// File: /workspace/github_c_makefile_star2_O1/mabdi[P]bunney/bunny-exec.c
// Function: handle_process
static void handle_process(_u8* path, _u8** argv) {

  struct bunny_message m;

  orig_pid = vfork();
  if (orig_pid < 0) fatal("unable to spawn a process");

  if (!orig_pid) {  
    execvp(path,(char**)argv);
    pfatal("unable to execute '%s'",path);
  }

  while (!read_shm(&m,sizeof(m))) {

    switch (m.type) {

      case MESSAGE_ENTER: {
          char fname[MAXTOKEN];
          if (m.data_len > MAXTOKEN - 1) fatal("excessively long function name");
          if (read_shm(fname,m.data_len)) goto handle_bailout;
          fname[m.data_len]=0;
          register_call(m.pid, fname, m.value);
        }
        break;

      case MESSAGE_PARAM:
        register_param(m.pid, m.value);
        break;

      case MESSAGE_LEAVE:
        register_return(m.pid, m.value);
        break;

      case MESSAGE_SPOT:
        register_spot(m.pid, m.value);
        break;


      default: fatal("malformed data from traced process (0x%08x)",m.type);

    }

  }

handle_bailout:

  finalize();
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1068, %rsp           # imm = 0x1068
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1180
movl %eax, 0x3348(%rip)      # 0x519c
testl %eax, %eax
js 0x2482
je 0x2487
leaq 0x4(%rsp), %rdi
movl $0x10, %esi
callq 0x25ed
testb %al, %al
jne 0x21b1
leaq 0x1184(%rip), %r15      # 0x3004
leaq 0x60(%rsp), %r12
xorl %eax, %eax
movq %rax, 0x20(%rsp)
leaq 0x4(%rsp), %r13
movl $0x10, %ebp
movl 0x8(%rsp), %edi
movl %edi, %eax
addl $0x3ffefff0, %eax       # imm = 0x3FFEFFF0
roll $0x1c, %eax
cmpl $0x3, %eax
ja 0x2473
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movl 0x10(%rsp), %eax
movl %eax, %ebx
cmpq $0x1000, %rbx           # imm = 0x1000
jae 0x2478
movl %ebx, %esi
movq %r12, %rdi
callq 0x25ed
testb %al, %al
jne 0x21b1
movl %eax, %r14d
movb $0x0, 0x60(%rsp,%rbx)
movl 0x4(%rsp), %edi
movl $0x1, %esi
callq 0x290a
movl %eax, %ebp
movq %r12, %rdi
callq 0x1220
testq %rax, %rax
je 0x247d
movq %rax, %rbx
movq 0x329a(%rip), %r12      # 0x51a8
movslq %ebp, %rbp
shlq $0x6, %rbp
leaq (%r12,%rbp), %r13
addq $0x10, %r13
movl 0x8(%r13), %eax
testb $0x7f, %al
jne 0x1f46
movq (%r13), %rdi
addl $0x82, %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x1210
movq %rax, (%r13)
testq %rax, %rax
je 0x24ab
movq (%r13), %rax
movl 0x8(%r13), %ecx
movl %ecx, %edx
incl %edx
movl %edx, 0x8(%r13)
movq %rbx, (%rax,%rcx,8)
movq (%r13), %rax
movl %edx, %ecx
movq $0x0, (%rax,%rcx,8)
leaq (%r12,%rbp), %rbx
addq $0x20, %rbx
movl 0x8(%rbx), %eax
testb $0x7f, %al
jne 0x1f96
movq (%rbx), %rdi
addl $0x81, %eax
movl %eax, %esi
shlq $0x2, %rsi
callq 0x1210
movq %rax, (%rbx)
testq %rax, %rax
je 0x24b0
movl 0x8(%r12,%rbp), %eax
movq (%rbx), %rcx
movl 0x8(%rbx), %edx
movl %edx, %esi
incl %esi
movl %esi, 0x8(%rbx)
movl %eax, (%rcx,%rdx,4)
incl 0x8(%r12,%rbp)
incl 0x4(%r12,%rbp)
leaq 0x31b4(%rip), %rdi      # 0x5170
movq 0x20(%rsp), %rsi
callq 0x1200
incl 0x31ec(%rip)            # 0x51b8
testb %r14b, %r14b
leaq 0x60(%rsp), %r12
leaq 0x4(%rsp), %r13
movl $0x10, %ebp
je 0x219f
jmp 0x21b1
movl 0x4(%rsp), %edi
movl 0xc(%rsp), %ebx
movl $0x1, %esi
callq 0x290a
movq 0x31a6(%rip), %r14      # 0x51a8
movl %eax, %eax
movl %eax, %r12d
shlq $0x6, %r12
leaq (%r14,%r12), %rbp
addq $0x10, %rbp
decl -0x8(%rbp)
movl 0x8(%rbp), %eax
testb $0x7f, %al
jne 0x203e
movq (%rbp), %rdi
addl $0x82, %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x1210
movq %rax, (%rbp)
testq %rax, %rax
je 0x24a1
movq (%rbp), %rax
movl 0x8(%rbp), %ecx
movl %ecx, %edx
incl %edx
movl %edx, 0x8(%rbp)
xorl %esi, %esi
movq %rsi, (%rax,%rcx,8)
movq (%rbp), %rax
movl %edx, %ecx
movq %rsi, (%rax,%rcx,8)
leaq (%r14,%r12), %r13
addq $0x20, %r13
movl 0x8(%r13), %eax
testb $0x7f, %al
jne 0x208d
movq (%r13), %rdi
addl $0x81, %eax
movl %eax, %esi
shlq $0x2, %rsi
callq 0x1210
movq %rax, (%r13)
testq %rax, %rax
je 0x249c
addq %r12, %r14
addq $0x8, %r14
movl (%r14), %eax
movq (%r13), %rcx
movl 0x8(%r13), %edx
movl %edx, %esi
incl %esi
movl %esi, 0x8(%r13)
movl %eax, (%rcx,%rdx,4)
movl 0x30(%r14), %eax
testb $0x7f, %al
movl $0x10, %ebp
jne 0x20d8
movq 0x28(%r14), %rdi
addl $0x81, %eax
movl %eax, %esi
shlq $0x2, %rsi
callq 0x1210
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x2497
movq 0x28(%r14), %rax
movl 0x30(%r14), %ecx
movl %ecx, %edx
incl %edx
movl %edx, 0x30(%r14)
movl %ebx, (%rax,%rcx,4)
leaq 0x60(%rsp), %r12
leaq 0x4(%rsp), %r13
jmp 0x219f
movl 0x4(%rsp), %edi
movl 0xc(%rsp), %esi
callq 0x26f0
jmp 0x219f
movl 0x4(%rsp), %edi
movl 0x308a(%rip), %eax      # 0x51a0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x2145
movq 0x307f(%rip), %rdx      # 0x51a8
xorl %esi, %esi
cmpl %edi, (%rdx)
je 0x2143
movq %rsi, %r8
incq %r8
addq $0x40, %rdx
movq %r8, %rsi
cmpq %r8, %rcx
jne 0x212b
jmp 0x2145
movl %esi, %eax
testl %eax, %eax
js 0x246e
movl 0xc(%rsp), %ebx
movq 0x3050(%rip), %rcx      # 0x51a8
movl %eax, %eax
shlq $0x6, %rax
leaq (%rcx,%rax), %r14
addq $0x30, %r14
movl 0x8(%r14), %eax
testb $0x7f, %al
jne 0x218d
movq (%r14), %rdi
addl $0x81, %eax
movl %eax, %esi
shlq $0x2, %rsi
callq 0x1210
movq %rax, (%r14)
testq %rax, %rax
je 0x24a6
movq (%r14), %rax
movl 0x8(%r14), %ecx
movl %ecx, %edx
incl %edx
movl %edx, 0x8(%r14)
movl %ebx, (%rax,%rcx,4)
movq %r13, %rdi
movl %ebp, %esi
callq 0x25ed
testb %al, %al
je 0x1e96
movb 0x2fe3(%rip), %al       # 0x519a
movb %al, 0x28(%rsp)
movl 0x2fdf(%rip), %eax      # 0x51a0
movl %eax, 0x3c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x1080
xorl %eax, %eax
cmpl $0x0, 0x2fc8(%rip)      # 0x51a0
je 0x2296
xorl %ecx, %ecx
movl %ecx, %r12d
leaq 0x60(%rsp), %rbx
movl $0x4, %r14d
movl %ecx, 0x14(%rsp)
movq 0x2faf(%rip), %rax      # 0x51a8
movq %r12, %r13
shlq $0x6, %r13
cmpl $0x0, 0x18(%rax,%r13)
je 0x2271
xorl %ecx, %ecx
movl %ecx, %ebp
movq %rax, %rcx
movq 0x10(%rcx,%r13), %rax
movq (%rax,%rbp,8), %r15
testq %r15, %r15
je 0x2233
movq %r15, %rdi
callq 0x1050
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1240
movq 0x2f6e(%rip), %rax      # 0x51a8
leaq (,%rbp,4), %rsi
addq 0x20(%rax,%r13), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x1240
movq %rbp, %rdx
incq %rdx
movq 0x2f49(%rip), %rcx      # 0x51a8
movl 0x18(%rcx,%r13), %eax
movl %eax, %esi
movq %rdx, %rbp
movq %rcx, %rax
cmpq %rsi, %rdx
jb 0x220f
movl 0x14(%rsp), %ecx
addl 0x4(%rax,%r13), %ecx
movq %r12, %rdx
incq %rdx
movl 0x2f1a(%rip), %eax      # 0x51a0
movl %eax, %esi
movq %rdx, %r12
movl %ecx, %eax
cmpq %rsi, %rdx
jb 0x21ee
movl %eax, %ebp
leaq 0x50(%rsp), %rbx
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x1150
movq (%rbx), %rax
movq %rax, 0x30(%rsp)
movl %ebp, 0x40(%rsp)
movl 0x2ee4(%rip), %eax      # 0x51a0
movl %eax, %ecx
xorl %esi, %esi
testq %rcx, %rcx
je 0x22e9
movq 0x2edc(%rip), %rax      # 0x51a8
shlq $0x6, %rcx
xorl %edi, %edi
movl %edi, %edx
addl 0x38(%rax,%rdx), %edi
movq %rdx, %r8
addq $0x40, %r8
movq %r8, %rdx
movl %edi, %esi
cmpq %r8, %rcx
jne 0x22d4
movl %esi, 0x44(%rsp)
movl $0x0, 0x48(%rsp)
xorl %esi, %esi
movq 0x2e92(%rip), %rax      # 0x5190
movl %esi, %ecx
movl %esi, %edx
cmpl $0x0, 0x14(%rax,%rcx,4)
jns 0x230d
subl 0x14(%rax,%rcx,4), %edx
movq %rcx, %rdi
incq %rdi
movq %rdi, %rcx
movl %edx, %esi
cmpq $0x10, %rdi
jne 0x2300
movl %edx, 0x48(%rsp)
movq 0x2e97(%rip), %rdi      # 0x51c0
xorl %eax, %eax
testq %rdi, %rdi
je 0x233e
testb $0x7, 0x2e63(%rip)      # 0x519a
je 0x233e
callq 0x1050
leaq 0x28(%rsp), %rsi
movl %eax, 0x10(%rsi)
movl $0x28, %edx
movl $0x63, %edi
callq 0x1040
cmpq $0x28, %rax
jne 0x2492
movl 0x38(%rsp), %eax
movl %eax, %ebx
testq %rbx, %rbx
je 0x2387
movq 0x2e4f(%rip), %rsi      # 0x51c0
movl $0x63, %edi
movq %rbx, %rdx
callq 0x1040
cmpq %rbx, %rax
jne 0x24b5
cmpl $0x0, 0x2e12(%rip)      # 0x51a0
je 0x2455
xorl %eax, %eax
movl $0x63, %ebx
movq %rax, %rdx
movq 0x2e03(%rip), %rax      # 0x51a8
movq %rdx, %r12
shlq $0x6, %r12
movl 0x38(%rax,%r12), %ecx
testl %ecx, %ecx
je 0x243b
movq %rdx, 0x18(%rsp)
addq %r12, %rax
addq $0x30, %rax
movq (%rax), %r14
shll $0x2, %ecx
xorl %r15d, %r15d
movl %ecx, %r13d
movl %eax, %ebp
movl %r13d, %eax
movl %eax, %edx
movl %ebx, %edi
movq %r14, %rsi
callq 0x1040
movl %eax, %ecx
testl %eax, %eax
jle 0x2400
addl %ecx, %r15d
subl %ecx, %r13d
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %r14
movl %r13d, %edx
movl %r15d, %esi
movl %ebp, %eax
jmp 0x2408
movl %r13d, %edx
movl %r15d, %esi
movl %ecx, %eax
testl %ecx, %ecx
jle 0x2418
movl %edx, %r13d
movl %esi, %r15d
testl %edx, %edx
jne 0x23d1
jmp 0x241a
movl %eax, %esi
movslq %esi, %rcx
movq 0x2d84(%rip), %rax      # 0x51a8
movl 0x38(%rax,%r12), %eax
leaq (,%rax,4), %rdx
cmpq %rcx, %rdx
movq 0x18(%rsp), %rdx
jne 0x2467
movq %rdx, %rcx
incq %rcx
movl 0x2d59(%rip), %eax      # 0x51a0
movl %eax, %edx
movq %rcx, %rax
cmpq %rdx, %rcx
jb 0x239b
addq $0x1068, %rsp           # imm = 0x1068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x1524
callq 0x1448
callq 0x168e
callq 0x1644
callq 0x15fc
callq 0x1736
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16d6
callq 0x1490
callq 0x1320
callq 0x136a
callq 0x13b4
callq 0x13fe
callq 0x15b4
callq 0x156c
callq 0x14da