#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 main() {
  int i;
  char *s = "Hello, World!";
  char *s2 = "Hello, World!";
  char s3[] = "Hello, World!";
  printf("&i = %p\n", &i);
  printf("*s = %p\n", s);
  printf("*s2 = %p\n", s2);
  printf("*s3 = %p\n", s3);
  printf("s3 = %s\n\n", s3);
  s3[0] = 'B';
  printf("Change s3[0] to B\n\n");
  printf("s3' = %s\n", s3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecf(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x26(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x1e(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x1a(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x26(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x26(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x42,-0x26(%rbp)
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x26(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x21646c726f5720,%rax
mov    %rax,0xe(%rsp)
movabs $0x57202c6f6c6c6548,%rax
2c 20 57
mov    %rax,0x8(%rsp)
lea    0xeb6(%rip),%rbx
lea    0xebd(%rip),%rdi
lea    0x1c(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x42,0x8(%rsp)
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    0xe80(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, World!\00"
@__const.main.s3 = [14 x i8] c"Hello, World!\00"
@.str.1 = [9 x i8] c"&i = %p\0A\00"
@.str.2 = [9 x i8] c"*s = %p\0A\00"
@.str.3 = [10 x i8] c"*s2 = %p\0A\00"
@.str.4 = [10 x i8] c"*s3 = %p\0A\00"
@.str.5 = [10 x i8] c"s3 = %s\0A\0A\00"
@.str.6 = [20 x i8] c"Change s3[0] to B\0A\0A\00"
@.str.7 = [10 x i8] c"s3' = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [14 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %4
%6 = bitcast [14 x i8]* %5 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
store i8 66, i8* %16
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%18 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s3 = [14 x i8] c"Hello, World!\00"
@.str.1 = [9 x i8] c"&i = %p\0A\00"
@.str.2 = [9 x i8] c"*s = %p\0A\00"
@.str.3 = [10 x i8] c"*s2 = %p\0A\00"
@.str.4 = [10 x i8] c"*s3 = %p\0A\00"
@.str.5 = [10 x i8] c"s3 = %s\0A\0A\00"
@.str.7 = [10 x i8] c"s3' = %s\0A\00"
@str = [19 x i8] c"Change s3[0] to B\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__const.main.s3, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__const.main.s3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %4)
store i8 66, i8* %4
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %4)
ret i32 0
}