#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*/ ln();
int /*<<< orphan*/ printInt(int);
int /*<<< orphan*/ printStr(char *);
int /*<<< orphan*/ readInt(int);
int /*<<< orphan*/ readStr(char *, int);
void main() {
  int age;
  char name[20];
  printStr("name? ");
  readStr(name, 20);
  printStr("age? ");
  readInt(age);
  printStr("Welcome, ");
  printStr(name);
  printStr(", ");
  printInt(age);
  printStr(" :-)");
  ln();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
call   1040 <printStr@plt>
lea    -0x20(%rbp),%rdi
mov    $0x14,%esi
call   1070 <readStr@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printStr@plt>
mov    -0x4(%rbp),%edi
call   1050 <readInt@plt>
lea    0xe80(%rip),%rdi
call   1040 <printStr@plt>
lea    -0x20(%rbp),%rdi
call   1040 <printStr@plt>
lea    0xe72(%rip),%rdi
call   1040 <printStr@plt>
mov    -0x4(%rbp),%edi
call   1030 <printInt@plt>
lea    0xe61(%rip),%rdi
call   1040 <printStr@plt>
mov    $0x0,%al
call   1060 <ln@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xea4(%rip),%rdi
call   1040 <printStr@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1070 <readStr@plt>
lea    0xe8f(%rip),%rdi
call   1040 <printStr@plt>
call   1050 <readInt@plt>
lea    0xe84(%rip),%rdi
call   1040 <printStr@plt>
mov    %rbx,%rdi
call   1040 <printStr@plt>
lea    0xe77(%rip),%rdi
call   1040 <printStr@plt>
call   1030 <printInt@plt>
lea    0xe69(%rip),%rdi
call   1040 <printStr@plt>
xor    %eax,%eax
call   1060 <ln@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"name? \00"
@.str.1 = [6 x i8] c"age? \00"
@.str.2 = [10 x i8] c"Welcome, \00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [5 x i8] c" :-)\00"
define void @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = call i32 @printStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @readStr(i8* %4, i32 20)
%6 = call i32 @printStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = call i32 @readInt(i32 %7)
%9 = call i32 @printStr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = call i32 @printStr(i8* %10)
%12 = call i32 @printStr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = call i32 @printInt(i32 %13)
%15 = call i32 @printStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (...) @ln()
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"name? \00"
@.str.1 = [6 x i8] c"age? \00"
@.str.2 = [10 x i8] c"Welcome, \00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [5 x i8] c" :-)\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @readStr(i8* %2, i32 20)
%5 = call i32 @printStr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @readInt(i32 undef)
%7 = call i32 @printStr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printStr(i8* %2)
%9 = call i32 @printStr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printInt(i32 undef)
%11 = call i32 @printStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (...) @ln()
ret void
}