// File: /workspace/github_c_makefile_star2_O1/mabdi[P]bunney/bunny-trace.c
// Function: handle_process
static void handle_process(_u8* path, _u8** argv) {
  struct bunny_message m;
  
  orig_pid = fork();
  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)) fatal("unable to read function name from process");
	  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);
      
    }    

  }
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1040
movl %eax, 0x362b(%rip)      # 0x5138
testl %eax, %eax
js 0x1fc7
je 0x1fcc
leaq 0x10(%rsp), %rdi
movl $0x10, %esi
callq 0x2067
testb %al, %al
jne 0x1f6c
movl 0x14(%rsp), %edi
leal 0x3ffefff0(%rdi), %eax
roll $0x1c, %eax
cmpl $0x3, %eax
ja 0x1fa5
leaq 0x14b5(%rip), %rcx      # 0x3004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x1c(%rsp), %r13d
cmpq $0x1000, %r13           # imm = 0x1000
jae 0x1faa
leaq 0x20(%rsp), %rdi
movl %r13d, %esi
callq 0x2067
testb %al, %al
jne 0x1f98
movb $0x0, 0x20(%rsp,%r13)
movl 0x10(%rsp), %edi
movl 0x18(%rsp), %ebp
movl %edi, 0xc(%rsp)
movl $0x1, %esi
callq 0x228f
movq 0x359e(%rip), %r15      # 0x5140
movslq %eax, %r14
leaq (%r14,%r14,4), %r12
cmpq $0x0, 0x10(%r15,%r12,8)
jne 0x1faf
leaq (%r15,%r12,8), %rbx
movl %ebp, 0x4(%rbx)
cmpl $0x0, 0x20(%rbx)
je 0x1be2
xorl %r13d, %r13d
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x1bd7
callq 0x1130
incq %r13
movl 0x20(%rbx), %eax
cmpq %rax, %r13
jb 0x1bc5
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x1bf0
callq 0x1130
movq $0x0, 0x18(%rbx)
movl $0x0, 0x20(%rbx)
testl %ebp, %ebp
je 0x1d57
leaq 0x20(%rsp), %rdi
callq 0x11d0
movq %rax, 0x10(%r15,%r12,8)
testq %rax, %rax
jne 0x1b1b
jmp 0x1fbd
movl 0x10(%rsp), %r13d
movl 0x18(%rsp), %ebp
movl %r13d, %edi
movl $0x1, %esi
callq 0x228f
movq 0x34ff(%rip), %rcx      # 0x5140
cltq
leaq (%rax,%rax,4), %rax
cmpq $0x0, 0x10(%rcx,%rax,8)
jne 0x1f8b
leaq (%rcx,%rax,8), %rax
decl 0x8(%rax)
movl 0x8(%rax), %esi
movl %r13d, %edi
xorl %edx, %edx
callq 0x232b
movq 0x34b2(%rip), %r13      # 0x5120
movl %ebp, %edi
callq 0x2398
movq %r13, %rdi
leaq 0x1993(%rip), %rsi      # 0x3612
jmp 0x1d44
movl 0x10(%rsp), %edi
movl 0x34ae(%rip), %eax      # 0x513c
testq %rax, %rax
je 0x1cec
movq 0x34a6(%rip), %rdx      # 0x5140
xorl %ecx, %ecx
cmpl %edi, (%rdx)
je 0x1cee
incq %rcx
addq $0x28, %rdx
cmpq %rcx, %rax
jne 0x1c9c
movl %eax, %ecx
jmp 0x1cee
movl 0x10(%rsp), %r13d
movl 0x3481(%rip), %ecx      # 0x513c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x1d9b
movq 0x3470(%rip), %rdx      # 0x5140
xorl %esi, %esi
cmpl %r13d, (%rdx)
je 0x1d99
incq %rsi
addq $0x28, %rdx
cmpq %rsi, %rcx
jne 0x1cd2
jmp 0x1d9b
xorl %ecx, %ecx
cmpl %eax, %ecx
je 0x1fb8
movq 0x3443(%rip), %rax      # 0x5140
movl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
cmpq $0x0, 0x10(%rax,%rcx,8)
jne 0x1f7e
leaq (%rax,%rcx,8), %rax
movl 0x8(%rax), %esi
testl %esi, %esi
je 0x1f7e
movl 0x18(%rsp), %ebp
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x232b
movq 0x33ed(%rip), %r13      # 0x5120
movl %ebp, %edi
callq 0x2398
movq %r13, %rdi
leaq 0x1960(%rip), %rsi      # 0x36a4
leaq 0x3405(%rip), %rdx      # 0x5150
xorl %eax, %eax
callq 0x1170
jmp 0x1b1b
shlq $0x3, %r14
leaq (%r14,%r14,4), %rbx
movl 0x8(%r15,%rbx), %esi
movl 0xc(%rsp), %edi
xorl %edx, %edx
callq 0x232b
movq 0x33aa(%rip), %rdi      # 0x5120
leaq 0x1777(%rip), %rsi      # 0x34f4
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x1170
movq 0x33b0(%rip), %rax      # 0x5140
incl 0x8(%rax,%rbx)
jmp 0x1b1b
movl %esi, %eax
testl %eax, %eax
js 0x1f9d
movq 0x3396(%rip), %rcx      # 0x5140
movl %eax, %r15d
leaq (%r15,%r15,4), %r12
cmpq $0x0, 0x10(%rcx,%r12,8)
je 0x1f83
leaq (%rcx,%r12,8), %rax
cmpl $0x0, 0x4(%rax)
je 0x1f83
movl 0x18(%rsp), %edi
callq 0x2398
leaq 0x3375(%rip), %rdi      # 0x5150
callq 0x11d0
testq %rax, %rax
je 0x1f93
movq %rax, %rbp
movq 0x334d(%rip), %r14      # 0x5140
leaq (%r14,%r12,8), %rbx
addq $0x18, %rbx
movl 0x8(%rbx), %esi
testb $0x7f, %sil
jne 0x1e22
movq (%rbx), %rdi
addl $0x82, %esi
shlq $0x3, %rsi
callq 0x11c0
movq %rax, (%rbx)
testq %rax, %rax
je 0x1fc2
movq (%rbx), %rax
movl 0x8(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
movq %rbp, (%rax,%rcx,8)
movq (%rbx), %rax
movq $0x0, (%rax,%rdx,8)
decl 0x4(%r14,%r12,8)
leaq 0x16b3(%rip), %rbp      # 0x34fc
jne 0x1b1b
shlq $0x3, %r15
leaq (%r15,%r15,4), %rbx
movl 0x8(%r14,%rbx), %esi
movl %r13d, %edi
xorl %edx, %edx
callq 0x232b
movq 0x32b3(%rip), %rdi      # 0x5120
movq 0x32cc(%rip), %rax      # 0x5140
movq 0x10(%rax,%rbx), %rdx
leaq 0x1729(%rip), %rsi      # 0x35a9
xorl %eax, %eax
callq 0x1170
movq 0x32b2(%rip), %rax      # 0x5140
cmpl $0x0, 0x20(%rax,%rbx)
leaq 0x171b(%rip), %r14      # 0x35b5
leaq 0x170f(%rip), %r15      # 0x35b0
je 0x1ee8
addq %rbx, %rax
addq $0x18, %rax
xorl %ebx, %ebx
movq 0x326d(%rip), %rdi      # 0x5120
testq %rbx, %rbx
movq %r14, %rdx
cmoveq %rbp, %rdx
movq (%rax), %rax
movq (%rax,%rbx,8), %rcx
movq %r15, %rsi
xorl %eax, %eax
callq 0x1170
incq %rbx
movq 0x3268(%rip), %rax      # 0x5140
leaq (%rax,%r12,8), %rax
addq $0x18, %rax
movl 0x8(%rax), %ecx
cmpq %rcx, %rbx
jb 0x1eac
movq 0x3231(%rip), %rcx      # 0x5120
movl $0x2, %esi
movl $0x1, %edx
leaq 0x15fa(%rip), %rdi      # 0x34fa
callq 0x11e0
movq 0x3234(%rip), %r14      # 0x5140
leaq (%r14,%r12,8), %rbx
addq $0x18, %rbx
cmpl $0x0, 0x8(%rbx)
je 0x1f39
xorl %r15d, %r15d
movq (%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x1f2e
callq 0x1130
incq %r15
movl 0x8(%rbx), %eax
cmpq %rax, %r15
jb 0x1f1d
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1f46
callq 0x1130
xorl %r15d, %r15d
movq %r15, (%rbx)
movl $0x0, 0x8(%rbx)
movq 0x10(%r14,%r12,8), %rdi
callq 0x1130
movq %r15, 0x10(%r14,%r12,8)
incl 0x8(%r14,%r12,8)
jmp 0x1b1b
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1210
movl %r13d, %edi
callq 0x137c
movl %r13d, %edi
callq 0x12a0
callq 0x1332
callq 0x140c
movl %r13d, %edi
callq 0x13c4
callq 0x1532
callq 0x14e8
movl 0xc(%rsp), %edi
callq 0x1456
callq 0x1258
callq 0x149e
callq 0x12e8
callq 0x15da
movq %r14, %rdi
movq %rbx, %rsi
callq 0x157a