#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 */
typedef int pid_t;

/* Variables and functions */
scalar_t__ ECHILD;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ free(char *);
char *malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, int);
void testpr4(int optional) {
  int fdx;
  pid_t pidx;
  int fd;
  int nread = 0;
  char *buf = NULL;
  pid_t pid;
  int b_read = 0;
  if (!optional) {
    if ((pid = fork()) == -1) {
      printf("ERROR. Process %u could not fork. Exit\n", pid);
      exit(-1);
    } else if (pid == 0) {
      printf("*********Test pr4*********\n");
      printf("Inicio de test con configuracion por defecto\n");
      sleep(1);
      while (nread < 60) {
        fd = open("/proc/modtimer", O_RDONLY);
        buf = malloc(50);
        b_read = read(fd, buf, 50);
        buf[b_read] = '\0';
        printf("%s\n", buf);
        nread++;
        free(buf);
        close(fd);
      }
    } else {
      sleep(10);
      fd = open("/proc/modconfig", O_WRONLY);
      if (fd > 0) {
        write(fd, "emergency_threshold 10\n", 23);
      } else {
        printf("error\n");
        exit(-1);
      }
      close(fd);
      fd = open("/proc/modconfig", O_WRONLY);
      if (fd > 0) {
        write(fd, "max_random 100\n", 15);
      } else {
        printf("error\n");
        exit(-1);
      }
      close(fd);
      fd = open("/proc/modconfig", O_WRONLY);
      if (fd > 0) {
        write(fd, "timer_period 25\n", 16);
      } else {
        printf("error\n");
        exit(-1);
      }
      printf("Inicio de test con configuracion intensiva\n");
      sleep(1);
      close(fd);
    }
    while (wait(NULL) != -1)
      ;
    if (errno != ECHILD) {
      printf("ERROR when waiting for childs to finish\n");
      exit(-1);
    }
  } else {
    if ((pidx = fork()) == -1) {
      printf("ERROR. Process %u could not fork. Exit\n", pidx);
      exit(-1);
    } else if (pidx == 0) {
      printf("*********Test pr4 opcional*********\n");
      printf("Inicio de test con configuracion por defecto\n");
      sleep(1);
      if ((pid = fork()) == -1) {
        printf("ERROR. Process %u could not fork. Exit\n", pid);
        exit(-1);
      } else if (pid == 0) {
        sleep(1);
        fd = open("/proc/modtimer", O_RDONLY);
        while (1) {
          buf = malloc(50);
          b_read = read(fd, buf, 50);
          buf[b_read] = '\0';
          printf("-Impares-\n");
          printf("%s\n", buf);
          free(buf);
        }
        close(fd);
      } else {
        fd = open("/proc/modtimer", O_RDONLY);
        while (1) {
          buf = malloc(50);
          b_read = read(fd, buf, 50);
          buf[b_read] = '\0';
          printf("-Pares-\n");
          printf("%s\n", buf);
          free(buf);
        }
        close(fd);
      }
      while (wait(NULL) != -1)
        ;
      if (errno != ECHILD) {
        printf("ERROR when waiting for childs to finish\n");
        exit(-1);
      }
      exit(0);
    } else {
      sleep(10);
      fdx = open("/proc/modconfig", O_WRONLY);
      if (fdx > 0) {
        write(fdx, "emergency_threshold 10\n", 23);
      } else {
        printf("error\n");
        exit(-1);
      }
      close(fdx);
      fdx = open("/proc/modconfig", O_WRONLY);
      if (fdx > 0) {
        write(fdx, "max_random 10\n", 14);
      } else {
        printf("error\n");
        exit(-1);
      }
      close(fdx);
      fdx = open("/proc/modconfig", O_WRONLY);
      if (fdx > 0) {
        write(fdx, "timer_period 50\n", 16);
      } else {
        printf("error\n");
        exit(-1);
      }
      printf("Inicio de test con configuracion intensiva\n");
      sleep(1);
      close(fdx);
    }
    while (wait(NULL) != -1)
      ;
    if (errno != ECHILD) {
      printf("ERROR when waiting for childs to finish\n");
      exit(-1);
    }
    exit(0);
  }
}


x86 assembly (clang, -O0):
<testpr4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    144a <testpr4+0x29a>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    1209 <testpr4+0x59>
mov    -0x24(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x24(%rbp)
jne    12bf <testpr4+0x10f>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
cmpl   $0x3c,-0x14(%rbp)
jge    12ba <testpr4+0x10a>
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
lea    0xe1f(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x10(%rbp)
mov    $0x32,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x32,%edx
call   1070 <read@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rsi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
jmp    1239 <testpr4+0x89>
jmp    13f2 <testpr4+0x242>
mov    $0xa,%edi
call   10b0 <sleep@plt>
mov    0x2cf0(%rip),%rax
mov    (%rax),%esi
lea    0xdac(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1304 <testpr4+0x154>
mov    -0x10(%rbp),%edi
lea    0xda0(%rip),%rsi
mov    $0x17,%edx
call   1040 <write@plt>
jmp    131c <testpr4+0x16c>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
mov    0x2c95(%rip),%rax
mov    (%rax),%esi
lea    0xd51(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    135f <testpr4+0x1af>
mov    -0x10(%rbp),%edi
lea    0xd64(%rip),%rsi
mov    $0xf,%edx
call   1040 <write@plt>
jmp    1377 <testpr4+0x1c7>
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
mov    0x2c3a(%rip),%rax
mov    (%rax),%esi
lea    0xcf6(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    13ba <testpr4+0x20a>
mov    -0x10(%rbp),%edi
lea    0xd19(%rip),%rsi
mov    $0x10,%edx
call   1040 <write@plt>
jmp    13d2 <testpr4+0x222>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0xcfc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
jmp    13f7 <testpr4+0x247>
jmp    13fc <testpr4+0x24c>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <wait@plt>
cmp    $0xffffffff,%eax
je     1413 <testpr4+0x263>
jmp    13fc <testpr4+0x24c>
mov    0x2bbe(%rip),%rax
mov    (%rax),%rax
mov    0x2bac(%rip),%rcx
cmp    (%rcx),%rax
je     1445 <testpr4+0x295>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
jmp    175f <testpr4+0x5af>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1478 <testpr4+0x2c8>
mov    -0xc(%rbp),%esi
lea    0xb99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0xc(%rbp)
jne    15d2 <testpr4+0x422>
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbad(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    14d6 <testpr4+0x326>
mov    -0x24(%rbp),%esi
lea    0xb3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x24(%rbp)
jne    155e <testpr4+0x3ae>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    0x2af7(%rip),%rax
mov    (%rax),%esi
lea    0xb78(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x10(%rbp)
mov    $0x32,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x32,%edx
call   1070 <read@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xb38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    1502 <testpr4+0x352>
mov    0x2a83(%rip),%rax
mov    (%rax),%esi
lea    0xb04(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x10(%rbp)
mov    $0x32,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x32,%edx
call   1070 <read@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
lea    0xbaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xac4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    1576 <testpr4+0x3c6>
mov    $0xa,%edi
call   10b0 <sleep@plt>
mov    0x29dd(%rip),%rax
mov    (%rax),%esi
lea    0xa99(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1617 <testpr4+0x467>
mov    -0x8(%rbp),%edi
lea    0xa8d(%rip),%rsi
mov    $0x17,%edx
call   1040 <write@plt>
jmp    162f <testpr4+0x47f>
lea    0xa8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    0x2982(%rip),%rax
mov    (%rax),%esi
lea    0xa3e(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1672 <testpr4+0x4c2>
mov    -0x8(%rbp),%edi
lea    0xb00(%rip),%rsi
mov    $0xe,%edx
call   1040 <write@plt>
jmp    168a <testpr4+0x4da>
lea    0xa34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    0x2927(%rip),%rax
mov    (%rax),%esi
lea    0x9e3(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    16cd <testpr4+0x51d>
mov    -0x8(%rbp),%edi
lea    0xab4(%rip),%rsi
mov    $0x10,%edx
call   1040 <write@plt>
jmp    16e5 <testpr4+0x535>
lea    0x9d9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0x9e9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
jmp    170a <testpr4+0x55a>
jmp    170f <testpr4+0x55f>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <wait@plt>
cmp    $0xffffffff,%eax
je     1726 <testpr4+0x576>
jmp    170f <testpr4+0x55f>
mov    0x28ab(%rip),%rax
mov    (%rax),%rax
mov    0x2899(%rip),%rcx
cmp    (%rcx),%rax
je     1758 <testpr4+0x5a8>
lea    0x9ba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testpr4>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   10e0 <fork@plt>
test   %ebx,%ebx
je     127d <testpr4+0xbd>
test   %eax,%eax
jne    147f <testpr4+0x2bf>
lea    0xf2c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf44(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
je     1353 <testpr4+0x193>
cmp    $0xffffffff,%eax
je     1484 <testpr4+0x2c4>
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
lea    0xdfd(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%ebx
lea    0xf2c(%rip),%r14
nopl   0x0(%rax)
mov    $0x32,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %rax,%rsi
mov    $0x32,%edx
call   1080 <read@plt>
cltq
movb   $0x0,0x0(%rbp,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
jmp    1240 <testpr4+0x80>
test   %eax,%eax
je     13bd <testpr4+0x1fd>
cmp    $0xffffffff,%eax
je     1484 <testpr4+0x2c4>
mov    $0xa,%edi
call   10c0 <sleep@plt>
mov    0x2d21(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xd8e(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1586 <testpr4+0x3c6>
mov    %eax,%ebx
lea    0xd88(%rip),%rsi
mov    %eax,%edi
mov    $0x17,%edx
call   1050 <write@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    0x0(%rbp),%esi
lea    0xd5b(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1586 <testpr4+0x3c6>
mov    %eax,%ebx
lea    0xd6d(%rip),%rsi
mov    %eax,%edi
mov    $0xf,%edx
call   1050 <write@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    0x0(%rbp),%esi
lea    0xd28(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1586 <testpr4+0x3c6>
mov    %eax,%ebx
lea    0xd4a(%rip),%rsi
mov    %eax,%edi
mov    $0x10,%edx
call   1050 <write@plt>
lea    0xd89(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    %ebx,%edi
call   1070 <close@plt>
jmp    1450 <testpr4+0x290>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    0x2c84(%rip),%rax
mov    (%rax),%esi
lea    0xcbb(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%ebx
lea    0xdf2(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    $0x32,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %rax,%rsi
mov    $0x32,%edx
call   1080 <read@plt>
cltq
movb   $0x0,0x0(%rbp,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
jmp    1380 <testpr4+0x1c0>
lea    0xcdc(%rip),%rdi
call   1040 <puts@plt>
lea    0xd68(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    $0x3c,%ebp
mov    0x2bfd(%rip),%r12
lea    0xc36(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12),%esi
mov    %r14,%rdi
call   10a0 <open@plt>
mov    %eax,%r15d
mov    $0x32,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %r15d,%edi
mov    %rax,%rsi
mov    $0x32,%edx
call   1080 <read@plt>
cltq
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15d,%edi
call   1070 <close@plt>
add    $0xffffffff,%ebp
jne    1400 <testpr4+0x240>
nop
xor    %edi,%edi
call   10d0 <wait@plt>
cmp    $0xffffffff,%eax
jne    1450 <testpr4+0x290>
mov    0x2b75(%rip),%rax
mov    (%rax),%rax
mov    0x2b63(%rip),%rcx
cmp    (%rcx),%rax
jne    158f <testpr4+0x3cf>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0xffffffff,%eax
jne    14a1 <testpr4+0x2e1>
lea    0xb75(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    $0xa,%edi
call   10c0 <sleep@plt>
mov    0x2b0e(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xb7b(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1586 <testpr4+0x3c6>
mov    %eax,%ebx
lea    0xb75(%rip),%rsi
mov    %eax,%edi
mov    $0x17,%edx
call   1050 <write@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    0x0(%rbp),%esi
lea    0xb48(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1586 <testpr4+0x3c6>
mov    %eax,%ebx
lea    0xb7b(%rip),%rsi
mov    %eax,%edi
mov    $0xe,%edx
call   1050 <write@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    0x0(%rbp),%esi
lea    0xb15(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    1586 <testpr4+0x3c6>
mov    %eax,%ebx
lea    0xb5b(%rip),%rsi
mov    %eax,%edi
mov    $0x10,%edx
call   1050 <write@plt>
lea    0xb7a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %edi,%edi
call   10d0 <wait@plt>
cmp    $0xffffffff,%eax
jne    155d <testpr4+0x39d>
mov    0x2a68(%rip),%rax
mov    (%rax),%rax
mov    0x2a56(%rip),%rcx
cmp    (%rcx),%rax
jne    158f <testpr4+0x3cf>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    0xb2e(%rip),%rdi
jmp    1596 <testpr4+0x3d6>
lea    0xb56(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"ERROR. Process %u could not fork. Exit\0A\00"
@.str.1 = [28 x i8] c"*********Test pr4*********\0A\00"
@.str.2 = [46 x i8] c"Inicio de test con configuracion por defecto\0A\00"
@.str.3 = [15 x i8] c"/proc/modtimer\00"
@O_RDONLY = global i32 0
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [16 x i8] c"/proc/modconfig\00"
@O_WRONLY = global i32 0
@.str.6 = [24 x i8] c"emergency_threshold 10\0A\00"
@.str.7 = [7 x i8] c"error\0A\00"
@.str.8 = [16 x i8] c"max_random 100\0A\00"
@.str.9 = [17 x i8] c"timer_period 25\0A\00"
@.str.10 = [44 x i8] c"Inicio de test con configuracion intensiva\0A\00"
@errno = global i64 0
@ECHILD = global i64 0
@.str.11 = [41 x i8] c"ERROR when waiting for childs to finish\0A\00"
@.str.12 = [37 x i8] c"*********Test pr4 opcional*********\0A\00"
@.str.13 = [11 x i8] c"-Impares-\0A\00"
@.str.14 = [9 x i8] c"-Pares-\0A\00"
@.str.15 = [15 x i8] c"max_random 10\0A\00"
@.str.16 = [17 x i8] c"timer_period 50\0A\00"
define void @testpr4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %6
store i8* null, i8** %7
store i32 0, i32* %9
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %106, label %12
12: ; preds = %1
%13 = call i32 (...) @fork()
store i32 %13, i32* %8
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %12
%20 = load i32, i32* %8
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %49
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @sleep(i32 1)
br label %26
26: ; preds = %29, %22
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 60
br i1 %28, label %29, label %48
29: ; preds = %26
%30 = load i32, i32* @O_RDONLY
%31 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %30)
store i32 %31, i32* %5
%32 = call i8* @malloc(i32 50)
store i8* %32, i8** %7
%33 = load i32, i32* %5
%34 = load i8*, i8** %7
%35 = call i32 @read(i32 %33, i8* %34, i32 50)
store i32 %35, i32* %9
%36 = load i8*, i8** %7
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
store i8 0, i8* %39
%40 = load i8*, i8** %7
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %40)
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
%44 = load i8*, i8** %7
%45 = call i32 @free(i8* %44)
%46 = load i32, i32* %5
%47 = call i32 @close(i32 %46)
br label %26
48: ; preds = %26
br label %92
49: ; preds = %19
%50 = call i32 @sleep(i32 10)
%51 = load i32, i32* @O_WRONLY
%52 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %51)
store i32 %52, i32* %5
%53 = load i32, i32* %5
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %49
%56 = load i32, i32* %5
%57 = call i32 @write(i32 %56, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 23)
br label %61
58: ; preds = %49
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %55
%62 = load i32, i32* %5
%63 = call i32 @close(i32 %62)
%64 = load i32, i32* @O_WRONLY
%65 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %64)
store i32 %65, i32* %5
%66 = load i32, i32* %5
%67 = icmp sgt i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %61
%69 = load i32, i32* %5
%70 = call i32 @write(i32 %69, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 15)
br label %74
71: ; preds = %61
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%73 = call i32 @exit(i32 -1)
unreachable
74: ; preds = %68
%75 = load i32, i32* %5
%76 = call i32 @close(i32 %75)
%77 = load i32, i32* @O_WRONLY
%78 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %77)
store i32 %78, i32* %5
%79 = load i32, i32* %5
%80 = icmp sgt i32 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %74
%82 = load i32, i32* %5
%83 = call i32 @write(i32 %82, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 16)
br label %87
84: ; preds = %74
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%86 = call i32 @exit(i32 -1)
unreachable
87: ; preds = %81
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0))
%89 = call i32 @sleep(i32 1)
%90 = load i32, i32* %5
%91 = call i32 @close(i32 %90)
br label %92
92: ; preds = %87, %48
br label %93
93: ; preds = %92
br label %94
94: ; preds = %97, %93
%95 = call i32 @wait(i32* null)
%96 = icmp ne i32 %95, -1
br i1 %96, label %97, label %98
97: ; preds = %94
br label %94
98: ; preds = %94
%99 = load i64, i64* @errno
%100 = load i64, i64* @ECHILD
%101 = icmp ne i64 %99, %100
br i1 %101, label %102, label %105
102: ; preds = %98
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
%104 = call i32 @exit(i32 -1)
unreachable
105: ; preds = %98
br label %222
106: ; preds = %1
%107 = call i32 (...) @fork()
store i32 %107, i32* %4
%108 = icmp eq i32 %107, -1
br i1 %108, label %109, label %113
109: ; preds = %106
%110 = load i32, i32* %4
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %110)
%112 = call i32 @exit(i32 -1)
unreachable
113: ; preds = %106
%114 = load i32, i32* %4
%115 = icmp eq i32 %114, 0
br i1 %115, label %116, label %164
116: ; preds = %113
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%119 = call i32 @sleep(i32 1)
%120 = call i32 (...) @fork()
store i32 %120, i32* %8
%121 = icmp eq i32 %120, -1
br i1 %121, label %122, label %126
122: ; preds = %116
%123 = load i32, i32* %8
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %123)
%125 = call i32 @exit(i32 -1)
unreachable
126: ; preds = %116
%127 = load i32, i32* %8
%128 = icmp eq i32 %127, 0
br i1 %128, label %129, label %147
129: ; preds = %126
%130 = call i32 @sleep(i32 1)
%131 = load i32, i32* @O_RDONLY
%132 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %131)
store i32 %132, i32* %5
br label %133
133: ; preds = %129, %133
%134 = call i8* @malloc(i32 50)
store i8* %134, i8** %7
%135 = load i32, i32* %5
%136 = load i8*, i8** %7
%137 = call i32 @read(i32 %135, i8* %136, i32 50)
store i32 %137, i32* %9
%138 = load i8*, i8** %7
%139 = load i32, i32* %9
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %138, i64 %140
store i8 0, i8* %141
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
%143 = load i8*, i8** %7
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %143)
%145 = load i8*, i8** %7
%146 = call i32 @free(i8* %145)
br label %133
147: ; preds = %126
%148 = load i32, i32* @O_RDONLY
%149 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %148)
store i32 %149, i32* %5
br label %150
150: ; preds = %147, %150
%151 = call i8* @malloc(i32 50)
store i8* %151, i8** %7
%152 = load i32, i32* %5
%153 = load i8*, i8** %7
%154 = call i32 @read(i32 %152, i8* %153, i32 50)
store i32 %154, i32* %9
%155 = load i8*, i8** %7
%156 = load i32, i32* %9
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %155, i64 %157
store i8 0, i8* %158
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%160 = load i8*, i8** %7
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %160)
%162 = load i8*, i8** %7
%163 = call i32 @free(i8* %162)
br label %150
164: ; preds = %113
%165 = call i32 @sleep(i32 10)
%166 = load i32, i32* @O_WRONLY
%167 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %166)
store i32 %167, i32* %3
%168 = load i32, i32* %3
%169 = icmp sgt i32 %168, 0
br i1 %169, label %170, label %173
170: ; preds = %164
%171 = load i32, i32* %3
%172 = call i32 @write(i32 %171, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 23)
br label %176
173: ; preds = %164
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%175 = call i32 @exit(i32 -1)
unreachable
176: ; preds = %170
%177 = load i32, i32* %3
%178 = call i32 @close(i32 %177)
%179 = load i32, i32* @O_WRONLY
%180 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %179)
store i32 %180, i32* %3
%181 = load i32, i32* %3
%182 = icmp sgt i32 %181, 0
br i1 %182, label %183, label %186
183: ; preds = %176
%184 = load i32, i32* %3
%185 = call i32 @write(i32 %184, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0), i32 14)
br label %189
186: ; preds = %176
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%188 = call i32 @exit(i32 -1)
unreachable
189: ; preds = %183
%190 = load i32, i32* %3
%191 = call i32 @close(i32 %190)
%192 = load i32, i32* @O_WRONLY
%193 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %192)
store i32 %193, i32* %3
%194 = load i32, i32* %3
%195 = icmp sgt i32 %194, 0
br i1 %195, label %196, label %199
196: ; preds = %189
%197 = load i32, i32* %3
%198 = call i32 @write(i32 %197, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i32 16)
br label %202
199: ; preds = %189
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%201 = call i32 @exit(i32 -1)
unreachable
202: ; preds = %196
%203 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0))
%204 = call i32 @sleep(i32 1)
%205 = load i32, i32* %3
%206 = call i32 @close(i32 %205)
br label %207
207: ; preds = %202
br label %208
208: ; preds = %207
br label %209
209: ; preds = %212, %208
%210 = call i32 @wait(i32* null)
%211 = icmp ne i32 %210, -1
br i1 %211, label %212, label %213
212: ; preds = %209
br label %209
213: ; preds = %209
%214 = load i64, i64* @errno
%215 = load i64, i64* @ECHILD
%216 = icmp ne i64 %214, %215
br i1 %216, label %217, label %220
217: ; preds = %213
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
%219 = call i32 @exit(i32 -1)
unreachable
220: ; preds = %213
%221 = call i32 @exit(i32 0)
unreachable
222: ; preds = %105
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"ERROR. Process %u could not fork. Exit\0A\00"
@.str.3 = [15 x i8] c"/proc/modtimer\00"
@O_RDONLY = global i32 0
@.str.5 = [16 x i8] c"/proc/modconfig\00"
@O_WRONLY = global i32 0
@.str.6 = [24 x i8] c"emergency_threshold 10\0A\00"
@.str.8 = [16 x i8] c"max_random 100\0A\00"
@.str.9 = [17 x i8] c"timer_period 25\0A\00"
@errno = global i64 0
@ECHILD = global i64 0
@.str.15 = [15 x i8] c"max_random 10\0A\00"
@.str.16 = [17 x i8] c"timer_period 50\0A\00"
@str.21 = [27 x i8] c"*********Test pr4*********\00"
@str.25 = [6 x i8] c"error\00"
@str.26 = [43 x i8] c"Inicio de test con configuracion intensiva\00"
@str.27 = [40 x i8] c"ERROR when waiting for childs to finish\00"
@str.28 = [36 x i8] c"*********Test pr4 opcional*********\00"
@str.29 = [45 x i8] c"Inicio de test con configuracion por defecto\00"
@str.30 = [8 x i8] c"-Pares-\00"
@str.31 = [10 x i8] c"-Impares-\00"
define void @testpr4(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = tail call i32 (...) @fork()
br i1 %2, label %4, label %67
4: ; preds = %1
switch i32 %3, label %25 [
i32 -1, label %5
i32 0, label %8
]
5: ; preds = %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 -1)
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.21, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.29, i64 0, i64 0))
%11 = tail call i32 @sleep(i32 1)
br label %12
12: ; preds = %8, %12
%13 = phi i32 [ 0, %8 ], [ %21, %12 ]
%14 = load i32, i32* @O_RDONLY
%15 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = tail call dereferenceable_or_null(50) i8* @malloc(i32 50)
%17 = tail call i32 @read(i32 %15, i8* %16, i32 50)
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
%20 = tail call i32 @puts(i8* dereferenceable(1) %16)
%21 = add nuw nsw i32 %13, 1
%22 = tail call i32 @free(i8* %16)
%23 = tail call i32 @close(i32 %15)
%24 = icmp eq i32 %21, 60
br i1 %24, label %53, label %12
25: ; preds = %4
%26 = tail call i32 @sleep(i32 10)
%27 = load i32, i32* @O_WRONLY
%28 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %25
%31 = tail call i32 @write(i32 %28, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 23)
%32 = tail call i32 @close(i32 %28)
%33 = load i32, i32* @O_WRONLY
%34 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %33)
%35 = icmp sgt i32 %34, 0
br i1 %35, label %39, label %45
36: ; preds = %25
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.25, i64 0, i64 0))
%38 = tail call i32 @exit(i32 -1)
unreachable
39: ; preds = %30
%40 = tail call i32 @write(i32 %34, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 15)
%41 = tail call i32 @close(i32 %34)
%42 = load i32, i32* @O_WRONLY
%43 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %42)
%44 = icmp sgt i32 %43, 0
br i1 %44, label %48, label %54
45: ; preds = %30
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.25, i64 0, i64 0))
%47 = tail call i32 @exit(i32 -1)
unreachable
48: ; preds = %39
%49 = tail call i32 @write(i32 %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 16)
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.26, i64 0, i64 0))
%51 = tail call i32 @sleep(i32 1)
%52 = tail call i32 @close(i32 %43)
br label %53
53: ; preds = %12, %48
br label %57
54: ; preds = %39
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.25, i64 0, i64 0))
%56 = tail call i32 @exit(i32 -1)
unreachable
57: ; preds = %53, %57
%58 = tail call i32 @wait(i32* null)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %57
60: ; preds = %57
%61 = load i64, i64* @errno
%62 = load i64, i64* @ECHILD
%63 = icmp eq i64 %61, %62
br i1 %63, label %145, label %64
64: ; preds = %60
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.27, i64 0, i64 0))
%66 = tail call i32 @exit(i32 -1)
unreachable
67: ; preds = %1
switch i32 %3, label %102 [
i32 -1, label %68
i32 0, label %71
]
68: ; preds = %67
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 -1)
%70 = tail call i32 @exit(i32 -1)
unreachable
71: ; preds = %67
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.28, i64 0, i64 0))
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.29, i64 0, i64 0))
%74 = tail call i32 @sleep(i32 1)
%75 = tail call i32 (...) @fork()
switch i32 %75, label %91 [
i32 -1, label %76
i32 0, label %79
]
76: ; preds = %71
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 -1)
%78 = tail call i32 @exit(i32 -1)
unreachable
79: ; preds = %71
%80 = tail call i32 @sleep(i32 1)
%81 = load i32, i32* @O_RDONLY
%82 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %81)
br label %83
83: ; preds = %83, %79
%84 = tail call dereferenceable_or_null(50) i8* @malloc(i32 50)
%85 = tail call i32 @read(i32 %82, i8* %84, i32 50)
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
store i8 0, i8* %87
%88 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.31, i64 0, i64 0))
%89 = tail call i32 @puts(i8* dereferenceable(1) %84)
%90 = tail call i32 @free(i8* %84)
br label %83
91: ; preds = %71
%92 = load i32, i32* @O_RDONLY
%93 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %92)
br label %94
94: ; preds = %94, %91
%95 = tail call dereferenceable_or_null(50) i8* @malloc(i32 50)
%96 = tail call i32 @read(i32 %93, i8* %95, i32 50)
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %95, i64 %97
store i8 0, i8* %98
%99 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.30, i64 0, i64 0))
%100 = tail call i32 @puts(i8* dereferenceable(1) %95)
%101 = tail call i32 @free(i8* %95)
br label %94
102: ; preds = %67
%103 = tail call i32 @sleep(i32 10)
%104 = load i32, i32* @O_WRONLY
%105 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %104)
%106 = icmp sgt i32 %105, 0
br i1 %106, label %107, label %113
107: ; preds = %102
%108 = tail call i32 @write(i32 %105, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 23)
%109 = tail call i32 @close(i32 %105)
%110 = load i32, i32* @O_WRONLY
%111 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %110)
%112 = icmp sgt i32 %111, 0
br i1 %112, label %116, label %122
113: ; preds = %102
%114 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.25, i64 0, i64 0))
%115 = tail call i32 @exit(i32 -1)
unreachable
116: ; preds = %107
%117 = tail call i32 @write(i32 %111, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0), i32 14)
%118 = tail call i32 @close(i32 %111)
%119 = load i32, i32* @O_WRONLY
%120 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %119)
%121 = icmp sgt i32 %120, 0
br i1 %121, label %125, label %130
122: ; preds = %107
%123 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.25, i64 0, i64 0))
%124 = tail call i32 @exit(i32 -1)
unreachable
125: ; preds = %116
%126 = tail call i32 @write(i32 %120, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i32 16)
%127 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.26, i64 0, i64 0))
%128 = tail call i32 @sleep(i32 1)
%129 = tail call i32 @close(i32 %120)
br label %133
130: ; preds = %116
%131 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.25, i64 0, i64 0))
%132 = tail call i32 @exit(i32 -1)
unreachable
133: ; preds = %133, %125
%134 = tail call i32 @wait(i32* null)
%135 = icmp eq i32 %134, -1
br i1 %135, label %136, label %133
136: ; preds = %133
%137 = load i64, i64* @errno
%138 = load i64, i64* @ECHILD
%139 = icmp eq i64 %137, %138
br i1 %139, label %143, label %140
140: ; preds = %136
%141 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.27, i64 0, i64 0))
%142 = tail call i32 @exit(i32 -1)
unreachable
143: ; preds = %136
%144 = tail call i32 @exit(i32 0)
unreachable
145: ; preds = %60
ret void
}