#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 */
scalar_t__ xmalloc(size_t);
double **double_matrix(long nrl, long nrh, long ncl, long nch) {
  long i, nrow, ncol;
  double **m;
  nrow = nrh - nrl + 1;
  ncol = nch - ncl + 1;
  m = (double **)xmalloc((size_t)((nrow + 1) * sizeof(double *)));
  m += 1;
  m -= nrl;
  m[nrl] = (double *)xmalloc((size_t)((nrow * ncol + 1) * sizeof(double)));
  m[nrl] += 1;
  m[nrl] -= ncl;
  for (i = nrl + 1; i <= nrh; i++)
    m[i] = m[i - 1] + ncol;
  return m;
}


x86 assembly (clang, -O0):
<double_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1030 <xmalloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x40(%rbp),%rax
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
imul   -0x38(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1030 <xmalloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x8,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
xor    %esi,%esi
sub    %rdi,%rsi
shl    $0x3,%rsi
add    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     122c <double_matrix+0x11c>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x38(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11e6 <double_matrix+0xd6>
mov    -0x40(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,0x20(%rsp)
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
mov    %rcx,%r12
sub    %rdx,%r12
add    $0x1,%r12
mov    %rsi,%rbp
sub    %rdi,%rbp
lea    0x10(,%rbp,8),%rdi
call   1030 <xmalloc@plt>
mov    %rax,%r13
mov    0x8(%rsp),%rax
lea    0x0(,%rax,8),%r15
mov    %r13,%rax
sub    %r15,%rax
mov    %rax,0x18(%rsp)
neg    %r15
lea    0x8(,%rbp,8),%rdi
mov    %r12,0x10(%rsp)
imul   %r12,%rdi
add    $0x8,%rdi
call   1030 <xmalloc@plt>
mov    0x8(%rsp),%r11
mov    %rax,%rcx
mov    0x20(%rsp),%rax
mov    %rax,%r10
lea    0x0(,%rax,8),%r8
mov    %r8,%rdx
neg    %rdx
lea    (%r15,%r13,1),%rax
add    $0x8,%rax
lea    (%rcx,%rdx,1),%rsi
add    $0x8,%rsi
mov    0x18(%rsp),%rdx
mov    %rsi,0x8(%rdx,%r11,8)
cmp    %r11,%rbx
jle    12b9 <double_matrix+0x1a9>
mov    %ebx,%edx
sub    %r11d,%edx
mov    %r11,%r9
not    %r9
add    %rbx,%r9
and    $0x7,%rdx
je     1225 <double_matrix+0x115>
mov    %rbx,%r15
lea    0x0(,%r14,8),%rdi
sub    %r8,%rdi
add    $0x8,%rdi
mov    %r14,%rbx
sub    %r10,%rbx
sub    %r10,%rbx
lea    (%rcx,%rbx,8),%rbp
add    $0x10,%rbp
xor    %ecx,%ecx
nopl   (%rax)
mov    %rbp,0x10(%r13,%rcx,8)
add    $0x1,%rcx
add    %rdi,%rsi
add    %rdi,%rbp
cmp    %rcx,%rdx
jne    1200 <double_matrix+0xf0>
add    %r11,%rcx
mov    %r15,%rbx
cmp    $0x7,%r9
jae    1232 <double_matrix+0x122>
jmp    12b9 <double_matrix+0x1a9>
mov    %r11,%rcx
cmp    $0x7,%r9
jb     12b9 <double_matrix+0x1a9>
mov    0x10(%rsp),%rdx
lea    (%rsi,%rdx,8),%rsi
mov    %r14,%rdi
shl    $0x6,%rdi
shl    $0x6,%r10
sub    %r10,%rdi
add    $0x40,%rdi
mov    $0x9,%edx
sub    %r11,%rdx
lea    0x0(,%rdx,8),%rdx
add    %r13,%rdx
shl    $0x3,%r14
sub    %r8,%r14
add    $0x8,%r14
nopl   0x0(%rax,%rax,1)
mov    %rsi,-0x38(%rdx,%rcx,8)
lea    (%rsi,%r14,1),%rbp
mov    %rbp,-0x30(%rdx,%rcx,8)
add    %r14,%rbp
mov    %rbp,-0x28(%rdx,%rcx,8)
add    %r14,%rbp
mov    %rbp,-0x20(%rdx,%rcx,8)
add    %r14,%rbp
mov    %rbp,-0x18(%rdx,%rcx,8)
add    %r14,%rbp
mov    %rbp,-0x10(%rdx,%rcx,8)
add    %r14,%rbp
mov    %rbp,-0x8(%rdx,%rcx,8)
add    %r14,%rbp
mov    %rbp,(%rdx,%rcx,8)
add    $0x8,%rcx
add    %rdi,%rsi
cmp    %rcx,%rbx
jne    1270 <double_matrix+0x160>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @double_matrix(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca double**
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%13 = load i64, i64* %6
%14 = load i64, i64* %5
%15 = sub nsw i64 %13, %14
%16 = add nsw i64 %15, 1
store i64 %16, i64* %10
%17 = load i64, i64* %8
%18 = load i64, i64* %7
%19 = sub nsw i64 %17, %18
%20 = add nsw i64 %19, 1
store i64 %20, i64* %11
%21 = load i64, i64* %10
%22 = add nsw i64 %21, 1
%23 = mul i64 %22, 8
%24 = call i64 @xmalloc(i64 %23)
%25 = inttoptr i64 %24 to double**
store double** %25, double*** %12
%26 = load double**, double*** %12
%27 = getelementptr inbounds double*, double** %26, i64 1
store double** %27, double*** %12
%28 = load i64, i64* %5
%29 = load double**, double*** %12
%30 = sub i64 0, %28
%31 = getelementptr inbounds double*, double** %29, i64 %30
store double** %31, double*** %12
%32 = load i64, i64* %10
%33 = load i64, i64* %11
%34 = mul nsw i64 %32, %33
%35 = add nsw i64 %34, 1
%36 = mul i64 %35, 8
%37 = call i64 @xmalloc(i64 %36)
%38 = inttoptr i64 %37 to double*
%39 = load double**, double*** %12
%40 = load i64, i64* %5
%41 = getelementptr inbounds double*, double** %39, i64 %40
store double* %38, double** %41
%42 = load double**, double*** %12
%43 = load i64, i64* %5
%44 = getelementptr inbounds double*, double** %42, i64 %43
%45 = load double*, double** %44
%46 = getelementptr inbounds double, double* %45, i64 1
store double* %46, double** %44
%47 = load i64, i64* %7
%48 = load double**, double*** %12
%49 = load i64, i64* %5
%50 = getelementptr inbounds double*, double** %48, i64 %49
%51 = load double*, double** %50
%52 = sub i64 0, %47
%53 = getelementptr inbounds double, double* %51, i64 %52
store double* %53, double** %50
%54 = load i64, i64* %5
%55 = add nsw i64 %54, 1
store i64 %55, i64* %9
br label %56
56: ; preds = %71, %4
%57 = load i64, i64* %9
%58 = load i64, i64* %6
%59 = icmp sle i64 %57, %58
br i1 %59, label %60, label %74
60: ; preds = %56
%61 = load double**, double*** %12
%62 = load i64, i64* %9
%63 = sub nsw i64 %62, 1
%64 = getelementptr inbounds double*, double** %61, i64 %63
%65 = load double*, double** %64
%66 = load i64, i64* %11
%67 = getelementptr inbounds double, double* %65, i64 %66
%68 = load double**, double*** %12
%69 = load i64, i64* %9
%70 = getelementptr inbounds double*, double** %68, i64 %69
store double* %67, double** %70
br label %71
71: ; preds = %60
%72 = load i64, i64* %9
%73 = add nsw i64 %72, 1
store i64 %73, i64* %9
br label %56
74: ; preds = %56
%75 = load double**, double*** %12
ret double** %75
}

LLVM IR (-O2):
define double** @double_matrix(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = sub nsw i64 %1, %0
%6 = sub nsw i64 %3, %2
%7 = add nsw i64 %6, 1
%8 = shl i64 %5, 3
%9 = add i64 %8, 16
%10 = tail call i64 @xmalloc(i64 %9)
%11 = inttoptr i64 %10 to double**
%12 = getelementptr inbounds double*, double** %11, i64 1
%13 = sub i64 0, %0
%14 = getelementptr inbounds double*, double** %12, i64 %13
%15 = add i64 %8, 8
%16 = mul i64 %15, %7
%17 = add i64 %16, 8
%18 = tail call i64 @xmalloc(i64 %17)
%19 = inttoptr i64 %18 to double*
%20 = getelementptr inbounds double*, double** %14, i64 %0
%21 = getelementptr inbounds double, double* %19, i64 1
%22 = sub i64 0, %2
%23 = getelementptr inbounds double, double* %21, i64 %22
store double* %23, double** %20
%24 = icmp sgt i64 %1, %0
br i1 %24, label %25, label %72
25: ; preds = %4
%26 = sub i64 %1, %0
%27 = xor i64 %0, -1
%28 = add i64 %27, %1
%29 = and i64 %26, 7
%30 = icmp eq i64 %29, 0
br i1 %30, label %40, label %31
31: ; preds = %25, %31
%32 = phi double* [ %36, %31 ], [ %23, %25 ]
%33 = phi i64 [ %35, %31 ], [ %0, %25 ]
%34 = phi i64 [ %38, %31 ], [ 0, %25 ]
%35 = add nsw i64 %33, 1
%36 = getelementptr inbounds double, double* %32, i64 %7
%37 = getelementptr inbounds double*, double** %14, i64 %35
store double* %36, double** %37
%38 = add i64 %34, 1
%39 = icmp eq i64 %38, %29
br i1 %39, label %40, label %31
40: ; preds = %31, %25
%41 = phi double* [ %23, %25 ], [ %36, %31 ]
%42 = phi i64 [ %0, %25 ], [ %35, %31 ]
%43 = icmp ult i64 %28, 7
br i1 %43, label %72, label %44
44: ; preds = %40, %44
%45 = phi double* [ %69, %44 ], [ %41, %40 ]
%46 = phi i64 [ %68, %44 ], [ %42, %40 ]
%47 = add nsw i64 %46, 1
%48 = getelementptr inbounds double, double* %45, i64 %7
%49 = getelementptr inbounds double*, double** %14, i64 %47
store double* %48, double** %49
%50 = add nsw i64 %46, 2
%51 = getelementptr inbounds double, double* %48, i64 %7
%52 = getelementptr inbounds double*, double** %14, i64 %50
store double* %51, double** %52
%53 = add nsw i64 %46, 3
%54 = getelementptr inbounds double, double* %51, i64 %7
%55 = getelementptr inbounds double*, double** %14, i64 %53
store double* %54, double** %55
%56 = add nsw i64 %46, 4
%57 = getelementptr inbounds double, double* %54, i64 %7
%58 = getelementptr inbounds double*, double** %14, i64 %56
store double* %57, double** %58
%59 = add nsw i64 %46, 5
%60 = getelementptr inbounds double, double* %57, i64 %7
%61 = getelementptr inbounds double*, double** %14, i64 %59
store double* %60, double** %61
%62 = add nsw i64 %46, 6
%63 = getelementptr inbounds double, double* %60, i64 %7
%64 = getelementptr inbounds double*, double** %14, i64 %62
store double* %63, double** %64
%65 = add nsw i64 %46, 7
%66 = getelementptr inbounds double, double* %63, i64 %7
%67 = getelementptr inbounds double*, double** %14, i64 %65
store double* %66, double** %67
%68 = add nsw i64 %46, 8
%69 = getelementptr inbounds double, double* %66, i64 %7
%70 = getelementptr inbounds double*, double** %14, i64 %68
store double* %69, double** %70
%71 = icmp eq i64 %68, %1
br i1 %71, label %72, label %44
72: ; preds = %40, %44, %4
ret double** %14
}