#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*/ abort();
int /*<<< orphan*/ foo(double *, double *, double *);
int main() {
  double b[1024], d[2 * 1024], f[1024];
  int i;
  for (i = 0; i < 2 * 1024; i++)
    d[i] = 1.;
  foo(b, d, f);
  for (i = 0; i < 1024; i += 2) {
    if (d[2 * i] != 2.)
      abort();
    if (d[2 * i + 1] != 4.)
      abort();
  }
  for (i = 0; i < 1024; i++) {
    if (b[i] != 1.)
      abort();
    if (f[i] != 6.)
      abort();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8014(%rbp)
cmpl   $0x800,-0x8014(%rbp)
jge    1178 <main+0x58>
movslq -0x8014(%rbp),%rax
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x6010(%rbp,%rax,8)
ff ff
mov    -0x8014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8014(%rbp)
jmp    113c <main+0x1c>
lea    -0x2010(%rbp),%rdi
lea    -0x6010(%rbp),%rsi
lea    -0x8010(%rbp),%rdx
call   1040 <foo@plt>
movl   $0x0,-0x8014(%rbp)
cmpl   $0x400,-0x8014(%rbp)
jge    1238 <main+0x118>
mov    -0x8014(%rbp),%eax
shl    $0x1,%eax
cltq
movsd  -0x6010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xe48(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11dd <main+0xbd>
jp     11dd <main+0xbd>
jmp    11e4 <main+0xc4>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8014(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
movsd  -0x6010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xe15(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1218 <main+0xf8>
jp     1218 <main+0xf8>
jmp    121f <main+0xff>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1224 <main+0x104>
mov    -0x8014(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8014(%rbp)
jmp    119c <main+0x7c>
movl   $0x0,-0x8014(%rbp)
cmpl   $0x400,-0x8014(%rbp)
jge    12d3 <main+0x1b3>
movslq -0x8014(%rbp),%rax
movsd  -0x2010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xd96(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    127f <main+0x15f>
jp     127f <main+0x15f>
jmp    1286 <main+0x166>
mov    $0x0,%al
call   1030 <abort@plt>
movslq -0x8014(%rbp),%rax
movsd  -0x8010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xd6a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    12b3 <main+0x193>
jp     12b3 <main+0x193>
jmp    12ba <main+0x19a>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    12bf <main+0x19f>
mov    -0x8014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8014(%rbp)
jmp    1242 <main+0x122>
xor    %eax,%eax
add    $0x8020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x8008,%rsp
xor    %eax,%eax
movaps 0xed0(%rip),%xmm0
movaps %xmm0,(%rsp,%rax,8)
movaps %xmm0,0x10(%rsp,%rax,8)
movaps %xmm0,0x20(%rsp,%rax,8)
movaps %xmm0,0x30(%rsp,%rax,8)
movaps %xmm0,0x40(%rsp,%rax,8)
movaps %xmm0,0x50(%rsp,%rax,8)
movaps %xmm0,0x60(%rsp,%rax,8)
movaps %xmm0,0x70(%rsp,%rax,8)
movaps %xmm0,0x80(%rsp,%rax,8)
movaps %xmm0,0x90(%rsp,%rax,8)
movaps %xmm0,0xa0(%rsp,%rax,8)
movaps %xmm0,0xb0(%rsp,%rax,8)
movaps %xmm0,0xc0(%rsp,%rax,8)
movaps %xmm0,0xd0(%rsp,%rax,8)
movaps %xmm0,0xe0(%rsp,%rax,8)
movaps %xmm0,0xf0(%rsp,%rax,8)
add    $0x20,%rax
cmp    $0x800,%rax
jne    1130 <main+0x10>
lea    0x6000(%rsp),%rdi
mov    %rsp,%rsi
lea    0x4000(%rsp),%rdx
call   1040 <foo@plt>
lea    0x28(%rsp),%rax
mov    $0xfffffffffffffffe,%rcx
movsd  0xe41(%rip),%xmm0
movsd  0xe41(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movsd  -0x28(%rax),%xmm2
ucomisd %xmm0,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
movsd  -0x20(%rax),%xmm2
ucomisd %xmm1,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
movsd  -0x8(%rax),%xmm2
ucomisd %xmm0,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
movsd  (%rax),%xmm2
ucomisd %xmm1,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
add    $0x40,%rax
add    $0x4,%rcx
cmp    $0x3fe,%rcx
jb     11e0 <main+0xc0>
xor    %eax,%eax
movsd  0xdd2(%rip),%xmm0
movsd  0xdd2(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  0x6000(%rsp,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
movsd  0x4000(%rsp,%rax,8),%xmm2
ucomisd %xmm1,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
movsd  0x6008(%rsp,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
movsd  0x4008(%rsp,%rax,8),%xmm2
ucomisd %xmm1,%xmm2
jne    12ba <main+0x19a>
jp     12ba <main+0x19a>
add    $0x2,%rax
cmp    $0x400,%rax
jne    1260 <main+0x140>
xor    %eax,%eax
add    $0x8008,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x double]
%3 = alloca [2048 x double]
%4 = alloca [1024 x double]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2048
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 %11
store double 1.000000e+00, double* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
%17 = getelementptr inbounds [1024 x double], [1024 x double]* %2, i64 0, i64 0
%18 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 0
%19 = getelementptr inbounds [1024 x double], [1024 x double]* %4, i64 0, i64 0
%20 = call i32 @foo(double* %17, double* %18, double* %19)
store i32 0, i32* %5
br label %21
21: ; preds = %44, %16
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 1024
br i1 %23, label %24, label %47
24: ; preds = %21
%25 = load i32, i32* %5
%26 = mul nsw i32 2, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 %27
%29 = load double, double* %28
%30 = fcmp une double %29, 2.000000e+00
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %24
%34 = load i32, i32* %5
%35 = mul nsw i32 2, %34
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 %37
%39 = load double, double* %38
%40 = fcmp une double %39, 4.000000e+00
br i1 %40, label %41, label %43
41: ; preds = %33
%42 = call i32 (...) @abort()
unreachable
43: ; preds = %33
br label %44
44: ; preds = %43
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 2
store i32 %46, i32* %5
br label %21
47: ; preds = %21
store i32 0, i32* %5
br label %48
48: ; preds = %68, %47
%49 = load i32, i32* %5
%50 = icmp slt i32 %49, 1024
br i1 %50, label %51, label %71
51: ; preds = %48
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [1024 x double], [1024 x double]* %2, i64 0, i64 %53
%55 = load double, double* %54
%56 = fcmp une double %55, 1.000000e+00
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = call i32 (...) @abort()
unreachable
59: ; preds = %51
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [1024 x double], [1024 x double]* %4, i64 0, i64 %61
%63 = load double, double* %62
%64 = fcmp une double %63, 6.000000e+00
br i1 %64, label %65, label %67
65: ; preds = %59
%66 = call i32 (...) @abort()
unreachable
67: ; preds = %59
br label %68
68: ; preds = %67
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
store i32 %70, i32* %5
br label %48
71: ; preds = %48
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1024 x double]
%2 = alloca [2048 x double]
%3 = alloca [1024 x double]
%4 = bitcast [1024 x double]* %1 to i8*
%5 = bitcast [2048 x double]* %2 to i8*
%6 = bitcast [1024 x double]* %3 to i8*
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ 0, %0 ], [ %48, %7 ]
%9 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %8
%10 = bitcast double* %9 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %10
%11 = getelementptr inbounds double, double* %9, i64 2
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %12
%13 = or i64 %8, 4
%14 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %13
%15 = bitcast double* %14 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %15
%16 = getelementptr inbounds double, double* %14, i64 2
%17 = bitcast double* %16 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %17
%18 = or i64 %8, 8
%19 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %18
%20 = bitcast double* %19 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %20
%21 = getelementptr inbounds double, double* %19, i64 2
%22 = bitcast double* %21 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %22
%23 = or i64 %8, 12
%24 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %23
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %25
%26 = getelementptr inbounds double, double* %24, i64 2
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %27
%28 = or i64 %8, 16
%29 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %28
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %30
%31 = getelementptr inbounds double, double* %29, i64 2
%32 = bitcast double* %31 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %32
%33 = or i64 %8, 20
%34 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %33
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %35
%36 = getelementptr inbounds double, double* %34, i64 2
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %37
%38 = or i64 %8, 24
%39 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %38
%40 = bitcast double* %39 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %40
%41 = getelementptr inbounds double, double* %39, i64 2
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %42
%43 = or i64 %8, 28
%44 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %43
%45 = bitcast double* %44 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %45
%46 = getelementptr inbounds double, double* %44, i64 2
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %47
%48 = add nuw nsw i64 %8, 32
%49 = icmp eq i64 %48, 2048
br i1 %49, label %50, label %7
50: ; preds = %7
%51 = getelementptr inbounds [1024 x double], [1024 x double]* %1, i64 0, i64 0
%52 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 0
%53 = getelementptr inbounds [1024 x double], [1024 x double]* %3, i64 0, i64 0
%54 = call i32 @foo(double* %51, double* %52, double* %53)
br label %69
55: ; preds = %77
%56 = or i64 %70, 2
%57 = shl nuw nsw i64 %56, 1
%58 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %57
%59 = load double, double* %58
%60 = fcmp une double %59, 2.000000e+00
br i1 %60, label %75, label %61
61: ; preds = %55
%62 = or i64 %57, 1
%63 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %62
%64 = load double, double* %63
%65 = fcmp une double %64, 4.000000e+00
br i1 %65, label %82, label %66
66: ; preds = %61
%67 = add nuw nsw i64 %70, 4
%68 = icmp ult i64 %56, 1022
br i1 %68, label %69, label %96
69: ; preds = %66, %50
%70 = phi i64 [ 0, %50 ], [ %67, %66 ]
%71 = shl nuw nsw i64 %70, 1
%72 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %71
%73 = load double, double* %72
%74 = fcmp une double %73, 2.000000e+00
br i1 %74, label %75, label %77
75: ; preds = %55, %69
%76 = call i32 (...) @abort()
unreachable
77: ; preds = %69
%78 = or i64 %71, 1
%79 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %78
%80 = load double, double* %79
%81 = fcmp une double %80, 4.000000e+00
br i1 %81, label %82, label %55
82: ; preds = %61, %77
%83 = call i32 (...) @abort()
unreachable
84: ; preds = %103
%85 = or i64 %97, 1
%86 = getelementptr inbounds [1024 x double], [1024 x double]* %1, i64 0, i64 %85
%87 = load double, double* %86
%88 = fcmp une double %87, 1.000000e+00
br i1 %88, label %101, label %89
89: ; preds = %84
%90 = getelementptr inbounds [1024 x double], [1024 x double]* %3, i64 0, i64 %85
%91 = load double, double* %90
%92 = fcmp une double %91, 6.000000e+00
br i1 %92, label %107, label %93
93: ; preds = %89
%94 = add nuw nsw i64 %97, 2
%95 = icmp eq i64 %94, 1024
br i1 %95, label %109, label %96
96: ; preds = %66, %93
%97 = phi i64 [ %94, %93 ], [ 0, %66 ]
%98 = getelementptr inbounds [1024 x double], [1024 x double]* %1, i64 0, i64 %97
%99 = load double, double* %98
%100 = fcmp une double %99, 1.000000e+00
br i1 %100, label %101, label %103
101: ; preds = %84, %96
%102 = call i32 (...) @abort()
unreachable
103: ; preds = %96
%104 = getelementptr inbounds [1024 x double], [1024 x double]* %3, i64 0, i64 %97
%105 = load double, double* %104
%106 = fcmp une double %105, 6.000000e+00
br i1 %106, label %107, label %84
107: ; preds = %89, %103
%108 = call i32 (...) @abort()
unreachable
109: ; preds = %93
ret i32 0
}