#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*/ free(double *);
double *make1Darray(int);
double *reduce1Darray(double *array, int new_len, int old_len) {
  double *tmp_array = make1Darray(new_len);
  int ii;
  for (ii = 0; ii < new_len; ii++) {
    tmp_array[ii] = array[ii];
  }
  free(array);
  return tmp_array;
}


x86 assembly (clang, -O0):
<reduce1Darray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <make1Darray@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1179 <reduce1Darray+0x59>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1145 <reduce1Darray+0x25>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reduce1Darray>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <make1Darray@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    12a4 <reduce1Darray+0x184>
mov    %ebp,%eax
cmp    $0x4,%ebp
jb     1158 <reduce1Darray+0x38>
lea    (%r14,%rax,8),%rcx
cmp    %rcx,%rbx
jae    11d0 <reduce1Darray+0xb0>
lea    (%rbx,%rax,8),%rcx
cmp    %r14,%rcx
jbe    11d0 <reduce1Darray+0xb0>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %rax,%rdx
mov    %rax,%rsi
and    $0x3,%rsi
je     1185 <reduce1Darray+0x65>
nopl   0x0(%rax)
movsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    1170 <reduce1Darray+0x50>
cmp    $0x3,%rdx
jb     12a4 <reduce1Darray+0x184>
nop
movsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
movsd  0x10(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
movsd  0x18(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    1190 <reduce1Darray+0x70>
jmp    12a4 <reduce1Darray+0x184>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0xc,%rdi
jae    11f3 <reduce1Darray+0xd3>
xor    %edi,%edi
jmp    1260 <reduce1Darray+0x140>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
movups (%r14,%rdi,8),%xmm0
movups 0x10(%r14,%rdi,8),%xmm1
movups %xmm0,(%rbx,%rdi,8)
movups %xmm1,0x10(%rbx,%rdi,8)
movups 0x20(%r14,%rdi,8),%xmm0
movups 0x30(%r14,%rdi,8),%xmm1
movups %xmm0,0x20(%rbx,%rdi,8)
movups %xmm1,0x30(%rbx,%rdi,8)
movups 0x40(%r14,%rdi,8),%xmm0
movups 0x50(%r14,%rdi,8),%xmm1
movups %xmm0,0x40(%rbx,%rdi,8)
movups %xmm1,0x50(%rbx,%rdi,8)
movups 0x60(%r14,%rdi,8),%xmm0
movups 0x70(%r14,%rdi,8),%xmm1
movups %xmm0,0x60(%rbx,%rdi,8)
movups %xmm1,0x70(%rbx,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1200 <reduce1Darray+0xe0>
test   %rdx,%rdx
je     129b <reduce1Darray+0x17b>
lea    (%rbx,%rdi,8),%rsi
add    $0x10,%rsi
lea    (%r14,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rdx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movups -0x10(%rdi,%rbp,1),%xmm0
movups (%rdi,%rbp,1),%xmm1
movups %xmm0,-0x10(%rsi,%rbp,1)
movups %xmm1,(%rsi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%rdx
jne    1280 <reduce1Darray+0x160>
cmp    %rax,%rcx
jne    115a <reduce1Darray+0x3a>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double* @reduce1Darray(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = call double* @make1Darray(i32 %9)
store double* %10, double** %7
store i32 0, i32* %8
br label %11
11: ; preds = %25, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = load double*, double** %4
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
store double %20, double* %24
br label %25
25: ; preds = %15
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %11
28: ; preds = %11
%29 = load double*, double** %4
%30 = call i32 @free(double* %29)
%31 = load double*, double** %7
ret double* %31
}

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