#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 */
typedef int **i;

/* Variables and functions */
int /*<<< orphan*/ getchar();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int **i;
  int *a1, *a2, *a3, *a4;
  int b1, b2, b3, b4;
  b1 = 11;
  b2 = 15;
  b3 = 19;
  b4 = 23;
  a1 = &b1;
  a2 = &b2;
  a3 = &b3;
  a4 = &b4;
  i = (int **)malloc(sizeof(int *));
  *i = a1;
  *(i + 1) = a2;
  *(i + 2) = a3;
  printf("%d\n", *(*(i) + 1));
  printf("%d\n", *(*(i + 1)));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xb,-0x34(%rbp)
movl   $0xf,-0x38(%rbp)
movl   $0x13,-0x3c(%rbp)
movl   $0x17,-0x40(%rbp)
lea    -0x34(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x3c(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x4(%rax),%esi
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0xb,0x14(%rsp)
movl   $0xf,0x10(%rsp)
movl   $0x13,0xc(%rsp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0x14(%rsp),%rax
mov    %rax,(%rbx)
lea    0x10(%rsp),%rax
mov    %rax,0x8(%rbx)
lea    0xc(%rsp),%rax
mov    %rax,0x10(%rbx)
lea    0xe83(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
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*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 11, i32* %7
store i32 15, i32* %8
store i32 19, i32* %9
store i32 23, i32* %10
store i32* %7, i32** %3
store i32* %8, i32** %4
store i32* %9, i32** %5
store i32* %10, i32** %6
%11 = call i64 @malloc(i32 8)
%12 = inttoptr i64 %11 to i32**
store i32** %12, i32*** %2
%13 = load i32*, i32** %3
%14 = load i32**, i32*** %2
store i32* %13, i32** %14
%15 = load i32*, i32** %4
%16 = load i32**, i32*** %2
%17 = getelementptr inbounds i32*, i32** %16, i64 1
store i32* %15, i32** %17
%18 = load i32*, i32** %5
%19 = load i32**, i32*** %2
%20 = getelementptr inbounds i32*, i32** %19, i64 2
store i32* %18, i32** %20
%21 = load i32**, i32*** %2
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i32**, i32*** %2
%27 = getelementptr inbounds i32*, i32** %26, i64 1
%28 = load i32*, i32** %27
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = call i32 (...) @getchar()
ret i32 0
}

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