#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 */
float *calloc(int, int);
float consumer_from_buffer(int, int, float **);
float **malloc(int);
int /*<<< orphan*/ printf(char *);
float producer(int, int);
float **storeBuffCompute() {
  int x, y, i, j;
  int yo, y_base, y_in, yi, py;
  int numPasses = 40 / 1;
  float producer_buffer[4 + 1][1 + 1];
  float **consumer_arr;
  float **returnMePls;
  int correctness = 0;
  if (40 % 1)
    numPasses++;
  printf("Good morning\n");
  consumer_arr = malloc(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, producer_buffer)
  for (yo = 0; yo < numPasses; yo++) {
    y_base = 1 * yo;
    if (y_base > 40 - 1)
      y_base = 40 - 1;
    for (y_in = 0; y_in <= 1; y_in++) {
      y = y_base + y_in;
      for (x = 0; x < 4 + 1; x++) {
        producer_buffer[x][y_in] = producer(x, y);
      }
    }
    for (x = 0; x < 4; x++) {
      for (y_in = 0; y_in < 1; y_in++) {
        y = y_base + y_in;
        consumer_arr[x][y] =
            consumer_from_buffer(x, y, (float **)producer_buffer);
      }
    }
  }
  return returnMePls;
}


x86 assembly (clang, -O0):
<storeBuffCompute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x28,-0x28(%rbp)
movl   $0x0,-0x64(%rbp)
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1060 <malloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11bd <storeBuffCompute+0x6d>
mov    $0x28,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rdx
mov    -0x58(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1187 <storeBuffCompute+0x37>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    12dc <storeBuffCompute+0x18c>
mov    -0x14(%rbp),%eax
shl    $0x0,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x27,-0x18(%rbp)
jle    11ea <storeBuffCompute+0x9a>
movl   $0x27,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jg     1259 <storeBuffCompute+0x109>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    1246 <storeBuffCompute+0xf6>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <producer@plt>
movslq -0x4(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    120b <storeBuffCompute+0xbb>
jmp    124b <storeBuffCompute+0xfb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f1 <storeBuffCompute+0xa1>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    12c9 <storeBuffCompute+0x179>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    12b6 <storeBuffCompute+0x166>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1070 <consumer_from_buffer@plt>
mov    -0x58(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1271 <storeBuffCompute+0x121>
jmp    12bb <storeBuffCompute+0x16b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1260 <storeBuffCompute+0x110>
jmp    12ce <storeBuffCompute+0x17e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c4 <storeBuffCompute+0x74>
mov    -0x60(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<storeBuffCompute>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x20,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x28,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,0x30(%rsp)
mov    %rax,(%rbx)
mov    $0x28,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,0x28(%rsp)
mov    %rax,0x8(%rbx)
mov    $0x28,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r12
mov    %rax,0x10(%rbx)
mov    $0x28,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r13
mov    %rax,0x18(%rbx)
xor    %r14d,%r14d
mov    %rsp,%rbp
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %r14d,%esi
call   1030 <producer@plt>
movss  %xmm0,(%rsp)
mov    $0x1,%edi
mov    %r14d,%esi
call   1030 <producer@plt>
movss  %xmm0,0x8(%rsp)
mov    $0x2,%edi
mov    %r14d,%esi
call   1030 <producer@plt>
movss  %xmm0,0x10(%rsp)
mov    $0x3,%edi
mov    %r14d,%esi
call   1030 <producer@plt>
movss  %xmm0,0x18(%rsp)
mov    $0x4,%edi
mov    %r14d,%esi
call   1030 <producer@plt>
movss  %xmm0,0x20(%rsp)
lea    0x1(%r14),%rbx
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <producer@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x1,%edi
mov    %ebx,%esi
call   1030 <producer@plt>
movss  %xmm0,0xc(%rsp)
mov    $0x2,%edi
mov    %ebx,%esi
call   1030 <producer@plt>
movss  %xmm0,0x14(%rsp)
mov    $0x3,%edi
mov    %ebx,%esi
call   1030 <producer@plt>
movss  %xmm0,0x1c(%rsp)
mov    $0x4,%edi
mov    %ebx,%esi
call   1030 <producer@plt>
movss  %xmm0,0x24(%rsp)
lea    -0x1(%rbx),%r15d
xor    %edi,%edi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1070 <consumer_from_buffer@plt>
mov    0x30(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
mov    $0x1,%edi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1070 <consumer_from_buffer@plt>
mov    0x28(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
mov    $0x2,%edi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1070 <consumer_from_buffer@plt>
movss  %xmm0,(%r12,%r14,4)
mov    $0x3,%edi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1070 <consumer_from_buffer@plt>
movss  %xmm0,0x0(%r13,%r14,4)
mov    %rbx,%r14
cmp    $0x28,%rbx
jne    11e0 <storeBuffCompute+0x90>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Good morning\0A\00"
define float** @storeBuffCompute() {
%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 i32
%11 = alloca [5 x [2 x float]]
%12 = alloca float**
%13 = alloca float**
%14 = alloca i32
store i32 40, i32* %10
store i32 0, i32* %14
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%16 = call float** @malloc(i32 32)
store float** %16, float*** %12
store i32 0, i32* %3
br label %17
17: ; preds = %26, %0
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = call float* @calloc(i32 40, i32 4)
%22 = load float**, float*** %12
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float*, float** %22, i64 %24
store float* %21, float** %25
br label %26
26: ; preds = %20
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %17
29: ; preds = %17
store i32 0, i32* %5
br label %30
30: ; preds = %101, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %10
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %104
34: ; preds = %30
%35 = load i32, i32* %5
%36 = mul nsw i32 1, %35
store i32 %36, i32* %6
%37 = load i32, i32* %6
%38 = icmp sgt i32 %37, 39
br i1 %38, label %39, label %40
39: ; preds = %34
store i32 39, i32* %6
br label %40
40: ; preds = %39, %34
store i32 0, i32* %7
br label %41
41: ; preds = %65, %40
%42 = load i32, i32* %7
%43 = icmp sle i32 %42, 1
br i1 %43, label %44, label %68
44: ; preds = %41
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = add nsw i32 %45, %46
store i32 %47, i32* %2
store i32 0, i32* %1
br label %48
48: ; preds = %61, %44
%49 = load i32, i32* %1
%50 = icmp slt i32 %49, 5
br i1 %50, label %51, label %64
51: ; preds = %48
%52 = load i32, i32* %1
%53 = load i32, i32* %2
%54 = call float @producer(i32 %52, i32 %53)
%55 = load i32, i32* %1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %11, i64 0, i64 %56
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [2 x float], [2 x float]* %57, i64 0, i64 %59
store float %54, float* %60
br label %61
61: ; preds = %51
%62 = load i32, i32* %1
%63 = add nsw i32 %62, 1
store i32 %63, i32* %1
br label %48
64: ; preds = %48
br label %65
65: ; preds = %64
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
store i32 %67, i32* %7
br label %41
68: ; preds = %41
store i32 0, i32* %1
br label %69
69: ; preds = %97, %68
%70 = load i32, i32* %1
%71 = icmp slt i32 %70, 4
br i1 %71, label %72, label %100
72: ; preds = %69
store i32 0, i32* %7
br label %73
73: ; preds = %93, %72
%74 = load i32, i32* %7
%75 = icmp slt i32 %74, 1
br i1 %75, label %76, label %96
76: ; preds = %73
%77 = load i32, i32* %6
%78 = load i32, i32* %7
%79 = add nsw i32 %77, %78
store i32 %79, i32* %2
%80 = load i32, i32* %1
%81 = load i32, i32* %2
%82 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %11, i64 0, i64 0
%83 = bitcast [2 x float]* %82 to float**
%84 = call float @consumer_from_buffer(i32 %80, i32 %81, float** %83)
%85 = load float**, float*** %12
%86 = load i32, i32* %1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds float*, float** %85, i64 %87
%89 = load float*, float** %88
%90 = load i32, i32* %2
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds float, float* %89, i64 %91
store float %84, float* %92
br label %93
93: ; preds = %76
%94 = load i32, i32* %7
%95 = add nsw i32 %94, 1
store i32 %95, i32* %7
br label %73
96: ; preds = %73
br label %97
97: ; preds = %96
%98 = load i32, i32* %1
%99 = add nsw i32 %98, 1
store i32 %99, i32* %1
br label %69
100: ; preds = %69
br label %101
101: ; preds = %100
%102 = load i32, i32* %5
%103 = add nsw i32 %102, 1
store i32 %103, i32* %5
br label %30
104: ; preds = %30
%105 = load float**, float*** %13
ret float** %105
}

LLVM IR (-O2):
@str = [13 x i8] c"Good morning\00"
define noalias float** @storeBuffCompute() {
%1 = alloca [5 x [2 x float]]
%2 = bitcast [5 x [2 x float]]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call float** @malloc(i32 32)
%5 = tail call float* @calloc(i32 40, i32 4)
store float* %5, float** %4
%6 = tail call float* @calloc(i32 40, i32 4)
%7 = getelementptr inbounds float*, float** %4, i64 1
store float* %6, float** %7
%8 = tail call float* @calloc(i32 40, i32 4)
%9 = getelementptr inbounds float*, float** %4, i64 2
store float* %8, float** %9
%10 = tail call float* @calloc(i32 40, i32 4)
%11 = getelementptr inbounds float*, float** %4, i64 3
store float* %10, float** %11
%12 = bitcast [5 x [2 x float]]* %1 to float**
%13 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 0, i64 0
%14 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 1, i64 0
%15 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 2, i64 0
%16 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 3, i64 0
%17 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 4, i64 0
%18 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 0, i64 1
%19 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 1, i64 1
%20 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 2, i64 1
%21 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 3, i64 1
%22 = getelementptr inbounds [5 x [2 x float]], [5 x [2 x float]]* %1, i64 0, i64 4, i64 1
br label %23
23: ; preds = %0, %23
%24 = phi i64 [ 0, %0 ], [ %31, %23 ]
%25 = trunc i64 %24 to i32
%26 = call float @producer(i32 0, i32 %25)
store float %26, float* %13
%27 = call float @producer(i32 1, i32 %25)
store float %27, float* %14
%28 = call float @producer(i32 2, i32 %25)
store float %28, float* %15
%29 = call float @producer(i32 3, i32 %25)
store float %29, float* %16
%30 = call float @producer(i32 4, i32 %25)
store float %30, float* %17
%31 = add nuw nsw i64 %24, 1
%32 = trunc i64 %31 to i32
%33 = call float @producer(i32 0, i32 %32)
store float %33, float* %18
%34 = call float @producer(i32 1, i32 %32)
store float %34, float* %19
%35 = call float @producer(i32 2, i32 %32)
store float %35, float* %20
%36 = call float @producer(i32 3, i32 %32)
store float %36, float* %21
%37 = call float @producer(i32 4, i32 %32)
store float %37, float* %22
%38 = call float @consumer_from_buffer(i32 0, i32 %25, float** %12)
%39 = getelementptr inbounds float, float* %5, i64 %24
store float %38, float* %39
%40 = call float @consumer_from_buffer(i32 1, i32 %25, float** %12)
%41 = getelementptr inbounds float, float* %6, i64 %24
store float %40, float* %41
%42 = call float @consumer_from_buffer(i32 2, i32 %25, float** %12)
%43 = getelementptr inbounds float, float* %8, i64 %24
store float %42, float* %43
%44 = call float @consumer_from_buffer(i32 3, i32 %25, float** %12)
%45 = getelementptr inbounds float, float* %10, i64 %24
store float %44, float* %45
%46 = icmp eq i64 %31, 40
br i1 %46, label %47, label %23
47: ; preds = %23
ret float** undef
}