// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1030, %rsp           # imm = 0x1030
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x1040
movl %eax, 0x39ea(%rip)      # 0x5138
cmpl $0x0, 0x39e3(%rip)      # 0x5138
jge 0x17a7
jmp 0x1759
movq 0x3880(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x1abc(%rip), %rsi      # 0x3226
movb $0x0, %al
callq 0x1170
movq 0x3868(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x1921(%rip), %rsi      # 0x30a3
leaq 0x1ace(%rip), %rdx      # 0x3257
leaq 0x1928(%rip), %rcx      # 0x30b8
movl $0x13f, %r8d            # imm = 0x13F
movb $0x0, %al
callq 0x1170
movl $0x1, %edi
callq 0x1140
cmpl $0x0, 0x398a(%rip)      # 0x5138
jne 0x181b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1080
movq 0x381c(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x1a94(%rip), %rsi      # 0x3266
movb $0x0, %al
callq 0x1170
movq 0x3800(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x18b9(%rip), %rsi      # 0x30a3
leaq 0x1a66(%rip), %rdx      # 0x3257
leaq 0x18c0(%rip), %rcx      # 0x30b8
movl $0x143, %r8d            # imm = 0x143
movb $0x0, %al
callq 0x1170
leaq 0x19a4(%rip), %rdi      # 0x31b0
callq 0x10d0
movl $0x1, %edi
callq 0x1140
jmp 0x181d
leaq -0x20(%rbp), %rdi
movl $0x10, %esi
callq 0x1a90
cmpb $0x0, %al
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x183b
jmp 0x19e3
movl -0x1c(%rbp), %eax
movl %eax, -0x1024(%rbp)
subl $0xc0010010, %eax       # imm = 0xC0010010
je 0x1889
jmp 0x184d
movl -0x1024(%rbp), %eax
subl $0xc0010020, %eax       # imm = 0xC0010020
je 0x1964
jmp 0x1860
movl -0x1024(%rbp), %eax
subl $0xc0010030, %eax       # imm = 0xC0010030
je 0x1971
jmp 0x1873
movl -0x1024(%rbp), %eax
subl $0xc0010040, %eax       # imm = 0xC0010040
je 0x197e
jmp 0x198b
cmpl $0xfff, -0x14(%rbp)     # imm = 0xFFF
jbe 0x18e2
jmp 0x1894
movq 0x3745(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x19ee(%rip), %rsi      # 0x3293
movb $0x0, %al
callq 0x1170
movq 0x372d(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x17e6(%rip), %rsi      # 0x30a3
leaq 0x1993(%rip), %rdx      # 0x3257
leaq 0x17ed(%rip), %rcx      # 0x30b8
movl $0x14b, %r8d            # imm = 0x14B
movb $0x0, %al
callq 0x1170
movl $0x1, %edi
callq 0x1140
leaq -0x1020(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1a90
cmpb $0x0, %al
je 0x1945
jmp 0x18f7
movq 0x36e2(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x19c1(%rip), %rsi      # 0x32c9
movb $0x0, %al
callq 0x1170
movq 0x36ca(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x1783(%rip), %rsi      # 0x30a3
leaq 0x1930(%rip), %rdx      # 0x3257
leaq 0x178a(%rip), %rcx      # 0x30b8
movl $0x14c, %r8d            # imm = 0x14C
movb $0x0, %al
callq 0x1170
movl $0x1, %edi
callq 0x1140
movl -0x14(%rbp), %eax
movb $0x0, -0x1020(%rbp,%rax)
movl -0x20(%rbp), %edi
leaq -0x1020(%rbp), %rsi
movl -0x18(%rbp), %edx
callq 0x1cd0
jmp 0x19de
movl -0x20(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x1f00
jmp 0x19de
movl -0x20(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x2330
jmp 0x19de
movl -0x20(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x2430
jmp 0x19de
jmp 0x198d
movq 0x364c(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x1969(%rip), %rsi      # 0x330a
movb $0x0, %al
callq 0x1170
movq 0x3631(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
leaq 0x16ea(%rip), %rsi      # 0x30a3
leaq 0x1897(%rip), %rdx      # 0x3257
leaq 0x16f1(%rip), %rcx      # 0x30b8
movl $0x15e, %r8d            # imm = 0x15E
movb $0x0, %al
callq 0x1170
movl $0x1, %edi
callq 0x1140
jmp 0x181d
addq $0x1030, %rsp           # imm = 0x1030
popq %rbp
retq
nopl (%rax)