// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1030, %rsp           # imm = 0x1030
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x1180
movl %eax, 0x48e6(%rip)      # 0x6194
cmpl $0x0, 0x48df(%rip)      # 0x6194
jge 0x1907
jmp 0x18b9
movq 0x4720(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
leaq 0x2897(%rip), %rsi      # 0x4161
movb $0x0, %al
callq 0x11b0
movq 0x4708(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
leaq 0x277d(%rip), %rsi      # 0x405f
leaq 0x28a9(%rip), %rdx      # 0x4192
leaq 0x2784(%rip), %rcx      # 0x4074
movl $0x1b2, %r8d            # imm = 0x1B2
movb $0x0, %al
callq 0x11b0
movl $0x1, %edi
callq 0x1130
cmpl $0x0, 0x4886(%rip)      # 0x6194
jne 0x197b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1090
movq 0x46bc(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x286f(%rip), %rsi      # 0x41a1
movb $0x0, %al
callq 0x11b0
movq 0x46a0(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
leaq 0x2715(%rip), %rsi      # 0x405f
leaq 0x2841(%rip), %rdx      # 0x4192
leaq 0x271c(%rip), %rcx      # 0x4074
movl $0x1b6, %r8d            # imm = 0x1B6
movb $0x0, %al
callq 0x11b0
leaq 0x27a4(%rip), %rdi      # 0x4110
callq 0x10d0
movl $0x1, %edi
callq 0x1130
jmp 0x197d
leaq -0x20(%rbp), %rdi
movl $0x10, %esi
callq 0x1d40
cmpb $0x0, %al
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x199b
jmp 0x1af8
movl -0x1c(%rbp), %eax
movl %eax, -0x1024(%rbp)
subl $0xc0010010, %eax       # imm = 0xC0010010
je 0x19e9
jmp 0x19ad
movl -0x1024(%rbp), %eax
subl $0xc0010020, %eax       # imm = 0xC0010020
je 0x1a79
jmp 0x19c0
movl -0x1024(%rbp), %eax
subl $0xc0010030, %eax       # imm = 0xC0010030
je 0x1a86
jmp 0x19d3
movl -0x1024(%rbp), %eax
subl $0xc0010040, %eax       # imm = 0xC0010040
je 0x1a93
jmp 0x1aa0
cmpl $0xfff, -0x14(%rbp)     # imm = 0xFFF
jbe 0x1a42
jmp 0x19f4
movq 0x45e5(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
leaq 0x27c9(%rip), %rsi      # 0x41ce
movb $0x0, %al
callq 0x11b0
movq 0x45cd(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
leaq 0x2642(%rip), %rsi      # 0x405f
leaq 0x276e(%rip), %rdx      # 0x4192
leaq 0x2649(%rip), %rcx      # 0x4074
movl $0x1bf, %r8d            # imm = 0x1BF
movb $0x0, %al
callq 0x11b0
movl $0x1, %edi
callq 0x1130
leaq -0x1020(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1d40
cmpb $0x0, %al
je 0x1a5a
jmp 0x1afa
movl -0x14(%rbp), %eax
movb $0x0, -0x1020(%rbp,%rax)
movl -0x20(%rbp), %edi
leaq -0x1020(%rbp), %rsi
movl -0x18(%rbp), %edx
callq 0x1f80
jmp 0x1af3
movl -0x20(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x2240
jmp 0x1af3
movl -0x20(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x2390
jmp 0x1af3
movl -0x20(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x2670
jmp 0x1af3
jmp 0x1aa2
movq 0x4537(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x274e(%rip), %rsi      # 0x4204
movb $0x0, %al
callq 0x11b0
movq 0x451c(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
leaq 0x2591(%rip), %rsi      # 0x405f
leaq 0x26bd(%rip), %rdx      # 0x4192
leaq 0x2598(%rip), %rcx      # 0x4074
movl $0x1d3, %r8d            # imm = 0x1D3
movb $0x0, %al
callq 0x11b0
movl $0x1, %edi
callq 0x1130
jmp 0x197d
jmp 0x1afa
callq 0x2770
addq $0x1030, %rsp           # imm = 0x1030
popq %rbp
retq
nopl (%rax,%rax)