#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void main(int iArgC, char **cArgV) {
  FILE *fLMP;
  unsigned char cPalBuffer[768];
  FILE *fTGA;
  unsigned char cTGAOut[768 + 18];
  short iPalLoop, iTGALoop;
  printf("PAL2TGA V%s by Marco Hladik\n", "1.1");
  printf("============================\n\n");
  if (iArgC <= 1) {
    printf("[ERROR] No .LMP file specified.\n\n");
    printf("Usage: pal2tga input.lmp");
    return;
  }
  printf("Opening %s... ", cArgV[1]);
  fLMP = fopen(cArgV[1], "rb");
  if (!fLMP) {
    printf("[FAIL]\n[ERROR] Cannot find %s!\n", cArgV[1]);
    return;
  }
  printf("\nReading palette buffer...\n");
  fread(cPalBuffer, 1, 768, fLMP);
  fclose(fLMP);
  printf("Writing the header...\n");
  memset(cTGAOut, 0, 18);
  cTGAOut[2] = 2;
  cTGAOut[12] = 16;
  cTGAOut[14] = 16;
  cTGAOut[16] = 24;
  printf("Flipping buffer and sorting RGB > BGR... \n");
  for (iTGALoop = 15; iTGALoop >= 0; iTGALoop--) {
    for (iPalLoop = 0; iPalLoop < 16; iPalLoop++) {
      cTGAOut[18 + (iTGALoop * 48) + (iPalLoop * 3) + 0] =
          cPalBuffer[((15 - iTGALoop) * 48) + (iPalLoop * 3) + 2];
      cTGAOut[18 + (iTGALoop * 48) + (iPalLoop * 3) + 1] =
          cPalBuffer[((15 - iTGALoop) * 48) + (iPalLoop * 3) + 1];
      cTGAOut[18 + (iTGALoop * 48) + (iPalLoop * 3) + 2] =
          cPalBuffer[((15 - iTGALoop) * 48) + (iPalLoop * 3) + 0];
    }
  }
  printf("Saving output to output.tga... \n");
  fTGA = fopen("output.tga", "w+b");
  fwrite(cTGAOut, 1, 768 + 18, fTGA);
  fclose(fTGA);
  printf("Done. Palette conversion complete.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x650,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jg     11c0 <main+0x60>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    143e <main+0x2de>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea5(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1214 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    143e <main+0x2de>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x320(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x300,%edx
call   1030 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x640(%rbp),%rdi
xor    %esi,%esi
mov    $0x12,%edx
call   1060 <memset@plt>
movb   $0x2,-0x63e(%rbp)
movb   $0x10,-0x634(%rbp)
movb   $0x10,-0x632(%rbp)
movb   $0x18,-0x630(%rbp)
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movw   $0xf,-0x644(%rbp)
movswl -0x644(%rbp),%eax
cmp    $0x0,%eax
jl     13df <main+0x27f>
movw   $0x0,-0x642(%rbp)
movswl -0x642(%rbp),%eax
cmp    $0x10,%eax
jge    13c3 <main+0x263>
movswl -0x644(%rbp),%ecx
mov    $0xf,%eax
sub    %ecx,%eax
imul   $0x30,%eax,%eax
movswl -0x642(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    %ecx,%eax
add    $0x2,%eax
cltq
mov    -0x320(%rbp,%rax,1),%cl
movswl -0x644(%rbp),%eax
imul   $0x30,%eax,%eax
add    $0x12,%eax
movswl -0x642(%rbp),%edx
imul   $0x3,%edx,%edx
add    %edx,%eax
add    $0x0,%eax
cltq
mov    %cl,-0x640(%rbp,%rax,1)
movswl -0x644(%rbp),%ecx
mov    $0xf,%eax
sub    %ecx,%eax
imul   $0x30,%eax,%eax
movswl -0x642(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    %ecx,%eax
add    $0x1,%eax
cltq
mov    -0x320(%rbp,%rax,1),%cl
movswl -0x644(%rbp),%eax
imul   $0x30,%eax,%eax
add    $0x12,%eax
movswl -0x642(%rbp),%edx
imul   $0x3,%edx,%edx
add    %edx,%eax
add    $0x1,%eax
cltq
mov    %cl,-0x640(%rbp,%rax,1)
movswl -0x644(%rbp),%ecx
mov    $0xf,%eax
sub    %ecx,%eax
imul   $0x30,%eax,%eax
movswl -0x642(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    %ecx,%eax
add    $0x0,%eax
cltq
mov    -0x320(%rbp,%rax,1),%cl
movswl -0x644(%rbp),%eax
imul   $0x30,%eax,%eax
add    $0x12,%eax
movswl -0x642(%rbp),%edx
imul   $0x3,%edx,%edx
add    %edx,%eax
add    $0x2,%eax
cltq
mov    %cl,-0x640(%rbp,%rax,1)
mov    -0x642(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x642(%rbp)
jmp    12b2 <main+0x152>
jmp    13c8 <main+0x268>
mov    -0x644(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x644(%rbp)
jmp    1299 <main+0x139>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd38(%rip),%rdi
lea    0xd3c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x328(%rbp)
lea    -0x640(%rbp),%rdi
mov    -0x328(%rbp),%rcx
mov    $0x1,%esi
mov    $0x312,%edx
call   1080 <fwrite@plt>
mov    -0x328(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x650,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x628,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xe7a(%rip),%rdi
lea    0xe90(%rip),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x1,%ebx
jg     11c9 <main+0x59>
lea    0xf8b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
add    $0x628,%rsp
pop    %rbx
pop    %r14
jmp    1060 <printf@plt>
mov    0x8(%r14),%rsi
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r14),%rdi
lea    0xe63(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     131a <main+0x1aa>
mov    %rax,%rbx
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0x320(%rsp),%rdi
mov    $0x1,%esi
mov    $0x300,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x12,%edx
call   1070 <memset@plt>
movb   $0x2,0x2(%rsp)
movb   $0x10,0xc(%rsp)
movb   $0x10,0xe(%rsp)
movb   $0x18,0x10(%rsp)
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0x2e4(%rsp),%rax
lea    0x322(%rsp),%rcx
mov    $0xf,%edx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rcx,%rsi,1),%ebx
mov    %bl,-0x2(%rax,%rsi,1)
movzbl -0x1(%rcx,%rsi,1),%ebx
mov    %bl,-0x1(%rax,%rsi,1)
movzbl -0x2(%rcx,%rsi,1),%ebx
mov    %bl,(%rax,%rsi,1)
add    $0x3,%rsi
cmp    $0x30,%rsi
jne    1290 <main+0x120>
lea    -0x1(%rdx),%esi
add    $0xffffffffffffffd0,%rax
add    $0x30,%rcx
test   %edx,%edx
mov    %esi,%edx
jg     1280 <main+0x110>
lea    0xe29(%rip),%rdi
call   1030 <puts@plt>
lea    0xd95(%rip),%rdi
lea    0xd99(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x312,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
add    $0x628,%rsp
pop    %rbx
pop    %r14
ret
mov    0x8(%r14),%rsi
lea    0xd27(%rip),%rdi
xor    %eax,%eax
add    $0x628,%rsp
pop    %rbx
pop    %r14
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"PAL2TGA V%s by Marco Hladik\0A\00"
@.str.1 = [4 x i8] c"1.1\00"
@.str.2 = [31 x i8] c"============================\0A\0A\00"
@.str.3 = [34 x i8] c"[ERROR] No .LMP file specified.\0A\0A\00"
@.str.4 = [25 x i8] c"Usage: pal2tga input.lmp\00"
@.str.5 = [15 x i8] c"Opening %s... \00"
@.str.6 = [3 x i8] c"rb\00"
@.str.7 = [32 x i8] c"[FAIL]\0A[ERROR] Cannot find %s!\0A\00"
@.str.8 = [28 x i8] c"\0AReading palette buffer...\0A\00"
@.str.9 = [23 x i8] c"Writing the header...\0A\00"
@.str.10 = [43 x i8] c"Flipping buffer and sorting RGB > BGR... \0A\00"
@.str.11 = [33 x i8] c"Saving output to output.tga... \0A\00"
@.str.12 = [11 x i8] c"output.tga\00"
@.str.13 = [4 x i8] c"w+b\00"
@.str.14 = [36 x i8] c"Done. Palette conversion complete.\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca [768 x i8]
%7 = alloca i32*
%8 = alloca [786 x i8]
%9 = alloca i16
%10 = alloca i16
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %144
18: ; preds = %2
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %26, i32** %5
%27 = load i32*, i32** %5
%28 = icmp ne i32* %27, null
br i1 %28, label %34, label %29
29: ; preds = %18
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %32)
br label %144
34: ; preds = %18
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%36 = getelementptr inbounds [768 x i8], [768 x i8]* %6, i64 0, i64 0
%37 = load i32*, i32** %5
%38 = call i32 @fread(i8* %36, i32 1, i32 768, i32* %37)
%39 = load i32*, i32** %5
%40 = call i32 @fclose(i32* %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%42 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 0
%43 = call i32 @memset(i8* %42, i32 0, i32 18)
%44 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 2
store i8 2, i8* %44
%45 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 12
store i8 16, i8* %45
%46 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 14
store i8 16, i8* %46
%47 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 16
store i8 24, i8* %47
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0))
store i16 15, i16* %10
br label %49
49: ; preds = %132, %34
%50 = load i16, i16* %10
%51 = sext i16 %50 to i32
%52 = icmp sge i32 %51, 0
br i1 %52, label %53, label %135
53: ; preds = %49
store i16 0, i16* %9
br label %54
54: ; preds = %128, %53
%55 = load i16, i16* %9
%56 = sext i16 %55 to i32
%57 = icmp slt i32 %56, 16
br i1 %57, label %58, label %131
58: ; preds = %54
%59 = load i16, i16* %10
%60 = sext i16 %59 to i32
%61 = sub nsw i32 15, %60
%62 = mul nsw i32 %61, 48
%63 = load i16, i16* %9
%64 = sext i16 %63 to i32
%65 = mul nsw i32 %64, 3
%66 = add nsw i32 %62, %65
%67 = add nsw i32 %66, 2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [768 x i8], [768 x i8]* %6, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = load i16, i16* %10
%72 = sext i16 %71 to i32
%73 = mul nsw i32 %72, 48
%74 = add nsw i32 18, %73
%75 = load i16, i16* %9
%76 = sext i16 %75 to i32
%77 = mul nsw i32 %76, 3
%78 = add nsw i32 %74, %77
%79 = add nsw i32 %78, 0
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 %80
store i8 %70, i8* %81
%82 = load i16, i16* %10
%83 = sext i16 %82 to i32
%84 = sub nsw i32 15, %83
%85 = mul nsw i32 %84, 48
%86 = load i16, i16* %9
%87 = sext i16 %86 to i32
%88 = mul nsw i32 %87, 3
%89 = add nsw i32 %85, %88
%90 = add nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [768 x i8], [768 x i8]* %6, i64 0, i64 %91
%93 = load i8, i8* %92
%94 = load i16, i16* %10
%95 = sext i16 %94 to i32
%96 = mul nsw i32 %95, 48
%97 = add nsw i32 18, %96
%98 = load i16, i16* %9
%99 = sext i16 %98 to i32
%100 = mul nsw i32 %99, 3
%101 = add nsw i32 %97, %100
%102 = add nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 %103
store i8 %93, i8* %104
%105 = load i16, i16* %10
%106 = sext i16 %105 to i32
%107 = sub nsw i32 15, %106
%108 = mul nsw i32 %107, 48
%109 = load i16, i16* %9
%110 = sext i16 %109 to i32
%111 = mul nsw i32 %110, 3
%112 = add nsw i32 %108, %111
%113 = add nsw i32 %112, 0
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [768 x i8], [768 x i8]* %6, i64 0, i64 %114
%116 = load i8, i8* %115
%117 = load i16, i16* %10
%118 = sext i16 %117 to i32
%119 = mul nsw i32 %118, 48
%120 = add nsw i32 18, %119
%121 = load i16, i16* %9
%122 = sext i16 %121 to i32
%123 = mul nsw i32 %122, 3
%124 = add nsw i32 %120, %123
%125 = add nsw i32 %124, 2
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 %126
store i8 %116, i8* %127
br label %128
128: ; preds = %58
%129 = load i16, i16* %9
%130 = add i16 %129, 1
store i16 %130, i16* %9
br label %54
131: ; preds = %54
br label %132
132: ; preds = %131
%133 = load i16, i16* %10
%134 = add i16 %133, -1
store i16 %134, i16* %10
br label %49
135: ; preds = %49
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
%137 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
store i32* %137, i32** %7
%138 = getelementptr inbounds [786 x i8], [786 x i8]* %8, i64 0, i64 0
%139 = load i32*, i32** %7
%140 = call i32 @fwrite(i8* %138, i32 1, i32 786, i32* %139)
%141 = load i32*, i32** %7
%142 = call i32 @fclose(i32* %141)
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0))
br label %144
144: ; preds = %135, %29, %15
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"PAL2TGA V%s by Marco Hladik\0A\00"
@.str.1 = [4 x i8] c"1.1\00"
@.str.4 = [25 x i8] c"Usage: pal2tga input.lmp\00"
@.str.5 = [15 x i8] c"Opening %s... \00"
@.str.6 = [3 x i8] c"rb\00"
@.str.7 = [32 x i8] c"[FAIL]\0A[ERROR] Cannot find %s!\0A\00"
@.str.12 = [11 x i8] c"output.tga\00"
@.str.13 = [4 x i8] c"w+b\00"
@str = [30 x i8] c"============================\0A\00"
@str.15 = [27 x i8] c"\0AReading palette buffer...\00"
@str.16 = [22 x i8] c"Writing the header...\00"
@str.17 = [42 x i8] c"Flipping buffer and sorting RGB > BGR... \00"
@str.18 = [32 x i8] c"Saving output to output.tga... \00"
@str.19 = [35 x i8] c"Done. Palette conversion complete.\00"
@str.20 = [33 x i8] c"[ERROR] No .LMP file specified.\0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca [768 x i8]
%4 = alloca [786 x i8]
%5 = getelementptr inbounds [768 x i8], [768 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.20, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %71
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %14
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = load i8*, i8** %14
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %21)
br label %71
23: ; preds = %13
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.15, i64 0, i64 0))
%25 = call i32 @fread(i8* %5, i32 1, i32 768, i32* %18)
%26 = tail call i32 @fclose(i32* %18)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.16, i64 0, i64 0))
%28 = call i32 @memset(i8* %6, i32 0, i32 18)
%29 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 2
store i8 2, i8* %29
%30 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 12
store i8 16, i8* %30
%31 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 14
store i8 16, i8* %31
%32 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 16
store i8 24, i8* %32
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.17, i64 0, i64 0))
br label %34
34: ; preds = %23, %61
%35 = phi i32 [ 15, %23 ], [ %62, %61 ]
%36 = phi i64 [ 15, %23 ], [ %64, %61 ]
%37 = sub nuw nsw i64 15, %36
%38 = mul nuw nsw i64 %37, 48
%39 = mul nuw nsw i64 %36, 48
%40 = add nuw nsw i64 %39, 18
br label %41
41: ; preds = %34, %41
%42 = phi i64 [ 0, %34 ], [ %59, %41 ]
%43 = mul nuw nsw i64 %42, 3
%44 = add nuw nsw i64 %43, %38
%45 = add nuw nsw i64 %44, 2
%46 = getelementptr inbounds [768 x i8], [768 x i8]* %3, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = add nuw nsw i64 %40, %43
%49 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 %48
store i8 %47, i8* %49
%50 = add nuw nsw i64 %44, 1
%51 = getelementptr inbounds [768 x i8], [768 x i8]* %3, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = add nuw nsw i64 %48, 1
%54 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 %53
store i8 %52, i8* %54
%55 = getelementptr inbounds [768 x i8], [768 x i8]* %3, i64 0, i64 %44
%56 = load i8, i8* %55
%57 = add nuw nsw i64 %48, 2
%58 = getelementptr inbounds [786 x i8], [786 x i8]* %4, i64 0, i64 %57
store i8 %56, i8* %58
%59 = add nuw nsw i64 %42, 1
%60 = icmp eq i64 %59, 16
br i1 %60, label %61, label %41
61: ; preds = %41
%62 = add nsw i32 %35, -1
%63 = icmp sgt i32 %35, 0
%64 = add nsw i64 %36, -1
br i1 %63, label %34, label %65
65: ; preds = %61
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.18, i64 0, i64 0))
%67 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%68 = call i32 @fwrite(i8* %6, i32 1, i32 786, i32* %67)
%69 = call i32 @fclose(i32* %67)
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.19, i64 0, i64 0))
br label %71
71: ; preds = %65, %20, %10
ret void
}