#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int main(void) {
  printf("Hello, what is your name?\n");
  char name[100];
  int age;
  scanf("%s", &name);
  printf("Hello %s\n", name);
  printf("How Old are you?\n");
  scanf("%i", &age);
  if (age > 30)
    printf("Grumpy old geezer!");
  else
    printf("Hey young fellow!");
  fflush(stdin);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x74(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x1e,-0x74(%rbp)
jle    11c1 <main+0x81>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cf <main+0x8f>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x1f,0xc(%rsp)
lea    0xe5a(%rip),%rax
lea    0xe66(%rip),%rdi
cmovge %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Hello, what is your name?\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"Hello %s\0A\00"
@.str.3 = [18 x i8] c"How Old are you?\0A\00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [19 x i8] c"Grumpy old geezer!\00"
@.str.6 = [18 x i8] c"Hey young fellow!\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [100 x i8]* %2)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 30
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* @stdin
%18 = call i32 @fflush(i32 %17)
%19 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"Hello %s\0A\00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [19 x i8] c"Grumpy old geezer!\00"
@.str.6 = [18 x i8] c"Hey young fellow!\00"
@stdin = global i32 0
@str = [26 x i8] c"Hello, what is your name?\00"
@str.7 = [17 x i8] c"How Old are you?\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [100 x i8]* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 30
%12 = select i1 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12)
%14 = load i32, i32* @stdin
%15 = call i32 @fflush(i32 %14)
%16 = call i32 (...) @getchar()
ret i32 0
}