#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__ malloc(size_t);
double **dmatrix_zeiger_alloc_1(double *a, long zn, long sn) {
  double **m;
  long i;
  m = (double **)malloc((size_t)(zn + 1) * sizeof(double *));
  if (m == NULL)
    return NULL;
  m[0] = a;
#pragma omp parallel for
  for (i = 0; i < zn; i++)
    m[i + 1] = a + i * sn;
  return m;
}


x86 assembly (clang, -O0):
<dmatrix_zeiger_alloc_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1151 <dmatrix_zeiger_alloc_1+0x41>
movq   $0x0,-0x8(%rbp)
jmp    11ac <dmatrix_zeiger_alloc_1+0x9c>
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11a4 <dmatrix_zeiger_alloc_1+0x94>
mov    -0x10(%rbp),%rdx
mov    -0x30(%rbp),%rax
imul   -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    %rdx,0x8(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1164 <dmatrix_zeiger_alloc_1+0x54>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmatrix_zeiger_alloc_1>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
lea    0x8(,%rsi,8),%rdi
call   1030 <malloc@plt>
test   %rax,%rax
je     1155 <dmatrix_zeiger_alloc_1+0x45>
mov    %r14,(%rax)
test   %r12,%r12
jle    11e0 <dmatrix_zeiger_alloc_1+0xd0>
lea    -0x1(%r12),%rcx
mov    %r12d,%r8d
and    $0x3,%r8d
cmp    $0x3,%rcx
jae    115c <dmatrix_zeiger_alloc_1+0x4c>
xor    %edx,%edx
jmp    11ac <dmatrix_zeiger_alloc_1+0x9c>
xor    %eax,%eax
jmp    11e0 <dmatrix_zeiger_alloc_1+0xd0>
and    $0xfffffffffffffffc,%r12
mov    %r15,%r9
shl    $0x4,%r9
mov    %r15,%rdi
shl    $0x5,%rdi
lea    0x0(,%r15,8),%rcx
lea    (%rcx,%rcx,2),%r10
xor    %edx,%edx
mov    %r14,%rsi
nop
mov    %rsi,0x8(%rax,%rdx,8)
lea    (%rsi,%rcx,1),%rbx
mov    %rbx,0x10(%rax,%rdx,8)
lea    (%rsi,%r9,1),%rbx
mov    %rbx,0x18(%rax,%rdx,8)
lea    (%rsi,%r10,1),%rbx
mov    %rbx,0x20(%rax,%rdx,8)
add    $0x4,%rdx
add    %rdi,%rsi
cmp    %rdx,%r12
jne    1180 <dmatrix_zeiger_alloc_1+0x70>
test   %r8,%r8
je     11e0 <dmatrix_zeiger_alloc_1+0xd0>
lea    (%rax,%rdx,8),%rcx
add    $0x8,%rcx
imul   %r15,%rdx
lea    (%r14,%rdx,8),%rdx
shl    $0x3,%r15
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
mov    %rdx,(%rcx,%rsi,8)
add    $0x1,%rsi
add    %r15,%rdx
cmp    %rsi,%r8
jne    11d0 <dmatrix_zeiger_alloc_1+0xc0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double** @dmatrix_zeiger_alloc_1(double* %0, i64 %1, i64 %2) {
%4 = alloca double**
%5 = alloca double*
%6 = alloca i64
%7 = alloca i64
%8 = alloca double**
%9 = alloca i64
store double* %0, double** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%10 = load i64, i64* %6
%11 = add nsw i64 %10, 1
%12 = mul i64 %11, 8
%13 = call i64 @malloc(i64 %12)
%14 = inttoptr i64 %13 to double**
store double** %14, double*** %8
%15 = load double**, double*** %8
%16 = icmp eq double** %15, null
br i1 %16, label %17, label %18
17: ; preds = %3
store double** null, double*** %4
br label %41
18: ; preds = %3
%19 = load double*, double** %5
%20 = load double**, double*** %8
%21 = getelementptr inbounds double*, double** %20, i64 0
store double* %19, double** %21
store i64 0, i64* %9
br label %22
22: ; preds = %36, %18
%23 = load i64, i64* %9
%24 = load i64, i64* %6
%25 = icmp slt i64 %23, %24
br i1 %25, label %26, label %39
26: ; preds = %22
%27 = load double*, double** %5
%28 = load i64, i64* %9
%29 = load i64, i64* %7
%30 = mul nsw i64 %28, %29
%31 = getelementptr inbounds double, double* %27, i64 %30
%32 = load double**, double*** %8
%33 = load i64, i64* %9
%34 = add nsw i64 %33, 1
%35 = getelementptr inbounds double*, double** %32, i64 %34
store double* %31, double** %35
br label %36
36: ; preds = %26
%37 = load i64, i64* %9
%38 = add nsw i64 %37, 1
store i64 %38, i64* %9
br label %22
39: ; preds = %22
%40 = load double**, double*** %8
store double** %40, double*** %4
br label %41
41: ; preds = %39, %17
%42 = load double**, double*** %4
ret double** %42
}

LLVM IR (-O2):
define double** @dmatrix_zeiger_alloc_1(double* %0, i64 %1, i64 %2) {
%4 = shl i64 %1, 3
%5 = add i64 %4, 8
%6 = tail call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to double**
%8 = icmp eq i64 %6, 0
br i1 %8, label %50, label %9
9: ; preds = %3
store double* %0, double** %7
%10 = icmp sgt i64 %1, 0
br i1 %10, label %11, label %50
11: ; preds = %9
%12 = add i64 %1, -1
%13 = and i64 %1, 3
%14 = icmp ult i64 %12, 3
br i1 %14, label %38, label %15
15: ; preds = %11
%16 = and i64 %1, -4
br label %17
17: ; preds = %17, %15
%18 = phi i64 [ 0, %15 ], [ %34, %17 ]
%19 = phi i64 [ 0, %15 ], [ %36, %17 ]
%20 = mul nsw i64 %18, %2
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = or i64 %18, 1
%23 = getelementptr inbounds double*, double** %7, i64 %22
store double* %21, double** %23
%24 = mul nsw i64 %22, %2
%25 = getelementptr inbounds double, double* %0, i64 %24
%26 = or i64 %18, 2
%27 = getelementptr inbounds double*, double** %7, i64 %26
store double* %25, double** %27
%28 = mul nsw i64 %26, %2
%29 = getelementptr inbounds double, double* %0, i64 %28
%30 = or i64 %18, 3
%31 = getelementptr inbounds double*, double** %7, i64 %30
store double* %29, double** %31
%32 = mul nsw i64 %30, %2
%33 = getelementptr inbounds double, double* %0, i64 %32
%34 = add nuw nsw i64 %18, 4
%35 = getelementptr inbounds double*, double** %7, i64 %34
store double* %33, double** %35
%36 = add nuw i64 %19, 4
%37 = icmp eq i64 %36, %16
br i1 %37, label %38, label %17
38: ; preds = %17, %11
%39 = phi i64 [ 0, %11 ], [ %34, %17 ]
%40 = icmp eq i64 %13, 0
br i1 %40, label %50, label %41
41: ; preds = %38, %41
%42 = phi i64 [ %46, %41 ], [ %39, %38 ]
%43 = phi i64 [ %48, %41 ], [ 0, %38 ]
%44 = mul nsw i64 %42, %2
%45 = getelementptr inbounds double, double* %0, i64 %44
%46 = add nuw nsw i64 %42, 1
%47 = getelementptr inbounds double*, double** %7, i64 %46
store double* %45, double** %47
%48 = add i64 %43, 1
%49 = icmp eq i64 %48, %13
br i1 %49, label %50, label %41
50: ; preds = %38, %41, %9, %3
%51 = phi double** [ null, %3 ], [ %7, %9 ], [ %7, %41 ], [ %7, %38 ]
ret double** %51
}