#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(void) {
  int i;
  float x[2048 * 2048];
  float y[2048 * 2048];
  for (i = 0; i < 2048 * 2048; i++) {
    x[i] = i * 1.4;
    y[i] = i / 0.9;
  }
  float a = 411.3;
#pragma scop
#pragma species kernel 0 : N - 1 | element ^ 0 : N - 1 | element->0 : N - 1 |  \
    element
  for (i = 0; i < 2048 * 2048; i++) {
    y[i] = a * x[i] + y[i];
  }
#pragma species endkernel saxpy
#pragma endscop
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2000020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x400000,-0x8(%rbp)
jge    1188 <main+0x78>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xecd(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x1000010(%rbp,%rax,4)
ff fe
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x2000010(%rbp,%rax,4)
ff fd
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
movss  0xe70(%rip),%xmm0
movss  %xmm0,-0x2000014(%rbp)
fd
movl   $0x0,-0x8(%rbp)
cmpl   $0x400000,-0x8(%rbp)
jge    11f1 <main+0xe1>
movss  -0x2000014(%rbp),%xmm0
fd
movslq -0x8(%rbp),%rax
movss  -0x1000010(%rbp,%rax,4),%xmm2
ff fe
movslq -0x8(%rbp),%rax
movss  -0x2000010(%rbp,%rax,4),%xmm1
ff fd
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x2000010(%rbp,%rax,4)
ff fd
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119f <main+0x8f>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x2000020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x2000008,%rsp
movdqa 0xee1(%rip),%xmm0
xor    %eax,%eax
movapd 0xee7(%rip),%xmm1
movapd 0xeef(%rip),%xmm2
movdqa 0xef6(%rip),%xmm8
movdqa 0xefe(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cvtdq2pd %xmm0,%xmm3
pshufd $0xee,%xmm0,%xmm6
cvtdq2pd %xmm6,%xmm6
movapd %xmm6,%xmm7
mulpd  %xmm1,%xmm7
movapd %xmm3,%xmm5
mulpd  %xmm1,%xmm5
cvtpd2ps %xmm5,%xmm5
cvtpd2ps %xmm7,%xmm7
unpcklpd %xmm7,%xmm5
divpd  %xmm2,%xmm6
divpd  %xmm2,%xmm3
cvtpd2ps %xmm3,%xmm3
cvtpd2ps %xmm6,%xmm6
movapd %xmm5,0x1000000(%rsp,%rax,4)
movdqa %xmm0,%xmm5
paddd  %xmm8,%xmm5
cvtdq2pd %xmm5,%xmm7
unpcklpd %xmm6,%xmm3
pshufd $0xee,%xmm5,%xmm5
cvtdq2pd %xmm5,%xmm5
movapd %xmm3,(%rsp,%rax,4)
movapd %xmm5,%xmm3
movapd %xmm7,%xmm6
mulpd  %xmm1,%xmm6
cvtpd2ps %xmm6,%xmm6
mulpd  %xmm1,%xmm3
cvtpd2ps %xmm3,%xmm3
unpcklpd %xmm3,%xmm6
movapd %xmm6,0x1000010(%rsp,%rax,4)
divpd  %xmm2,%xmm7
cvtpd2ps %xmm7,%xmm3
divpd  %xmm2,%xmm5
cvtpd2ps %xmm5,%xmm5
unpcklpd %xmm5,%xmm3
movapd %xmm3,0x10(%rsp,%rax,4)
add    $0x8,%rax
paddd  %xmm4,%xmm0
cmp    $0x400000,%rax
jne    1150 <main+0x40>
xor    %eax,%eax
movaps 0xe43(%rip),%xmm0
nopl   (%rax)
movaps 0x1000000(%rsp,%rax,4),%xmm1
01
mulps  %xmm0,%xmm1
addps  (%rsp,%rax,4),%xmm1
movaps 0x1000010(%rsp,%rax,4),%xmm2
01
mulps  %xmm0,%xmm2
addps  0x10(%rsp,%rax,4),%xmm2
movaps %xmm1,(%rsp,%rax,4)
movaps %xmm2,0x10(%rsp,%rax,4)
movaps 0x1000020(%rsp,%rax,4),%xmm1
01
mulps  %xmm0,%xmm1
addps  0x20(%rsp,%rax,4),%xmm1
movaps 0x1000030(%rsp,%rax,4),%xmm2
01
mulps  %xmm0,%xmm2
addps  0x30(%rsp,%rax,4),%xmm2
movaps %xmm1,0x20(%rsp,%rax,4)
movaps %xmm2,0x30(%rsp,%rax,4)
add    $0x10,%rax
cmp    $0x400000,%rax
jne    1210 <main+0x100>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
add    $0x2000008,%rsp
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4194304 x float]
%4 = alloca [4194304 x float]
%5 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 4194304
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 1.400000e+00
%13 = fptrunc double %12 to float
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4194304 x float], [4194304 x float]* %3, i64 0, i64 %15
store float %13, float* %16
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to double
%19 = fdiv double %18, 9.000000e-01
%20 = fptrunc double %19 to float
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [4194304 x float], [4194304 x float]* %4, i64 0, i64 %22
store float %20, float* %23
br label %24
24: ; preds = %9
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %6
27: ; preds = %6
store float 0x4079B4CCC0000000, float* %5
store i32 0, i32* %2
br label %28
28: ; preds = %45, %27
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 4194304
br i1 %30, label %31, label %48
31: ; preds = %28
%32 = load float, float* %5
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4194304 x float], [4194304 x float]* %3, i64 0, i64 %34
%36 = load float, float* %35
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [4194304 x float], [4194304 x float]* %4, i64 0, i64 %38
%40 = load float, float* %39
%41 = call float @llvm.fmuladd.f32(float %32, float %36, float %40)
%42 = load i32, i32* %2
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [4194304 x float], [4194304 x float]* %4, i64 0, i64 %43
store float %41, float* %44
br label %45
45: ; preds = %31
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %28
48: ; preds = %28
%49 = load i32, i32* @stdout
%50 = call i32 @fflush(i32 %49)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main() {
%1 = alloca [4194304 x float]
%2 = alloca [4194304 x float]
%3 = bitcast [4194304 x float]* %1 to i8*
%4 = bitcast [4194304 x float]* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ 0, %0 ], [ %28, %5 ]
%7 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %29, %5 ]
%8 = sitofp <4 x i32> %7 to <4 x double>
%9 = fmul <4 x double> %8, <double 1.400000e+00, double 1.400000e+00, double 1.400000e+00, double 1.400000e+00>
%10 = fptrunc <4 x double> %9 to <4 x float>
%11 = getelementptr inbounds [4194304 x float], [4194304 x float]* %1, i64 0, i64 %6
%12 = bitcast float* %11 to <4 x float>*
store <4 x float> %10, <4 x float>* %12
%13 = fdiv <4 x double> %8, <double 9.000000e-01, double 9.000000e-01, double 9.000000e-01, double 9.000000e-01>
%14 = fptrunc <4 x double> %13 to <4 x float>
%15 = getelementptr inbounds [4194304 x float], [4194304 x float]* %2, i64 0, i64 %6
%16 = bitcast float* %15 to <4 x float>*
store <4 x float> %14, <4 x float>* %16
%17 = or i64 %6, 4
%18 = add <4 x i32> %7, <i32 4, i32 4, i32 4, i32 4>
%19 = sitofp <4 x i32> %18 to <4 x double>
%20 = fmul <4 x double> %19, <double 1.400000e+00, double 1.400000e+00, double 1.400000e+00, double 1.400000e+00>
%21 = fptrunc <4 x double> %20 to <4 x float>
%22 = getelementptr inbounds [4194304 x float], [4194304 x float]* %1, i64 0, i64 %17
%23 = bitcast float* %22 to <4 x float>*
store <4 x float> %21, <4 x float>* %23
%24 = fdiv <4 x double> %19, <double 9.000000e-01, double 9.000000e-01, double 9.000000e-01, double 9.000000e-01>
%25 = fptrunc <4 x double> %24 to <4 x float>
%26 = getelementptr inbounds [4194304 x float], [4194304 x float]* %2, i64 0, i64 %17
%27 = bitcast float* %26 to <4 x float>*
store <4 x float> %25, <4 x float>* %27
%28 = add nuw nsw i64 %6, 8
%29 = add <4 x i32> %7, <i32 8, i32 8, i32 8, i32 8>
%30 = icmp eq i64 %28, 4194304
br i1 %30, label %31, label %5
31: ; preds = %5, %31
%32 = phi i64 [ %66, %31 ], [ 0, %5 ]
%33 = getelementptr inbounds [4194304 x float], [4194304 x float]* %1, i64 0, i64 %32
%34 = bitcast float* %33 to <4 x float>*
%35 = load <4 x float>, <4 x float>* %34
%36 = getelementptr inbounds float, float* %33, i64 4
%37 = bitcast float* %36 to <4 x float>*
%38 = load <4 x float>, <4 x float>* %37
%39 = getelementptr inbounds [4194304 x float], [4194304 x float]* %2, i64 0, i64 %32
%40 = bitcast float* %39 to <4 x float>*
%41 = load <4 x float>, <4 x float>* %40
%42 = getelementptr inbounds float, float* %39, i64 4
%43 = bitcast float* %42 to <4 x float>*
%44 = load <4 x float>, <4 x float>* %43
%45 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %35, <4 x float> <float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000>, <4 x float> %41)
%46 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %38, <4 x float> <float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000>, <4 x float> %44)
%47 = bitcast float* %39 to <4 x float>*
store <4 x float> %45, <4 x float>* %47
%48 = bitcast float* %42 to <4 x float>*
store <4 x float> %46, <4 x float>* %48
%49 = or i64 %32, 8
%50 = getelementptr inbounds [4194304 x float], [4194304 x float]* %1, i64 0, i64 %49
%51 = bitcast float* %50 to <4 x float>*
%52 = load <4 x float>, <4 x float>* %51
%53 = getelementptr inbounds float, float* %50, i64 4
%54 = bitcast float* %53 to <4 x float>*
%55 = load <4 x float>, <4 x float>* %54
%56 = getelementptr inbounds [4194304 x float], [4194304 x float]* %2, i64 0, i64 %49
%57 = bitcast float* %56 to <4 x float>*
%58 = load <4 x float>, <4 x float>* %57
%59 = getelementptr inbounds float, float* %56, i64 4
%60 = bitcast float* %59 to <4 x float>*
%61 = load <4 x float>, <4 x float>* %60
%62 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %52, <4 x float> <float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000>, <4 x float> %58)
%63 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %55, <4 x float> <float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000, float 0x4079B4CCC0000000>, <4 x float> %61)
%64 = bitcast float* %56 to <4 x float>*
store <4 x float> %62, <4 x float>* %64
%65 = bitcast float* %59 to <4 x float>*
store <4 x float> %63, <4 x float>* %65
%66 = add nuw nsw i64 %32, 16
%67 = icmp eq i64 %66, 4194304
br i1 %67, label %68, label %31
68: ; preds = %31
%69 = load i32, i32* @stdout
%70 = tail call i32 @fflush(i32 %69)
ret i32 0
}