#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 *, int **, int *);
int main() {
  int apricot[2][3][5];
  int(*r)[5] = apricot[0];
  int *t = apricot[0][0];
  printf("r: %p, t: %p\n", r, t);
  ++r;
  ++t;
  printf("r: %p, t: %p\n", r, t);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rdx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x88(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x88(%rbp)
mov    -0x90(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x90(%rbp)
mov    -0x88(%rbp),%rsi
mov    -0x90(%rbp),%rdx
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xee1(%rip),%rbx
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"r: %p, t: %p\0A\00"
define i32 @main() {
%1 = alloca [2 x [3 x [5 x i32]]]
%2 = bitcast [2 x [3 x [5 x i32]]]* %1 to i8*
%3 = getelementptr inbounds [2 x [3 x [5 x i32]]], [2 x [3 x [5 x i32]]]* %1, i64 0, i64 0, i64 0, i64 0
%4 = bitcast [2 x [3 x [5 x i32]]]* %1 to i32**
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32** %4, i32* %3)
%6 = getelementptr inbounds [2 x [3 x [5 x i32]]], [2 x [3 x [5 x i32]]]* %1, i64 0, i64 0, i64 1
%7 = getelementptr inbounds [2 x [3 x [5 x i32]]], [2 x [3 x [5 x i32]]]* %1, i64 0, i64 0, i64 0, i64 1
%8 = bitcast [5 x i32]* %6 to i32**
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32** %8, i32* %7)
ret i32 0
}