#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 */
scalar_t__ EOF;
int /*<<< orphan*/ compare_results(unsigned char *, unsigned char *,
                                   unsigned long);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, ...);
void *malloc(unsigned long);
int /*<<< orphan*/ printf(char *, int, char *, int);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int stub1(unsigned char *, unsigned char *, unsigned long long);
int /*<<< orphan*/ write_rsp(unsigned long, unsigned char *, unsigned char *,
                             unsigned long, int /*<<< orphan*/ *);
int do_comparison1(char *infile, char *outfile,
                   int (*funcs[])(unsigned char *, unsigned char *,
                                  unsigned long long),
                   int funcslength, char *rsps[]) {
  setbuf(stdout, NULL);
  FILE *fpin = fopen(infile, "r");
  FILE *fpout = fopen(outfile, "r");
  int i;
  FILE **frsps = malloc(funcslength * sizeof(FILE *));
  for (i = 0; i < funcslength; i++) {
    frsps[i] = fopen(rsps[i], "w+");
    if (frsps[i] == NULL) {
      fprintf(stderr, "Can't open rsp file %s\n", rsps[i]);
      exit(1);
    }
  }
  if (fpin == NULL) {
    fprintf(stderr, "Can't open input file %s!\n", infile);
    exit(1);
  }
  if (fpout == NULL) {
    fprintf(stderr, "Can't open output file %s\n", outfile);
    exit(1);
  }
  unsigned long inlength, outlength;
  int testno;
  unsigned char nextstring[50];
  testno = 1;
  while (fscanf(fpin, "%s", nextstring) != EOF) {
    while (nextstring[0] == '#' || nextstring[0] == '[') {
      fscanf(fpin, "%*[^\n]\n", NULL);
      fscanf(fpin, "%s", nextstring);
    }
    fscanf(fpin, "%s", nextstring);
    fscanf(fpin, "%lu", &inlength);
    inlength = inlength / 8;
    unsigned char input0[0];
    unsigned char *input = malloc(inlength * sizeof(char));
    fscanf(fpin, "%s", nextstring);
    fscanf(fpin, "%s", nextstring);
    if (inlength == 0) {
      fscanf(fpin, "%*2hhx");
      input = input0;
    } else {
      for (i = 0; i < inlength; i++) {
        fscanf(fpin, "%2hhx", &input[i]);
      }
    }
    fscanf(fpout, "%lu", &outlength);
    unsigned char *output1 = malloc(outlength * sizeof(char));
    unsigned char *output2 = malloc(outlength * sizeof(char));
    for (i = 0; i < outlength; i++) {
      fscanf(fpout, "%2hhx", &output1[i]);
    }
    for (i = 0; i < funcslength; i++) {
      funcs[i](input, output2, inlength);
      if (!compare_results(output1, output2, outlength)) {
        printf("Test %d of file %s failed for function %d\n", testno, infile,
               i);
      }
      write_rsp(inlength, input, output2, outlength, frsps[i]);
    }
    if (inlength != 0) {
      free(input);
    }
    free(output1);
    free(output2);
    testno++;
  }
  fclose(fpin);
  fclose(fpout);
  return 0;
}


x86 assembly (clang, -O0):
<do_comparison1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <setbuf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x38(%rbp)
movslq -0x1c(%rbp),%rdi
shl    $0x3,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12a4 <do_comparison1+0xf4>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc3(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rdx
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1291 <do_comparison1+0xe1>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd83(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1296 <do_comparison1+0xe6>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1220 <do_comparison1+0x70>
cmpq   $0x0,-0x30(%rbp)
jne    12d2 <do_comparison1+0x122>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd5a(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpq   $0x0,-0x38(%rbp)
jne    1300 <do_comparison1+0x150>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd47(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x1,-0x5c(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xd3a(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    0x2cc1(%rip),%rcx
cmp    (%rcx),%rax
je     15fc <do_comparison1+0x44c>
jmp    1335 <do_comparison1+0x185>
movzbl -0x90(%rbp),%ecx
mov    $0x1,%al
cmp    $0x23,%ecx
mov    %al,-0xb1(%rbp)
je     1360 <do_comparison1+0x1b0>
movzbl -0x90(%rbp),%eax
cmp    $0x5b,%eax
sete   %al
mov    %al,-0xb1(%rbp)
mov    -0xb1(%rbp),%al
test   $0x1,%al
jne    1373 <do_comparison1+0x1c3>
jmp    13a7 <do_comparison1+0x1f7>
mov    -0x30(%rbp),%rdi
lea    0xcd8(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xcb8(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
jmp    1335 <do_comparison1+0x185>
mov    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xc9a(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x30(%rbp),%rdi
lea    0xc93(%rip),%rsi
lea    -0x50(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x50(%rbp),%rax
shr    $0x3,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
shl    $0x0,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xc4b(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xc32(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
cmpq   $0x0,-0x50(%rbp)
jne    1458 <do_comparison1+0x2a8>
mov    -0x30(%rbp),%rdi
lea    0xc24(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
lea    -0x91(%rbp),%rax
mov    %rax,-0xa0(%rbp)
jmp    14a0 <do_comparison1+0x2f0>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    149b <do_comparison1+0x2eb>
mov    -0x30(%rbp),%rdi
mov    -0xa0(%rbp),%rdx
movslq -0x3c(%rbp),%rax
add    %rax,%rdx
lea    0xbe3(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    145f <do_comparison1+0x2af>
jmp    14a0 <do_comparison1+0x2f0>
mov    -0x38(%rbp),%rdi
lea    0xbb3(%rip),%rsi
lea    -0x58(%rbp),%rdx
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x58(%rbp),%rdi
shl    $0x0,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0xa8(%rbp)
mov    -0x58(%rbp),%rdi
shl    $0x0,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    -0x58(%rbp),%rax
jae    1521 <do_comparison1+0x371>
mov    -0x38(%rbp),%rdi
mov    -0xa8(%rbp),%rdx
movslq -0x3c(%rbp),%rax
add    %rax,%rdx
lea    0xb5d(%rip),%rsi
mov    $0x0,%al
call   1070 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14e5 <do_comparison1+0x335>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    15bf <do_comparison1+0x40f>
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xa0(%rbp),%rdi
mov    -0xb0(%rbp),%rsi
mov    -0x50(%rbp),%rdx
call   *%rax
mov    -0xa8(%rbp),%rdi
mov    -0xb0(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   10d0 <compare_results@plt>
cmp    $0x0,%eax
jne    158a <do_comparison1+0x3da>
mov    -0x5c(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
lea    0xaea(%rip),%rdi
call   1060 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    -0xb0(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%r8
mov    (%rax,%r8,8),%r8
call   1090 <write_rsp@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <do_comparison1+0x378>
cmpq   $0x0,-0x50(%rbp)
je     15d6 <do_comparison1+0x426>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1307 <do_comparison1+0x157>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_comparison1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r8,%r12
mov    %ecx,%r14d
mov    %rdx,0x58(%rsp)
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
lea    0xe17(%rip),%r15
mov    %rbx,0x40(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <fopen@plt>
mov    %rax,%r13
mov    %rbp,0x20(%rsp)
mov    %rbp,%rdi
mov    %r15,%rsi
call   10b0 <fopen@plt>
mov    %rax,0x18(%rsp)
movslq %r14d,%rbp
lea    0x0(,%rbp,8),%rdi
call   10a0 <malloc@plt>
mov    %rax,%rcx
mov    %r14d,0x34(%rsp)
mov    %r14d,%eax
mov    %rcx,%rbx
mov    %rax,0x48(%rsp)
test   %ebp,%ebp
jle    1274 <do_comparison1+0xc4>
xor    %ebp,%ebp
lea    0xdc1(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdi
mov    %r15,%rsi
call   10b0 <fopen@plt>
mov    %rax,(%rbx,%rbp,8)
test   %rax,%rax
je     1527 <do_comparison1+0x377>
add    $0x1,%rbp
cmp    %rbp,0x48(%rsp)
jne    1250 <do_comparison1+0xa0>
test   %r13,%r13
je     154a <do_comparison1+0x39a>
cmpq   $0x0,0x18(%rsp)
je     1561 <do_comparison1+0x3b1>
mov    %rbx,%r12
lea    0xdc0(%rip),%rsi
lea    0x60(%rsp),%rdx
mov    %r13,%rdi
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2d3f(%rip),%rcx
cmp    (%rcx),%rax
mov    0x18(%rsp),%r14
je     1503 <do_comparison1+0x353>
movl   $0x1,0x20(%rsp)
lea    0xd90(%rip),%rbp
lea    0xd86(%rip),%r15
lea    0x60(%rsp),%rbx
mov    %r12,0x50(%rsp)
jmp    12ff <do_comparison1+0x14f>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x60(%rsp),%al
cmp    $0x5b,%al
je     12e0 <do_comparison1+0x130>
cmp    $0x23,%al
je     12e0 <do_comparison1+0x130>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r13,%rdi
lea    0xd39(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x8(%rsp),%rdi
shr    $0x3,%rdi
mov    %rdi,0x8(%rsp)
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
cmpq   $0x0,0x8(%rsp)
je     139e <do_comparison1+0x1ee>
xor    %ebp,%ebp
lea    0xcf1(%rip),%rbx
nopl   0x0(%rax,%rax,1)
lea    (%r12,%rbp,1),%rdx
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%rbp
cmp    %rbp,0x8(%rsp)
ja     1380 <do_comparison1+0x1d0>
jmp    13b4 <do_comparison1+0x204>
mov    %r13,%rdi
lea    0xcba(%rip),%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
lea    0x17(%rsp),%r12
mov    %r12,0x38(%rsp)
mov    %r14,%rdi
lea    0xc9b(%rip),%rsi
lea    0x28(%rsp),%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x28(%rsp),%r14
mov    %r14,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    %r14,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r15
test   %r14,%r14
mov    0x18(%rsp),%rbx
lea    0xc70(%rip),%r14
je     141c <do_comparison1+0x26c>
xor    %ebp,%ebp
nopl   (%rax)
lea    (%r12,%rbp,1),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <fscanf@plt>
add    $0x1,%rbp
cmp    %rbp,0x28(%rsp)
ja     1400 <do_comparison1+0x250>
cmpl   $0x0,0x34(%rsp)
mov    0x50(%rsp),%rbx
mov    0x38(%rsp),%rbp
jle    14a6 <do_comparison1+0x2f6>
xor    %r14d,%r14d
jmp    1464 <do_comparison1+0x2b4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%rdi
mov    0x28(%rsp),%rcx
mov    (%rbx,%r14,8),%r8
mov    %rbp,%rsi
mov    %r15,%rdx
call   1090 <write_rsp@plt>
add    $0x1,%r14
cmp    %r14,0x48(%rsp)
je     14a6 <do_comparison1+0x2f6>
mov    0x8(%rsp),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    0x58(%rsp),%rax
call   *(%rax,%r14,8)
mov    0x28(%rsp),%rdx
mov    %r12,%rdi
mov    %r15,%rsi
call   10d0 <compare_results@plt>
test   %eax,%eax
jne    1440 <do_comparison1+0x290>
lea    0xbdc(%rip),%rdi
mov    0x20(%rsp),%esi
mov    0x40(%rsp),%rdx
mov    %r14d,%ecx
call   1060 <printf@plt>
jmp    1440 <do_comparison1+0x290>
cmpq   $0x0,0x8(%rsp)
je     14b6 <do_comparison1+0x306>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
addl   $0x1,0x20(%rsp)
mov    %r13,%rdi
lea    0xb7e(%rip),%r15
mov    %r15,%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fscanf@plt>
mov    0x2afa(%rip),%rcx
cmp    (%rcx),%rax
mov    0x18(%rsp),%r14
lea    0xb59(%rip),%rbp
jne    12ff <do_comparison1+0x14f>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2aaa(%rip),%rax
mov    (%rax),%edi
mov    (%r12,%rbp,8),%rdx
lea    0xaca(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2a87(%rip),%rax
mov    (%rax),%edi
lea    0xac3(%rip),%rsi
mov    0x40(%rsp),%rdx
jmp    153b <do_comparison1+0x38b>
mov    0x2a70(%rip),%rax
mov    (%rax),%edi
lea    0xac7(%rip),%rsi
mov    0x20(%rsp),%rdx
jmp    153b <do_comparison1+0x38b>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"w+\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"Can't open rsp file %s\0A\00"
@.str.3 = [27 x i8] c"Can't open input file %s!\0A\00"
@.str.4 = [27 x i8] c"Can't open output file %s\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.6 = [8 x i8] c"%*[^\0A]\0A\00"
@.str.7 = [4 x i8] c"%lu\00"
@.str.8 = [7 x i8] c"%*2hhx\00"
@.str.9 = [6 x i8] c"%2hhx\00"
@.str.10 = [43 x i8] c"Test %d of file %s failed for function %d\0A\00"
define i32 @do_comparison1(i8* %0, i8* %1, i32 (i8*, i8*, i64)** nocapture %2, i32 %3, i8** nocapture %4) {
%6 = alloca [0 x i8]
%7 = alloca i64
%8 = alloca i64
%9 = alloca [50 x i8]
%10 = load i32, i32* @stdout
%11 = tail call i32 @setbuf(i32 %10, i32* null)
%12 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = sext i32 %3 to i64
%15 = shl nsw i64 %14, 3
%16 = tail call i8* @malloc(i64 %15)
%17 = bitcast i8* %16 to i32**
%18 = icmp sgt i32 %3, 0
br i1 %18, label %19, label %38
19: ; preds = %5
%20 = zext i32 %3 to i64
br label %21
21: ; preds = %19, %35
%22 = phi i64 [ 0, %19 ], [ %36, %35 ]
%23 = getelementptr inbounds i8*, i8** %4, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = getelementptr inbounds i32*, i32** %17, i64 %22
store i32* %25, i32** %26
%27 = icmp eq i32* %25, null
br i1 %27, label %28, label %35
28: ; preds = %21
%29 = and i64 %22, 4294967295
%30 = getelementptr inbounds i8*, i8** %4, i64 %29
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %30
%33 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %21
%36 = add nuw nsw i64 %22, 1
%37 = icmp eq i64 %36, %20
br i1 %37, label %38, label %21
38: ; preds = %35, %5
%39 = icmp eq i32* %12, null
br i1 %39, label %40, label %44
40: ; preds = %38
%41 = load i32, i32* @stderr
%42 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%43 = tail call i32 @exit(i32 1)
unreachable
44: ; preds = %38
%45 = icmp eq i32* %13, null
br i1 %45, label %46, label %50
46: ; preds = %44
%47 = load i32, i32* @stderr
%48 = tail call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%49 = tail call i32 @exit(i32 1)
unreachable
50: ; preds = %44
%51 = bitcast i64* %7 to i8*
%52 = bitcast i64* %8 to i8*
%53 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%54 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%55 = load i64, i64* @EOF
%56 = icmp eq i64 %54, %55
br i1 %56, label %133, label %57
57: ; preds = %50
%58 = getelementptr inbounds [0 x i8], [0 x i8]* %6, i64 0, i64 0
%59 = zext i32 %3 to i64
br label %60
60: ; preds = %57, %126
%61 = phi i32 [ 1, %57 ], [ %129, %126 ]
br label %62
62: ; preds = %60, %64
%63 = load i8, i8* %53
switch i8 %63, label %67 [
i8 91, label %64
i8 35, label %64
]
64: ; preds = %62, %62
%65 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* null)
%66 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
br label %62
67: ; preds = %62
%68 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%69 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %7)
%70 = load i64, i64* %7
%71 = lshr i64 %70, 3
store i64 %71, i64* %7
%72 = call i8* @malloc(i64 %71)
%73 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%74 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%75 = load i64, i64* %7
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %67
%78 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %86
79: ; preds = %67, %79
%80 = phi i64 [ %83, %79 ], [ 0, %67 ]
%81 = getelementptr inbounds i8, i8* %72, i64 %80
%82 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %81)
%83 = add nuw i64 %80, 1
%84 = load i64, i64* %7
%85 = icmp ugt i64 %84, %83
br i1 %85, label %79, label %86
86: ; preds = %79, %77
%87 = phi i8* [ %58, %77 ], [ %72, %79 ]
%88 = call i64 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %8)
%89 = load i64, i64* %8
%90 = call i8* @malloc(i64 %89)
%91 = call i8* @malloc(i64 %89)
%92 = icmp eq i64 %89, 0
br i1 %92, label %93, label %94
93: ; preds = %94, %86
br i1 %18, label %101, label %121
94: ; preds = %86, %94
%95 = phi i64 [ %98, %94 ], [ 0, %86 ]
%96 = getelementptr inbounds i8, i8* %90, i64 %95
%97 = call i64 (i32*, i8*, ...) @fscanf(i32* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %96)
%98 = add nuw i64 %95, 1
%99 = load i64, i64* %8
%100 = icmp ugt i64 %99, %98
br i1 %100, label %94, label %93
101: ; preds = %93, %113
%102 = phi i64 [ %119, %113 ], [ 0, %93 ]
%103 = getelementptr inbounds i32 (i8*, i8*, i64)*, i32 (i8*, i8*, i64)** %2, i64 %102
%104 = load i32 (i8*, i8*, i64)*, i32 (i8*, i8*, i64)** %103
%105 = load i64, i64* %7
%106 = call i32 %104(i8* %87, i8* %91, i64 %105)
%107 = load i64, i64* %8
%108 = call i32 @compare_results(i8* %90, i8* %91, i64 %107)
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %101
%111 = trunc i64 %102 to i32
%112 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i32 %61, i8* %0, i32 %111)
br label %113
113: ; preds = %110, %101
%114 = load i64, i64* %7
%115 = load i64, i64* %8
%116 = getelementptr inbounds i32*, i32** %17, i64 %102
%117 = load i32*, i32** %116
%118 = call i32 @write_rsp(i64 %114, i8* %87, i8* %91, i64 %115, i32* %117)
%119 = add nuw nsw i64 %102, 1
%120 = icmp eq i64 %119, %59
br i1 %120, label %121, label %101
121: ; preds = %113, %93
%122 = load i64, i64* %7
%123 = icmp eq i64 %122, 0
br i1 %123, label %126, label %124
124: ; preds = %121
%125 = call i32 @free(i8* %87)
br label %126
126: ; preds = %124, %121
%127 = call i32 @free(i8* %90)
%128 = call i32 @free(i8* %91)
%129 = add nuw nsw i32 %61, 1
%130 = call i64 (i32*, i8*, ...) @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %53)
%131 = load i64, i64* @EOF
%132 = icmp eq i64 %130, %131
br i1 %132, label %133, label %60
133: ; preds = %126, %50
%134 = call i32 @fclose(i32* %12)
%135 = call i32 @fclose(i32* %13)
ret i32 0
}