#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 main() {
  int **i;
  int *a1[4];
  int b1[4] = {11, 15, 19, 23};
  for (int ii = 0; ii < 4; ii++) {
    a1[ii] = &b1[ii];
  }
  i = (int **)malloc(sizeof(int *));
  for (int ii = 0; ii < 4; i++) {
    *(i + ii) = a1[ii];
  }
  for (int ii = 0; ii < 4; i++) {
    printf("%d\n", *(*(i) + 1));
    printf("%d\n", *(*(i + 1)));
    printf("---------------\n");
  }
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x4,-0x44(%rbp)
jge    118c <main+0x5c>
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rcx
shl    $0x2,%rax
add    %rax,%rcx
movslq -0x44(%rbp),%rax
mov    %rcx,-0x30(%rbp,%rax,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    115c <main+0x2c>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x4,-0x48(%rbp)
jge    11d1 <main+0xa1>
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11a1 <main+0x71>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    1231 <main+0x101>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x4(%rax),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11d8 <main+0xa8>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rsp,%rcx
nopl   0x0(%rax)
mov    %rcx,(%rax)
add    $0x8,%rax
jmp    1130 <main+0x20>

LLVM IR (-O0):
@__const.main.b1 = [4 x i32] [i32 11, i32 15, i32 19, i32 23]
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [17 x i8] c"---------------\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca [4 x i32*]
%4 = alloca [4 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [4 x i32]* %4 to i8*
store i32 0, i32* %5
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %14
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 %17
store i32* %15, i32** %18
br label %19
19: ; preds = %12
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = call i64 @malloc(i32 8)
%24 = inttoptr i64 %23 to i32**
store i32** %24, i32*** %2
store i32 0, i32* %6
br label %25
25: ; preds = %37, %22
%26 = load i32, i32* %6
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %40
28: ; preds = %25
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 %30
%32 = load i32*, i32** %31
%33 = load i32**, i32*** %2
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32*, i32** %33, i64 %35
store i32* %32, i32** %36
br label %37
37: ; preds = %28
%38 = load i32**, i32*** %2
%39 = getelementptr inbounds i32*, i32** %38, i32 1
store i32** %39, i32*** %2
br label %25
40: ; preds = %25
store i32 0, i32* %7
br label %41
41: ; preds = %56, %40
%42 = load i32, i32* %7
%43 = icmp slt i32 %42, 4
br i1 %43, label %44, label %59
44: ; preds = %41
%45 = load i32**, i32*** %2
%46 = load i32*, i32** %45
%47 = getelementptr inbounds i32, i32* %46, i64 1
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %48)
%50 = load i32**, i32*** %2
%51 = getelementptr inbounds i32*, i32** %50, i64 1
%52 = load i32*, i32** %51
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %56
56: ; preds = %44
%57 = load i32**, i32*** %2
%58 = getelementptr inbounds i32*, i32** %57, i32 1
store i32** %58, i32*** %2
br label %41
59: ; preds = %41
%60 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.b1 = [4 x i32] [i32 11, i32 15, i32 19, i32 23]
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i64 @malloc(i32 8)
%5 = inttoptr i64 %4 to i32**
br label %6
6: ; preds = %6, %0
%7 = phi i32** [ %5, %0 ], [ %8, %6 ]
store i32* %3, i32** %7
%8 = getelementptr inbounds i32*, i32** %7, i64 1
br label %6
}