#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() {
  printf("Hello Wolrd!");
  char mytype[10] = {0};
  printf("the address of mytype: %p \nthe value of mytype:%s\n", mytype,
         mytype);
  printf("write a name: ");
  scanf("%s", mytype);
  printf("\nthe address of mytype: %p\nthe value of mytype:%s\n", mytype,
         mytype);
  printf("write a name: \n");
  scanf("%s", mytype);
  printf("\nthe address of mytype: %p\nthe value of mytype:%p %p %p\n", mytype,
         mytype, mytype + 0x01, &mytype[1]);
  printf("\n it seems that there is still things: %c%c%c\n", mytype[4],
         mytype[5], mytype[6]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    -0xe(%rbp),%rsi
lea    -0xe(%rbp),%rdx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xe(%rbp),%rsi
lea    -0xe(%rbp),%rdx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xe(%rbp),%rsi
lea    -0xe(%rbp),%rdx
lea    -0xe(%rbp),%rcx
add    $0x1,%rcx
lea    -0xe(%rbp),%r8
add    $0x1,%r8
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xa(%rbp),%esi
movsbl -0x9(%rbp),%edx
movsbl -0x8(%rbp),%ecx
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movw   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xeb0(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf6a(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebb(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0x1(%rsp),%rcx
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %rcx,%r8
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x4(%rsp),%esi
movsbl 0x5(%rsp),%edx
movsbl 0x6(%rsp),%ecx
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello Wolrd!\00"
@.str.1 = [51 x i8] c"the address of mytype: %p \0Athe value of mytype:%s\0A\00"
@.str.2 = [15 x i8] c"write a name: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [51 x i8] c"\0Athe address of mytype: %p\0Athe value of mytype:%s\0A\00"
@.str.5 = [16 x i8] c"write a name: \0A\00"
@.str.6 = [57 x i8] c"\0Athe address of mytype: %p\0Athe value of mytype:%p %p %p\0A\00"
@.str.7 = [47 x i8] c"\0A it seems that there is still things: %c%c%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [10 x i8]* %2 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8* %11, i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %17, i8* %18, i8* %20, i8* %21)
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 5
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 6
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i32 %25, i32 %28, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello Wolrd!\00"
@.str.1 = [51 x i8] c"the address of mytype: %p \0Athe value of mytype:%s\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [51 x i8] c"\0Athe address of mytype: %p\0Athe value of mytype:%s\0A\00"
@.str.6 = [57 x i8] c"\0Athe address of mytype: %p\0Athe value of mytype:%p %p %p\0A\00"
@.str.7 = [47 x i8] c"\0A it seems that there is still things: %c%c%c\0A\00"
@str = [15 x i8] c"write a name: \00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8* %3, i8* %3)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %3, i8* %3, i8* %10, i8* %10)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i32 %14, i32 %17, i32 %20)
ret i32 0
}