#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 INT_MAX;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int get_fsize(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ ternary_xor_b8(int, int);
int main(int argc, char *argv[]) {
  int i;
  int result = 0;
  FILE *fIn[2], *fOut;
  if (argc < 3) {
    fprintf(stderr,
            "ternary_backup\n"
            "  %s [src1] [src2] ([dst])\n",
            argv[0]);
    return 0;
  }
  if (3 < argc) {
    fOut = fopen(argv[3], "rb");
    if (fOut) {
      fclose(fOut);
      fprintf(stderr, "file %s exists\n", argv[3]);
      return 1;
    } else {
      fOut = fopen(argv[3], "wb");
    }
  } else {
    fOut = stdout;
  }
  for (i = 0; i < 2; ++i) {
    fIn[i] = fopen(argv[i + 1], "rb");
  }
  if (!(fIn[0] && fIn[1] && fOut)) {
    fputs("failed to open any file\n", stderr);
    result = 1;
  } else {
    int size = get_fsize(fIn[0]);
    if (size == -1) {
      fprintf(stderr, "this program can not treat large(%d<) input\n", INT_MAX);
      result = 1;
    } else if (size != get_fsize(fIn[1])) {
      fputs("input files must have same size\n", stderr);
      result = 1;
    } else {
      for (i = 0; i < size && !feof(fIn[0]) && !feof(fIn[1]); ++i) {
        int a = fgetc(fIn[0]);
        int b = fgetc(fIn[1]);
        int c = a < b ? b : a;
        if (242 < c) {
          fputs("input files include invalid characters\n", stderr);
          result = 2;
          break;
        }
        fputc(ternary_xor_b8(a, b), fOut);
      }
      fflush(fOut);
    }
  }
  if (fOut && fOut != stdout) {
    fclose(fOut);
  }
  for (i = 0; i < 2; ++i) {
    if (fIn[i]) {
      fclose(fIn[i]);
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11f1 <main+0x51>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14f0 <main+0x350>
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jge    1273 <main+0xd3>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe1d(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1256 <main+0xb6>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f0 <main+0x350>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdd9(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x38(%rbp)
jmp    1281 <main+0xe1>
mov    0x2d56(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    12c9 <main+0x129>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd81(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x30(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1288 <main+0xe8>
cmpq   $0x0,-0x30(%rbp)
je     12ea <main+0x14a>
cmpq   $0x0,-0x28(%rbp)
je     12ea <main+0x14a>
cmpq   $0x0,-0x38(%rbp)
jne    130b <main+0x16b>
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
lea    0xd47(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x1,-0x18(%rbp)
jmp    1480 <main+0x2e0>
mov    -0x30(%rbp),%rdi
call   1030 <get_fsize@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    134d <main+0x1ad>
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
mov    0x2cb7(%rip),%rax
mov    (%rax),%edx
lea    0xd20(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x18(%rbp)
jmp    147b <main+0x2db>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <get_fsize@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
je     138a <main+0x1ea>
mov    0x2c68(%rip),%rax
mov    (%rax),%esi
lea    0xd0e(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x1,-0x18(%rbp)
jmp    1476 <main+0x2d6>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x3c(%rbp),%ecx
mov    %al,-0x4d(%rbp)
jge    13cf <main+0x22f>
mov    -0x30(%rbp),%rdi
call   10a0 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x4d(%rbp)
jne    13cf <main+0x22f>
mov    -0x28(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
test   $0x1,%al
jne    13df <main+0x23f>
jmp    146d <main+0x2cd>
mov    -0x30(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    140e <main+0x26e>
mov    -0x44(%rbp),%eax
mov    %eax,-0x54(%rbp)
jmp    1414 <main+0x274>
mov    -0x40(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    $0xf2,%eax
cmp    -0x48(%rbp),%eax
jge    1449 <main+0x2a9>
mov    0x2ba9(%rip),%rax
mov    (%rax),%esi
lea    0xc70(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x2,-0x18(%rbp)
jmp    146d <main+0x2cd>
mov    -0x40(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1050 <ternary_xor_b8@plt>
mov    %eax,%edi
mov    -0x38(%rbp),%rsi
call   1080 <fputc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1391 <main+0x1f1>
mov    -0x38(%rbp),%rdi
call   10b0 <fflush@plt>
jmp    147b <main+0x2db>
jmp    1480 <main+0x2e0>
cmpq   $0x0,-0x38(%rbp)
je     14a8 <main+0x308>
mov    -0x38(%rbp),%rax
mov    0x2b3a(%rip),%rcx
cmp    (%rcx),%rax
je     14a8 <main+0x308>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    14ea <main+0x34a>
movslq -0x14(%rbp),%rax
cmpq   $0x0,-0x30(%rbp,%rax,8)
je     14d7 <main+0x337>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1040 <fclose@plt>
jmp    14dc <main+0x33c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    14af <main+0x30f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%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,%rbx
cmp    $0x2,%edi
jg     11d5 <main+0x35>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe3a(%rip),%rsi
xor    %r13d,%r13d
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1394 <main+0x1f4>
cmp    $0x3,%edi
jne    11e6 <main+0x46>
mov    0x2def(%rip),%rax
mov    (%rax),%r14
jmp    123c <main+0x9c>
mov    0x18(%rbx),%rdi
lea    0xe3a(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1229 <main+0x89>
mov    %rax,%rdi
call   1040 <fclose@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rbx),%rdx
lea    0xe17(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%r13d
jmp    1394 <main+0x1f4>
mov    0x18(%rbx),%rdi
lea    0xe0a(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
lea    0xde4(%rip),%rbp
mov    %rbp,%rsi
call   10c0 <fopen@plt>
mov    %rax,%r12
mov    0x10(%rbx),%rdi
mov    %rbp,%rsi
call   10c0 <fopen@plt>
mov    %rax,%r15
test   %r12,%r12
je     1312 <main+0x172>
test   %r15,%r15
je     1312 <main+0x172>
test   %r14,%r14
je     1312 <main+0x172>
mov    %r12,%rdi
call   1030 <get_fsize@plt>
cmp    $0xffffffff,%eax
je     1324 <main+0x184>
mov    %eax,%ebx
mov    %r15,%rdi
call   1030 <get_fsize@plt>
cmp    %eax,%ebx
jne    1346 <main+0x1a6>
xor    %r13d,%r13d
test   %ebx,%ebx
jle    13c1 <main+0x221>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    13c1 <main+0x221>
mov    %r15,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    13c1 <main+0x221>
mov    %r12,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1070 <fgetc@plt>
cmp    %eax,%ebp
mov    %ebp,%ecx
cmovl  %eax,%ecx
cmp    $0xf3,%ecx
jge    13a6 <main+0x206>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <ternary_xor_b8@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0xffffffff,%ebx
jne    12b0 <main+0x110>
jmp    13c1 <main+0x221>
mov    0x2cbf(%rip),%rax
mov    (%rax),%esi
lea    0xd1f(%rip),%rdi
jmp    1356 <main+0x1b6>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
mov    0x2cb4(%rip),%rax
mov    (%rax),%edx
lea    0xd1d(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    135b <main+0x1bb>
mov    0x2c8b(%rip),%rax
mov    (%rax),%esi
lea    0xd31(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x1,%r13d
test   %r14,%r14
je     137a <main+0x1da>
mov    0x2c63(%rip),%rax
cmp    (%rax),%r14
je     137a <main+0x1da>
mov    %r14,%rdi
call   1040 <fclose@plt>
test   %r12,%r12
je     1387 <main+0x1e7>
mov    %r12,%rdi
call   1040 <fclose@plt>
test   %r15,%r15
je     1394 <main+0x1f4>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c2b(%rip),%rax
mov    (%rax),%esi
lea    0xcf2(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x2,%r13d
mov    %r14,%rdi
call   10b0 <fflush@plt>
test   %r14,%r14
jne    1366 <main+0x1c6>
jmp    137a <main+0x1da>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"ternary_backup\0A %s [src1] [src2] ([dst])\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [16 x i8] c"file %s exists\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@stdout = global i32* null
@.str.4 = [25 x i8] c"failed to open any file\0A\00"
@.str.5 = [45 x i8] c"this program can not treat large(%d<) input\0A\00"
@INT_MAX = global i32 0
@.str.6 = [33 x i8] c"input files must have same size\0A\00"
@.str.7 = [40 x i8] c"input files include invalid characters\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x i32*]
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %184
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp slt i32 3, %23
br i1 %24, label %25, label %46
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 3
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %9
%30 = load i32*, i32** %9
%31 = icmp ne i32* %30, null
br i1 %31, label %32, label %40
32: ; preds = %25
%33 = load i32*, i32** %9
%34 = call i32 @fclose(i32* %33)
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 3
%38 = load i8*, i8** %37
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %38)
store i32 1, i32* %3
br label %184
40: ; preds = %25
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 3
%43 = load i8*, i8** %42
%44 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %44, i32** %9
br label %45
45: ; preds = %40
br label %48
46: ; preds = %22
%47 = load i32*, i32** @stdout
store i32* %47, i32** %9
br label %48
48: ; preds = %46, %45
store i32 0, i32* %6
br label %49
49: ; preds = %63, %48
%50 = load i32, i32* %6
%51 = icmp slt i32 %50, 2
br i1 %51, label %52, label %66
52: ; preds = %49
%53 = load i8**, i8*** %5
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %53, i64 %56
%58 = load i8*, i8** %57
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %61
store i32* %59, i32** %62
br label %63
63: ; preds = %52
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %49
66: ; preds = %49
%67 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 0
%68 = load i32*, i32** %67
%69 = icmp ne i32* %68, null
br i1 %69, label %70, label %77
70: ; preds = %66
%71 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 1
%72 = load i32*, i32** %71
%73 = icmp ne i32* %72, null
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = load i32*, i32** %9
%76 = icmp ne i32* %75, null
br i1 %76, label %80, label %77
77: ; preds = %74, %70, %66
%78 = load i32, i32* @stderr
%79 = call i32 @fputs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %78)
store i32 1, i32* %7
br label %152
80: ; preds = %74
%81 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 0
%82 = load i32*, i32** %81
%83 = call i32 @get_fsize(i32* %82)
store i32 %83, i32* %10
%84 = load i32, i32* %10
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %90
86: ; preds = %80
%87 = load i32, i32* @stderr
%88 = load i32, i32* @INT_MAX
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %88)
store i32 1, i32* %7
br label %151
90: ; preds = %80
%91 = load i32, i32* %10
%92 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 1
%93 = load i32*, i32** %92
%94 = call i32 @get_fsize(i32* %93)
%95 = icmp ne i32 %91, %94
br i1 %95, label %96, label %99
96: ; preds = %90
%97 = load i32, i32* @stderr
%98 = call i32 @fputs(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %97)
store i32 1, i32* %7
br label %150
99: ; preds = %90
store i32 0, i32* %6
br label %100
100: ; preds = %144, %99
%101 = load i32, i32* %6
%102 = load i32, i32* %10
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %115
104: ; preds = %100
%105 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 0
%106 = load i32*, i32** %105
%107 = call i32 @feof(i32* %106)
%108 = icmp ne i32 %107, 0
br i1 %108, label %115, label %109
109: ; preds = %104
%110 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 1
%111 = load i32*, i32** %110
%112 = call i32 @feof(i32* %111)
%113 = icmp ne i32 %112, 0
%114 = xor i1 %113, true
br label %115
115: ; preds = %109, %104, %100
%116 = phi i1 [ false, %104 ], [ false, %100 ], [ %114, %109 ]
br i1 %116, label %117, label %147
117: ; preds = %115
%118 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 0
%119 = load i32*, i32** %118
%120 = call i32 @fgetc(i32* %119)
store i32 %120, i32* %11
%121 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 1
%122 = load i32*, i32** %121
%123 = call i32 @fgetc(i32* %122)
store i32 %123, i32* %12
%124 = load i32, i32* %11
%125 = load i32, i32* %12
%126 = icmp slt i32 %124, %125
br i1 %126, label %127, label %129
127: ; preds = %117
%128 = load i32, i32* %12
br label %131
129: ; preds = %117
%130 = load i32, i32* %11
br label %131
131: ; preds = %129, %127
%132 = phi i32 [ %128, %127 ], [ %130, %129 ]
store i32 %132, i32* %13
%133 = load i32, i32* %13
%134 = icmp slt i32 242, %133
br i1 %134, label %135, label %138
135: ; preds = %131
%136 = load i32, i32* @stderr
%137 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %136)
store i32 2, i32* %7
br label %147
138: ; preds = %131
%139 = load i32, i32* %11
%140 = load i32, i32* %12
%141 = call i32 @ternary_xor_b8(i32 %139, i32 %140)
%142 = load i32*, i32** %9
%143 = call i32 @fputc(i32 %141, i32* %142)
br label %144
144: ; preds = %138
%145 = load i32, i32* %6
%146 = add nsw i32 %145, 1
store i32 %146, i32* %6
br label %100
147: ; preds = %135, %115
%148 = load i32*, i32** %9
%149 = call i32 @fflush(i32* %148)
br label %150
150: ; preds = %147, %96
br label %151
151: ; preds = %150, %86
br label %152
152: ; preds = %151, %77
%153 = load i32*, i32** %9
%154 = icmp ne i32* %153, null
br i1 %154, label %155, label %162
155: ; preds = %152
%156 = load i32*, i32** %9
%157 = load i32*, i32** @stdout
%158 = icmp ne i32* %156, %157
br i1 %158, label %159, label %162
159: ; preds = %155
%160 = load i32*, i32** %9
%161 = call i32 @fclose(i32* %160)
br label %162
162: ; preds = %159, %155, %152
store i32 0, i32* %6
br label %163
163: ; preds = %179, %162
%164 = load i32, i32* %6
%165 = icmp slt i32 %164, 2
br i1 %165, label %166, label %182
166: ; preds = %163
%167 = load i32, i32* %6
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %168
%170 = load i32*, i32** %169
%171 = icmp ne i32* %170, null
br i1 %171, label %172, label %178
172: ; preds = %166
%173 = load i32, i32* %6
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [2 x i32*], [2 x i32*]* %8, i64 0, i64 %174
%176 = load i32*, i32** %175
%177 = call i32 @fclose(i32* %176)
br label %178
178: ; preds = %172, %166
br label %179
179: ; preds = %178
%180 = load i32, i32* %6
%181 = add nsw i32 %180, 1
store i32 %181, i32* %6
br label %163
182: ; preds = %163
%183 = load i32, i32* %7
store i32 %183, i32* %3
br label %184
184: ; preds = %182, %32, %16
%185 = load i32, i32* %3
ret i32 %185
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"ternary_backup\0A %s [src1] [src2] ([dst])\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [16 x i8] c"file %s exists\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@stdout = global i32* null
@.str.4 = [25 x i8] c"failed to open any file\0A\00"
@.str.5 = [45 x i8] c"this program can not treat large(%d<) input\0A\00"
@INT_MAX = global i32 0
@.str.6 = [33 x i8] c"input files must have same size\0A\00"
@.str.7 = [40 x i8] c"input files include invalid characters\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %96
8: ; preds = %2
%9 = icmp eq i32 %0, 3
br i1 %9, label %23, label %10
10: ; preds = %8
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = tail call i32 @fclose(i32* %13)
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %11
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %96
20: ; preds = %10
%21 = load i8*, i8** %11
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %25
23: ; preds = %8
%24 = load i32*, i32** @stdout
br label %25
25: ; preds = %23, %20
%26 = phi i32* [ %22, %20 ], [ %24, %23 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
%29 = tail call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = tail call i32* @fopen(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp ne i32* %29, null
%34 = icmp ne i32* %32, null
%35 = and i1 %33, %34
%36 = icmp ne i32* %26, null
%37 = select i1 %35, i1 %36, i1 false
br i1 %37, label %41, label %38
38: ; preds = %25
%39 = load i32, i32* @stderr
%40 = tail call i32 @fputs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %39)
br label %80
41: ; preds = %25
%42 = tail call i32 @get_fsize(i32* %29)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = load i32, i32* @INT_MAX
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %46)
br label %80
48: ; preds = %41
%49 = tail call i32 @get_fsize(i32* %32)
%50 = icmp eq i32 %42, %49
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = icmp sgt i32 %42, 0
br i1 %52, label %56, label %77
53: ; preds = %48
%54 = load i32, i32* @stderr
%55 = tail call i32 @fputs(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %54)
br label %80
56: ; preds = %51, %72
%57 = phi i32 [ %75, %72 ], [ 0, %51 ]
%58 = tail call i32 @feof(i32* %29)
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %77
60: ; preds = %56
%61 = tail call i32 @feof(i32* %32)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %77
63: ; preds = %60
%64 = tail call i32 @fgetc(i32* %29)
%65 = tail call i32 @fgetc(i32* %32)
%66 = icmp slt i32 %64, %65
%67 = select i1 %66, i32 %65, i32 %64
%68 = icmp sgt i32 %67, 242
br i1 %68, label %69, label %72
69: ; preds = %63
%70 = load i32, i32* @stderr
%71 = tail call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %70)
br label %77
72: ; preds = %63
%73 = tail call i32 @ternary_xor_b8(i32 %64, i32 %65)
%74 = tail call i32 @fputc(i32 %73, i32* %26)
%75 = add nuw nsw i32 %57, 1
%76 = icmp eq i32 %75, %42
br i1 %76, label %77, label %56
77: ; preds = %60, %56, %72, %51, %69
%78 = phi i32 [ 2, %69 ], [ 0, %51 ], [ 0, %72 ], [ 0, %56 ], [ 0, %60 ]
%79 = tail call i32 @fflush(i32* %26)
br label %80
80: ; preds = %44, %77, %53, %38
%81 = phi i32 [ 1, %38 ], [ 1, %44 ], [ 1, %53 ], [ %78, %77 ]
%82 = xor i1 %36, true
%83 = load i32*, i32** @stdout
%84 = icmp eq i32* %26, %83
%85 = select i1 %82, i1 true, i1 %84
br i1 %85, label %88, label %86
86: ; preds = %80
%87 = tail call i32 @fclose(i32* %26)
br label %88
88: ; preds = %86, %80
%89 = icmp eq i32* %29, null
br i1 %89, label %92, label %90
90: ; preds = %88
%91 = tail call i32 @fclose(i32* %29)
br label %92
92: ; preds = %88, %90
%93 = icmp eq i32* %32, null
br i1 %93, label %96, label %94
94: ; preds = %92
%95 = tail call i32 @fclose(i32* %32)
br label %96
96: ; preds = %92, %94, %15, %4
%97 = phi i32 [ 0, %4 ], [ 1, %15 ], [ %81, %94 ], [ %81, %92 ]
ret i32 %97
}