#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int tv_usec;
  int tv_sec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int distance(char *, int, char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
int /*<<< orphan*/ printf(char *, int, int);
int rand();
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ timeval_subtract(struct timeval *, struct timeval *,
                                    struct timeval *);
int main(int argc, char *argv[], char *envp[]) {
  int delay;
  int length = 5;
  int i;
  int trash;
  int dist;
  int lResponse;
  char string[64];
  char response[64];
  char next;
  struct timeval tvStart;
  struct timeval tvEnd;
  struct timeval tvDiff;
  struct timezone tz;
  FILE *outfile = stdout;
  gettimeofday(&tvStart, &tz);
  srand((unsigned int)tvStart.tv_usec);
  delay = rand() % 4;
  sleep(delay);
  for (i = 1; i < argc; i++) {
    if (!strcmp(argv[i], "-l") && i < argc - 1) {
      i += 1;
      trash = atoi(argv[i]);
      if (trash > 64) {
        trash = 64;
      }
      if (trash > 0) {
        length = trash;
      }
    }
    if (!strcmp(argv[i], "-f") && i < argc - 1) {
      i += 1;
      outfile = fopen(argv[i], "a");
      if (outfile == NULL) {
        outfile = stdout;
      }
    }
  }
  for (i = 0; i < length; i++) {
    trash = rand() % 26;
    next = 'a' + (char)trash;
    string[i] = next;
  }
  string[i] = '\000';
  fprintf(stderr, "\n%s - Repeat!\n", string);
  gettimeofday(&tvStart, &tz);
  scanf("%63s", response);
  gettimeofday(&tvEnd, &tz);
  timeval_subtract(&tvDiff, &tvEnd, &tvStart);
  lResponse = strlen(response);
  dist = distance(string, length, response, lResponse);
  fprintf(outfile, ",%d,%d,%d,%ld.%.6ld\n", delay, length, dist, tvDiff.tv_sec,
          tvDiff.tv_usec);
  if (outfile != stdout) {
    int t = tvDiff.tv_sec;
    if (tvDiff.tv_usec > 600000) {
      t += 1;
    }
    printf("%d errors, %d seconds\n", dist, t);
    fclose(outfile);
  }
  return dist;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x5,-0x20(%rbp)
mov    0x2dcd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe0(%rbp)
lea    -0xc0(%rbp),%rdi
lea    -0xd8(%rbp),%rsi
call   1060 <gettimeofday@plt>
mov    -0xc0(%rbp),%edi
call   1070 <srand@plt>
mov    $0x0,%al
call   1100 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   10e0 <sleep@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1366 <main+0x186>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd8d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12d5 <main+0xf5>
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12d5 <main+0xf5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x40,-0x28(%rbp)
jle    12c0 <main+0xe0>
movl   $0x40,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jle    12d0 <main+0xf0>
mov    -0x28(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    12d5 <main+0xf5>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd1b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1353 <main+0x173>
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1353 <main+0x173>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xce3(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0xe0(%rbp)
cmpq   $0x0,-0xe0(%rbp)
jne    134e <main+0x16e>
mov    0x2c94(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe0(%rbp)
jmp    1353 <main+0x173>
jmp    1358 <main+0x178>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1254 <main+0x74>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13b6 <main+0x1d6>
mov    $0x0,%al
call   1100 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x28(%rbp)
mov    -0x28(%rbp),%eax
movsbl %al,%eax
add    $0x61,%eax
mov    %al,-0xb1(%rbp)
mov    -0xb1(%rbp),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    136d <main+0x18d>
movslq -0x24(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    0x2c1a(%rip),%rax
movslq (%rax),%rdi
lea    -0x70(%rbp),%rdx
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    -0xc0(%rbp),%rdi
lea    -0xd8(%rbp),%rsi
call   1060 <gettimeofday@plt>
lea    -0xb0(%rbp),%rsi
lea    0xc1b(%rip),%rdi
call   10b0 <scanf@plt>
lea    -0xc8(%rbp),%rdi
lea    -0xd8(%rbp),%rsi
call   1060 <gettimeofday@plt>
lea    -0xd0(%rbp),%rdi
lea    -0xc8(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   10a0 <timeval_subtract@plt>
lea    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x30(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x20(%rbp),%esi
lea    -0xb0(%rbp),%rdx
mov    -0x30(%rbp),%ecx
call   10f0 <distance@plt>
mov    %eax,-0x2c(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0xcc(%rbp),%r9d
mov    -0xd0(%rbp),%eax
lea    0xba1(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0xe0(%rbp),%rax
mov    0x2b45(%rip),%rcx
cmp    (%rcx),%rax
je     14e8 <main+0x308>
mov    -0xcc(%rbp),%eax
mov    %eax,-0xe4(%rbp)
cmpl   $0x927c0,-0xd0(%rbp)
jle    14c7 <main+0x2e7>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0xe4(%rbp),%edx
lea    0xb5a(%rip),%rdi
call   1050 <printf@plt>
mov    -0xe0(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x2c(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x2ddb(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1060 <gettimeofday@plt>
mov    0x28(%rsp),%edi
call   1070 <srand@plt>
xor    %eax,%eax
call   1100 <rand@plt>
mov    %eax,%edi
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffffc,%eax
sub    %eax,%edi
mov    %rdi,0x30(%rsp)
call   10e0 <sleep@plt>
mov    $0x5,%r12d
cmp    $0x2,%ebx
jl     130d <main+0x12d>
lea    -0x1(%rbx),%r13d
mov    $0x1,%r14d
movl   $0x5,0xc(%rsp)
jmp    1271 <main+0x91>
add    $0x1,%r14d
add    $0x1,%r14d
cmp    %ebx,%r14d
jge    1303 <main+0x123>
movslq %r14d,%r12
mov    0x0(%rbp,%r12,8),%r15
mov    %r15,%rdi
lea    0xd7d(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    12b5 <main+0xd5>
cmp    %r13d,%r14d
jge    12b5 <main+0xd5>
add    $0x1,%r14d
mov    0x8(%rbp,%r12,8),%r15
mov    %r15,%rdi
call   10d0 <atoi@plt>
test   %eax,%eax
jle    12b5 <main+0xd5>
cmp    $0x40,%eax
mov    $0x40,%ecx
cmovae %ecx,%eax
mov    %eax,0xc(%rsp)
mov    %r15,%rdi
lea    0xd44(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    1264 <main+0x84>
cmp    %r13d,%r14d
jge    1264 <main+0x84>
movslq %r14d,%rax
mov    0x8(%rbp,%rax,8),%rdi
lea    0xd2a(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    1260 <main+0x80>
mov    0x2ce2(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
jmp    1260 <main+0x80>
mov    0xc(%rsp),%r12d
test   %r12d,%r12d
jle    135b <main+0x17b>
mov    %r12d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1100 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x40(%rsp,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1320 <main+0x140>
mov    %r12d,%eax
jmp    135d <main+0x17d>
xor    %eax,%eax
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
mov    0x2c75(%rip),%rax
movslq (%rax),%rdi
lea    0xc93(%rip),%rsi
lea    0x40(%rsp),%r14
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0x28(%rsp),%r15
lea    0x20(%rsp),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <gettimeofday@plt>
lea    0xc77(%rip),%rdi
lea    0x80(%rsp),%rbp
mov    %rbp,%rsi
call   10b0 <scanf@plt>
lea    0x38(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <gettimeofday@plt>
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   10a0 <timeval_subtract@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
mov    %eax,%ecx
call   10f0 <distance@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%eax
mov    0x14(%rsp),%r9d
mov    %eax,(%rsp)
lea    0xc1f(%rip),%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
mov    0x30(%rsp),%rdx
mov    %r12d,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2bba(%rip),%rax
cmp    (%rax),%rbp
je     144a <main+0x26a>
xor    %edx,%edx
cmpl   $0x927c1,0x10(%rsp)
setge  %dl
add    0x14(%rsp),%edx
lea    0xbf6(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    %ebx,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
@stdout = global i32* null
@.str = [3 x i8] c"-l\00"
@.str.1 = [3 x i8] c"-f\00"
@.str.2 = [2 x i8] c"a\00"
@stderr = global i32 0
@.str.3 = [15 x i8] c"\0A%s - Repeat!\0A\00"
@.str.4 = [5 x i8] c"%63s\00"
@.str.5 = [21 x i8] c",%d,%d,%d,%ld.%.6ld\0A\00"
@.str.6 = [23 x i8] c"%d errors, %d seconds\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [64 x i8]
%15 = alloca [64 x i8]
%16 = alloca i8
%17 = alloca %struct.timeval
%18 = alloca %struct.timeval
%19 = alloca %struct.timeval
%20 = alloca %struct.timezone
%21 = alloca i32*
%22 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 5, i32* %9
%23 = load i32*, i32** @stdout
store i32* %23, i32** %21
%24 = call i32 @gettimeofday(%struct.timeval* %17, %struct.timezone* %20)
%25 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @srand(i32 %26)
%28 = call i32 (...) @rand()
%29 = srem i32 %28, 4
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = call i32 @sleep(i32 %30)
store i32 1, i32* %10
br label %32
32: ; preds = %95, %3
%33 = load i32, i32* %10
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %98
36: ; preds = %32
%37 = load i8**, i8*** %6
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
br i1 %43, label %67, label %44
44: ; preds = %36
%45 = load i32, i32* %10
%46 = load i32, i32* %5
%47 = sub nsw i32 %46, 1
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %67
49: ; preds = %44
%50 = load i32, i32* %10
%51 = add nsw i32 %50, 1
store i32 %51, i32* %10
%52 = load i8**, i8*** %6
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %11
%58 = load i32, i32* %11
%59 = icmp sgt i32 %58, 64
br i1 %59, label %60, label %61
60: ; preds = %49
store i32 64, i32* %11
br label %61
61: ; preds = %60, %49
%62 = load i32, i32* %11
%63 = icmp sgt i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = load i32, i32* %11
store i32 %65, i32* %9
br label %66
66: ; preds = %64, %61
br label %67
67: ; preds = %66, %44, %36
%68 = load i8**, i8*** %6
%69 = load i32, i32* %10
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%74 = icmp ne i32 %73, 0
br i1 %74, label %94, label %75
75: ; preds = %67
%76 = load i32, i32* %10
%77 = load i32, i32* %5
%78 = sub nsw i32 %77, 1
%79 = icmp slt i32 %76, %78
br i1 %79, label %80, label %94
80: ; preds = %75
%81 = load i32, i32* %10
%82 = add nsw i32 %81, 1
store i32 %82, i32* %10
%83 = load i8**, i8*** %6
%84 = load i32, i32* %10
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
%87 = load i8*, i8** %86
%88 = call i32* @fopen(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %88, i32** %21
%89 = load i32*, i32** %21
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %93
91: ; preds = %80
%92 = load i32*, i32** @stdout
store i32* %92, i32** %21
br label %93
93: ; preds = %91, %80
br label %94
94: ; preds = %93, %75, %67
br label %95
95: ; preds = %94
%96 = load i32, i32* %10
%97 = add nsw i32 %96, 1
store i32 %97, i32* %10
br label %32
98: ; preds = %32
store i32 0, i32* %10
br label %99
99: ; preds = %115, %98
%100 = load i32, i32* %10
%101 = load i32, i32* %9
%102 = icmp slt i32 %100, %101
br i1 %102, label %103, label %118
103: ; preds = %99
%104 = call i32 (...) @rand()
%105 = srem i32 %104, 26
store i32 %105, i32* %11
%106 = load i32, i32* %11
%107 = trunc i32 %106 to i8
%108 = sext i8 %107 to i32
%109 = add nsw i32 97, %108
%110 = trunc i32 %109 to i8
store i8 %110, i8* %16
%111 = load i8, i8* %16
%112 = load i32, i32* %10
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 %113
store i8 %111, i8* %114
br label %115
115: ; preds = %103
%116 = load i32, i32* %10
%117 = add nsw i32 %116, 1
store i32 %117, i32* %10
br label %99
118: ; preds = %99
%119 = load i32, i32* %10
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 %120
store i8 0, i8* %121
%122 = load i32, i32* @stderr
%123 = sext i32 %122 to i64
%124 = inttoptr i64 %123 to i32*
%125 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 0
%126 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %125)
%127 = call i32 @gettimeofday(%struct.timeval* %17, %struct.timezone* %20)
%128 = getelementptr inbounds [64 x i8], [64 x i8]* %15, i64 0, i64 0
%129 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %128)
%130 = call i32 @gettimeofday(%struct.timeval* %18, %struct.timezone* %20)
%131 = call i32 @timeval_subtract(%struct.timeval* %19, %struct.timeval* %18, %struct.timeval* %17)
%132 = getelementptr inbounds [64 x i8], [64 x i8]* %15, i64 0, i64 0
%133 = call i32 @strlen(i8* %132)
store i32 %133, i32* %13
%134 = getelementptr inbounds [64 x i8], [64 x i8]* %14, i64 0, i64 0
%135 = load i32, i32* %9
%136 = getelementptr inbounds [64 x i8], [64 x i8]* %15, i64 0, i64 0
%137 = load i32, i32* %13
%138 = call i32 @distance(i8* %134, i32 %135, i8* %136, i32 %137)
store i32 %138, i32* %12
%139 = load i32*, i32** %21
%140 = load i32, i32* %8
%141 = load i32, i32* %9
%142 = load i32, i32* %12
%143 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 1
%144 = load i32, i32* %143
%145 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
%146 = load i32, i32* %145
%147 = call i32 (i32*, i8*, ...) @fprintf(i32* %139, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %140, i32 %141, i32 %142, i32 %144, i32 %146)
%148 = load i32*, i32** %21
%149 = load i32*, i32** @stdout
%150 = icmp ne i32* %148, %149
br i1 %150, label %151, label %166
151: ; preds = %118
%152 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 1
%153 = load i32, i32* %152
store i32 %153, i32* %22
%154 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
%155 = load i32, i32* %154
%156 = icmp sgt i32 %155, 600000
br i1 %156, label %157, label %160
157: ; preds = %151
%158 = load i32, i32* %22
%159 = add nsw i32 %158, 1
store i32 %159, i32* %22
br label %160
160: ; preds = %157, %151
%161 = load i32, i32* %12
%162 = load i32, i32* %22
%163 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %161, i32 %162)
%164 = load i32*, i32** %21
%165 = call i32 @fclose(i32* %164)
br label %166
166: ; preds = %160, %118
%167 = load i32, i32* %12
ret i32 %167
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
@stdout = global i32* null
@.str = [3 x i8] c"-l\00"
@.str.1 = [3 x i8] c"-f\00"
@.str.2 = [2 x i8] c"a\00"
@stderr = global i32 0
@.str.3 = [15 x i8] c"\0A%s - Repeat!\0A\00"
@.str.4 = [5 x i8] c"%63s\00"
@.str.5 = [21 x i8] c",%d,%d,%d,%ld.%.6ld\0A\00"
@.str.6 = [23 x i8] c"%d errors, %d seconds\0A\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca %struct.timeval
%9 = alloca %struct.timezone
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%12 = bitcast %struct.timeval* %6 to i8*
%13 = bitcast %struct.timeval* %7 to i8*
%14 = bitcast %struct.timeval* %8 to i8*
%15 = bitcast %struct.timezone* %9 to i8*
%16 = load i32*, i32** @stdout
%17 = call i32 @gettimeofday(%struct.timeval* %6, %struct.timezone* %9)
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%19 = load i32, i32* %18
%20 = tail call i32 @srand(i32 %19)
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 4
%23 = tail call i32 @sleep(i32 %22)
%24 = icmp sgt i32 %0, 1
br i1 %24, label %25, label %29
25: ; preds = %3
%26 = add nsw i32 %0, -1
br label %33
27: ; preds = %71
%28 = icmp sgt i32 %57, 0
br i1 %28, label %29, label %85
29: ; preds = %3, %27
%30 = phi i32* [ %73, %27 ], [ %16, %3 ]
%31 = phi i32 [ %57, %27 ], [ 5, %3 ]
%32 = zext i32 %31 to i64
br label %76
33: ; preds = %25, %71
%34 = phi i32* [ %16, %25 ], [ %73, %71 ]
%35 = phi i32 [ 5, %25 ], [ %57, %71 ]
%36 = phi i32 [ 1, %25 ], [ %74, %71 ]
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %1, i64 %37
%39 = load i8*, i8** %38
%40 = tail call i32 @strcmp(i8* dereferenceable(1) %39, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%41 = icmp eq i32 %40, 0
%42 = icmp slt i32 %36, %26
%43 = select i1 %41, i1 %42, i1 false
br i1 %43, label %44, label %54
44: ; preds = %33
%45 = add nsw i32 %36, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %1, i64 %46
%48 = load i8*, i8** %47
%49 = tail call i32 @atoi(i8* %48)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %44
%52 = icmp ult i32 %49, 64
%53 = select i1 %52, i32 %49, i32 64
br label %54
54: ; preds = %44, %51, %33
%55 = phi i8* [ %48, %44 ], [ %48, %51 ], [ %39, %33 ]
%56 = phi i32 [ %45, %44 ], [ %45, %51 ], [ %36, %33 ]
%57 = phi i32 [ %35, %44 ], [ %53, %51 ], [ %35, %33 ]
%58 = tail call i32 @strcmp(i8* dereferenceable(1) %55, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%59 = icmp eq i32 %58, 0
%60 = icmp slt i32 %56, %26
%61 = select i1 %59, i1 %60, i1 false
br i1 %61, label %62, label %71
62: ; preds = %54
%63 = add nsw i32 %56, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
%67 = tail call i32* @fopen(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%68 = icmp eq i32* %67, null
%69 = load i32*, i32** @stdout
%70 = select i1 %68, i32* %69, i32* %67
br label %71
71: ; preds = %62, %54
%72 = phi i32 [ %56, %54 ], [ %63, %62 ]
%73 = phi i32* [ %34, %54 ], [ %70, %62 ]
%74 = add nsw i32 %72, 1
%75 = icmp slt i32 %74, %0
br i1 %75, label %33, label %27
76: ; preds = %29, %76
%77 = phi i64 [ 0, %29 ], [ %83, %76 ]
%78 = tail call i32 (...) @rand()
%79 = srem i32 %78, 26
%80 = trunc i32 %79 to i8
%81 = add nsw i8 %80, 97
%82 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 %77
store i8 %81, i8* %82
%83 = add nuw nsw i64 %77, 1
%84 = icmp eq i64 %83, %32
br i1 %84, label %85, label %76
85: ; preds = %76, %27
%86 = phi i32* [ %73, %27 ], [ %30, %76 ]
%87 = phi i32 [ %57, %27 ], [ %31, %76 ]
%88 = phi i32 [ 0, %27 ], [ %31, %76 ]
%89 = zext i32 %88 to i64
%90 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 %89
store i8 0, i8* %90
%91 = load i32, i32* @stderr
%92 = sext i32 %91 to i64
%93 = inttoptr i64 %92 to i32*
%94 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%95 = call i32 @gettimeofday(%struct.timeval* %6, %struct.timezone* %9)
%96 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%97 = call i32 @gettimeofday(%struct.timeval* %7, %struct.timezone* %9)
%98 = call i32 @timeval_subtract(%struct.timeval* %8, %struct.timeval* %7, %struct.timeval* %6)
%99 = call i32 @strlen(i8* %11)
%100 = call i32 @distance(i8* %10, i32 %87, i8* %11, i32 %99)
%101 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 1
%102 = load i32, i32* %101
%103 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 0
%104 = load i32, i32* %103
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %22, i32 %87, i32 %100, i32 %102, i32 %104)
%106 = load i32*, i32** @stdout
%107 = icmp eq i32* %86, %106
br i1 %107, label %116, label %108
108: ; preds = %85
%109 = load i32, i32* %101
%110 = load i32, i32* %103
%111 = icmp sgt i32 %110, 600000
%112 = zext i1 %111 to i32
%113 = add nsw i32 %109, %112
%114 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %100, i32 %113)
%115 = call i32 @fclose(i32* %86)
br label %116
116: ; preds = %108, %85
ret i32 %100
}