viewing paste Unknown #17384 | ASM

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
.file   "switch.c"
    .section    .rodata
.LC0:
    .string "%d\n\n"
    .text
    .globl  main
    .type   main, @function
main:
.LFB0:
    .cfi_startproc
    pushq   %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    subq    $16, %rsp
    movl    $5, -4(%rbp)
    movl    -4(%rbp), %eax
    cmpl    $5, %eax
    je  .L3
    cmpl    $6, %eax
    je  .L4
    cmpl    $4, %eax
    je  .L5
    addl    $10, -4(%rbp) ; here we add 10
.L4:
    subl    $10, -4(%rbp) ; here we subtract 10
.L3:
    addl    $1, -4(%rbp) ; here we add 1
.L5:
    subl    $2, -4(%rbp) ; here we subtract 2
    movl    -4(%rbp), %eax
    movl    %eax, %esi
    movl    $.LC0, %edi
    movl    $0, %eax
    call    printf
    movl    $0, %eax
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size   main, .-main
    .ident  "GCC: (GNU) 4.9.2 20150204 (prerelease)"
    .section    .note.GNU-stack,"",@progbits
Viewed 593 times, submitted by Guest.