#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rijndaelIVKAT(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ rijndaelTKAT(int /*<<< orphan*/ *, int,
                                int /*<<< orphan*/ *);
int /*<<< orphan*/ rijndaelVKKAT(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ rijndaelVTKAT(int /*<<< orphan*/ *, int);
void makeKATs(const char *vkFile, const char *vtFile, const char *tblFile,
              const char *ivFile) {
  FILE *fp, *fp2;
  fp = fopen(vkFile, "w");
  fprintf(fp,
          "\n"
          "=========================\n"
          "\n"
          "FILENAME:  \"%s\"\n"
          "\n"
          "Electronic Codebook (ECB) Mode\n"
          "Variable Key Known Answer Tests\n"
          "\n"
          "Algorithm Name: Rijndael\n"
          "Principal Submitter: %s\n",
          vkFile, "Joan Daemen");
  fflush(fp);
  rijndaelVKKAT(fp, 128);
  rijndaelVKKAT(fp, 192);
  rijndaelVKKAT(fp, 256);
  fprintf(fp, "\n"
              "==========");
  fclose(fp);
  fp = fopen(vtFile, "w");
  fprintf(fp,
          "\n"
          "=========================\n"
          "\n"
          "FILENAME:  \"%s\"\n"
          "\n"
          "Electronic Codebook (ECB) Mode\n"
          "Variable Text Known Answer Tests\n"
          "\n"
          "Algorithm Name: Rijndael\n"
          "Principal Submitter: %s\n",
          vtFile, "Joan Daemen");
  fflush(fp);
  rijndaelVTKAT(fp, 128);
  rijndaelVTKAT(fp, 192);
  rijndaelVTKAT(fp, 256);
  fprintf(fp, "\n"
              "==========");
  fclose(fp);
  fp = fopen(tblFile, "w");
  fprintf(fp,
          "/* Description of what tables are tested:\n"
          "   The provided implementations each use a different set of tables\n"
          "    - Java implementation: uses no tables\n"
          "    - reference C implementation: uses Logtable, Alogtable, S, Si, "
          "rcon\n"
          "    - fast C implementation: uses Logtable, Alogtable,  rcon\n"
          "        and additionally, T1, T2, T3, T4, T5, T6, T7, T8\n"
          "   All these tables are tested.\n"
          "\n"
          "=========================\n"
          "\n"
          "FILENAME:  \"%s\"\n"
          "\n"
          "Electronic Codebook (ECB) Mode\n"
          "Tables Known Answer Tests\n"
          "\n"
          "Algorithm Name: Rijndael\n"
          "Principal Submitter: %s\n",
          tblFile, "Joan Daemen");
  fflush(fp);
  if (NULL != (fp2 = fopen("table.128", "r"))) {
    rijndaelTKAT(fp, 128, fp2);
    fclose(fp2);
  } else {
    printf("Table Known Answer test expects file table.128\n");
    fclose(fp);
    exit(EXIT_FAILURE);
  }
  if (NULL != (fp2 = fopen("table.192", "r"))) {
    rijndaelTKAT(fp, 192, fp2);
    fclose(fp2);
  } else {
    printf("Table Known Answer test expects file table.192\n");
    fclose(fp);
    exit(EXIT_FAILURE);
  }
  if (NULL != (fp2 = fopen("table.256", "r"))) {
    rijndaelTKAT(fp, 256, fp2);
    fclose(fp2);
  } else {
    printf("Table Known Answer test expects file table.192\n");
    fclose(fp);
    exit(EXIT_FAILURE);
  }
  fprintf(fp, "\n"
              "==========");
  fclose(fp);
  fp = fopen(ivFile, "w");
  fprintf(fp,
          "\n"
          "=========================\n"
          "\n"
          "FILENAME:  \"%s\"\n"
          "\n"
          "Electronic Codebook (ECB) Mode\n"
          "Intermediate Value Known Answer Tests\n"
          "\n"
          "Algorithm Name: Rijndael\n"
          "Principal Submitter: %s\n",
          ivFile, "Joan Daemen");
  fflush(fp);
  rijndaelIVKAT(fp, 128);
  rijndaelIVKAT(fp, 192);
  rijndaelIVKAT(fp, 256);
  fprintf(fp, "\n"
              "==========");
  fclose(fp);
}


x86 assembly (clang, -O0):
<makeKATs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe27(%rip),%rsi
lea    0xebf(%rip),%rcx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fflush@plt>
mov    -0x28(%rbp),%rdi
mov    $0x80,%esi
call   10c0 <rijndaelVKKAT@plt>
mov    -0x28(%rbp),%rdi
mov    $0xc0,%esi
call   10c0 <rijndaelVKKAT@plt>
mov    -0x28(%rbp),%rdi
mov    $0x100,%esi
call   10c0 <rijndaelVKKAT@plt>
mov    -0x28(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe5f(%rip),%rsi
lea    0xe40(%rip),%rcx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fflush@plt>
mov    -0x28(%rbp),%rdi
mov    $0x80,%esi
call   10a0 <rijndaelVTKAT@plt>
mov    -0x28(%rbp),%rdi
mov    $0xc0,%esi
call   10a0 <rijndaelVTKAT@plt>
mov    -0x28(%rbp),%rdi
mov    $0x100,%esi
call   10a0 <rijndaelVTKAT@plt>
mov    -0x28(%rbp),%rdi
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
lea    0xd3f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe80(%rip),%rsi
lea    0xdc1(%rip),%rcx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fflush@plt>
lea    0x1070(%rip),%rdi
lea    0x1073(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x30(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     1335 <makeKATs+0x195>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x80,%esi
call   1090 <rijndaelTKAT@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1358 <makeKATs+0x1b8>
lea    0x1037(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0x1044(%rip),%rdi
lea    0x100b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x30(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     139d <makeKATs+0x1fd>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0xc0,%esi
call   1090 <rijndaelTKAT@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
jmp    13c0 <makeKATs+0x220>
lea    0x1009(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2c27(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0x1016(%rip),%rdi
lea    0xfa3(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x30(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     1405 <makeKATs+0x265>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x100,%esi
call   1090 <rijndaelTKAT@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1428 <makeKATs+0x288>
lea    0xfa1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2bbf(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x28(%rbp),%rdi
lea    0xc7a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
lea    0xbb2(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xf81(%rip),%rsi
lea    0xc34(%rip),%rcx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fflush@plt>
mov    -0x28(%rbp),%rdi
mov    $0x80,%esi
call   1060 <rijndaelIVKAT@plt>
mov    -0x28(%rbp),%rdi
mov    $0xc0,%esi
call   1060 <rijndaelIVKAT@plt>
mov    -0x28(%rbp),%rdi
mov    $0x100,%esi
call   1060 <rijndaelIVKAT@plt>
mov    -0x28(%rbp),%rdi
lea    0xbfb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeKATs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xe31(%rip),%r13
mov    %r13,%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0xe21(%rip),%rsi
lea    0xeb9(%rip),%rcx
mov    %rax,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1070 <fflush@plt>
mov    %r14,%rdi
mov    $0x80,%esi
call   10d0 <rijndaelVKKAT@plt>
mov    %r14,%rdi
mov    $0xc0,%esi
call   10d0 <rijndaelVKKAT@plt>
mov    %r14,%rdi
mov    $0x100,%esi
call   10d0 <rijndaelVKKAT@plt>
lea    0xe82(%rip),%r12
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r14,%rcx
call   10c0 <fwrite@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbp
lea    0xe5c(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
lea    0xe37(%rip),%r14
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbp,%rdi
call   1070 <fflush@plt>
mov    %rbp,%rdi
mov    $0x80,%esi
call   10a0 <rijndaelVTKAT@plt>
mov    %rbp,%rdi
mov    $0xc0,%esi
call   10a0 <rijndaelVTKAT@plt>
mov    %rbp,%rdi
mov    $0x100,%esi
call   10a0 <rijndaelVTKAT@plt>
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe84(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <fflush@plt>
lea    0x1149(%rip),%rdi
lea    0x106c(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     144a <makeKATs+0x29a>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1090 <rijndaelTKAT@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0x1141(%rip),%rdi
lea    0x1035(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1441 <makeKATs+0x291>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0xc0,%esi
mov    %rax,%rdx
call   1090 <rijndaelTKAT@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0x1007(%rip),%rdi
lea    0xffe(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1441 <makeKATs+0x291>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1090 <rijndaelTKAT@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0xd14(%rip),%r15
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xc43(%rip),%rsi
mov    (%rsp),%rbp
mov    %rbp,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xfa0(%rip),%rsi
lea    0xcc7(%rip),%rcx
mov    %rax,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <fflush@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
call   1060 <rijndaelIVKAT@plt>
mov    %rbx,%rdi
mov    $0xc0,%esi
call   1060 <rijndaelIVKAT@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <rijndaelIVKAT@plt>
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fclose@plt>
lea    0xfff(%rip),%rdi
jmp    1451 <makeKATs+0x2a1>
lea    0xfc7(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2b7b(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [159 x i8] c"\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0AVariable Key Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@.str.2 = [12 x i8] c"Joan Daemen\00"
@.str.3 = [12 x i8] c"\0A==========\00"
@.str.4 = [160 x i8] c"\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0AVariable Text Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@.str.5 = [526 x i8] c"/* Description of what tables are tested:\0A The provided implementations each use a different set of tables\0A - Java implementation: uses no tables\0A - reference C implementation: uses Logtable, Alogtable, S, Si, rcon\0A - fast C implementation: uses Logtable, Alogtable, rcon\0A and additionally, T1, T2, T3, T4, T5, T6, T7, T8\0A All these tables are tested.\0A\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0ATables Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@.str.6 = [10 x i8] c"table.128\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [48 x i8] c"Table Known Answer test expects file table.128\0A\00"
@EXIT_FAILURE = global i32 0
@.str.9 = [10 x i8] c"table.192\00"
@.str.10 = [48 x i8] c"Table Known Answer test expects file table.192\0A\00"
@.str.11 = [10 x i8] c"table.256\00"
@.str.12 = [165 x i8] c"\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0AIntermediate Value Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
define void @makeKATs(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %5
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %9
%13 = load i32*, i32** %9
%14 = load i8*, i8** %5
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32*, i32** %9
%17 = call i32 @fflush(i32* %16)
%18 = load i32*, i32** %9
%19 = call i32 @rijndaelVKKAT(i32* %18, i32 128)
%20 = load i32*, i32** %9
%21 = call i32 @rijndaelVKKAT(i32* %20, i32 192)
%22 = load i32*, i32** %9
%23 = call i32 @rijndaelVKKAT(i32* %22, i32 256)
%24 = load i32*, i32** %9
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32*, i32** %9
%27 = call i32 @fclose(i32* %26)
%28 = load i8*, i8** %6
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %29, i32** %9
%30 = load i32*, i32** %9
%31 = load i8*, i8** %6
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.4, i64 0, i64 0), i8* %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%33 = load i32*, i32** %9
%34 = call i32 @fflush(i32* %33)
%35 = load i32*, i32** %9
%36 = call i32 @rijndaelVTKAT(i32* %35, i32 128)
%37 = load i32*, i32** %9
%38 = call i32 @rijndaelVTKAT(i32* %37, i32 192)
%39 = load i32*, i32** %9
%40 = call i32 @rijndaelVTKAT(i32* %39, i32 256)
%41 = load i32*, i32** %9
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32*, i32** %9
%44 = call i32 @fclose(i32* %43)
%45 = load i8*, i8** %7
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %46, i32** %9
%47 = load i32*, i32** %9
%48 = load i8*, i8** %7
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([526 x i8], [526 x i8]* @.str.5, i64 0, i64 0), i8* %48, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32*, i32** %9
%51 = call i32 @fflush(i32* %50)
%52 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %52, i32** %10
%53 = icmp ne i32* null, %52
br i1 %53, label %54, label %60
54: ; preds = %4
%55 = load i32*, i32** %9
%56 = load i32*, i32** %10
%57 = call i32 @rijndaelTKAT(i32* %55, i32 128, i32* %56)
%58 = load i32*, i32** %10
%59 = call i32 @fclose(i32* %58)
br label %66
60: ; preds = %4
%61 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
%62 = load i32*, i32** %9
%63 = call i32 @fclose(i32* %62)
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %54
%67 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %67, i32** %10
%68 = icmp ne i32* null, %67
br i1 %68, label %69, label %75
69: ; preds = %66
%70 = load i32*, i32** %9
%71 = load i32*, i32** %10
%72 = call i32 @rijndaelTKAT(i32* %70, i32 192, i32* %71)
%73 = load i32*, i32** %10
%74 = call i32 @fclose(i32* %73)
br label %81
75: ; preds = %66
%76 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0))
%77 = load i32*, i32** %9
%78 = call i32 @fclose(i32* %77)
%79 = load i32, i32* @EXIT_FAILURE
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %69
%82 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %82, i32** %10
%83 = icmp ne i32* null, %82
br i1 %83, label %84, label %90
84: ; preds = %81
%85 = load i32*, i32** %9
%86 = load i32*, i32** %10
%87 = call i32 @rijndaelTKAT(i32* %85, i32 256, i32* %86)
%88 = load i32*, i32** %10
%89 = call i32 @fclose(i32* %88)
br label %96
90: ; preds = %81
%91 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0))
%92 = load i32*, i32** %9
%93 = call i32 @fclose(i32* %92)
%94 = load i32, i32* @EXIT_FAILURE
%95 = call i32 @exit(i32 %94)
unreachable
96: ; preds = %84
%97 = load i32*, i32** %9
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%99 = load i32*, i32** %9
%100 = call i32 @fclose(i32* %99)
%101 = load i8*, i8** %8
%102 = call i32* @fopen(i8* %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %102, i32** %9
%103 = load i32*, i32** %9
%104 = load i8*, i8** %8
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str.12, i64 0, i64 0), i8* %104, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%106 = load i32*, i32** %9
%107 = call i32 @fflush(i32* %106)
%108 = load i32*, i32** %9
%109 = call i32 @rijndaelIVKAT(i32* %108, i32 128)
%110 = load i32*, i32** %9
%111 = call i32 @rijndaelIVKAT(i32* %110, i32 192)
%112 = load i32*, i32** %9
%113 = call i32 @rijndaelIVKAT(i32* %112, i32 256)
%114 = load i32*, i32** %9
%115 = call i32 (i32*, i8*, ...) @fprintf(i32* %114, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%116 = load i32*, i32** %9
%117 = call i32 @fclose(i32* %116)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [159 x i8] c"\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0AVariable Key Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@.str.2 = [12 x i8] c"Joan Daemen\00"
@.str.3 = [12 x i8] c"\0A==========\00"
@.str.4 = [160 x i8] c"\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0AVariable Text Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@.str.5 = [526 x i8] c"/* Description of what tables are tested:\0A The provided implementations each use a different set of tables\0A - Java implementation: uses no tables\0A - reference C implementation: uses Logtable, Alogtable, S, Si, rcon\0A - fast C implementation: uses Logtable, Alogtable, rcon\0A and additionally, T1, T2, T3, T4, T5, T6, T7, T8\0A All these tables are tested.\0A\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0ATables Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@.str.6 = [10 x i8] c"table.128\00"
@.str.7 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.9 = [10 x i8] c"table.192\00"
@.str.11 = [10 x i8] c"table.256\00"
@.str.12 = [165 x i8] c"\0A=========================\0A\0AFILENAME: \22%s\22\0A\0AElectronic Codebook (ECB) Mode\0AIntermediate Value Known Answer Tests\0A\0AAlgorithm Name: Rijndael\0APrincipal Submitter: %s\0A\00"
@str = [47 x i8] c"Table Known Answer test expects file table.128\00"
@str.14 = [47 x i8] c"Table Known Answer test expects file table.192\00"
define void @makeKATs(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @fflush(i32* %5)
%8 = tail call i32 @rijndaelVKKAT(i32* %5, i32 128)
%9 = tail call i32 @rijndaelVKKAT(i32* %5, i32 192)
%10 = tail call i32 @rijndaelVKKAT(i32* %5, i32 256)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %5)
%12 = tail call i32 @fclose(i32* %5)
%13 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @fflush(i32* %13)
%16 = tail call i32 @rijndaelVTKAT(i32* %13, i32 128)
%17 = tail call i32 @rijndaelVTKAT(i32* %13, i32 192)
%18 = tail call i32 @rijndaelVTKAT(i32* %13, i32 256)
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %13)
%20 = tail call i32 @fclose(i32* %13)
%21 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([526 x i8], [526 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 @fflush(i32* %21)
%24 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %31, label %26
26: ; preds = %4
%27 = tail call i32 @rijndaelTKAT(i32* %21, i32 128, i32* %24)
%28 = tail call i32 @fclose(i32* %24)
%29 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i32* %29, null
br i1 %30, label %41, label %36
31: ; preds = %4
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%33 = tail call i32 @fclose(i32* %21)
%34 = load i32, i32* @EXIT_FAILURE
%35 = tail call i32 @exit(i32 %34)
unreachable
36: ; preds = %26
%37 = tail call i32 @rijndaelTKAT(i32* %21, i32 192, i32* %29)
%38 = tail call i32 @fclose(i32* %29)
%39 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %59, label %46
41: ; preds = %26
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.14, i64 0, i64 0))
%43 = tail call i32 @fclose(i32* %21)
%44 = load i32, i32* @EXIT_FAILURE
%45 = tail call i32 @exit(i32 %44)
unreachable
46: ; preds = %36
%47 = tail call i32 @rijndaelTKAT(i32* %21, i32 256, i32* %39)
%48 = tail call i32 @fclose(i32* %39)
%49 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %21)
%50 = tail call i32 @fclose(i32* %21)
%51 = tail call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%52 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str.12, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%53 = tail call i32 @fflush(i32* %51)
%54 = tail call i32 @rijndaelIVKAT(i32* %51, i32 128)
%55 = tail call i32 @rijndaelIVKAT(i32* %51, i32 192)
%56 = tail call i32 @rijndaelIVKAT(i32* %51, i32 256)
%57 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %51)
%58 = tail call i32 @fclose(i32* %51)
ret void
59: ; preds = %36
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.14, i64 0, i64 0))
%61 = tail call i32 @fclose(i32* %21)
%62 = load i32, i32* @EXIT_FAILURE
%63 = tail call i32 @exit(i32 %62)
unreachable
}