#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 *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, double);
int main(int argc, char **argv) {
  int N = 100000;
  double *a, *b, *c;
  a = (double *)malloc(N * sizeof(double));
  b = (double *)malloc(N * sizeof(double));
  c = (double *)malloc(N * sizeof(double));
  for (int n = 0; n < N; n++) {
    a[n] = n;
    b[n] = N - n;
  }
  for (int n = 0; n < N; n++) {
    c[n] = a[n] + b[n];
  }
  int printId = 0;
  printf("c[%d] = %f \n", printId, c[printId]);
  free(a);
  free(b);
  free(c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x186a0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d0 <main+0xa0>
cvtsi2sdl -0x34(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
sub    -0x34(%rbp),%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118d <main+0x5d>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1218 <main+0xe8>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d7 <main+0xa7>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdca(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xc3500,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0xc3500,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0xc3500,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
lea    0xc3500(%r14),%rcx
lea    0xc3500(%rbx),%rax
cmp    %rax,%r14
jae    11cf <main+0x9f>
cmp    %rcx,%rbx
jae    11cf <main+0x9f>
mov    $0x1869f,%edx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
lea    0x1(%rdx),%edi
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
movsd  %xmm0,(%r14,%rsi,8)
lea    0x1(%rsi),%edi
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  %xmm1,(%rbx,%rsi,8)
movsd  %xmm0,0x8(%r14,%rsi,8)
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x8(%rbx,%rsi,8)
add    $0xfffffffe,%edx
add    $0x2,%rsi
cmp    $0x186a0,%rsi
jne    1180 <main+0x50>
jmp    1251 <main+0x121>
movdqa 0xe29(%rip),%xmm0
mov    $0x2,%edx
movdqa 0xe2c(%rip),%xmm1
movdqa 0xe34(%rip),%xmm2
movdqa 0xe3c(%rip),%xmm3
movdqa 0xe44(%rip),%xmm4
movdqa %xmm0,%xmm5
movdqa %xmm0,%xmm6
paddd  %xmm1,%xmm6
cvtdq2pd %xmm0,%xmm7
cvtdq2pd %xmm6,%xmm6
movups %xmm7,-0x10(%r14,%rdx,8)
movups %xmm6,(%r14,%rdx,8)
movdqa %xmm2,%xmm6
psubd  %xmm5,%xmm6
movdqa %xmm3,%xmm7
psubd  %xmm5,%xmm7
cvtdq2pd %xmm6,%xmm6
cvtdq2pd %xmm7,%xmm7
movups %xmm6,-0x10(%rbx,%rdx,8)
movups %xmm7,(%rbx,%rdx,8)
paddd  %xmm4,%xmm0
paddd  %xmm4,%xmm5
add    $0x4,%rdx
cmp    $0x186a2,%rdx
jne    1200 <main+0xd0>
lea    0xc3500(%r15),%rdx
cmp    %rcx,%r15
setb   %sil
cmp    %rdx,%r14
setb   %cl
cmp    %rax,%r15
setb   %al
cmp    %rdx,%rbx
setb   %dl
test   %cl,%sil
jne    12eb <main+0x1bb>
and    %dl,%al
jne    12eb <main+0x1bb>
mov    $0x6,%eax
nop
movupd -0x30(%r14,%rax,8),%xmm0
movupd -0x20(%r14,%rax,8),%xmm1
movupd -0x30(%rbx,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd -0x20(%rbx,%rax,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,-0x30(%r15,%rax,8)
movupd %xmm0,-0x20(%r15,%rax,8)
movupd -0x10(%r14,%rax,8),%xmm0
movupd (%r14,%rax,8),%xmm1
movupd -0x10(%rbx,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd (%rbx,%rax,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,-0x10(%r15,%rax,8)
movupd %xmm0,(%r15,%rax,8)
add    $0x8,%rax
cmp    $0x186a6,%rax
jne    1280 <main+0x150>
jmp    1349 <main+0x219>
mov    $0x3,%eax
movsd  -0x18(%r14,%rax,8),%xmm0
addsd  -0x18(%rbx,%rax,8),%xmm0
movsd  %xmm0,-0x18(%r15,%rax,8)
movsd  -0x10(%r14,%rax,8),%xmm0
addsd  -0x10(%rbx,%rax,8),%xmm0
movsd  %xmm0,-0x10(%r15,%rax,8)
movsd  -0x8(%r14,%rax,8),%xmm0
addsd  -0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,-0x8(%r15,%rax,8)
movsd  (%r14,%rax,8),%xmm0
addsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
add    $0x4,%rax
cmp    $0x186a3,%rax
jne    12f0 <main+0x1c0>
movsd  (%r15),%xmm0
lea    0xcfb(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"c[%d] = %f \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100000, i32* %6
%13 = load i32, i32* %6
%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** %7
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to double*
store double* %24, double** %8
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 8
%28 = trunc i64 %27 to i32
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to double*
store double* %30, double** %9
store i32 0, i32* %10
br label %31
31: ; preds = %50, %2
%32 = load i32, i32* %10
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %53
35: ; preds = %31
%36 = load i32, i32* %10
%37 = sitofp i32 %36 to double
%38 = load double*, double** %7
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double %37, double* %41
%42 = load i32, i32* %6
%43 = load i32, i32* %10
%44 = sub nsw i32 %42, %43
%45 = sitofp i32 %44 to double
%46 = load double*, double** %8
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
store double %45, double* %49
br label %50
50: ; preds = %35
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
br label %31
53: ; preds = %31
store i32 0, i32* %11
br label %54
54: ; preds = %74, %53
%55 = load i32, i32* %11
%56 = load i32, i32* %6
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %77
58: ; preds = %54
%59 = load double*, double** %7
%60 = load i32, i32* %11
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
%63 = load double, double* %62
%64 = load double*, double** %8
%65 = load i32, i32* %11
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = fadd double %63, %68
%70 = load double*, double** %9
%71 = load i32, i32* %11
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
store double %69, double* %73
br label %74
74: ; preds = %58
%75 = load i32, i32* %11
%76 = add nsw i32 %75, 1
store i32 %76, i32* %11
br label %54
77: ; preds = %54
store i32 0, i32* %12
%78 = load i32, i32* %12
%79 = load double*, double** %9
%80 = load i32, i32* %12
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %78, double %83)
%85 = load double*, double** %7
%86 = call i32 @free(double* %85)
%87 = load double*, double** %8
%88 = call i32 @free(double* %87)
%89 = load double*, double** %9
%90 = call i32 @free(double* %89)
%91 = load i32, i32* %3
ret i32 %91
}

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