#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 main() {
  char name[] = "Adam";
  char sentence[] = "This is a sentence and a test of string representation.";
  char nameInput[20];
  printf("%c\n", name[0]);
  printf("%s\n", name);
  printf("%s\n", sentence);
  printf("Please enter your name: ");
  scanf("%s", &nameInput);
  printf("Nice to meet you %s.", nameInput);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xee4(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
movsbl -0x9(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x9(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe71(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x6d616441,0x8(%rsp)
6d
movaps 0xf17(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x2e6e6f69746174,%rax
mov    %rax,0x40(%rsp)
lea    0xe89(%rip),%rdi
mov    $0x41,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe71(%rip),%rdi
lea    0x50(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xe60(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.name = [5 x i8] c"Adam\00"
@__const.main.sentence = [56 x i8] c"This is a sentence and a test of string representation.\00"
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [25 x i8] c"Please enter your name: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [21 x i8] c"Nice to meet you %s.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [56 x i8]
%4 = alloca [20 x i8]
store i32 0, i32* %1
%5 = bitcast [5 x i8]* %2 to i8*
%6 = bitcast [56 x i8]* %3 to i8*
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [56 x i8], [56 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%16 = bitcast [20 x i8]* %4 to i8**
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.name = [5 x i8] c"Adam\00"
@__const.main.sentence = [56 x i8] c"This is a sentence and a test of string representation.\00"
@.str = [4 x i8] c"%c\0A\00"
@.str.2 = [25 x i8] c"Please enter your name: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [21 x i8] c"Nice to meet you %s.\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [56 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [56 x i8], [56 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 65)
%8 = call i32 @puts(i8* %4)
%9 = call i32 @puts(i8* %5)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%11 = bitcast [20 x i8]* %3 to i8**
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %6)
ret i32 0
}