#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*/ flushall();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void main() {
  char name[7] = {'R', 'o', 'b', 'e', 'r', 't', '\0'};
  puts(name);
  printf("\n\n");
  scanf("%s", name);
  printf("%s\n", name);
  printf("\n\n");
  strcpy(name, "Philip");
  printf("%s\n", name);
  printf("\n\n");
  *(name + 5) = 'a';
  printf("%s\n", name);
  strcpy(name, "Philip");
  printf("%s\n", name);
  flushall();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xe92(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xe8c(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xe84(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x7(%rbp),%rdi
call   1040 <puts@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x7(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x7(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x7(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x7(%rbp),%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movb   $0x61,-0x2(%rbp)
lea    -0x7(%rbp),%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x7(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x7(%rbp),%rsi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <flushall@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x747265,0xb(%rsp)
movl   $0x65626f52,0x8(%rsp)
65
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe94(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe5f(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
movb   $0x61,0xd(%rsp)
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <flushall@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.name = [7 x i8] c"Robert\00"
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [7 x i8] c"Philip\00"
define void @main() {
%1 = alloca [7 x i8]
%2 = bitcast [7 x i8]* %1 to i8*
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = call i32 @puts(i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %1, 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]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 5
store i8 97, i8* %17
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = call i32 (...) @flushall()
%25 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@__const.main.name = [7 x i8] c"Robert\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [7 x i8] c"Philip\00"
@str.5 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @puts(i8* %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @puts(i8* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%8 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @puts(i8* %2)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 5
store i8 97, i8* %11
%12 = call i32 @puts(i8* %2)
%13 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @puts(i8* %2)
%15 = call i32 (...) @flushall()
%16 = call i32 (...) @getchar()
ret void
}