#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 */
scalar_t__ feof(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int ftell(int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(short);
short pow(int, int);
int /*<<< orphan*/ printf(char *, long, long, short, short);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int IPS_create(FILE *original, FILE *modified, FILE *patch, int use_rle) {
  if (!original || !modified || !patch)
    return -1;
  rewind(original);
  rewind(modified);
  rewind(patch);
  if (fwrite("PATCH", 5, 1, patch) != 1) {
    return -10;
  }
  char *buffer = (char *)malloc(pow(2, 16));
  long patch_offset = 0;
  short buffer_size = 0;
  int patch_count = 0;
  char c;
  while (!feof(modified) && !feof(original)) {
    while ((c = fgetc(modified)) == fgetc(original) && !feof(modified) &&
           !feof(original))
      ;
    if (feof(modified) || feof(original)) {
      continue;
    }
    patch_offset = ftell(modified) - 1;
    buffer[buffer_size++] = c;
    while ((c = fgetc(modified)) != fgetc(original)) {
      buffer[buffer_size++] = c;
      if (buffer_size > pow(2, 16)) {
        break;
      }
    }
    printf("Patch: Offset: %d (%08X), Length: %d(%04X)\n", patch_offset,
           patch_offset, buffer_size, buffer_size);
    char offset_value[3] = {(patch_offset & 0x00ff0000) >> 16,
                            (patch_offset & 0x0000ff00) >> 8,
                            (patch_offset & 0x000000ff)};
    char size_value[2] = {(buffer_size & 0xff00) >> 8, (buffer_size & 0x00ff)};
    fwrite(offset_value, 3, 1, patch);
    fwrite(size_value, 2, 1, patch);
    fwrite(buffer, buffer_size, 1, patch);
    buffer_size = 0;
    patch_count++;
  }
  free(buffer);
  if (fwrite("EOF", 3, 1, patch) != 1) {
    return -20;
  }
  return patch_count;
}


x86 assembly (clang, -O0):
<IPS_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11c8 <IPS_create+0x38>
cmpq   $0x0,-0x18(%rbp)
je     11c8 <IPS_create+0x38>
cmpq   $0x0,-0x20(%rbp)
jne    11d4 <IPS_create+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d9 <IPS_create+0x349>
mov    -0x10(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x18(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x20(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x20(%rbp),%rcx
lea    0xe06(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     121e <IPS_create+0x8e>
movl   $0xfffffff6,-0x4(%rbp)
jmp    14d9 <IPS_create+0x349>
mov    $0x2,%edi
mov    $0x10,%esi
call   10a0 <pow@plt>
movswl %ax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movw   $0x0,-0x3a(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x47(%rbp)
jne    127e <IPS_create+0xee>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x47(%rbp)
mov    -0x47(%rbp),%al
test   $0x1,%al
jne    128e <IPS_create+0xfe>
jmp    149b <IPS_create+0x30b>
jmp    1293 <IPS_create+0x103>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x41(%rbp)
movsbl %al,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fgetc@plt>
mov    -0x4c(%rbp),%ecx
movsbl %al,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x48(%rbp)
jne    12f1 <IPS_create+0x161>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x48(%rbp)
jne    12f1 <IPS_create+0x161>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x48(%rbp)
mov    -0x48(%rbp),%al
test   $0x1,%al
jne    1301 <IPS_create+0x171>
jmp    1306 <IPS_create+0x176>
jmp    1293 <IPS_create+0x103>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
jne    132c <IPS_create+0x19c>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%rax
je     1331 <IPS_create+0x1a1>
jmp    124e <IPS_create+0xbe>
mov    -0x18(%rbp),%rdi
call   1070 <ftell@plt>
sub    $0x1,%eax
cltq
mov    %rax,-0x38(%rbp)
mov    -0x41(%rbp),%dl
mov    -0x30(%rbp),%rax
mov    -0x3a(%rbp),%cx
mov    %cx,%si
add    $0x1,%si
mov    %si,-0x3a(%rbp)
movswq %cx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x41(%rbp)
movsbl %al,%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,%cl
mov    -0x50(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
je     13d9 <IPS_create+0x249>
mov    -0x41(%rbp),%dl
mov    -0x30(%rbp),%rax
mov    -0x3a(%rbp),%cx
mov    %cx,%si
add    $0x1,%si
mov    %si,-0x3a(%rbp)
movswq %cx,%rcx
mov    %dl,(%rax,%rcx,1)
movswl -0x3a(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    $0x2,%edi
mov    $0x10,%esi
call   10a0 <pow@plt>
mov    %ax,%cx
mov    -0x54(%rbp),%eax
movswl %cx,%ecx
cmp    %ecx,%eax
jle    13d4 <IPS_create+0x244>
jmp    13d9 <IPS_create+0x249>
jmp    1360 <IPS_create+0x1d0>
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x3a(%rbp),%ax
lea    0xc1a(%rip),%rdi
movswl %ax,%ecx
movswl -0x3a(%rbp),%r8d
call   1040 <printf@plt>
mov    -0x38(%rbp),%rax
and    $0xff0000,%rax
sar    $0x10,%rax
mov    %al,-0x44(%rbp)
mov    -0x38(%rbp),%rax
and    $0xff00,%rax
sar    $0x8,%rax
mov    %al,-0x43(%rbp)
mov    -0x38(%rbp),%rax
and    $0xff,%rax
mov    %al,-0x42(%rbp)
movswl -0x3a(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0x46(%rbp)
movswl -0x3a(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x45(%rbp)
lea    -0x44(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x3,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
lea    -0x46(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    -0x30(%rbp),%rdi
movswl -0x3a(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
call   10b0 <fwrite@plt>
movw   $0x0,-0x3a(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    124e <IPS_create+0xbe>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rcx
lea    0xb83(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     14d3 <IPS_create+0x343>
movl   $0xffffffec,-0x4(%rbp)
jmp    14d9 <IPS_create+0x349>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IPS_create>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1258 <IPS_create+0xc8>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1258 <IPS_create+0xc8>
mov    %rdx,%r14
test   %rdx,%rdx
je     1258 <IPS_create+0xc8>
mov    %rdi,%r15
call   1050 <rewind@plt>
mov    %rbx,%rdi
call   1050 <rewind@plt>
mov    %r14,%rdi
call   1050 <rewind@plt>
lea    0xe1d(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %eax,%ecx
mov    $0xfffffff6,%eax
cmp    $0x1,%ecx
jne    1258 <IPS_create+0xc8>
mov    $0x2,%edi
mov    $0x10,%esi
call   10a0 <pow@plt>
movswl %ax,%edi
call   1090 <malloc@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1080 <feof@plt>
xor    %r12d,%r12d
test   %rax,%rax
je     1267 <IPS_create+0xd7>
mov    %r13,%rdi
call   1030 <free@plt>
lea    0xdf8(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
mov    $0xffffffec,%eax
cmove  %r12d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r12d,%r12d
jmp    1311 <IPS_create+0x181>
mov    %r13d,%r12d
movswl %r12w,%ebp
lea    0xd89(%rip),%rdi
mov    0x20(%rsp),%rdx
mov    %rdx,%rsi
mov    %rdx,%r12
mov    %ebp,%ecx
mov    %ebp,%r8d
call   1040 <printf@plt>
mov    %r12,%rcx
mov    %ecx,%eax
shr    $0x10,%eax
mov    %al,0xf(%rsp)
mov    %ch,0x10(%rsp)
mov    %cl,0x11(%rsp)
mov    %ebp,%eax
rol    $0x8,%ax
mov    %ax,0x12(%rsp)
lea    0xf(%rsp),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
lea    0x12(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    0x18(%rsp),%r13
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    0x14(%rsp),%r12d
add    $0x1,%r12d
nop
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    122b <IPS_create+0x9b>
mov    %r15,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    122b <IPS_create+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <fgetc@plt>
cmp    %al,%bpl
jne    1361 <IPS_create+0x1d1>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1361 <IPS_create+0x1d1>
mov    %r15,%rdi
call   1080 <feof@plt>
test   %rax,%rax
je     1330 <IPS_create+0x1a0>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1300 <IPS_create+0x170>
mov    %r15,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1300 <IPS_create+0x170>
mov    %r12d,0x14(%rsp)
mov    %rbx,%rdi
call   1070 <ftell@plt>
add    $0xffffffff,%eax
cltq
mov    %rax,0x20(%rsp)
mov    %r13,0x18(%rsp)
mov    %bpl,0x0(%r13)
mov    $0x1,%r13w
mov    %rbx,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <fgetc@plt>
cmp    %al,%bpl
je     126f <IPS_create+0xdf>
lea    0x1(%r13),%r12d
movswq %r13w,%rax
mov    0x18(%rsp),%rcx
mov    %bpl,(%rcx,%rax,1)
mov    $0x2,%edi
mov    $0x10,%esi
call   10a0 <pow@plt>
mov    %r12d,%r13d
cmp    %ax,%r12w
jle    13a0 <IPS_create+0x210>
jmp    1272 <IPS_create+0xe2>

LLVM IR (-O0):
@.str = [6 x i8] c"PATCH\00"
@.str.1 = [44 x i8] c"Patch: Offset: %d (%08X), Length: %d(%04X)\0A\00"
@.str.2 = [4 x i8] c"EOF\00"
define i32 @IPS_create(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i16
%13 = alloca i32
%14 = alloca i8
%15 = alloca [3 x i8]
%16 = alloca [2 x i8]
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %25
19: ; preds = %4
%20 = load i32*, i32** %7
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32*, i32** %8
%24 = icmp ne i32* %23, null
br i1 %24, label %26, label %25
25: ; preds = %22, %19, %4
store i32 -1, i32* %5
br label %168
26: ; preds = %22
%27 = load i32*, i32** %6
%28 = call i32 @rewind(i32* %27)
%29 = load i32*, i32** %7
%30 = call i32 @rewind(i32* %29)
%31 = load i32*, i32** %8
%32 = call i32 @rewind(i32* %31)
%33 = load i32*, i32** %8
%34 = call i32 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5, i32 1, i32* %33)
%35 = icmp ne i32 %34, 1
br i1 %35, label %36, label %37
36: ; preds = %26
store i32 -10, i32* %5
br label %168
37: ; preds = %26
%38 = call signext i16 @pow(i32 2, i32 16)
%39 = call i64 @malloc(i16 signext %38)
%40 = inttoptr i64 %39 to i8*
store i8* %40, i8** %10
store i64 0, i64* %11
store i16 0, i16* %12
store i32 0, i32* %13
br label %41
41: ; preds = %115, %81, %37
%42 = load i32*, i32** %7
%43 = call i64 @feof(i32* %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %41
%46 = load i32*, i32** %6
%47 = call i64 @feof(i32* %46)
%48 = icmp ne i64 %47, 0
%49 = xor i1 %48, true
br label %50
50: ; preds = %45, %41
%51 = phi i1 [ false, %41 ], [ %49, %45 ]
br i1 %51, label %52, label %159
52: ; preds = %50
br label %53
53: ; preds = %72, %52
%54 = load i32*, i32** %7
%55 = call signext i8 @fgetc(i32* %54)
store i8 %55, i8* %14
%56 = sext i8 %55 to i32
%57 = load i32*, i32** %6
%58 = call signext i8 @fgetc(i32* %57)
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %56, %59
br i1 %60, label %61, label %70
61: ; preds = %53
%62 = load i32*, i32** %7
%63 = call i64 @feof(i32* %62)
%64 = icmp ne i64 %63, 0
br i1 %64, label %70, label %65
65: ; preds = %61
%66 = load i32*, i32** %6
%67 = call i64 @feof(i32* %66)
%68 = icmp ne i64 %67, 0
%69 = xor i1 %68, true
br label %70
70: ; preds = %65, %61, %53
%71 = phi i1 [ false, %61 ], [ false, %53 ], [ %69, %65 ]
br i1 %71, label %72, label %73
72: ; preds = %70
br label %53
73: ; preds = %70
%74 = load i32*, i32** %7
%75 = call i64 @feof(i32* %74)
%76 = icmp ne i64 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %73
%78 = load i32*, i32** %6
%79 = call i64 @feof(i32* %78)
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %82
81: ; preds = %77, %73
br label %41
82: ; preds = %77
%83 = load i32*, i32** %7
%84 = call i32 @ftell(i32* %83)
%85 = sub nsw i32 %84, 1
%86 = sext i32 %85 to i64
store i64 %86, i64* %11
%87 = load i8, i8* %14
%88 = load i8*, i8** %10
%89 = load i16, i16* %12
%90 = add i16 %89, 1
store i16 %90, i16* %12
%91 = sext i16 %89 to i64
%92 = getelementptr inbounds i8, i8* %88, i64 %91
store i8 %87, i8* %92
br label %93
93: ; preds = %114, %82
%94 = load i32*, i32** %7
%95 = call signext i8 @fgetc(i32* %94)
store i8 %95, i8* %14
%96 = sext i8 %95 to i32
%97 = load i32*, i32** %6
%98 = call signext i8 @fgetc(i32* %97)
%99 = sext i8 %98 to i32
%100 = icmp ne i32 %96, %99
br i1 %100, label %101, label %115
101: ; preds = %93
%102 = load i8, i8* %14
%103 = load i8*, i8** %10
%104 = load i16, i16* %12
%105 = add i16 %104, 1
store i16 %105, i16* %12
%106 = sext i16 %104 to i64
%107 = getelementptr inbounds i8, i8* %103, i64 %106
store i8 %102, i8* %107
%108 = load i16, i16* %12
%109 = sext i16 %108 to i32
%110 = call signext i16 @pow(i32 2, i32 16)
%111 = sext i16 %110 to i32
%112 = icmp sgt i32 %109, %111
br i1 %112, label %113, label %114
113: ; preds = %101
br label %115
114: ; preds = %101
br label %93
115: ; preds = %113, %93
%116 = load i64, i64* %11
%117 = load i64, i64* %11
%118 = load i16, i16* %12
%119 = load i16, i16* %12
%120 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i64 %116, i64 %117, i16 signext %118, i16 signext %119)
%121 = getelementptr inbounds [3 x i8], [3 x i8]* %15, i64 0, i64 0
%122 = load i64, i64* %11
%123 = and i64 %122, 16711680
%124 = ashr i64 %123, 16
%125 = trunc i64 %124 to i8
store i8 %125, i8* %121
%126 = getelementptr inbounds i8, i8* %121, i64 1
%127 = load i64, i64* %11
%128 = and i64 %127, 65280
%129 = ashr i64 %128, 8
%130 = trunc i64 %129 to i8
store i8 %130, i8* %126
%131 = getelementptr inbounds i8, i8* %126, i64 1
%132 = load i64, i64* %11
%133 = and i64 %132, 255
%134 = trunc i64 %133 to i8
store i8 %134, i8* %131
%135 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%136 = load i16, i16* %12
%137 = sext i16 %136 to i32
%138 = and i32 %137, 65280
%139 = ashr i32 %138, 8
%140 = trunc i32 %139 to i8
store i8 %140, i8* %135
%141 = getelementptr inbounds i8, i8* %135, i64 1
%142 = load i16, i16* %12
%143 = sext i16 %142 to i32
%144 = and i32 %143, 255
%145 = trunc i32 %144 to i8
store i8 %145, i8* %141
%146 = getelementptr inbounds [3 x i8], [3 x i8]* %15, i64 0, i64 0
%147 = load i32*, i32** %8
%148 = call i32 @fwrite(i8* %146, i32 3, i32 1, i32* %147)
%149 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%150 = load i32*, i32** %8
%151 = call i32 @fwrite(i8* %149, i32 2, i32 1, i32* %150)
%152 = load i8*, i8** %10
%153 = load i16, i16* %12
%154 = sext i16 %153 to i32
%155 = load i32*, i32** %8
%156 = call i32 @fwrite(i8* %152, i32 %154, i32 1, i32* %155)
store i16 0, i16* %12
%157 = load i32, i32* %13
%158 = add nsw i32 %157, 1
store i32 %158, i32* %13
br label %41
159: ; preds = %50
%160 = load i8*, i8** %10
%161 = call i32 @free(i8* %160)
%162 = load i32*, i32** %8
%163 = call i32 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 1, i32* %162)
%164 = icmp ne i32 %163, 1
br i1 %164, label %165, label %166
165: ; preds = %159
store i32 -20, i32* %5
br label %168
166: ; preds = %159
%167 = load i32, i32* %13
store i32 %167, i32* %5
br label %168
168: ; preds = %166, %165, %36, %25
%169 = load i32, i32* %5
ret i32 %169
}

LLVM IR (-O2):
@.str = [6 x i8] c"PATCH\00"
@.str.1 = [44 x i8] c"Patch: Offset: %d (%08X), Length: %d(%04X)\0A\00"
@.str.2 = [4 x i8] c"EOF\00"
define i32 @IPS_create(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca [3 x i8]
%6 = alloca [2 x i8]
%7 = icmp ne i32* %0, null
%8 = icmp ne i32* %1, null
%9 = and i1 %7, %8
%10 = icmp ne i32* %2, null
%11 = and i1 %9, %10
br i1 %11, label %12, label %93
12: ; preds = %4
%13 = tail call i32 @rewind(i32* %0)
%14 = tail call i32 @rewind(i32* %1)
%15 = tail call i32 @rewind(i32* %2)
%16 = tail call i32 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5, i32 1, i32* %2)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %93
18: ; preds = %12
%19 = tail call signext i16 @pow(i32 2, i32 16)
%20 = tail call i64 @malloc(i16 signext %19)
%21 = inttoptr i64 %20 to i8*
%22 = tail call i64 @feof(i32* %1)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %87
24: ; preds = %18
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%26 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 1
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 2
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
br label %30
30: ; preds = %24, %69
%31 = phi i32 [ 0, %24 ], [ %84, %69 ]
br label %32
32: ; preds = %30, %51
%33 = tail call i64 @feof(i32* %0)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %87
35: ; preds = %32, %42
%36 = tail call signext i8 @fgetc(i32* %1)
%37 = tail call signext i8 @fgetc(i32* %0)
%38 = icmp eq i8 %36, %37
br i1 %38, label %39, label %45
39: ; preds = %35
%40 = tail call i64 @feof(i32* %1)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = tail call i64 @feof(i32* %0)
%44 = icmp eq i64 %43, 0
br i1 %44, label %35, label %45
45: ; preds = %35, %39, %42
%46 = tail call i64 @feof(i32* %1)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = tail call i64 @feof(i32* %0)
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %48, %45
%52 = tail call i64 @feof(i32* %1)
%53 = icmp eq i64 %52, 0
br i1 %53, label %32, label %87
54: ; preds = %48
%55 = tail call i32 @ftell(i32* %1)
%56 = add nsw i32 %55, -1
%57 = sext i32 %56 to i64
store i8 %36, i8* %21
br label %58
58: ; preds = %63, %54
%59 = phi i16 [ 1, %54 ], [ %64, %63 ]
%60 = tail call signext i8 @fgetc(i32* %1)
%61 = tail call signext i8 @fgetc(i32* %0)
%62 = icmp eq i8 %60, %61
br i1 %62, label %69, label %63
63: ; preds = %58
%64 = add i16 %59, 1
%65 = sext i16 %59 to i64
%66 = getelementptr inbounds i8, i8* %21, i64 %65
store i8 %60, i8* %66
%67 = tail call signext i16 @pow(i32 2, i32 16)
%68 = icmp sgt i16 %64, %67
br i1 %68, label %69, label %58
69: ; preds = %63, %58
%70 = phi i16 [ %64, %63 ], [ %59, %58 ]
%71 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i64 %57, i64 %57, i16 signext %70, i16 signext %70)
%72 = lshr i32 %56, 16
%73 = trunc i32 %72 to i8
store i8 %73, i8* %25
%74 = lshr i32 %56, 8
%75 = trunc i32 %74 to i8
store i8 %75, i8* %26
%76 = trunc i32 %56 to i8
store i8 %76, i8* %27
%77 = sext i16 %70 to i32
%78 = lshr i16 %70, 8
%79 = trunc i16 %78 to i8
store i8 %79, i8* %28
%80 = trunc i16 %70 to i8
store i8 %80, i8* %29
%81 = call i32 @fwrite(i8* %25, i32 3, i32 1, i32* %2)
%82 = call i32 @fwrite(i8* %28, i32 2, i32 1, i32* %2)
%83 = tail call i32 @fwrite(i8* %21, i32 %77, i32 1, i32* %2)
%84 = add nuw nsw i32 %31, 1
%85 = tail call i64 @feof(i32* %1)
%86 = icmp eq i64 %85, 0
br i1 %86, label %30, label %87
87: ; preds = %69, %32, %51, %18
%88 = phi i32 [ 0, %18 ], [ %31, %51 ], [ %31, %32 ], [ %84, %69 ]
%89 = tail call i32 @free(i8* %21)
%90 = tail call i32 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 1, i32* %2)
%91 = icmp eq i32 %90, 1
%92 = select i1 %91, i32 %88, i32 -20
br label %93
93: ; preds = %12, %4, %87
%94 = phi i32 [ %92, %87 ], [ -1, %4 ], [ -10, %12 ]
ret i32 %94
}