#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*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ processBytes(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *fin, *fout;
  if (argc != 3) {
    fprintf(stderr, "No file names supplied\n");
    return 0;
  }
  fin = fopen(argv[1], "rb");
  if (fin == NULL) {
    fprintf(stderr, "Unable to open input file\n");
    return 0;
  }
  fout = fopen(argv[2], "wb");
  if (fout == NULL) {
    fprintf(stderr, "Unable to open output file\n");
    fclose(fin);
    return 0;
  }
  while (processBytes(fin, fout))
    ;
  fclose(fin);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1181 <main+0x41>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c5 <main+0x85>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe62(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1212 <main+0xd2>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    124c <main+0x10c>
jmp    1217 <main+0xd7>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <processBytes@plt>
cmp    $0x0,%rax
je     1233 <main+0xf3>
jmp    1217 <main+0xd7>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    119d <main+0x5d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xec1(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11b4 <main+0x74>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xec7(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11cb <main+0x8b>
mov    %rax,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <processBytes@plt>
test   %rax,%rax
jne    1180 <main+0x40>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
jmp    11e3 <main+0xa3>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11e8 <main+0xa8>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe57(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11e8 <main+0xa8>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"No file names supplied\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [27 x i8] c"Unable to open input file\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [28 x i8] c"Unable to open output file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %47
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i32*, i32** %6
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %47
23: ; preds = %13
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %27, i32** %7
%28 = load i32*, i32** %7
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %35
30: ; preds = %23
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32*, i32** %6
%34 = call i32 @fclose(i32* %33)
store i32 0, i32* %3
br label %47
35: ; preds = %23
br label %36
36: ; preds = %41, %35
%37 = load i32*, i32** %6
%38 = load i32*, i32** %7
%39 = call i64 @processBytes(i32* %37, i32* %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %36
br label %36
42: ; preds = %36
%43 = load i32*, i32** %6
%44 = call i32 @fclose(i32* %43)
%45 = load i32*, i32** %7
%46 = call i32 @fclose(i32* %45)
store i32 0, i32* %3
br label %47
47: ; preds = %42, %30, %20, %10
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"No file names supplied\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [27 x i8] c"Unable to open input file\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [28 x i8] c"Unable to open output file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %30
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %30
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 @fclose(i32* %10)
br label %30
24: ; preds = %15, %24
%25 = tail call i64 @processBytes(i32* %10, i32* %18)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %24
27: ; preds = %24
%28 = tail call i32 @fclose(i32* %10)
%29 = tail call i32 @fclose(i32* %18)
br label %30
30: ; preds = %27, %20, %12, %4
ret i32 0
}