#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned char *malloc(int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  unsigned char *buffer;
  FILE *file;
  int size;
  int i, checksum;
  printf("com2ws 1.0a (c) tomasz@slanina.pl\n");
  if (argc < 3) {
    printf(" usage: com2ws.exe file.com file.ws\n");
    return -1;
  }
  buffer = malloc(512 * 1024);
  memset(buffer, 0, 512 * 1024);
  file = fopen(argv[1], "rb");
  if (file) {
    fseek(file, 0, SEEK_END);
    size = ftell(file);
    fseek(file, 0, SEEK_SET);
    fread(&buffer[0x100], 1, size, file);
    fclose(file);
    for (checksum = i = 0; i < 512 * 1024 - 2; checksum += buffer[i], ++i)
      ;
    checksum &= 0xffff;
    buffer[512 * 1024 - 1] = checksum >> 8;
    buffer[512 * 1024 - 2] = checksum & 0xff;
    buffer[512 * 1024 - 4] = 4;
    buffer[512 * 1024 - 6] = 1;
    buffer[512 * 1024 - 16] = 0xea;
    buffer[512 * 1024 - 15] = 0x00;
    buffer[512 * 1024 - 14] = 0x01;
    buffer[512 * 1024 - 12] = 0x80;
    buffer[512 * 1024 - 9] = 0x1;
    file = fopen(argv[argc - 1], "wb");
    if (file) {
      fwrite(buffer, 1, 512 * 1024, file);
      fclose(file);
    }
  }
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jge    11e4 <main+0x44>
lea    0xe50(%rip),%rdi
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139d <main+0x1fd>
mov    $0x80000,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x80000,%edx
call   1070 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe37(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     138d <main+0x1ed>
mov    -0x20(%rbp),%rdi
mov    0x2db8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x18(%rbp),%rdi
add    $0x100,%rdi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x7fffe,-0x28(%rbp)
jge    12be <main+0x11e>
jmp    129e <main+0xfe>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    128c <main+0xec>
mov    -0x2c(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x7ffff(%rax)
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x7fffe(%rax)
mov    -0x18(%rbp),%rax
movb   $0x4,0x7fffc(%rax)
mov    -0x18(%rbp),%rax
movb   $0x1,0x7fffa(%rax)
mov    -0x18(%rbp),%rax
movb   $0xea,0x7fff0(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x7fff1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x1,0x7fff2(%rax)
mov    -0x18(%rbp),%rax
movb   $0x80,0x7fff4(%rax)
mov    -0x18(%rbp),%rax
movb   $0x1,0x7fff7(%rax)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcf7(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1388 <main+0x1e8>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x80000,%edx
call   10c0 <fwrite@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
jmp    138d <main+0x1ed>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r12d
lea    0xe4e(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x2,%r12d
jg     11da <main+0x3a>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%r15d
jmp    13bb <main+0x21b>
mov    $0x80000,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
xor    %r15d,%r15d
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x80000,%edx
call   1070 <memset@plt>
mov    0x8(%r14),%rdi
lea    0xdfc(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13b3 <main+0x213>
mov    %rax,%rbp
mov    0x2dcc(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbp,%rdi
call   1080 <ftell@plt>
mov    %eax,%r13d
mov    0x2d9e(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbx,%rdi
add    $0x100,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
pxor   %xmm0,%xmm0
mov    $0x14,%eax
pxor   %xmm2,%xmm2
pxor   %xmm1,%xmm1
nopl   0x0(%rax)
movd   -0x14(%rbx,%rax,1),%xmm4
movd   -0x10(%rbx,%rax,1),%xmm3
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
paddd  %xmm2,%xmm4
punpcklbw %xmm0,%xmm3
punpcklwd %xmm0,%xmm3
paddd  %xmm1,%xmm3
movd   -0xc(%rbx,%rax,1),%xmm5
movd   -0x8(%rbx,%rax,1),%xmm6
punpcklbw %xmm0,%xmm5
punpcklwd %xmm0,%xmm5
punpcklbw %xmm0,%xmm6
punpcklwd %xmm0,%xmm6
movd   -0x4(%rbx,%rax,1),%xmm2
movd   (%rbx,%rax,1),%xmm1
punpcklbw %xmm0,%xmm2
punpcklwd %xmm0,%xmm2
paddd  %xmm5,%xmm2
paddd  %xmm4,%xmm2
punpcklbw %xmm0,%xmm1
punpcklwd %xmm0,%xmm1
paddd  %xmm6,%xmm1
paddd  %xmm3,%xmm1
add    $0x18,%rax
cmp    $0x8000c,%rax
jne    1280 <main+0xe0>
paddd  %xmm2,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
movzbl 0x7fff8(%rbx),%ecx
add    %eax,%ecx
movzbl 0x7fff9(%rbx),%eax
add    %ecx,%eax
movzbl 0x7fffa(%rbx),%ecx
add    %eax,%ecx
movzbl 0x7fffb(%rbx),%eax
add    %ecx,%eax
movzbl 0x7fffc(%rbx),%ecx
add    %eax,%ecx
movzbl 0x7fffd(%rbx),%eax
add    %ecx,%eax
mov    %ax,0x7fffe(%rbx)
movb   $0x4,0x7fffc(%rbx)
movb   $0x1,0x7fffa(%rbx)
movw   $0xea,0x7fff0(%rbx)
movb   $0x1,0x7fff2(%rbx)
movb   $0x80,0x7fff4(%rbx)
movb   $0x1,0x7fff7(%rbx)
add    $0xffffffff,%r12d
mov    (%r14,%r12,8),%rdi
lea    0xc7a(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13b3 <main+0x213>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x80000,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"com2ws 1.0a (c) tomasz@slanina.pl\0A\00"
@.str.1 = [37 x i8] c" usage: com2ws.exe file.com file.ws\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [3 x i8] c"wb\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %103
16: ; preds = %2
%17 = call i8* @malloc(i32 524288)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = call i32 @memset(i8* %18, i32 0, i32 524288)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %23, i32** %7
%24 = load i32*, i32** %7
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %100
26: ; preds = %16
%27 = load i32*, i32** %7
%28 = load i32, i32* @SEEK_END
%29 = call i32 @fseek(i32* %27, i32 0, i32 %28)
%30 = load i32*, i32** %7
%31 = call i32 @ftell(i32* %30)
store i32 %31, i32* %8
%32 = load i32*, i32** %7
%33 = load i32, i32* @SEEK_SET
%34 = call i32 @fseek(i32* %32, i32 0, i32 %33)
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i64 256
%37 = load i32, i32* %8
%38 = load i32*, i32** %7
%39 = call i32 @fread(i8* %36, i32 1, i32 %37, i32* %38)
%40 = load i32*, i32** %7
%41 = call i32 @fclose(i32* %40)
store i32 0, i32* %9
store i32 0, i32* %10
br label %42
42: ; preds = %46, %26
%43 = load i32, i32* %9
%44 = icmp slt i32 %43, 524286
br i1 %44, label %45, label %57
45: ; preds = %42
br label %46
46: ; preds = %45
%47 = load i8*, i8** %6
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = load i32, i32* %10
%54 = add nsw i32 %53, %52
store i32 %54, i32* %10
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %42
57: ; preds = %42
%58 = load i32, i32* %10
%59 = and i32 %58, 65535
store i32 %59, i32* %10
%60 = load i32, i32* %10
%61 = ashr i32 %60, 8
%62 = trunc i32 %61 to i8
%63 = load i8*, i8** %6
%64 = getelementptr inbounds i8, i8* %63, i64 524287
store i8 %62, i8* %64
%65 = load i32, i32* %10
%66 = and i32 %65, 255
%67 = trunc i32 %66 to i8
%68 = load i8*, i8** %6
%69 = getelementptr inbounds i8, i8* %68, i64 524286
store i8 %67, i8* %69
%70 = load i8*, i8** %6
%71 = getelementptr inbounds i8, i8* %70, i64 524284
store i8 4, i8* %71
%72 = load i8*, i8** %6
%73 = getelementptr inbounds i8, i8* %72, i64 524282
store i8 1, i8* %73
%74 = load i8*, i8** %6
%75 = getelementptr inbounds i8, i8* %74, i64 524272
store i8 -22, i8* %75
%76 = load i8*, i8** %6
%77 = getelementptr inbounds i8, i8* %76, i64 524273
store i8 0, i8* %77
%78 = load i8*, i8** %6
%79 = getelementptr inbounds i8, i8* %78, i64 524274
store i8 1, i8* %79
%80 = load i8*, i8** %6
%81 = getelementptr inbounds i8, i8* %80, i64 524276
store i8 -128, i8* %81
%82 = load i8*, i8** %6
%83 = getelementptr inbounds i8, i8* %82, i64 524279
store i8 1, i8* %83
%84 = load i8**, i8*** %5
%85 = load i32, i32* %4
%86 = sub nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8*, i8** %84, i64 %87
%89 = load i8*, i8** %88
%90 = call i32* @fopen(i8* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %90, i32** %7
%91 = load i32*, i32** %7
%92 = icmp ne i32* %91, null
br i1 %92, label %93, label %99
93: ; preds = %57
%94 = load i8*, i8** %6
%95 = load i32*, i32** %7
%96 = call i32 @fwrite(i8* %94, i32 1, i32 524288, i32* %95)
%97 = load i32*, i32** %7
%98 = call i32 @fclose(i32* %97)
br label %99
99: ; preds = %93, %57
br label %100
100: ; preds = %99, %16
%101 = load i8*, i8** %6
%102 = call i32 @free(i8* %101)
store i32 0, i32* %3
br label %103
103: ; preds = %100, %14
%104 = load i32, i32* %3
ret i32 %104
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [3 x i8] c"wb\00"
@str = [34 x i8] c"com2ws 1.0a (c) tomasz@slanina.pl\00"
@str.4 = [36 x i8] c" usage: com2ws.exe file.com file.ws\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%4 = icmp slt i32 %0, 3
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.4, i64 0, i64 0))
br label %111
7: ; preds = %2
%8 = tail call dereferenceable_or_null(524288) i8* @malloc(i32 524288)
%9 = tail call i32 @memset(i8* %8, i32 0, i32 524288)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %109, label %14
14: ; preds = %7
%15 = load i32, i32* @SEEK_END
%16 = tail call i32 @fseek(i32* %12, i32 0, i32 %15)
%17 = tail call i32 @ftell(i32* %12)
%18 = load i32, i32* @SEEK_SET
%19 = tail call i32 @fseek(i32* %12, i32 0, i32 %18)
%20 = getelementptr inbounds i8, i8* %8, i64 256
%21 = tail call i32 @fread(i8* %20, i32 1, i32 %17, i32* %12)
%22 = tail call i32 @fclose(i32* %12)
br label %23
23: ; preds = %23, %14
%24 = phi i64 [ 0, %14 ], [ %59, %23 ]
%25 = phi <4 x i32> [ zeroinitializer, %14 ], [ %57, %23 ]
%26 = phi <4 x i32> [ zeroinitializer, %14 ], [ %58, %23 ]
%27 = getelementptr inbounds i8, i8* %8, i64 %24
%28 = bitcast i8* %27 to <4 x i8>*
%29 = load <4 x i8>, <4 x i8>* %28
%30 = getelementptr inbounds i8, i8* %27, i64 4
%31 = bitcast i8* %30 to <4 x i8>*
%32 = load <4 x i8>, <4 x i8>* %31
%33 = zext <4 x i8> %29 to <4 x i32>
%34 = zext <4 x i8> %32 to <4 x i32>
%35 = add <4 x i32> %25, %33
%36 = add <4 x i32> %26, %34
%37 = add nuw nsw i64 %24, 8
%38 = getelementptr inbounds i8, i8* %8, i64 %37
%39 = bitcast i8* %38 to <4 x i8>*
%40 = load <4 x i8>, <4 x i8>* %39
%41 = getelementptr inbounds i8, i8* %38, i64 4
%42 = bitcast i8* %41 to <4 x i8>*
%43 = load <4 x i8>, <4 x i8>* %42
%44 = zext <4 x i8> %40 to <4 x i32>
%45 = zext <4 x i8> %43 to <4 x i32>
%46 = add <4 x i32> %35, %44
%47 = add <4 x i32> %36, %45
%48 = add nuw nsw i64 %24, 16
%49 = getelementptr inbounds i8, i8* %8, i64 %48
%50 = bitcast i8* %49 to <4 x i8>*
%51 = load <4 x i8>, <4 x i8>* %50
%52 = getelementptr inbounds i8, i8* %49, i64 4
%53 = bitcast i8* %52 to <4 x i8>*
%54 = load <4 x i8>, <4 x i8>* %53
%55 = zext <4 x i8> %51 to <4 x i32>
%56 = zext <4 x i8> %54 to <4 x i32>
%57 = add <4 x i32> %46, %55
%58 = add <4 x i32> %47, %56
%59 = add nuw nsw i64 %24, 24
%60 = icmp eq i64 %59, 524280
br i1 %60, label %61, label %23
61: ; preds = %23
%62 = add <4 x i32> %58, %57
%63 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %62)
%64 = getelementptr inbounds i8, i8* %8, i64 524280
%65 = load i8, i8* %64
%66 = zext i8 %65 to i32
%67 = add nuw nsw i32 %63, %66
%68 = getelementptr inbounds i8, i8* %8, i64 524281
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = add nuw nsw i32 %67, %70
%72 = getelementptr inbounds i8, i8* %8, i64 524282
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = add nuw nsw i32 %71, %74
%76 = getelementptr inbounds i8, i8* %8, i64 524283
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = add nuw nsw i32 %75, %78
%80 = getelementptr inbounds i8, i8* %8, i64 524284
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = add nuw nsw i32 %79, %82
%84 = getelementptr inbounds i8, i8* %8, i64 524285
%85 = load i8, i8* %84
%86 = zext i8 %85 to i32
%87 = add nuw nsw i32 %83, %86
%88 = lshr i32 %87, 8
%89 = trunc i32 %88 to i8
%90 = getelementptr inbounds i8, i8* %8, i64 524287
store i8 %89, i8* %90
%91 = trunc i32 %87 to i8
%92 = getelementptr inbounds i8, i8* %8, i64 524286
store i8 %91, i8* %92
%93 = getelementptr inbounds i8, i8* %8, i64 524284
store i8 4, i8* %93
%94 = getelementptr inbounds i8, i8* %8, i64 524282
store i8 1, i8* %94
%95 = getelementptr inbounds i8, i8* %8, i64 524272
store i8 -22, i8* %95
%96 = getelementptr inbounds i8, i8* %8, i64 524273
store i8 0, i8* %96
%97 = getelementptr inbounds i8, i8* %8, i64 524274
store i8 1, i8* %97
%98 = getelementptr inbounds i8, i8* %8, i64 524276
store i8 -128, i8* %98
%99 = getelementptr inbounds i8, i8* %8, i64 524279
store i8 1, i8* %99
%100 = add nsw i32 %0, -1
%101 = zext i32 %100 to i64
%102 = getelementptr inbounds i8*, i8** %1, i64 %101
%103 = load i8*, i8** %102
%104 = tail call i32* @fopen(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%105 = icmp eq i32* %104, null
br i1 %105, label %109, label %106
106: ; preds = %61
%107 = tail call i32 @fwrite(i8* %8, i32 1, i32 524288, i32* %104)
%108 = tail call i32 @fclose(i32* %104)
br label %109
109: ; preds = %61, %106, %7
%110 = tail call i32 @free(i8* %8)
br label %111
111: ; preds = %109, %5
%112 = phi i32 [ -1, %5 ], [ 0, %109 ]
ret i32 %112
}