#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 /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void multidimensionalArray() {
  int arr[3][3] = {{1, 2, 3}, {5, 6, 7}, {8, 9, 10}};
  printf("%zd \n", sizeof(arr));
  printf("%zd \n", sizeof(*arr));
  int *arr0 = *arr;
  printf("*arr0=%d", *arr0);
  int *arr2 = *(arr + 1);
  printf("%d\n", *arr2 + 1);
  printf("%d", *(*(arr + 2)));
}


x86 assembly (clang, -O0):
<multidimensionalArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    0xee0(%rip),%rdi
mov    $0x24,%esi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
add    $0xc,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%esi
add    $0x1,%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multidimensionalArray>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x24,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x8,%esi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%zd \0A\00"
@.str.1 = [9 x i8] c"*arr0=%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [3 x i8] c"%d\00"
define void @multidimensionalArray() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 36)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 12)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 6)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 8)
ret void
}