#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 */
int /*<<< orphan*/ O_RDONLY;
int atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ memcpy(int *, char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int read(int, char *, int);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int time(int /*<<< orphan*/ *);
int wait(int *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    return 1;
  }
  char startbuff[50], endbuff[50], buf[4 * 3];
  pid_t pid;
  int start = atoi(argv[1]) - 1, end = atoi(argv[2]),
      process_count = atoi(argv[3]), tasks = end - start,
      tasks_per_process = (tasks / process_count),
      tasks_additional = tasks - (tasks_per_process * process_count),
      pierwszych = 0, i, status, fd, sub_start, sub_end, buf_count,
      pierwszych_it, start_time, end_time;
  start_time = time(NULL);
  remove("results.txt");
  for (i = 0; i < process_count; i++) {
    if (fork() == 0) {
      sub_start = start + (i * tasks_per_process) + 1;
      sub_end = start + (i + 1) * tasks_per_process;
      if (i + 1 == process_count) {
        sub_end += tasks_additional;
      }
      sprintf(startbuff, "%d", sub_start);
      sprintf(endbuff, "%d", sub_end);
      execl("./pierwsza_zad2", "pierwsza_zad2", startbuff, endbuff, NULL);
      perror("error");
    }
  }
  for (i = 0; i < process_count; i++) {
    pid = wait(&status);
    printf("process stopped [pid=%d]\n", pid);
  }
  fd = open("results.txt", O_RDONLY);
  if (fd < 0) {
    perror("file1 open error");
    exit(0);
  }
  do {
    buf_count = read(fd, buf, 4 * 3);
    if (buf_count == 0)
      continue;
    memcpy(&pierwszych_it, buf + 8, sizeof(int));
    pierwszych += pierwszych_it;
  } while (buf_count == 4 * 3);
  close(fd);
  end_time = time(NULL);
  printf("pierwszych = %d\n", pierwszych);
  printf("czas wykonywania = %d\n", end_time - start_time);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    120f <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1500 <main+0x320>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0xa8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0xac(%rbp)
mov    -0xa8(%rbp),%eax
sub    -0xa4(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cltd
idivl  -0xac(%rbp)
mov    %eax,-0xb4(%rbp)
mov    -0xb0(%rbp),%eax
mov    -0xb4(%rbp),%ecx
imul   -0xac(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0xb8(%rbp)
movl   $0x0,-0xbc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0xdc(%rbp)
lea    0xd55(%rip),%rdi
call   1030 <remove@plt>
movl   $0x0,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0xac(%rbp),%eax
jge    13b7 <main+0x1d7>
mov    $0x0,%al
call   1100 <fork@plt>
cmp    $0x0,%rax
jne    139e <main+0x1be>
mov    -0xa4(%rbp),%eax
mov    -0xc0(%rbp),%ecx
imul   -0xb4(%rbp),%ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
mov    -0xa4(%rbp),%eax
mov    -0xc0(%rbp),%ecx
add    $0x1,%ecx
imul   -0xb4(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xd0(%rbp)
mov    -0xc0(%rbp),%eax
add    $0x1,%eax
cmp    -0xac(%rbp),%eax
jne    1340 <main+0x160>
mov    -0xb8(%rbp),%eax
add    -0xd0(%rbp),%eax
mov    %eax,-0xd0(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0xcc(%rbp),%edx
lea    0xcbb(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x90(%rbp),%rdi
mov    -0xd0(%rbp),%edx
lea    0xca2(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x50(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    0xc8e(%rip),%rdi
lea    0xc89(%rip),%rsi
xor    %eax,%eax
mov    %eax,%r8d
call   10e0 <execl@plt>
lea    0xcab(%rip),%rdi
call   10a0 <perror@plt>
jmp    13a3 <main+0x1c3>
mov    -0xc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc0(%rbp)
jmp    12ba <main+0xda>
movl   $0x0,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0xac(%rbp),%eax
jge    140b <main+0x22b>
lea    -0xc4(%rbp),%rdi
call   10f0 <wait@plt>
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%esi
lea    0xc2d(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc0(%rbp)
jmp    13c1 <main+0x1e1>
mov    0x2bd6(%rip),%rax
mov    (%rax),%esi
lea    0xbe5(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0xc8(%rbp)
cmpl   $0x0,-0xc8(%rbp)
jge    1446 <main+0x266>
lea    0xbff(%rip),%rdi
call   10a0 <perror@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
jmp    144b <main+0x26b>
mov    -0xc8(%rbp),%edi
lea    -0x9c(%rbp),%rsi
mov    $0xc,%edx
call   1060 <read@plt>
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0xd4(%rbp)
jne    147a <main+0x29a>
jmp    14a8 <main+0x2c8>
lea    -0x9c(%rbp),%rsi
add    $0x8,%rsi
lea    -0xd8(%rbp),%rdi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    -0xd8(%rbp),%eax
add    -0xbc(%rbp),%eax
mov    %eax,-0xbc(%rbp)
cmpl   $0xc,-0xd4(%rbp)
je     144b <main+0x26b>
mov    -0xc8(%rbp),%edi
call   1050 <close@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0xe0(%rbp)
mov    -0xbc(%rbp),%esi
lea    0xb6e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xe0(%rbp),%esi
sub    -0xdc(%rbp),%esi
lea    0xb67(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    $0x1,%r14d
cmp    $0x4,%edi
jl     13d3 <main+0x1f3>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   10b0 <atoi@plt>
mov    %rax,0x18(%rsp)
lea    -0x1(%rax),%r14d
mov    0x10(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebx
mov    0x18(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
mov    %r14d,0xc(%rsp)
sub    %r14d,%ebx
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %edx,0x10(%rsp)
mov    %eax,0x8(%rsp)
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,0x4(%rsp)
lea    0xdae(%rip),%rdi
call   1030 <remove@plt>
test   %ebp,%ebp
jle    1337 <main+0x157>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1100 <fork@plt>
test   %rax,%rax
je     128a <main+0xaa>
add    $0x1,%r15d
cmp    %ebp,%r15d
jne    1270 <main+0x90>
jmp    130f <main+0x12f>
mov    %r15d,%edx
mov    0x8(%rsp),%ecx
imul   %ecx,%edx
add    0x18(%rsp),%edx
add    $0x1,%r15d
mov    %r15d,%eax
imul   %ecx,%eax
add    0xc(%rsp),%eax
cmp    %ebp,%r15d
mov    $0x0,%r14d
cmove  0x10(%rsp),%r14d
add    %eax,%r14d
lea    0x70(%rsp),%r13
mov    %r13,%rdi
lea    0xd45(%rip),%r12
mov    %r12,%rsi
call   10c0 <sprintf@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   10c0 <sprintf@plt>
lea    0xd26(%rip),%rdi
lea    0xd21(%rip),%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   10e0 <execl@plt>
lea    0xd3f(%rip),%rdi
call   10a0 <perror@plt>
jmp    1280 <main+0xa0>
test   %ebp,%ebp
jle    1337 <main+0x157>
lea    0x20(%rsp),%r14
lea    0xd00(%rip),%rbx
nop
mov    %r14,%rdi
call   10f0 <wait@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1320 <main+0x140>
mov    0x2caa(%rip),%rax
mov    (%rax),%esi
lea    0xcb9(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     13e8 <main+0x208>
mov    %eax,%r13d
xor    %ebx,%ebx
lea    0x2c(%rsp),%r14
lea    0x24(%rsp),%r15
lea    0x14(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1060 <read@plt>
test   %eax,%eax
je     139f <main+0x1bf>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
add    0x14(%rsp),%ebx
cmp    $0xc,%ebp
je     1370 <main+0x190>
mov    %r13d,%edi
call   1050 <close@plt>
xor    %r14d,%r14d
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%ebp
lea    0xc90(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
sub    0x4(%rsp),%ebp
lea    0xc8f(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
mov    %r14d,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc4a(%rip),%rdi
call   10a0 <perror@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"results.txt\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"./pierwsza_zad2\00"
@.str.3 = [14 x i8] c"pierwsza_zad2\00"
@.str.4 = [6 x i8] c"error\00"
@.str.5 = [26 x i8] c"process stopped [pid=%d]\0A\00"
@O_RDONLY = global i32 0
@.str.6 = [17 x i8] c"file1 open error\00"
@.str.7 = [17 x i8] c"pierwszych = %d\0A\00"
@.str.8 = [23 x i8] c"czas wykonywania = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [50 x i8]
%7 = alloca [50 x i8]
%8 = alloca [12 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %29
28: ; preds = %2
store i32 1, i32* %3
br label %147
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = sub nsw i32 %33, 1
store i32 %34, i32* %10
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %11
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %12
%43 = load i32, i32* %11
%44 = load i32, i32* %10
%45 = sub nsw i32 %43, %44
store i32 %45, i32* %13
%46 = load i32, i32* %13
%47 = load i32, i32* %12
%48 = sdiv i32 %46, %47
store i32 %48, i32* %14
%49 = load i32, i32* %13
%50 = load i32, i32* %14
%51 = load i32, i32* %12
%52 = mul nsw i32 %50, %51
%53 = sub nsw i32 %49, %52
store i32 %53, i32* %15
store i32 0, i32* %16
%54 = call i32 @time(i32* null)
store i32 %54, i32* %24
%55 = call i32 @remove(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %17
br label %56
56: ; preds = %96, %29
%57 = load i32, i32* %17
%58 = load i32, i32* %12
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %99
60: ; preds = %56
%61 = call i64 (...) @fork()
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %95
63: ; preds = %60
%64 = load i32, i32* %10
%65 = load i32, i32* %17
%66 = load i32, i32* %14
%67 = mul nsw i32 %65, %66
%68 = add nsw i32 %64, %67
%69 = add nsw i32 %68, 1
store i32 %69, i32* %20
%70 = load i32, i32* %10
%71 = load i32, i32* %17
%72 = add nsw i32 %71, 1
%73 = load i32, i32* %14
%74 = mul nsw i32 %72, %73
%75 = add nsw i32 %70, %74
store i32 %75, i32* %21
%76 = load i32, i32* %17
%77 = add nsw i32 %76, 1
%78 = load i32, i32* %12
%79 = icmp eq i32 %77, %78
br i1 %79, label %80, label %84
80: ; preds = %63
%81 = load i32, i32* %15
%82 = load i32, i32* %21
%83 = add nsw i32 %82, %81
store i32 %83, i32* %21
br label %84
84: ; preds = %80, %63
%85 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%86 = load i32, i32* %20
%87 = call i32 @sprintf(i8* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%89 = load i32, i32* %21
%90 = call i32 @sprintf(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %89)
%91 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%92 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%93 = call i32 @execl(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %91, i8* %92, i32* null)
%94 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %95
95: ; preds = %84, %60
br label %96
96: ; preds = %95
%97 = load i32, i32* %17
%98 = add nsw i32 %97, 1
store i32 %98, i32* %17
br label %56
99: ; preds = %56
store i32 0, i32* %17
br label %100
100: ; preds = %108, %99
%101 = load i32, i32* %17
%102 = load i32, i32* %12
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %111
104: ; preds = %100
%105 = call i32 @wait(i32* %18)
store i32 %105, i32* %9
%106 = load i32, i32* %9
%107 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %104
%109 = load i32, i32* %17
%110 = add nsw i32 %109, 1
store i32 %110, i32* %17
br label %100
111: ; preds = %100
%112 = load i32, i32* @O_RDONLY
%113 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %112)
store i32 %113, i32* %19
%114 = load i32, i32* %19
%115 = icmp slt i32 %114, 0
br i1 %115, label %116, label %119
116: ; preds = %111
%117 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%118 = call i32 @exit(i32 0)
unreachable
119: ; preds = %111
br label %120
120: ; preds = %134, %119
%121 = load i32, i32* %19
%122 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%123 = call i32 @read(i32 %121, i8* %122, i32 12)
store i32 %123, i32* %22
%124 = load i32, i32* %22
%125 = icmp eq i32 %124, 0
br i1 %125, label %126, label %127
126: ; preds = %120
br label %134
127: ; preds = %120
%128 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%129 = getelementptr inbounds i8, i8* %128, i64 8
%130 = call i32 @memcpy(i32* %23, i8* %129, i32 4)
%131 = load i32, i32* %23
%132 = load i32, i32* %16
%133 = add nsw i32 %132, %131
store i32 %133, i32* %16
br label %134
134: ; preds = %127, %126
%135 = load i32, i32* %22
%136 = icmp eq i32 %135, 12
br i1 %136, label %120, label %137
137: ; preds = %134
%138 = load i32, i32* %19
%139 = call i32 @close(i32 %138)
%140 = call i32 @time(i32* null)
store i32 %140, i32* %25
%141 = load i32, i32* %16
%142 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %141)
%143 = load i32, i32* %25
%144 = load i32, i32* %24
%145 = sub nsw i32 %143, %144
%146 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %145)
store i32 0, i32* %3
br label %147
147: ; preds = %137, %28
%148 = load i32, i32* %3
ret i32 %148
}

LLVM IR (-O2):
@.str = [12 x i8] c"results.txt\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"./pierwsza_zad2\00"
@.str.3 = [14 x i8] c"pierwsza_zad2\00"
@.str.4 = [6 x i8] c"error\00"
@.str.5 = [26 x i8] c"process stopped [pid=%d]\0A\00"
@O_RDONLY = global i32 0
@.str.6 = [17 x i8] c"file1 open error\00"
@.str.7 = [17 x i8] c"pierwszych = %d\0A\00"
@.str.8 = [23 x i8] c"czas wykonywania = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca [12 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = icmp slt i32 %0, 4
br i1 %8, label %86, label %9
9: ; preds = %2
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = add nsw i32 %15, -1
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = sub nsw i32 %19, %16
%24 = sdiv i32 %23, %22
%25 = mul nsw i32 %24, %22
%26 = srem i32 %23, %22
%27 = bitcast i32* %6 to i8*
%28 = bitcast i32* %7 to i8*
%29 = tail call i32 @time(i32* null)
%30 = tail call i32 @remove(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%31 = icmp sgt i32 %22, 0
br i1 %31, label %33, label %61
32: ; preds = %52
br i1 %31, label %55, label %61
33: ; preds = %9, %52
%34 = phi i32 [ %53, %52 ], [ 0, %9 ]
%35 = call i64 (...) @fork()
%36 = icmp eq i64 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = add nuw nsw i32 %34, 1
br label %52
39: ; preds = %33
%40 = mul nsw i32 %34, %24
%41 = add i32 %40, %15
%42 = add nuw nsw i32 %34, 1
%43 = mul nsw i32 %42, %24
%44 = add nsw i32 %43, %16
%45 = icmp eq i32 %42, %22
%46 = select i1 %45, i32 %26, i32 0
%47 = add nsw i32 %44, %46
%48 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%49 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%50 = call i32 @execl(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %10, i8* %11, i32* null)
%51 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %37, %39
%53 = phi i32 [ %38, %37 ], [ %42, %39 ]
%54 = icmp eq i32 %53, %22
br i1 %54, label %32, label %33
55: ; preds = %32, %55
%56 = phi i32 [ %59, %55 ], [ 0, %32 ]
%57 = call i32 @wait(i32* %6)
%58 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %57)
%59 = add nuw nsw i32 %56, 1
%60 = icmp eq i32 %59, %22
br i1 %60, label %61, label %55
61: ; preds = %55, %9, %32
%62 = load i32, i32* @O_RDONLY
%63 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %62)
%64 = icmp slt i32 %63, 0
br i1 %64, label %67, label %65
65: ; preds = %61
%66 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 8
br label %70
67: ; preds = %61
%68 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%69 = call i32 @exit(i32 0)
unreachable
70: ; preds = %65, %74
%71 = phi i32 [ %77, %74 ], [ 0, %65 ]
%72 = call i32 @read(i32 %63, i8* %12, i32 12)
%73 = icmp eq i32 %72, 0
br i1 %73, label %79, label %74
74: ; preds = %70
%75 = call i32 @memcpy(i32* %7, i8* %66, i32 4)
%76 = load i32, i32* %7
%77 = add nsw i32 %76, %71
%78 = icmp eq i32 %72, 12
br i1 %78, label %70, label %79
79: ; preds = %70, %74
%80 = phi i32 [ %77, %74 ], [ %71, %70 ]
%81 = call i32 @close(i32 %63)
%82 = call i32 @time(i32* null)
%83 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %80)
%84 = sub nsw i32 %82, %29
%85 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %84)
br label %86
86: ; preds = %2, %79
%87 = phi i32 [ 0, %79 ], [ 1, %2 ]
ret i32 %87
}