double **new_realloc_double(double **array, int ext1, int ext2) {
  int a, b;
  int first, l1;
  int second, l2;
  double **new_array;
  first = read_size_double(array, sizeof(double *));
  second = read_size_double(array[0], sizeof(double));
  if (ext1 == -1)
    ext1 = first;
  if (ext2 == -1)
    ext2 = second;
  l1 = (((ext1) < (first)) ? (ext1) : (first));
  l2 = (((ext2) < (second)) ? (ext2) : (second));
  new_array = declare_arrayN(2, sizeof(double), ext1, ext2);
  for (a = 0; a < l1; a++)
    for (b = 0; b < l2; b++)
      new_array[a][b] = array[a][b];
  free_double(array, -1);
  return new_array;
}


x86 assembly (clang, -O0):
<new_realloc_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <read_size_double@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <read_size_double@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    117b <new_realloc_double+0x4b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    118b <new_realloc_double+0x5b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11a2 <new_realloc_double+0x72>
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11a8 <new_realloc_double+0x78>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11c5 <new_realloc_double+0x95>
mov    -0x10(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    11cb <new_realloc_double+0x9b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x2,%edi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <declare_arrayN@plt>
cltq
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    125f <new_realloc_double+0x12f>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    124c <new_realloc_double+0x11c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1208 <new_realloc_double+0xd8>
jmp    1251 <new_realloc_double+0x121>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f5 <new_realloc_double+0xc5>
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1050 <free_double@plt>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_realloc_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r12d
mov    %esi,%ebx
mov    %rdi,%rbp
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <read_size_double@plt>
mov    %eax,%r15d
mov    0x0(%rbp),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <read_size_double@plt>
cmp    $0xffffffff,%ebx
cmove  %r15d,%ebx
mov    %eax,%r14d
cmp    $0xffffffff,%r12d
cmove  %eax,%r12d
cmp    %r15d,%ebx
cmovl  %ebx,%r15d
cmp    %eax,%r12d
cmovl  %r12d,%r14d
mov    $0x8,%esi
mov    $0x2,%edi
mov    %ebx,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1040 <declare_arrayN@plt>
mov    %rbp,%rdi
movslq %eax,%r12
test   %r15d,%r15d
jle    1370 <new_realloc_double+0x240>
mov    %r15d,%r15d
mov    %r14d,%ecx
mov    %ecx,%r11d
and    $0xfffffffc,%r11d
lea    -0x4(%r11),%rax
mov    %rax,0x10(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r9d
and    $0x3,%r9d
and    $0xfffffffffffffffc,%rax
mov    %rax,(%rsp)
mov    %ecx,%r13d
and    $0x3,%r13d
mov    %r9,0x8(%rsp)
shl    $0x5,%r9
xor    %r8d,%r8d
jmp    11fd <new_realloc_double+0xcd>
nopl   0x0(%rax)
add    $0x1,%r8
cmp    %r15,%r8
je     1370 <new_realloc_double+0x240>
test   %r14d,%r14d
jle    11f0 <new_realloc_double+0xc0>
mov    (%rdi,%r8,8),%rbx
mov    (%r12,%r8,8),%rax
cmp    $0x4,%r14d
jb     1226 <new_realloc_double+0xf6>
lea    (%rbx,%rcx,8),%rsi
cmp    %rsi,%rax
jae    129c <new_realloc_double+0x16c>
lea    (%rax,%rcx,8),%rsi
cmp    %rsi,%rbx
jae    129c <new_realloc_double+0x16c>
xor    %esi,%esi
mov    %rsi,%rbp
not    %rbp
add    %rcx,%rbp
test   %r13,%r13
je     1254 <new_realloc_double+0x124>
mov    %r13,%rdx
nopl   0x0(%rax)
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
add    $0x1,%rsi
add    $0xffffffffffffffff,%rdx
jne    1240 <new_realloc_double+0x110>
cmp    $0x3,%rbp
jb     11f0 <new_realloc_double+0xc0>
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
movsd  0x8(%rbx,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rax,%rsi,8)
movsd  0x10(%rbx,%rsi,8),%xmm0
movsd  %xmm0,0x10(%rax,%rsi,8)
movsd  0x18(%rbx,%rsi,8),%xmm0
movsd  %xmm0,0x18(%rax,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%rcx
jne    1260 <new_realloc_double+0x130>
jmp    11f0 <new_realloc_double+0xc0>
mov    %rdi,%rdx
cmpq   $0xc,0x10(%rsp)
jae    12ab <new_realloc_double+0x17b>
xor    %esi,%esi
jmp    1318 <new_realloc_double+0x1e8>
mov    (%rsp),%r10
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movups (%rbx,%rsi,8),%xmm0
movups 0x10(%rbx,%rsi,8),%xmm1
movups %xmm0,(%rax,%rsi,8)
movups %xmm1,0x10(%rax,%rsi,8)
movups 0x20(%rbx,%rsi,8),%xmm0
movups 0x30(%rbx,%rsi,8),%xmm1
movups %xmm0,0x20(%rax,%rsi,8)
movups %xmm1,0x30(%rax,%rsi,8)
movups 0x40(%rbx,%rsi,8),%xmm0
movups 0x50(%rbx,%rsi,8),%xmm1
movups %xmm0,0x40(%rax,%rsi,8)
movups %xmm1,0x50(%rax,%rsi,8)
movups 0x60(%rbx,%rsi,8),%xmm0
movups 0x70(%rbx,%rsi,8),%xmm1
movups %xmm0,0x60(%rax,%rsi,8)
movups %xmm1,0x70(%rax,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%r10
jne    12c0 <new_realloc_double+0x190>
cmpq   $0x0,0x8(%rsp)
je     135c <new_realloc_double+0x22c>
lea    (%rax,%rsi,8),%rbp
add    $0x10,%rbp
lea    (%rbx,%rsi,8),%rsi
add    $0x10,%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups -0x10(%rsi,%rdi,1),%xmm0
movups (%rsi,%rdi,1),%xmm1
movups %xmm0,-0x10(%rbp,%rdi,1)
movups %xmm1,0x0(%rbp,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%r9
jne    1340 <new_realloc_double+0x210>
mov    %r11,%rsi
cmp    %rcx,%r11
mov    %rdx,%rdi
je     11f0 <new_realloc_double+0xc0>
jmp    1228 <new_realloc_double+0xf8>
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1050 <free_double@plt>
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @new_realloc_double(double** %0, i32 %1, i32 %2) {
%4 = alloca double**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double**
store double** %0, double*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%14 = load double**, double*** %4
%15 = call i32 (double**, i64, ...) bitcast (i32 (...)* @read_size_double to i32 (double**, i64, ...)*)(double** %14, i64 8)
store i32 %15, i32* %9
%16 = load double**, double*** %4
%17 = getelementptr inbounds double*, double** %16, i64 0
%18 = load double*, double** %17
%19 = call i32 (double*, i64, ...) bitcast (i32 (...)* @read_size_double to i32 (double*, i64, ...)*)(double* %18, i64 8)
store i32 %19, i32* %11
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %3
%23 = load i32, i32* %9
store i32 %23, i32* %5
br label %24
24: ; preds = %22, %3
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = load i32, i32* %11
store i32 %28, i32* %6
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %5
%31 = load i32, i32* %9
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = load i32, i32* %5
br label %37
35: ; preds = %29
%36 = load i32, i32* %9
br label %37
37: ; preds = %35, %33
%38 = phi i32 [ %34, %33 ], [ %36, %35 ]
store i32 %38, i32* %10
%39 = load i32, i32* %6
%40 = load i32, i32* %11
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = load i32, i32* %6
br label %46
44: ; preds = %37
%45 = load i32, i32* %11
br label %46
46: ; preds = %44, %42
%47 = phi i32 [ %43, %42 ], [ %45, %44 ]
store i32 %47, i32* %12
%48 = load i32, i32* %5
%49 = load i32, i32* %6
%50 = call i32 (i32, i64, i32, i32, ...) bitcast (i32 (...)* @declare_arrayN to i32 (i32, i64, i32, i32, ...)*)(i32 2, i64 8, i32 %48, i32 %49)
%51 = sext i32 %50 to i64
%52 = inttoptr i64 %51 to double**
store double** %52, double*** %13
store i32 0, i32* %7
br label %53
53: ; preds = %84, %46
%54 = load i32, i32* %7
%55 = load i32, i32* %10
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %87
57: ; preds = %53
store i32 0, i32* %8
br label %58
58: ; preds = %80, %57
%59 = load i32, i32* %8
%60 = load i32, i32* %12
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %83
62: ; preds = %58
%63 = load double**, double*** %4
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double*, double** %63, i64 %65
%67 = load double*, double** %66
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
%71 = load double, double* %70
%72 = load double**, double*** %13
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double*, double** %72, i64 %74
%76 = load double*, double** %75
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
store double %71, double* %79
br label %80
80: ; preds = %62
%81 = load i32, i32* %8
%82 = add nsw i32 %81, 1
store i32 %82, i32* %8
br label %58
83: ; preds = %58
br label %84
84: ; preds = %83
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 1
store i32 %86, i32* %7
br label %53
87: ; preds = %53
%88 = load double**, double*** %4
%89 = call i32 (double**, i32, ...) bitcast (i32 (...)* @free_double to i32 (double**, i32, ...)*)(double** %88, i32 -1)
%90 = load double**, double*** %13
ret double** %90
}

LLVM IR (-O2):
define double** @new_realloc_double(double** %0, i32 %1, i32 %2) {
%4 = tail call i32 (double**, i64, ...) bitcast (i32 (...)* @read_size_double to i32 (double**, i64, ...)*)(double** %0, i64 8)
%5 = load double*, double** %0
%6 = tail call i32 (double*, i64, ...) bitcast (i32 (...)* @read_size_double to i32 (double*, i64, ...)*)(double* %5, i64 8)
%7 = icmp eq i32 %1, -1
%8 = select i1 %7, i32 %4, i32 %1
%9 = icmp eq i32 %2, -1
%10 = select i1 %9, i32 %6, i32 %2
%11 = icmp slt i32 %8, %4
%12 = select i1 %11, i32 %8, i32 %4
%13 = icmp slt i32 %10, %6
%14 = select i1 %13, i32 %10, i32 %6
%15 = tail call i32 (i32, i64, i32, i32, ...) bitcast (i32 (...)* @declare_arrayN to i32 (i32, i64, i32, i32, ...)*)(i32 2, i64 8, i32 %8, i32 %10)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to double**
%18 = icmp sgt i32 %12, 0
br i1 %18, label %19, label %156
19: ; preds = %3
%20 = icmp sgt i32 %14, 0
%21 = zext i32 %12 to i64
%22 = zext i32 %14 to i64
%23 = and i64 %22, 4294967292
%24 = add nsw i64 %23, -4
%25 = lshr exact i64 %24, 2
%26 = add nuw nsw i64 %25, 1
%27 = icmp ult i32 %14, 4
%28 = and i64 %22, 4294967292
%29 = and i64 %26, 3
%30 = icmp ult i64 %24, 12
%31 = and i64 %26, 9223372036854775804
%32 = icmp eq i64 %29, 0
%33 = icmp eq i64 %28, %22
%34 = and i64 %22, 3
%35 = icmp eq i64 %34, 0
br label %36
36: ; preds = %19, %153
%37 = phi i64 [ 0, %19 ], [ %154, %153 ]
br i1 %20, label %38, label %153
38: ; preds = %36
%39 = getelementptr inbounds double*, double** %0, i64 %37
%40 = load double*, double** %39
%41 = getelementptr inbounds double*, double** %17, i64 %37
%42 = load double*, double** %41
br i1 %27, label %118, label %43
43: ; preds = %38
%44 = getelementptr double, double* %42, i64 %22
%45 = getelementptr double, double* %40, i64 %22
%46 = icmp ult double* %42, %45
%47 = icmp ult double* %40, %44
%48 = and i1 %46, %47
br i1 %48, label %118, label %49
49: ; preds = %43
br i1 %30, label %99, label %50
50: ; preds = %49, %50
%51 = phi i64 [ %96, %50 ], [ 0, %49 ]
%52 = phi i64 [ %97, %50 ], [ 0, %49 ]
%53 = getelementptr inbounds double, double* %40, i64 %51
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = getelementptr inbounds double, double* %53, i64 2
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = getelementptr inbounds double, double* %42, i64 %51
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %55, <2 x double>* %60
%61 = getelementptr inbounds double, double* %59, i64 2
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> %58, <2 x double>* %62
%63 = or i64 %51, 4
%64 = getelementptr inbounds double, double* %40, i64 %63
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = getelementptr inbounds double, double* %64, i64 2
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = getelementptr inbounds double, double* %42, i64 %63
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %66, <2 x double>* %71
%72 = getelementptr inbounds double, double* %70, i64 2
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> %69, <2 x double>* %73
%74 = or i64 %51, 8
%75 = getelementptr inbounds double, double* %40, i64 %74
%76 = bitcast double* %75 to <2 x double>*
%77 = load <2 x double>, <2 x double>* %76
%78 = getelementptr inbounds double, double* %75, i64 2
%79 = bitcast double* %78 to <2 x double>*
%80 = load <2 x double>, <2 x double>* %79
%81 = getelementptr inbounds double, double* %42, i64 %74
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> %77, <2 x double>* %82
%83 = getelementptr inbounds double, double* %81, i64 2
%84 = bitcast double* %83 to <2 x double>*
store <2 x double> %80, <2 x double>* %84
%85 = or i64 %51, 12
%86 = getelementptr inbounds double, double* %40, i64 %85
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = getelementptr inbounds double, double* %86, i64 2
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = getelementptr inbounds double, double* %42, i64 %85
%93 = bitcast double* %92 to <2 x double>*
store <2 x double> %88, <2 x double>* %93
%94 = getelementptr inbounds double, double* %92, i64 2
%95 = bitcast double* %94 to <2 x double>*
store <2 x double> %91, <2 x double>* %95
%96 = add nuw i64 %51, 16
%97 = add nuw i64 %52, 4
%98 = icmp eq i64 %97, %31
br i1 %98, label %99, label %50
99: ; preds = %50, %49
%100 = phi i64 [ 0, %49 ], [ %96, %50 ]
br i1 %32, label %117, label %101
101: ; preds = %99, %101
%102 = phi i64 [ %114, %101 ], [ %100, %99 ]
%103 = phi i64 [ %115, %101 ], [ 0, %99 ]
%104 = getelementptr inbounds double, double* %40, i64 %102
%105 = bitcast double* %104 to <2 x double>*
%106 = load <2 x double>, <2 x double>* %105
%107 = getelementptr inbounds double, double* %104, i64 2
%108 = bitcast double* %107 to <2 x double>*
%109 = load <2 x double>, <2 x double>* %108
%110 = getelementptr inbounds double, double* %42, i64 %102
%111 = bitcast double* %110 to <2 x double>*
store <2 x double> %106, <2 x double>* %111
%112 = getelementptr inbounds double, double* %110, i64 2
%113 = bitcast double* %112 to <2 x double>*
store <2 x double> %109, <2 x double>* %113
%114 = add nuw i64 %102, 4
%115 = add i64 %103, 1
%116 = icmp eq i64 %115, %29
br i1 %116, label %117, label %101
117: ; preds = %101, %99
br i1 %33, label %153, label %118
118: ; preds = %43, %38, %117
%119 = phi i64 [ 0, %43 ], [ 0, %38 ], [ %28, %117 ]
%120 = xor i64 %119, -1
%121 = add nsw i64 %120, %22
br i1 %35, label %131, label %122
122: ; preds = %118, %122
%123 = phi i64 [ %128, %122 ], [ %119, %118 ]
%124 = phi i64 [ %129, %122 ], [ 0, %118 ]
%125 = getelementptr inbounds double, double* %40, i64 %123
%126 = load double, double* %125
%127 = getelementptr inbounds double, double* %42, i64 %123
store double %126, double* %127
%128 = add nuw nsw i64 %123, 1
%129 = add i64 %124, 1
%130 = icmp eq i64 %129, %34
br i1 %130, label %131, label %122
131: ; preds = %122, %118
%132 = phi i64 [ %119, %118 ], [ %128, %122 ]
%133 = icmp ult i64 %121, 3
br i1 %133, label %153, label %134
134: ; preds = %131, %134
%135 = phi i64 [ %151, %134 ], [ %132, %131 ]
%136 = getelementptr inbounds double, double* %40, i64 %135
%137 = load double, double* %136
%138 = getelementptr inbounds double, double* %42, i64 %135
store double %137, double* %138
%139 = add nuw nsw i64 %135, 1
%140 = getelementptr inbounds double, double* %40, i64 %139
%141 = load double, double* %140
%142 = getelementptr inbounds double, double* %42, i64 %139
store double %141, double* %142
%143 = add nuw nsw i64 %135, 2
%144 = getelementptr inbounds double, double* %40, i64 %143
%145 = load double, double* %144
%146 = getelementptr inbounds double, double* %42, i64 %143
store double %145, double* %146
%147 = add nuw nsw i64 %135, 3
%148 = getelementptr inbounds double, double* %40, i64 %147
%149 = load double, double* %148
%150 = getelementptr inbounds double, double* %42, i64 %147
store double %149, double* %150
%151 = add nuw nsw i64 %135, 4
%152 = icmp eq i64 %151, %22
br i1 %152, label %153, label %134
153: ; preds = %131, %134, %117, %36
%154 = add nuw nsw i64 %37, 1
%155 = icmp eq i64 %154, %21
br i1 %155, label %156, label %36
156: ; preds = %153, %3
%157 = tail call i32 (double**, i32, ...) bitcast (i32 (...)* @free_double to i32 (double**, i32, ...)*)(double** %0, i32 -1)
ret double** %17
}