#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*/ check_vect();
int /*<<< orphan*/ foo(double *, double *, double *);
int main() {
  double b[1024], d[2 * 1024], f[1024];
  int i;
  check_vect();
  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)
mov    $0x0,%al
call   1040 <check_vect@plt>
movl   $0x0,-0x8014(%rbp)
cmpl   $0x800,-0x8014(%rbp)
jge    118f <main+0x5f>
movslq -0x8014(%rbp),%rax
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x6010(%rbp,%rax,8)
ff ff
mov    -0x8014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8014(%rbp)
jmp    1153 <main+0x23>
lea    -0x2010(%rbp),%rdi
lea    -0x6010(%rbp),%rsi
lea    -0x8010(%rbp),%rdx
call   1050 <foo@plt>
movl   $0x0,-0x8014(%rbp)
cmpl   $0x400,-0x8014(%rbp)
jge    124f <main+0x11f>
mov    -0x8014(%rbp),%eax
shl    $0x1,%eax
cltq
movsd  -0x6010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xe31(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11f4 <main+0xc4>
jp     11f4 <main+0xc4>
jmp    11fb <main+0xcb>
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  0xdfe(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    122f <main+0xff>
jp     122f <main+0xff>
jmp    1236 <main+0x106>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    123b <main+0x10b>
mov    -0x8014(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8014(%rbp)
jmp    11b3 <main+0x83>
movl   $0x0,-0x8014(%rbp)
cmpl   $0x400,-0x8014(%rbp)
jge    12ea <main+0x1ba>
movslq -0x8014(%rbp),%rax
movsd  -0x2010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xd7f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1296 <main+0x166>
jp     1296 <main+0x166>
jmp    129d <main+0x16d>
mov    $0x0,%al
call   1030 <abort@plt>
movslq -0x8014(%rbp),%rax
movsd  -0x8010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xd53(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    12ca <main+0x19a>
jp     12ca <main+0x19a>
jmp    12d1 <main+0x1a1>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    12d6 <main+0x1a6>
mov    -0x8014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8014(%rbp)
jmp    1259 <main+0x129>
xor    %eax,%eax
add    $0x8020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x8000,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <check_vect@plt>
movaps 0xeb8(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movaps %xmm0,(%rsp,%rbx,8)
movaps %xmm0,0x10(%rsp,%rbx,8)
movaps %xmm0,0x20(%rsp,%rbx,8)
movaps %xmm0,0x30(%rsp,%rbx,8)
movaps %xmm0,0x40(%rsp,%rbx,8)
movaps %xmm0,0x50(%rsp,%rbx,8)
movaps %xmm0,0x60(%rsp,%rbx,8)
movaps %xmm0,0x70(%rsp,%rbx,8)
movaps %xmm0,0x80(%rsp,%rbx,8)
movaps %xmm0,0x90(%rsp,%rbx,8)
movaps %xmm0,0xa0(%rsp,%rbx,8)
movaps %xmm0,0xb0(%rsp,%rbx,8)
movaps %xmm0,0xc0(%rsp,%rbx,8)
movaps %xmm0,0xd0(%rsp,%rbx,8)
movaps %xmm0,0xe0(%rsp,%rbx,8)
movaps %xmm0,0xf0(%rsp,%rbx,8)
add    $0x20,%rbx
cmp    $0x800,%rbx
jne    1150 <main+0x20>
lea    0x6000(%rsp),%rdi
mov    %rsp,%rsi
lea    0x4000(%rsp),%rdx
call   1050 <foo@plt>
lea    0x28(%rsp),%rax
mov    $0xfffffffffffffffe,%rcx
movsd  0xe20(%rip),%xmm0
movsd  0xe20(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
movsd  -0x28(%rax),%xmm2
ucomisd %xmm0,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
movsd  -0x20(%rax),%xmm2
ucomisd %xmm1,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
movsd  -0x8(%rax),%xmm2
ucomisd %xmm0,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
movsd  (%rax),%xmm2
ucomisd %xmm1,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
add    $0x40,%rax
add    $0x4,%rcx
cmp    $0x3fe,%rcx
jb     1200 <main+0xd0>
xor    %eax,%eax
movsd  0xdb2(%rip),%xmm0
movsd  0xdb2(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  0x6000(%rsp,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
movsd  0x4000(%rsp,%rax,8),%xmm2
ucomisd %xmm1,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
movsd  0x6008(%rsp,%rax,8),%xmm2
ucomisd %xmm0,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
movsd  0x4008(%rsp,%rax,8),%xmm2
ucomisd %xmm1,%xmm2
jne    12db <main+0x1ab>
jp     12db <main+0x1ab>
add    $0x2,%rax
cmp    $0x400,%rax
jne    1280 <main+0x150>
xor    %eax,%eax
add    $0x8000,%rsp
pop    %rbx
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
%6 = call i32 (...) @check_vect()
store i32 0, i32* %5
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 2048
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 %12
store double 1.000000e+00, double* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %7
17: ; preds = %7
%18 = getelementptr inbounds [1024 x double], [1024 x double]* %2, i64 0, i64 0
%19 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 0
%20 = getelementptr inbounds [1024 x double], [1024 x double]* %4, i64 0, i64 0
%21 = call i32 @foo(double* %18, double* %19, double* %20)
store i32 0, i32* %5
br label %22
22: ; preds = %45, %17
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 1024
br i1 %24, label %25, label %48
25: ; preds = %22
%26 = load i32, i32* %5
%27 = mul nsw i32 2, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 %28
%30 = load double, double* %29
%31 = fcmp une double %30, 2.000000e+00
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 (...) @abort()
unreachable
34: ; preds = %25
%35 = load i32, i32* %5
%36 = mul nsw i32 2, %35
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [2048 x double], [2048 x double]* %3, i64 0, i64 %38
%40 = load double, double* %39
%41 = fcmp une double %40, 4.000000e+00
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = call i32 (...) @abort()
unreachable
44: ; preds = %34
br label %45
45: ; preds = %44
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 2
store i32 %47, i32* %5
br label %22
48: ; preds = %22
store i32 0, i32* %5
br label %49
49: ; preds = %69, %48
%50 = load i32, i32* %5
%51 = icmp slt i32 %50, 1024
br i1 %51, label %52, label %72
52: ; preds = %49
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [1024 x double], [1024 x double]* %2, i64 0, i64 %54
%56 = load double, double* %55
%57 = fcmp une double %56, 1.000000e+00
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = call i32 (...) @abort()
unreachable
60: ; preds = %52
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [1024 x double], [1024 x double]* %4, i64 0, i64 %62
%64 = load double, double* %63
%65 = fcmp une double %64, 6.000000e+00
br i1 %65, label %66, label %68
66: ; preds = %60
%67 = call i32 (...) @abort()
unreachable
68: ; preds = %60
br label %69
69: ; preds = %68
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 1
store i32 %71, i32* %5
br label %49
72: ; preds = %49
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*
%7 = tail call i32 (...) @check_vect()
br label %8
8: ; preds = %8, %0
%9 = phi i64 [ 0, %0 ], [ %49, %8 ]
%10 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %9
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %11
%12 = getelementptr inbounds double, double* %10, i64 2
%13 = bitcast double* %12 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %13
%14 = or i64 %9, 4
%15 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %14
%16 = bitcast double* %15 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %16
%17 = getelementptr inbounds double, double* %15, i64 2
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %18
%19 = or i64 %9, 8
%20 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %19
%21 = bitcast double* %20 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %21
%22 = getelementptr inbounds double, double* %20, i64 2
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %23
%24 = or i64 %9, 12
%25 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %24
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %26
%27 = getelementptr inbounds double, double* %25, i64 2
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %28
%29 = or i64 %9, 16
%30 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %29
%31 = bitcast double* %30 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %31
%32 = getelementptr inbounds double, double* %30, i64 2
%33 = bitcast double* %32 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %33
%34 = or i64 %9, 20
%35 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %34
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %36
%37 = getelementptr inbounds double, double* %35, i64 2
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %38
%39 = or i64 %9, 24
%40 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %39
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %43
%44 = or i64 %9, 28
%45 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %44
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %46
%47 = getelementptr inbounds double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %48
%49 = add nuw nsw i64 %9, 32
%50 = icmp eq i64 %49, 2048
br i1 %50, label %51, label %8
51: ; preds = %8
%52 = getelementptr inbounds [1024 x double], [1024 x double]* %1, i64 0, i64 0
%53 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 0
%54 = getelementptr inbounds [1024 x double], [1024 x double]* %3, i64 0, i64 0
%55 = call i32 @foo(double* %52, double* %53, double* %54)
br label %70
56: ; preds = %78
%57 = or i64 %71, 2
%58 = shl nuw nsw i64 %57, 1
%59 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %58
%60 = load double, double* %59
%61 = fcmp une double %60, 2.000000e+00
br i1 %61, label %76, label %62
62: ; preds = %56
%63 = or i64 %58, 1
%64 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %63
%65 = load double, double* %64
%66 = fcmp une double %65, 4.000000e+00
br i1 %66, label %83, label %67
67: ; preds = %62
%68 = add nuw nsw i64 %71, 4
%69 = icmp ult i64 %57, 1022
br i1 %69, label %70, label %97
70: ; preds = %67, %51
%71 = phi i64 [ 0, %51 ], [ %68, %67 ]
%72 = shl nuw nsw i64 %71, 1
%73 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %72
%74 = load double, double* %73
%75 = fcmp une double %74, 2.000000e+00
br i1 %75, label %76, label %78
76: ; preds = %56, %70
%77 = call i32 (...) @abort()
unreachable
78: ; preds = %70
%79 = or i64 %72, 1
%80 = getelementptr inbounds [2048 x double], [2048 x double]* %2, i64 0, i64 %79
%81 = load double, double* %80
%82 = fcmp une double %81, 4.000000e+00
br i1 %82, label %83, label %56
83: ; preds = %62, %78
%84 = call i32 (...) @abort()
unreachable
85: ; preds = %104
%86 = or i64 %98, 1
%87 = getelementptr inbounds [1024 x double], [1024 x double]* %1, i64 0, i64 %86
%88 = load double, double* %87
%89 = fcmp une double %88, 1.000000e+00
br i1 %89, label %102, label %90
90: ; preds = %85
%91 = getelementptr inbounds [1024 x double], [1024 x double]* %3, i64 0, i64 %86
%92 = load double, double* %91
%93 = fcmp une double %92, 6.000000e+00
br i1 %93, label %108, label %94
94: ; preds = %90
%95 = add nuw nsw i64 %98, 2
%96 = icmp eq i64 %95, 1024
br i1 %96, label %110, label %97
97: ; preds = %67, %94
%98 = phi i64 [ %95, %94 ], [ 0, %67 ]
%99 = getelementptr inbounds [1024 x double], [1024 x double]* %1, i64 0, i64 %98
%100 = load double, double* %99
%101 = fcmp une double %100, 1.000000e+00
br i1 %101, label %102, label %104
102: ; preds = %85, %97
%103 = call i32 (...) @abort()
unreachable
104: ; preds = %97
%105 = getelementptr inbounds [1024 x double], [1024 x double]* %3, i64 0, i64 %98
%106 = load double, double* %105
%107 = fcmp une double %106, 6.000000e+00
br i1 %107, label %108, label %85
108: ; preds = %90, %104
%109 = call i32 (...) @abort()
unreachable
110: ; preds = %94
ret i32 0
}