#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 *str = "hello world";
  char *str2 = "hello c";
  char *arr[20] = {str, str2};
  char **arr2 = arr;
  printf("%s\n", str);
  char **pStr = &str;
  char ***ppStr = &pStr;
  printf("%s\n", *pStr);
  printf("%s\n", pStr[0]);
  printf("%s-%s\n", arr[0], arr[1]);
  printf("%s-%s\n", arr2[0], arr2[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec8(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0xa0,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0xc0(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rax
mov    %rax,-0xd0(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0xd0(%rbp),%rax
mov    (%rax),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xd0(%rbp),%rax
mov    (%rax),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc0(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc8(%rbp),%rax
mov    (%rax),%rsi
mov    -0xc8(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xefb(%rip),%r14
lea    0xedd(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec3(%rip),%r14
lea    0xeb4(%rip),%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
@.str.1 = [8 x i8] c"hello c\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [7 x i8] c"%s-%s\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}