#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char const **argv) {
  int ch = 0;
  int col = 0;
  if (2 != argc) {
    fprintf(stderr, "Usage: %s dataName\n", argv[0]);
  }
  puts("/* auto-generated code - edit at your own risk! (Good luck with that!) "
       "*/");
  printf("static const char %s[] = {\n", argv[1]);
  while (EOF != (ch = getchar())) {
    printf("%d, ", ch);
    if (0 == (++col % 128)) {
      putchar('\n');
      col = 0;
    }
  }
  puts("\n0};");
  return 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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     119e <main+0x4e>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe67(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
mov    %ecx,-0x14(%rbp)
cmp    %ecx,%eax
je     1225 <main+0xd5>
mov    -0x14(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x80,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    1220 <main+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x18(%rbp)
jmp    11c0 <main+0x70>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1177 <main+0x27>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe8e(%rip),%rsi
call   1070 <fprintf@plt>
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rbx),%rsi
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e4c(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    %eax,%ebx
jne    11c3 <main+0x73>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xeb0(%rip),%r15
xor    %ebp,%ebp
jmp    11de <main+0x8e>
xchg   %ax,%ax
mov    (%r14),%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    %eax,%ebx
je     11aa <main+0x5a>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
test   $0x7f,%bpl
jne    11d0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    11d0 <main+0x80>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s dataName\0A\00"
@.str.1 = [74 x i8] c"/* auto-generated code - edit at your own risk! (Good luck with that!) */\00"
@.str.2 = [28 x i8] c"static const char %s[] = {\0A\00"
@EOF = global i32 0
@.str.3 = [5 x i8] c"%d, \00"
@.str.4 = [5 x i8] c"\0A0};\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 2, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %10, %2
%17 = call i32 @puts(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %35, %16
%23 = load i32, i32* @EOF
%24 = call i32 (...) @getchar()
store i32 %24, i32* %6
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
%31 = srem i32 %30, 128
%32 = icmp eq i32 0, %31
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %7
br label %35
35: ; preds = %33, %26
br label %22
36: ; preds = %22
%37 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s dataName\0A\00"
@.str.1 = [74 x i8] c"/* auto-generated code - edit at your own risk! (Good luck with that!) */\00"
@.str.2 = [28 x i8] c"static const char %s[] = {\0A\00"
@EOF = global i32 0
@.str.3 = [5 x i8] c"%d, \00"
@.str.4 = [5 x i8] c"\0A0};\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %4, %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @EOF
%14 = tail call i32 (...) @getchar()
%15 = icmp eq i32 %13, %14
br i1 %15, label %30, label %16
16: ; preds = %8, %25
%17 = phi i32 [ %28, %25 ], [ %14, %8 ]
%18 = phi i32 [ %26, %25 ], [ 0, %8 ]
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%20 = add nsw i32 %18, 1
%21 = and i32 %20, 127
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = tail call i32 @putchar(i8 signext 10)
br label %25
25: ; preds = %23, %16
%26 = phi i32 [ 0, %23 ], [ %20, %16 ]
%27 = load i32, i32* @EOF
%28 = tail call i32 (...) @getchar()
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %16
30: ; preds = %25, %8
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}