#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ getppid();
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ kill(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
char *strerror(scalar_t__);
int waitpid(scalar_t__, int *, int /*<<< orphan*/);
int child_exit_yet(int argc, char *argv[]) {
  pid_t pid = fork();
  if (pid < 0) {
    do {
      struct timeval tv;
      gettimeofday(&tv, NULL);
      printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
             getpid());
      printf("fork() failed");
      printf("\n");
    } while (0);
  } else if (0 == pid) {
    do {
      struct timeval tv;
      gettimeofday(&tv, NULL);
      printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
             getpid());
      printf("in child, sleep 2 seconds");
      printf("\n");
    } while (0);
    sleep(2);
    exit(3);
  } else {
    do {
      struct timeval tv;
      gettimeofday(&tv, NULL);
      printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
             getpid());
      printf("in parent");
      printf("\n");
    } while (0);
    sleep(1);
    if (0 == kill(pid, 0)) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("child [%d] exists", pid);
        printf("\n");
      } while (0);
    } else {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("child [%d] not exists", pid);
        printf("\n");
      } while (0);
    }
    errno = 0;
    int st = 0;
    int p = waitpid(pid, &st, WNOHANG);
    if (0 == p) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("child [%d] has not yet changed state", pid);
        printf("\n");
      } while (0);
    } else if (p < 0) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("waitpid() failed, error = [%s]", strerror(errno));
        printf("\n");
      } while (0);
    } else {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("child [%d] exit", pid);
        printf("\n");
      } while (0);
    }
    sleep(2);
    errno = 0;
    st = 0;
    p = waitpid(pid, &st, WNOHANG);
    if (0 == p) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("child [%d] has not yet changed state", pid);
        printf("\n");
      } while (0);
    } else if (p < 0) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("waitpid() failed, error = [%s]", strerror(errno));
        printf("\n");
      } while (0);
    } else {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("child [%d] exit", pid);
        printf("\n");
      } while (0);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<child_exit_yet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <fork@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1238 <child_exit_yet+0x98>
jmp    11cd <child_exit_yet+0x2d>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0x7c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x84(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    %eax,%r8d
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1829 <child_exit_yet+0x689>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    12cf <child_exit_yet+0x12f>
jmp    1249 <child_exit_yet+0xa9>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0x88(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x90(%rbp),%esi
mov    -0x8c(%rbp),%edx
mov    -0x88(%rbp),%ecx
mov    %eax,%r8d
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   10b0 <sleep@plt>
mov    $0x3,%edi
call   1090 <exit@plt>
jmp    12d4 <child_exit_yet+0x134>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0x94(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x9c(%rbp),%esi
mov    -0x98(%rbp),%edx
mov    -0x94(%rbp),%ecx
mov    %eax,%r8d
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1060 <kill@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    13e9 <child_exit_yet+0x249>
jmp    136e <child_exit_yet+0x1ce>
lea    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xa0(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xa8(%rbp),%esi
mov    -0xa4(%rbp),%edx
mov    -0xa0(%rbp),%ecx
mov    %eax,%r8d
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xc7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1469 <child_exit_yet+0x2c9>
jmp    13ee <child_exit_yet+0x24e>
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xac(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xb4(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0xac(%rbp),%ecx
mov    %eax,%r8d
lea    0xbc3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xc0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1469 <child_exit_yet+0x2c9>
mov    0x2b68(%rip),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2b5f(%rip),%rax
mov    (%rax),%edx
lea    -0x44(%rbp),%rsi
call   1070 <waitpid@plt>
mov    %eax,-0x48(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%eax
jne    1522 <child_exit_yet+0x382>
jmp    14a7 <child_exit_yet+0x307>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xb8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xc0(%rbp),%esi
mov    -0xbc(%rbp),%edx
mov    -0xb8(%rbp),%ecx
mov    %eax,%r8d
lea    0xb0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xb6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    163f <child_exit_yet+0x49f>
cmpl   $0x0,-0x48(%rbp)
jge    15ba <child_exit_yet+0x41a>
jmp    1531 <child_exit_yet+0x391>
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xc4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xcc(%rbp),%esi
mov    -0xc8(%rbp),%edx
mov    -0xc4(%rbp),%ecx
mov    %eax,%r8d
lea    0xa80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2a4a(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    %rax,%rsi
lea    0xaf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xa76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    163a <child_exit_yet+0x49a>
jmp    15bf <child_exit_yet+0x41f>
lea    -0x60(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xd0(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xd8(%rbp),%esi
mov    -0xd4(%rbp),%edx
mov    -0xd0(%rbp),%ecx
mov    %eax,%r8d
lea    0x9f2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xa96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x9f6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    163a <child_exit_yet+0x49a>
jmp    163f <child_exit_yet+0x49f>
mov    $0x2,%edi
call   10b0 <sleep@plt>
mov    0x2988(%rip),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x297f(%rip),%rax
mov    (%rax),%edx
lea    -0x44(%rbp),%rsi
call   1070 <waitpid@plt>
mov    %eax,-0x48(%rbp)
xor    %eax,%eax
cmp    -0x48(%rbp),%eax
jne    1702 <child_exit_yet+0x562>
jmp    1687 <child_exit_yet+0x4e7>
lea    -0x68(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x64(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0x68(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xdc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xe4(%rbp),%esi
mov    -0xe0(%rbp),%edx
mov    -0xdc(%rbp),%ecx
mov    %eax,%r8d
lea    0x92a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x98a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x92e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    181f <child_exit_yet+0x67f>
cmpl   $0x0,-0x48(%rbp)
jge    179a <child_exit_yet+0x5fa>
jmp    1711 <child_exit_yet+0x571>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x6c(%rbp),%eax
mov    %eax,-0xf0(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0xec(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xe8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xf0(%rbp),%esi
mov    -0xec(%rbp),%edx
mov    -0xe8(%rbp),%ecx
mov    %eax,%r8d
lea    0x8a0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x286a(%rip),%rax
mov    (%rax),%rdi
call   10a0 <strerror@plt>
mov    %rax,%rsi
lea    0x917(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x896(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    181a <child_exit_yet+0x67a>
jmp    179f <child_exit_yet+0x5ff>
lea    -0x78(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0xfc(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0xf8(%rbp)
mov    $0x0,%al
call   1080 <getppid@plt>
mov    %eax,-0xf4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xfc(%rbp),%esi
mov    -0xf8(%rbp),%edx
mov    -0xf4(%rbp),%ecx
mov    %eax,%r8d
lea    0x812(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x8b6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x816(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    181a <child_exit_yet+0x67a>
jmp    181f <child_exit_yet+0x67f>
jmp    1824 <child_exit_yet+0x684>
jmp    1829 <child_exit_yet+0x689>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_exit_yet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   10d0 <fork@plt>
test   %rax,%rax
js     1292 <child_exit_yet+0xe2>
je     157e <child_exit_yet+0x3ce>
mov    %rax,%r14
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebx
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdfd(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1070 <kill@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
je     12e2 <child_exit_yet+0x132>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd8b(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdcd(%rip),%rdi
jmp    131f <child_exit_yet+0x16f>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd42(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd40(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1563 <child_exit_yet+0x3b3>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xcf9(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd29(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2c9e(%rip),%r12
movq   $0x0,(%r12)
movl   $0x0,0x14(%rsp)
mov    0x2c97(%rip),%r13
mov    0x0(%r13),%edx
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1080 <waitpid@plt>
lea    0x8(%rsp),%rdi
test   %eax,%eax
je     13b2 <child_exit_yet+0x202>
js     13f6 <child_exit_yet+0x246>
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xc68(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd04(%rip),%rdi
jmp    13f1 <child_exit_yet+0x241>
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xc27(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc7f(%rip),%rdi
mov    %r14,%rsi
jmp    1441 <child_exit_yet+0x291>
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xbe3(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12),%rdi
call   10b0 <strerror@plt>
lea    0xc57(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
movq   $0x0,(%r12)
movl   $0x0,0x14(%rsp)
mov    0x0(%r13),%edx
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1080 <waitpid@plt>
lea    0x8(%rsp),%rdi
test   %eax,%eax
je     14cd <child_exit_yet+0x31d>
js     1511 <child_exit_yet+0x361>
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xb4d(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbe9(%rip),%rdi
jmp    150c <child_exit_yet+0x35c>
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xb0c(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xb64(%rip),%rdi
mov    %r14,%rsi
jmp    155c <child_exit_yet+0x3ac>
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xac8(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12),%rdi
call   10b0 <strerror@plt>
lea    0xb3c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1090 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xa56(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   10c0 <sleep@plt>
mov    $0x3,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [22 x i8] c"%ld.%6ld [%d->%d] -- \00"
@.str.1 = [14 x i8] c"fork() failed\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [26 x i8] c"in child, sleep 2 seconds\00"
@.str.4 = [10 x i8] c"in parent\00"
@.str.5 = [18 x i8] c"child [%d] exists\00"
@.str.6 = [22 x i8] c"child [%d] not exists\00"
@errno = global i64 0
@WNOHANG = global i32 0
@.str.7 = [37 x i8] c"child [%d] has not yet changed state\00"
@.str.8 = [31 x i8] c"waitpid() failed, error = [%s]\00"
@.str.9 = [16 x i8] c"child [%d] exit\00"
define i32 @child_exit_yet(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca %struct.timeval
%9 = alloca %struct.timeval
%10 = alloca %struct.timeval
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.timeval
%14 = alloca %struct.timeval
%15 = alloca %struct.timeval
%16 = alloca %struct.timeval
%17 = alloca %struct.timeval
%18 = alloca %struct.timeval
store i32 %0, i32* %3
store i8** %1, i8*** %4
%19 = call i64 (...) @fork()
store i64 %19, i64* %5
%20 = load i64, i64* %5
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %35
22: ; preds = %2
br label %23
23: ; preds = %22
%24 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%25 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%28 = load i32, i32* %27
%29 = call i32 (...) @getppid()
%30 = call i32 (...) @getpid()
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %28, i32 %29, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %23
br label %207
35: ; preds = %2
%36 = load i64, i64* %5
%37 = icmp eq i64 0, %36
br i1 %37, label %38, label %53
38: ; preds = %35
br label %39
39: ; preds = %38
%40 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%41 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 (...) @getppid()
%46 = call i32 (...) @getpid()
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %42, i32 %44, i32 %45, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %39
%51 = call i32 @sleep(i32 2)
%52 = call i32 @exit(i32 3)
unreachable
53: ; preds = %35
br label %54
54: ; preds = %53
%55 = call i32 @gettimeofday(%struct.timeval* %8, i32* null)
%56 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%57 = load i32, i32* %56
%58 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%59 = load i32, i32* %58
%60 = call i32 (...) @getppid()
%61 = call i32 (...) @getpid()
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %57, i32 %59, i32 %60, i32 %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %65
65: ; preds = %54
%66 = call i32 @sleep(i32 1)
%67 = load i64, i64* %5
%68 = call i64 @kill(i64 %67, i32 0)
%69 = icmp eq i64 0, %68
br i1 %69, label %70, label %84
70: ; preds = %65
br label %71
71: ; preds = %70
%72 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%73 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%74 = load i32, i32* %73
%75 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%76 = load i32, i32* %75
%77 = call i32 (...) @getppid()
%78 = call i32 (...) @getpid()
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %74, i32 %76, i32 %77, i32 %78)
%80 = load i64, i64* %5
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %83
83: ; preds = %71
br label %98
84: ; preds = %65
br label %85
85: ; preds = %84
%86 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%87 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%88 = load i32, i32* %87
%89 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
%90 = load i32, i32* %89
%91 = call i32 (...) @getppid()
%92 = call i32 (...) @getpid()
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %88, i32 %90, i32 %91, i32 %92)
%94 = load i64, i64* %5
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i64 %94)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %97
97: ; preds = %85
br label %98
98: ; preds = %97, %83
store i64 0, i64* @errno
store i32 0, i32* %11
%99 = load i64, i64* %5
%100 = load i32, i32* @WNOHANG
%101 = call i32 @waitpid(i64 %99, i32* %11, i32 %100)
store i32 %101, i32* %12
%102 = load i32, i32* %12
%103 = icmp eq i32 0, %102
br i1 %103, label %104, label %118
104: ; preds = %98
br label %105
105: ; preds = %104
%106 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%107 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%108 = load i32, i32* %107
%109 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%110 = load i32, i32* %109
%111 = call i32 (...) @getppid()
%112 = call i32 (...) @getpid()
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %108, i32 %110, i32 %111, i32 %112)
%114 = load i64, i64* %5
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %114)
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %117
117: ; preds = %105
br label %151
118: ; preds = %98
%119 = load i32, i32* %12
%120 = icmp slt i32 %119, 0
br i1 %120, label %121, label %136
121: ; preds = %118
br label %122
122: ; preds = %121
%123 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%124 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%125 = load i32, i32* %124
%126 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%127 = load i32, i32* %126
%128 = call i32 (...) @getppid()
%129 = call i32 (...) @getpid()
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %125, i32 %127, i32 %128, i32 %129)
%131 = load i64, i64* @errno
%132 = call i8* @strerror(i64 %131)
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %132)
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %135
135: ; preds = %122
br label %150
136: ; preds = %118
br label %137
137: ; preds = %136
%138 = call i32 @gettimeofday(%struct.timeval* %15, i32* null)
%139 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
%140 = load i32, i32* %139
%141 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 0
%142 = load i32, i32* %141
%143 = call i32 (...) @getppid()
%144 = call i32 (...) @getpid()
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %140, i32 %142, i32 %143, i32 %144)
%146 = load i64, i64* %5
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i64 %146)
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %149
149: ; preds = %137
br label %150
150: ; preds = %149, %135
br label %151
151: ; preds = %150, %117
%152 = call i32 @sleep(i32 2)
store i64 0, i64* @errno
store i32 0, i32* %11
%153 = load i64, i64* %5
%154 = load i32, i32* @WNOHANG
%155 = call i32 @waitpid(i64 %153, i32* %11, i32 %154)
store i32 %155, i32* %12
%156 = load i32, i32* %12
%157 = icmp eq i32 0, %156
br i1 %157, label %158, label %172
158: ; preds = %151
br label %159
159: ; preds = %158
%160 = call i32 @gettimeofday(%struct.timeval* %16, i32* null)
%161 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
%162 = load i32, i32* %161
%163 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 0
%164 = load i32, i32* %163
%165 = call i32 (...) @getppid()
%166 = call i32 (...) @getpid()
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %162, i32 %164, i32 %165, i32 %166)
%168 = load i64, i64* %5
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %168)
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %171
171: ; preds = %159
br label %205
172: ; preds = %151
%173 = load i32, i32* %12
%174 = icmp slt i32 %173, 0
br i1 %174, label %175, label %190
175: ; preds = %172
br label %176
176: ; preds = %175
%177 = call i32 @gettimeofday(%struct.timeval* %17, i32* null)
%178 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 1
%179 = load i32, i32* %178
%180 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%181 = load i32, i32* %180
%182 = call i32 (...) @getppid()
%183 = call i32 (...) @getpid()
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %179, i32 %181, i32 %182, i32 %183)
%185 = load i64, i64* @errno
%186 = call i8* @strerror(i64 %185)
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %186)
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %189
189: ; preds = %176
br label %204
190: ; preds = %172
br label %191
191: ; preds = %190
%192 = call i32 @gettimeofday(%struct.timeval* %18, i32* null)
%193 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
%194 = load i32, i32* %193
%195 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
%196 = load i32, i32* %195
%197 = call i32 (...) @getppid()
%198 = call i32 (...) @getpid()
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %194, i32 %196, i32 %197, i32 %198)
%200 = load i64, i64* %5
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i64 %200)
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %203
203: ; preds = %191
br label %204
204: ; preds = %203, %189
br label %205
205: ; preds = %204, %171
br label %206
206: ; preds = %205
br label %207
207: ; preds = %206, %34
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [22 x i8] c"%ld.%6ld [%d->%d] -- \00"
@.str.1 = [14 x i8] c"fork() failed\00"
@.str.3 = [26 x i8] c"in child, sleep 2 seconds\00"
@.str.4 = [10 x i8] c"in parent\00"
@.str.5 = [18 x i8] c"child [%d] exists\00"
@.str.6 = [22 x i8] c"child [%d] not exists\00"
@errno = global i64 0
@WNOHANG = global i32 0
@.str.7 = [37 x i8] c"child [%d] has not yet changed state\00"
@.str.8 = [31 x i8] c"waitpid() failed, error = [%s]\00"
@.str.9 = [16 x i8] c"child [%d] exit\00"
define i32 @child_exit_yet(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca i32
%9 = alloca %struct.timeval
%10 = alloca %struct.timeval
%11 = alloca %struct.timeval
%12 = alloca %struct.timeval
%13 = alloca %struct.timeval
%14 = alloca %struct.timeval
%15 = tail call i64 (...) @fork()
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %2
%18 = bitcast %struct.timeval* %3 to i8*
%19 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%23 = load i32, i32* %22
%24 = tail call i32 (...) @getppid()
%25 = tail call i32 (...) @getpid()
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %23, i32 %24, i32 %25)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%28 = tail call i32 @putchar(i32 10)
br label %175
29: ; preds = %2
%30 = icmp eq i64 %15, 0
br i1 %30, label %31, label %45
31: ; preds = %29
%32 = bitcast %struct.timeval* %4 to i8*
%33 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%34 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%37 = load i32, i32* %36
%38 = tail call i32 (...) @getppid()
%39 = tail call i32 (...) @getpid()
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %37, i32 %38, i32 %39)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%42 = tail call i32 @putchar(i32 10)
%43 = tail call i32 @sleep(i32 2)
%44 = tail call i32 @exit(i32 3)
unreachable
45: ; preds = %29
%46 = bitcast %struct.timeval* %5 to i8*
%47 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%48 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%51 = load i32, i32* %50
%52 = tail call i32 (...) @getppid()
%53 = tail call i32 (...) @getpid()
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %51, i32 %52, i32 %53)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%56 = tail call i32 @putchar(i32 10)
%57 = tail call i32 @sleep(i32 1)
%58 = tail call i64 @kill(i64 %15, i32 0)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %72
60: ; preds = %45
%61 = bitcast %struct.timeval* %6 to i8*
%62 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%63 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%66 = load i32, i32* %65
%67 = tail call i32 (...) @getppid()
%68 = tail call i32 (...) @getpid()
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %64, i32 %66, i32 %67, i32 %68)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 %15)
%71 = tail call i32 @putchar(i32 10)
br label %84
72: ; preds = %45
%73 = bitcast %struct.timeval* %7 to i8*
%74 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%75 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 1
%76 = load i32, i32* %75
%77 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 0
%78 = load i32, i32* %77
%79 = tail call i32 (...) @getppid()
%80 = tail call i32 (...) @getpid()
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %76, i32 %78, i32 %79, i32 %80)
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i64 %15)
%83 = tail call i32 @putchar(i32 10)
br label %84
84: ; preds = %72, %60
store i64 0, i64* @errno
%85 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%86 = load i32, i32* @WNOHANG
%87 = call i32 @waitpid(i64 %15, i32* %8, i32 %86)
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %101
89: ; preds = %84
%90 = bitcast %struct.timeval* %9 to i8*
%91 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%92 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 1
%93 = load i32, i32* %92
%94 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 0
%95 = load i32, i32* %94
%96 = call i32 (...) @getppid()
%97 = call i32 (...) @getpid()
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %93, i32 %95, i32 %96, i32 %97)
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %15)
%100 = call i32 @putchar(i32 10)
br label %129
101: ; preds = %84
%102 = icmp slt i32 %87, 0
br i1 %102, label %103, label %117
103: ; preds = %101
%104 = bitcast %struct.timeval* %10 to i8*
%105 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%106 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 1
%107 = load i32, i32* %106
%108 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 0
%109 = load i32, i32* %108
%110 = call i32 (...) @getppid()
%111 = call i32 (...) @getpid()
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %107, i32 %109, i32 %110, i32 %111)
%113 = load i64, i64* @errno
%114 = call i8* @strerror(i64 %113)
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %114)
%116 = call i32 @putchar(i32 10)
br label %129
117: ; preds = %101
%118 = bitcast %struct.timeval* %11 to i8*
%119 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
%120 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i64 0, i32 1
%121 = load i32, i32* %120
%122 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i64 0, i32 0
%123 = load i32, i32* %122
%124 = call i32 (...) @getppid()
%125 = call i32 (...) @getpid()
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %121, i32 %123, i32 %124, i32 %125)
%127 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i64 %15)
%128 = call i32 @putchar(i32 10)
br label %129
129: ; preds = %103, %117, %89
%130 = call i32 @sleep(i32 2)
store i64 0, i64* @errno
store i32 0, i32* %8
%131 = load i32, i32* @WNOHANG
%132 = call i32 @waitpid(i64 %15, i32* %8, i32 %131)
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %146
134: ; preds = %129
%135 = bitcast %struct.timeval* %12 to i8*
%136 = call i32 @gettimeofday(%struct.timeval* %12, i32* null)
%137 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i64 0, i32 1
%138 = load i32, i32* %137
%139 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i64 0, i32 0
%140 = load i32, i32* %139
%141 = call i32 (...) @getppid()
%142 = call i32 (...) @getpid()
%143 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %138, i32 %140, i32 %141, i32 %142)
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %15)
%145 = call i32 @putchar(i32 10)
br label %174
146: ; preds = %129
%147 = icmp slt i32 %132, 0
br i1 %147, label %148, label %162
148: ; preds = %146
%149 = bitcast %struct.timeval* %13 to i8*
%150 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%151 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i64 0, i32 1
%152 = load i32, i32* %151
%153 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i64 0, i32 0
%154 = load i32, i32* %153
%155 = call i32 (...) @getppid()
%156 = call i32 (...) @getpid()
%157 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %152, i32 %154, i32 %155, i32 %156)
%158 = load i64, i64* @errno
%159 = call i8* @strerror(i64 %158)
%160 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %159)
%161 = call i32 @putchar(i32 10)
br label %174
162: ; preds = %146
%163 = bitcast %struct.timeval* %14 to i8*
%164 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%165 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0, i32 1
%166 = load i32, i32* %165
%167 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0, i32 0
%168 = load i32, i32* %167
%169 = call i32 (...) @getppid()
%170 = call i32 (...) @getpid()
%171 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %166, i32 %168, i32 %169, i32 %170)
%172 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i64 %15)
%173 = call i32 @putchar(i32 10)
br label %174
174: ; preds = %148, %162, %134
br label %175
175: ; preds = %174, %17
ret i32 0
}