// File: /workspace/github_c_makefile_star2_O3/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 0x2046
je 0x204b
leaq 0x10(%rsp), %rdi
movl $0x10, %esi
callq 0x20e6
testb %al, %al
jne 0x1fec
movl 0x14(%rsp), %edi
leal 0x3ffefff0(%rdi), %eax
roll $0x1c, %eax
cmpl $0x3, %eax
ja 0x2022
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 0x2027
leaq 0x20(%rsp), %rdi
movl %r13d, %esi
callq 0x20e6
testb %al, %al
jne 0x201d
movb $0x0, 0x20(%rsp,%r13)
movl 0x10(%rsp), %edi
movl 0x18(%rsp), %ebp
movl %edi, 0xc(%rsp)
movl $0x1, %esi
callq 0x230f
movq 0x359e(%rip), %r15      # 0x5140
movslq %eax, %r14
leaq (%r14,%r14,4), %r12
cmpq $0x0, 0x10(%r15,%r12,8)
jne 0x202c
leaq (%r15,%r12,8), %rbx
movl %ebp, 0x4(%rbx)
movl 0x20(%rbx), %eax
testl %eax, %eax
je 0x1be5
xorl %r13d, %r13d
movq 0x18(%rbx), %rcx
movq (%rcx,%r13,8), %rdi
testq %rdi, %rdi
je 0x1bdb
callq 0x1130
movl 0x20(%rbx), %eax
incq %r13
movl %eax, %ecx
cmpq %rcx, %r13
jb 0x1bc6
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x1bf3
callq 0x1130
movq $0x0, 0x18(%rbx)
movl $0x0, 0x20(%rbx)
testl %ebp, %ebp
je 0x1faa
leaq 0x20(%rsp), %rdi
callq 0x11d0
movq %rax, 0x10(%r15,%r12,8)
testq %rax, %rax
jne 0x1b1b
jmp 0x203c
movl 0x10(%rsp), %ebp
movl 0x18(%rsp), %r13d
movl %ebp, %edi
movl $0x1, %esi
callq 0x230f
movq 0x34fd(%rip), %rcx      # 0x5140
cltq
leaq (%rax,%rax,4), %rax
cmpq $0x0, 0x10(%rcx,%rax,8)
jne 0x2035
leaq (%rcx,%rax,8), %rax
movl 0x8(%rax), %esi
decl %esi
movl %esi, 0x8(%rax)
movl %ebp, %edi
xorl %edx, %edx
callq 0x23ae
movq 0x34af(%rip), %rbp      # 0x5120
leal 0xf423f(%r13), %eax
cmpl $0x1e847f, %eax         # imm = 0x1E847F
leaq 0x1937(%rip), %rsi      # 0x35bb
leaq 0x192d(%rip), %rax      # 0x35b8
cmovbq %rax, %rsi
leaq 0x34ba(%rip), %rbx      # 0x5150
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x1030
movq %rbp, %rdi
leaq 0x1965(%rip), %rsi      # 0x3612
jmp 0x1f9b
movl 0x10(%rsp), %edi
movl 0x18(%rsp), %r13d
movl 0x347b(%rip), %eax      # 0x513c
testq %rax, %rax
je 0x1f1c
movq 0x346f(%rip), %rdx      # 0x5140
xorl %ecx, %ecx
cmpl %edi, (%rdx)
je 0x1f1e
incq %rcx
addq $0x28, %rdx
cmpq %rcx, %rax
jne 0x1cd3
jmp 0x2006
movl 0x10(%rsp), %r13d
movl 0x3445(%rip), %ecx      # 0x513c
testq %rcx, %rcx
je 0x1ffe
movl 0x18(%rsp), %edx
movq 0x3435(%rip), %rax      # 0x5140
movq %rax, %rsi
xorl %r12d, %r12d
cmpl %r13d, (%rsi)
je 0x1d27
incq %r12
addq $0x28, %rsi
cmpq %r12, %rcx
jne 0x1d11
jmp 0x1ffe
testl %r12d, %r12d
js 0x1ffe
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
leaq (%r12,%r12,4), %r15
cmpq $0x0, 0x10(%rax,%r15,8)
je 0x2010
leaq (%rax,%r15,8), %rax
cmpl $0x0, 0x4(%rax)
je 0x2010
leal 0xf423f(%rdx), %eax
cmpl $0x1e847f, %eax         # imm = 0x1E847F
leaq 0x1854(%rip), %rsi      # 0x35bb
leaq 0x184a(%rip), %rax      # 0x35b8
cmovbq %rax, %rsi
leaq 0x33d7(%rip), %rbx      # 0x5150
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1030
movq %rbx, %rdi
callq 0x11d0
testq %rax, %rax
je 0x2018
movq %rax, %rbp
movq 0x33a2(%rip), %r14      # 0x5140
leaq (%r14,%r15,8), %rbx
addq $0x18, %rbx
movl 0x8(%rbx), %esi
movq (%rbx), %rax
testb $0x7f, %sil
jne 0x1dd3
addl $0x82, %esi
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x11c0
movq %rax, (%rbx)
testq %rax, %rax
je 0x2041
movl 0x8(%rbx), %esi
leal 0x1(%rsi), %ecx
movl %ecx, 0x8(%rbx)
movl %esi, %edx
movq %rbp, (%rax,%rdx,8)
movq (%rbx), %rax
movq $0x0, (%rax,%rcx,8)
decl 0x4(%r14,%r15,8)
leaq 0x1706(%rip), %rbp      # 0x34fc
jne 0x1b1b
shlq $0x3, %r12
leaq (%r12,%r12,4), %rbx
movl 0x8(%r14,%rbx), %esi
movl %r13d, %edi
xorl %edx, %edx
callq 0x23ae
movq 0x3306(%rip), %rdi      # 0x5120
movq 0x331f(%rip), %rax      # 0x5140
movq 0x10(%rax,%rbx), %rdx
leaq 0x177c(%rip), %rsi      # 0x35a9
xorl %eax, %eax
callq 0x1170
movq 0x3305(%rip), %rax      # 0x5140
cmpl $0x0, 0x20(%rax,%rbx)
leaq 0x176e(%rip), %r14      # 0x35b5
leaq 0x1762(%rip), %r12      # 0x35b0
je 0x1e95
addq %rbx, %rax
addq $0x18, %rax
xorl %ebx, %ebx
movq 0x32c0(%rip), %rdi      # 0x5120
testq %rbx, %rbx
movq %r14, %rdx
cmoveq %rbp, %rdx
movq (%rax), %rax
movq (%rax,%rbx,8), %rcx
movq %r12, %rsi
xorl %eax, %eax
callq 0x1170
incq %rbx
movq 0x32bb(%rip), %rax      # 0x5140
leaq (%rax,%r15,8), %rax
addq $0x18, %rax
movl 0x8(%rax), %ecx
cmpq %rcx, %rbx
jb 0x1e59
movq 0x3284(%rip), %rcx      # 0x5120
movl $0x2, %esi
movl $0x1, %edx
leaq 0x164d(%rip), %rdi      # 0x34fa
callq 0x11e0
movq 0x3287(%rip), %r14      # 0x5140
leaq (%r14,%r15,8), %rbx
addq $0x18, %rbx
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0x1ee9
xorl %r12d, %r12d
movq (%rbx), %rcx
movq (%rcx,%r12,8), %rdi
testq %rdi, %rdi
je 0x1edf
callq 0x1130
movl 0x8(%rbx), %eax
incq %r12
movl %eax, %ecx
cmpq %rcx, %r12
jb 0x1ecb
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1ef6
callq 0x1130
xorl %r12d, %r12d
movq %r12, (%rbx)
movl $0x0, 0x8(%rbx)
movq 0x10(%r14,%r15,8), %rdi
callq 0x1130
movq %r12, 0x10(%r14,%r15,8)
incl 0x8(%r14,%r15,8)
jmp 0x1b1b
xorl %ecx, %ecx
cmpl %eax, %ecx
je 0x2006
movq 0x3213(%rip), %rax      # 0x5140
movl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
cmpq $0x0, 0x10(%rax,%rcx,8)
jne 0x200b
leaq (%rax,%rcx,8), %rax
movl 0x8(%rax), %esi
testl %esi, %esi
je 0x200b
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x23ae
movq 0x31c1(%rip), %rbp      # 0x5120
leal 0xf423f(%r13), %eax
cmpl $0x1e847f, %eax         # imm = 0x1E847F
leaq 0x1649(%rip), %rsi      # 0x35bb
leaq 0x163f(%rip), %rax      # 0x35b8
cmovbq %rax, %rsi
leaq 0x31cc(%rip), %rbx      # 0x5150
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x1030
movq %rbp, %rdi
leaq 0x1709(%rip), %rsi      # 0x36a4
movq %rbx, %rdx
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 0x23ae
movq 0x3157(%rip), %rdi      # 0x5120
leaq 0x1524(%rip), %rsi      # 0x34f4
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x1170
movq 0x315d(%rip), %rax      # 0x5140
incl 0x8(%rax,%rbx)
jmp 0x1b1b
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r13d, %edi
callq 0x13c4
callq 0x1258
callq 0x1210
movl %r13d, %edi
callq 0x137c
callq 0x1332
callq 0x140c
callq 0x1532
callq 0x14e8
movl 0xc(%rsp), %edi
callq 0x1456
movl %ebp, %edi
callq 0x12a0
callq 0x149e
callq 0x12e8
callq 0x15da
movq %r14, %rdi
movq %rbx, %rsi
callq 0x157a