#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*/ c;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
int main(int argc, char **argv) {
  FILE *in = fdopen(0, "rb"), *out = stdout;
  int i;
  fprintf(out, "/* AUTOMATICALLY GENERATED.  DO NOT EDIT. */\n");
  fprintf(out, "const unsigned char %s[] = {\n", argc > 1 ? argv[1] : "file");
  for (i = 0; !feof(in); i++) {
    unsigned char c;
    if (0 == fread(&c, sizeof(c), 1, in))
      continue;
    fprintf(out, "%s%3d",
            (i == 0)          ? "  "
            : (0 == (i % 16)) ? ",\n  "
                              : ",",
            (unsigned)c);
  }
  fprintf(out, "\n};\n");
  fclose(in);
  fclose(out);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
lea    0xe91(%rip),%rsi
call   1070 <fdopen@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11bb <main+0x6b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    11cb <main+0x7b>
lea    0xe8d(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    11cb <main+0x7b>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1206 <main+0xb6>
jmp    129e <main+0x14e>
mov    -0x18(%rbp),%rcx
lea    -0x25(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    122d <main+0xdd>
jmp    1290 <main+0x140>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    124f <main+0xff>
lea    0xe16(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    1276 <main+0x126>
mov    -0x24(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
xor    %edx,%edx
lea    0xdfa(%rip),%rax
lea    0xdee(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rdx
movzbl -0x25(%rbp),%ecx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e8 <main+0x98>
mov    -0x20(%rbp),%rdi
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%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,%r15
mov    %edi,%ebp
lea    0xe89(%rip),%rsi
xor    %edi,%edi
call   1070 <fdopen@plt>
mov    %rax,%rbx
mov    0x2e58(%rip),%rax
mov    (%rax),%r14
lea    0xe71(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
cmp    $0x2,%ebp
jl     11af <main+0x4f>
mov    0x8(%r15),%rdx
jmp    11b6 <main+0x56>
lea    0xe99(%rip),%rdx
lea    0xe74(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     120d <main+0xad>
lea    0xe87(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x7(%rsp),%r15
lea    0xe43(%rip),%r13
lea    0xe34(%rip),%r12
xor    %ebp,%ebp
jmp    123f <main+0xdf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11d3 <main+0x73>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
test   %rax,%rax
je     1230 <main+0xd0>
test   $0xf,%bpl
lea    0xdfb(%rip),%rdx
lea    0xdef(%rip),%rax
cmove  %rax,%rdx
test   %ebp,%ebp
cmove  %r13,%rdx
movzbl 0x7(%rsp),%ecx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1230 <main+0xd0>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stdout = global i32* null
@.str.1 = [46 x i8] c"/* AUTOMATICALLY GENERATED. DO NOT EDIT. */\0A\00"
@.str.2 = [30 x i8] c"const unsigned char %s[] = {\0A\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [6 x i8] c"%s%3d\00"
@.str.5 = [3 x i8] c" \00"
@.str.6 = [5 x i8] c",\0A \00"
@.str.7 = [2 x i8] c",\00"
@.str.8 = [5 x i8] c"\0A};\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 i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32* @fdopen(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %6
%11 = load i32*, i32** @stdout
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32*, i32** %7
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
br label %22
21: ; preds = %2
br label %22
22: ; preds = %21, %17
%23 = phi i8* [ %20, %17 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %21 ]
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %23)
store i32 0, i32* %8
br label %25
25: ; preds = %51, %22
%26 = load i32*, i32** %6
%27 = call i32 @feof(i32* %26)
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
br i1 %29, label %30, label %54
30: ; preds = %25
%31 = load i32*, i32** %6
%32 = call i64 @fread(i8* %9, i32 1, i32 1, i32* %31)
%33 = icmp eq i64 0, %32
br i1 %33, label %34, label %35
34: ; preds = %30
br label %51
35: ; preds = %30
%36 = load i32*, i32** %7
%37 = load i32, i32* %8
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %35
br label %46
40: ; preds = %35
%41 = load i32, i32* %8
%42 = srem i32 %41, 16
%43 = icmp eq i32 0, %42
%44 = zext i1 %43 to i64
%45 = select i1 %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
br label %46
46: ; preds = %40, %39
%47 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %39 ], [ %45, %40 ]
%48 = load i8, i8* %9
%49 = zext i8 %48 to i32
%50 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %47, i32 %49)
br label %51
51: ; preds = %46, %34
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %25
54: ; preds = %25
%55 = load i32*, i32** %7
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%57 = load i32*, i32** %6
%58 = call i32 @fclose(i32* %57)
%59 = load i32*, i32** %7
%60 = call i32 @fclose(i32* %59)
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stdout = global i32* null
@.str.1 = [46 x i8] c"/* AUTOMATICALLY GENERATED. DO NOT EDIT. */\0A\00"
@.str.2 = [30 x i8] c"const unsigned char %s[] = {\0A\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [6 x i8] c"%s%3d\00"
@.str.5 = [3 x i8] c" \00"
@.str.6 = [5 x i8] c",\0A \00"
@.str.7 = [2 x i8] c",\00"
@.str.8 = [5 x i8] c"\0A};\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = tail call i32* @fdopen(i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** @stdout
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i64 45, i64 1, i32* %5)
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
br label %11
11: ; preds = %2, %8
%12 = phi i8* [ %10, %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %2 ]
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = tail call i32 @feof(i32* %4)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %11, %29
%17 = phi i32 [ %30, %29 ], [ 0, %11 ]
%18 = call i64 @fread(i8* %3, i32 1, i32 1, i32* %4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %16
%21 = icmp eq i32 %17, 0
%22 = and i32 %17, 15
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%25 = select i1 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %24
%26 = load i8, i8* %3
%27 = zext i8 %26 to i32
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %25, i32 %27)
br label %29
29: ; preds = %16, %20
%30 = add nuw nsw i32 %17, 1
%31 = tail call i32 @feof(i32* %4)
%32 = icmp eq i32 %31, 0
br i1 %32, label %16, label %33
33: ; preds = %29, %11
%34 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 4, i64 1, i32* %5)
%35 = tail call i32 @fclose(i32* %4)
%36 = tail call i32 @fclose(i32* %5)
ret i32 0
}