.file "add.c" .def __main; .scl 2; .type 32; .endef .section .rdata,"dr" .LC0: .ascii "Usage: %s \12\0" .LC1: .ascii "Sum 1+2+3+...+%d = %d\12\0" .text .globl main .def main; .scl 2; .type 32; .endef .seh_proc main main: pushq %rbp .seh_pushreg %rbp movq %rsp, %rbp .seh_setframe %rbp, 0 subq $48, %rsp .seh_stackalloc 48 .seh_endprologue movl %ecx, 16(%rbp) movq %rdx, 24(%rbp) call __main cmpl $2, 16(%rbp) je .L2 movq 24(%rbp), %rax movq (%rax), %rax movq %rax, %rdx leaq .LC0(%rip), %rcx call printf movl $0, %ecx call exit .L2: movq 24(%rbp), %rax addq $8, %rax movq (%rax), %rax movq %rax, %rcx call atoi movl %eax, -12(%rbp) movl $0, -4(%rbp) movl $1, -8(%rbp) jmp .L3 .L4: movl -8(%rbp), %eax addl %eax, -4(%rbp) addl $1, -8(%rbp) .L3: movl -8(%rbp), %eax cmpl -12(%rbp), %eax jle .L4 movl -4(%rbp), %edx movl -12(%rbp), %eax movl %edx, %r8d movl %eax, %edx leaq .LC1(%rip), %rcx call printf movl $0, %eax addq $48, %rsp popq %rbp ret .seh_endproc .ident "GCC: (GNU) 6.4.0" .def printf; .scl 2; .type 32; .endef .def exit; .scl 2; .type 32; .endef .def atoi; .scl 2; .type 32; .endef