#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 EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void *fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int writeS19(char *srcFileName, int startAddress, int max) {
  char *tgtFileName;
  FILE *fps, *fpt;
  int i;
  unsigned int count;
  int byte;
  int checkSum;
  fps = fopen(srcFileName, "r");
  if (!fps) {
    fprintf(stderr, "Unable to open %s\n", srcFileName);
    return 0;
  }
  tgtFileName = malloc(strlen(srcFileName) + 5);
  strcpy(tgtFileName, srcFileName);
  i = strlen(tgtFileName) - 1;
  while (i) {
    if (tgtFileName[i] == '.') {
      tgtFileName[i] = '\0';
      strcat(tgtFileName, ".s19");
      break;
    }
    i--;
  }
  fpt = fopen(tgtFileName, "w");
  if (!fpt) {
    fclose(fps);
    fprintf(stderr, "Unable to open %s\n", tgtFileName);
    free(tgtFileName);
    tgtFileName = NULL;
    return 0;
  }
  i = 0;
  checkSum = 0;
  count = 0;
  while ((byte = fgetc(fps)) != EOF) {
    if (!count) {
      if (byte != 0x02) {
        free(tgtFileName);
        fclose(fps);
        fclose(fpt);
        return 1;
      }
      fgetc(fps);
      fgetc(fps);
      count = fgetc(fps);
      byte = fgetc(fps);
    }
    checkSum += byte;
    if (!(i % max))
      fprintf(fpt, "S1%02X%04X", max + 3, startAddress + i);
    fprintf(fpt, "%02X", byte);
    i++;
    count--;
    if (!(i % max)) {
      fprintf(fpt, "%02X\n", checkSum & 0xFF);
      checkSum = 0;
    }
  }
  fclose(fps);
  fclose(fpt);
  return 1;
}


x86 assembly (clang, -O0):
<writeS19>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11e9 <writeS19+0x59>
mov    0x2e10(%rip),%rax
movslq (%rax),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    140e <writeS19+0x27e>
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
add    $0x5,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     126a <writeS19+0xda>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    125c <writeS19+0xcc>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   10b0 <strcat@plt>
jmp    126a <writeS19+0xda>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    121c <writeS19+0x8c>
mov    -0x20(%rbp),%rdi
lea    0xda5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12cb <writeS19+0x13b>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2d3f(%rip),%rax
movslq (%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd5b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    140e <writeS19+0x27e>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2cf5(%rip),%rcx
cmp    (%rcx),%eax
je     13f5 <writeS19+0x265>
cmpl   $0x0,-0x38(%rbp)
jne    1360 <writeS19+0x1d0>
cmpl   $0x2,-0x3c(%rbp)
je     1336 <writeS19+0x1a6>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    140e <writeS19+0x27e>
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    -0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
jne    1397 <writeS19+0x207>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%edx
add    $0x3,%edx
mov    -0x14(%rbp),%ecx
add    -0x34(%rbp),%ecx
lea    0xc8c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%edx
lea    0xc82(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
jne    13f0 <writeS19+0x260>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%edx
and    $0xff,%edx
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x40(%rbp)
jmp    12e0 <writeS19+0x150>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeS19>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,%r14d
mov    %rsi,0x30(%rsp)
mov    %rdi,%rbp
lea    0xe50(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1363 <writeS19+0x1d3>
mov    %rbp,%rdi
call   1060 <strlen@plt>
lea    0x5(%rax),%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdx
mov    %r15,%rax
add    %rdx,%rax
mov    $0x1,%ecx
sub    %edx,%ecx
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
cmp    %edx,%ecx
je     1225 <writeS19+0x95>
lea    -0x1(%rdx),%rsi
cmpb   $0x2e,-0x1(%rax,%rdx,1)
mov    %rsi,%rdx
jne    1200 <writeS19+0x70>
movb   $0x0,(%rsi,%rax,1)
lea    0xdf8(%rip),%rsi
mov    %r15,%rdi
call   10b0 <strcat@plt>
lea    0xdee(%rip),%rsi
mov    %r15,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1382 <writeS19+0x1f2>
mov    %rax,0x10(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x20(%rsp)
mov    0x8(%rsp),%rdi
call   1070 <fgetc@plt>
mov    %rax,%r12
mov    0x2d88(%rip),%rax
cmp    %r12d,(%rax)
je     13bd <writeS19+0x22d>
mov    0x20(%rsp),%rax
add    $0x3,%eax
mov    %eax,0x1c(%rsp)
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %ebp,%ebp
mov    0x20(%rsp),%r13
jmp    12b1 <writeS19+0x121>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%r15d
mov    0x8(%rsp),%rdi
call   1070 <fgetc@plt>
mov    %rax,%r12
mov    0x2d40(%rip),%rax
cmp    %r12d,(%rax)
je     13bd <writeS19+0x22d>
test   %r15d,%r15d
jne    12eb <writeS19+0x15b>
cmp    $0x2,%r12d
jne    13b3 <writeS19+0x223>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %rax,%r12
mov    %ebp,%eax
cltd
idiv   %r13d
test   %edx,%edx
mov    0x10(%rsp),%rbx
jne    131e <writeS19+0x18e>
mov    0x30(%rsp),%rax
lea    (%rax,%rbp,1),%ecx
mov    0x10(%rsp),%rdi
lea    0xd0e(%rip),%rsi
mov    0x1c(%rsp),%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%rbx
add    %r12d,%r14d
mov    %rbx,%rdi
lea    0xcfc(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%ebp
mov    %ebp,%eax
cltd
idiv   %r13d
test   %edx,%edx
jne    1290 <writeS19+0x100>
movzbl %r14b,%edx
xor    %r14d,%r14d
mov    %rbx,%rdi
lea    0xcd5(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    1290 <writeS19+0x100>
mov    0x2c6e(%rip),%rax
movslq (%rax),%rdi
lea    0xc8e(%rip),%rsi
xor    %ebx,%ebx
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    13d6 <writeS19+0x246>
mov    0x8(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x2c45(%rip),%rax
movslq (%rax),%rdi
lea    0xc65(%rip),%rsi
xor    %ebx,%ebx
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    13d6 <writeS19+0x246>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"Unable to open %s\0A\00"
@.str.2 = [5 x i8] c".s19\00"
@.str.3 = [2 x i8] c"w\00"
@EOF = global i32 0
@.str.4 = [11 x i8] c"S1%02X%04X\00"
@.str.5 = [5 x i8] c"%02X\00"
@.str.6 = [6 x i8] c"%02X\0A\00"
define i32 @writeS19(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%15 = load i8*, i8** %5
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %9
%17 = load i32*, i32** %9
%18 = icmp ne i32* %17, null
br i1 %18, label %25, label %19
19: ; preds = %3
%20 = load i32, i32* @stderr
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load i8*, i8** %5
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %23)
store i32 0, i32* %4
br label %142
25: ; preds = %3
%26 = load i8*, i8** %5
%27 = call i32 @strlen(i8* %26)
%28 = add nsw i32 %27, 5
%29 = call i8* @malloc(i32 %28)
store i8* %29, i8** %8
%30 = load i8*, i8** %8
%31 = load i8*, i8** %5
%32 = call i32 @strcpy(i8* %30, i8* %31)
%33 = load i8*, i8** %8
%34 = call i32 @strlen(i8* %33)
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %11
br label %36
36: ; preds = %54, %25
%37 = load i32, i32* %11
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %57
39: ; preds = %36
%40 = load i8*, i8** %8
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 46
br i1 %46, label %47, label %54
47: ; preds = %39
%48 = load i8*, i8** %8
%49 = load i32, i32* %11
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8 0, i8* %51
%52 = load i8*, i8** %8
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %57
54: ; preds = %39
%55 = load i32, i32* %11
%56 = add nsw i32 %55, -1
store i32 %56, i32* %11
br label %36
57: ; preds = %47, %36
%58 = load i8*, i8** %8
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %59, i32** %10
%60 = load i32*, i32** %10
%61 = icmp ne i32* %60, null
br i1 %61, label %72, label %62
62: ; preds = %57
%63 = load i32*, i32** %9
%64 = call i32 @fclose(i32* %63)
%65 = load i32, i32* @stderr
%66 = sext i32 %65 to i64
%67 = inttoptr i64 %66 to i32*
%68 = load i8*, i8** %8
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %68)
%70 = load i8*, i8** %8
%71 = call i32 @free(i8* %70)
store i8* null, i8** %8
store i32 0, i32* %4
br label %142
72: ; preds = %57
store i32 0, i32* %11
store i32 0, i32* %14
store i32 0, i32* %12
br label %73
73: ; preds = %136, %72
%74 = load i32*, i32** %9
%75 = call i8* @fgetc(i32* %74)
%76 = ptrtoint i8* %75 to i32
store i32 %76, i32* %13
%77 = load i32, i32* @EOF
%78 = icmp ne i32 %76, %77
br i1 %78, label %79, label %137
79: ; preds = %73
%80 = load i32, i32* %12
%81 = icmp ne i32 %80, 0
br i1 %81, label %103, label %82
82: ; preds = %79
%83 = load i32, i32* %13
%84 = icmp ne i32 %83, 2
br i1 %84, label %85, label %92
85: ; preds = %82
%86 = load i8*, i8** %8
%87 = call i32 @free(i8* %86)
%88 = load i32*, i32** %9
%89 = call i32 @fclose(i32* %88)
%90 = load i32*, i32** %10
%91 = call i32 @fclose(i32* %90)
store i32 1, i32* %4
br label %142
92: ; preds = %82
%93 = load i32*, i32** %9
%94 = call i8* @fgetc(i32* %93)
%95 = load i32*, i32** %9
%96 = call i8* @fgetc(i32* %95)
%97 = load i32*, i32** %9
%98 = call i8* @fgetc(i32* %97)
%99 = ptrtoint i8* %98 to i32
store i32 %99, i32* %12
%100 = load i32*, i32** %9
%101 = call i8* @fgetc(i32* %100)
%102 = ptrtoint i8* %101 to i32
store i32 %102, i32* %13
br label %103
103: ; preds = %92, %79
%104 = load i32, i32* %13
%105 = load i32, i32* %14
%106 = add nsw i32 %105, %104
store i32 %106, i32* %14
%107 = load i32, i32* %11
%108 = load i32, i32* %7
%109 = srem i32 %107, %108
%110 = icmp ne i32 %109, 0
br i1 %110, label %119, label %111
111: ; preds = %103
%112 = load i32*, i32** %10
%113 = load i32, i32* %7
%114 = add nsw i32 %113, 3
%115 = load i32, i32* %6
%116 = load i32, i32* %11
%117 = add nsw i32 %115, %116
%118 = call i32 (i32*, i8*, ...) @fprintf(i32* %112, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %114, i32 %117)
br label %119
119: ; preds = %111, %103
%120 = load i32*, i32** %10
%121 = load i32, i32* %13
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %120, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %121)
%123 = load i32, i32* %11
%124 = add nsw i32 %123, 1
store i32 %124, i32* %11
%125 = load i32, i32* %12
%126 = add i32 %125, -1
store i32 %126, i32* %12
%127 = load i32, i32* %11
%128 = load i32, i32* %7
%129 = srem i32 %127, %128
%130 = icmp ne i32 %129, 0
br i1 %130, label %136, label %131
131: ; preds = %119
%132 = load i32*, i32** %10
%133 = load i32, i32* %14
%134 = and i32 %133, 255
%135 = call i32 (i32*, i8*, ...) @fprintf(i32* %132, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %134)
store i32 0, i32* %14
br label %136
136: ; preds = %131, %119
br label %73
137: ; preds = %73
%138 = load i32*, i32** %9
%139 = call i32 @fclose(i32* %138)
%140 = load i32*, i32** %10
%141 = call i32 @fclose(i32* %140)
store i32 1, i32* %4
br label %142
142: ; preds = %137, %85, %62, %19
%143 = load i32, i32* %4
ret i32 %143
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [19 x i8] c"Unable to open %s\0A\00"
@.str.2 = [5 x i8] c".s19\00"
@.str.3 = [2 x i8] c"w\00"
@EOF = global i32 0
@.str.4 = [11 x i8] c"S1%02X%04X\00"
@.str.5 = [5 x i8] c"%02X\00"
@.str.6 = [6 x i8] c"%02X\0A\00"
define i32 @writeS19(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %97
11: ; preds = %3
%12 = tail call i32 @strlen(i8* %0)
%13 = add nsw i32 %12, 5
%14 = tail call i8* @malloc(i32 %13)
%15 = tail call i32 @strcpy(i8* %14, i8* %0)
%16 = tail call i32 @strlen(i8* %14)
%17 = sext i32 %16 to i64
br label %18
18: ; preds = %23, %11
%19 = phi i64 [ %20, %23 ], [ %17, %11 ]
%20 = add nsw i64 %19, -1
%21 = trunc i64 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %14, i64 %20
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 46
br i1 %26, label %27, label %18
27: ; preds = %23
%28 = getelementptr inbounds i8, i8* %14, i64 %20
store i8 0, i8* %28
%29 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %18, %27
%31 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %41, label %33
33: ; preds = %30
%34 = tail call i8* @fgetc(i32* %4)
%35 = ptrtoint i8* %34 to i64
%36 = trunc i64 %35 to i32
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %37, %36
br i1 %38, label %94, label %39
39: ; preds = %33
%40 = add nsw i32 %2, 3
br label %48
41: ; preds = %30
%42 = tail call i32 @fclose(i32* %4)
%43 = load i32, i32* @stderr
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to i32*
%46 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%47 = tail call i32 @free(i8* %14)
br label %97
48: ; preds = %39, %87
%49 = phi i32 [ %36, %39 ], [ %91, %87 ]
%50 = phi i32 [ 0, %39 ], [ %88, %87 ]
%51 = phi i32 [ 0, %39 ], [ %81, %87 ]
%52 = phi i32 [ 0, %39 ], [ %80, %87 ]
%53 = icmp eq i32 %51, 0
br i1 %53, label %54, label %69
54: ; preds = %48
%55 = icmp eq i32 %49, 2
br i1 %55, label %60, label %56
56: ; preds = %54
%57 = tail call i32 @free(i8* %14)
%58 = tail call i32 @fclose(i32* %4)
%59 = tail call i32 @fclose(i32* %31)
br label %97
60: ; preds = %54
%61 = tail call i8* @fgetc(i32* %4)
%62 = tail call i8* @fgetc(i32* %4)
%63 = tail call i8* @fgetc(i32* %4)
%64 = ptrtoint i8* %63 to i64
%65 = trunc i64 %64 to i32
%66 = tail call i8* @fgetc(i32* %4)
%67 = ptrtoint i8* %66 to i64
%68 = trunc i64 %67 to i32
br label %69
69: ; preds = %60, %48
%70 = phi i32 [ %51, %48 ], [ %65, %60 ]
%71 = phi i32 [ %49, %48 ], [ %68, %60 ]
%72 = add nsw i32 %71, %50
%73 = srem i32 %52, %2
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %69
%76 = add nsw i32 %52, %1
%77 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 %76)
br label %78
78: ; preds = %75, %69
%79 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %71)
%80 = add nuw nsw i32 %52, 1
%81 = add i32 %70, -1
%82 = srem i32 %80, %2
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %78
%85 = and i32 %72, 255
%86 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 %85)
br label %87
87: ; preds = %84, %78
%88 = phi i32 [ %72, %78 ], [ 0, %84 ]
%89 = tail call i8* @fgetc(i32* %4)
%90 = ptrtoint i8* %89 to i64
%91 = trunc i64 %90 to i32
%92 = load i32, i32* @EOF
%93 = icmp eq i32 %92, %91
br i1 %93, label %94, label %48
94: ; preds = %87, %33
%95 = tail call i32 @fclose(i32* %4)
%96 = tail call i32 @fclose(i32* %31)
br label %97
97: ; preds = %94, %56, %41, %6
%98 = phi i32 [ 1, %56 ], [ 1, %94 ], [ 0, %41 ], [ 0, %6 ]
ret i32 %98
}