#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(void) {
  char str1[] = "hello world!";
  char str2[] = "hello c!";
  const char *p = str1;
  char *const q = str2;
  int const i = 1;
  int k = 2;
  const int *j = &i;
  j = &k;
  q[0] = 'H';
  printf("p = %s\n", p);
  printf("q = %s\n", q);
  printf("i = %d\n", i);
  printf("j = %d\n", *j);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xeda(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x16(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0xe(%rbp)
lea    -0xd(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movb   $0x48,(%rax)
mov    -0x20(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movabs $0x21646c726f7720,%rax
mov    %rax,0x1d(%rsp)
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,0x18(%rsp)
movabs $0x2163206f6c6c6568,%rax
20 63 21
mov    %rax,0x8(%rsp)
movb   $0x0,0x10(%rsp)
movb   $0x48,0x8(%rsp)
lea    0xec4(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.str1 = [13 x i8] c"hello world!\00"
@__const.main.str2 = [9 x i8] c"hello c!\00"
@.str = [8 x i8] c"p = %s\0A\00"
@.str.1 = [8 x i8] c"q = %s\0A\00"
@.str.2 = [8 x i8] c"i = %d\0A\00"
@.str.3 = [8 x i8] c"j = %d\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [9 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = bitcast [13 x i8]* %1 to i8*
%9 = bitcast [9 x i8]* %2 to i8*
%10 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
store i8* %10, i8** %3
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
store i8* %11, i8** %4
store i32 1, i32* %5
store i32 2, i32* %6
store i32* %5, i32** %7
store i32* %6, i32** %7
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 72, i8* %13
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 1)
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [13 x i8] c"hello world!\00"
@__const.main.str2 = [9 x i8] c"hello c!\00"
@.str = [8 x i8] c"p = %s\0A\00"
@.str.1 = [8 x i8] c"q = %s\0A\00"
@.str.2 = [8 x i8] c"i = %d\0A\00"
@.str.3 = [8 x i8] c"j = %d\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
store i8 72, i8* %4
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 2)
ret i32 0
}