#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() {
  char c = 'c';
  char *str = &c;
  char *str2 = "hello world";
  char str4[] = "hello world2";
  char str5[] = {'h', 'e', 'l', 'l', 'o', '\0'};
  printf("str: %s\n", str);
  printf("str2: %s\n", str2);
  printf("str4: %s\n", str4);
  printf("str5: %s\n", str5);
  char **strs = &str;
  printf("strs: %s\n", (*strs));
  char *strs2[] = {"hello", "world"};
  printf("(*strs2): %s\n", (*strs2));
  printf("strs2[0]: %s\n", strs2[0]);
  printf("strs2[1]: %s\n", strs2[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x63,-0x5(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x25(%rbp)
mov    0xecd(%rip),%eax
mov    %eax,-0x1d(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x19(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x2b(%rbp)
mov    0xeba(%rip),%ax
mov    %ax,-0x27(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x25(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x2b(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    0x2c47(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c44(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movb   $0x63,0xf(%rsp)
movabs $0x32646c726f7720,%rax
mov    %rax,0x1d(%rsp)
movabs $0x6f77206f6c6c6568,%rax
20 77 6f
mov    %rax,0x18(%rsp)
movw   $0x6f,0x14(%rsp)
movl   $0x6c6c6568,0x10(%rsp)
6c
lea    0xefa(%rip),%r14
lea    0xec2(%rip),%rdi
lea    0xf(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0xe8e(%rip),%rsi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    0x18(%rsp),%rsi
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    0xe32(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
@__const.main.str4 = [13 x i8] c"hello world2\00"
@__const.main.str5 = [6 x i8] c"hello\00"
@.str.1 = [9 x i8] c"str: %s\0A\00"
@.str.2 = [10 x i8] c"str2: %s\0A\00"
@.str.3 = [10 x i8] c"str4: %s\0A\00"
@.str.4 = [10 x i8] c"str5: %s\0A\00"
@.str.5 = [10 x i8] c"strs: %s\0A\00"
@.str.6 = [6 x i8] c"hello\00"
@.str.7 = [6 x i8] c"world\00"
@__const.main.strs2 = [2 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0)]
@.str.8 = [14 x i8] c"(*strs2): %s\0A\00"
@.str.9 = [14 x i8] c"strs2[0]: %s\0A\00"
@.str.10 = [14 x i8] c"strs2[1]: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [13 x i8]
%6 = alloca [6 x i8]
%7 = alloca i8**
%8 = alloca [2 x i8*]
store i32 0, i32* %1
store i8 99, i8* %2
store i8* %2, i8** %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %4
%9 = bitcast [13 x i8]* %5 to i8*
%10 = bitcast [6 x i8]* %6 to i8*
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %4
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %17)
store i8** %3, i8*** %7
%19 = load i8**, i8*** %7
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %20)
%22 = bitcast [2 x i8*]* %8 to i8*
%23 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8* %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
@__const.main.str4 = [13 x i8] c"hello world2\00"
@.str.1 = [9 x i8] c"str: %s\0A\00"
@.str.2 = [10 x i8] c"str2: %s\0A\00"
@.str.3 = [10 x i8] c"str4: %s\0A\00"
@.str.4 = [10 x i8] c"str5: %s\0A\00"
@.str.5 = [10 x i8] c"strs: %s\0A\00"
@.str.6 = [6 x i8] c"hello\00"
@.str.7 = [6 x i8] c"world\00"
@.str.8 = [14 x i8] c"(*strs2): %s\0A\00"
@.str.9 = [14 x i8] c"strs2[0]: %s\0A\00"
@.str.10 = [14 x i8] c"strs2[1]: %s\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [13 x i8]
%3 = alloca [6 x i8]
store i8 99, i8* %1
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}