source: trunk/hello-mod.s@ 24

Last change on this file since 24 was 24, checked in by Mattia Monga, 11 years ago

Esercizi lab 3

File size: 1.0 KB
Line 
1 .section .rodata
2.LC0:
3 .string "Hello world! (%d)\n"
4formato: /* la stringa di formato per la scanf */
5 .string "%d"
6
7 .data
8x: /* una variabile x */
9 .int
10
11 .text
12 .globl main
13 .type main, @function
14main:
15.LFB0:
16 .cfi_startproc
17 pushl %ebp
18 .cfi_def_cfa_offset 8
19 .cfi_offset 5, -8
20 movl %esp, %ebp
21 .cfi_def_cfa_register 5
22 andl $-16, %esp
23 subl $32, %esp
24 push $x /* oppure: movl $x, 4(%esp) */
25 push $formato /* oppure: movl $formato, (%esp) */
26 call scanf
27 subl $1, (x) /* da 0 a x-1 */
28 movl $0, 28(%esp)
29 jmp .L2
30.L3:
31 movl 28(%esp), %eax
32 addl $1, %eax
33 movl %eax, 4(%esp)
34 movl $.LC0, (%esp)
35 call printf
36 movl $1, (%esp)
37 call sleep
38 addl $1, 28(%esp)
39.L2:
40 movl (x), %eax /* compara con x */
41 cmpl %eax, 28(%esp)
42 jle .L3
43 movl $0, (%esp)
44 call exit
45 .cfi_endproc
46.LFE0:
47 .size main, .-main
48 .ident "GCC: (Debian 4.7.2-5) 4.7.2"
49 .section .note.GNU-stack,"",@progbits
Note: See TracBrowser for help on using the repository browser.