#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, char const *, ...);
int /*<<< orphan*/ puts(char const *);
int main(void) {
  char words[81] = "I am a string in an array.";
  char greeting[] = "Hello"
                    " "
                    "world!";
  const char *pt1 = "Something is pointing at me.";
  const char *copy;
  char input[81];
  copy = pt1;
  puts("Here are some strings");
  puts("I am a symbolic string constant.");
  puts(greeting);
  puts(words);
  puts(pt1);
  words[8] = 'p';
  puts(words);
  printf("pt1 = %s, &pt1 = %p, value = %p\n", pt1, &pt1, pt1);
  printf("copy = %s, &copy = %p, value = %p\n", copy, &copy, copy);
  puts("Enter a string:");
  gets(input);
  printf("You entered '%s'\n", input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x51,%edx
call   1050 <memcpy@plt>
mov    0xee3(%rip),%rax
mov    %rax,-0x6d(%rbp)
mov    0xee1(%rip),%eax
mov    %eax,-0x65(%rbp)
mov    0xedc(%rip),%al
mov    %al,-0x61(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    -0x6d(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x78(%rbp),%rdi
call   1030 <puts@plt>
movb   $0x70,-0x58(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x78(%rbp),%rsi
mov    -0x78(%rbp),%rcx
lea    0xecc(%rip),%rdi
lea    -0x78(%rbp),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x80(%rbp),%rsi
mov    -0x80(%rbp),%rcx
lea    0xed3(%rip),%rdi
lea    -0x80(%rbp),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    -0xe0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0xe0(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
movaps 0xeff(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x70(%rsp)
movabs $0x21646c726f7720,%rax
mov    %rax,0x15(%rsp)
movabs $0x6f77206f6c6c6548,%rax
20 77 6f
mov    %rax,0x10(%rsp)
lea    0xebe(%rip),%rbx
mov    %rbx,0x8(%rsp)
mov    %rbx,(%rsp)
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movb   $0x70,0x28(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
lea    0x8(%rsp),%rdx
mov    %rbx,%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
mov    %rsp,%rdx
mov    %rbx,%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.words = [81 x i8] c"I am a string in an array.\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.greeting = [13 x i8] c"Hello world!\00"
@.str = [29 x i8] c"Something is pointing at me.\00"
@.str.1 = [22 x i8] c"Here are some strings\00"
@.str.2 = [33 x i8] c"I am a symbolic string constant.\00"
@.str.3 = [33 x i8] c"pt1 = %s, &pt1 = %p, value = %p\0A\00"
@.str.4 = [35 x i8] c"copy = %s, &copy = %p, value = %p\0A\00"
@.str.5 = [16 x i8] c"Enter a string:\00"
@.str.6 = [18 x i8] c"You entered '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
%3 = alloca [13 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [81 x i8]
store i32 0, i32* %1
%7 = bitcast [81 x i8]* %2 to i8*
%8 = bitcast [13 x i8]* %3 to i8*
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %4
%9 = load i8*, i8** %4
store i8* %9, i8** %5
%10 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%13 = call i32 @puts(i8* %12)
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%15 = call i32 @puts(i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @puts(i8* %16)
%18 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 8
store i8 112, i8* %18
%19 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
%21 = load i8*, i8** %4
%22 = load i8*, i8** %4
%23 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %21, i8** %4, i8* %22)
%24 = load i8*, i8** %5
%25 = load i8*, i8** %5
%26 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %24, i8** %5, i8* %25)
%27 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%28 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%29 = call i32 @gets(i8* %28)
%30 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%31 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %30)
ret i32 0
}

LLVM IR (-O2):
@__const.main.words = [81 x i8] c"I am a string in an array.\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.greeting = [13 x i8] c"Hello world!\00"
@.str = [29 x i8] c"Something is pointing at me.\00"
@.str.1 = [22 x i8] c"Here are some strings\00"
@.str.2 = [33 x i8] c"I am a symbolic string constant.\00"
@.str.3 = [33 x i8] c"pt1 = %s, &pt1 = %p, value = %p\0A\00"
@.str.4 = [35 x i8] c"copy = %s, &copy = %p, value = %p\0A\00"
@.str.5 = [16 x i8] c"Enter a string:\00"
@.str.6 = [18 x i8] c"You entered '%s'\0A\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = alloca [13 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [81 x i8]
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%8 = bitcast i8** %3 to i8*
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %3
%9 = bitcast i8** %4 to i8*
%10 = getelementptr inbounds [81 x i8], [81 x i8]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %4
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @puts(i8* %7)
%14 = call i32 @puts(i8* %6)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 8
store i8 112, i8* %16
%17 = call i32 @puts(i8* %6)
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @gets(i8* %10)
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %10)
ret i32 0
}