#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*/ PrintChar(char);
int /*<<< orphan*/ PrintInt(int);
int /*<<< orphan*/ PrintString(char *);
int /*<<< orphan*/ Printf(char *, int, int, int, char);
int /*<<< orphan*/ ReadString(char *, int);
int /*<<< orphan*/ Scanf(char *, ...);
scalar_t__ alloc(int);
int main() {
  char *namePtr = (char *)alloc(sizeof(char) * 40);
  PrintString("Input Your Name Please : \n");
  ReadString(namePtr, 40);
  PrintString("Hello ");
  PrintString(namePtr);
  PrintChar('\n');
  PrintString("Input a Number : ");
  int a;
  Scanf("%d", &a);
  int b = a * a;
  PrintString("Square of ");
  PrintInt(a);
  PrintString(" is ");
  PrintInt(b);
  PrintChar('\n');
  char c;
  Scanf("%c", &c);
  Printf("%d %d %d %c Hello World\n", 1, 2, 3, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x28,%edi
call   1060 <alloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe6c(%rip),%rdi
call   1090 <PrintString@plt>
mov    -0x10(%rbp),%rdi
mov    $0x28,%esi
call   1050 <ReadString@plt>
lea    0xe6d(%rip),%rdi
call   1090 <PrintString@plt>
mov    -0x10(%rbp),%rdi
call   1090 <PrintString@plt>
mov    $0xa,%edi
call   1040 <PrintChar@plt>
lea    0xe55(%rip),%rdi
call   1090 <PrintString@plt>
lea    0xe5b(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1080 <Scanf@plt>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xe42(%rip),%rdi
call   1090 <PrintString@plt>
mov    -0x14(%rbp),%edi
call   1070 <PrintInt@plt>
lea    0xe39(%rip),%rdi
call   1090 <PrintString@plt>
mov    -0x18(%rbp),%edi
call   1070 <PrintInt@plt>
mov    $0xa,%edi
call   1040 <PrintChar@plt>
lea    0xe20(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1080 <Scanf@plt>
lea    0xe11(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
movsbl -0x19(%rbp),%r8d
call   1030 <Printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x28,%edi
call   1060 <alloc@plt>
mov    %rax,%rbx
lea    0xe77(%rip),%rdi
call   1090 <PrintString@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1050 <ReadString@plt>
lea    0xe79(%rip),%rdi
call   1090 <PrintString@plt>
mov    %rbx,%rdi
call   1090 <PrintString@plt>
mov    $0xa,%edi
call   1040 <PrintChar@plt>
lea    0xe62(%rip),%rdi
call   1090 <PrintString@plt>
lea    0xe68(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1080 <Scanf@plt>
mov    0xc(%rsp),%ebx
imul   %ebx,%ebx
lea    0xe51(%rip),%rdi
call   1090 <PrintString@plt>
mov    0xc(%rsp),%edi
call   1070 <PrintInt@plt>
lea    0xe47(%rip),%rdi
call   1090 <PrintString@plt>
mov    %ebx,%edi
call   1070 <PrintInt@plt>
mov    $0xa,%edi
call   1040 <PrintChar@plt>
lea    0xe2f(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   1080 <Scanf@plt>
movsbl 0xb(%rsp),%r8d
lea    0xe19(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <Printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Input Your Name Please : \0A\00"
@.str.1 = [7 x i8] c"Hello \00"
@.str.2 = [18 x i8] c"Input a Number : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [11 x i8] c"Square of \00"
@.str.5 = [5 x i8] c" is \00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [25 x i8] c"%d %d %d %c Hello World\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
%6 = call i64 @alloc(i32 40)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %2
%8 = call i32 @PrintString(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i32 @ReadString(i8* %9, i32 40)
%11 = call i32 @PrintString(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %2
%13 = call i32 @PrintString(i8* %12)
%14 = call i32 @PrintChar(i8 signext 10)
%15 = call i32 @PrintString(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @Scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = load i32, i32* %3
%19 = mul nsw i32 %17, %18
store i32 %19, i32* %4
%20 = call i32 @PrintString(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32, i32* %3
%22 = call i32 @PrintInt(i32 %21)
%23 = call i32 @PrintString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* %4
%25 = call i32 @PrintInt(i32 %24)
%26 = call i32 @PrintChar(i8 signext 10)
%27 = call i32 (i8*, ...) @Scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %5)
%28 = load i8, i8* %5
%29 = call i32 @Printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 1, i32 2, i32 3, i8 signext %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Input Your Name Please : \0A\00"
@.str.1 = [7 x i8] c"Hello \00"
@.str.2 = [18 x i8] c"Input a Number : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [11 x i8] c"Square of \00"
@.str.5 = [5 x i8] c" is \00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [25 x i8] c"%d %d %d %c Hello World\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = tail call i64 @alloc(i32 40)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @PrintString(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @ReadString(i8* %4, i32 40)
%7 = tail call i32 @PrintString(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @PrintString(i8* %4)
%9 = tail call i32 @PrintChar(i8 signext 10)
%10 = tail call i32 @PrintString(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%11 = bitcast i32* %1 to i8*
%12 = call i32 (i8*, ...) @Scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = mul nsw i32 %13, %13
%15 = call i32 @PrintString(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = call i32 @PrintInt(i32 %16)
%18 = call i32 @PrintString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @PrintInt(i32 %14)
%20 = call i32 @PrintChar(i8 signext 10)
%21 = call i32 (i8*, ...) @Scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%22 = load i8, i8* %2
%23 = call i32 @Printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 1, i32 2, i32 3, i8 signext %22)
ret i32 0
}