#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
scalar_t__ malloc_or_die(int);
int /*<<< orphan*/ stderr;
long long **allocate_llmatrix(int L, int M) {
  long long **llmatrix;
  int i;
  if ((L < 1) || (M < 1)) {
    fprintf(stderr,
            "allocate_array_of_pairs:  L and M must be >= 1; got %d and %d.\n",
            L, M);
    exit(1);
  }
  llmatrix = (long long **)malloc_or_die(L * sizeof(long long *));
  for (i = 0; i < L; i++)
    llmatrix[i] = (long long *)malloc_or_die(M * sizeof(long long));
  return llmatrix;
}


x86 assembly (clang, -O0):
<allocate_llmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jl     1152 <allocate_llmatrix+0x22>
cmpl   $0x1,-0x8(%rbp)
jge    1177 <allocate_llmatrix+0x47>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe98(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc_or_die@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c9 <allocate_llmatrix+0x99>
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc_or_die@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1191 <allocate_llmatrix+0x61>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate_llmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %edi,%r14d
test   %edi,%edi
jle    1181 <allocate_llmatrix+0x51>
test   %r15d,%r15d
jle    1181 <allocate_llmatrix+0x51>
lea    0x0(,%r14,8),%edi
call   1040 <malloc_or_die@plt>
mov    %rax,%r12
shl    $0x3,%r15d
mov    %r14d,%ebp
xor    %ebx,%ebx
mov    %r15d,%edi
call   1040 <malloc_or_die@plt>
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <allocate_llmatrix+0x30>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [64 x i8] c"allocate_array_of_pairs: L and M must be >= 1; got %d and %d.\0A\00"
define i64** @allocate_llmatrix(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64**
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %9, %2
%13 = load i32, i32* @stderr
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %9
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc_or_die(i32 %22)
%24 = inttoptr i64 %23 to i64**
store i64** %24, i64*** %5
store i32 0, i32* %6
br label %25
25: ; preds = %40, %18
%26 = load i32, i32* %6
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %43
29: ; preds = %25
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = mul i64 %31, 8
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc_or_die(i32 %33)
%35 = inttoptr i64 %34 to i64*
%36 = load i64**, i64*** %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i64*, i64** %36, i64 %38
store i64* %35, i64** %39
br label %40
40: ; preds = %29
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %25
43: ; preds = %25
%44 = load i64**, i64*** %5
ret i64** %44
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [64 x i8] c"allocate_array_of_pairs: L and M must be >= 1; got %d and %d.\0A\00"
define i64** @allocate_llmatrix(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
%4 = icmp slt i32 %1, 1
%5 = or i1 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = shl i32 %0, 3
%12 = tail call i64 @malloc_or_die(i32 %11)
%13 = inttoptr i64 %12 to i64**
%14 = shl i32 %1, 3
%15 = zext i32 %0 to i64
br label %16
16: ; preds = %10, %16
%17 = phi i64 [ 0, %10 ], [ %21, %16 ]
%18 = tail call i64 @malloc_or_die(i32 %14)
%19 = inttoptr i64 %18 to i64*
%20 = getelementptr inbounds i64*, i64** %13, i64 %17
store i64* %19, i64** %20
%21 = add nuw nsw i64 %17, 1
%22 = icmp eq i64 %21, %15
br i1 %22, label %23, label %16
23: ; preds = %16
ret i64** %13
}