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

/* Variables and functions */
int /*<<< orphan*/ PrintErrorDestroyFile(char *, char *, char *);
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
long fread(unsigned char *, int, int, int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
long fwrite(char *, int, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned char, unsigned char,
                            unsigned char);
long strlen(char *);
int main(int argc, char *argv[]) {
  int i;
  long count;
  char buffer[128];
  unsigned char gamepal[768];
  FILE *filestream = fopen("gamepal.obj", "rb");
  if (filestream == NULL) {
    printf("[Error]: Could not open file '%s' for read!\n", "gamepal.obj");
    return 1;
  }
  if (fseek(filestream, 0x77, SEEK_SET)) {
    fclose(filestream);
    printf("[Error]: Could not seek past header data!\n");
    return 2;
  }
  count = fread(gamepal, sizeof(char), 768, filestream);
  if (count != 768) {
    fclose(filestream);
    printf("[Error]: Read error on file '%s'\n", "gamepal.obj");
    return 3;
  }
  if (fclose(filestream)) {
    printf("[Error]: The filestream was not closed\n");
  }
  filestream = fopen("wolf_pal.c", "w");
  if (filestream == NULL) {
    printf("[Error]: Could not create output file '%s'\n", "wolf_pal.c");
    return 4;
  }
  count = fwrite("\nchar gamepal[ ] = {\n", sizeof(char),
                 strlen("\nchar gamepal[ ] = {\n"), filestream);
  if (count != strlen("\nchar gamepal[ ] = {\n")) {
    fclose(filestream);
    PrintErrorDestroyFile("wolf_pal.c",
                          "[Error]: Could not write to output file: '%s'",
                          "wolf_pal.c");
    return 5;
  }
  for (i = 0; i < 768; i += 3) {
    snprintf(buffer, sizeof(buffer), "\t%d, %d, %d,\n", gamepal[i],
             gamepal[i + 1], gamepal[i + 2]);
    count = fwrite(buffer, sizeof(char), strlen(buffer), filestream);
    if (count != strlen(buffer)) {
      fclose(filestream);
      PrintErrorDestroyFile("wolf_pal.c",
                            "[Error]: Could not write to output file: '%s'",
                            "wolf_pal.c");
      return 5;
    }
  }
  if (fseek(filestream, -3, SEEK_CUR)) {
    fclose(filestream);
    PrintErrorDestroyFile("wolf_pal.c",
                          "[Error]: Could not seek back on output file '%s'\n",
                          "wolf_pal.c");
    return 6;
  }
  count = fwrite("\n};\n", sizeof(char), strlen("\n};\n"), filestream);
  if (count != strlen("\n};\n")) {
    fclose(filestream);
    PrintErrorDestroyFile("wolf_pal.c",
                          "[Error]: Could not write to output file: '%s'",
                          "wolf_pal.c");
    return 5;
  }
  if (fclose(filestream)) {
    printf("[Error]: The filestream was not closed\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe50(%rip),%rdi
lea    0xe55(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x3a8(%rbp)
cmpq   $0x0,-0x3a8(%rbp)
jne    11f2 <main+0x62>
lea    0xe37(%rip),%rdi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    158b <main+0x3fb>
mov    -0x3a8(%rbp),%rdi
mov    0x2dd8(%rip),%rax
mov    (%rax),%edx
mov    $0x77,%esi
call   1090 <fseek@plt>
cmp    $0x0,%rax
je     123c <main+0xac>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    158b <main+0x3fb>
lea    -0x3a0(%rbp),%rdi
mov    -0x3a8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x300,%edx
call   1030 <fread@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x300,-0x20(%rbp)
je     1298 <main+0x108>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xde9(%rip),%rdi
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    158b <main+0x3fb>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     12bc <main+0x12c>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdee(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x3a8(%rbp)
cmpq   $0x0,-0x3a8(%rbp)
jne    1305 <main+0x175>
lea    0xdd3(%rip),%rdi
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x4,-0x4(%rbp)
jmp    158b <main+0x3fb>
lea    0xdde(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdx
mov    -0x3a8(%rbp),%rcx
lea    0xdc8(%rip),%rdi
mov    $0x1,%esi
call   10b0 <fwrite@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x3b0(%rbp)
lea    0xda8(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x3b0(%rbp),%rax
cmp    %rcx,%rax
je     1388 <main+0x1f8>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xd44(%rip),%rdx
lea    0xd8c(%rip),%rsi
mov    %rdx,%rdi
call   1050 <PrintErrorDestroyFile@plt>
movl   $0x5,-0x4(%rbp)
jmp    158b <main+0x3fb>
movl   $0x0,-0x14(%rbp)
cmpl   $0x300,-0x14(%rbp)
jge    148b <main+0x2fb>
lea    -0xa0(%rbp),%rdi
movslq -0x14(%rbp),%rax
mov    -0x3a0(%rbp,%rax,1),%cl
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x3a0(%rbp,%rax,1),%r8b
ff
mov    -0x14(%rbp),%eax
add    $0x2,%eax
cltq
mov    $0x80,%esi
lea    0xd5c(%rip),%rdx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl -0x3a0(%rbp,%rax,1),%r9d
ff ff
call   1080 <snprintf@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0x3c0(%rbp)
lea    -0xa0(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x3c0(%rbp),%rdi
mov    %rax,%rdx
mov    -0x3a8(%rbp),%rcx
mov    $0x1,%esi
call   10b0 <fwrite@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x3b8(%rbp)
lea    -0xa0(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x3b8(%rbp),%rax
cmp    %rcx,%rax
je     1478 <main+0x2e8>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xc54(%rip),%rdx
lea    0xc9c(%rip),%rsi
mov    %rdx,%rdi
call   1050 <PrintErrorDestroyFile@plt>
movl   $0x5,-0x4(%rbp)
jmp    158b <main+0x3fb>
jmp    147d <main+0x2ed>
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
jmp    138f <main+0x1ff>
mov    -0x3a8(%rbp),%rdi
mov    0x2b4f(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffd,%esi
call   1090 <fseek@plt>
cmp    $0x0,%rax
je     14dd <main+0x34d>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xbef(%rip),%rdx
lea    0xc73(%rip),%rsi
mov    %rdx,%rdi
call   1050 <PrintErrorDestroyFile@plt>
movl   $0x6,-0x4(%rbp)
jmp    158b <main+0x3fb>
lea    0xc8a(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdx
mov    -0x3a8(%rbp),%rcx
lea    0xc74(%rip),%rdi
mov    $0x1,%esi
call   10b0 <fwrite@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x3c8(%rbp)
lea    0xc54(%rip),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x3c8(%rbp),%rax
cmp    %rcx,%rax
je     1560 <main+0x3d0>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xb6c(%rip),%rdx
lea    0xbb4(%rip),%rsi
mov    %rdx,%rdi
call   1050 <PrintErrorDestroyFile@plt>
movl   $0x5,-0x4(%rbp)
jmp    158b <main+0x3fb>
mov    -0x3a8(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     1584 <main+0x3f4>
lea    0xb0c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x380,%rsp
lea    0xe49(%rip),%rdi
lea    0xe4e(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1204 <main+0x64>
mov    %rax,%rbx
mov    0x2e06(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x77,%esi
call   10a0 <fseek@plt>
test   %rax,%rax
je     1223 <main+0x83>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xf52(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%ebx
jmp    13c1 <main+0x221>
lea    0xe04(%rip),%rdi
lea    0xdee(%rip),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%ebx
jmp    13c1 <main+0x221>
lea    0x80(%rsp),%rdi
mov    $0x1,%esi
mov    $0x300,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <fclose@plt>
cmp    $0x300,%r14
jne    1366 <main+0x1c6>
test   %rax,%rax
je     1266 <main+0xc6>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xdf1(%rip),%rdi
lea    0xdf5(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13a7 <main+0x207>
mov    %rax,%r15
lea    0xe0b(%rip),%rdi
mov    $0x15,%edx
mov    $0x1,%esi
mov    %rax,%rcx
call   10c0 <fwrite@plt>
cmp    $0x15,%rax
jne    1382 <main+0x1e2>
mov    $0xfffffffffffffffd,%rbx
lea    0xe25(%rip),%r14
mov    %rsp,%r12
nopl   0x0(%rax)
movzbl 0x83(%rsp,%rbx,1),%ecx
movzbl 0x84(%rsp,%rbx,1),%r8d
movzbl 0x85(%rsp,%rbx,1),%r9d
mov    %r12,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1090 <snprintf@plt>
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r15,%rcx
call   10c0 <fwrite@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1070 <strlen@plt>
cmp    %rax,%r13
jne    1382 <main+0x1e2>
add    $0x3,%rbx
cmp    $0x2fc,%rbx
jbe    12c0 <main+0x120>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    $0xfffffffd,%esi
call   10a0 <fseek@plt>
test   %rax,%rax
je     13d4 <main+0x234>
mov    %r15,%rdi
call   1050 <fclose@plt>
lea    0xd99(%rip),%rsi
lea    0xd07(%rip),%rdi
mov    %rdi,%rdx
call   1060 <PrintErrorDestroyFile@plt>
mov    $0x6,%ebx
jmp    13c1 <main+0x221>
lea    0xccf(%rip),%rdi
lea    0xc8c(%rip),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x3,%ebx
jmp    13c1 <main+0x221>
mov    %r15,%rdi
call   1050 <fclose@plt>
lea    0xd1c(%rip),%rsi
lea    0xcc6(%rip),%rdi
mov    %rdi,%rdx
call   1060 <PrintErrorDestroyFile@plt>
mov    $0x5,%ebx
jmp    13c1 <main+0x221>
lea    0xcbd(%rip),%rdi
lea    0xca9(%rip),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x4,%ebx
mov    %ebx,%eax
add    $0x380,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xd40(%rip),%rdi
mov    $0x4,%edx
mov    $0x1,%esi
mov    %r15,%rcx
call   10c0 <fwrite@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <fclose@plt>
cmp    $0x4,%rbx
jne    138a <main+0x1ea>
xor    %ebx,%ebx
test   %rax,%rax
je     13c1 <main+0x221>
lea    0xd14(%rip),%rdi
call   1030 <puts@plt>
jmp    13c1 <main+0x221>

LLVM IR (-O0):
@.str = [12 x i8] c"gamepal.obj\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [45 x i8] c"[Error]: Could not open file '%s' for read!\0A\00"
@SEEK_SET = global i32 0
@.str.3 = [43 x i8] c"[Error]: Could not seek past header data!\0A\00"
@.str.4 = [34 x i8] c"[Error]: Read error on file '%s'\0A\00"
@.str.5 = [40 x i8] c"[Error]: The filestream was not closed\0A\00"
@.str.6 = [11 x i8] c"wolf_pal.c\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [44 x i8] c"[Error]: Could not create output file '%s'\0A\00"
@.str.9 = [22 x i8] c"\0Achar gamepal[ ] = {\0A\00"
@.str.10 = [46 x i8] c"[Error]: Could not write to output file: '%s'\00"
@.str.11 = [14 x i8] c"\09%d, %d, %d,\0A\00"
@SEEK_CUR = global i32 0
@.str.12 = [50 x i8] c"[Error]: Could not seek back on output file '%s'\0A\00"
@.str.13 = [5 x i8] c"\0A};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca [128 x i8]
%9 = alloca [768 x i8]
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %10
%12 = load i32*, i32** %10
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %123
16: ; preds = %2
%17 = load i32*, i32** %10
%18 = load i32, i32* @SEEK_SET
%19 = call i64 @fseek(i32* %17, i32 119, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = load i32*, i32** %10
%23 = call i64 @fclose(i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
store i32 2, i32* %3
br label %123
25: ; preds = %16
%26 = getelementptr inbounds [768 x i8], [768 x i8]* %9, i64 0, i64 0
%27 = load i32*, i32** %10
%28 = call i64 @fread(i8* %26, i32 1, i32 768, i32* %27)
store i64 %28, i64* %7
%29 = load i64, i64* %7
%30 = icmp ne i64 %29, 768
br i1 %30, label %31, label %35
31: ; preds = %25
%32 = load i32*, i32** %10
%33 = call i64 @fclose(i32* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 3, i32* %3
br label %123
35: ; preds = %25
%36 = load i32*, i32** %10
%37 = call i64 @fclose(i32* %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %35
%42 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 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* %42, i32** %10
%43 = load i32*, i32** %10
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 4, i32* %3
br label %123
47: ; preds = %41
%48 = call i64 @strlen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%49 = load i32*, i32** %10
%50 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 1, i64 %48, i32* %49)
store i64 %50, i64* %7
%51 = load i64, i64* %7
%52 = call i64 @strlen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%53 = icmp ne i64 %51, %52
br i1 %53, label %54, label %58
54: ; preds = %47
%55 = load i32*, i32** %10
%56 = call i64 @fclose(i32* %55)
%57 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 5, i32* %3
br label %123
58: ; preds = %47
store i32 0, i32* %6
br label %59
59: ; preds = %93, %58
%60 = load i32, i32* %6
%61 = icmp slt i32 %60, 768
br i1 %61, label %62, label %96
62: ; preds = %59
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [768 x i8], [768 x i8]* %9, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = load i32, i32* %6
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [768 x i8], [768 x i8]* %9, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 2
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [768 x i8], [768 x i8]* %9, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = call i32 @snprintf(i8* %63, i32 128, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8 zeroext %67, i8 zeroext %72, i8 zeroext %77)
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%81 = call i64 @strlen(i8* %80)
%82 = load i32*, i32** %10
%83 = call i64 @fwrite(i8* %79, i32 1, i64 %81, i32* %82)
store i64 %83, i64* %7
%84 = load i64, i64* %7
%85 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%86 = call i64 @strlen(i8* %85)
%87 = icmp ne i64 %84, %86
br i1 %87, label %88, label %92
88: ; preds = %62
%89 = load i32*, i32** %10
%90 = call i64 @fclose(i32* %89)
%91 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 5, i32* %3
br label %123
92: ; preds = %62
br label %93
93: ; preds = %92
%94 = load i32, i32* %6
%95 = add nsw i32 %94, 3
store i32 %95, i32* %6
br label %59
96: ; preds = %59
%97 = load i32*, i32** %10
%98 = load i32, i32* @SEEK_CUR
%99 = call i64 @fseek(i32* %97, i32 -3, i32 %98)
%100 = icmp ne i64 %99, 0
br i1 %100, label %101, label %105
101: ; preds = %96
%102 = load i32*, i32** %10
%103 = call i64 @fclose(i32* %102)
%104 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 6, i32* %3
br label %123
105: ; preds = %96
%106 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%107 = load i32*, i32** %10
%108 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 1, i64 %106, i32* %107)
store i64 %108, i64* %7
%109 = load i64, i64* %7
%110 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%111 = icmp ne i64 %109, %110
br i1 %111, label %112, label %116
112: ; preds = %105
%113 = load i32*, i32** %10
%114 = call i64 @fclose(i32* %113)
%115 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 5, i32* %3
br label %123
116: ; preds = %105
%117 = load i32*, i32** %10
%118 = call i64 @fclose(i32* %117)
%119 = icmp ne i64 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %116
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %122
122: ; preds = %120, %116
store i32 0, i32* %3
br label %123
123: ; preds = %122, %112, %101, %88, %54, %45, %31, %21, %14
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
@.str = [12 x i8] c"gamepal.obj\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [45 x i8] c"[Error]: Could not open file '%s' for read!\0A\00"
@SEEK_SET = global i32 0
@.str.4 = [34 x i8] c"[Error]: Read error on file '%s'\0A\00"
@.str.6 = [11 x i8] c"wolf_pal.c\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [44 x i8] c"[Error]: Could not create output file '%s'\0A\00"
@.str.9 = [22 x i8] c"\0Achar gamepal[ ] = {\0A\00"
@.str.10 = [46 x i8] c"[Error]: Could not write to output file: '%s'\00"
@.str.11 = [14 x i8] c"\09%d, %d, %d,\0A\00"
@SEEK_CUR = global i32 0
@.str.12 = [50 x i8] c"[Error]: Could not seek back on output file '%s'\0A\00"
@.str.13 = [5 x i8] c"\0A};\0A\00"
@str.14 = [39 x i8] c"[Error]: The filestream was not closed\00"
@str.15 = [42 x i8] c"[Error]: Could not seek past header data!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = alloca [768 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [768 x i8], [768 x i8]* %4, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %77
11: ; preds = %2
%12 = load i32, i32* @SEEK_SET
%13 = tail call i64 @fseek(i32* %7, i32 119, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = tail call i64 @fclose(i32* %7)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.15, i64 0, i64 0))
br label %77
18: ; preds = %11
%19 = call i64 @fread(i8* %6, i32 1, i32 768, i32* %7)
%20 = icmp eq i64 %19, 768
%21 = tail call i64 @fclose(i32* %7)
br i1 %20, label %24, label %22
22: ; preds = %18
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %77
24: ; preds = %18
%25 = icmp eq i64 %21, 0
br i1 %25, label %28, label %26
26: ; preds = %24
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.14, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
%29 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, 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 %31, label %33
31: ; preds = %28
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %77
33: ; preds = %28
%34 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 1, i64 21, i32* %29)
%35 = icmp eq i64 %34, 21
br i1 %35, label %42, label %36
36: ; preds = %33
%37 = tail call i64 @fclose(i32* %29)
%38 = tail call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %77
39: ; preds = %42
%40 = add nuw nsw i64 %43, 3
%41 = icmp ult i64 %43, 765
br i1 %41, label %42, label %60
42: ; preds = %33, %39
%43 = phi i64 [ %40, %39 ], [ 0, %33 ]
%44 = getelementptr inbounds [768 x i8], [768 x i8]* %4, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = add nuw nsw i64 %43, 1
%47 = getelementptr inbounds [768 x i8], [768 x i8]* %4, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = add nuw nsw i64 %43, 2
%50 = getelementptr inbounds [768 x i8], [768 x i8]* %4, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = call i32 @snprintf(i8* %5, i32 128, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8 zeroext %45, i8 zeroext %48, i8 zeroext %51)
%53 = call i64 @strlen(i8* %5)
%54 = call i64 @fwrite(i8* %5, i32 1, i64 %53, i32* %29)
%55 = call i64 @strlen(i8* %5)
%56 = icmp eq i64 %54, %55
br i1 %56, label %39, label %57
57: ; preds = %42
%58 = call i64 @fclose(i32* %29)
%59 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %77
60: ; preds = %39
%61 = load i32, i32* @SEEK_CUR
%62 = call i64 @fseek(i32* %29, i32 -3, i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %67, label %64
64: ; preds = %60
%65 = call i64 @fclose(i32* %29)
%66 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %77
67: ; preds = %60
%68 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 1, i64 4, i32* %29)
%69 = icmp eq i64 %68, 4
%70 = call i64 @fclose(i32* %29)
br i1 %69, label %73, label %71
71: ; preds = %67
%72 = call i32 @PrintErrorDestroyFile(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %77
73: ; preds = %67
%74 = icmp eq i64 %70, 0
br i1 %74, label %77, label %75
75: ; preds = %73
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.14, i64 0, i64 0))
br label %77
77: ; preds = %73, %75, %71, %64, %57, %36, %31, %22, %15, %9
%78 = phi i32 [ 1, %9 ], [ 2, %15 ], [ 3, %22 ], [ 4, %31 ], [ 5, %36 ], [ 5, %57 ], [ 6, %64 ], [ 5, %71 ], [ 0, %75 ], [ 0, %73 ]
ret i32 %78
}