1/* This testcase is part of GDB, the GNU debugger.
2
3   Copyright (C) 2015-2024 Free Software Foundation, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18   This file was created with gcc -O2 -g -S -fverbose-asm -dA disasm-optim.c
19   and then cleaning up the output.  */
20
21          .file     "disasm-optim.c"
22
23          .text
24          .p2align 4,,15
25          .globl    main
26          .type     main, @function
27main:
28.LFB1:
29          .file 1 "disasm-optim.c"
30          # disasm-optim.c:24
31          .loc 1 24 0
32          .cfi_startproc
33          # disasm-optim.c:25
34          .loc 1 25 0
35          movl      y(%rip), %eax
36.LVL0:
37.LBB4:
38.LBB5:
39          .file 2 "disasm-optim.h"
40          # disasm-optim.h:21
41          .loc 2 21 0
42          testl     %eax, %eax
43          js        .L6
44          # disasm-optim.h:25
45          .loc 2 25 0
46          leal      10(%rax), %edx
47          testl     %eax, %eax
48          movl      $1, %eax
49.LVL1:
50          cmovne    %edx, %eax
51.LVL2:
52.L3:
53.LBE5:
54.LBE4:
55          # disasm-optim.c:25
56          .loc 1 25 0
57          movl      %eax, x(%rip)
58          # disasm-optim.c:27
59          .loc 1 27 0
60          xorl      %eax, %eax
61          ret
62.LVL3:
63.L6:
64.LBB7:
65.LBB6:
66          # disasm-optim.h:22
67          .loc 2 22 0
68          addl      %eax, %eax
69.LVL4:
70          jmp       .L3
71.LBE6:
72.LBE7:
73          .cfi_endproc
74.LFE1:
75          .size     main, .-main
76          .comm     y,4,4
77          .comm     x,4,4
78          .text
79.Letext0:
80          .section  .debug_info,"",@progbits
81.Ldebug_info0:
82          .long     0xb1      # Length of Compilation Unit Info
83          .value    0x4       # DWARF version number
84          .long     .Ldebug_abbrev0     # Offset Into Abbrev. Section
85          .byte     0x8       # Pointer Size (in bytes)
86          .uleb128 0x1        # (DIE (0xb) DW_TAG_compile_unit)
87          .long     .LASF0    # DW_AT_producer: "GNU C 4.9.2 20150212 (Red Hat 4.9.2-6) -mtune=generic -march=x86-64 -g -O2"
88          .byte     0x1       # DW_AT_language
89          .long     .LASF1    # DW_AT_name: "disasm-optim.c"
90          .long     .LASF2    # DW_AT_comp_dir: "/main/disassemble3/gdb/testsuite/gdb.base"
91          .long     .Ldebug_ranges0+0x30          # DW_AT_ranges
92          .quad     0         # DW_AT_low_pc
93          .long     .Ldebug_line0       # DW_AT_stmt_list
94          .uleb128 0x2        # (DIE (0x29) DW_TAG_subprogram)
95                              # DW_AT_external
96          .ascii "foo\0"      # DW_AT_name
97          .byte     0x2       # DW_AT_decl_file (disasm-optim.h)
98          .byte     0x13      # DW_AT_decl_line
99                              # DW_AT_prototyped
100          .long     0x43      # DW_AT_type
101          .byte     0x3       # DW_AT_inline
102          .long     0x43      # DW_AT_sibling
103          .uleb128 0x3        # (DIE (0x39) DW_TAG_formal_parameter)
104          .ascii "a\0"        # DW_AT_name
105          .byte     0x2       # DW_AT_decl_file (disasm-optim.h)
106          .byte     0x13      # DW_AT_decl_line
107          .long     0x43      # DW_AT_type
108          .byte     0         # end of children of DIE 0x29
109          .uleb128 0x4        # (DIE (0x43) DW_TAG_base_type)
110          .byte     0x4       # DW_AT_byte_size
111          .byte     0x5       # DW_AT_encoding
112          .ascii "int\0"      # DW_AT_name
113          .uleb128 0x5        # (DIE (0x4a) DW_TAG_subprogram)
114                              # DW_AT_external
115          .long     .LASF3    # DW_AT_name: "main"
116          .byte     0x1       # DW_AT_decl_file (disasm-optim.c)
117          .byte     0x17      # DW_AT_decl_line
118          .long     0x43      # DW_AT_type
119          .quad     .LFB1     # DW_AT_low_pc
120          .quad     .LFE1-.LFB1         # DW_AT_high_pc
121          .uleb128 0x1        # DW_AT_frame_base
122          .byte     0x9c      # DW_OP_call_frame_cfa
123                              # DW_AT_GNU_all_call_sites
124          .long     0x89      # DW_AT_sibling
125          .uleb128 0x6        # (DIE (0x6b) DW_TAG_inlined_subroutine)
126          .long     0x29      # DW_AT_abstract_origin
127          .quad     .LBB4     # DW_AT_entry_pc
128          .long     .Ldebug_ranges0+0   # DW_AT_ranges
129          .byte     0x1       # DW_AT_call_file (disasm-optim.c)
130          .byte     0x19      # DW_AT_call_line
131          .uleb128 0x7        # (DIE (0x7e) DW_TAG_formal_parameter)
132          .long     0x39      # DW_AT_abstract_origin
133          .long     .LLST0    # DW_AT_location
134          .byte     0         # end of children of DIE 0x6b
135          .byte     0         # end of children of DIE 0x4a
136          .uleb128 0x8        # (DIE (0x89) DW_TAG_variable)
137          .ascii "x\0"        # DW_AT_name
138          .byte     0x1       # DW_AT_decl_file (disasm-optim.c)
139          .byte     0x14      # DW_AT_decl_line
140          .long     0x9c      # DW_AT_type
141                              # DW_AT_external
142          .uleb128 0x9        # DW_AT_location
143          .byte     0x3       # DW_OP_addr
144          .quad     x
145          .uleb128 0x9        # (DIE (0x9c) DW_TAG_volatile_type)
146          .long     0x43      # DW_AT_type
147          .uleb128 0x8        # (DIE (0xa1) DW_TAG_variable)
148          .ascii "y\0"        # DW_AT_name
149          .byte     0x1       # DW_AT_decl_file (disasm-optim.c)
150          .byte     0x14      # DW_AT_decl_line
151          .long     0x9c      # DW_AT_type
152                              # DW_AT_external
153          .uleb128 0x9        # DW_AT_location
154          .byte     0x3       # DW_OP_addr
155          .quad     y
156          .byte     0         # end of children of DIE 0xb
157          .section  .debug_abbrev,"",@progbits
158.Ldebug_abbrev0:
159          .uleb128 0x1        # (abbrev code)
160          .uleb128 0x11       # (TAG: DW_TAG_compile_unit)
161          .byte     0x1       # DW_children_yes
162          .uleb128 0x25       # (DW_AT_producer)
163          .uleb128 0xe        # (DW_FORM_strp)
164          .uleb128 0x13       # (DW_AT_language)
165          .uleb128 0xb        # (DW_FORM_data1)
166          .uleb128 0x3        # (DW_AT_name)
167          .uleb128 0xe        # (DW_FORM_strp)
168          .uleb128 0x1b       # (DW_AT_comp_dir)
169          .uleb128 0xe        # (DW_FORM_strp)
170          .uleb128 0x55       # (DW_AT_ranges)
171          .uleb128 0x17       # (DW_FORM_sec_offset)
172          .uleb128 0x11       # (DW_AT_low_pc)
173          .uleb128 0x1        # (DW_FORM_addr)
174          .uleb128 0x10       # (DW_AT_stmt_list)
175          .uleb128 0x17       # (DW_FORM_sec_offset)
176          .byte     0
177          .byte     0
178          .uleb128 0x2        # (abbrev code)
179          .uleb128 0x2e       # (TAG: DW_TAG_subprogram)
180          .byte     0x1       # DW_children_yes
181          .uleb128 0x3f       # (DW_AT_external)
182          .uleb128 0x19       # (DW_FORM_flag_present)
183          .uleb128 0x3        # (DW_AT_name)
184          .uleb128 0x8        # (DW_FORM_string)
185          .uleb128 0x3a       # (DW_AT_decl_file)
186          .uleb128 0xb        # (DW_FORM_data1)
187          .uleb128 0x3b       # (DW_AT_decl_line)
188          .uleb128 0xb        # (DW_FORM_data1)
189          .uleb128 0x27       # (DW_AT_prototyped)
190          .uleb128 0x19       # (DW_FORM_flag_present)
191          .uleb128 0x49       # (DW_AT_type)
192          .uleb128 0x13       # (DW_FORM_ref4)
193          .uleb128 0x20       # (DW_AT_inline)
194          .uleb128 0xb        # (DW_FORM_data1)
195          .uleb128 0x1        # (DW_AT_sibling)
196          .uleb128 0x13       # (DW_FORM_ref4)
197          .byte     0
198          .byte     0
199          .uleb128 0x3        # (abbrev code)
200          .uleb128 0x5        # (TAG: DW_TAG_formal_parameter)
201          .byte     0         # DW_children_no
202          .uleb128 0x3        # (DW_AT_name)
203          .uleb128 0x8        # (DW_FORM_string)
204          .uleb128 0x3a       # (DW_AT_decl_file)
205          .uleb128 0xb        # (DW_FORM_data1)
206          .uleb128 0x3b       # (DW_AT_decl_line)
207          .uleb128 0xb        # (DW_FORM_data1)
208          .uleb128 0x49       # (DW_AT_type)
209          .uleb128 0x13       # (DW_FORM_ref4)
210          .byte     0
211          .byte     0
212          .uleb128 0x4        # (abbrev code)
213          .uleb128 0x24       # (TAG: DW_TAG_base_type)
214          .byte     0         # DW_children_no
215          .uleb128 0xb        # (DW_AT_byte_size)
216          .uleb128 0xb        # (DW_FORM_data1)
217          .uleb128 0x3e       # (DW_AT_encoding)
218          .uleb128 0xb        # (DW_FORM_data1)
219          .uleb128 0x3        # (DW_AT_name)
220          .uleb128 0x8        # (DW_FORM_string)
221          .byte     0
222          .byte     0
223          .uleb128 0x5        # (abbrev code)
224          .uleb128 0x2e       # (TAG: DW_TAG_subprogram)
225          .byte     0x1       # DW_children_yes
226          .uleb128 0x3f       # (DW_AT_external)
227          .uleb128 0x19       # (DW_FORM_flag_present)
228          .uleb128 0x3        # (DW_AT_name)
229          .uleb128 0xe        # (DW_FORM_strp)
230          .uleb128 0x3a       # (DW_AT_decl_file)
231          .uleb128 0xb        # (DW_FORM_data1)
232          .uleb128 0x3b       # (DW_AT_decl_line)
233          .uleb128 0xb        # (DW_FORM_data1)
234          .uleb128 0x49       # (DW_AT_type)
235          .uleb128 0x13       # (DW_FORM_ref4)
236          .uleb128 0x11       # (DW_AT_low_pc)
237          .uleb128 0x1        # (DW_FORM_addr)
238          .uleb128 0x12       # (DW_AT_high_pc)
239          .uleb128 0x7        # (DW_FORM_data8)
240          .uleb128 0x40       # (DW_AT_frame_base)
241          .uleb128 0x18       # (DW_FORM_exprloc)
242          .uleb128 0x2117     # (DW_AT_GNU_all_call_sites)
243          .uleb128 0x19       # (DW_FORM_flag_present)
244          .uleb128 0x1        # (DW_AT_sibling)
245          .uleb128 0x13       # (DW_FORM_ref4)
246          .byte     0
247          .byte     0
248          .uleb128 0x6        # (abbrev code)
249          .uleb128 0x1d       # (TAG: DW_TAG_inlined_subroutine)
250          .byte     0x1       # DW_children_yes
251          .uleb128 0x31       # (DW_AT_abstract_origin)
252          .uleb128 0x13       # (DW_FORM_ref4)
253          .uleb128 0x52       # (DW_AT_entry_pc)
254          .uleb128 0x1        # (DW_FORM_addr)
255          .uleb128 0x55       # (DW_AT_ranges)
256          .uleb128 0x17       # (DW_FORM_sec_offset)
257          .uleb128 0x58       # (DW_AT_call_file)
258          .uleb128 0xb        # (DW_FORM_data1)
259          .uleb128 0x59       # (DW_AT_call_line)
260          .uleb128 0xb        # (DW_FORM_data1)
261          .byte     0
262          .byte     0
263          .uleb128 0x7        # (abbrev code)
264          .uleb128 0x5        # (TAG: DW_TAG_formal_parameter)
265          .byte     0         # DW_children_no
266          .uleb128 0x31       # (DW_AT_abstract_origin)
267          .uleb128 0x13       # (DW_FORM_ref4)
268          .uleb128 0x2        # (DW_AT_location)
269          .uleb128 0x17       # (DW_FORM_sec_offset)
270          .byte     0
271          .byte     0
272          .uleb128 0x8        # (abbrev code)
273          .uleb128 0x34       # (TAG: DW_TAG_variable)
274          .byte     0         # DW_children_no
275          .uleb128 0x3        # (DW_AT_name)
276          .uleb128 0x8        # (DW_FORM_string)
277          .uleb128 0x3a       # (DW_AT_decl_file)
278          .uleb128 0xb        # (DW_FORM_data1)
279          .uleb128 0x3b       # (DW_AT_decl_line)
280          .uleb128 0xb        # (DW_FORM_data1)
281          .uleb128 0x49       # (DW_AT_type)
282          .uleb128 0x13       # (DW_FORM_ref4)
283          .uleb128 0x3f       # (DW_AT_external)
284          .uleb128 0x19       # (DW_FORM_flag_present)
285          .uleb128 0x2        # (DW_AT_location)
286          .uleb128 0x18       # (DW_FORM_exprloc)
287          .byte     0
288          .byte     0
289          .uleb128 0x9        # (abbrev code)
290          .uleb128 0x35       # (TAG: DW_TAG_volatile_type)
291          .byte     0         # DW_children_no
292          .uleb128 0x49       # (DW_AT_type)
293          .uleb128 0x13       # (DW_FORM_ref4)
294          .byte     0
295          .byte     0
296          .byte     0
297          .section  .debug_loc,"",@progbits
298.Ldebug_loc0:
299.LLST0:
300          .quad     .LVL0     # Location list begin address (*.LLST0)
301          .quad     .LVL1     # Location list end address (*.LLST0)
302          .value    0x1       # Location expression size
303          .byte     0x50      # DW_OP_reg0
304          .quad     .LVL1     # Location list begin address (*.LLST0)
305          .quad     .LVL2     # Location list end address (*.LLST0)
306          .value    0x3       # Location expression size
307          .byte     0x71      # DW_OP_breg1
308          .sleb128 -10
309          .byte     0x9f      # DW_OP_stack_value
310          .quad     .LVL3     # Location list begin address (*.LLST0)
311          .quad     .LVL4     # Location list end address (*.LLST0)
312          .value    0x1       # Location expression size
313          .byte     0x50      # DW_OP_reg0
314          .quad     0         # Location list terminator begin (*.LLST0)
315          .quad     0         # Location list terminator end (*.LLST0)
316          .section  .debug_aranges,"",@progbits
317          .long     0x2c      # Length of Address Ranges Info
318          .value    0x2       # DWARF Version
319          .long     .Ldebug_info0       # Offset of Compilation Unit Info
320          .byte     0x8       # Size of Address
321          .byte     0         # Size of Segment Descriptor
322          .value    0         # Pad to 16 byte boundary
323          .value    0
324          .quad     .LFB1     # Address
325          .quad     .LFE1-.LFB1         # Length
326          .quad     0
327          .quad     0
328          .section  .debug_ranges,"",@progbits
329.Ldebug_ranges0:
330          .quad     .LBB4     # Offset 0
331          .quad     .LBE4
332          .quad     .LBB7
333          .quad     .LBE7
334          .quad     0
335          .quad     0
336          .quad     .LFB1     # Offset 0x30
337          .quad     .LFE1
338          .quad     0
339          .quad     0
340          .section  .debug_line,"",@progbits
341.Ldebug_line0:
342          .section  .debug_str,"MS",@progbits,1
343.LASF2:
344          .string   "/main/disassemble3/gdb/testsuite/gdb.base"
345.LASF1:
346          .string   "disasm-optim.c"
347.LASF3:
348          .string   "main"
349.LASF0:
350          .string   "GNU C 4.9.2 20150212 (Red Hat 4.9.2-6) -mtune=generic -march=x86-64 -g -O2"
351          .ident    "GCC: (GNU) 4.9.2 20150212 (Red Hat 4.9.2-6)"
352          .section  .note.GNU-stack,"",@progbits
353