#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*/ SIGINT;
int WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
int WTERMSIG(int);
scalar_t__ errno;
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*/ pause();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
char *strerror(scalar_t__);
scalar_t__ waitpid(scalar_t__, int *, int /*<<< orphan*/);
int child_terminated_by_signal(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(1)");
      printf("\n");
    } while (0);
    sleep(1);
    do {
      struct timeval tv;
      gettimeofday(&tv, NULL);
      printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
             getpid());
      printf("pause()");
      printf("\n");
    } while (0);
    pause();
    do {
      struct timeval tv;
      gettimeofday(&tv, NULL);
      printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
             getpid());
      printf("after pause");
      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("in parent");
      printf("\n");
    } while (0);
    sleep(2);
    if (kill(pid, 0) == 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);
      return 0;
    }
    errno = 0;
    if (kill(pid, SIGINT) < 0) {
      do {
        struct timeval tv;
        gettimeofday(&tv, NULL);
        printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
               getpid());
        printf("kill() to child [%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("kill() to child [%d] success", pid);
        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);
        int sig = WTERMSIG(st);
        do {
          struct timeval tv;
          gettimeofday(&tv, NULL);
          printf("%ld.%6ld [%d->%d] -- ", tv.tv_sec, tv.tv_usec, getppid(),
                 getpid());
          printf("the signal terminated child process : [%d]", sig);
          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_by_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ddf(%rip),%rax
movq   $0x0,(%rax)
mov    $0x0,%al
call   1100 <fork@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    12ab <child_terminated_by_signal+0xcb>
jmp    121b <child_terminated_by_signal+0x3b>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0xbc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xc4(%rbp),%esi
mov    -0xc0(%rbp),%edx
mov    -0xbc(%rbp),%ecx
mov    %eax,%r8d
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1b79 <child_terminated_by_signal+0x999>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1428 <child_terminated_by_signal+0x248>
jmp    12bc <child_terminated_by_signal+0xdc>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0xc8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xd0(%rbp),%esi
mov    -0xcc(%rbp),%edx
mov    -0xc8(%rbp),%ecx
mov    %eax,%r8d
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0xdc(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0xd4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xdc(%rbp),%esi
mov    -0xd8(%rbp),%edx
mov    -0xd4(%rbp),%ecx
mov    %eax,%r8d
lea    0xc79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <pause@plt>
lea    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0xe0(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xe8(%rbp),%esi
mov    -0xe4(%rbp),%edx
mov    -0xe0(%rbp),%ecx
mov    %eax,%r8d
lea    0xc00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1b6d <child_terminated_by_signal+0x98d>
jmp    142d <child_terminated_by_signal+0x24d>
lea    -0x40(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0xf4(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0xf0(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0xec(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xf4(%rbp),%esi
mov    -0xf0(%rbp),%edx
mov    -0xec(%rbp),%ecx
mov    %eax,%r8d
lea    0xb84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   10f0 <sleep@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1070 <kill@plt>
cmp    $0x0,%rax
jne    153e <child_terminated_by_signal+0x35e>
jmp    14c3 <child_terminated_by_signal+0x2e3>
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x100(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0xfc(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0xf8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x100(%rbp),%esi
mov    -0xfc(%rbp),%edx
mov    -0xf8(%rbp),%ecx
mov    %eax,%r8d
lea    0xaee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xb41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    15c5 <child_terminated_by_signal+0x3e5>
jmp    1543 <child_terminated_by_signal+0x363>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x10c(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x108(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x104(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x10c(%rbp),%esi
mov    -0x108(%rbp),%edx
mov    -0x104(%rbp),%ecx
mov    %eax,%r8d
lea    0xa6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xad3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xa80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1b79 <child_terminated_by_signal+0x999>
mov    0x2a0c(%rip),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    0x2a0a(%rip),%rax
mov    (%rax),%esi
call   1070 <kill@plt>
cmp    $0x0,%rax
jge    166f <child_terminated_by_signal+0x48f>
jmp    15f4 <child_terminated_by_signal+0x414>
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x118(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x114(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x110(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x118(%rbp),%esi
mov    -0x114(%rbp),%edx
mov    -0x110(%rbp),%ecx
mov    %eax,%r8d
lea    0x9bd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xa38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x9cf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    16ef <child_terminated_by_signal+0x50f>
jmp    1674 <child_terminated_by_signal+0x494>
lea    -0x60(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x124(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0x120(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x11c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x124(%rbp),%esi
mov    -0x120(%rbp),%edx
mov    -0x11c(%rbp),%ecx
mov    %eax,%r8d
lea    0x93d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x9d4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x94f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    16ef <child_terminated_by_signal+0x50f>
movl   $0x0,-0x64(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x64(%rbp),%rsi
xor    %edx,%edx
call   10b0 <waitpid@plt>
cmp    $0x0,%rax
jge    178f <child_terminated_by_signal+0x5af>
jmp    1714 <child_terminated_by_signal+0x534>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x130(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0x12c(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x128(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x130(%rbp),%esi
mov    -0x12c(%rbp),%edx
mov    -0x128(%rbp),%ecx
mov    %eax,%r8d
lea    0x89d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x951(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x8af(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1b68 <child_terminated_by_signal+0x988>
jmp    1794 <child_terminated_by_signal+0x5b4>
lea    -0x78(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0x13c(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x138(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x134(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x13c(%rbp),%esi
mov    -0x138(%rbp),%edx
mov    -0x134(%rbp),%ecx
mov    %eax,%r8d
lea    0x81d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x8eb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x82f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%edi
call   10c0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     192f <child_terminated_by_signal+0x74f>
jmp    1821 <child_terminated_by_signal+0x641>
lea    -0x80(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x148(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0x144(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x140(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x148(%rbp),%esi
mov    -0x144(%rbp),%edx
mov    -0x140(%rbp),%ecx
mov    %eax,%r8d
lea    0x790(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x879(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x7a2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%edi
call   10a0 <WEXITSTATUS@plt>
mov    %eax,-0x84(%rbp)
lea    -0x90(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x154(%rbp)
mov    -0x90(%rbp),%eax
mov    %eax,-0x150(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x14c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x154(%rbp),%esi
mov    -0x150(%rbp),%edx
mov    -0x14c(%rbp),%ecx
mov    %eax,%r8d
lea    0x703(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x84(%rbp),%edx
lea    0x805(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x70f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    19b8 <child_terminated_by_signal+0x7d8>
jmp    1934 <child_terminated_by_signal+0x754>
lea    -0x98(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x94(%rbp),%eax
mov    %eax,-0x160(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0x15c(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x158(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x160(%rbp),%esi
mov    -0x15c(%rbp),%edx
mov    -0x158(%rbp),%ecx
mov    %eax,%r8d
lea    0x674(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0x79d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x686(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    19b8 <child_terminated_by_signal+0x7d8>
mov    -0x64(%rbp),%edi
call   1060 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     1ade <child_terminated_by_signal+0x8fe>
jmp    19cf <child_terminated_by_signal+0x7ef>
lea    -0xa0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x9c(%rbp),%eax
mov    %eax,-0x16c(%rbp)
mov    -0xa0(%rbp),%eax
mov    %eax,-0x168(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x164(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x16c(%rbp),%esi
mov    -0x168(%rbp),%edx
mov    -0x164(%rbp),%ecx
mov    %eax,%r8d
lea    0x5d9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x727(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x5ef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%edi
call   1090 <WTERMSIG@plt>
mov    %eax,-0xa4(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0xac(%rbp),%eax
mov    %eax,-0x178(%rbp)
mov    -0xb0(%rbp),%eax
mov    %eax,-0x174(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x170(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x178(%rbp),%esi
mov    -0x174(%rbp),%edx
mov    -0x170(%rbp),%ecx
mov    %eax,%r8d
lea    0x550(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xa4(%rbp),%esi
lea    0x6b5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x560(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1b63 <child_terminated_by_signal+0x983>
jmp    1ae3 <child_terminated_by_signal+0x903>
lea    -0xb8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0xb4(%rbp),%eax
mov    %eax,-0x184(%rbp)
mov    -0xb8(%rbp),%eax
mov    %eax,-0x180(%rbp)
mov    $0x0,%al
call   10d0 <getppid@plt>
mov    %eax,-0x17c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x184(%rbp),%esi
mov    -0x180(%rbp),%edx
mov    -0x17c(%rbp),%ecx
mov    %eax,%r8d
lea    0x4c5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x65b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x4db(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1b63 <child_terminated_by_signal+0x983>
jmp    1b68 <child_terminated_by_signal+0x988>
jmp    1b6d <child_terminated_by_signal+0x98d>
jmp    1b72 <child_terminated_by_signal+0x992>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_terminated_by_signal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2dd3(%rip),%r13
movq   $0x0,0x0(%r13)
xor    %eax,%eax
call   1110 <fork@plt>
test   %rax,%rax
js     12ee <child_terminated_by_signal+0xfe>
je     135a <child_terminated_by_signal+0x16a>
mov    %rax,%r14
xor    %r15d,%r15d
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdab(%rip),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   1100 <sleep@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1080 <kill@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
je     146d <child_terminated_by_signal+0x27d>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd39(%rip),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd96(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    145e <child_terminated_by_signal+0x26e>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xce6(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%rdi
call   10f0 <strerror@plt>
lea    0xcdb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%r15d
jmp    1866 <child_terminated_by_signal+0x676>
xor    %r15d,%r15d
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebx
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xc77(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc8e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1100 <sleep@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc46(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1090 <pause@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbf6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1866 <child_terminated_by_signal+0x676>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xb6e(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbb9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movq   $0x0,0x0(%r13)
mov    0x2b1b(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1080 <kill@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
js     1522 <child_terminated_by_signal+0x332>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xaf8(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xb87(%rip),%rdi
jmp    155f <child_terminated_by_signal+0x36f>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xab9(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xb2c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,0x14(%rsp)
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %edx,%edx
call   10c0 <waitpid@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
js     16b6 <child_terminated_by_signal+0x4c6>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xa41(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xb07(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
call   10d0 <WIFEXITED@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
test   %rax,%rax
je     1702 <child_terminated_by_signal+0x512>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebx
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x9d7(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xab5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
call   10b0 <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   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa74(%rip),%rdi
mov    %r14,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1749 <child_terminated_by_signal+0x559>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x925(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9d1(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1859 <child_terminated_by_signal+0x669>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x8d9(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9fa(%rip),%rdi
mov    %r14,%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     1815 <child_terminated_by_signal+0x625>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebx
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x86f(%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    0x9ae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
call   10a0 <WTERMSIG@plt>
mov    %eax,%r15d
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x96e(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1859 <child_terminated_by_signal+0x669>
call   1060 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   10e0 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0x7c6(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x950(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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(1)\00"
@.str.4 = [8 x i8] c"pause()\00"
@.str.5 = [12 x i8] c"after pause\00"
@.str.6 = [10 x i8] c"in parent\00"
@.str.7 = [18 x i8] c"child [%d] exists\00"
@.str.8 = [22 x i8] c"child [%d] not exists\00"
@SIGINT = global i32 0
@.str.9 = [28 x i8] c"kill() to child [%d] failed\00"
@.str.10 = [29 x i8] c"kill() to child [%d] success\00"
@.str.11 = [26 x i8] c"waitpid() for [%d] failed\00"
@.str.12 = [27 x i8] c"waitpid() for [%d] success\00"
@.str.13 = [31 x i8] c"child [%d] terminated normally\00"
@.str.14 = [33 x i8] c"child [%d] exit status is : [%d]\00"
@.str.15 = [33 x i8] c"child [%d] terminated unnormally\00"
@.str.16 = [29 x i8] c"child terminated by a signal\00"
@.str.17 = [43 x i8] c"the signal terminated child process : [%d]\00"
@.str.18 = [33 x i8] c"child terminated not by a signal\00"
define i32 @child_terminated_by_signal(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 %struct.timeval
%12 = alloca %struct.timeval
%13 = alloca %struct.timeval
%14 = alloca %struct.timeval
%15 = alloca %struct.timeval
%16 = alloca i32
%17 = alloca %struct.timeval
%18 = alloca %struct.timeval
%19 = alloca %struct.timeval
%20 = alloca i32
%21 = alloca %struct.timeval
%22 = alloca %struct.timeval
%23 = alloca %struct.timeval
%24 = alloca i32
%25 = alloca %struct.timeval
%26 = alloca %struct.timeval
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* @errno
%27 = call i64 (...) @fork()
store i64 %27, i64* %6
%28 = load i64, i64* %6
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %45
30: ; preds = %2
br label %31
31: ; preds = %30
%32 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%33 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%34 = load i32, i32* %33
%35 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%36 = load i32, i32* %35
%37 = call i32 (...) @getppid()
%38 = call i32 (...) @getpid()
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %34, i32 %36, i32 %37, i32 %38)
%40 = load i64, i64* @errno
%41 = call i8* @strerror(i64 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %31
store i32 -1, i32* %3
br label %293
45: ; preds = %2
%46 = load i64, i64* %6
%47 = icmp eq i64 0, %46
br i1 %47, label %48, label %87
48: ; preds = %45
br label %49
49: ; preds = %48
%50 = call i32 @gettimeofday(%struct.timeval* %8, i32* null)
%51 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%52 = load i32, i32* %51
%53 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%54 = load i32, i32* %53
%55 = call i32 (...) @getppid()
%56 = call i32 (...) @getpid()
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %52, i32 %54, i32 %55, i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %49
%61 = call i32 @sleep(i32 1)
br label %62
62: ; preds = %60
%63 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%64 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%65 = load i32, i32* %64
%66 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%67 = load i32, i32* %66
%68 = call i32 (...) @getppid()
%69 = call i32 (...) @getpid()
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %65, i32 %67, i32 %68, i32 %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %73
73: ; preds = %62
%74 = call i32 (...) @pause()
br label %75
75: ; preds = %73
%76 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%77 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%78 = load i32, i32* %77
%79 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
%80 = load i32, i32* %79
%81 = call i32 (...) @getppid()
%82 = call i32 (...) @getpid()
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %78, i32 %80, i32 %81, i32 %82)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %86
86: ; preds = %75
br label %291
87: ; preds = %45
br label %88
88: ; preds = %87
%89 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
%90 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%91 = load i32, i32* %90
%92 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%93 = load i32, i32* %92
%94 = call i32 (...) @getppid()
%95 = call i32 (...) @getpid()
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %91, i32 %93, i32 %94, i32 %95)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %99
99: ; preds = %88
%100 = call i32 @sleep(i32 2)
%101 = load i64, i64* %6
%102 = call i64 @kill(i64 %101, i32 0)
%103 = icmp eq i64 %102, 0
br i1 %103, label %104, label %118
104: ; preds = %99
br label %105
105: ; preds = %104
%106 = call i32 @gettimeofday(%struct.timeval* %12, i32* null)
%107 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%108 = load i32, i32* %107
%109 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, 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* %6
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 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 %132
118: ; preds = %99
br label %119
119: ; preds = %118
%120 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%121 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%122 = load i32, i32* %121
%123 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%124 = load i32, i32* %123
%125 = call i32 (...) @getppid()
%126 = call i32 (...) @getpid()
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %122, i32 %124, i32 %125, i32 %126)
%128 = load i64, i64* %6
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i64 %128)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %131
131: ; preds = %119
store i32 0, i32* %3
br label %293
132: ; preds = %117
store i64 0, i64* @errno
%133 = load i64, i64* %6
%134 = load i32, i32* @SIGINT
%135 = call i64 @kill(i64 %133, i32 %134)
%136 = icmp slt i64 %135, 0
br i1 %136, label %137, label %151
137: ; preds = %132
br label %138
138: ; preds = %137
%139 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%140 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%141 = load i32, i32* %140
%142 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%143 = load i32, i32* %142
%144 = call i32 (...) @getppid()
%145 = call i32 (...) @getpid()
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %141, i32 %143, i32 %144, i32 %145)
%147 = load i64, i64* %6
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i64 %147)
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %150
150: ; preds = %138
br label %165
151: ; preds = %132
br label %152
152: ; preds = %151
%153 = call i32 @gettimeofday(%struct.timeval* %15, i32* null)
%154 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
%155 = load i32, i32* %154
%156 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 0
%157 = load i32, i32* %156
%158 = call i32 (...) @getppid()
%159 = call i32 (...) @getpid()
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %155, i32 %157, i32 %158, i32 %159)
%161 = load i64, i64* %6
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i64 %161)
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %164
164: ; preds = %152
br label %165
165: ; preds = %164, %150
store i32 0, i32* %16
%166 = load i64, i64* %6
%167 = call i64 @waitpid(i64 %166, i32* %16, i32 0)
%168 = icmp slt i64 %167, 0
br i1 %168, label %169, label %183
169: ; preds = %165
br label %170
170: ; preds = %169
%171 = call i32 @gettimeofday(%struct.timeval* %17, i32* null)
%172 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 1
%173 = load i32, i32* %172
%174 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%175 = load i32, i32* %174
%176 = call i32 (...) @getppid()
%177 = call i32 (...) @getpid()
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %173, i32 %175, i32 %176, i32 %177)
%179 = load i64, i64* %6
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 %179)
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %182
182: ; preds = %170
br label %290
183: ; preds = %165
br label %184
184: ; preds = %183
%185 = call i32 @gettimeofday(%struct.timeval* %18, i32* null)
%186 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
%187 = load i32, i32* %186
%188 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
%189 = load i32, i32* %188
%190 = call i32 (...) @getppid()
%191 = call i32 (...) @getpid()
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %187, i32 %189, i32 %190, i32 %191)
%193 = load i64, i64* %6
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i64 %193)
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %196
196: ; preds = %184
%197 = load i32, i32* %16
%198 = call i64 @WIFEXITED(i32 %197)
%199 = icmp ne i64 %198, 0
br i1 %199, label %200, label %230
200: ; preds = %196
br label %201
201: ; preds = %200
%202 = call i32 @gettimeofday(%struct.timeval* %19, i32* null)
%203 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 1
%204 = load i32, i32* %203
%205 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
%206 = load i32, i32* %205
%207 = call i32 (...) @getppid()
%208 = call i32 (...) @getpid()
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %204, i32 %206, i32 %207, i32 %208)
%210 = load i64, i64* %6
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i64 %210)
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %213
213: ; preds = %201
%214 = load i32, i32* %16
%215 = call i32 @WEXITSTATUS(i32 %214)
store i32 %215, i32* %20
br label %216
216: ; preds = %213
%217 = call i32 @gettimeofday(%struct.timeval* %21, i32* null)
%218 = getelementptr inbounds %struct.timeval, %struct.timeval* %21, i32 0, i32 1
%219 = load i32, i32* %218
%220 = getelementptr inbounds %struct.timeval, %struct.timeval* %21, i32 0, i32 0
%221 = load i32, i32* %220
%222 = call i32 (...) @getppid()
%223 = call i32 (...) @getpid()
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %219, i32 %221, i32 %222, i32 %223)
%225 = load i64, i64* %6
%226 = load i32, i32* %20
%227 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0), i64 %225, i32 %226)
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %229
229: ; preds = %216
br label %244
230: ; preds = %196
br label %231
231: ; preds = %230
%232 = call i32 @gettimeofday(%struct.timeval* %22, i32* null)
%233 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i32 0, i32 1
%234 = load i32, i32* %233
%235 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i32 0, i32 0
%236 = load i32, i32* %235
%237 = call i32 (...) @getppid()
%238 = call i32 (...) @getpid()
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %234, i32 %236, i32 %237, i32 %238)
%240 = load i64, i64* %6
%241 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.15, i64 0, i64 0), i64 %240)
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %243
243: ; preds = %231
br label %244
244: ; preds = %243, %229
%245 = load i32, i32* %16
%246 = call i64 @WIFSIGNALED(i32 %245)
%247 = icmp ne i64 %246, 0
br i1 %247, label %248, label %276
248: ; preds = %244
br label %249
249: ; preds = %248
%250 = call i32 @gettimeofday(%struct.timeval* %23, i32* null)
%251 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 1
%252 = load i32, i32* %251
%253 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 0
%254 = load i32, i32* %253
%255 = call i32 (...) @getppid()
%256 = call i32 (...) @getpid()
%257 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %252, i32 %254, i32 %255, i32 %256)
%258 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.16, i64 0, i64 0))
%259 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %260
260: ; preds = %249
%261 = load i32, i32* %16
%262 = call i32 @WTERMSIG(i32 %261)
store i32 %262, i32* %24
br label %263
263: ; preds = %260
%264 = call i32 @gettimeofday(%struct.timeval* %25, i32* null)
%265 = getelementptr inbounds %struct.timeval, %struct.timeval* %25, i32 0, i32 1
%266 = load i32, i32* %265
%267 = getelementptr inbounds %struct.timeval, %struct.timeval* %25, i32 0, i32 0
%268 = load i32, i32* %267
%269 = call i32 (...) @getppid()
%270 = call i32 (...) @getpid()
%271 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %266, i32 %268, i32 %269, i32 %270)
%272 = load i32, i32* %24
%273 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.17, i64 0, i64 0), i32 %272)
%274 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %275
275: ; preds = %263
br label %289
276: ; preds = %244
br label %277
277: ; preds = %276
%278 = call i32 @gettimeofday(%struct.timeval* %26, i32* null)
%279 = getelementptr inbounds %struct.timeval, %struct.timeval* %26, i32 0, i32 1
%280 = load i32, i32* %279
%281 = getelementptr inbounds %struct.timeval, %struct.timeval* %26, i32 0, i32 0
%282 = load i32, i32* %281
%283 = call i32 (...) @getppid()
%284 = call i32 (...) @getpid()
%285 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %280, i32 %282, i32 %283, i32 %284)
%286 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.18, i64 0, i64 0))
%287 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %288
288: ; preds = %277
br label %289
289: ; preds = %288, %275
br label %290
290: ; preds = %289, %182
br label %291
291: ; preds = %290, %86
br label %292
292: ; preds = %291
store i32 0, i32* %3
br label %293
293: ; preds = %292, %131, %44
%294 = load i32, i32* %3
ret i32 %294
}

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(1)\00"
@.str.4 = [8 x i8] c"pause()\00"
@.str.5 = [12 x i8] c"after pause\00"
@.str.6 = [10 x i8] c"in parent\00"
@.str.7 = [18 x i8] c"child [%d] exists\00"
@.str.8 = [22 x i8] c"child [%d] not exists\00"
@SIGINT = global i32 0
@.str.9 = [28 x i8] c"kill() to child [%d] failed\00"
@.str.10 = [29 x i8] c"kill() to child [%d] success\00"
@.str.11 = [26 x i8] c"waitpid() for [%d] failed\00"
@.str.12 = [27 x i8] c"waitpid() for [%d] success\00"
@.str.13 = [31 x i8] c"child [%d] terminated normally\00"
@.str.14 = [33 x i8] c"child [%d] exit status is : [%d]\00"
@.str.15 = [33 x i8] c"child [%d] terminated unnormally\00"
@.str.16 = [29 x i8] c"child terminated by a signal\00"
@.str.17 = [43 x i8] c"the signal terminated child process : [%d]\00"
@.str.18 = [33 x i8] c"child terminated not by a signal\00"
define i32 @child_terminated_by_signal(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 %struct.timeval
%9 = alloca %struct.timeval
%10 = alloca %struct.timeval
%11 = alloca %struct.timeval
%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
%19 = alloca %struct.timeval
%20 = alloca %struct.timeval
store i64 0, i64* @errno
%21 = tail call i64 (...) @fork()
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %37
23: ; preds = %2
%24 = bitcast %struct.timeval* %3 to i8*
%25 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%29 = load i32, i32* %28
%30 = tail call i32 (...) @getppid()
%31 = tail call i32 (...) @getpid()
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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 = tail call i8* @strerror(i64 %33)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = tail call i32 @putchar(i32 10)
br label %251
37: ; preds = %2
%38 = icmp eq i64 %21, 0
br i1 %38, label %39, label %75
39: ; preds = %37
%40 = bitcast %struct.timeval* %4 to i8*
%41 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%42 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%43 = load i32, i32* %42
%44 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%45 = load i32, i32* %44
%46 = tail call i32 (...) @getppid()
%47 = tail call i32 (...) @getpid()
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %43, i32 %45, i32 %46, i32 %47)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%50 = tail call i32 @putchar(i32 10)
%51 = tail call i32 @sleep(i32 1)
%52 = bitcast %struct.timeval* %5 to i8*
%53 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%54 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%55 = load i32, i32* %54
%56 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%57 = load i32, i32* %56
%58 = tail call i32 (...) @getppid()
%59 = tail call i32 (...) @getpid()
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %55, i32 %57, i32 %58, i32 %59)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%62 = tail call i32 @putchar(i32 10)
%63 = tail call i32 (...) @pause()
%64 = bitcast %struct.timeval* %6 to i8*
%65 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%66 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%67 = load i32, i32* %66
%68 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%69 = load i32, i32* %68
%70 = tail call i32 (...) @getppid()
%71 = tail call i32 (...) @getpid()
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %67, i32 %69, i32 %70, i32 %71)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%74 = tail call i32 @putchar(i32 10)
br label %251
75: ; preds = %37
%76 = bitcast %struct.timeval* %7 to i8*
%77 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%78 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 1
%79 = load i32, i32* %78
%80 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 0
%81 = load i32, i32* %80
%82 = tail call i32 (...) @getppid()
%83 = tail call i32 (...) @getpid()
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %79, i32 %81, i32 %82, i32 %83)
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%86 = tail call i32 @putchar(i32 10)
%87 = tail call i32 @sleep(i32 2)
%88 = tail call i64 @kill(i64 %21, i32 0)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %105
90: ; preds = %75
%91 = bitcast %struct.timeval* %8 to i8*
%92 = call i32 @gettimeofday(%struct.timeval* %8, i32* null)
%93 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 1
%94 = load i32, i32* %93
%95 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 0
%96 = load i32, i32* %95
%97 = tail call i32 (...) @getppid()
%98 = tail call i32 (...) @getpid()
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %94, i32 %96, i32 %97, i32 %98)
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i64 %21)
%101 = tail call i32 @putchar(i32 10)
store i64 0, i64* @errno
%102 = load i32, i32* @SIGINT
%103 = tail call i64 @kill(i64 %21, i32 %102)
%104 = icmp slt i64 %103, 0
br i1 %104, label %117, label %129
105: ; preds = %75
%106 = bitcast %struct.timeval* %9 to i8*
%107 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%108 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 1
%109 = load i32, i32* %108
%110 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 0
%111 = load i32, i32* %110
%112 = tail call i32 (...) @getppid()
%113 = tail call i32 (...) @getpid()
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %109, i32 %111, i32 %112, i32 %113)
%115 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i64 %21)
%116 = tail call i32 @putchar(i32 10)
br label %251
117: ; preds = %90
%118 = bitcast %struct.timeval* %10 to i8*
%119 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%120 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 1
%121 = load i32, i32* %120
%122 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 0
%123 = load i32, i32* %122
%124 = tail call i32 (...) @getppid()
%125 = tail call i32 (...) @getpid()
%126 = tail 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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i64 %21)
%128 = tail call i32 @putchar(i32 10)
br label %141
129: ; preds = %90
%130 = bitcast %struct.timeval* %11 to i8*
%131 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
%132 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i64 0, i32 1
%133 = load i32, i32* %132
%134 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i64 0, i32 0
%135 = load i32, i32* %134
%136 = tail call i32 (...) @getppid()
%137 = tail call i32 (...) @getpid()
%138 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %133, i32 %135, i32 %136, i32 %137)
%139 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i64 %21)
%140 = tail call i32 @putchar(i32 10)
br label %141
141: ; preds = %129, %117
%142 = bitcast i32* %12 to i8*
store i32 0, i32* %12
%143 = call i64 @waitpid(i64 %21, i32* %12, i32 0)
%144 = icmp slt i64 %143, 0
br i1 %144, label %145, label %157
145: ; preds = %141
%146 = bitcast %struct.timeval* %13 to i8*
%147 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%148 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i64 0, i32 1
%149 = load i32, i32* %148
%150 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i64 0, i32 0
%151 = load i32, i32* %150
%152 = call i32 (...) @getppid()
%153 = call i32 (...) @getpid()
%154 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %149, i32 %151, i32 %152, i32 %153)
%155 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i64 %21)
%156 = call i32 @putchar(i32 10)
br label %250
157: ; preds = %141
%158 = bitcast %struct.timeval* %14 to i8*
%159 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%160 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0, i32 1
%161 = load i32, i32* %160
%162 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0, i32 0
%163 = load i32, i32* %162
%164 = call i32 (...) @getppid()
%165 = call i32 (...) @getpid()
%166 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %161, i32 %163, i32 %164, i32 %165)
%167 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i64 %21)
%168 = call i32 @putchar(i32 10)
%169 = load i32, i32* %12
%170 = call i64 @WIFEXITED(i32 %169)
%171 = icmp eq i64 %170, 0
br i1 %171, label %197, label %172
172: ; preds = %157
%173 = bitcast %struct.timeval* %15 to i8*
%174 = call i32 @gettimeofday(%struct.timeval* %15, i32* null)
%175 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i64 0, i32 1
%176 = load i32, i32* %175
%177 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i64 0, i32 0
%178 = load i32, i32* %177
%179 = call i32 (...) @getppid()
%180 = call i32 (...) @getpid()
%181 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %176, i32 %178, i32 %179, i32 %180)
%182 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i64 %21)
%183 = call i32 @putchar(i32 10)
%184 = load i32, i32* %12
%185 = call i32 @WEXITSTATUS(i32 %184)
%186 = bitcast %struct.timeval* %16 to i8*
%187 = call i32 @gettimeofday(%struct.timeval* %16, i32* null)
%188 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i64 0, i32 1
%189 = load i32, i32* %188
%190 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i64 0, i32 0
%191 = load i32, i32* %190
%192 = call i32 (...) @getppid()
%193 = call i32 (...) @getpid()
%194 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %189, i32 %191, i32 %192, i32 %193)
%195 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0), i64 %21, i32 %185)
%196 = call i32 @putchar(i32 10)
br label %209
197: ; preds = %157
%198 = bitcast %struct.timeval* %17 to i8*
%199 = call i32 @gettimeofday(%struct.timeval* %17, i32* null)
%200 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i64 0, i32 1
%201 = load i32, i32* %200
%202 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i64 0, i32 0
%203 = load i32, i32* %202
%204 = call i32 (...) @getppid()
%205 = call i32 (...) @getpid()
%206 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %201, i32 %203, i32 %204, i32 %205)
%207 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.15, i64 0, i64 0), i64 %21)
%208 = call i32 @putchar(i32 10)
br label %209
209: ; preds = %197, %172
%210 = load i32, i32* %12
%211 = call i64 @WIFSIGNALED(i32 %210)
%212 = icmp eq i64 %211, 0
br i1 %212, label %238, label %213
213: ; preds = %209
%214 = bitcast %struct.timeval* %18 to i8*
%215 = call i32 @gettimeofday(%struct.timeval* %18, i32* null)
%216 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i64 0, i32 1
%217 = load i32, i32* %216
%218 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i64 0, i32 0
%219 = load i32, i32* %218
%220 = call i32 (...) @getppid()
%221 = call i32 (...) @getpid()
%222 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %217, i32 %219, i32 %220, i32 %221)
%223 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.16, i64 0, i64 0))
%224 = call i32 @putchar(i32 10)
%225 = load i32, i32* %12
%226 = call i32 @WTERMSIG(i32 %225)
%227 = bitcast %struct.timeval* %19 to i8*
%228 = call i32 @gettimeofday(%struct.timeval* %19, i32* null)
%229 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i64 0, i32 1
%230 = load i32, i32* %229
%231 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i64 0, i32 0
%232 = load i32, i32* %231
%233 = call i32 (...) @getppid()
%234 = call i32 (...) @getpid()
%235 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %230, i32 %232, i32 %233, i32 %234)
%236 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.17, i64 0, i64 0), i32 %226)
%237 = call i32 @putchar(i32 10)
br label %250
238: ; preds = %209
%239 = bitcast %struct.timeval* %20 to i8*
%240 = call i32 @gettimeofday(%struct.timeval* %20, i32* null)
%241 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i64 0, i32 1
%242 = load i32, i32* %241
%243 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i64 0, i32 0
%244 = load i32, i32* %243
%245 = call i32 (...) @getppid()
%246 = call i32 (...) @getpid()
%247 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %242, i32 %244, i32 %245, i32 %246)
%248 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.18, i64 0, i64 0))
%249 = call i32 @putchar(i32 10)
br label %250
250: ; preds = %213, %238, %145
br label %251
251: ; preds = %250, %39, %105, %23
%252 = phi i32 [ -1, %23 ], [ 0, %105 ], [ 0, %39 ], [ 0, %250 ]
ret i32 %252
}