#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*/ abort();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int main(int argc, const char **argv) {
  if (argc != 3) {
    abort();
  }
  const char *output = argv[1];
  const char *input = argv[2];
  FILE *fin = fopen(input, "rb");
  FILE *fout = fopen(output, "wb");
  char read_buf[4096];
  while (!feof(fin)) {
    size_t nread = fread(read_buf, 1, 4096, fin);
    for (size_t i = 0; i < nread; ++i) {
      char c = read_buf[i];
      fprintf(fout, "0x%02X, ", c);
      if (i % 13 == 12) {
        fprintf(fout, "\n");
      }
    }
  }
  fprintf(fout, "0x00");
  fclose(fin);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e8 <main+0x88>
jmp    12a3 <main+0x143>
lea    -0x1030(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1040 <fread@plt>
mov    %rax,-0x1038(%rbp)
movq   $0x0,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
cmp    -0x1038(%rbp),%rax
jae    129e <main+0x13e>
mov    -0x1040(%rbp),%rax
mov    -0x1030(%rbp,%rax,1),%al
mov    %al,-0x1041(%rbp)
mov    -0x30(%rbp),%rdi
movsbl -0x1041(%rbp),%edx
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x1040(%rbp),%rax
mov    $0xd,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0xc,%rdx
jne    1282 <main+0x122>
mov    -0x30(%rbp),%rdi
lea    0xd94(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1287 <main+0x127>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
jmp    1214 <main+0xb4>
jmp    11ca <main+0x6a>
mov    -0x30(%rbp),%rdi
lea    0xd63(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
cmp    $0x3,%edi
jne    12b5 <main+0x135>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%rdi
lea    0xe57(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbp
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
mov    %rax,%r13
mov    %rbp,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     120c <main+0x8c>
lea    0xe39(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10a0 <fwrite@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x4ec4ec4ec4ec4ec5,%r15
ec c4 4e
lea    0xde9(%rip),%r12
mov    %rbp,0x8(%rsp)
jmp    1241 <main+0xc1>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    11cf <main+0x4f>
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
mov    %rbp,%rcx
call   1040 <fread@plt>
test   %rax,%rax
je     1230 <main+0xb0>
mov    %rax,%rbx
xor    %ebp,%ebp
jmp    1279 <main+0xf9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1230 <main+0xb0>
mov    %rbp,%rax
mul    %r15
shr    $0x2,%rdx
lea    (%rdx,%rdx,2),%rax
lea    (%rdx,%rax,4),%r14
add    $0xc,%r14
movsbl 0x10(%rsp,%rbp,1),%edx
mov    %r13,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
cmp    %rbp,%r14
jne    1270 <main+0xf0>
mov    $0xa,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
jmp    1270 <main+0xf0>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [9 x i8] c"0x%02X, \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [5 x i8] c"0x00\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [4096 x i8]
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
store i8* %21, i8** %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
store i8* %24, i8** %7
%25 = load i8*, i8** %7
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %26, i32** %8
%27 = load i8*, i8** %6
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %9
br label %29
29: ; preds = %60, %18
%30 = load i32*, i32** %8
%31 = call i32 @feof(i32* %30)
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br i1 %33, label %34, label %61
34: ; preds = %29
%35 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 0
%36 = load i32*, i32** %8
%37 = call i64 @fread(i8* %35, i32 1, i32 4096, i32* %36)
store i64 %37, i64* %11
store i64 0, i64* %12
br label %38
38: ; preds = %57, %34
%39 = load i64, i64* %12
%40 = load i64, i64* %11
%41 = icmp ult i64 %39, %40
br i1 %41, label %42, label %60
42: ; preds = %38
%43 = load i64, i64* %12
%44 = getelementptr inbounds [4096 x i8], [4096 x i8]* %10, i64 0, i64 %43
%45 = load i8, i8* %44
store i8 %45, i8* %13
%46 = load i32*, i32** %9
%47 = load i8, i8* %13
%48 = sext i8 %47 to i32
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = load i64, i64* %12
%51 = urem i64 %50, 13
%52 = icmp eq i64 %51, 12
br i1 %52, label %53, label %56
53: ; preds = %42
%54 = load i32*, i32** %9
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %56
56: ; preds = %53, %42
br label %57
57: ; preds = %56
%58 = load i64, i64* %12
%59 = add i64 %58, 1
store i64 %59, i64* %12
br label %38
60: ; preds = %38
br label %29
61: ; preds = %29
%62 = load i32*, i32** %9
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%64 = load i32*, i32** %8
%65 = call i32 @fclose(i32* %64)
%66 = load i32*, i32** %9
%67 = call i32 @fclose(i32* %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [9 x i8] c"0x%02X, \00"
@.str.4 = [5 x i8] c"0x00\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = icmp eq i32 %0, 3
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%15 = tail call i32 @feof(i32* %12)
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %36
17: ; preds = %33, %20
%18 = tail call i32 @feof(i32* %12)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %36
20: ; preds = %7, %17
%21 = call i64 @fread(i8* %14, i32 1, i32 4096, i32* %12)
%22 = icmp eq i64 %21, 0
br i1 %22, label %17, label %23
23: ; preds = %20, %33
%24 = phi i64 [ %34, %33 ], [ 0, %20 ]
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = urem i64 %24, 13
%30 = icmp eq i64 %29, 12
br i1 %30, label %31, label %33
31: ; preds = %23
%32 = tail call i32 @fputc(i32 10, i32* %13)
br label %33
33: ; preds = %31, %23
%34 = add nuw i64 %24, 1
%35 = icmp eq i64 %34, %21
br i1 %35, label %17, label %23
36: ; preds = %17, %7
%37 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 4, i64 1, i32* %13)
%38 = tail call i32 @fclose(i32* %12)
%39 = tail call i32 @fclose(i32* %13)
ret i32 0
}