#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*/ *);
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char);
main(int argc, char **argv) {
  FILE *fFrom, *fTo;
  unsigned char in, out;
  int i = 0;
  fFrom = fopen(argv[1], "r");
  fTo = fopen(argv[2], "r");
  while (i < 256) {
    in = fgetc(fFrom);
    out = fgetc(fTo);
    printf("0x%.2x\t0x%.2x\n", in, out);
    i++;
  }
  fclose(fFrom);
  fclose(fTo);
}


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)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe94(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe7c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x100,-0x28(%rbp)
jge    11d6 <main+0x96>
mov    -0x18(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x22(%rbp)
mov    -0x21(%rbp),%al
lea    0xe46(%rip),%rdi
movzbl %al,%esi
movzbl -0x22(%rbp),%edx
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    118d <main+0x4d>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeaa(%rip),%r15
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
mov    $0x100,%ebp
lea    0xe86(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1050 <fgetc@plt>
movzbl %bl,%esi
movzbl %al,%edx
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x40>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [15 x i8] c"0x%.2x\090x%.2x\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 i8
%9 = alloca i8
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %7
br label %19
19: ; preds = %22, %2
%20 = load i32, i32* %10
%21 = icmp slt i32 %20, 256
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i32*, i32** %6
%24 = call zeroext i8 @fgetc(i32* %23)
store i8 %24, i8* %8
%25 = load i32*, i32** %7
%26 = call zeroext i8 @fgetc(i32* %25)
store i8 %26, i8* %9
%27 = load i8, i8* %8
%28 = load i8, i8* %9
%29 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %27, i8 zeroext %28)
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
br label %19
32: ; preds = %19
%33 = load i32*, i32** %6
%34 = call i32 @fclose(i32* %33)
%35 = load i32*, i32** %7
%36 = call i32 @fclose(i32* %35)
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [15 x i8] c"0x%.2x\090x%.2x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %2, %9
%10 = phi i32 [ 0, %2 ], [ %14, %9 ]
%11 = tail call zeroext i8 @fgetc(i32* %5)
%12 = tail call zeroext i8 @fgetc(i32* %8)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %11, i8 zeroext %12)
%14 = add nuw nsw i32 %10, 1
%15 = icmp eq i32 %14, 256
br i1 %15, label %16, label %9
16: ; preds = %9
%17 = tail call i32 @fclose(i32* %5)
%18 = tail call i32 @fclose(i32* %8)
ret i32 0
}