#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 /*<<< orphan*/ contrivedLeak();
int /*<<< orphan*/ contrivedOverflow();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  setbuf(stdout, NULL);
  printf("What you give, you will get back\n");
  printf("==> white elephants: ");
  contrivedLeak();
  printf("\nYou're lucky numbers are 512 and 1024\n");
  contrivedOverflow();
  printf("\n\nWoah There\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
lea    0xea7(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <contrivedLeak@plt>
lea    0xeaa(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <contrivedOverflow@plt>
lea    0xebf(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <contrivedLeak@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <contrivedOverflow@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [34 x i8] c"What you give, you will get back\0A\00"
@.str.1 = [22 x i8] c"==> white elephants: \00"
@.str.2 = [40 x i8] c"\0AYou're lucky numbers are 512 and 1024\0A\00"
@.str.3 = [14 x i8] c"\0A\0AWoah There\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @stdout
%7 = call i32 @setbuf(i32 %6, i32* null)
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @contrivedLeak()
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (...) @contrivedOverflow()
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.1 = [22 x i8] c"==> white elephants: \00"
@str = [33 x i8] c"What you give, you will get back\00"
@str.4 = [39 x i8] c"\0AYou're lucky numbers are 512 and 1024\00"
@str.5 = [13 x i8] c"\0A\0AWoah There\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @setbuf(i32 %3, i32* null)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @contrivedLeak()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.4, i64 0, i64 0))
%9 = tail call i32 (...) @contrivedOverflow()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}