#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();
double pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
int main() {
  printf("Test...\n");
  printf("eof = %d\n", EOF);
  printf("2 ** 5 = %f\n", pow(2, 5));
  int c;
  while ((c = getchar()) != EOF) {
    putchar(c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1060 <pow@plt>
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e46(%rip),%rcx
cmp    (%rcx),%eax
je     11b7 <main+0x77>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1191 <main+0x51>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e84(%rip),%rbx
mov    (%rbx),%esi
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1070 <pow@plt>
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     11b4 <main+0x64>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x50>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Test...\0A\00"
@.str.1 = [10 x i8] c"eof = %d\0A\00"
@EOF = global i32 0
@.str.2 = [13 x i8] c"2 ** 5 = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call double @pow(i32 2, i32 5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %6)
br label %8
8: ; preds = %12, %0
%9 = call i32 (...) @getchar()
store i32 %9, i32* %2
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %2
%14 = call i32 @putchar(i32 %13)
br label %8
15: ; preds = %8
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"eof = %d\0A\00"
@EOF = global i32 0
@.str.2 = [13 x i8] c"2 ** 5 = %f\0A\00"
@str = [8 x i8] c"Test...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EOF
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = tail call double @pow(i32 2, i32 5)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %4)
%6 = tail call i32 (...) @getchar()
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %15, label %9
9: ; preds = %0, %9
%10 = phi i32 [ %12, %9 ], [ %6, %0 ]
%11 = tail call i32 @putchar(i32 %10)
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %9
15: ; preds = %9, %0
ret i32 0
}