#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 /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ msg;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *,
                          int *, int *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int rand();
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, int);
int child(int argc, char *argv[]) {
  char msg[64];
  int n, i;
  time_t t;
  srand((unsigned)time(&t));
  int temp = atoi(argv[1]);
  int fd = atoi(argv[2]);
  int n3;
  read(fd, msg, 64);
  sscanf(msg, "%d", &n3);
  char txt_file[64];
  sprintf(txt_file, "%s%d", "data", n3);
  FILE *in = fopen(strcat(txt_file, ".txt"), "r");
  int input_num[5];
  fscanf(in, "%d %d %d %d %d", &input_num[0], &input_num[1], &input_num[2],
         &input_num[3], &input_num[4]);
  int fd1 = atoi(argv[3]);
  memset(&msg[0], 0, sizeof(msg));
  sprintf(msg, "%d", 222);
  write(fd1, msg, 64);
  int n1, n2;
  int count = 0, num_n = 0;
  while (1) {
    memset(&msg[0], 0, sizeof(msg));
    read(fd, msg, 64);
    sscanf(msg, "%d", &n);
    if (n == 111) {
      num_n = 0;
      for (i = 0; i < 5; i++) {
        if (input_num[i] > 0)
          num_n++;
      }
      if (num_n == 0) {
        sprintf(msg, "%d", -1);
        write(fd1, msg, 64);
      } else {
        int rnd_n = rand() % num_n;
        for (i = 0; i < 5; i++) {
          if (input_num[i] > 0 && rnd_n == 0) {
            sprintf(msg, "%d", input_num[i]);
            write(fd1, msg, 64);
            break;
          } else if (input_num[i] > 0)
            rnd_n--;
        }
      }
    } else if (n == 666) {
      read(fd, msg, 64);
      sscanf(msg, "%d", &n1);
      count = 0;
      for (i = 0; i < 5; i++) {
        if (input_num[i] > n1)
          count++;
      }
      memset(&msg[0], 0, sizeof(msg));
      sprintf(msg, "%d", count);
      write(fd1, msg, 64);
      read(fd, msg, 64);
      sscanf(msg, "%d", &n2);
      if (n2 == 333) {
        for (i = 0; i < 5; i++) {
          if (input_num[i] < n1)
            input_num[i] = -1;
        }
      }
      if (n2 == 444) {
        for (i = 0; i < 5; i++) {
          if (input_num[i] > n1)
            input_num[i] = -1;
        }
      }
      if (n2 == 555) {
        break;
      }
    }
  }
  fclose(in);
}


x86 assembly (clang, -O0):
<child>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x5c(%rbp),%rdi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1070 <read@plt>
lea    -0x50(%rbp),%rdi
lea    0xdef(%rip),%rsi
lea    -0x68(%rbp),%rdx
call   10a0 <sscanf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x68(%rbp),%ecx
lea    0xdb8(%rip),%rsi
lea    0xdb6(%rip),%rdx
mov    $0x0,%al
call   10e0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
lea    0xda6(%rip),%rsi
call   10d0 <strcat@plt>
mov    %eax,%edi
lea    0xd9d(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rdi
lea    -0xd0(%rbp),%rdx
lea    -0xd0(%rbp),%rcx
add    $0x4,%rcx
lea    -0xd0(%rbp),%r8
add    $0x8,%r8
lea    -0xd0(%rbp),%r9
add    $0xc,%r9
lea    -0xd0(%rbp),%rax
add    $0x10,%rax
lea    0xd52(%rip),%rsi
mov    %rax,(%rsp)
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0xd4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
lea    0xd27(%rip),%rsi
mov    $0xde,%edx
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0xd4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1030 <write@plt>
movl   $0x0,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    -0x64(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1070 <read@plt>
lea    -0x50(%rbp),%rdi
lea    0xcc7(%rip),%rsi
lea    -0x54(%rbp),%rdx
call   10a0 <sscanf@plt>
cmpl   $0x6f,-0x54(%rbp)
jne    14b2 <child+0x2e2>
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x5,-0x58(%rbp)
jge    13b8 <child+0x1e8>
movslq -0x58(%rbp),%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jle    13a5 <child+0x1d5>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    13aa <child+0x1da>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    137a <child+0x1aa>
cmpl   $0x0,-0xe4(%rbp)
jne    13f5 <child+0x225>
lea    -0x50(%rbp),%rdi
lea    0xc4d(%rip),%rsi
mov    $0xffffffff,%edx
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0xd4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1030 <write@plt>
jmp    14ad <child+0x2dd>
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0xe4(%rbp)
mov    %edx,-0xe8(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x5,-0x58(%rbp)
jge    14a8 <child+0x2d8>
movslq -0x58(%rbp),%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jle    146f <child+0x29f>
cmpl   $0x0,-0xe8(%rbp)
jne    146f <child+0x29f>
lea    -0x50(%rbp),%rdi
movslq -0x58(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%edx
lea    0xbce(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0xd4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1030 <write@plt>
jmp    14a8 <child+0x2d8>
movslq -0x58(%rbp),%rax
cmpl   $0x0,-0xd0(%rbp,%rax,4)
jle    1490 <child+0x2c0>
mov    -0xe8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xe8(%rbp)
jmp    1495 <child+0x2c5>
jmp    149a <child+0x2ca>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1410 <child+0x240>
jmp    14ad <child+0x2dd>
jmp    167c <child+0x4ac>
cmpl   $0x29a,-0x54(%rbp)
jne    1677 <child+0x4a7>
mov    -0x64(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1070 <read@plt>
lea    -0x50(%rbp),%rdi
lea    0xb42(%rip),%rsi
lea    -0xd8(%rbp),%rdx
call   10a0 <sscanf@plt>
movl   $0x0,-0xe0(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x5,-0x58(%rbp)
jge    153b <child+0x36b>
movslq -0x58(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
cmp    -0xd8(%rbp),%eax
jle    1528 <child+0x358>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    152d <child+0x35d>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    14f8 <child+0x328>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    -0xe0(%rbp),%edx
lea    0xac1(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0xd4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1030 <write@plt>
mov    -0x64(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1070 <read@plt>
lea    -0x50(%rbp),%rdi
lea    0xa8a(%rip),%rsi
lea    -0xdc(%rbp),%rdx
call   10a0 <sscanf@plt>
cmpl   $0x14d,-0xdc(%rbp)
jne    15fe <child+0x42e>
movl   $0x0,-0x58(%rbp)
cmpl   $0x5,-0x58(%rbp)
jge    15f9 <child+0x429>
movslq -0x58(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
cmp    -0xd8(%rbp),%eax
jge    15e6 <child+0x416>
movslq -0x58(%rbp),%rax
movl   $0xffffffff,-0xd0(%rbp,%rax,4)
ff ff ff ff
jmp    15eb <child+0x41b>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    15b6 <child+0x3e6>
jmp    15fe <child+0x42e>
cmpl   $0x1bc,-0xdc(%rbp)
jne    165d <child+0x48d>
movl   $0x0,-0x58(%rbp)
cmpl   $0x5,-0x58(%rbp)
jge    1658 <child+0x488>
movslq -0x58(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
cmp    -0xd8(%rbp),%eax
jle    1645 <child+0x475>
movslq -0x58(%rbp),%rax
movl   $0xffffffff,-0xd0(%rbp,%rax,4)
ff ff ff ff
jmp    164a <child+0x47a>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1615 <child+0x445>
jmp    165d <child+0x48d>
cmpl   $0x22b,-0xdc(%rbp)
jne    1672 <child+0x4a2>
jmp    1681 <child+0x4b1>
jmp    1677 <child+0x4a7>
jmp    167c <child+0x4ac>
jmp    132a <child+0x15a>
mov    -0xb8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rsi,%r15
lea    0x4c(%rsp),%rdi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    0x10(%r15),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r13d
lea    0x90(%rsp),%r12
mov    %eax,%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1070 <read@plt>
lea    0xe0e(%rip),%r14
lea    0x38(%rsp),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
call   10a0 <sscanf@plt>
mov    0x38(%rsp),%ecx
lea    0xdd6(%rip),%rsi
lea    0xdd4(%rip),%rdx
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <sprintf@plt>
lea    0xdc3(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <strcat@plt>
lea    0xdb9(%rip),%rsi
mov    %eax,%edi
call   10b0 <fopen@plt>
mov    %rax,%rdi
lea    0x14(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x1c(%rsp),%r9
lea    0x20(%rsp),%rax
mov    %rax,(%rsp)
lea    0xd92(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rdi,0x40(%rsp)
call   1060 <fscanf@plt>
mov    0x18(%r15),%rdi
call   10c0 <atoi@plt>
mov    %eax,%ebx
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0xde,%edx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %ebx,0x2c(%rsp)
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1030 <write@plt>
lea    0x3c(%rsp),%rbx
jmp    1310 <child+0x140>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    0x2c(%rsp),%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1030 <write@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1070 <read@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10a0 <sscanf@plt>
mov    0x3c(%rsp),%eax
cmp    $0x29a,%eax
je     1420 <child+0x250>
cmp    $0x6f,%eax
jne    1310 <child+0x140>
movdqa 0x10(%rsp),%xmm0
pcmpgtd 0xca1(%rip),%xmm0
xor    %eax,%eax
cmpl   $0x0,0x20(%rsp)
setg   %al
movmskps %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ebp
add    %eax,%ebp
je     14fb <child+0x32b>
xor    %eax,%eax
call   10f0 <rand@plt>
cltd
idiv   %ebp
mov    0x10(%rsp),%eax
test   %eax,%eax
jle    13b1 <child+0x1e1>
test   %edx,%edx
je     12f0 <child+0x120>
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
sub    %ecx,%edx
mov    0x14(%rsp),%eax
test   %eax,%eax
jle    13ca <child+0x1fa>
test   %edx,%edx
je     12f0 <child+0x120>
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
sub    %ecx,%edx
mov    0x18(%rsp),%eax
test   %eax,%eax
jle    13e3 <child+0x213>
test   %edx,%edx
je     12f0 <child+0x120>
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
sub    %ecx,%edx
mov    0x1c(%rsp),%eax
test   %eax,%eax
jle    13fc <child+0x22c>
test   %edx,%edx
je     12f0 <child+0x120>
xor    %ecx,%ecx
test   %eax,%eax
setg   %sil
mov    0x20(%rsp),%eax
test   %eax,%eax
jle    1310 <child+0x140>
mov    %sil,%cl
cmp    %ecx,%edx
je     12f0 <child+0x120>
jmp    1310 <child+0x140>
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1070 <read@plt>
mov    %r12,%rdi
mov    %r14,%rsi
lea    0x30(%rsp),%rdx
call   10a0 <sscanf@plt>
mov    0x30(%rsp),%eax
movdqa 0x10(%rsp),%xmm0
movd   %eax,%xmm1
pshufd $0x0,%xmm1,%xmm1
pcmpgtd %xmm1,%xmm0
xor    %ecx,%ecx
cmp    %eax,0x20(%rsp)
setg   %cl
movmskps %xmm0,%eax
mov    %eax,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%al
mov    %eax,%edx
and    $0x33,%dl
shr    $0x2,%al
and    $0x33,%al
add    %dl,%al
mov    %eax,%edx
shr    $0x4,%dl
add    %al,%dl
and    $0xf,%dl
movzbl %dl,%r15d
add    %ecx,%r15d
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    0x2c(%rsp),%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1030 <write@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x40,%edx
call   1070 <read@plt>
mov    %r12,%rdi
mov    %r14,%rsi
lea    0x34(%rsp),%rdx
call   10a0 <sscanf@plt>
mov    0x34(%rsp),%eax
cmp    $0x14d,%eax
je     150b <child+0x33b>
cmp    $0x1bc,%eax
je     1533 <child+0x363>
cmp    $0x22b,%eax
jne    1310 <child+0x140>
jmp    15f8 <child+0x428>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%edx
jmp    12f8 <child+0x128>
mov    0x30(%rsp),%eax
cmp    %eax,0x10(%rsp)
jl     1562 <child+0x392>
cmp    %eax,0x14(%rsp)
jl     1570 <child+0x3a0>
cmp    %eax,0x18(%rsp)
jl     157e <child+0x3ae>
cmp    %eax,0x1c(%rsp)
jl     158c <child+0x3bc>
cmp    %eax,0x20(%rsp)
jge    1310 <child+0x140>
jmp    159e <child+0x3ce>
mov    0x30(%rsp),%eax
cmp    %eax,0x10(%rsp)
jg     15ab <child+0x3db>
cmp    %eax,0x14(%rsp)
jg     15b9 <child+0x3e9>
cmp    %eax,0x18(%rsp)
jg     15c7 <child+0x3f7>
cmp    %eax,0x1c(%rsp)
jg     15d9 <child+0x409>
cmp    %eax,0x20(%rsp)
jle    1310 <child+0x140>
jmp    15eb <child+0x41b>
movl   $0xffffffff,0x10(%rsp)
ff
cmp    %eax,0x14(%rsp)
jge    151b <child+0x34b>
movl   $0xffffffff,0x14(%rsp)
ff
cmp    %eax,0x18(%rsp)
jge    1521 <child+0x351>
movl   $0xffffffff,0x18(%rsp)
ff
cmp    %eax,0x1c(%rsp)
jge    1527 <child+0x357>
movl   $0xffffffff,0x1c(%rsp)
ff
cmp    %eax,0x20(%rsp)
jge    1310 <child+0x140>
movl   $0xffffffff,0x20(%rsp)
ff
jmp    1310 <child+0x140>
movl   $0xffffffff,0x10(%rsp)
ff
cmp    %eax,0x14(%rsp)
jle    1543 <child+0x373>
movl   $0xffffffff,0x14(%rsp)
ff
cmp    %eax,0x18(%rsp)
jle    1549 <child+0x379>
movl   $0xffffffff,0x18(%rsp)
ff
cmp    %eax,0x1c(%rsp)
jle    1553 <child+0x383>
movl   $0xffffffff,0x1c(%rsp)
ff
cmp    %eax,0x20(%rsp)
jle    1310 <child+0x140>
movl   $0xffffffff,0x20(%rsp)
ff
jmp    1310 <child+0x140>
mov    0x40(%rsp),%rdi
call   1040 <fclose@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%s%d\00"
@.str.2 = [5 x i8] c"data\00"
@.str.3 = [5 x i8] c".txt\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [15 x i8] c"%d %d %d %d %d\00"
define i32 @child(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [64 x i8]
%14 = alloca i32*
%15 = alloca [5 x i32]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = call i64 @time(i32* %9)
%23 = trunc i64 %22 to i32
%24 = call i32 @srand(i32 %23)
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %10
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %11
%33 = load i32, i32* %11
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%35 = call i32 @read(i32 %33, i8* %34, i32 64)
%36 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%37 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%39 = load i32, i32* %12
%40 = call i32 (i8*, i8*, ...) @sprintf(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32* @fopen(i32 %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %43, i32** %14
%44 = load i32*, i32** %14
%45 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 0
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 1
%47 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 2
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 3
%49 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 4
%50 = call i32 @fscanf(i32* %44, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32* %45, i32* %46, i32* %47, i32* %48, i32* %49)
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 3
%53 = load i8*, i8** %52
%54 = call i32 @atoi(i8* %53)
store i32 %54, i32* %16
%55 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%56 = call i32 @memset(i8* %55, i32 0, i32 64)
%57 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%58 = call i32 (i8*, i8*, ...) @sprintf(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 222)
%59 = load i32, i32* %16
%60 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%61 = call i32 @write(i32 %59, i8* %60, i32 64)
store i32 0, i32* %19
store i32 0, i32* %20
br label %62
62: ; preds = %2, %231
%63 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%64 = call i32 @memset(i8* %63, i32 0, i32 64)
%65 = load i32, i32* %11
%66 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%67 = call i32 @read(i32 %65, i8* %66, i32 64)
%68 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%69 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%70 = load i32, i32* %7
%71 = icmp eq i32 %70, 111
br i1 %71, label %72, label %140
72: ; preds = %62
store i32 0, i32* %20
store i32 0, i32* %8
br label %73
73: ; preds = %86, %72
%74 = load i32, i32* %8
%75 = icmp slt i32 %74, 5
br i1 %75, label %76, label %89
76: ; preds = %73
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %78
%80 = load i32, i32* %79
%81 = icmp sgt i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %76
%83 = load i32, i32* %20
%84 = add nsw i32 %83, 1
store i32 %84, i32* %20
br label %85
85: ; preds = %82, %76
br label %86
86: ; preds = %85
%87 = load i32, i32* %8
%88 = add nsw i32 %87, 1
store i32 %88, i32* %8
br label %73
89: ; preds = %73
%90 = load i32, i32* %20
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %98
92: ; preds = %89
%93 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%94 = call i32 (i8*, i8*, ...) @sprintf(i8* %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -1)
%95 = load i32, i32* %16
%96 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%97 = call i32 @write(i32 %95, i8* %96, i32 64)
br label %139
98: ; preds = %89
%99 = call i32 (...) @rand()
%100 = load i32, i32* %20
%101 = srem i32 %99, %100
store i32 %101, i32* %21
store i32 0, i32* %8
br label %102
102: ; preds = %135, %98
%103 = load i32, i32* %8
%104 = icmp slt i32 %103, 5
br i1 %104, label %105, label %138
105: ; preds = %102
%106 = load i32, i32* %8
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %107
%109 = load i32, i32* %108
%110 = icmp sgt i32 %109, 0
br i1 %110, label %111, label %124
111: ; preds = %105
%112 = load i32, i32* %21
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %124
114: ; preds = %111
%115 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%116 = load i32, i32* %8
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %117
%119 = load i32, i32* %118
%120 = call i32 (i8*, i8*, ...) @sprintf(i8* %115, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %119)
%121 = load i32, i32* %16
%122 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%123 = call i32 @write(i32 %121, i8* %122, i32 64)
br label %138
124: ; preds = %111, %105
%125 = load i32, i32* %8
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %126
%128 = load i32, i32* %127
%129 = icmp sgt i32 %128, 0
br i1 %129, label %130, label %133
130: ; preds = %124
%131 = load i32, i32* %21
%132 = add nsw i32 %131, -1
store i32 %132, i32* %21
br label %133
133: ; preds = %130, %124
br label %134
134: ; preds = %133
br label %135
135: ; preds = %134
%136 = load i32, i32* %8
%137 = add nsw i32 %136, 1
store i32 %137, i32* %8
br label %102
138: ; preds = %114, %102
br label %139
139: ; preds = %138, %92
br label %231
140: ; preds = %62
%141 = load i32, i32* %7
%142 = icmp eq i32 %141, 666
br i1 %142, label %143, label %230
143: ; preds = %140
%144 = load i32, i32* %11
%145 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%146 = call i32 @read(i32 %144, i8* %145, i32 64)
%147 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%148 = call i32 @sscanf(i8* %147, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
store i32 0, i32* %19
store i32 0, i32* %8
br label %149
149: ; preds = %163, %143
%150 = load i32, i32* %8
%151 = icmp slt i32 %150, 5
br i1 %151, label %152, label %166
152: ; preds = %149
%153 = load i32, i32* %8
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %154
%156 = load i32, i32* %155
%157 = load i32, i32* %17
%158 = icmp sgt i32 %156, %157
br i1 %158, label %159, label %162
159: ; preds = %152
%160 = load i32, i32* %19
%161 = add nsw i32 %160, 1
store i32 %161, i32* %19
br label %162
162: ; preds = %159, %152
br label %163
163: ; preds = %162
%164 = load i32, i32* %8
%165 = add nsw i32 %164, 1
store i32 %165, i32* %8
br label %149
166: ; preds = %149
%167 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%168 = call i32 @memset(i8* %167, i32 0, i32 64)
%169 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%170 = load i32, i32* %19
%171 = call i32 (i8*, i8*, ...) @sprintf(i8* %169, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %170)
%172 = load i32, i32* %16
%173 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%174 = call i32 @write(i32 %172, i8* %173, i32 64)
%175 = load i32, i32* %11
%176 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%177 = call i32 @read(i32 %175, i8* %176, i32 64)
%178 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%179 = call i32 @sscanf(i8* %178, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %18)
%180 = load i32, i32* %18
%181 = icmp eq i32 %180, 333
br i1 %181, label %182, label %202
182: ; preds = %166
store i32 0, i32* %8
br label %183
183: ; preds = %198, %182
%184 = load i32, i32* %8
%185 = icmp slt i32 %184, 5
br i1 %185, label %186, label %201
186: ; preds = %183
%187 = load i32, i32* %8
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %188
%190 = load i32, i32* %189
%191 = load i32, i32* %17
%192 = icmp slt i32 %190, %191
br i1 %192, label %193, label %197
193: ; preds = %186
%194 = load i32, i32* %8
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %195
store i32 -1, i32* %196
br label %197
197: ; preds = %193, %186
br label %198
198: ; preds = %197
%199 = load i32, i32* %8
%200 = add nsw i32 %199, 1
store i32 %200, i32* %8
br label %183
201: ; preds = %183
br label %202
202: ; preds = %201, %166
%203 = load i32, i32* %18
%204 = icmp eq i32 %203, 444
br i1 %204, label %205, label %225
205: ; preds = %202
store i32 0, i32* %8
br label %206
206: ; preds = %221, %205
%207 = load i32, i32* %8
%208 = icmp slt i32 %207, 5
br i1 %208, label %209, label %224
209: ; preds = %206
%210 = load i32, i32* %8
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %211
%213 = load i32, i32* %212
%214 = load i32, i32* %17
%215 = icmp sgt i32 %213, %214
br i1 %215, label %216, label %220
216: ; preds = %209
%217 = load i32, i32* %8
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %218
store i32 -1, i32* %219
br label %220
220: ; preds = %216, %209
br label %221
221: ; preds = %220
%222 = load i32, i32* %8
%223 = add nsw i32 %222, 1
store i32 %223, i32* %8
br label %206
224: ; preds = %206
br label %225
225: ; preds = %224, %202
%226 = load i32, i32* %18
%227 = icmp eq i32 %226, 555
br i1 %227, label %228, label %229
228: ; preds = %225
br label %232
229: ; preds = %225
br label %230
230: ; preds = %229, %140
br label %231
231: ; preds = %230, %139
br label %62
232: ; preds = %228
%233 = load i32*, i32** %14
%234 = call i32 @fclose(i32* %233)
%235 = load i32, i32* %3
ret i32 %235
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%s%d\00"
@.str.2 = [5 x i8] c"data\00"
@.str.3 = [5 x i8] c".txt\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [15 x i8] c"%d %d %d %d %d\00"
define i32 @child(i32 %0, i8** nocapture %1) {
%3 = alloca [64 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [64 x i8]
%8 = alloca [5 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = call i64 @time(i32* %5)
%15 = trunc i64 %14 to i32
%16 = call i32 @srand(i32 %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
%20 = bitcast i32* %6 to i8*
%21 = call i32 @read(i32 %19, i8* %11, i32 64)
%22 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%24 = load i32, i32* %6
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32* @fopen(i32 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%28 = bitcast [5 x i32]* %8 to i8*
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 0
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 1
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 2
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 3
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 4
%34 = call i32 @fscanf(i32* %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32* %29, i32* %30, i32* %31, i32* %32, i32* %33)
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = call i32 @memset(i8* %11, i32 0, i32 64)
%39 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 222)
%40 = call i32 @write(i32 %37, i8* %11, i32 64)
%41 = bitcast i32* %9 to i8*
%42 = bitcast i32* %10 to i8*
%43 = bitcast [5 x i32]* %8 to <4 x i32>*
%44 = bitcast [5 x i32]* %8 to <4 x i32>*
br label %45
45: ; preds = %164, %2
%46 = call i32 @memset(i8* %11, i32 0, i32 64)
%47 = call i32 @read(i32 %19, i8* %11, i32 64)
%48 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%49 = load i32, i32* %4
switch i32 %49, label %164 [
i32 111, label %50
i32 666, label %102
]
50: ; preds = %45
%51 = load <4 x i32>, <4 x i32>* %44
%52 = icmp sgt <4 x i32> %51, zeroinitializer
%53 = load i32, i32* %33
%54 = icmp sgt i32 %53, 0
%55 = zext i1 %54 to i32
%56 = bitcast <4 x i1> %52 to i4
%57 = call i4 @llvm.ctpop.i4(i4 %56)
%58 = zext i4 %57 to i32
%59 = add nuw nsw i32 %58, %55
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %50
%62 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -1)
%63 = call i32 @write(i32 %37, i8* %11, i32 64)
br label %164
64: ; preds = %50
%65 = call i32 (...) @rand()
%66 = srem i32 %65, %59
%67 = load i32, i32* %29
%68 = icmp sgt i32 %67, 0
%69 = icmp eq i32 %66, 0
%70 = select i1 %68, i1 %69, i1 false
br i1 %70, label %71, label %75
71: ; preds = %96, %89, %82, %75, %64
%72 = phi i32 [ %67, %64 ], [ %78, %75 ], [ %85, %82 ], [ %92, %89 ], [ %98, %96 ]
%73 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %72)
%74 = call i32 @write(i32 %37, i8* %11, i32 64)
br label %164
75: ; preds = %64
%76 = sext i1 %68 to i32
%77 = add nsw i32 %66, %76
%78 = load i32, i32* %30
%79 = icmp sgt i32 %78, 0
%80 = icmp eq i32 %77, 0
%81 = select i1 %79, i1 %80, i1 false
br i1 %81, label %71, label %82
82: ; preds = %75
%83 = sext i1 %79 to i32
%84 = add nsw i32 %77, %83
%85 = load i32, i32* %31
%86 = icmp sgt i32 %85, 0
%87 = icmp eq i32 %84, 0
%88 = select i1 %86, i1 %87, i1 false
br i1 %88, label %71, label %89
89: ; preds = %82
%90 = sext i1 %86 to i32
%91 = add nsw i32 %84, %90
%92 = load i32, i32* %32
%93 = icmp sgt i32 %92, 0
%94 = icmp eq i32 %91, 0
%95 = select i1 %93, i1 %94, i1 false
br i1 %95, label %71, label %96
96: ; preds = %89
%97 = zext i1 %93 to i32
%98 = load i32, i32* %33
%99 = icmp sgt i32 %98, 0
%100 = icmp eq i32 %91, %97
%101 = select i1 %99, i1 %100, i1 false
br i1 %101, label %71, label %164
102: ; preds = %45
%103 = call i32 @read(i32 %19, i8* %11, i32 64)
%104 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%105 = load i32, i32* %9
%106 = load <4 x i32>, <4 x i32>* %43
%107 = insertelement <4 x i32> poison, i32 %105, i64 0
%108 = shufflevector <4 x i32> %107, <4 x i32> poison, <4 x i32> zeroinitializer
%109 = icmp sgt <4 x i32> %106, %108
%110 = load i32, i32* %33
%111 = icmp sgt i32 %110, %105
%112 = zext i1 %111 to i32
%113 = bitcast <4 x i1> %109 to i4
%114 = call i4 @llvm.ctpop.i4(i4 %113)
%115 = zext i4 %114 to i32
%116 = add nuw nsw i32 %115, %112
%117 = call i32 @memset(i8* %11, i32 0, i32 64)
%118 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %116)
%119 = call i32 @write(i32 %37, i8* %11, i32 64)
%120 = call i32 @read(i32 %19, i8* %11, i32 64)
%121 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%122 = load i32, i32* %10
switch i32 %122, label %164 [
i32 333, label %123
i32 444, label %144
i32 555, label %166
]
123: ; preds = %102
%124 = load i32, i32* %9
%125 = load i32, i32* %29
%126 = icmp slt i32 %125, %124
br i1 %126, label %127, label %128
127: ; preds = %123
store i32 -1, i32* %29
br label %128
128: ; preds = %123, %127
%129 = load i32, i32* %30
%130 = icmp slt i32 %129, %124
br i1 %130, label %131, label %132
131: ; preds = %128
store i32 -1, i32* %30
br label %132
132: ; preds = %131, %128
%133 = load i32, i32* %31
%134 = icmp slt i32 %133, %124
br i1 %134, label %135, label %136
135: ; preds = %132
store i32 -1, i32* %31
br label %136
136: ; preds = %135, %132
%137 = load i32, i32* %32
%138 = icmp slt i32 %137, %124
br i1 %138, label %139, label %140
139: ; preds = %136
store i32 -1, i32* %32
br label %140
140: ; preds = %139, %136
%141 = load i32, i32* %33
%142 = icmp slt i32 %141, %124
br i1 %142, label %143, label %164
143: ; preds = %140
store i32 -1, i32* %33
br label %164
144: ; preds = %102
%145 = load i32, i32* %9
%146 = load i32, i32* %29
%147 = icmp sgt i32 %146, %145
br i1 %147, label %148, label %149
148: ; preds = %144
store i32 -1, i32* %29
br label %149
149: ; preds = %144, %148
%150 = load i32, i32* %30
%151 = icmp sgt i32 %150, %145
br i1 %151, label %152, label %153
152: ; preds = %149
store i32 -1, i32* %30
br label %153
153: ; preds = %152, %149
%154 = load i32, i32* %31
%155 = icmp sgt i32 %154, %145
br i1 %155, label %156, label %157
156: ; preds = %153
store i32 -1, i32* %31
br label %157
157: ; preds = %156, %153
%158 = load i32, i32* %32
%159 = icmp sgt i32 %158, %145
br i1 %159, label %160, label %161
160: ; preds = %157
store i32 -1, i32* %32
br label %161
161: ; preds = %160, %157
%162 = load i32, i32* %33
%163 = icmp sgt i32 %162, %145
br i1 %163, label %165, label %164
164: ; preds = %161, %165, %140, %143, %96, %102, %45, %71, %61
br label %45
165: ; preds = %161
store i32 -1, i32* %33
br label %164
166: ; preds = %102
%167 = call i32 @fclose(i32* %27)
ret i32 undef
}