#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 uint8_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int byteSwapper(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(int *, int, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int main(int argc, char const *argv[]) {
  puts("EDITING FOX");
  FILE *fp;
  char const *falcoDATs[4] = {"PlFxNr.dat", "PlFxGr.dat", "PlFxOr.dat",
                              "PlFxLa.dat"};
  long const arrayOfJacketOffsets[8] = {0x9952, 0x9A12, 0x9B92, 0x9C52,
                                        0xB072, 0xB132, 0xB1F2, 0xB2B2};
  for (int i = 0; i < 8; i++) {
    printf("offset: %#X\n", arrayOfJacketOffsets[i]);
  }
  puts("\nEnter number corresponding to choice:");
  for (int i = 0; i < 4; i++) {
    printf("%d: %s\n", i, falcoDATs[i]);
  }
  int choice;
  char fileName[255];
  scanf("%d", &choice);
  if (choice >= 0 && choice < 4) {
    strcpy(fileName, falcoDATs[choice]);
    printf("You chose: %s\n", fileName);
  } else {
    puts("invalid choice \007");
    return -1;
  }
  fp = fopen(fileName, "rb");
  if (fp == NULL) {
    puts("failed to open file \007");
    return -1;
  } else {
    puts("succesfully opened file");
    fseek(fp, 0, SEEK_END);
    long file_size = ftell(fp);
    printf("size of file is : %ld\n", file_size);
    uint8_t BUFFER[file_size];
    fseek(fp, 0, SEEK_SET);
    fread(BUFFER, sizeof(uint8_t), file_size, fp);
    for (int i = 0; i < 8; i++) {
      long offset = arrayOfJacketOffsets[i];
      printf("\n%d offset: %#X", i, offset);
      printf("\narrayOfJacketOffsets[i]: %#X", arrayOfJacketOffsets[i]);
      uint16_t jacket;
      fseek(fp, offset, SEEK_SET);
      fread(&jacket, sizeof(uint16_t), 1, fp);
      jacket = byteSwapper(jacket);
      if (jacket == 0x001C) {
        printf("\nmaking the jacket matte");
        BUFFER[offset] = 0x00;
        BUFFER[offset + 1] = 0x14;
      } else if (jacket == 0x0014) {
        printf("\nmaking the jacket shiny");
        BUFFER[offset] = 0x00;
        BUFFER[offset + 1] = 0x1C;
      } else {
        printf("\nERROR!");
      }
      printf("\nwas: %#0.2x ::", jacket);
      printf("is:  %#0.2x\n", BUFFER[offset + 1]);
    }
    FILE *fpout;
    char *outFileName = fileName;
    strcat(outFileName, ".out");
    printf("\nOutputted to: \"%s\"\nYou will need to delete \".out\" before "
           "importing",
           outFileName);
    fpout = fopen(outFileName, "wb");
    fwrite(BUFFER, sizeof(uint8_t), file_size, fpout);
    fclose(fpout);
  }
  puts("\nClosing file...");
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe10(%rip),%rdi
call   1040 <puts@plt>
mov    0x2bf4(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2bf1(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2bee(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2beb(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xfa4(%rip),%rsi
mov    $0x40,%edx
call   1090 <memcpy@plt>
movl   $0x0,-0x84(%rbp)
cmpl   $0x8,-0x84(%rbp)
jge    127b <main+0xab>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1240 <main+0x70>
lea    0xdc3(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x88(%rbp)
cmpl   $0x4,-0x88(%rbp)
jge    12d2 <main+0x102>
mov    -0x88(%rbp),%esi
movslq -0x88(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1291 <main+0xc1>
lea    0xd9b(%rip),%rdi
lea    -0x8c(%rbp),%rsi
call   10c0 <scanf@plt>
cmpl   $0x0,-0x8c(%rbp)
jl     1331 <main+0x161>
cmpl   $0x4,-0x8c(%rbp)
jge    1331 <main+0x161>
lea    -0x190(%rbp),%rdi
movslq -0x8c(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
call   1030 <strcpy@plt>
lea    -0x190(%rbp),%rsi
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1349 <main+0x179>
lea    0xd4e(%rip),%rdi
call   1040 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1666 <main+0x496>
lea    -0x190(%rbp),%rdi
lea    0xd40(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1383 <main+0x1b3>
lea    0xd28(%rip),%rdi
call   1040 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1666 <main+0x496>
lea    0xd26(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c4e(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,-0x1dc(%rbp)
mov    %eax,%esi
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,%rcx
mov    -0x1dc(%rbp),%eax
mov    %rcx,-0x198(%rbp)
mov    -0x198(%rbp),%rsi
lea    0xcf6(%rip),%rdi
call   1070 <printf@plt>
mov    -0x198(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x1a0(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1d8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x1a8(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2bc2(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <fseek@plt>
mov    -0x1d8(%rbp),%rdi
mov    -0x198(%rbp),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
call   1050 <fread@plt>
movl   $0x0,-0x1ac(%rbp)
cmpl   $0x8,-0x1ac(%rbp)
jge    15c5 <main+0x3f5>
movslq -0x1ac(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x1ac(%rbp),%esi
mov    -0x1b8(%rbp),%rdx
lea    0xc62(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0x1ac(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1b8(%rbp),%rsi
mov    0x2b28(%rip),%rax
mov    (%rax),%edx
call   10b0 <fseek@plt>
mov    -0x18(%rbp),%rcx
lea    -0x1bc(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <fread@plt>
mov    -0x1bc(%rbp),%edi
call   10a0 <byteSwapper@plt>
mov    %eax,-0x1bc(%rbp)
cmpl   $0x1c,-0x1bc(%rbp)
jne    1526 <main+0x356>
lea    0xc17(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1d8(%rbp),%rax
mov    -0x1b8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1b8(%rbp),%rcx
movl   $0x14,0x4(%rax,%rcx,4)
jmp    157d <main+0x3ad>
cmpl   $0x14,-0x1bc(%rbp)
jne    156a <main+0x39a>
lea    0xbec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1d8(%rbp),%rax
mov    -0x1b8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1b8(%rbp),%rcx
movl   $0x1c,0x4(%rax,%rcx,4)
jmp    1578 <main+0x3a8>
lea    0xbce(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    157d <main+0x3ad>
mov    -0x1bc(%rbp),%esi
lea    0xbbd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1d8(%rbp),%rax
mov    -0x1b8(%rbp),%rcx
mov    0x4(%rax,%rcx,4),%esi
lea    0xbad(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1449 <main+0x279>
lea    -0x190(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
mov    -0x1d0(%rbp),%rdi
lea    0xb83(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x1d0(%rbp),%rsi
lea    0xb75(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1d0(%rbp),%rdi
lea    0xba4(%rip),%rsi
call   10d0 <fopen@plt>
mov    -0x1d8(%rbp),%rdi
mov    %rax,-0x1c8(%rbp)
mov    -0x198(%rbp),%rdx
mov    -0x1c8(%rbp),%rcx
mov    $0x4,%esi
call   10f0 <fwrite@plt>
mov    -0x1c8(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x1a0(%rbp),%rax
mov    %rax,%rsp
lea    0xb5f(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
lea    0xe25(%rip),%rdi
call   1040 <puts@plt>
lea    0xe51(%rip),%rbx
mov    $0x9952,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x9a12,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x9b92,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x9c52,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xb072,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xb132,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xb1f2,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xb2b2,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xddf(%rip),%rdi
call   1040 <puts@plt>
lea    0xdfa(%rip),%rbx
lea    0xd93(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd8b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd80(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd75(%rip),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xda6(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x38(%rbp),%eax
cmp    $0x3,%rax
ja     14c8 <main+0x308>
lea    0xee5(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    -0x150(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xd6f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd7e(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1544 <main+0x384>
mov    %rax,%rbx
lea    0xd7c(%rip),%rdi
call   1040 <puts@plt>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbx,%rdi
call   1080 <ftell@plt>
mov    %rax,%r14
lea    0xd6a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,-0x40(%rbp)
mov    %rsp,%r15
lea    0xf(,%r14,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2c50(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r15,-0x30(%rbp)
mov    %r15,%rdi
mov    $0x4,%esi
mov    %r14,-0x48(%rbp)
mov    %r14d,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
lea    0xe2a(%rip),%r15
xor    %r14d,%r14d
mov    %rbx,-0x50(%rbp)
jmp    140b <main+0x24b>
nop
lea    0xd78(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r12
lea    0xd6e(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%rbx,%r12,4),%esi
lea    0xd69(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r14
add    $0x8,%r15
cmp    $0x8,%r14
mov    -0x50(%rbp),%rbx
je     14d1 <main+0x311>
mov    (%r15),%r12
lea    0xcca(%rip),%rdi
mov    %r14d,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcc6(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2b9e(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <fseek@plt>
lea    -0x34(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
mov    -0x34(%rbp),%edi
call   1090 <byteSwapper@plt>
mov    %eax,%r13d
cmp    $0x14,%eax
je     14a0 <main+0x2e0>
cmp    $0x1c,%r13d
mov    -0x30(%rbp),%rbx
jne    13c0 <main+0x200>
lea    0xc8b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0x0,(%rbx,%r12,4)
movl   $0x14,0x4(%rbx,%r12,4)
jmp    13ce <main+0x20e>
nop
lea    0xc7f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x30(%rbp),%rbx
movl   $0x0,(%rbx,%r12,4)
movl   $0x1c,0x4(%rbx,%r12,4)
jmp    13ce <main+0x20e>
lea    0xbb7(%rip),%rdi
jmp    154b <main+0x38b>
lea    0xc8c(%rip),%rsi
lea    -0x150(%rbp),%r12
mov    %r12,%rdi
call   10d0 <strcat@plt>
lea    0xc7b(%rip),%rdi
xor    %r14d,%r14d
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcab(%rip),%rsi
mov    %r12,%rdi
call   10c0 <fopen@plt>
mov    %rax,%r12
mov    -0x30(%rbp),%rdi
mov    $0x4,%esi
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
call   10e0 <fwrite@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
mov    -0x40(%rbp),%rsp
lea    0xc7b(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
jmp    1556 <main+0x396>
lea    0xb4f(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"EDITING FOX\00"
@.str.1 = [11 x i8] c"PlFxNr.dat\00"
@.str.2 = [11 x i8] c"PlFxGr.dat\00"
@.str.3 = [11 x i8] c"PlFxOr.dat\00"
@.str.4 = [11 x i8] c"PlFxLa.dat\00"
@__const.main.falcoDATs = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0)]
@__const.main.arrayOfJacketOffsets = [8 x i64] [i64 39250, i64 39442, i64 39826, i64 40018, i64 45170, i64 45362, i64 45554, i64 45746]
@.str.5 = [13 x i8] c"offset: %#X\0A\00"
@.str.6 = [39 x i8] c"\0AEnter number corresponding to choice:\00"
@.str.7 = [8 x i8] c"%d: %s\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [15 x i8] c"You chose: %s\0A\00"
@.str.10 = [17 x i8] c"invalid choice \07\00"
@.str.11 = [3 x i8] c"rb\00"
@.str.12 = [22 x i8] c"failed to open file \07\00"
@.str.13 = [24 x i8] c"succesfully opened file\00"
@SEEK_END = global i32 0
@.str.14 = [23 x i8] c"size of file is : %ld\0A\00"
@SEEK_SET = global i32 0
@.str.15 = [16 x i8] c"\0A%d offset: %#X\00"
@.str.16 = [30 x i8] c"\0AarrayOfJacketOffsets[i]: %#X\00"
@.str.17 = [25 x i8] c"\0Amaking the jacket matte\00"
@.str.18 = [25 x i8] c"\0Amaking the jacket shiny\00"
@.str.19 = [8 x i8] c"\0AERROR!\00"
@.str.20 = [16 x i8] c"\0Awas: %.2x ::\00"
@.str.21 = [13 x i8] c"is: %.2x\0A\00"
@.str.22 = [5 x i8] c".out\00"
@.str.23 = [68 x i8] c"\0AOutputted to: \22%s\22\0AYou will need to delete \22.out\22 before importing\00"
@.str.24 = [3 x i8] c"wb\00"
@.str.25 = [17 x i8] c"\0AClosing file...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4 x i8*]
%8 = alloca [8 x i64]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [255 x i8]
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i32
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32*
%20 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%22 = bitcast [4 x i8*]* %7 to i8*
%23 = bitcast [8 x i64]* %8 to i8*
store i32 0, i32* %9
br label %24
24: ; preds = %33, %2
%25 = load i32, i32* %9
%26 = icmp slt i32 %25, 8
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [8 x i64], [8 x i64]* %8, i64 0, i64 %29
%31 = load i64, i64* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 %31)
br label %33
33: ; preds = %27
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %24
36: ; preds = %24
%37 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %10
br label %38
38: ; preds = %48, %36
%39 = load i32, i32* %10
%40 = icmp slt i32 %39, 4
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = load i32, i32* %10
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %42, i8* %46)
br label %48
48: ; preds = %41
%49 = load i32, i32* %10
%50 = add nsw i32 %49, 1
store i32 %50, i32* %10
br label %38
51: ; preds = %38
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %11)
%53 = load i32, i32* %11
%54 = icmp sge i32 %53, 0
br i1 %54, label %55, label %67
55: ; preds = %51
%56 = load i32, i32* %11
%57 = icmp slt i32 %56, 4
br i1 %57, label %58, label %67
58: ; preds = %55
%59 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%60 = load i32, i32* %11
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %61
%63 = load i8*, i8** %62
%64 = call i32 @strcpy(i8* %59, i8* %63)
%65 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %65)
br label %69
67: ; preds = %55, %51
%68 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
store i32 -1, i32* %3
br label %170
69: ; preds = %58
%70 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%71 = call i32* @fopen(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i32* %71, i32** %6
%72 = load i32*, i32** %6
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %76
74: ; preds = %69
%75 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
store i32 -1, i32* %3
br label %170
76: ; preds = %69
%77 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%78 = load i32*, i32** %6
%79 = load i32, i32* @SEEK_END
%80 = call i32 @fseek(i32* %78, i64 0, i32 %79)
%81 = load i32*, i32** %6
%82 = call i64 @ftell(i32* %81)
store i64 %82, i64* %13
%83 = load i64, i64* %13
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i64 %83)
%85 = load i64, i64* %13
%86 = call i8* @llvm.stacksave()
store i8* %86, i8** %14
%87 = alloca i32, i64 %85
store i64 %85, i64* %15
%88 = load i32*, i32** %6
%89 = load i32, i32* @SEEK_SET
%90 = call i32 @fseek(i32* %88, i64 0, i32 %89)
%91 = load i64, i64* %13
%92 = trunc i64 %91 to i32
%93 = load i32*, i32** %6
%94 = call i32 @fread(i32* %87, i32 4, i32 %92, i32* %93)
store i32 0, i32* %16
br label %95
95: ; preds = %149, %76
%96 = load i32, i32* %16
%97 = icmp slt i32 %96, 8
br i1 %97, label %98, label %152
98: ; preds = %95
%99 = load i32, i32* %16
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [8 x i64], [8 x i64]* %8, i64 0, i64 %100
%102 = load i64, i64* %101
store i64 %102, i64* %17
%103 = load i32, i32* %16
%104 = load i64, i64* %17
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %103, i64 %104)
%106 = load i32, i32* %16
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [8 x i64], [8 x i64]* %8, i64 0, i64 %107
%109 = load i64, i64* %108
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i64 %109)
%111 = load i32*, i32** %6
%112 = load i64, i64* %17
%113 = load i32, i32* @SEEK_SET
%114 = call i32 @fseek(i32* %111, i64 %112, i32 %113)
%115 = load i32*, i32** %6
%116 = call i32 @fread(i32* %18, i32 4, i32 1, i32* %115)
%117 = load i32, i32* %18
%118 = call i32 @byteSwapper(i32 %117)
store i32 %118, i32* %18
%119 = load i32, i32* %18
%120 = icmp eq i32 %119, 28
br i1 %120, label %121, label %128
121: ; preds = %98
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0))
%123 = load i64, i64* %17
%124 = getelementptr inbounds i32, i32* %87, i64 %123
store i32 0, i32* %124
%125 = load i64, i64* %17
%126 = add nsw i64 %125, 1
%127 = getelementptr inbounds i32, i32* %87, i64 %126
store i32 20, i32* %127
br label %141
128: ; preds = %98
%129 = load i32, i32* %18
%130 = icmp eq i32 %129, 20
br i1 %130, label %131, label %138
131: ; preds = %128
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0))
%133 = load i64, i64* %17
%134 = getelementptr inbounds i32, i32* %87, i64 %133
store i32 0, i32* %134
%135 = load i64, i64* %17
%136 = add nsw i64 %135, 1
%137 = getelementptr inbounds i32, i32* %87, i64 %136
store i32 28, i32* %137
br label %140
138: ; preds = %128
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
br label %140
140: ; preds = %138, %131
br label %141
141: ; preds = %140, %121
%142 = load i32, i32* %18
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i32 %142)
%144 = load i64, i64* %17
%145 = add nsw i64 %144, 1
%146 = getelementptr inbounds i32, i32* %87, i64 %145
%147 = load i32, i32* %146
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i32 %147)
br label %149
149: ; preds = %141
%150 = load i32, i32* %16
%151 = add nsw i32 %150, 1
store i32 %151, i32* %16
br label %95
152: ; preds = %95
%153 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
store i8* %153, i8** %20
%154 = load i8*, i8** %20
%155 = call i32 @strcat(i8* %154, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i64 0, i64 0))
%156 = load i8*, i8** %20
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.23, i64 0, i64 0), i8* %156)
%158 = load i8*, i8** %20
%159 = call i32* @fopen(i8* %158, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
store i32* %159, i32** %19
%160 = load i64, i64* %13
%161 = load i32*, i32** %19
%162 = call i32 @fwrite(i32* %87, i32 4, i64 %160, i32* %161)
%163 = load i32*, i32** %19
%164 = call i32 @fclose(i32* %163)
%165 = load i8*, i8** %14
br label %166
166: ; preds = %152
%167 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.25, i64 0, i64 0))
%168 = load i32*, i32** %6
%169 = call i32 @fclose(i32* %168)
store i32 0, i32* %3
br label %170
170: ; preds = %166, %74, %67
%171 = load i32, i32* %3
ret i32 %171
}

LLVM IR (-O2):
@.str = [12 x i8] c"EDITING FOX\00"
@.str.1 = [11 x i8] c"PlFxNr.dat\00"
@.str.2 = [11 x i8] c"PlFxGr.dat\00"
@.str.3 = [11 x i8] c"PlFxOr.dat\00"
@.str.4 = [11 x i8] c"PlFxLa.dat\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
@__const.main.arrayOfJacketOffsets = [8 x i64] [i64 39250, i64 39442, i64 39826, i64 40018, i64 45170, i64 45362, i64 45554, i64 45746]
@.str.5 = [13 x i8] c"offset: %#X\0A\00"
@.str.6 = [39 x i8] c"\0AEnter number corresponding to choice:\00"
@.str.7 = [8 x i8] c"%d: %s\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [15 x i8] c"You chose: %s\0A\00"
@.str.10 = [17 x i8] c"invalid choice \07\00"
@.str.11 = [3 x i8] c"rb\00"
@.str.12 = [22 x i8] c"failed to open file \07\00"
@.str.13 = [24 x i8] c"succesfully opened file\00"
@SEEK_END = global i32 0
@.str.14 = [23 x i8] c"size of file is : %ld\0A\00"
@SEEK_SET = global i32 0
@.str.15 = [16 x i8] c"\0A%d offset: %#X\00"
@.str.16 = [30 x i8] c"\0AarrayOfJacketOffsets[i]: %#X\00"
@.str.17 = [25 x i8] c"\0Amaking the jacket matte\00"
@.str.18 = [25 x i8] c"\0Amaking the jacket shiny\00"
@.str.19 = [8 x i8] c"\0AERROR!\00"
@.str.20 = [16 x i8] c"\0Awas: %.2x ::\00"
@.str.21 = [13 x i8] c"is: %.2x\0A\00"
@.str.22 = [5 x i8] c".out\00"
@.str.23 = [68 x i8] c"\0AOutputted to: \22%s\22\0AYou will need to delete \22.out\22 before importing\00"
@.str.24 = [3 x i8] c"wb\00"
@.str.25 = [17 x i8] c"\0AClosing file...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [255 x i8]
%5 = alloca i32
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 39250)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 39442)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 39826)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 40018)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 45170)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 45362)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 45554)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 45746)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%20 = bitcast i32* %3 to i8*
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%23 = load i32, i32* %3
%24 = icmp ult i32 %23, 4
br i1 %24, label %25, label %33
25: ; preds = %2
%26 = zext i32 %23 to i64
%27 = shl i64 %26, 2
%28 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %27)
%29 = call i32 @strcpy(i8* %21, i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%31 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %35, label %37
33: ; preds = %2
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
br label %91
35: ; preds = %25
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %91
37: ; preds = %25
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%39 = load i32, i32* @SEEK_END
%40 = call i32 @fseek(i32* %31, i64 0, i32 %39)
%41 = call i64 @ftell(i32* %31)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i64 %41)
%43 = call i8* @llvm.stacksave()
%44 = alloca i32, i64 %41
%45 = load i32, i32* @SEEK_SET
%46 = call i32 @fseek(i32* %31, i64 0, i32 %45)
%47 = trunc i64 %41 to i32
%48 = call i32 @fread(i32* %44, i32 4, i32 %47, i32* %31)
%49 = bitcast i32* %5 to i8*
br label %58
50: ; preds = %83
%51 = call i32 @strcat(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.23, i64 0, i64 0), i8* %21)
%53 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
%54 = call i32 @fwrite(i32* %44, i32 4, i64 %41, i32* %53)
%55 = call i32 @fclose(i32* %53)
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.25, i64 0, i64 0))
%57 = call i32 @fclose(i32* %31)
br label %91
58: ; preds = %37, %83
%59 = phi i64 [ 0, %37 ], [ %89, %83 ]
%60 = getelementptr inbounds [8 x i64], [8 x i64]* @__const.main.arrayOfJacketOffsets, i64 0, i64 %59
%61 = load i64, i64* %60
%62 = trunc i64 %59 to i32
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i32 %62, i64 %61)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i64 %61)
%65 = load i32, i32* @SEEK_SET
%66 = call i32 @fseek(i32* %31, i64 %61, i32 %65)
%67 = call i32 @fread(i32* %5, i32 4, i32 1, i32* %31)
%68 = load i32, i32* %5
%69 = call i32 @byteSwapper(i32 %68)
switch i32 %69, label %80 [
i32 28, label %70
i32 20, label %75
]
70: ; preds = %58
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0))
%72 = getelementptr inbounds i32, i32* %44, i64 %61
store i32 0, i32* %72
%73 = add nsw i64 %61, 1
%74 = getelementptr inbounds i32, i32* %44, i64 %73
store i32 20, i32* %74
br label %83
75: ; preds = %58
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.18, i64 0, i64 0))
%77 = getelementptr inbounds i32, i32* %44, i64 %61
store i32 0, i32* %77
%78 = add nsw i64 %61, 1
%79 = getelementptr inbounds i32, i32* %44, i64 %78
store i32 28, i32* %79
br label %83
80: ; preds = %58
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
%82 = add nsw i64 %61, 1
br label %83
83: ; preds = %75, %80, %70
%84 = phi i64 [ %78, %75 ], [ %82, %80 ], [ %73, %70 ]
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i32 %69)
%86 = getelementptr inbounds i32, i32* %44, i64 %84
%87 = load i32, i32* %86
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i32 %87)
%89 = add nuw nsw i64 %59, 1
%90 = icmp eq i64 %89, 8
br i1 %90, label %50, label %58
91: ; preds = %50, %35, %33
%92 = phi i32 [ -1, %35 ], [ 0, %50 ], [ -1, %33 ]
ret i32 %92
}