#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int main(void) {
  char name[51];
  char output[7] = "Hello ";
  printf("What is your name?: ");
  scanf("%s", name);
  strcat(output, name);
  printf("The combined string is: %s\n", output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x47(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x41(%rbp)
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x47(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x47(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movl   $0x206f6c,0xb(%rsp)
movl   $0x6c6c6548,0x8(%rsp)
6c
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
lea    0xe9f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.output = [7 x i8] c"Hello \00"
@.str = [21 x i8] c"What is your name?: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"The combined string is: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [51 x i8]
%3 = alloca [7 x i8]
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %3 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [51 x i8], [51 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [51 x i8], [51 x i8]* %2, i64 0, i64 0
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.output = [7 x i8] c"Hello \00"
@.str = [21 x i8] c"What is your name?: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"The combined string is: %s\0A\00"
define i32 @main() {
%1 = alloca [51 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [51 x i8], [51 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @strcat(i8* %4, i8* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret i32 0
}