#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 **noStoreComputeByScanline() {
  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(x, y) shared(consumer_arr)
  for (x = 0; x < 4; x++)
    for (y = 0; y < 40; y++)
      consumer_arr[x][y] = consumer_raw(x, y);
  return consumer_arr;
}


x86 assembly (clang, -O0):
<noStoreComputeByScanline>:
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 <noStoreComputeByScanline+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 <noStoreComputeByScanline+0x29>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    11e2 <noStoreComputeByScanline+0xc2>
movl   $0x0,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    11cf <noStoreComputeByScanline+0xaf>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <consumer_raw@plt>
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <noStoreComputeByScanline+0x77>
jmp    11d4 <noStoreComputeByScanline+0xb4>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <noStoreComputeByScanline+0x66>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noStoreComputeByScanline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r14
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    %rax,(%r14)
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%r13
mov    %rax,0x8(%r14)
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%r12
mov    %rax,0x10(%r14)
mov    $0x28,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%r15
mov    %rax,0x18(%r14)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %ebp,%esi
call   1040 <consumer_raw@plt>
movss  %xmm0,(%rbx,%rbp,4)
add    $0x1,%rbp
cmp    $0x28,%rbp
jne    11a0 <noStoreComputeByScanline+0x80>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %ebx,%esi
call   1040 <consumer_raw@plt>
movss  %xmm0,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    $0x28,%rbx
jne    11c0 <noStoreComputeByScanline+0xa0>
xor    %ebx,%ebx
nop
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <consumer_raw@plt>
movss  %xmm0,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    $0x28,%rbx
jne    11e0 <noStoreComputeByScanline+0xc0>
xor    %ebx,%ebx
xchg   %ax,%ax
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <consumer_raw@plt>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    $0x28,%rbx
jne    1200 <noStoreComputeByScanline+0xe0>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float** @noStoreComputeByScanline() {
%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* %1
br label %29
29: ; preds = %52, %28
%30 = load i32, i32* %1
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %55
32: ; preds = %29
store i32 0, i32* %2
br label %33
33: ; preds = %48, %32
%34 = load i32, i32* %2
%35 = icmp slt i32 %34, 40
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = call float @consumer_raw(i32 %37, i32 %38)
%40 = load float**, float*** %10
%41 = load i32, i32* %1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds float*, float** %40, i64 %42
%44 = load float*, float** %43
%45 = load i32, i32* %2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
store float %39, float* %47
br label %48
48: ; preds = %36
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
store i32 %50, i32* %2
br label %33
51: ; preds = %33
br label %52
52: ; preds = %51
%53 = load i32, i32* %1
%54 = add nsw i32 %53, 1
store i32 %54, i32* %1
br label %29
55: ; preds = %29
%56 = load float**, float*** %10
ret float** %56
}

LLVM IR (-O2):
define noalias float** @noStoreComputeByScanline() {
%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, %18
%19 = phi i64 [ 0, %0 ], [ %23, %18 ]
%20 = trunc i64 %19 to i32
%21 = tail call float @consumer_raw(i32 0, i32 %20)
%22 = getelementptr inbounds float, float* %14, i64 %19
store float %21, float* %22
%23 = add nuw nsw i64 %19, 1
%24 = icmp eq i64 %23, 40
br i1 %24, label %25, label %18
25: ; preds = %18, %25
%26 = phi i64 [ %30, %25 ], [ 0, %18 ]
%27 = trunc i64 %26 to i32
%28 = tail call float @consumer_raw(i32 1, i32 %27)
%29 = getelementptr inbounds float, float* %15, i64 %26
store float %28, float* %29
%30 = add nuw nsw i64 %26, 1
%31 = icmp eq i64 %30, 40
br i1 %31, label %32, label %25
32: ; preds = %25, %32
%33 = phi i64 [ %37, %32 ], [ 0, %25 ]
%34 = trunc i64 %33 to i32
%35 = tail call float @consumer_raw(i32 2, i32 %34)
%36 = getelementptr inbounds float, float* %16, i64 %33
store float %35, float* %36
%37 = add nuw nsw i64 %33, 1
%38 = icmp eq i64 %37, 40
br i1 %38, label %39, label %32
39: ; preds = %32, %39
%40 = phi i64 [ %44, %39 ], [ 0, %32 ]
%41 = trunc i64 %40 to i32
%42 = tail call float @consumer_raw(i32 3, i32 %41)
%43 = getelementptr inbounds float, float* %17, i64 %40
store float %42, float* %43
%44 = add nuw nsw i64 %40, 1
%45 = icmp eq i64 %44, 40
br i1 %45, label %46, label %39
46: ; preds = %39
ret float** %2
}