#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);
void array_test() {
  int arr1[2];
  int arr2[2][2];
  arr1[0] = 100;
  arr1[1] = 200;
  arr2[0][0] = 10;
  arr2[0][1] = 20;
  arr2[1][0] = 30;
  arr2[1][1] = 40;
  printf("arr1[0] = %d, arr1[1] = %d\n", arr1[0], arr1[1]);
  printf("arr2[0][0]=%d, arr2[0][1]=%d\n", arr2[0][0], arr2[0][1]);
  printf("arr2[1][0]=%d, arr2[1][1]=%d\n", arr2[1][0], arr2[1][1]);
}


x86 assembly (clang, -O0):
<array_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x64,-0x8(%rbp)
movl   $0xc8,-0x4(%rbp)
movl   $0xa,-0x20(%rbp)
movl   $0x14,-0x1c(%rbp)
movl   $0x1e,-0x18(%rbp)
movl   $0x28,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_test>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x64,%esi
mov    $0xc8,%edx
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x1e,%esi
mov    $0x28,%edx
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"arr1[0] = %d, arr1[1] = %d\0A\00"
@.str.1 = [30 x i8] c"arr2[0][0]=%d, arr2[0][1]=%d\0A\00"
@.str.2 = [30 x i8] c"arr2[1][0]=%d, arr2[1][1]=%d\0A\00"
define void @array_test() {
%1 = alloca [2 x i32]
%2 = alloca [2 x [2 x i32]]
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
store i32 100, i32* %3
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
store i32 200, i32* %4
%5 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 10, i32* %6
%7 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 20, i32* %8
%9 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 30, i32* %10
%11 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
store i32 40, i32* %12
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16)
%18 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 1
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %23)
%25 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %25, i64 0, i64 0
%27 = load i32, i32* %26
%28 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 1
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %28, i64 0, i64 1
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %30)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"arr1[0] = %d, arr1[1] = %d\0A\00"
@.str.1 = [30 x i8] c"arr2[0][0]=%d, arr2[0][1]=%d\0A\00"
@.str.2 = [30 x i8] c"arr2[1][0]=%d, arr2[1][1]=%d\0A\00"
define void @array_test() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 100, i32 200)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 30, i32 40)
ret void
}