#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*/ islandPerimeter(int **, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 10;
  int *pInt;
  int **ppInt;
  int **ppInt2;
  ppInt2 = (int **)malloc(sizeof(int));
  pInt = &i;
  ppInt = &pInt;
  ppInt2 = &pInt;
  printf("%d\n", i);
  printf("%d\n", *pInt);
  printf("%d\n", **ppInt);
  printf("%d\n", **ppInt2);
  islandPerimeter(ppInt, 10, 20);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1050 <islandPerimeter@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0x4(%rsp)
mov    $0x4,%edi
call   1040 <malloc@plt>
lea    0x4(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1050 <islandPerimeter@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32**
%5 = alloca i32**
store i32 0, i32* %1
store i32 10, i32* %2
%6 = call i64 @malloc(i32 4)
%7 = inttoptr i64 %6 to i32**
store i32** %7, i32*** %5
store i32* %2, i32** %3
store i32** %3, i32*** %4
store i32** %3, i32*** %5
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32**, i32*** %4
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32**, i32*** %5
%18 = load i32*, i32** %17
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32**, i32*** %4
%22 = call i32 @islandPerimeter(i32** %21, i32 10, i32 20)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%4 = bitcast i32** %2 to i8*
%5 = tail call i64 @malloc(i32 4)
store i32* %1, i32** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @islandPerimeter(i32** %2, i32 10, i32 20)
ret i32 0
}