// File: /workspace/github_c_makefile_star2_O2/mabdi[P]bunney/bunny-exec.c
// Function: report_kids
static _u8 report_kids(void) {
  static _u32 st;
  _s32 i;

  if (wait_res >= 0) {
    wait_res = waitpid(orig_pid,&st,WNOHANG);
    /* Process still running or just done? */
    if (wait_res >= 0) return 0;
  }

  /* Process gone at least a round ago... */

  i = get_procentry(orig_pid,0);

  if (!total_calls) exitflags |= EXITF_NOCALLS;

  /* Detect termination on fault-related signals */
  if (WIFSIGNALED(st)) {
    _u32 sig = WTERMSIG(st);
#ifdef EXTRA_SIGNALS
    if (sig == SIGSEGV || sig == SIGILL  || sig == SIGBUS  || sig == SIGFPE ||
        sig == SIGABRT || sig == SIGTRAP || sig == SIGXCPU || sig == SIGXFSZ)
#else
    if (sig == SIGSEGV || sig == SIGILL  || sig == SIGBUS  || sig == SIGFPE)
#endif /* ^EXTRA_SIGNALS */
      exitflags |= EXITF_CRASH;

    if (i >= 0) {
      register_spot(orig_pid, WTERMSIG(st));
      fault_loc = procs[i].funclist.v[procs[i].funclist.c-1];
    }
      
  } else {
    if (i >= 0) register_spot(orig_pid, WEXITSTATUS(st));
  }

  if (!fault_loc && shmreg->child_crash) {
    _s32 x = get_procentry(shmreg->child_crash,0);
    if (x >= 0) fault_loc = procs[x].funclist.v[procs[x].funclist.c-1];
    exitflags |= EXITF_CRASH;
  }

  /* Kill all registered child processes */
  for (i=0;i<proc_cnt;i++) 
    if (procs[i].pid) kill(procs[i].pid,SIGKILL);

  return 1;
  
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x2d6c(%rip)      # 0x51b4
js 0x2470
movl 0x2d4c(%rip), %edi      # 0x519c
leaq 0x2d59(%rip), %rsi      # 0x51b0
pushq $0x1
popq %rdx
callq 0x10a0
movl %eax, 0x2d4f(%rip)      # 0x51b4
testl %eax, %eax
js 0x2470
xorl %eax, %eax
jmp 0x25a1
movl 0x2d26(%rip), %edi      # 0x519c
xorl %esi, %esi
callq 0x25a7
movl %eax, %ebx
cmpl $0x0, 0x2d32(%rip)      # 0x51b8
jne 0x248f
orb $0x8, 0x2d0b(%rip)      # 0x519a
movl 0x2d1b(%rip), %ecx      # 0x51b0
movl %ecx, %eax
andl $0x7f, %eax
movl %eax, %edx
shll $0x18, %edx
addl $0x1000000, %edx        # imm = 0x1000000
cmpl $0x2000000, %edx        # imm = 0x2000000
jl 0x2501
andl $0x7e, %ecx
cmpl $0x18, %ecx
je 0x24c4
cmpl $0xb, %eax
ja 0x24cb
movl $0x9f0, %ecx            # imm = 0x9F0
btl %eax, %ecx
jae 0x24cb
orb $0x2, 0x2ccf(%rip)      # 0x519a
testl %ebx, %ebx
js 0x2513
movl 0x2cc7(%rip), %edi      # 0x519c
movl %eax, %esi
callq 0x2391
movq 0x2cc5(%rip), %rax      # 0x51a8
movl %ebx, %ecx
shlq $0x6, %rcx
movq 0x10(%rax,%rcx), %rdx
movl 0x18(%rax,%rcx), %eax
decl %eax
movq (%rdx,%rax,8), %rax
movq %rax, 0x2cc1(%rip)      # 0x51c0
jmp 0x251a
testl %ebx, %ebx
js 0x2513
movl 0x2c91(%rip), %edi      # 0x519c
movzbl %ch, %esi
callq 0x2391
movq 0x2ca6(%rip), %rax      # 0x51c0
testq %rax, %rax
jne 0x2564
movq 0x2c6a(%rip), %rax      # 0x5190
cmpl $0x0, 0x10(%rax)
je 0x2564
movl 0x10(%rax), %edi
xorl %esi, %esi
callq 0x25a7
testl %eax, %eax
js 0x255d
movq 0x2c67(%rip), %rcx      # 0x51a8
movl %eax, %eax
shlq $0x6, %rax
movq 0x10(%rcx,%rax), %rdx
movl 0x18(%rcx,%rax), %eax
decl %eax
movq (%rdx,%rax,8), %rax
movq %rax, 0x2c63(%rip)      # 0x51c0
orb $0x2, 0x2c36(%rip)      # 0x519a
movl 0x2c36(%rip), %eax      # 0x51a0
xorl %r14d, %r14d
pushq $0x9
popq %rbx
xorl %r15d, %r15d
movl %eax, %ecx
cmpq %rcx, %r15
jae 0x259f
movq 0x2c27(%rip), %rcx      # 0x51a8
movl (%rcx,%r14), %edi
testl %edi, %edi
je 0x2596
movl %ebx, %esi
callq 0x11a0
movl 0x2c0a(%rip), %eax      # 0x51a0
incq %r15
addq $0x40, %r14
jmp 0x2573
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq