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


x86 assembly (clang, -O0):
<doberes_dreieck_zeiger_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
shl    $0x3,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    114d <doberes_dreieck_zeiger_alloc+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    11b8 <doberes_dreieck_zeiger_alloc+0xa8>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11b0 <doberes_dreieck_zeiger_alloc+0xa0>
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rdx,0x8(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
sub    -0x28(%rbp),%rax
sub    $0x1,%rax
shl    $0x3,%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1168 <doberes_dreieck_zeiger_alloc+0x58>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doberes_dreieck_zeiger_alloc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x8(,%rsi,8),%rdi
call   1030 <malloc@plt>
test   %rax,%rax
je     115d <doberes_dreieck_zeiger_alloc+0x4d>
mov    %r15,(%rax)
test   %r14,%r14
jle    1235 <doberes_dreieck_zeiger_alloc+0x125>
lea    -0x1(%r14),%rcx
mov    %r14d,%r8d
and    $0x3,%r8d
cmp    $0x3,%rcx
jae    1164 <doberes_dreieck_zeiger_alloc+0x54>
xor    %ecx,%ecx
test   %r8,%r8
jne    1204 <doberes_dreieck_zeiger_alloc+0xf4>
jmp    1235 <doberes_dreieck_zeiger_alloc+0x125>
xor    %eax,%eax
jmp    1235 <doberes_dreieck_zeiger_alloc+0x125>
mov    %r14,%r9
and    $0xfffffffffffffffc,%r9
lea    0x0(,%r14,8),%rcx
lea    (%rcx,%rcx,2),%rdx
mov    $0xffffffffffffffd0,%r10
sub    %rdx,%r10
lea    (%rcx,%rcx,2),%r11
add    $0xffffffffffffffd0,%r11
mov    %r14,%r12
shl    $0x4,%r12
add    $0xffffffffffffffe8,%r12
lea    -0x8(,%r14,8),%rdi
ff
xor    %ecx,%ecx
xchg   %ax,%ax
mov    %rcx,%rdx
mov    %r15,%rbx
mov    %r15,0x8(%rax,%rcx,8)
lea    (%r15,%rdi,1),%rcx
mov    %rcx,0x10(%rax,%rdx,8)
lea    (%r15,%r12,1),%rcx
mov    %rcx,0x18(%rax,%rdx,8)
mov    %r14,%rsi
sub    %rdx,%rsi
lea    (%rcx,%rsi,8),%r15
lea    0x4(%rdx),%rcx
lea    (%rbx,%r11,1),%rsi
mov    %rsi,0x20(%rax,%rdx,8)
xor    $0xfffffffffffffffc,%rdx
add    %r14,%rdx
lea    (%r15,%rdx,8),%r15
add    $0xffffffffffffffe8,%r15
add    $0x60,%r10
add    $0xffffffffffffffa0,%r11
add    $0xffffffffffffffc0,%r12
add    $0xffffffffffffffe0,%rdi
cmp    %rcx,%r9
jne    11a0 <doberes_dreieck_zeiger_alloc+0x90>
lea    (%rbx,%rdx,8),%r15
sub    %r10,%r15
test   %r8,%r8
je     1235 <doberes_dreieck_zeiger_alloc+0x125>
lea    (%rax,%rcx,8),%rdx
add    $0x8,%rdx
not    %rcx
add    %r14,%rcx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,(%rdx,%rsi,8)
lea    (%r15,%rcx,8),%r15
add    $0x1,%rsi
add    $0xffffffffffffffff,%rcx
cmp    %rsi,%r8
jne    1220 <doberes_dreieck_zeiger_alloc+0x110>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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