#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int c, i = 0;
  printf("#ifdef HAVE_CONFIG_H\n");
  printf("# include \"config.h\"\n");
  printf("#endif\n\n");
  printf("#ifdef EMBED\n");
  printf("unsigned char flash_data[] = {\n");
  while ((c = getchar()) != EOF) {
    printf("0x%.2x, ", c);
    if (!(i % 32))
      printf("\n");
    i++;
  }
  printf(" };\n");
  printf("#endif\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e5b(%rip),%rcx
cmp    (%rcx),%eax
je     11d6 <main+0xb6>
mov    -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c8 <main+0xa8>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117c <main+0x5c>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
lea    0xec7(%rip),%rdi
call   1040 <puts@plt>
lea    0xed0(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e5a(%rip),%r14
cmp    (%r14),%eax
jne    11b2 <main+0x72>
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe47(%rip),%rbx
xor    %ebp,%ebp
jmp    11cf <main+0x8f>
nopl   (%rax)
add    $0x1,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%r14),%eax
je     1193 <main+0x53>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   $0x1f,%bpl
jne    11c0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11c0 <main+0x80>

LLVM IR (-O0):
@.str = [22 x i8] c"#ifdef HAVE_CONFIG_H\0A\00"
@.str.1 = [22 x i8] c"# include \22config.h\22\0A\00"
@.str.2 = [9 x i8] c"#endif\0A\0A\00"
@.str.3 = [14 x i8] c"#ifdef EMBED\0A\00"
@.str.4 = [32 x i8] c"unsigned char flash_data[] = {\0A\00"
@EOF = global i32 0
@.str.5 = [9 x i8] c"0x%.2x, \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [5 x i8] c" };\0A\00"
@.str.8 = [8 x i8] c"#endif\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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %9
9: ; preds = %21, %0
%10 = call i32 (...) @getchar()
store i32 %10, i32* %2
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %24
13: ; preds = %9
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = srem i32 %16, 32
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %19, %13
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.5 = [9 x i8] c"0x%.2x, \00"
@str = [21 x i8] c"#ifdef HAVE_CONFIG_H\00"
@str.9 = [21 x i8] c"# include \22config.h\22\00"
@str.10 = [8 x i8] c"#endif\0A\00"
@str.11 = [13 x i8] c"#ifdef EMBED\00"
@str.12 = [31 x i8] c"unsigned char flash_data[] = {\00"
@str.13 = [4 x i8] c" };\00"
@str.14 = [7 x i8] c"#endif\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.12, i64 0, i64 0))
%6 = tail call i32 (...) @getchar()
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %22, label %9
9: ; preds = %0, %17
%10 = phi i32 [ %19, %17 ], [ %6, %0 ]
%11 = phi i32 [ %18, %17 ], [ 0, %0 ]
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%13 = and i32 %11, 31
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 @putchar(i32 10)
br label %17
17: ; preds = %15, %9
%18 = add nuw nsw i32 %11, 1
%19 = tail call i32 (...) @getchar()
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %9
22: ; preds = %17, %0
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.13, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}