Guest User

Untitled

a guest
Jan 12th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .globl main
  2. .set TYPE_BOOL, 1
  3. .set TYPE_BOOL_FALSE, 1
  4. .set TYPE_BOOL_TRUE, 5
  5. .set TYPE_INT, 0
  6. .set SHIFT, 2
  7. .set MASK, 3
  8. main:
  9.         pushl %ebp
  10.         movl  %esp, %ebp
  11.  
  12.         movl $1,         %esi # esi = 1
  13.         sall $SHIFT,     %esi # esi = 4
  14.         orl  $TYPE_INT,  %esi # esi = 4 (1:TYPE_INT)
  15.  
  16.         movl $MASK,      %eax # eax = 3
  17.         andl %esi,       %eax # eax = 0 (TYPE_INT)
  18.  
  19.         cmpl $TYPE_BOOL, %eax # 1 >= 0
  20.         setge  %al            # al should be 1
  21.         movzbl %al, %ebx      # ebx should be 1
  22.  
  23.         pushl %ebx
  24.         call printnl_int      # prints 0! =(
  25.         addl $4, %esp
  26.  
  27.         movl $0, %eax
  28.         leave
  29.         ret
Add Comment
Please, Sign In to add comment