#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 EOF;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int b, i;
  char *sym;
  if (2 != argc)
    return 1;
  sym = argv[1];
  b = getchar();
  if (b == EOF)
    goto abort;
  printf("/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n"
         "unsigned char %s[] =\n{\n",
         sym);
  while (1) {
    printf("0x%02x", b);
    b = getchar();
    if (b == EOF)
      goto end;
    for (i = 0; i < 16 - 1; i++) {
      printf(", 0x%02x", b);
      b = getchar();
      if (b == EOF)
        goto end;
    }
    printf(",\n");
  }
end:
  printf("\n};\n");
abort:
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     115f <main+0x2f>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%eax
jne    118c <main+0x5c>
jmp    1247 <main+0x117>
mov    -0x20(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%eax
jne    11d0 <main+0xa0>
jmp    1239 <main+0x109>
movl   $0x0,-0x18(%rbp)
cmpl   $0xf,-0x18(%rbp)
jge    1226 <main+0xf6>
mov    -0x14(%rbp),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2de2(%rip),%rcx
cmp    (%rcx),%eax
jne    1213 <main+0xe3>
jmp    1239 <main+0x109>
jmp    1218 <main+0xe8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d7 <main+0xa7>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <main+0x6e>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
je     114b <main+0xb>
mov    $0x1,%eax
ret
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x8(%rsi),%rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e83(%rip),%r12
cmp    (%r12),%eax
je     11a7 <main+0x67>
mov    %eax,%ebp
lea    0xe8c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
jne    11ae <main+0x6e>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe98(%rip),%rbx
lea    0xe9a(%rip),%r14
lea    0xe8c(%rip),%r15
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     119b <main+0x5b>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
jne    11c3 <main+0x83>
jmp    119b <main+0x5b>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [77 x i8] c"/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\0Aunsigned char %s[] =\0A{\0A\00"
@.str.1 = [7 x i8] c"0x%02x\00"
@.str.2 = [9 x i8] c", 0x%02x\00"
@.str.3 = [3 x i8] c",\0A\00"
@.str.4 = [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 i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 2, %9
br i1 %10, label %11, label %12
11: ; preds = %2
ret i32 1
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %8
%16 = call i32 (...) @getchar()
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %12
br label %52
21: ; preds = %12
%22 = load i8*, i8** %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %21, %48
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = call i32 (...) @getchar()
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %24
br label %50
32: ; preds = %24
store i32 0, i32* %7
br label %33
33: ; preds = %45, %32
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 15
br i1 %35, label %36, label %48
36: ; preds = %33
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = call i32 (...) @getchar()
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %44
43: ; preds = %36
br label %50
44: ; preds = %36
br label %45
45: ; preds = %44
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %33
48: ; preds = %33
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %24
50: ; preds = %43, %31
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50, %20
%53 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [77 x i8] c"/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\0Aunsigned char %s[] =\0A{\0A\00"
@.str.1 = [7 x i8] c"0x%02x\00"
@.str.2 = [9 x i8] c", 0x%02x\00"
@str = [2 x i8] c",\00"
@str.5 = [4 x i8] c"\0A};\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %5, label %4
4: ; preds = %2
ret i32 1
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 (...) @getchar()
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %101, label %11
11: ; preds = %5
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0), i8* %7)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%14 = tail call i32 (...) @getchar()
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
br i1 %16, label %99, label %17
17: ; preds = %11, %93
%18 = phi i32 [ %96, %93 ], [ %14, %11 ]
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = tail call i32 (...) @getchar()
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %99, label %23
23: ; preds = %17
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %99, label %28
28: ; preds = %23
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%30 = tail call i32 (...) @getchar()
%31 = load i32, i32* @EOF
%32 = icmp eq i32 %30, %31
br i1 %32, label %99, label %33
33: ; preds = %28
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%35 = tail call i32 (...) @getchar()
%36 = load i32, i32* @EOF
%37 = icmp eq i32 %35, %36
br i1 %37, label %99, label %38
38: ; preds = %33
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%40 = tail call i32 (...) @getchar()
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %99, label %43
43: ; preds = %38
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%45 = tail call i32 (...) @getchar()
%46 = load i32, i32* @EOF
%47 = icmp eq i32 %45, %46
br i1 %47, label %99, label %48
48: ; preds = %43
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %45)
%50 = tail call i32 (...) @getchar()
%51 = load i32, i32* @EOF
%52 = icmp eq i32 %50, %51
br i1 %52, label %99, label %53
53: ; preds = %48
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%55 = tail call i32 (...) @getchar()
%56 = load i32, i32* @EOF
%57 = icmp eq i32 %55, %56
br i1 %57, label %99, label %58
58: ; preds = %53
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %55)
%60 = tail call i32 (...) @getchar()
%61 = load i32, i32* @EOF
%62 = icmp eq i32 %60, %61
br i1 %62, label %99, label %63
63: ; preds = %58
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %60)
%65 = tail call i32 (...) @getchar()
%66 = load i32, i32* @EOF
%67 = icmp eq i32 %65, %66
br i1 %67, label %99, label %68
68: ; preds = %63
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%70 = tail call i32 (...) @getchar()
%71 = load i32, i32* @EOF
%72 = icmp eq i32 %70, %71
br i1 %72, label %99, label %73
73: ; preds = %68
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %70)
%75 = tail call i32 (...) @getchar()
%76 = load i32, i32* @EOF
%77 = icmp eq i32 %75, %76
br i1 %77, label %99, label %78
78: ; preds = %73
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %75)
%80 = tail call i32 (...) @getchar()
%81 = load i32, i32* @EOF
%82 = icmp eq i32 %80, %81
br i1 %82, label %99, label %83
83: ; preds = %78
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %80)
%85 = tail call i32 (...) @getchar()
%86 = load i32, i32* @EOF
%87 = icmp eq i32 %85, %86
br i1 %87, label %99, label %88
88: ; preds = %83
%89 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %85)
%90 = tail call i32 (...) @getchar()
%91 = load i32, i32* @EOF
%92 = icmp eq i32 %90, %91
br i1 %92, label %99, label %93
93: ; preds = %88
%94 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%95 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %90)
%96 = tail call i32 (...) @getchar()
%97 = load i32, i32* @EOF
%98 = icmp eq i32 %96, %97
br i1 %98, label %99, label %17
99: ; preds = %93, %17, %23, %28, %33, %38, %43, %48, %53, %58, %63, %68, %73, %78, %83, %88, %11
%100 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.5, i64 0, i64 0))
br label %101
101: ; preds = %5, %99
%102 = tail call i32 @exit(i32 0)
unreachable
}