#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*/ chk(int **, int, int, int, int);
main() {
  int a[][2] = {0, 1, 2, 3};
  int b[][2] = {{1}, {2}};
  int c[][2] = {{1}, 2, 3};
  int d[][2] = {1, 2, {3}};
  chk(a, 0, 1, 2, 3);
  chk(b, 1, 0, 2, 0);
  chk(c, 1, 0, 2, 3);
  chk(d, 1, 2, 3, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
call   1030 <chk@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
xor    %r8d,%r8d
mov    $0x2,%ecx
mov    %r8d,%edx
call   1030 <chk@plt>
lea    -0x40(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
call   1030 <chk@plt>
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
xor    %r8d,%r8d
call   1030 <chk@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xef1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
call   1030 <chk@plt>
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
xor    %r8d,%r8d
call   1030 <chk@plt>
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
call   1030 <chk@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
xor    %r8d,%r8d
call   1030 <chk@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [2 x [2 x i32]] [[2 x i32] [i32 0, i32 1], [2 x i32] [i32 2, i32 3]]
@__const.main.b = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 0], [2 x i32] [i32 2, i32 0]]
@__const.main.c = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 0], [2 x i32] [i32 2, i32 3]]
@__const.main.d = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 0]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [2 x i32]]
%3 = alloca [2 x [2 x i32]]
%4 = alloca [2 x [2 x i32]]
%5 = alloca [2 x [2 x i32]]
store i32 0, i32* %1
%6 = bitcast [2 x [2 x i32]]* %2 to i8*
%7 = bitcast [2 x [2 x i32]]* %3 to i8*
%8 = bitcast [2 x [2 x i32]]* %4 to i8*
%9 = bitcast [2 x [2 x i32]]* %5 to i8*
%10 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%11 = bitcast [2 x i32]* %10 to i32**
%12 = call i32 @chk(i32** %11, i32 0, i32 1, i32 2, i32 3)
%13 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0
%14 = bitcast [2 x i32]* %13 to i32**
%15 = call i32 @chk(i32** %14, i32 1, i32 0, i32 2, i32 0)
%16 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 0
%17 = bitcast [2 x i32]* %16 to i32**
%18 = call i32 @chk(i32** %17, i32 1, i32 0, i32 2, i32 3)
%19 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %5, i64 0, i64 0
%20 = bitcast [2 x i32]* %19 to i32**
%21 = call i32 @chk(i32** %20, i32 1, i32 2, i32 3, i32 0)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [2 x [2 x i32]] [[2 x i32] [i32 0, i32 1], [2 x i32] [i32 2, i32 3]]
@__const.main.b = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 0], [2 x i32] [i32 2, i32 0]]
@__const.main.c = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 0], [2 x i32] [i32 2, i32 3]]
@__const.main.d = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 0]]
define i32 @main() {
%1 = alloca [2 x [2 x i32]]
%2 = alloca [2 x [2 x i32]]
%3 = alloca [2 x [2 x i32]]
%4 = alloca [2 x [2 x i32]]
%5 = bitcast [2 x [2 x i32]]* %1 to i8*
%6 = bitcast [2 x [2 x i32]]* %2 to i8*
%7 = bitcast [2 x [2 x i32]]* %3 to i8*
%8 = bitcast [2 x [2 x i32]]* %4 to i8*
%9 = bitcast [2 x [2 x i32]]* %1 to i32**
%10 = call i32 @chk(i32** %9, i32 0, i32 1, i32 2, i32 3)
%11 = bitcast [2 x [2 x i32]]* %2 to i32**
%12 = call i32 @chk(i32** %11, i32 1, i32 0, i32 2, i32 0)
%13 = bitcast [2 x [2 x i32]]* %3 to i32**
%14 = call i32 @chk(i32** %13, i32 1, i32 0, i32 2, i32 3)
%15 = bitcast [2 x [2 x i32]]* %4 to i32**
%16 = call i32 @chk(i32** %15, i32 1, i32 2, i32 3, i32 0)
ret i32 0
}