#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 *, ...);
void test3() {
  int **ptr;
  int i = 10;
  int *ptr2 = &i;
  ptr = &ptr2;
  printf("i == %d  == %d \n", **ptr, *ptr2);
  char *arr[3] = {"z", "s", "e"};
  char **p = arr;
  printf("%s\n", *p);
  for (int i = 0; i < 3; i++) {
    printf("*p[%d]->%s\n", i, *p);
    p++;
  }
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0xa,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2cad(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2caa(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2ca7(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    11cd <test3+0xbd>
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1191 <test3+0x81>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe97(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"i == %d == %d \0A\00"
@.str.1 = [2 x i8] c"z\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [2 x i8] c"e\00"
@__const.test3.arr = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [12 x i8] c"*p[%d]->%s\0A\00"
define void @test3() {
%1 = alloca i32**
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [3 x i8*]
%5 = alloca i8**
%6 = alloca i32
store i32 10, i32* %2
store i32* %2, i32** %3
store i32** %3, i32*** %1
%7 = load i32**, i32*** %1
%8 = load i32*, i32** %7
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = bitcast [3 x i8*]* %4 to i8*
%14 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 0
store i8** %14, i8*** %5
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %16)
store i32 0, i32* %6
br label %18
18: ; preds = %28, %0
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load i32, i32* %6
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %22, i8* %24)
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %5
br label %28
28: ; preds = %21
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %18
31: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"i == %d == %d \0A\00"
@.str.1 = [2 x i8] c"z\00"
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [2 x i8] c"e\00"
@.str.5 = [12 x i8] c"*p[%d]->%s\0A\00"
define void @test3() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}