#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 fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  FILE *f;
  unsigned char tab[65536];
  int nb = 0, i;
  if (argc == 1)
    return -1;
  f = fopen(argv[1], "rb");
  if (f != NULL) {
    nb = fread(tab, 1, 65536, f);
    fclose(f);
  }
  printf("#ifndef SFX_CODE\n");
  printf("#define SFX_CODE\n");
  printf("#define SFX_CODE_SIZE %dUL\n\n", nb);
  printf("#ifndef SFX\n");
  printf("static unsigned char sfx_code[] = {");
  for (i = 0; i < nb - 1; ++i) {
    if ((i & 31) == 0)
      printf("\n");
    printf("%d,", tab[i]);
  }
  printf("%d\n};\n", tab[i]);
  printf("#endif /* !SFX */\n");
  printf("#endif /* SFX_CODE */\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x10024(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1179 <main+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    12c3 <main+0x183>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe78(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c5 <main+0x85>
lea    -0x10020(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10000,%edx
call   1030 <fread@plt>
mov    %eax,-0x10024(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10024(%rbp),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x10028(%rbp)
mov    -0x10028(%rbp),%eax
mov    -0x10024(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1283 <main+0x143>
mov    -0x10028(%rbp),%eax
and    $0x1f,%eax
cmp    $0x0,%eax
jne    1252 <main+0x112>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x10028(%rbp),%rax
movzbl -0x10020(%rbp,%rax,1),%esi
ff
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10028(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10028(%rbp)
jmp    121b <main+0xdb>
movslq -0x10028(%rbp),%rax
movzbl -0x10020(%rbp,%rax,1),%esi
ff
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x10008,%rsp
mov    $0xffffffff,%r14d
cmp    $0x1,%edi
je     1275 <main+0x115>
mov    0x8(%rsi),%rdi
lea    0xe79(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11b5 <main+0x55>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x10000,%edx
mov    %rax,%rcx
call   1050 <fread@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <fclose@plt>
jmp    11b7 <main+0x57>
xor    %ebp,%ebp
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2d(%rip),%rdi
xor    %r14d,%r14d
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    $0x2,%ebp
jl     1249 <main+0xe9>
add    $0xffffffff,%ebp
mov    %ebp,%ebx
lea    0xe37(%rip),%r15
xor    %ebp,%ebp
jmp    1237 <main+0xd7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rsp,%rbp,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     124b <main+0xeb>
test   $0x1f,%bpl
jne    1220 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1220 <main+0xc0>
xor    %ebx,%ebx
movzbl (%rsp,%rbx,1),%esi
lea    0xdf2(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
lea    0xe1f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%eax
add    $0x10008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [18 x i8] c"#ifndef SFX_CODE\0A\00"
@.str.2 = [18 x i8] c"#define SFX_CODE\0A\00"
@.str.3 = [29 x i8] c"#define SFX_CODE_SIZE %dUL\0A\0A\00"
@.str.4 = [13 x i8] c"#ifndef SFX\0A\00"
@.str.5 = [36 x i8] c"static unsigned char sfx_code[] = {\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [4 x i8] c"%d,\00"
@.str.8 = [7 x i8] c"%d\0A};\0A\00"
@.str.9 = [19 x i8] c"#endif /* !SFX */\0A\00"
@.str.10 = [24 x i8] c"#endif /* SFX_CODE */\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [65536 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %63
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, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i32*, i32** %6
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 0
%22 = load i32*, i32** %6
%23 = call i32 @fread(i8* %21, i32 1, i32 65536, i32* %22)
store i32 %23, i32* %8
%24 = load i32*, i32** %6
%25 = call i32 @fclose(i32* %24)
br label %26
26: ; preds = %20, %13
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%29 = load i32, i32* %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %33
33: ; preds = %51, %26
%34 = load i32, i32* %9
%35 = load i32, i32* %8
%36 = sub nsw i32 %35, 1
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %54
38: ; preds = %33
%39 = load i32, i32* %9
%40 = and i32 %39, 31
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %44
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %33
54: ; preds = %33
%55 = load i32, i32* %9
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %59)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %3
br label %63
63: ; preds = %54, %12
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.3 = [29 x i8] c"#define SFX_CODE_SIZE %dUL\0A\0A\00"
@.str.5 = [36 x i8] c"static unsigned char sfx_code[] = {\00"
@.str.7 = [4 x i8] c"%d,\00"
@.str.8 = [7 x i8] c"%d\0A};\0A\00"
@str = [17 x i8] c"#ifndef SFX_CODE\00"
@str.11 = [17 x i8] c"#define SFX_CODE\00"
@str.12 = [12 x i8] c"#ifndef SFX\00"
@str.13 = [18 x i8] c"#endif /* !SFX */\00"
@str.14 = [23 x i8] c"#endif /* SFX_CODE */\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [65536 x i8]
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 1
br i1 %5, label %48, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = call i32 @fread(i8* %4, i32 1, i32 65536, i32* %9)
%13 = tail call i32 @fclose(i32* %9)
br label %14
14: ; preds = %11, %6
%15 = phi i32 [ %12, %11 ], [ 0, %6 ]
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.11, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%21 = add i32 %15, -1
%22 = icmp sgt i32 %15, 1
br i1 %22, label %23, label %40
23: ; preds = %14
%24 = zext i32 %21 to i64
br label %25
25: ; preds = %23, %31
%26 = phi i64 [ 0, %23 ], [ %36, %31 ]
%27 = and i64 %26, 31
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = tail call i32 @putchar(i32 10)
br label %31
31: ; preds = %29, %25
%32 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %26
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %34)
%36 = add nuw nsw i64 %26, 1
%37 = icmp eq i64 %36, %24
br i1 %37, label %38, label %25
38: ; preds = %31
%39 = zext i32 %21 to i64
br label %40
40: ; preds = %14, %38
%41 = phi i64 [ %39, %38 ], [ 0, %14 ]
%42 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %44)
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.13, i64 0, i64 0))
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.14, i64 0, i64 0))
br label %48
48: ; preds = %2, %40
%49 = phi i32 [ 0, %40 ], [ -1, %2 ]
ret i32 %49
}