#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 */

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/);
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
main() {
  int c, x = 0;
  fprintf(stdout, "unsigned char resource_buffer[]={\n");
  while (!feof(stdin)) {
    c = fgetc(stdin);
    if (!feof(stdin)) {
      if (x == 0)
        fprintf(stdout, "  0x%x", c);
      else if ((x % 15 == 0))
        fprintf(stdout, ",\n  0x%x", c);
      else
        fprintf(stdout, ",0x%x", c);
      x++;
    }
  }
  fprintf(stdout, "};\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1180 <main+0x50>
jmp    1231 <main+0x101>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1050 <feof@plt>
cmp    $0x0,%eax
jne    122c <main+0xfc>
cmpl   $0x0,-0xc(%rbp)
jne    11d1 <main+0xa1>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1223 <main+0xf3>
mov    -0xc(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1204 <main+0xd4>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    121e <main+0xee>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1223 <main+0xf3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x2d>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xdf1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e96(%rip),%r13
mov    0x0(%r13),%edi
lea    0xeb3(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e8d(%rip),%rbx
mov    (%rbx),%edi
call   1050 <feof@plt>
test   %eax,%eax
je     1189 <main+0x59>
mov    0x0(%r13),%edi
lea    0xec1(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe95(%rip),%r15
lea    0xe95(%rip),%r12
xor    %r14d,%r14d
jmp    11bb <main+0x8b>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%r14d
mov    (%rbx),%edi
call   1050 <feof@plt>
test   %eax,%eax
jne    1166 <main+0x36>
mov    (%rbx),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
call   1050 <feof@plt>
test   %eax,%eax
jne    11b0 <main+0x80>
test   %r14d,%r14d
je     119c <main+0x6c>
imul   $0xeeeeeeef,%r14d,%eax
add    $0x8888888,%eax
mov    0x0(%r13),%edi
cmp    $0x11111110,%eax
jbe    11f0 <main+0xc0>
mov    %r12,%rsi
jmp    11a3 <main+0x73>
lea    0xe2c(%rip),%rsi
jmp    11a3 <main+0x73>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [35 x i8] c"unsigned char resource_buffer[]={\0A\00"
@stdin = global i32 0
@.str.1 = [7 x i8] c" 0x%x\00"
@.str.2 = [9 x i8] c",\0A 0x%x\00"
@.str.3 = [6 x i8] c",0x%x\00"
@.str.4 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = load i32, i32* @stdout
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %40, %0
%7 = load i32, i32* @stdin
%8 = call i32 @feof(i32 %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %41
11: ; preds = %6
%12 = load i32, i32* @stdin
%13 = call i32 @fgetc(i32 %12)
store i32 %13, i32* %2
%14 = load i32, i32* @stdin
%15 = call i32 @feof(i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %40, label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* @stdout
%22 = load i32, i32* %2
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %37
24: ; preds = %17
%25 = load i32, i32* %3
%26 = srem i32 %25, 15
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load i32, i32* @stdout
%30 = load i32, i32* %2
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %36
32: ; preds = %24
%33 = load i32, i32* @stdout
%34 = load i32, i32* %2
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %32, %28
br label %37
37: ; preds = %36, %20
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %40
40: ; preds = %37, %11
br label %6
41: ; preds = %6
%42 = load i32, i32* @stdout
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [35 x i8] c"unsigned char resource_buffer[]={\0A\00"
@stdin = global i32 0
@.str.1 = [7 x i8] c" 0x%x\00"
@.str.2 = [9 x i8] c",\0A 0x%x\00"
@.str.3 = [6 x i8] c",0x%x\00"
@.str.4 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = tail call i32 @feof(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %33
6: ; preds = %0, %28
%7 = phi i32 [ %29, %28 ], [ 0, %0 ]
%8 = load i32, i32* @stdin
%9 = tail call i32 @fgetc(i32 %8)
%10 = load i32, i32* @stdin
%11 = tail call i32 @feof(i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %6
%14 = icmp eq i32 %7, 0
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i32, i32* @stdout
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %26
18: ; preds = %13
%19 = srem i32 %7, 15
%20 = icmp eq i32 %19, 0
%21 = load i32, i32* @stdout
br i1 %20, label %22, label %24
22: ; preds = %18
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %26
24: ; preds = %18
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %9)
br label %26
26: ; preds = %22, %24, %15
%27 = add nsw i32 %7, 1
br label %28
28: ; preds = %26, %6
%29 = phi i32 [ %7, %6 ], [ %27, %26 ]
%30 = load i32, i32* @stdin
%31 = tail call i32 @feof(i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %6, label %33
33: ; preds = %28, %0
%34 = load i32, i32* @stdout
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}