Skip to content

Instantly share code, notes, and snippets.

@b4284
Created March 23, 2017 14:53
Show Gist options
  • Select an option

  • Save b4284/4b1cff52d87860b443a83fef093eea63 to your computer and use it in GitHub Desktop.

Select an option

Save b4284/4b1cff52d87860b443a83fef093eea63 to your computer and use it in GitHub Desktop.
int swit(int num)
{
switch (num) {
case 0xA1:
case 0xA2:
case 0xA3:
case 0xA4:
case 0xB2:
case 0xB3:
case 0xB4:
case 0xC5:
return 0;
default:
return -1;
}
}
/*
* 0000000000000000 <swit>:
* 0: 55 push %rbp
* 1: 48 89 e5 mov %rsp,%rbp
* 4: 89 7d fc mov %edi,-0x4(%rbp)
* 7: 8b 45 fc mov -0x4(%rbp),%eax
* a: 2d a1 00 00 00 sub $0xa1,%eax
* f: 83 f8 24 cmp $0x24,%eax
* 12: 77 13 ja 27 <swit+0x27>
* 14: 89 c0 mov %eax,%eax
* 16: 48 8b 04 c5 00 00 00 mov 0x0(,%rax,8),%rax
* 1d: 00
* 1e: ff e0 jmpq *%rax
* 20: b8 00 00 00 00 mov $0x0,%eax
* 25: eb 05 jmp 2c <swit+0x2c>
* 27: b8 ff ff ff ff mov $0xffffffff,%eax
* 2c: 5d pop %rbp
* 2d: c3 retq
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment