#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
double **aml_array_dbl_2d_variable_2nd_new(int s1, int *s2, double val) {
  int i, j;
  double **arr;
  if (s1) {
    arr = (double **)malloc(s1 * sizeof(double *));
    for (i = 0; i < s1; i++) {
      if (s2[i]) {
        arr[i] = (double *)malloc(s2[i] * sizeof(double));
        for (j = 0; j < s2[i]; j++)
          arr[i][j] = val;
      } else {
        arr[i] = NULL;
      }
    }
  } else {
    fprintf(stderr, "%s:%d Attempt to initialise empty array\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/staropram/ffn/refs/heads/master/array.c",
            313);
    exit(1);
  }
  return arr;
}


x86 assembly (clang, -O0):
<aml_array_dbl_2d_variable_2nd_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     121c <aml_array_dbl_2d_variable_2nd_new+0xec>
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1217 <aml_array_dbl_2d_variable_2nd_new+0xe7>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11f4 <aml_array_dbl_2d_variable_2nd_new+0xc4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    11ef <aml_array_dbl_2d_variable_2nd_new+0xbf>
movsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b3 <aml_array_dbl_2d_variable_2nd_new+0x83>
jmp    1204 <aml_array_dbl_2d_variable_2nd_new+0xd4>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1209 <aml_array_dbl_2d_variable_2nd_new+0xd9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1168 <aml_array_dbl_2d_variable_2nd_new+0x38>
jmp    1247 <aml_array_dbl_2d_variable_2nd_new+0x117>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
lea    0xdd4(%rip),%rsi
lea    0xdf6(%rip),%rdx
mov    $0x139,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aml_array_dbl_2d_variable_2nd_new>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movaps %xmm0,(%rsp)
test   %edi,%edi
je     12d2 <aml_array_dbl_2d_variable_2nd_new+0x1a2>
mov    %rsi,%r12
mov    %edi,%r15d
lea    0x0(,%r15,8),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %r15d,%r15d
movaps (%rsp),%xmm0
jle    12c3 <aml_array_dbl_2d_variable_2nd_new+0x193>
mov    %r15d,%r15d
movaps %xmm0,%xmm1
movlhps %xmm0,%xmm1
xor    %ebx,%ebx
movaps %xmm1,0x10(%rsp)
jmp    1195 <aml_array_dbl_2d_variable_2nd_new+0x65>
nopl   0x0(%rax)
movq   $0x0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %r15,%rbx
je     12c3 <aml_array_dbl_2d_variable_2nd_new+0x193>
mov    (%r12,%rbx,4),%edi
test   %edi,%edi
je     1180 <aml_array_dbl_2d_variable_2nd_new+0x50>
shl    $0x3,%edi
call   1040 <malloc@plt>
movaps 0x10(%rsp),%xmm1
movaps (%rsp),%xmm0
mov    %rax,(%r14,%rbx,8)
mov    (%r12,%rbx,4),%ecx
test   %ecx,%ecx
jle    1188 <aml_array_dbl_2d_variable_2nd_new+0x58>
cmp    $0x4,%ecx
jae    11c6 <aml_array_dbl_2d_variable_2nd_new+0x96>
xor    %edx,%edx
jmp    12b0 <aml_array_dbl_2d_variable_2nd_new+0x180>
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rsi
mov    %rsi,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%r8d
and    $0x7,%r8d
cmp    $0x1c,%rsi
jae    11ee <aml_array_dbl_2d_variable_2nd_new+0xbe>
xor    %esi,%esi
jmp    1271 <aml_array_dbl_2d_variable_2nd_new+0x141>
and    $0xfffffffffffffff8,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm1,(%rax,%rsi,8)
movups %xmm1,0x10(%rax,%rsi,8)
movups %xmm1,0x20(%rax,%rsi,8)
movups %xmm1,0x30(%rax,%rsi,8)
movups %xmm1,0x40(%rax,%rsi,8)
movups %xmm1,0x50(%rax,%rsi,8)
movups %xmm1,0x60(%rax,%rsi,8)
movups %xmm1,0x70(%rax,%rsi,8)
movups %xmm1,0x80(%rax,%rsi,8)
movups %xmm1,0x90(%rax,%rsi,8)
movups %xmm1,0xa0(%rax,%rsi,8)
movups %xmm1,0xb0(%rax,%rsi,8)
movups %xmm1,0xc0(%rax,%rsi,8)
movups %xmm1,0xd0(%rax,%rsi,8)
movups %xmm1,0xe0(%rax,%rsi,8)
movups %xmm1,0xf0(%rax,%rsi,8)
add    $0x20,%rsi
add    $0xfffffffffffffff8,%rdi
jne    1200 <aml_array_dbl_2d_variable_2nd_new+0xd0>
test   %r8,%r8
je     12a2 <aml_array_dbl_2d_variable_2nd_new+0x172>
lea    (%rax,%rsi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%r8
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm1,-0x10(%rsi,%rdi,1)
movups %xmm1,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r8
jne    1290 <aml_array_dbl_2d_variable_2nd_new+0x160>
cmp    %rcx,%rdx
je     1188 <aml_array_dbl_2d_variable_2nd_new+0x58>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    12b0 <aml_array_dbl_2d_variable_2nd_new+0x180>
jmp    1188 <aml_array_dbl_2d_variable_2nd_new+0x58>
mov    %r14,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
lea    0xd1e(%rip),%rsi
lea    0xd40(%rip),%rdx
mov    $0x139,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"%s:%d Attempt to initialise empty array\0A\00"
@.str.1 = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/staropram/ffn/refs/heads/master/array.c\00"
define double** @aml_array_dbl_2d_variable_2nd_new(i32 %0, i32* %1, double %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double**
store i32 %0, i32* %4
store i32* %1, i32** %5
store double %2, double* %6
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %77
12: ; preds = %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to double**
store double** %18, double*** %9
store i32 0, i32* %7
br label %19
19: ; preds = %73, %12
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %76
23: ; preds = %19
%24 = load i32*, i32** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %67
30: ; preds = %23
%31 = load i32*, i32** %5
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 8
%38 = trunc i64 %37 to i32
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double*
%41 = load double**, double*** %9
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double*, double** %41, i64 %43
store double* %40, double** %44
store i32 0, i32* %8
br label %45
45: ; preds = %63, %30
%46 = load i32, i32* %8
%47 = load i32*, i32** %5
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %47, i64 %49
%51 = load i32, i32* %50
%52 = icmp slt i32 %46, %51
br i1 %52, label %53, label %66
53: ; preds = %45
%54 = load double, double* %6
%55 = load double**, double*** %9
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double*, double** %55, i64 %57
%59 = load double*, double** %58
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
store double %54, double* %62
br label %63
63: ; preds = %53
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
store i32 %65, i32* %8
br label %45
66: ; preds = %45
br label %72
67: ; preds = %23
%68 = load double**, double*** %9
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double*, double** %68, i64 %70
store double* null, double** %71
br label %72
72: ; preds = %67, %66
br label %73
73: ; preds = %72
%74 = load i32, i32* %7
%75 = add nsw i32 %74, 1
store i32 %75, i32* %7
br label %19
76: ; preds = %19
br label %81
77: ; preds = %3
%78 = load i32, i32* @stderr
%79 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0), i32 313)
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %76
%82 = load double**, double*** %9
ret double** %82
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"%s:%d Attempt to initialise empty array\0A\00"
@.str.1 = [130 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/staropram/ffn/refs/heads/master/array.c\00"
define double** @aml_array_dbl_2d_variable_2nd_new(i32 %0, i32* nocapture %1, double %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %112, label %5
5: ; preds = %3
%6 = shl i32 %0, 3
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to double**
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %116
10: ; preds = %5
%11 = zext i32 %0 to i64
%12 = insertelement <2 x double> poison, double %2, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %2, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
br label %16
16: ; preds = %10, %109
%17 = phi i64 [ 0, %10 ], [ %110, %109 ]
%18 = getelementptr inbounds i32, i32* %1, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %107, label %21
21: ; preds = %16
%22 = shl i32 %19, 3
%23 = tail call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to double*
%25 = getelementptr inbounds double*, double** %8, i64 %17
store double* %24, double** %25
%26 = load i32, i32* %18
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %109
28: ; preds = %21
%29 = zext i32 %26 to i64
%30 = icmp ult i32 %26, 4
br i1 %30, label %100, label %31
31: ; preds = %28
%32 = and i64 %29, 4294967292
%33 = add nsw i64 %32, -4
%34 = lshr exact i64 %33, 2
%35 = add nuw nsw i64 %34, 1
%36 = and i64 %35, 7
%37 = icmp ult i64 %33, 28
br i1 %37, label %85, label %38
38: ; preds = %31
%39 = and i64 %35, 9223372036854775800
br label %40
40: ; preds = %40, %38
%41 = phi i64 [ 0, %38 ], [ %82, %40 ]
%42 = phi i64 [ 0, %38 ], [ %83, %40 ]
%43 = getelementptr inbounds double, double* %24, i64 %41
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> %13, <2 x double>* %44
%45 = getelementptr inbounds double, double* %43, i64 2
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %15, <2 x double>* %46
%47 = or i64 %41, 4
%48 = getelementptr inbounds double, double* %24, i64 %47
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %13, <2 x double>* %49
%50 = getelementptr inbounds double, double* %48, i64 2
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> %15, <2 x double>* %51
%52 = or i64 %41, 8
%53 = getelementptr inbounds double, double* %24, i64 %52
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %13, <2 x double>* %54
%55 = getelementptr inbounds double, double* %53, i64 2
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %15, <2 x double>* %56
%57 = or i64 %41, 12
%58 = getelementptr inbounds double, double* %24, i64 %57
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %13, <2 x double>* %59
%60 = getelementptr inbounds double, double* %58, i64 2
%61 = bitcast double* %60 to <2 x double>*
store <2 x double> %15, <2 x double>* %61
%62 = or i64 %41, 16
%63 = getelementptr inbounds double, double* %24, i64 %62
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> %13, <2 x double>* %64
%65 = getelementptr inbounds double, double* %63, i64 2
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %15, <2 x double>* %66
%67 = or i64 %41, 20
%68 = getelementptr inbounds double, double* %24, i64 %67
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %13, <2 x double>* %69
%70 = getelementptr inbounds double, double* %68, i64 2
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %15, <2 x double>* %71
%72 = or i64 %41, 24
%73 = getelementptr inbounds double, double* %24, i64 %72
%74 = bitcast double* %73 to <2 x double>*
store <2 x double> %13, <2 x double>* %74
%75 = getelementptr inbounds double, double* %73, i64 2
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> %15, <2 x double>* %76
%77 = or i64 %41, 28
%78 = getelementptr inbounds double, double* %24, i64 %77
%79 = bitcast double* %78 to <2 x double>*
store <2 x double> %13, <2 x double>* %79
%80 = getelementptr inbounds double, double* %78, i64 2
%81 = bitcast double* %80 to <2 x double>*
store <2 x double> %15, <2 x double>* %81
%82 = add nuw i64 %41, 32
%83 = add i64 %42, 8
%84 = icmp eq i64 %83, %39
br i1 %84, label %85, label %40
85: ; preds = %40, %31
%86 = phi i64 [ 0, %31 ], [ %82, %40 ]
%87 = icmp eq i64 %36, 0
br i1 %87, label %98, label %88
88: ; preds = %85, %88
%89 = phi i64 [ %95, %88 ], [ %86, %85 ]
%90 = phi i64 [ %96, %88 ], [ 0, %85 ]
%91 = getelementptr inbounds double, double* %24, i64 %89
%92 = bitcast double* %91 to <2 x double>*
store <2 x double> %13, <2 x double>* %92
%93 = getelementptr inbounds double, double* %91, i64 2
%94 = bitcast double* %93 to <2 x double>*
store <2 x double> %15, <2 x double>* %94
%95 = add nuw i64 %89, 4
%96 = add i64 %90, 1
%97 = icmp eq i64 %96, %36
br i1 %97, label %98, label %88
98: ; preds = %88, %85
%99 = icmp eq i64 %32, %29
br i1 %99, label %109, label %100
100: ; preds = %28, %98
%101 = phi i64 [ 0, %28 ], [ %32, %98 ]
br label %102
102: ; preds = %100, %102
%103 = phi i64 [ %105, %102 ], [ %101, %100 ]
%104 = getelementptr inbounds double, double* %24, i64 %103
store double %2, double* %104
%105 = add nuw nsw i64 %103, 1
%106 = icmp eq i64 %105, %29
br i1 %106, label %109, label %102
107: ; preds = %16
%108 = getelementptr inbounds double*, double** %8, i64 %17
store double* null, double** %108
br label %109
109: ; preds = %102, %98, %21, %107
%110 = add nuw nsw i64 %17, 1
%111 = icmp eq i64 %110, %11
br i1 %111, label %116, label %16
112: ; preds = %3
%113 = load i32, i32* @stderr
%114 = tail call i32 @fprintf(i32 %113, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str.1, i64 0, i64 0), i32 313)
%115 = tail call i32 @exit(i32 1)
unreachable
116: ; preds = %109, %5
ret double** %8
}