#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 */
void *calloc(int, int);
float consumer_raw(int, int);
float **noStoreComputeChunked() {
  int x, y, i, j;
  int yo, y_base, y_in, yi, py;
  float **consumer_arr;
  float storeMe;
  int numPasses = 40 / 1;
  if (40 % 1)
    numPasses++;
  consumer_arr = calloc(4, sizeof(float *));
  for (i = 0; i < 4; i++)
    consumer_arr[i] = calloc(40, sizeof(float));
#pragma omp parallel for private(yo, y_in, y_base, x, yi, py, storeMe)
  for (yo = 0; yo < numPasses; yo++) {
    y_base = 1 * yo;
    if (y_base > 40 - 1)
      y_base = 40 - 1;
    for (x = 0; x < 4; x++) {
      for (y_in = 0; y_in < 1; y_in++) {
        y = y_base + y_in;
        storeMe = consumer_raw(x, y);
        if (storeMe - (x * y + (x + 1) * (y + 1) + x * (y + 1) + y * (x + 1)) >
            0.001f)
          consumer_arr[x][y] = storeMe;
      }
    }
  }
  return consumer_arr;
}


x86 assembly (clang, -O0):
<noStoreComputeChunked>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x28,-0x38(%rbp)
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    117f <noStoreComputeChunked+0x5f>
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <noStoreComputeChunked+0x29>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    128c <noStoreComputeChunked+0x16c>
mov    -0x14(%rbp),%eax
shl    $0x0,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x27,-0x18(%rbp)
jle    11ac <noStoreComputeChunked+0x8c>
movl   $0x27,-0x18(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    1279 <noStoreComputeChunked+0x159>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    1266 <noStoreComputeChunked+0x146>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <consumer_raw@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
movss  0xdd0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1253 <noStoreComputeChunked+0x133>
movss  -0x34(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1258 <noStoreComputeChunked+0x138>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c4 <noStoreComputeChunked+0xa4>
jmp    126b <noStoreComputeChunked+0x14b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b3 <noStoreComputeChunked+0x93>
jmp    127e <noStoreComputeChunked+0x15e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <noStoreComputeChunked+0x66>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noStoreComputeChunked>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,0x20(%rsp)
mov    %rax,(%rbx)
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,0x18(%rsp)
mov    %rax,0x8(%rbx)
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,0x10(%rsp)
mov    %rax,0x10(%rbx)
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rbx,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x18(%rbx)
mov    $0x1,%r14d
mov    $0x7,%r15d
mov    $0x5,%r12d
mov    $0x3,%r13d
mov    $0x1,%ebx
jmp    11ed <noStoreComputeChunked+0xcd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14
add    $0xe,%r15d
add    $0xa,%r12d
add    $0x6,%r13d
add    $0x2,%ebx
cmp    $0x29,%r14
je     12ba <noStoreComputeChunked+0x19a>
lea    -0x1(%r14),%rbp
xor    %edi,%edi
mov    %ebp,%esi
call   1040 <consumer_raw@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
movss  0xdf0(%rip),%xmm1
ucomiss %xmm1,%xmm2
jbe    1221 <noStoreComputeChunked+0x101>
mov    0x20(%rsp),%rax
movss  %xmm0,-0x4(%rax,%r14,4)
mov    $0x1,%edi
mov    %ebp,%esi
call   1040 <consumer_raw@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %r13d,%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
ucomiss 0xdbd(%rip),%xmm2
jbe    1251 <noStoreComputeChunked+0x131>
mov    0x18(%rsp),%rax
movss  %xmm0,-0x4(%rax,%r14,4)
mov    $0x2,%edi
mov    %ebp,%esi
call   1040 <consumer_raw@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %r12d,%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
ucomiss 0xd8d(%rip),%xmm2
jbe    1281 <noStoreComputeChunked+0x161>
mov    0x10(%rsp),%rax
movss  %xmm0,-0x4(%rax,%r14,4)
mov    $0x3,%edi
mov    %ebp,%esi
call   1040 <consumer_raw@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %r15d,%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
ucomiss 0xd5d(%rip),%xmm2
jbe    11d0 <noStoreComputeChunked+0xb0>
mov    0x8(%rsp),%rax
movss  %xmm0,-0x4(%rax,%r14,4)
jmp    11d0 <noStoreComputeChunked+0xb0>
mov    (%rsp),%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float** @noStoreComputeChunked() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float**
%11 = alloca float
%12 = alloca i32
store i32 40, i32* %12
%13 = call i8* @calloc(i32 4, i32 8)
%14 = bitcast i8* %13 to float**
store float** %14, float*** %10
store i32 0, i32* %3
br label %15
15: ; preds = %25, %0
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = call i8* @calloc(i32 40, i32 4)
%20 = bitcast i8* %19 to float*
%21 = load float**, float*** %10
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float*, float** %21, i64 %23
store float* %20, float** %24
br label %25
25: ; preds = %18
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %15
28: ; preds = %15
store i32 0, i32* %5
br label %29
29: ; preds = %96, %28
%30 = load i32, i32* %5
%31 = load i32, i32* %12
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %99
33: ; preds = %29
%34 = load i32, i32* %5
%35 = mul nsw i32 1, %34
store i32 %35, i32* %6
%36 = load i32, i32* %6
%37 = icmp sgt i32 %36, 39
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 39, i32* %6
br label %39
39: ; preds = %38, %33
store i32 0, i32* %1
br label %40
40: ; preds = %92, %39
%41 = load i32, i32* %1
%42 = icmp slt i32 %41, 4
br i1 %42, label %43, label %95
43: ; preds = %40
store i32 0, i32* %7
br label %44
44: ; preds = %88, %43
%45 = load i32, i32* %7
%46 = icmp slt i32 %45, 1
br i1 %46, label %47, label %91
47: ; preds = %44
%48 = load i32, i32* %6
%49 = load i32, i32* %7
%50 = add nsw i32 %48, %49
store i32 %50, i32* %2
%51 = load i32, i32* %1
%52 = load i32, i32* %2
%53 = call float @consumer_raw(i32 %51, i32 %52)
store float %53, float* %11
%54 = load float, float* %11
%55 = load i32, i32* %1
%56 = load i32, i32* %2
%57 = mul nsw i32 %55, %56
%58 = load i32, i32* %1
%59 = add nsw i32 %58, 1
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
%62 = mul nsw i32 %59, %61
%63 = add nsw i32 %57, %62
%64 = load i32, i32* %1
%65 = load i32, i32* %2
%66 = add nsw i32 %65, 1
%67 = mul nsw i32 %64, %66
%68 = add nsw i32 %63, %67
%69 = load i32, i32* %2
%70 = load i32, i32* %1
%71 = add nsw i32 %70, 1
%72 = mul nsw i32 %69, %71
%73 = add nsw i32 %68, %72
%74 = sitofp i32 %73 to float
%75 = fsub float %54, %74
%76 = fcmp ogt float %75, 0x3F50624DE0000000
br i1 %76, label %77, label %87
77: ; preds = %47
%78 = load float, float* %11
%79 = load float**, float*** %10
%80 = load i32, i32* %1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds float*, float** %79, i64 %81
%83 = load float*, float** %82
%84 = load i32, i32* %2
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds float, float* %83, i64 %85
store float %78, float* %86
br label %87
87: ; preds = %77, %47
br label %88
88: ; preds = %87
%89 = load i32, i32* %7
%90 = add nsw i32 %89, 1
store i32 %90, i32* %7
br label %44
91: ; preds = %44
br label %92
92: ; preds = %91
%93 = load i32, i32* %1
%94 = add nsw i32 %93, 1
store i32 %94, i32* %1
br label %40
95: ; preds = %40
br label %96
96: ; preds = %95
%97 = load i32, i32* %5
%98 = add nsw i32 %97, 1
store i32 %98, i32* %5
br label %29
99: ; preds = %29
%100 = load float**, float*** %10
ret float** %100
}

LLVM IR (-O2):
define noalias float** @noStoreComputeChunked() {
%1 = tail call dereferenceable_or_null(32) i8* @calloc(i32 4, i32 8)
%2 = bitcast i8* %1 to float**
%3 = tail call dereferenceable_or_null(160) i8* @calloc(i32 40, i32 4)
%4 = bitcast i8* %1 to i8**
store i8* %3, i8** %4
%5 = tail call dereferenceable_or_null(160) i8* @calloc(i32 40, i32 4)
%6 = getelementptr inbounds float*, float** %2, i64 1
%7 = bitcast float** %6 to i8**
store i8* %5, i8** %7
%8 = tail call dereferenceable_or_null(160) i8* @calloc(i32 40, i32 4)
%9 = getelementptr inbounds float*, float** %2, i64 2
%10 = bitcast float** %9 to i8**
store i8* %8, i8** %10
%11 = tail call dereferenceable_or_null(160) i8* @calloc(i32 40, i32 4)
%12 = getelementptr inbounds float*, float** %2, i64 3
%13 = bitcast float** %12 to i8**
store i8* %11, i8** %13
%14 = bitcast i8* %3 to float*
%15 = bitcast i8* %5 to float*
%16 = bitcast i8* %8 to float*
%17 = bitcast i8* %11 to float*
br label %18
18: ; preds = %0, %57
%19 = phi i64 [ 0, %0 ], [ %20, %57 ]
%20 = add nuw nsw i64 %19, 1
%21 = add nuw nsw i64 %20, %19
%22 = trunc i64 %19 to i32
%23 = tail call float @consumer_raw(i32 0, i32 %22)
%24 = trunc i64 %21 to i32
%25 = sitofp i32 %24 to float
%26 = fsub float %23, %25
%27 = fcmp ogt float %26, 0x3F50624DE0000000
br i1 %27, label %28, label %30
28: ; preds = %18
%29 = getelementptr inbounds float, float* %14, i64 %19
store float %23, float* %29
br label %30
30: ; preds = %18, %28
%31 = tail call float @consumer_raw(i32 1, i32 %22)
%32 = trunc i64 %21 to i32
%33 = mul i32 %32, 3
%34 = sitofp i32 %33 to float
%35 = fsub float %31, %34
%36 = fcmp ogt float %35, 0x3F50624DE0000000
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = getelementptr inbounds float, float* %15, i64 %19
store float %31, float* %38
br label %39
39: ; preds = %37, %30
%40 = tail call float @consumer_raw(i32 2, i32 %22)
%41 = trunc i64 %21 to i32
%42 = mul i32 %41, 5
%43 = sitofp i32 %42 to float
%44 = fsub float %40, %43
%45 = fcmp ogt float %44, 0x3F50624DE0000000
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = getelementptr inbounds float, float* %16, i64 %19
store float %40, float* %47
br label %48
48: ; preds = %46, %39
%49 = tail call float @consumer_raw(i32 3, i32 %22)
%50 = trunc i64 %21 to i32
%51 = mul i32 %50, 7
%52 = sitofp i32 %51 to float
%53 = fsub float %49, %52
%54 = fcmp ogt float %53, 0x3F50624DE0000000
br i1 %54, label %55, label %57
55: ; preds = %48
%56 = getelementptr inbounds float, float* %17, i64 %19
store float %49, float* %56
br label %57
57: ; preds = %55, %48
%58 = icmp eq i64 %20, 40
br i1 %58, label %59, label %18
59: ; preds = %57
ret float** %2
}