#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 */
int /*<<< orphan*/ abort();
void *malloc(int);
double **alloc_matrix(double init) {
  unsigned int i, j;
  double **matrix;
  matrix = malloc(sizeof(double *) * (2 * 3 * 5 * 7 * 8));
  if (matrix == NULL)
    abort();
  for (i = 0; i < (2 * 3 * 5 * 7 * 8); i++) {
    matrix[i] = malloc(sizeof(double) * (2 * 3 * 5 * 7 * 8));
    if (matrix[i] == NULL)
      abort();
    for (j = 0; j < (2 * 3 * 5 * 7 * 8); j++)
      matrix[i][j] = init;
  }
  return matrix;
}


x86 assembly (clang, -O0):
<alloc_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x3480,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114d <alloc_matrix+0x2d>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x690,-0xc(%rbp)
jae    11df <alloc_matrix+0xbf>
mov    $0x3480,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
jne    1192 <alloc_matrix+0x72>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x690,-0x10(%rbp)
jae    11cc <alloc_matrix+0xac>
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1199 <alloc_matrix+0x79>
jmp    11d1 <alloc_matrix+0xb1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <alloc_matrix+0x34>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_matrix>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
mov    $0x3480,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     11ed <alloc_matrix+0xcd>
mov    %rax,%r14
movaps (%rsp),%xmm0
movlhps %xmm0,%xmm0
xor    %ebx,%ebx
movaps %xmm0,(%rsp)
xchg   %ax,%ax
mov    $0x3480,%edi
call   1040 <malloc@plt>
mov    %rax,(%r14,%rbx,8)
test   %rax,%rax
je     11ed <alloc_matrix+0xcd>
mov    $0x1a,%ecx
movaps (%rsp),%xmm0
movups %xmm0,-0xd0(%rax,%rcx,8)
ff
movups %xmm0,-0xc0(%rax,%rcx,8)
ff
movups %xmm0,-0xb0(%rax,%rcx,8)
ff
movups %xmm0,-0xa0(%rax,%rcx,8)
ff
movups %xmm0,-0x90(%rax,%rcx,8)
ff
movups %xmm0,-0x80(%rax,%rcx,8)
movups %xmm0,-0x70(%rax,%rcx,8)
movups %xmm0,-0x60(%rax,%rcx,8)
movups %xmm0,-0x50(%rax,%rcx,8)
movups %xmm0,-0x40(%rax,%rcx,8)
movups %xmm0,-0x30(%rax,%rcx,8)
movups %xmm0,-0x20(%rax,%rcx,8)
movups %xmm0,-0x10(%rax,%rcx,8)
movups %xmm0,(%rax,%rcx,8)
add    $0x1c,%rcx
cmp    $0x6aa,%rcx
jne    1170 <alloc_matrix+0x50>
add    $0x1,%rbx
cmp    $0x690,%rbx
jne    1150 <alloc_matrix+0x30>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define double** @alloc_matrix(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca double**
store double %0, double* %2
%6 = call i8* @malloc(i32 13440)
%7 = bitcast i8* %6 to double**
store double** %7, double*** %5
%8 = load double**, double*** %5
%9 = icmp eq double** %8, null
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
store i32 0, i32* %3
br label %13
13: ; preds = %49, %12
%14 = load i32, i32* %3
%15 = icmp ult i32 %14, 1680
br i1 %15, label %16, label %52
16: ; preds = %13
%17 = call i8* @malloc(i32 13440)
%18 = bitcast i8* %17 to double*
%19 = load double**, double*** %5
%20 = load i32, i32* %3
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds double*, double** %19, i64 %21
store double* %18, double** %22
%23 = load double**, double*** %5
%24 = load i32, i32* %3
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds double*, double** %23, i64 %25
%27 = load double*, double** %26
%28 = icmp eq double* %27, null
br i1 %28, label %29, label %31
29: ; preds = %16
%30 = call i32 (...) @abort()
unreachable
31: ; preds = %16
store i32 0, i32* %4
br label %32
32: ; preds = %45, %31
%33 = load i32, i32* %4
%34 = icmp ult i32 %33, 1680
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load double, double* %2
%37 = load double**, double*** %5
%38 = load i32, i32* %3
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds double*, double** %37, i64 %39
%41 = load double*, double** %40
%42 = load i32, i32* %4
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double %36, double* %44
br label %45
45: ; preds = %35
%46 = load i32, i32* %4
%47 = add i32 %46, 1
store i32 %47, i32* %4
br label %32
48: ; preds = %32
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add i32 %50, 1
store i32 %51, i32* %3
br label %13
52: ; preds = %13
%53 = load double**, double*** %5
ret double** %53
}

LLVM IR (-O2):
define noalias double** @alloc_matrix(double %0) {
%2 = tail call dereferenceable_or_null(13440) i8* @malloc(i32 13440)
%3 = bitcast i8* %2 to double**
%4 = icmp eq i8* %2, null
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = insertelement <2 x double> poison, double %0, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = insertelement <2 x double> poison, double %0, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
br label %12
10: ; preds = %1
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %5, %59
%13 = phi i64 [ %60, %59 ], [ 0, %5 ]
%14 = tail call dereferenceable_or_null(13440) i8* @malloc(i32 13440)
%15 = getelementptr inbounds double*, double** %3, i64 %13
%16 = bitcast double** %15 to i8**
store i8* %14, i8** %16
%17 = icmp eq i8* %14, null
%18 = bitcast i8* %14 to double*
br i1 %17, label %57, label %19
19: ; preds = %12, %19
%20 = phi i64 [ %55, %19 ], [ 0, %12 ]
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = bitcast double* %21 to <2 x double>*
store <2 x double> %7, <2 x double>* %22
%23 = getelementptr inbounds double, double* %21, i64 2
%24 = bitcast double* %23 to <2 x double>*
store <2 x double> %9, <2 x double>* %24
%25 = add nuw nsw i64 %20, 4
%26 = getelementptr inbounds double, double* %18, i64 %25
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> %7, <2 x double>* %27
%28 = getelementptr inbounds double, double* %26, i64 2
%29 = bitcast double* %28 to <2 x double>*
store <2 x double> %9, <2 x double>* %29
%30 = add nuw nsw i64 %20, 8
%31 = getelementptr inbounds double, double* %18, i64 %30
%32 = bitcast double* %31 to <2 x double>*
store <2 x double> %7, <2 x double>* %32
%33 = getelementptr inbounds double, double* %31, i64 2
%34 = bitcast double* %33 to <2 x double>*
store <2 x double> %9, <2 x double>* %34
%35 = add nuw nsw i64 %20, 12
%36 = getelementptr inbounds double, double* %18, i64 %35
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> %7, <2 x double>* %37
%38 = getelementptr inbounds double, double* %36, i64 2
%39 = bitcast double* %38 to <2 x double>*
store <2 x double> %9, <2 x double>* %39
%40 = add nuw nsw i64 %20, 16
%41 = getelementptr inbounds double, double* %18, i64 %40
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> %7, <2 x double>* %42
%43 = getelementptr inbounds double, double* %41, i64 2
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> %9, <2 x double>* %44
%45 = add nuw nsw i64 %20, 20
%46 = getelementptr inbounds double, double* %18, i64 %45
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> %7, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %9, <2 x double>* %49
%50 = add nuw nsw i64 %20, 24
%51 = getelementptr inbounds double, double* %18, i64 %50
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %7, <2 x double>* %52
%53 = getelementptr inbounds double, double* %51, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %9, <2 x double>* %54
%55 = add nuw nsw i64 %20, 28
%56 = icmp eq i64 %55, 1680
br i1 %56, label %59, label %19
57: ; preds = %12
%58 = tail call i32 (...) @abort()
unreachable
59: ; preds = %19
%60 = add nuw nsw i64 %13, 1
%61 = icmp eq i64 %60, 1680
br i1 %61, label %62, label %12
62: ; preds = %59
ret double** %3
}