double **dmatrix(nrl, nrh, ncl, nch)
int nrl, nrh, ncl, nch;
{
  int i;
  double **m;
  m = (double **)calloc((unsigned)(nrh - nrl + 1), sizeof(double *));
  if (!m)
    nrerror("allocation failure 1 in dmatrix()");
  m -= nrl;
  for (i = nrl; i <= nrh; i++) {
    m[i] = (double *)calloc((unsigned)(nch - ncl + 1), sizeof(double));
    if (!m[i])
      nrerror("allocation failure 2 in dmatrix()");
    m[i] -= ncl;
  }
  return m;
}


x86 assembly (clang, -O0):
<dmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1168 <dmatrix+0x48>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <nrerror@plt>
mov    -0x4(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120b <dmatrix+0xeb>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    11db <dmatrix+0xbb>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <nrerror@plt>
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq %esi,%rdi
xor    %esi,%esi
sub    %rdi,%rsi
shl    $0x3,%rsi
add    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <dmatrix+0x68>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %edi,%r13d
mov    %esi,%ebx
sub    %edi,%ebx
add    $0x1,%ebx
mov    $0x8,%esi
mov    %rbx,%rdi
call   1040 <calloc@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1160 <dmatrix+0x40>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
movslq %r13d,%rax
shl    $0x3,%rax
mov    %r15,%rcx
sub    %rax,%rcx
mov    %rcx,(%rsp)
cmp    %ebp,%r13d
jle    1189 <dmatrix+0x69>
mov    (%rsp),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
sub    %r12d,%r14d
add    $0x1,%r14d
movslq %r12d,%r12
neg    %r12
xor    %r13d,%r13d
jmp    11b8 <dmatrix+0x98>
nopl   0x0(%rax,%rax,1)
lea    0x0(,%r12,8),%rax
add    %rbp,%rax
mov    %rax,(%r15,%r13,8)
add    $0x1,%r13
cmp    %r13d,%ebx
je     1176 <dmatrix+0x56>
mov    $0x8,%esi
mov    %r14,%rdi
call   1040 <calloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    11a0 <dmatrix+0x80>
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
jmp    11a0 <dmatrix+0x80>

LLVM IR (-O0):
@.str = [34 x i8] c"allocation failure 1 in dmatrix()\00"
@.str.1 = [34 x i8] c"allocation failure 2 in dmatrix()\00"
define double** @dmatrix(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double**
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = sub nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = zext i32 %14 to i64
%16 = call i8* @calloc(i64 %15, i64 8)
%17 = bitcast i8* %16 to double**
store double** %17, double*** %10
%18 = load double**, double*** %10
%19 = icmp ne double** %18, null
br i1 %19, label %22, label %20
20: ; preds = %4
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %4
%23 = load i32, i32* %5
%24 = load double**, double*** %10
%25 = sext i32 %23 to i64
%26 = sub i64 0, %25
%27 = getelementptr inbounds double*, double** %24, i64 %26
store double** %27, double*** %10
%28 = load i32, i32* %5
store i32 %28, i32* %9
br label %29
29: ; preds = %63, %22
%30 = load i32, i32* %9
%31 = load i32, i32* %6
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %66
33: ; preds = %29
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = sub nsw i32 %34, %35
%37 = add nsw i32 %36, 1
%38 = zext i32 %37 to i64
%39 = call i8* @calloc(i64 %38, i64 8)
%40 = bitcast i8* %39 to double*
%41 = load double**, double*** %10
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double*, double** %41, i64 %43
store double* %40, double** %44
%45 = load double**, double*** %10
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double*, double** %45, i64 %47
%49 = load double*, double** %48
%50 = icmp ne double* %49, null
br i1 %50, label %53, label %51
51: ; preds = %33
%52 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %51, %33
%54 = load i32, i32* %7
%55 = load double**, double*** %10
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double*, double** %55, i64 %57
%59 = load double*, double** %58
%60 = sext i32 %54 to i64
%61 = sub i64 0, %60
%62 = getelementptr inbounds double, double* %59, i64 %61
store double* %62, double** %58
br label %63
63: ; preds = %53
%64 = load i32, i32* %9
%65 = add nsw i32 %64, 1
store i32 %65, i32* %9
br label %29
66: ; preds = %29
%67 = load double**, double*** %10
ret double** %67
}

LLVM IR (-O2):
@.str = [34 x i8] c"allocation failure 1 in dmatrix()\00"
@.str.1 = [34 x i8] c"allocation failure 2 in dmatrix()\00"
define double** @dmatrix(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub i32 1, %0
%6 = add i32 %5, %1
%7 = zext i32 %6 to i64
%8 = tail call i8* @calloc(i64 %7, i64 8)
%9 = bitcast i8* %8 to double**
%10 = icmp eq i8* %8, null
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %4
%14 = sext i32 %0 to i64
%15 = sub nsw i64 0, %14
%16 = getelementptr inbounds double*, double** %9, i64 %15
%17 = icmp sgt i32 %0, %1
br i1 %17, label %38, label %18
18: ; preds = %13
%19 = sub i32 1, %2
%20 = add i32 %19, %3
%21 = zext i32 %20 to i64
%22 = sext i32 %2 to i64
%23 = sub nsw i64 0, %22
%24 = add i32 %1, 1
br label %25
25: ; preds = %18, %33
%26 = phi i64 [ %14, %18 ], [ %35, %33 ]
%27 = tail call i8* @calloc(i64 %21, i64 8)
%28 = getelementptr inbounds double*, double** %16, i64 %26
%29 = icmp eq i8* %27, null
%30 = bitcast i8* %27 to double*
br i1 %29, label %31, label %33
31: ; preds = %25
%32 = tail call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %31, %25
%34 = getelementptr inbounds double, double* %30, i64 %23
store double* %34, double** %28
%35 = add nsw i64 %26, 1
%36 = trunc i64 %35 to i32
%37 = icmp eq i32 %24, %36
br i1 %37, label %38, label %25
38: ; preds = %33, %13
ret double** %16
}