0 Replies - 619 Views - Last Post: 21 November 2019 - 05:56 PM Rate Topic: -----

#1 NoMoreWug   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-November 19

Need help with a function in x86

Posted 21 November 2019 - 05:56 PM

I'm currently doing my Binary Bomb project in school, and I am having trouble deciphering what is happening in this function. I can tell that it's a recursive function, but I can't tell what it's specifically adding and outputting at the end. The initial inputs will be %edi = 8 and %esi = user input between 2 and 4. Any help would be appreciated!

0000000000400fde <func4>:

400fde: push %r12

400fe0: push %rbp

400fe1: push %rbx

400fe2: %edi,%ebx

400fe4: test %edi,%edi

400fe6: jle 40100c <func4+0x2e>

400fe8: mov %esi,%ebp

400fea: mov %esi,%eax

400fec: cmp $0x1,%edi

400fef: je 401011 <func4+0x33>

400ff1: lea -0x1(%rdi),%edi

400ff4: callq 400fde <func4>

400ff9: lea (%rax,%rbp,1),%r12d

400ffd: lea -0x2(%rbx),%edi

401000: mov %ebp,%esi

401002: callq 400fde <func4>

401007: add %r12d,%eax

40100a: jmp 401011 <func4+0x33>

40100c: mov $0x0,%eax

401011: pop %rbx

401012: 5d pop %rbp

401013: 41 5c pop %r12

401015: c3 retq

Is This A Good Question/Topic? 0
  • +

Page 1 of 1