#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 */
double **dmatrix_pointer_alloc(double *, long, long, short);
double *dvector_alloc(long);
double **dmatrix_all_alloc(long zn, long sn, short indexing) {
  double **m;
  double *a;
  long ges_laenge;
  ges_laenge = zn * sn;
  a = dvector_alloc(ges_laenge);
  if (a == NULL)
    return NULL;
  m = dmatrix_pointer_alloc(a, zn, sn, indexing);
  return m;
}


x86 assembly (clang, -O0):
<dmatrix_all_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dx,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <dvector_alloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1169 <dmatrix_all_alloc+0x49>
movq   $0x0,-0x8(%rbp)
jmp    118a <dmatrix_all_alloc+0x6a>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movswl -0x1a(%rbp),%ecx
call   1030 <dmatrix_pointer_alloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmatrix_all_alloc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
imul   %rbx,%rdi
call   1040 <dvector_alloc@plt>
test   %rax,%rax
je     1152 <dmatrix_all_alloc+0x32>
movswl %bp,%ecx
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <dmatrix_pointer_alloc@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double** @dmatrix_all_alloc(i64 %0, i64 %1, i16 signext %2) {
%4 = alloca double**
%5 = alloca i64
%6 = alloca i64
%7 = alloca i16
%8 = alloca double**
%9 = alloca double*
%10 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i16 %2, i16* %7
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = mul nsw i64 %11, %12
store i64 %13, i64* %10
%14 = load i64, i64* %10
%15 = call double* @dvector_alloc(i64 %14)
store double* %15, double** %9
%16 = load double*, double** %9
%17 = icmp eq double* %16, null
br i1 %17, label %18, label %19
18: ; preds = %3
store double** null, double*** %4
br label %26
19: ; preds = %3
%20 = load double*, double** %9
%21 = load i64, i64* %5
%22 = load i64, i64* %6
%23 = load i16, i16* %7
%24 = call double** @dmatrix_pointer_alloc(double* %20, i64 %21, i64 %22, i16 signext %23)
store double** %24, double*** %8
%25 = load double**, double*** %8
store double** %25, double*** %4
br label %26
26: ; preds = %19, %18
%27 = load double**, double*** %4
ret double** %27
}

LLVM IR (-O2):
define double** @dmatrix_all_alloc(i64 %0, i64 %1, i16 signext %2) {
%4 = mul nsw i64 %1, %0
%5 = tail call double* @dvector_alloc(i64 %4)
%6 = icmp eq double* %5, null
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call double** @dmatrix_pointer_alloc(double* %5, i64 %0, i64 %1, i16 signext %2)
br label %9
9: ; preds = %3, %7
%10 = phi double** [ %8, %7 ], [ null, %3 ]
ret double** %10
}