#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 */
double *calloc(int, int);
int /*<<< orphan*/ free(double *);
int main(void) {
  double *array = calloc(10000, sizeof(double));
  double sum = 0;
  int i;
  int length = 10000;
  int limit = length - 31;
  double x0 = 0;
  double x1 = 0;
  double *ptr;
  for (i = 0; i < 600000; i++) {
    for (ptr = array; ptr < &array[limit]; ptr += 32) {
      x0 += *ptr + *(ptr + 2) + *(ptr + 4) + *(ptr + 6) + *(ptr + 8) +
            *(ptr + 10) + *(ptr + 12) + *(ptr + 14) + *(ptr + 16) +
            *(ptr + 18) + *(ptr + 20) + *(ptr + 22) + *(ptr + 24) +
            *(ptr + 26) + *(ptr + 28) + *(ptr + 30);
      x1 += *(ptr + 1) + *(ptr + 3) + *(ptr + 5) + *(ptr + 7) + *(ptr + 9) +
            *(ptr + 11) + *(ptr + 13) + *(ptr + 15) + *(ptr + 17) +
            *(ptr + 19) + *(ptr + 21) + *(ptr + 23) + *(ptr + 25) +
            *(ptr + 27) + *(ptr + 29) + *(ptr + 31);
    }
    for (; ptr < &array[length]; ptr++)
      x0 += *ptr;
    sum = x0 + x1;
  }
  free(array);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2710,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x2710,-0x20(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x1f,%eax
mov    %eax,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x927c0,-0x1c(%rbp)
jge    1379 <main+0x259>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    1318 <main+0x1f8>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x10(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x20(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x30(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x40(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x50(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x60(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x70(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x80(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x90(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xa0(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xb0(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xc0(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xd0(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xe0(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xf0(%rax),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x18(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x28(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x38(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x48(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x58(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x68(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x78(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x88(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0x98(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xa8(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xb8(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xc8(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xd8(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xe8(%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  0xf8(%rax),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x100,%rax
mov    %rax,-0x40(%rbp)
jmp    1186 <main+0x66>
jmp    131d <main+0x1fd>
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x20(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    135c <main+0x23c>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
jmp    131d <main+0x1fd>
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1171 <main+0x51>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2710,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double*
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double*
store i32 0, i32* %1
%10 = call double* @calloc(i32 10000, i32 8)
store double* %10, double** %2
store double 0.000000e+00, double* %3
store i32 10000, i32* %5
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 31
store i32 %12, i32* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store i32 0, i32* %4
br label %13
13: ; preds = %178, %0
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 600000
br i1 %15, label %16, label %181
16: ; preds = %13
%17 = load double*, double** %2
store double* %17, double** %9
br label %18
18: ; preds = %155, %16
%19 = load double*, double** %9
%20 = load double*, double** %2
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
%24 = icmp ult double* %19, %23
br i1 %24, label %25, label %158
25: ; preds = %18
%26 = load double*, double** %9
%27 = load double, double* %26
%28 = load double*, double** %9
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = fadd double %27, %30
%32 = load double*, double** %9
%33 = getelementptr inbounds double, double* %32, i64 4
%34 = load double, double* %33
%35 = fadd double %31, %34
%36 = load double*, double** %9
%37 = getelementptr inbounds double, double* %36, i64 6
%38 = load double, double* %37
%39 = fadd double %35, %38
%40 = load double*, double** %9
%41 = getelementptr inbounds double, double* %40, i64 8
%42 = load double, double* %41
%43 = fadd double %39, %42
%44 = load double*, double** %9
%45 = getelementptr inbounds double, double* %44, i64 10
%46 = load double, double* %45
%47 = fadd double %43, %46
%48 = load double*, double** %9
%49 = getelementptr inbounds double, double* %48, i64 12
%50 = load double, double* %49
%51 = fadd double %47, %50
%52 = load double*, double** %9
%53 = getelementptr inbounds double, double* %52, i64 14
%54 = load double, double* %53
%55 = fadd double %51, %54
%56 = load double*, double** %9
%57 = getelementptr inbounds double, double* %56, i64 16
%58 = load double, double* %57
%59 = fadd double %55, %58
%60 = load double*, double** %9
%61 = getelementptr inbounds double, double* %60, i64 18
%62 = load double, double* %61
%63 = fadd double %59, %62
%64 = load double*, double** %9
%65 = getelementptr inbounds double, double* %64, i64 20
%66 = load double, double* %65
%67 = fadd double %63, %66
%68 = load double*, double** %9
%69 = getelementptr inbounds double, double* %68, i64 22
%70 = load double, double* %69
%71 = fadd double %67, %70
%72 = load double*, double** %9
%73 = getelementptr inbounds double, double* %72, i64 24
%74 = load double, double* %73
%75 = fadd double %71, %74
%76 = load double*, double** %9
%77 = getelementptr inbounds double, double* %76, i64 26
%78 = load double, double* %77
%79 = fadd double %75, %78
%80 = load double*, double** %9
%81 = getelementptr inbounds double, double* %80, i64 28
%82 = load double, double* %81
%83 = fadd double %79, %82
%84 = load double*, double** %9
%85 = getelementptr inbounds double, double* %84, i64 30
%86 = load double, double* %85
%87 = fadd double %83, %86
%88 = load double, double* %7
%89 = fadd double %88, %87
store double %89, double* %7
%90 = load double*, double** %9
%91 = getelementptr inbounds double, double* %90, i64 1
%92 = load double, double* %91
%93 = load double*, double** %9
%94 = getelementptr inbounds double, double* %93, i64 3
%95 = load double, double* %94
%96 = fadd double %92, %95
%97 = load double*, double** %9
%98 = getelementptr inbounds double, double* %97, i64 5
%99 = load double, double* %98
%100 = fadd double %96, %99
%101 = load double*, double** %9
%102 = getelementptr inbounds double, double* %101, i64 7
%103 = load double, double* %102
%104 = fadd double %100, %103
%105 = load double*, double** %9
%106 = getelementptr inbounds double, double* %105, i64 9
%107 = load double, double* %106
%108 = fadd double %104, %107
%109 = load double*, double** %9
%110 = getelementptr inbounds double, double* %109, i64 11
%111 = load double, double* %110
%112 = fadd double %108, %111
%113 = load double*, double** %9
%114 = getelementptr inbounds double, double* %113, i64 13
%115 = load double, double* %114
%116 = fadd double %112, %115
%117 = load double*, double** %9
%118 = getelementptr inbounds double, double* %117, i64 15
%119 = load double, double* %118
%120 = fadd double %116, %119
%121 = load double*, double** %9
%122 = getelementptr inbounds double, double* %121, i64 17
%123 = load double, double* %122
%124 = fadd double %120, %123
%125 = load double*, double** %9
%126 = getelementptr inbounds double, double* %125, i64 19
%127 = load double, double* %126
%128 = fadd double %124, %127
%129 = load double*, double** %9
%130 = getelementptr inbounds double, double* %129, i64 21
%131 = load double, double* %130
%132 = fadd double %128, %131
%133 = load double*, double** %9
%134 = getelementptr inbounds double, double* %133, i64 23
%135 = load double, double* %134
%136 = fadd double %132, %135
%137 = load double*, double** %9
%138 = getelementptr inbounds double, double* %137, i64 25
%139 = load double, double* %138
%140 = fadd double %136, %139
%141 = load double*, double** %9
%142 = getelementptr inbounds double, double* %141, i64 27
%143 = load double, double* %142
%144 = fadd double %140, %143
%145 = load double*, double** %9
%146 = getelementptr inbounds double, double* %145, i64 29
%147 = load double, double* %146
%148 = fadd double %144, %147
%149 = load double*, double** %9
%150 = getelementptr inbounds double, double* %149, i64 31
%151 = load double, double* %150
%152 = fadd double %148, %151
%153 = load double, double* %8
%154 = fadd double %153, %152
store double %154, double* %8
br label %155
155: ; preds = %25
%156 = load double*, double** %9
%157 = getelementptr inbounds double, double* %156, i64 32
store double* %157, double** %9
br label %18
158: ; preds = %18
br label %159
159: ; preds = %171, %158
%160 = load double*, double** %9
%161 = load double*, double** %2
%162 = load i32, i32* %5
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %161, i64 %163
%165 = icmp ult double* %160, %164
br i1 %165, label %166, label %174
166: ; preds = %159
%167 = load double*, double** %9
%168 = load double, double* %167
%169 = load double, double* %7
%170 = fadd double %169, %168
store double %170, double* %7
br label %171
171: ; preds = %166
%172 = load double*, double** %9
%173 = getelementptr inbounds double, double* %172, i32 1
store double* %173, double** %9
br label %159
174: ; preds = %159
%175 = load double, double* %7
%176 = load double, double* %8
%177 = fadd double %175, %176
store double %177, double* %3
br label %178
178: ; preds = %174
%179 = load i32, i32* %4
%180 = add nsw i32 %179, 1
store i32 %180, i32* %4
br label %13
181: ; preds = %13
%182 = load double*, double** %2
%183 = call i32 @free(double* %182)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double* @calloc(i32 10000, i32 8)
%2 = tail call i32 @free(double* %1)
ret i32 0
}