Advertisement
dllbridge

asm GAS no opti

Nov 29th, 2020
1,598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         .file   "cc2.c"
  2.         .intel_syntax noprefix
  3.         .globl  _x
  4.         .data
  5. _x:
  6.         .byte   45
  7.         .globl  _y
  8. _y:
  9.         .byte   50
  10.         .comm   _r_1, 2, 1
  11.         .comm   _r_2, 2, 1
  12.         .comm   _n, 4, 2
  13.         .def    ___main;        .scl    2;      .type   32;     .endef
  14.         .section .rdata,"dr"
  15. LC0:
  16.         .ascii "(x + y)/2 + (y * x)/30 = %d\12\0"
  17. LC1:
  18.         .ascii "%d\0"
  19.         .text
  20.         .globl  _main
  21.         .def    _main;  .scl    2;      .type   32;     .endef
  22. _main:
  23. LFB6:
  24.         .cfi_startproc
  25.         push    ebp
  26.         .cfi_def_cfa_offset 8
  27.         .cfi_offset 5, -8
  28.         mov     ebp, esp
  29.         .cfi_def_cfa_register 5
  30.         push    ebx
  31.         and     esp, -16
  32.         sub     esp, 16
  33.         .cfi_offset 3, -12
  34.         call    ___main
  35.         mov     al, BYTE PTR _x
  36.         movsx   dx, al
  37.         mov     al, BYTE PTR _y
  38.         cbw
  39.         add     eax, edx
  40.         mov     WORD PTR _r_1, ax
  41.         mov     ax, WORD PTR _r_1
  42.         mov     edx, eax
  43.         shr     dx, 15
  44.         add     eax, edx
  45.         sar     ax
  46.         mov     WORD PTR _r_1, ax
  47.         mov     al, BYTE PTR _x
  48.         movsx   dx, al
  49.         mov     al, BYTE PTR _y
  50.         cbw
  51.         imul    ax, dx
  52.         mov     WORD PTR _r_2, ax
  53.         mov     dx, WORD PTR _r_2
  54.         movsx   ecx, dx
  55.         mov     eax, ecx
  56.         sal     eax, 4
  57.         add     eax, ecx
  58.         mov     ebx, eax
  59.         sal     ebx, 8
  60.         add     eax, ebx
  61.         sal     eax, 3
  62.         add     eax, ecx
  63.         shr     eax, 16
  64.         sub     ax, dx
  65.         add     eax, edx
  66.         mov     ecx, eax
  67.         sar     cx, 4
  68.         mov     eax, edx
  69.         sar     ax, 15
  70.         mov     edx, ecx
  71.         sub     dx, ax
  72.         mov     eax, edx
  73.         mov     WORD PTR _r_2, ax
  74.         mov     ax, WORD PTR _r_1
  75.         movsx   edx, ax
  76.         mov     ax, WORD PTR _r_2
  77.         cwde
  78.         add     eax, edx
  79.         mov     DWORD PTR [esp+4], eax
  80.         mov     DWORD PTR [esp], OFFSET FLAT:LC0
  81.         call    _printf
  82.         mov     DWORD PTR [esp+4], OFFSET FLAT:_n
  83.         mov     DWORD PTR [esp], OFFSET FLAT:LC1
  84.         call    _scanf
  85.         mov     ebx, DWORD PTR [ebp-4]
  86.         leave
  87.         .cfi_restore 5
  88.         .cfi_def_cfa 4, 4
  89.         .cfi_restore 3
  90.         ret
  91.         .cfi_endproc
  92. LFE6:
  93.         .def    _printf;        .scl    2;      .type   32;     .endef
  94.         .def    _scanf; .scl    2;      .type   32;     .endef  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement