#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/);
int /*<<< orphan*/ x_waste_a_second();
int main(int argc, char *argv[]) {
  FILE *in, *out;
  int i, j;
  int selection[(100)];
  char buffer[(127)];
  srand(time(0));
  if (argc != 3) {
    fprintf(stderr, "Use: %s <input-name> <output-name>\n", argv[0]);
    exit(-1);
  }
  in = fopen(argv[1], "wb");
  if (!in) {
    perror(argv[1]);
    exit(-1);
  }
  printf("creating input records\n");
  for (i = 0; i < ((10000) * (127)); i++) {
    putc(i, in);
  }
  fclose(in);
  for (i = 0; i < (100); i++) {
    selection[i] = rand() % (10000);
  }
  in = fopen(argv[1], "rb");
  if (!in) {
    perror(argv[1]);
    exit(-1);
  }
  out = fopen(argv[2], "wb");
  if (!out) {
    perror(argv[2]);
    exit(-1);
  }
  for (i = 0; i < (100); i++) {
    printf("record %d:\n", selection[i]);
    printf("\treading\n");
    fseek(in, selection[i] * (127), SEEK_SET);
    fread(buffer, 1, (127), in);
    x_waste_a_second();
    printf("\tverifying\n");
    for (j = 0; j < (127); j++) {
      if (buffer[j] != (char)(selection[i] * (127) + j)) {
        printf("pos %d should be %x but is %x\n", j, selection[i] * (127) + j,
               buffer[j]);
      }
    }
    printf("\twriting\n");
    fwrite(buffer, (127), 1, out);
  }
  fclose(in);
  fclose(out);
  printf("verifying output records\n");
  out = fopen(argv[2], "rb");
  if (!out) {
    perror(argv[2]);
    exit(-1);
  }
  for (i = 0; i < (100); i++) {
    fread(buffer, 1, (127), out);
    printf("record %d:\n", selection[i]);
    x_waste_a_second();
    for (j = 0; j < (127); j++) {
      if (buffer[j] != (char)(selection[i] * (127) + j)) {
        printf("pos %d should be %x but is %x\n", j, selection[i] * (127) + j,
               buffer[j]);
      }
    }
  }
  fclose(out);
  printf("SUCCESS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
cmpl   $0x3,-0x8(%rbp)
je     1237 <main+0x57>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd8(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdde(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1271 <main+0x91>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x1360f0,-0x24(%rbp)
jge    12ad <main+0xcd>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1070 <putc@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1286 <main+0xa6>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    12ef <main+0x10f>
mov    $0x0,%al
call   1100 <rand@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
movslq -0x24(%rbp),%rax
mov    %edx,-0x1c0(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12bd <main+0xdd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd41(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1329 <main+0x149>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xcec(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1363 <main+0x183>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    1494 <main+0x2b4>
movslq -0x24(%rbp),%rax
mov    -0x1c0(%rbp,%rax,4),%esi
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
movslq -0x24(%rbp),%rax
imul   $0x7f,-0x1c0(%rbp,%rax,4),%esi
7f
mov    0x2c26(%rip),%rax
mov    (%rax),%edx
call   10b0 <fseek@plt>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x7f,%edx
call   1030 <fread@plt>
mov    $0x0,%al
call   1090 <x_waste_a_second@plt>
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x7f,-0x28(%rbp)
jge    145e <main+0x27e>
movslq -0x28(%rbp),%rax
movsbl -0x240(%rbp,%rax,1),%eax
ff
movslq -0x24(%rbp),%rcx
imul   $0x7f,-0x1c0(%rbp,%rcx,4),%ecx
7f
add    -0x28(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
je     144b <main+0x26b>
mov    -0x28(%rbp),%esi
movslq -0x24(%rbp),%rax
imul   $0x7f,-0x1c0(%rbp,%rax,4),%edx
7f
add    -0x28(%rbp),%edx
movslq -0x28(%rbp),%rax
movsbl -0x240(%rbp,%rax,1),%ecx
ff
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1450 <main+0x270>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    13ef <main+0x20f>
lea    0xc1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x240(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x7f,%esi
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    136a <main+0x18a>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xbe0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xb7c(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    14ee <main+0x30e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    15c2 <main+0x3e2>
lea    -0x240(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x7f,%edx
call   1030 <fread@plt>
movslq -0x24(%rbp),%rax
mov    -0x1c0(%rbp,%rax,4),%esi
lea    0xb17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <x_waste_a_second@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x7f,-0x28(%rbp)
jge    15af <main+0x3cf>
movslq -0x28(%rbp),%rax
movsbl -0x240(%rbp,%rax,1),%eax
ff
movslq -0x24(%rbp),%rcx
imul   $0x7f,-0x1c0(%rbp,%rcx,4),%ecx
7f
add    -0x28(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
je     159c <main+0x3bc>
mov    -0x28(%rbp),%esi
movslq -0x24(%rbp),%rax
imul   $0x7f,-0x1c0(%rbp,%rax,4),%edx
7f
add    -0x28(%rbp),%edx
movslq -0x28(%rbp),%rax
movsbl -0x240(%rbp,%rax,1),%ecx
ff
lea    0xacf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    15a1 <main+0x3c1>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1540 <main+0x360>
jmp    15b4 <main+0x3d4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14f5 <main+0x315>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xad5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
cmp    $0x3,%ebx
jne    1500 <main+0x310>
mov    0x8(%r14),%rdi
lea    0xdfc(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     14fa <main+0x30a>
mov    %rax,%rbx
lea    0xe15(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
add    $0x1,%ebp
cmp    $0x1360f0,%ebp
jne    1250 <main+0x60>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1110 <rand@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2710,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0xa0(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1270 <main+0x80>
mov    0x8(%r14),%rdi
lea    0xd76(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     14fa <main+0x30a>
mov    %r14,0x8(%rsp)
mov    0x10(%r14),%rdi
lea    0xd50(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     1522 <main+0x332>
lea    0x20(%rsp),%rbp
lea    0xd43(%rip),%r13
xor    %r15d,%r15d
jmp    1336 <main+0x146>
nopl   0x0(%rax,%rax,1)
lea    0xd9a(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x7f,%esi
mov    $0x1,%edx
mov    0x10(%rsp),%rcx
call   1100 <fwrite@plt>
add    $0x1,%r15
cmp    $0x64,%r15
je     13f4 <main+0x204>
mov    0xa0(%rsp,%r15,4),%r12d
lea    0xce5(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd37(%rip),%rdi
call   1030 <puts@plt>
mov    %r12d,%r14d
shl    $0x7,%r14d
sub    %r12d,%r14d
mov    0x2c6c(%rip),%rax
mov    (%rax),%edx
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
call   10c0 <fseek@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x7f,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
xor    %eax,%eax
call   10a0 <x_waste_a_second@plt>
lea    0xcf5(%rip),%rdi
call   1030 <puts@plt>
imul   $0x7f000000,%r12d,%ebx
xor    %ebp,%ebp
jmp    13d4 <main+0x1e4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
add    $0x1000000,%ebx
cmp    $0x7f,%rbp
je     1300 <main+0x110>
movsbl 0x20(%rsp,%rbp,1),%ecx
mov    %ebx,%eax
sar    $0x18,%eax
cmp    %ecx,%eax
je     13c0 <main+0x1d0>
lea    (%r14,%rbp,1),%rdx
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13c0 <main+0x1d0>
mov    0x18(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
lea    0xc5d(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rbx
mov    0x10(%rbx),%rdi
lea    0xc03(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     152d <main+0x33d>
mov    %rax,%r12
lea    0xbfa(%rip),%r13
xor    %ebp,%ebp
jmp    144e <main+0x25e>
add    $0x1,%rbp
cmp    $0x64,%rbp
je     14d2 <main+0x2e2>
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x7f,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
mov    0xa0(%rsp,%rbp,4),%ebx
lea    0xbb7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10a0 <x_waste_a_second@plt>
mov    %ebx,%r14d
shl    $0x7,%r14d
sub    %ebx,%r14d
imul   $0x7f000000,%ebx,%r15d
xor    %ebx,%ebx
jmp    14b1 <main+0x2c1>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x1000000,%r15d
cmp    $0x7f,%rbx
je     1440 <main+0x250>
movsbl 0x20(%rsp,%rbx,1),%ecx
mov    %r15d,%eax
sar    $0x18,%eax
cmp    %ecx,%eax
je     14a0 <main+0x2b0>
lea    (%r14,%rbx,1),%rdx
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    14a0 <main+0x2b0>
mov    %r12,%rdi
call   1050 <fclose@plt>
lea    0xba4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%r14),%rdi
jmp    1531 <main+0x341>
mov    0x2ad9(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xaed(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
mov    0x8(%rsp),%rax
mov    0x10(%rax),%rdi
jmp    1531 <main+0x341>
mov    0x10(%rbx),%rdi
call   10e0 <perror@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Use: %s <input-name> <output-name>\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [12 x i8] c"record %d:\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [31 x i8] c"pos %d should be %x but is %x\0A\00"
@str = [23 x i8] c"creating input records\00"
@str.11 = [25 x i8] c"verifying output records\00"
@str.12 = [8 x i8] c"SUCCESS\00"
@str.13 = [9 x i8] c"\09reading\00"
@str.14 = [11 x i8] c"\09verifying\00"
@str.15 = [9 x i8] c"\09writing\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i32]
%4 = alloca [127 x i8]
%5 = bitcast [100 x i32]* %3 to i8*
%6 = getelementptr inbounds [127 x i8], [127 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @time(i32 0)
%8 = tail call i32 @srand(i32 %7)
%9 = icmp eq i32 %0, 3
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i8*, i8** %16
%22 = tail call i32 @perror(i8* %21)
%23 = tail call i32 @exit(i32 -1)
unreachable
24: ; preds = %15
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %24, %26
%27 = phi i32 [ 0, %24 ], [ %29, %26 ]
%28 = tail call i32 @putc(i32 %27, i32* %18)
%29 = add nuw nsw i32 %27, 1
%30 = icmp eq i32 %29, 1270000
br i1 %30, label %31, label %26
31: ; preds = %26
%32 = tail call i32 @fclose(i32* %18)
br label %33
33: ; preds = %31, %33
%34 = phi i64 [ 0, %31 ], [ %38, %33 ]
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, 10000
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %34
store i32 %36, i32* %37
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, 100
br i1 %39, label %40, label %33
40: ; preds = %33
%41 = load i8*, i8** %16
%42 = tail call i32* @fopen(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i8*, i8** %16
%46 = tail call i32 @perror(i8* %45)
%47 = tail call i32 @exit(i32 -1)
unreachable
48: ; preds = %40
%49 = getelementptr inbounds i8*, i8** %1, i64 2
%50 = load i8*, i8** %49
%51 = tail call i32* @fopen(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = load i8*, i8** %49
%55 = tail call i32 @perror(i8* %54)
%56 = tail call i32 @exit(i32 -1)
unreachable
57: ; preds = %48, %84
%58 = phi i64 [ %87, %84 ], [ 0, %48 ]
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %60)
%62 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.13, i64 0, i64 0))
%63 = mul nsw i32 %60, 127
%64 = load i32, i32* @SEEK_SET
%65 = tail call i32 @fseek(i32* %42, i32 %63, i32 %64)
%66 = call i32 @fread(i8* %6, i32 1, i32 127, i32* %42)
%67 = tail call i32 (...) @x_waste_a_second()
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.14, i64 0, i64 0))
br label %69
69: ; preds = %57, %81
%70 = phi i64 [ 0, %57 ], [ %82, %81 ]
%71 = getelementptr inbounds [127 x i8], [127 x i8]* %4, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = trunc i64 %70 to i32
%75 = add nsw i32 %63, %74
%76 = shl i32 %75, 24
%77 = ashr exact i32 %76, 24
%78 = icmp eq i32 %77, %73
br i1 %78, label %81, label %79
79: ; preds = %69
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %74, i32 %75, i32 %73)
br label %81
81: ; preds = %69, %79
%82 = add nuw nsw i64 %70, 1
%83 = icmp eq i64 %82, 127
br i1 %83, label %84, label %69
84: ; preds = %81
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.15, i64 0, i64 0))
%86 = call i32 @fwrite(i8* %6, i32 127, i32 1, i32* %51)
%87 = add nuw nsw i64 %58, 1
%88 = icmp eq i64 %87, 100
br i1 %88, label %89, label %57
89: ; preds = %84
%90 = tail call i32 @fclose(i32* %42)
%91 = tail call i32 @fclose(i32* %51)
%92 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.11, i64 0, i64 0))
%93 = load i8*, i8** %49
%94 = tail call i32* @fopen(i8* %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %100
96: ; preds = %89
%97 = load i8*, i8** %49
%98 = tail call i32 @perror(i8* %97)
%99 = tail call i32 @exit(i32 -1)
unreachable
100: ; preds = %89, %123
%101 = phi i64 [ %124, %123 ], [ 0, %89 ]
%102 = call i32 @fread(i8* %6, i32 1, i32 127, i32* %94)
%103 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %101
%104 = load i32, i32* %103
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %104)
%106 = tail call i32 (...) @x_waste_a_second()
%107 = mul nsw i32 %104, 127
br label %108
108: ; preds = %100, %120
%109 = phi i64 [ 0, %100 ], [ %121, %120 ]
%110 = getelementptr inbounds [127 x i8], [127 x i8]* %4, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = trunc i64 %109 to i32
%114 = add nsw i32 %107, %113
%115 = shl i32 %114, 24
%116 = ashr exact i32 %115, 24
%117 = icmp eq i32 %116, %112
br i1 %117, label %120, label %118
118: ; preds = %108
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %113, i32 %114, i32 %112)
br label %120
120: ; preds = %108, %118
%121 = add nuw nsw i64 %109, 1
%122 = icmp eq i64 %121, 127
br i1 %122, label %123, label %108
123: ; preds = %120
%124 = add nuw nsw i64 %101, 1
%125 = icmp eq i64 %124, 100
br i1 %125, label %126, label %100
126: ; preds = %123
%127 = tail call i32 @fclose(i32* %94)
%128 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.12, i64 0, i64 0))
ret i32 0
}