#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 foo(int, int ***);
int main(void) {
  int n = 13;
  int a[2][n][n - 1];
  a[0][0][0] = 42;
  a[0][n - 1][n - 2] = 33;
  return foo(n - 1, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,%edx
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
imul   %rdx,%rcx
lea    0xf(,%rcx,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rax,%rcx
imul   %rdx,%rcx
imul   $0x0,%rcx,%rdi
shl    $0x2,%rdi
mov    %rsi,%rcx
add    %rdi,%rcx
imul   $0x0,%rdx,%rdi
movl   $0x2a,(%rcx,%rdi,4)
imul   %rdx,%rax
imul   $0x0,%rax,%rcx
shl    $0x2,%rcx
mov    %rsi,%rax
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movl   $0x21,(%rax,%rcx,4)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <foo@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x4e8,%rsp
movl   $0x2a,(%rsp)
movl   $0x21,0x26c(%rsp)
mov    %rsp,%rsi
mov    $0xc,%edi
call   1030 <foo@plt>
add    $0x4e8,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
store i32 13, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %3
%12 = mul nuw i64 2, %7
%13 = mul nuw i64 %12, %10
%14 = alloca i32, i64 %13
store i64 %7, i64* %4
store i64 %10, i64* %5
%15 = mul nuw i64 %7, %10
%16 = mul nsw i64 0, %15
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = mul nsw i64 0, %10
%19 = getelementptr inbounds i32, i32* %17, i64 %18
%20 = getelementptr inbounds i32, i32* %19, i64 0
store i32 42, i32* %20
%21 = mul nuw i64 %7, %10
%22 = mul nsw i64 0, %21
%23 = getelementptr inbounds i32, i32* %14, i64 %22
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = mul nsw i64 %26, %10
%28 = getelementptr inbounds i32, i32* %23, i64 %27
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %28, i64 %31
store i32 33, i32* %32
%33 = load i32, i32* %2
%34 = sub nsw i32 %33, 1
%35 = bitcast i32* %14 to i32***
%36 = call i32 @foo(i32 %34, i32*** %35)
store i32 %36, i32* %1
%37 = load i8*, i8** %3
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [312 x i32]
%2 = getelementptr inbounds [312 x i32], [312 x i32]* %1, i64 0, i64 0
store i32 42, i32* %2
%3 = getelementptr inbounds [312 x i32], [312 x i32]* %1, i64 0, i64 155
store i32 33, i32* %3
%4 = bitcast [312 x i32]* %1 to i32***
%5 = call i32 @foo(i32 12, i32*** %4)
ret i32 %5
}