#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 /*<<< orphan*/ printval(int);
main(int argc, char **argv) {
  int val;
  int size = 0;
  unsigned char c;
  printf("gcc2_compiled.:\n");
  printf("__gnu_compiled_c:\n");
  printf("\t.globl linux_compressed_start\n");
  printf("\t.text\n");
  printf("\t.align 2\n");
  printf("\t.type linux_compressed_start,@object\n");
  printf("linux_compressed_start:\n");
  val = getchar();
  while (val != EOF) {
    size++;
    c = (unsigned char)(val & 0x00ff);
    printf("\t.byte  ");
    printval((int)c);
    printf("\n");
    val = getchar();
  }
  printf("\t.size linux_compressed_start,%d\n", size);
  printf("\t.globl linux_compressed_size\n");
  printf("\t.text\n");
  printf("\t.align 2\n");
  printf("\t.type linux_compressed_size,@object\n");
  printf("\t.size linux_compressed_size,4\n");
  printf("linux_compressed_size:\n");
  printf("\t.word %d\n", size);
}


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,-0x18(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%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
je     1213 <main+0xe3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x19(%rbp)
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x19(%rbp),%edi
call   1050 <printval@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
jmp    11b9 <main+0x89>
mov    -0x18(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
lea    0xf51(%rip),%rdi
call   1040 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xedd(%rip),%rdi
call   1040 <puts@plt>
lea    0xef7(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e2d(%rip),%r15
cmp    (%r15),%eax
je     11fe <main+0xae>
mov    %eax,%ebp
lea    0xe37(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl %bpl,%edi
call   1070 <printval@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
cmp    (%r15),%eax
jne    11d0 <main+0x80>
lea    0xe04(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xed7(%rip),%rdi
call   1040 <puts@plt>
lea    0xdce(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"gcc2_compiled.:\0A\00"
@.str.1 = [19 x i8] c"__gnu_compiled_c:\0A\00"
@.str.2 = [32 x i8] c"\09.globl linux_compressed_start\0A\00"
@.str.3 = [8 x i8] c"\09.text\0A\00"
@.str.4 = [11 x i8] c"\09.align 2\0A\00"
@.str.5 = [39 x i8] c"\09.type linux_compressed_start,@object\0A\00"
@.str.6 = [25 x i8] c"linux_compressed_start:\0A\00"
@EOF = global i32 0
@.str.7 = [9 x i8] c"\09.byte \00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [34 x i8] c"\09.size linux_compressed_start,%d\0A\00"
@.str.10 = [31 x i8] c"\09.globl linux_compressed_size\0A\00"
@.str.11 = [38 x i8] c"\09.type linux_compressed_size,@object\0A\00"
@.str.12 = [32 x i8] c"\09.size linux_compressed_size,4\0A\00"
@.str.13 = [24 x i8] c"linux_compressed_size:\0A\00"
@.str.14 = [11 x i8] c"\09.word %d\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
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 (...) @getchar()
store i32 %16, i32* %6
br label %17
17: ; preds = %21, %2
%18 = load i32, i32* %6
%19 = load i32, i32* @EOF
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %33
21: ; preds = %17
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = and i32 %24, 255
%26 = trunc i32 %25 to i8
store i8 %26, i8* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%28 = load i8, i8* %8
%29 = zext i8 %28 to i32
%30 = call i32 @printval(i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%32 = call i32 (...) @getchar()
store i32 %32, i32* %6
br label %17
33: ; preds = %17
%34 = load i32, i32* %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%42 = load i32, i32* %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.7 = [9 x i8] c"\09.byte \00"
@.str.9 = [34 x i8] c"\09.size linux_compressed_start,%d\0A\00"
@.str.14 = [11 x i8] c"\09.word %d\0A\00"
@str = [16 x i8] c"gcc2_compiled.:\00"
@str.15 = [18 x i8] c"__gnu_compiled_c:\00"
@str.16 = [31 x i8] c"\09.globl linux_compressed_start\00"
@str.19 = [38 x i8] c"\09.type linux_compressed_start,@object\00"
@str.20 = [24 x i8] c"linux_compressed_start:\00"
@str.21 = [30 x i8] c"\09.globl linux_compressed_size\00"
@str.22 = [7 x i8] c"\09.text\00"
@str.23 = [10 x i8] c"\09.align 2\00"
@str.24 = [37 x i8] c"\09.type linux_compressed_size,@object\00"
@str.25 = [31 x i8] c"\09.size linux_compressed_size,4\00"
@str.26 = [23 x i8] c"linux_compressed_size:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.15, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.22, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.23, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %24, label %13
13: ; preds = %2, %13
%14 = phi i32 [ %21, %13 ], [ %10, %2 ]
%15 = phi i32 [ %16, %13 ], [ 0, %2 ]
%16 = add nuw nsw i32 %15, 1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%18 = and i32 %14, 255
%19 = tail call i32 @printval(i32 %18)
%20 = tail call i32 @putchar(i32 10)
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %13
24: ; preds = %13, %2
%25 = phi i32 [ 0, %2 ], [ %16, %13 ]
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.21, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.22, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.23, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.24, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.25, i64 0, i64 0))
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.26, i64 0, i64 0))
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i32 %25)
ret i32 0
}