#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 *, char *);
int main(void) {
  char *pointer = "String pointer";
  printf("%s\n", pointer);
  char array[] = "String array";
  printf("%s\n", array);
  array[0] = 'J';
  printf("%s\n", array);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    0xed2(%rip),%rax
mov    %rax,-0x1d(%rbp)
mov    0xed0(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xecb(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x1d(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
movb   $0x4a,-0x1d(%rbp)
lea    -0x1d(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xef1(%rip),%rbx
lea    0xedb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
movabs $0x79617272612067,%rax
mov    %rax,0xd(%rsp)
movabs $0x6120676e69727453,%rax
67 20 61
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
movb   $0x4a,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"String pointer\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@__const.main.array = [13 x i8] c"String array\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [13 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = bitcast [13 x i8]* %3 to i8*
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
store i8 74, i8* %9
%10 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"String pointer\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@__const.main.array = [13 x i8] c"String array\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
store i8 74, i8* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}