#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, j;
  float A[4096][4096];
  float x[4096];
  float y[4096];
  float tmp[4096];
  for (i = 0; i < 4096; i++) {
    x[i] = i * 3.14159;
  }
  for (i = 0; i < 4096; i++) {
    for (j = 0; j < 4096; j++) {
      A[i][j] = ((float)i * (j + 1)) / 4096;
    }
  }
#pragma scop
#pragma species kernel A[0 : 4095, 0 : 4095] |                                 \
                         chunk(0 : 0, 0 : 4095) ^                              \
                             x[0 : 4095] | full->tmp[0 : 4095] | element
  for (i = 0; i < 4096; i++) {
    tmp[i] = 0;
    for (j = 0; j < 4096; j++) {
      tmp[i] = tmp[i] + A[i][j] * x[j];
    }
  }
#pragma species endkernel atax - part1
#pragma species kernel A[0 : 4095, 0 : 4095] |                                 \
                         chunk(0 : 4095, 0 : 0) ^                              \
                             tmp[0 : 4095] | full->y[0 : 4095] | element
  for (j = 0; j < 4096; j++) {
    y[j] = 0;
    for (i = 0; i < 4096; i++) {
      y[j] = y[j] + A[i][j] * tmp[i];
    }
  }
#pragma species endkernel atax - part2
#pragma endscop
  fflush(stdout);
  y[9] = y[9];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400c010,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    1166 <main+0x56>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xec5(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x4004010(%rbp,%rax,4)
ff fb
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    11e9 <main+0xd9>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1000,-0xc(%rbp)
jge    11d6 <main+0xc6>
cvtsi2ssl -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  0xe57(%rip),%xmm1
divss  %xmm1,%xmm0
movslq -0x8(%rbp),%rcx
lea    -0x4000010(%rbp),%rax
shl    $0xe,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1181 <main+0x71>
jmp    11db <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x5d>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    128c <main+0x17c>
movslq -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,-0x400c010(%rbp,%rax,4)
ff fb
movl   $0x0,-0xc(%rbp)
cmpl   $0x1000,-0xc(%rbp)
jge    1279 <main+0x169>
movslq -0x8(%rbp),%rax
movss  -0x400c010(%rbp,%rax,4),%xmm1
ff fb
movslq -0x8(%rbp),%rcx
lea    -0x4000010(%rbp),%rax
shl    $0xe,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0xc(%rbp),%rax
movss  -0x4004010(%rbp,%rax,4),%xmm2
ff fb
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x400c010(%rbp,%rax,4)
ff fb
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1214 <main+0x104>
jmp    127e <main+0x16e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f0 <main+0xe0>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1000,-0xc(%rbp)
jge    132f <main+0x21f>
movslq -0xc(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4008010(%rbp,%rax,4)
ff fb
movl   $0x0,-0x8(%rbp)
cmpl   $0x1000,-0x8(%rbp)
jge    131c <main+0x20c>
movslq -0xc(%rbp),%rax
movss  -0x4008010(%rbp,%rax,4),%xmm1
ff fb
movslq -0x8(%rbp),%rcx
lea    -0x4000010(%rbp),%rax
shl    $0xe,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x8(%rbp),%rax
movss  -0x400c010(%rbp,%rax,4),%xmm2
ff fb
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movslq -0xc(%rbp),%rax
movss  %xmm0,-0x4008010(%rbp,%rax,4)
ff fb
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12b7 <main+0x1a7>
jmp    1321 <main+0x211>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1293 <main+0x183>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
movss  -0x4007fec(%rbp),%xmm0
fb
movss  %xmm0,-0x4007fec(%rbp)
fb
xor    %eax,%eax
add    $0x400c010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4096 x [4096 x float]]
%5 = alloca [4096 x float]
%6 = alloca [4096 x float]
%7 = alloca [4096 x float]
store i32 0, i32* %1
store i32 0, i32* %2
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 4096
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 3.141590e+00
%15 = fptrunc double %14 to float
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4096 x float], [4096 x float]* %5, i64 0, i64 %17
store float %15, float* %18
br label %19
19: ; preds = %11
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %8
22: ; preds = %8
store i32 0, i32* %2
br label %23
23: ; preds = %48, %22
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 4096
br i1 %25, label %26, label %51
26: ; preds = %23
store i32 0, i32* %3
br label %27
27: ; preds = %44, %26
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 4096
br i1 %29, label %30, label %47
30: ; preds = %27
%31 = load i32, i32* %2
%32 = sitofp i32 %31 to float
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
%35 = sitofp i32 %34 to float
%36 = fmul float %32, %35
%37 = fdiv float %36, 4.096000e+03
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [4096 x [4096 x float]], [4096 x [4096 x float]]* %4, i64 0, i64 %39
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [4096 x float], [4096 x float]* %40, i64 0, i64 %42
store float %37, float* %43
br label %44
44: ; preds = %30
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %27
47: ; preds = %27
br label %48
48: ; preds = %47
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %23
51: ; preds = %23
store i32 0, i32* %2
br label %52
52: ; preds = %86, %51
%53 = load i32, i32* %2
%54 = icmp slt i32 %53, 4096
br i1 %54, label %55, label %89
55: ; preds = %52
%56 = load i32, i32* %2
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [4096 x float], [4096 x float]* %7, i64 0, i64 %57
store float 0.000000e+00, float* %58
store i32 0, i32* %3
br label %59
59: ; preds = %82, %55
%60 = load i32, i32* %3
%61 = icmp slt i32 %60, 4096
br i1 %61, label %62, label %85
62: ; preds = %59
%63 = load i32, i32* %2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [4096 x float], [4096 x float]* %7, i64 0, i64 %64
%66 = load float, float* %65
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [4096 x [4096 x float]], [4096 x [4096 x float]]* %4, i64 0, i64 %68
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [4096 x float], [4096 x float]* %69, i64 0, i64 %71
%73 = load float, float* %72
%74 = load i32, i32* %3
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [4096 x float], [4096 x float]* %5, i64 0, i64 %75
%77 = load float, float* %76
%78 = call float @llvm.fmuladd.f32(float %73, float %77, float %66)
%79 = load i32, i32* %2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [4096 x float], [4096 x float]* %7, i64 0, i64 %80
store float %78, float* %81
br label %82
82: ; preds = %62
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 1
store i32 %84, i32* %3
br label %59
85: ; preds = %59
br label %86
86: ; preds = %85
%87 = load i32, i32* %2
%88 = add nsw i32 %87, 1
store i32 %88, i32* %2
br label %52
89: ; preds = %52
store i32 0, i32* %3
br label %90
90: ; preds = %124, %89
%91 = load i32, i32* %3
%92 = icmp slt i32 %91, 4096
br i1 %92, label %93, label %127
93: ; preds = %90
%94 = load i32, i32* %3
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %95
store float 0.000000e+00, float* %96
store i32 0, i32* %2
br label %97
97: ; preds = %120, %93
%98 = load i32, i32* %2
%99 = icmp slt i32 %98, 4096
br i1 %99, label %100, label %123
100: ; preds = %97
%101 = load i32, i32* %3
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %102
%104 = load float, float* %103
%105 = load i32, i32* %2
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [4096 x [4096 x float]], [4096 x [4096 x float]]* %4, i64 0, i64 %106
%108 = load i32, i32* %3
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [4096 x float], [4096 x float]* %107, i64 0, i64 %109
%111 = load float, float* %110
%112 = load i32, i32* %2
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [4096 x float], [4096 x float]* %7, i64 0, i64 %113
%115 = load float, float* %114
%116 = call float @llvm.fmuladd.f32(float %111, float %115, float %104)
%117 = load i32, i32* %3
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %118
store float %116, float* %119
br label %120
120: ; preds = %100
%121 = load i32, i32* %2
%122 = add nsw i32 %121, 1
store i32 %122, i32* %2
br label %97
123: ; preds = %97
br label %124
124: ; preds = %123
%125 = load i32, i32* %3
%126 = add nsw i32 %125, 1
store i32 %126, i32* %3
br label %90
127: ; preds = %90
%128 = load i32, i32* @stdout
%129 = call i32 @fflush(i32 %128)
%130 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 9
%131 = load float, float* %130
%132 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 9
store float %131, float* %132
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
ret i32 0
}