// File: /workspace/github_c_makefile_star2_O2/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 $0x1018, %rsp           # imm = 0x1018
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1040
movl %eax, 0x3b1d(%rip)      # 0x5138
testl %eax, %eax
js 0x1cc4
je 0x1d03
movq %rsp, %r12
pushq $0x10
popq %rbp
movq %r12, %rdi
movl %ebp, %esi
callq 0x1de6
testb %al, %al
jne 0x1a06
movl 0x4(%rsp), %edx
leal 0x3ffefff0(%rdx), %eax
roll $0x1c, %eax
cmpl $0x3, %eax
ja 0x1b12
leaq 0x19a6(%rip), %rcx      # 0x3004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xc(%rsp), %r14d
cmpq $0x1000, %r14           # imm = 0x1000
jae 0x1b4d
leaq 0x10(%rsp), %rdi
movl %r14d, %esi
callq 0x1de6
testb %al, %al
jne 0x1bca
movb $0x0, 0x10(%rsp,%r14)
movl (%rsp), %r14d
movl 0x8(%rsp), %r13d
movl %r14d, %edi
pushq $0x1
popq %rsi
callq 0x201b
movq 0x3a91(%rip), %rbx      # 0x5140
cltq
imulq $0x28, %rax, %r15
cmpq $0x0, 0x10(%rbx,%r15)
jne 0x1b8c
leaq (%rbx,%r15), %rax
movl %r13d, 0x4(%rax)
leaq (%rbx,%r15), %rbp
addq $0x18, %rbp
xorl %r12d, %r12d
movl 0x8(%rbp), %eax
movq (%rbp), %rdi
cmpq %rax, %r12
jae 0x18d6
movq (%rdi,%r12,8), %rdi
callq 0x1130
incq %r12
jmp 0x16d4
movl (%rsp), %r14d
movl 0x8(%rsp), %r15d
movl %r14d, %edi
pushq $0x1
popq %rsi
callq 0x201b
movq 0x3a33(%rip), %rcx      # 0x5140
cltq
imulq $0x28, %rax, %rax
cmpq $0x0, 0x10(%rcx,%rax)
jne 0x1c09
addq %rax, %rcx
movl 0x8(%rcx), %esi
decl %esi
movl %esi, 0x8(%rcx)
movl %r14d, %edi
xorl %edx, %edx
callq 0x20ee
movq 0x39e5(%rip), %r14      # 0x5120
movl %r15d, %edi
callq 0x2175
movq %r14, %rdi
leaq 0x1ec5(%rip), %rsi      # 0x3612
jmp 0x1950
movl (%rsp), %edx
movl 0x8(%rsp), %r14d
movl 0x39dc(%rip), %ecx      # 0x513c
movq 0x39d9(%rip), %rax      # 0x5140
addq $0x10, %rax
movq %rcx, %rsi
subq $0x1, %rsi
jb 0x1a18
cmpl %edx, -0x10(%rax)
je 0x1910
addq $0x28, %rax
movq %rsi, %rcx
jmp 0x176e
movl (%rsp), %r14d
movl 0x8(%rsp), %r15d
movl %r14d, %edi
xorl %esi, %esi
callq 0x201b
testl %eax, %eax
js 0x1c47
movq 0x3994(%rip), %rcx      # 0x5140
movl %eax, %eax
imulq $0x28, %rax, %r13
cmpq $0x0, 0x10(%rcx,%r13)
je 0x1a5d
addq %r13, %rcx
cmpl $0x0, 0x4(%rcx)
je 0x1a5d
movl %r15d, %edi
callq 0x2175
leaq 0x3976(%rip), %rdi      # 0x5150
callq 0x11d0
testq %rax, %rax
je 0x1ad3
movq %rax, %r15
movq 0x394e(%rip), %rbx      # 0x5140
leaq (%rbx,%r13), %rbp
addq $0x18, %rbp
movl 0x8(%rbp), %esi
movq (%rbp), %rax
testb $0x7f, %sil
jne 0x1829
addl $0x82, %esi
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x11c0
movq %rax, (%rbp)
testq %rax, %rax
je 0x1ad3
movl 0x8(%rbp), %esi
leal 0x1(%rsi), %ecx
movl %ecx, 0x8(%rbp)
movl %esi, %edx
movq %r15, (%rax,%rdx,8)
movq (%rbp), %rax
andq $0x0, (%rax,%rcx,8)
decl 0x4(%rbx,%r13)
pushq $0x10
popq %rbp
leaq 0x1d68(%rip), %r15      # 0x35b5
jne 0x162f
movl 0x8(%rbx,%r13), %esi
movl %r14d, %edi
xorl %edx, %edx
callq 0x20ee
movq 0x38b7(%rip), %rdi      # 0x5120
movq 0x38d0(%rip), %rax      # 0x5140
movq 0x10(%rax,%r13), %rdx
leaq 0x1d2d(%rip), %rsi      # 0x35a9
xorl %eax, %eax
callq 0x1170
xorl %ebx, %ebx
leaq 0x1c70(%rip), %r14      # 0x34fc
movq 0x38ad(%rip), %rcx      # 0x5140
movl 0x20(%rcx,%r13), %edx
movq 0x3881(%rip), %rax      # 0x5120
cmpq %rdx, %rbx
jae 0x1963
addq %r13, %rcx
addq $0x18, %rcx
testq %rbx, %rbx
movq %r15, %rdx
cmoveq %r14, %rdx
movq (%rcx), %rcx
movq (%rcx,%rbx,8), %rcx
movq %rax, %rdi
leaq 0x1ce6(%rip), %rsi      # 0x35b0
xorl %eax, %eax
callq 0x1170
incq %rbx
jmp 0x188c
callq 0x1130
andq $0x0, (%rbp)
andl $0x0, 0x8(%rbp)
testl %r13d, %r13d
je 0x19cc
leaq 0x10(%rsp), %rdi
callq 0x11d0
movq %rax, 0x10(%rbx,%r15)
testq %rax, %rax
movq %rsp, %r12
pushq $0x10
popq %rbp
jne 0x162f
jmp 0x1c85
testl %ecx, %ecx
je 0x1a18
cmpq $0x0, (%rax)
jne 0x1a98
movl -0x8(%rax), %esi
testl %esi, %esi
je 0x1a98
movl %edx, %edi
pushq $-0x1
popq %rdx
callq 0x20ee
movq 0x37e2(%rip), %r15      # 0x5120
movl %r14d, %edi
callq 0x2175
movq %r15, %rdi
leaq 0x1d54(%rip), %rsi      # 0x36a4
leaq 0x37f9(%rip), %rdx      # 0x5150
xorl %eax, %eax
callq 0x1170
jmp 0x162f
leaq 0x1b90(%rip), %rdi      # 0x34fa
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rax, %rcx
callq 0x11e0
movq 0x37c1(%rip), %rbx      # 0x5140
leaq (%rbx,%r13), %r14
addq $0x18, %r14
xorl %r15d, %r15d
movl 0x8(%r14), %eax
movq (%r14), %rdi
cmpq %rax, %r15
jae 0x19a4
movq (%rdi,%r15,8), %rdi
callq 0x1130
incq %r15
jmp 0x198a
callq 0x1130
andq $0x0, (%r14)
andl $0x0, 0x8(%r14)
movq 0x10(%rbx,%r13), %rdi
callq 0x1130
andq $0x0, 0x10(%rbx,%r13)
incl 0x8(%rbx,%r13)
jmp 0x162f
movl 0x8(%rbx,%r15), %esi
movl %r14d, %edi
xorl %edx, %edx
callq 0x20ee
movq 0x373e(%rip), %rdi      # 0x5120
leaq 0x1b0b(%rip), %rsi      # 0x34f4
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x1170
movq 0x3744(%rip), %rax      # 0x5140
incl 0x8(%rax,%r15)
jmp 0x1629
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x35c1(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x1bf2(%rip), %rsi      # 0x361b
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x1679(%rip), %rsi      # 0x30b3
leaq 0x1c16(%rip), %rdx      # 0x3657
leaq 0x1680(%rip), %rcx      # 0x30c8
movl $0xcb, %r8d
xorl %eax, %eax
callq 0x1170
pushq $0x1
popq %rdi
callq 0x1140
movq 0x357c(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x1afb(%rip), %rsi      # 0x3569
movl %r14d, %edx
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x1631(%rip), %rsi      # 0x30b3
leaq 0x1ad1(%rip), %rdx      # 0x355a
leaq 0x1638(%rip), %rcx      # 0x30c8
movl $0x9a, %r8d
jmp 0x1a4e
movq 0x3541(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x1bbc(%rip), %rsi      # 0x3665
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x15f9(%rip), %rsi      # 0x30b3
leaq 0x1b96(%rip), %rdx      # 0x3657
leaq 0x1600(%rip), %rcx      # 0x30c8
movl $0xce, %r8d
jmp 0x1a4e
movq 0x3506(%rip), %rbx      # 0x4fe0
movq (%rbx), %rcx
leaq 0x198f(%rip), %rdi      # 0x3473
pushq $0x24
popq %rsi
pushq $0x1
popq %rdx
callq 0x11e0
movq (%rbx), %rdi
leaq 0x15ba(%rip), %rsi      # 0x30b3
leaq 0x1a5a(%rip), %rdx      # 0x355a
leaq 0x15c1(%rip), %rcx      # 0x30c8
movl $0x9c, %r8d
jmp 0x1a4e
movq 0x34c7(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x17f7(%rip), %rsi      # 0x331a
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x157f(%rip), %rsi      # 0x30b3
leaq 0x172c(%rip), %rdx      # 0x3267
leaq 0x1586(%rip), %rcx      # 0x30c8
movl $0x15e, %r8d            # imm = 0x15E
jmp 0x1a4e
movq 0x348c(%rip), %rbx      # 0x4fe0
movq (%rbx), %rcx
leaq 0x1745(%rip), %rdi      # 0x32a3
pushq $0x35
popq %rsi
pushq $0x1
popq %rdx
callq 0x11e0
movq (%rbx), %rdi
leaq 0x1540(%rip), %rsi      # 0x30b3
leaq 0x16ed(%rip), %rdx      # 0x3267
leaq 0x1547(%rip), %rcx      # 0x30c8
movl $0x14b, %r8d            # imm = 0x14B
jmp 0x1a4e
movq 0x344d(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x1909(%rip), %rsi      # 0x34a6
movl %r14d, %edx
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x1502(%rip), %rsi      # 0x30b3
leaq 0x192e(%rip), %rdx      # 0x34e6
leaq 0x1509(%rip), %rcx      # 0x30c8
movl $0x82, %r8d
jmp 0x1a4e
movq 0x340f(%rip), %rbx      # 0x4fe0
movq (%rbx), %rcx
leaq 0x16fe(%rip), %rdi      # 0x32d9
pushq $0x40
popq %rsi
pushq $0x1
popq %rdx
callq 0x11e0
movq (%rbx), %rdi
leaq 0x14c3(%rip), %rsi      # 0x30b3
leaq 0x1670(%rip), %rdx      # 0x3267
leaq 0x14ca(%rip), %rcx      # 0x30c8
movl $0x14c, %r8d            # imm = 0x14C
jmp 0x1a4e
movq 0x33d0(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x19a8(%rip), %rsi      # 0x35c2
movl %r14d, %edx
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x1485(%rip), %rsi      # 0x30b3
leaq 0x19cd(%rip), %rdx      # 0x3602
leaq 0x148c(%rip), %rcx      # 0x30c8
movl $0xb9, %r8d
jmp 0x1a4e
movq 0x3392(%rip), %rbx      # 0x4fe0
movq (%rbx), %rdi
leaq 0x18c5(%rip), %rsi      # 0x351d
movl %r14d, %edx
xorl %eax, %eax
callq 0x1170
movq (%rbx), %rdi
leaq 0x1447(%rip), %rsi      # 0x30b3
leaq 0x18e7(%rip), %rdx      # 0x355a
leaq 0x144e(%rip), %rcx      # 0x30c8
movl $0x97, %r8d
jmp 0x1a4e
movq 0x3354(%rip), %rbx      # 0x4fe0
movq (%rbx), %rcx
leaq 0x17dd(%rip), %rdi      # 0x3473
pushq $0x24
popq %rsi
pushq $0x1
popq %rdx
callq 0x11e0
movq (%rbx), %rdi
leaq 0x1408(%rip), %rsi      # 0x30b3
leaq 0x1834(%rip), %rdx      # 0x34e6
leaq 0x140f(%rip), %rcx      # 0x30c8
movl $0x8d, %r8d
jmp 0x1a4e
movq 0x3315(%rip), %rbx      # 0x4fe0
movq (%rbx), %rcx
leaq 0x1561(%rip), %rdi      # 0x3236
pushq $0x30
popq %rsi
pushq $0x1
popq %rdx
callq 0x11e0
movq (%rbx), %rdi
leaq 0x13c9(%rip), %rsi      # 0x30b3
leaq 0x1576(%rip), %rdx      # 0x3267
leaq 0x13d0(%rip), %rcx      # 0x30c8
movl $0x13f, %r8d            # imm = 0x13F
jmp 0x1a4e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1080
movq 0x32cb(%rip), %r14      # 0x4fe0
movq (%r14), %rdi
leaq 0x1557(%rip), %rsi      # 0x3276
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1170
movq (%r14), %rdi
leaq 0x1380(%rip), %rsi      # 0x30b3
leaq 0x152d(%rip), %rdx      # 0x3267
leaq 0x1387(%rip), %rcx      # 0x30c8
movl $0x143, %r8d            # imm = 0x143
xorl %eax, %eax
callq 0x1170
leaq 0x146b(%rip), %rdi      # 0x31c0
callq 0x10d0
jmp 0x1a55