#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 WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ getppid();
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
char *strerror(scalar_t__);
scalar_t__ waitpid(scalar_t__, int *, int /*<<< orphan*/);
int child_terminated_normally(int argc, char *argv[]) {
  errno = 0;
  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, error = [%s]", strerror(errno));
      printf("\n");
    } while (0);
    return -1;
  } 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)");
      printf("\n");
    } while (0);
    sleep(2);
    do {
      struct timeval tv;
      gettimeofday(&tv, NULL);
      printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
             getpid());
      printf("exit(0), terminated normally");
      printf("\n");
    } while (0);
    exit(5);
  } 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);
    int st = 0;
    if (waitpid(pid, &st, 0) < 0) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("waitpid() for [%d] failed", 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("waitpid() for [%d] success", pid);
        printf("\n");
      } while (0);
      if (WIFEXITED(st)) {
        do {
          struct timeval tv;
          gettimeofday(&tv, NULL);
          printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
                 getpid());
          printf("child [%d] terminated normally", pid);
          printf("\n");
        } while (0);
        int s = WEXITSTATUS(st);
        do {
          struct timeval tv;
          gettimeofday(&tv, NULL);
          printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
                 getpid());
          printf("child [%d] exit status is : [%d]", pid, s);
          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] terminated unnormally", pid);
          printf("\n");
        } while (0);
      }
      if (WIFSIGNALED(st)) {
        do {
          struct timeval tv;
          gettimeofday(&tv, NULL);
          printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
                 getpid());
          printf("child terminated by a signal");
          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 terminated not by a signal");
          printf("\n");
        } while (0);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<child_terminated_normally>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e07(%rip),%rax
movq   $0x0,(%rax)
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    128b <child_terminated_normally+0xcb>
jmp    11fb <child_terminated_normally+0x3b>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0x84(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x8c(%rbp),%esi
mov    -0x88(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    %eax,%r8d
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    %rax,%rsi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    17dc <child_terminated_normally+0x61c>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1394 <child_terminated_normally+0x1d4>
jmp    129c <child_terminated_normally+0xdc>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0x90(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x98(%rbp),%esi
mov    -0x94(%rbp),%edx
mov    -0x90(%rbp),%ecx
mov    %eax,%r8d
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   10d0 <sleep@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0x9c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xa4(%rbp),%esi
mov    -0xa0(%rbp),%edx
mov    -0x9c(%rbp),%ecx
mov    %eax,%r8d
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcd2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x5,%edi
call   10b0 <exit@plt>
jmp    1399 <child_terminated_normally+0x1d9>
lea    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xa8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xb0(%rbp),%esi
mov    -0xac(%rbp),%edx
mov    -0xa8(%rbp),%ecx
mov    %eax,%r8d
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
xor    %edx,%edx
call   1080 <waitpid@plt>
cmp    $0x0,%rax
jge    14ab <child_terminated_normally+0x2eb>
jmp    1430 <child_terminated_normally+0x270>
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xb4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xbc(%rbp),%esi
mov    -0xb8(%rbp),%edx
mov    -0xb4(%rbp),%ecx
mov    %eax,%r8d
lea    0xb81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    17cb <child_terminated_normally+0x60b>
jmp    14b0 <child_terminated_normally+0x2f0>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0xc4(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xc0(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xc8(%rbp),%esi
mov    -0xc4(%rbp),%edx
mov    -0xc0(%rbp),%ecx
mov    %eax,%r8d
lea    0xb01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xb77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%edi
call   1090 <WIFEXITED@plt>
cmp    $0x0,%rax
je     163c <child_terminated_normally+0x47c>
jmp    153d <child_terminated_normally+0x37d>
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xcc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xd4(%rbp),%esi
mov    -0xd0(%rbp),%edx
mov    -0xcc(%rbp),%ecx
mov    %eax,%r8d
lea    0xa74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xb05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xa86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%edi
call   1070 <WEXITSTATUS@plt>
mov    %eax,-0x5c(%rbp)
lea    -0x68(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x64(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0x68(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xd8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xe0(%rbp),%esi
mov    -0xdc(%rbp),%edx
mov    -0xd8(%rbp),%ecx
mov    %eax,%r8d
lea    0x9f3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x5c(%rbp),%edx
lea    0xaa0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xa02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    16bc <child_terminated_normally+0x4fc>
jmp    1641 <child_terminated_normally+0x481>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x6c(%rbp),%eax
mov    %eax,-0xec(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xe4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xec(%rbp),%esi
mov    -0xe8(%rbp),%edx
mov    -0xe4(%rbp),%ecx
mov    %eax,%r8d
lea    0x970(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xa41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x982(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    16bc <child_terminated_normally+0x4fc>
mov    -0x3c(%rbp),%edi
call   1060 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     174a <child_terminated_normally+0x58a>
jmp    16d3 <child_terminated_normally+0x513>
lea    -0x78(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0xf8(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0xf4(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xf0(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xf8(%rbp),%esi
mov    -0xf4(%rbp),%edx
mov    -0xf0(%rbp),%ecx
mov    %eax,%r8d
lea    0x8de(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x9d4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x8f4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    17c6 <child_terminated_normally+0x606>
jmp    174f <child_terminated_normally+0x58f>
lea    -0x80(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0x100(%rbp)
mov    $0x0,%al
call   10a0 <getppid@plt>
mov    %eax,-0xfc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x104(%rbp),%esi
mov    -0x100(%rbp),%edx
mov    -0xfc(%rbp),%ecx
mov    %eax,%r8d
lea    0x862(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x975(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x878(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    17c6 <child_terminated_normally+0x606>
jmp    17cb <child_terminated_normally+0x60b>
jmp    17d0 <child_terminated_normally+0x610>
jmp    17d5 <child_terminated_normally+0x615>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_terminated_normally>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2dfb(%rip),%r12
movq   $0x0,(%r12)
xor    %eax,%eax
call   10f0 <fork@plt>
test   %rax,%rax
js     139e <child_terminated_normally+0x1ce>
je     1559 <child_terminated_normally+0x389>
mov    %rax,%r15
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebx
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdce(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe18(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,0x14(%rsp)
lea    0x14(%rsp),%rsi
mov    %r15,%rdi
xor    %edx,%edx
call   1090 <waitpid@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
js     1409 <child_terminated_normally+0x239>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd59(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdc7(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
call   10a0 <WIFEXITED@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
je     1455 <child_terminated_normally+0x285>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xcef(%rip),%r14
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd75(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
call   1080 <WEXITSTATUS@plt>
mov    %eax,%r12d
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r13d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd34(%rip),%rdi
mov    %r15,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    149c <child_terminated_normally+0x2cc>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xc36(%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   10d0 <strerror@plt>
lea    0xc2b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%eax
jmp    154a <child_terminated_normally+0x37a>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xbd2(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc26(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    153e <child_terminated_normally+0x36e>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xb86(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc4f(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
call   1070 <WIFSIGNALED@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
je     14fa <child_terminated_normally+0x32a>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xb20(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc0a(%rip),%rdi
jmp    1537 <child_terminated_normally+0x367>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xae1(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbe8(%rip),%rdi
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),%r15d
mov    0xc(%rsp),%ebx
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xa7b(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   10e0 <sleep@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10b0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa4a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x5,%edi
call   10c0 <exit@plt>

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

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