#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 */
struct S_MATRIX {
  int dummy;
};

/* Variables and functions */
struct S_MATRIX ***calloc(size_t const, int);
struct S_MATRIX **constructor_matrix2_pointer(size_t const);
struct S_MATRIX ***constructor_matrix3_pointer(size_t const N0,
                                               size_t const N1) {
  struct S_MATRIX ***A = calloc(N0, sizeof *A);
  for (size_t i = 0; i < N0; i++)
    A[i] = constructor_matrix2_pointer(N1);
  return A;
}


x86 assembly (clang, -O0):
<constructor_matrix3_pointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1181 <constructor_matrix3_pointer+0x61>
mov    -0x10(%rbp),%rdi
call   1040 <constructor_matrix2_pointer@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114a <constructor_matrix3_pointer+0x2a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constructor_matrix3_pointer>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r12
test   %r15,%r15
je     1165 <constructor_matrix3_pointer+0x45>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <constructor_matrix2_pointer@plt>
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <constructor_matrix3_pointer+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.S_MATRIX = type { i32 }
define %struct.S_MATRIX*** @constructor_matrix3_pointer(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca %struct.S_MATRIX***
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = call %struct.S_MATRIX*** @calloc(i64 %7, i32 8)
store %struct.S_MATRIX*** %8, %struct.S_MATRIX**** %5
store i64 0, i64* %6
br label %9
9: ; preds = %19, %2
%10 = load i64, i64* %6
%11 = load i64, i64* %3
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i64, i64* %4
%15 = call %struct.S_MATRIX** @constructor_matrix2_pointer(i64 %14)
%16 = load %struct.S_MATRIX***, %struct.S_MATRIX**** %5
%17 = load i64, i64* %6
%18 = getelementptr inbounds %struct.S_MATRIX**, %struct.S_MATRIX*** %16, i64 %17
store %struct.S_MATRIX** %15, %struct.S_MATRIX*** %18
br label %19
19: ; preds = %13
%20 = load i64, i64* %6
%21 = add i64 %20, 1
store i64 %21, i64* %6
br label %9
22: ; preds = %9
%23 = load %struct.S_MATRIX***, %struct.S_MATRIX**** %5
ret %struct.S_MATRIX*** %23
}

LLVM IR (-O2):
%struct.S_MATRIX = type { i32 }
define %struct.S_MATRIX*** @constructor_matrix3_pointer(i64 %0, i64 %1) {
%3 = tail call %struct.S_MATRIX*** @calloc(i64 %0, i32 8)
%4 = icmp eq i64 %0, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %2
ret %struct.S_MATRIX*** %3
6: ; preds = %2, %6
%7 = phi i64 [ %10, %6 ], [ 0, %2 ]
%8 = tail call %struct.S_MATRIX** @constructor_matrix2_pointer(i64 %1)
%9 = getelementptr inbounds %struct.S_MATRIX**, %struct.S_MATRIX*** %3, i64 %7
store %struct.S_MATRIX** %8, %struct.S_MATRIX*** %9
%10 = add nuw i64 %7, 1
%11 = icmp eq i64 %10, %0
br i1 %11, label %5, label %6
}