#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double GetTimer();
int /*<<< orphan*/ StartTimer();
scalar_t__ black_kernel(float *, float *, float *, float *, float *, float *,
                        float *, float *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fill_coeffs(int, int, float, float, float, float, float,
                               float *, float *, float *, float *, float *,
                               float *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ red_kernel(float *, float *, float *, float *, float *, float *,
                      float *, float *);
float sqrt(float);
int main(void) {
  float L = 1.0;
  float H = 1.0;
  float width = 0.01;
  float th_cond = 1.0;
  float TN = 1.0;
  float tol = 1.e-6;
  int num_rows = (2048 / 2) + 2;
  int num_cols = 2048 + 2;
  int size_temp = num_rows * num_cols;
  int size = 2048 * 2048;
  float dx = L / 2048;
  float dy = H / 2048;
  int iter;
  int it_max = 1e6;
  float *restrict aP, *restrict aW, *restrict aE, *restrict aS, *restrict aN,
                                                                    *restrict b;
  float *restrict temp_red, *restrict temp_black;
  aP = (float *)calloc(size, sizeof(float));
  aW = (float *)calloc(size, sizeof(float));
  aE = (float *)calloc(size, sizeof(float));
  aS = (float *)calloc(size, sizeof(float));
  aN = (float *)calloc(size, sizeof(float));
  b = (float *)calloc(size, sizeof(float));
  temp_red = (float *)calloc(size_temp, sizeof(float));
  temp_black = (float *)calloc(size_temp, sizeof(float));
  fill_coeffs(2048, 2048, th_cond, dx, dy, width, TN, aP, aW, aE, aS, aN, b);
  int i;
  for (i = 0; i < size_temp; ++i) {
    temp_red[i] = 0.0f;
    temp_black[i] = 0.0f;
  }
  printf("Problem size: %d x %d \n", 2048, 2048);
  printf("Max threads: %d\n", 1);
  StartTimer();
#pragma acc data copyin(aP [0:SIZE], aW [0:SIZE], aE [0:SIZE], aS [0:SIZE],    \
                        aN [0:SIZE], b [0:SIZE])                               \
    copy(temp_red [0:SIZET], temp_black [0:SIZET])
  for (iter = 1; iter <= it_max; ++iter) {
    float norm_L2 = 0.0f;
    norm_L2 += red_kernel(aP, aW, aE, aS, aN, b, temp_black, temp_red);
    norm_L2 += black_kernel(aP, aW, aE, aS, aN, b, temp_red, temp_black);
    norm_L2 = sqrt(norm_L2 / ((float)size));
    if (iter % 100 == 0)
      printf("%5d, %0.6f\n", iter, norm_L2);
    if (norm_L2 < tol) {
      break;
    }
  }
  double runtime = GetTimer();
  printf("CPU\n");
  printf("Iterations: %i\n", iter);
  printf("Total time: %f s\n", runtime / 1000);
  FILE *pfile;
  pfile = fopen("temp_cpu.dat", "w");
  if (pfile != NULL) {
    fprintf(pfile, "#x\ty\ttemp(K)\n");
    int row, col;
    for (row = 1; row < 2048 + 1; ++row) {
      for (col = 1; col < 2048 + 1; ++col) {
        float x_pos = (col - 1) * dx + (dx / 2);
        float y_pos = (row - 1) * dy + (dy / 2);
        if ((row + col) % 2 == 0) {
          int ind = col * num_rows + (row + (col % 2)) / 2;
          fprintf(pfile, "%f\t%f\t%f\n", x_pos, y_pos, temp_red[ind]);
        } else {
          int ind = col * num_rows + (row + ((col + 1) % 2)) / 2;
          fprintf(pfile, "%f\t%f\t%f\n", x_pos, y_pos, temp_black[ind]);
        }
      }
      fprintf(pfile, "\n");
    }
  }
  fclose(pfile);
  free(aP);
  free(aW);
  free(aE);
  free(aS);
  free(aN);
  free(b);
  free(temp_red);
  free(temp_black);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xe2e(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe21(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe18(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe07(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xdfa(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xde9(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x402,-0x20(%rbp)
movl   $0x802,-0x24(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x400000,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xdb4(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xd9e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0xf4240,-0x3c(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x2c(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x28(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x28(%rbp),%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,-0x80(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x60(%rbp),%r9
mov    -0x68(%rbp),%r10
mov    -0x70(%rbp),%rax
mov    $0x800,%esi
mov    %esi,%edi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   10b0 <fill_coeffs@plt>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1393 <main+0x1d3>
mov    -0x78(%rbp),%rax
movslq -0x84(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x80(%rbp),%rax
movslq -0x84(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    134a <main+0x18a>
lea    0xc86(%rip),%rdi
mov    $0x800,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc89(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   10c0 <StartTimer@plt>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     14e3 <main+0x323>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x88(%rbp)
ff
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x70(%rbp),%r9
mov    -0x80(%rbp),%r10
mov    -0x78(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <red_kernel@plt>
cvtsi2ss %rax,%xmm0
addss  -0x88(%rbp),%xmm0
ff
movss  %xmm0,-0x88(%rbp)
ff
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x70(%rbp),%r9
mov    -0x78(%rbp),%r10
mov    -0x80(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   10a0 <black_kernel@plt>
cvtsi2ss %rax,%xmm0
addss  -0x88(%rbp),%xmm0
ff
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x88(%rbp),%xmm0
ff
cvtsi2ssl -0x2c(%rbp),%xmm1
divss  %xmm1,%xmm0
call   10e0 <sqrt@plt>
movss  %xmm0,-0x88(%rbp)
ff
mov    -0x38(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    14b5 <main+0x2f5>
mov    -0x38(%rbp),%esi
movss  -0x88(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xb9b(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movss  -0x88(%rbp),%xmm1
ff
movss  -0x1c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    14d0 <main+0x310>
jmp    14e3 <main+0x323>
jmp    14d5 <main+0x315>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13c9 <main+0x209>
mov    $0x0,%al
call   1060 <GetTimer@plt>
movsd  %xmm0,-0x90(%rbp)
ff
lea    0xb5c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xb50(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xaf7(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xb3e(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xb42(%rip),%rdi
lea    0xb48(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
je     178c <main+0x5cc>
mov    -0x98(%rbp),%rdi
lea    0xb22(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x9c(%rbp)
cmpl   $0x801,-0x9c(%rbp)
jge    1787 <main+0x5c7>
movl   $0x1,-0xa0(%rbp)
cmpl   $0x801,-0xa0(%rbp)
jge    175e <main+0x59e>
mov    -0xa0(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  -0x30(%rbp),%xmm2
movss  -0x30(%rbp),%xmm1
movss  0xa4d(%rip),%xmm3
divss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xa4(%rbp)
ff
mov    -0x9c(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  -0x34(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
movss  0xa1a(%rip),%xmm3
divss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xa8(%rbp)
ff
mov    -0x9c(%rbp),%eax
add    -0xa0(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    16b7 <main+0x4f7>
mov    -0xa0(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0xa0(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0xb8(%rbp),%eax
add    %edx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xac(%rbp)
mov    -0x98(%rbp),%rdi
movss  -0xa4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xa8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
mov    -0x78(%rbp),%rax
movslq -0xac(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x9ee(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
jmp    1745 <main+0x585>
mov    -0xa0(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0xc0(%rbp),%eax
add    %edx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xb0(%rbp)
mov    -0x98(%rbp),%rdi
movss  -0xa4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0xa8(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
mov    -0x80(%rbp),%rax
movslq -0xb0(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0x95b(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
jmp    174a <main+0x58a>
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    1594 <main+0x3d4>
mov    -0x98(%rbp),%rdi
lea    0x8ca(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    157a <main+0x3ba>
jmp    178c <main+0x5cc>
mov    -0x98(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    $0x400000,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,0x28(%rsp)
mov    $0x400000,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,0x18(%rsp)
mov    $0x400000,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%r13
mov    $0x400000,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%r14
mov    $0x400000,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%r15
mov    $0x400000,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%r12
mov    $0x201804,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%rbp
mov    $0x201804,%edi
mov    $0x4,%esi
call   10a0 <calloc@plt>
mov    %rax,%rbx
movss  0xd66(%rip),%xmm1
movss  0xd62(%rip),%xmm3
movss  0xd5e(%rip),%xmm0
mov    $0x800,%edi
mov    $0x800,%esi
movaps %xmm1,%xmm2
movaps %xmm0,%xmm4
mov    0x28(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    %r13,0x30(%rsp)
mov    %r13,%r8
mov    %r14,0x50(%rsp)
mov    %r14,%r9
mov    %r12,0x40(%rsp)
push   %r12
mov    %r15,0x50(%rsp)
push   %r15
call   10d0 <fill_coeffs@plt>
add    $0x10,%rsp
lea    0x806010(%rbx),%rax
cmp    %rax,%rbp
jae    1307 <main+0x117>
lea    0x806010(%rbp),%rax
cmp    %rax,%rbx
jae    1307 <main+0x117>
xor    %eax,%eax
jmp    1370 <main+0x180>
mov    $0x1c,%eax
xorps  %xmm0,%xmm0
nop
movups %xmm0,-0x70(%rbp,%rax,4)
movups %xmm0,-0x60(%rbp,%rax,4)
movups %xmm0,-0x70(%rbx,%rax,4)
movups %xmm0,-0x60(%rbx,%rax,4)
movups %xmm0,-0x50(%rbp,%rax,4)
movups %xmm0,-0x40(%rbp,%rax,4)
movups %xmm0,-0x50(%rbx,%rax,4)
movups %xmm0,-0x40(%rbx,%rax,4)
movups %xmm0,-0x30(%rbp,%rax,4)
movups %xmm0,-0x20(%rbp,%rax,4)
movups %xmm0,-0x30(%rbx,%rax,4)
movups %xmm0,-0x20(%rbx,%rax,4)
movups %xmm0,-0x10(%rbp,%rax,4)
movups %xmm0,0x0(%rbp,%rax,4)
movups %xmm0,-0x10(%rbx,%rax,4)
movups %xmm0,(%rbx,%rax,4)
add    $0x20,%rax
cmp    $0x20181c,%rax
jne    1310 <main+0x120>
mov    $0x201800,%eax
lea    0xc(,%rax,4),%rax
nopl   0x0(%rax,%rax,1)
movl   $0x0,-0xc(%rbp,%rax,1)
movl   $0x0,-0xc(%rbx,%rax,1)
movl   $0x0,-0x8(%rbp,%rax,1)
movl   $0x0,-0x8(%rbx,%rax,1)
movl   $0x0,-0x4(%rbp,%rax,1)
movl   $0x0,-0x4(%rbx,%rax,1)
movl   $0x0,0x0(%rbp,%rax,1)
movl   $0x0,(%rbx,%rax,1)
add    $0x10,%rax
cmp    $0x80601c,%rax
jne    1380 <main+0x190>
mov    %rbx,0x38(%rsp)
mov    %rbp,0x20(%rsp)
lea    0xc4c(%rip),%rdi
mov    $0x800,%esi
mov    $0x800,%edx
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc4c(%rip),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   10e0 <StartTimer@plt>
mov    0x50(%rsp),%r14
mov    0x48(%rsp),%r15
mov    0x40(%rsp),%r13
mov    0x38(%rsp),%r12
mov    %ebx,0x8(%rsp)
mov    %ebx,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
mov    $0x1,%ebp
sub    %eax,%ebp
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %r13,%r9
push   0x20(%rsp)
push   %r12
call   1050 <red_kernel@plt>
add    $0x10,%rsp
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %r13,%r9
push   %r12
push   0x28(%rsp)
call   10c0 <black_kernel@plt>
add    $0x10,%rsp
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x10(%rsp),%xmm0
mulss  0xb5e(%rip),%xmm0
ucomiss 0xb63(%rip),%xmm0
jb     14c0 <main+0x2d0>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    14c8 <main+0x2d8>
call   1100 <sqrt@plt>
movaps %xmm0,%xmm1
mov    0x8(%rsp),%ebx
add    %ebx,%ebp
cmp    $0x1,%ebp
jne    14f6 <main+0x306>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xb70(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
movss  %xmm1,0x10(%rsp)
call   1080 <printf@plt>
movss  0x10(%rsp),%xmm1
movss  0xb12(%rip),%xmm0
ucomiss %xmm1,%xmm0
ja     1517 <main+0x327>
add    $0x1,%ebx
cmp    $0xf4241,%ebx
jne    1420 <main+0x230>
mov    $0xf4241,%ebx
xor    %eax,%eax
call   1070 <GetTimer@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xb7b(%rip),%rdi
call   1040 <puts@plt>
lea    0xb26(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0xad2(%rip),%xmm0
lea    0xb18(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xb1c(%rip),%rdi
lea    0xb22(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
je     16a9 <main+0x4b9>
lea    0xb0c(%rip),%rdi
mov    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1110 <fwrite@plt>
mov    $0x2,%r13d
movss  0xa68(%rip),%xmm2
mov    0x20(%rsp),%r12
mov    0x38(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xa29(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x402,%r14d
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
lea    0x1(%rax),%r15d
mulss  0x9ed(%rip),%xmm0
addss  0x9f9(%rip),%xmm0
add    %r13d,%eax
and    $0x1,%eax
mov    %r15d,%ecx
and    $0x1,%ecx
xor    %eax,%ecx
test   %eax,%eax
mov    %rbx,%rax
cmove  %r12,%rax
cvtss2sd %xmm0,%xmm0
add    0x8(%rsp),%rcx
shr    %rcx
add    %r14,%rcx
movss  (%rax,%rcx,4),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
mov    %rbp,%rdi
lea    0xa45(%rip),%rsi
movsd  0x10(%rsp),%xmm1
mov    $0x3,%al
call   10b0 <fprintf@plt>
add    $0x402,%r14
mov    %r15d,%eax
cmp    $0x201402,%r14d
jne    1600 <main+0x410>
mov    $0xa,%edi
mov    %rbp,%rsi
call   1090 <fputc@plt>
mov    0x8(%rsp),%rax
add    $0x1,%rax
add    $0x1,%r13d
mov    %rax,0x8(%rsp)
cmp    $0x801,%eax
movss  0x971(%rip),%xmm2
jne    15c0 <main+0x3d0>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Problem size: %d x %d \0A\00"
@.str.1 = [17 x i8] c"Max threads: %d\0A\00"
@.str.2 = [12 x i8] c"%5d, %0.6f\0A\00"
@.str.3 = [5 x i8] c"CPU\0A\00"
@.str.4 = [16 x i8] c"Iterations: %i\0A\00"
@.str.5 = [18 x i8] c"Total time: %f s\0A\00"
@.str.6 = [13 x i8] c"temp_cpu.dat\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [14 x i8] c"#x\09y\09temp(K)\0A\00"
@.str.9 = [10 x i8] c"%f\09%f\09%f\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca i32
%16 = alloca float*
%17 = alloca float*
%18 = alloca float*
%19 = alloca float*
%20 = alloca float*
%21 = alloca float*
%22 = alloca float*
%23 = alloca float*
%24 = alloca i32
%25 = alloca float
%26 = alloca double
%27 = alloca i32*
%28 = alloca i32
%29 = alloca i32
%30 = alloca float
%31 = alloca float
%32 = alloca i32
%33 = alloca i32
store i32 0, i32* %1
store float 1.000000e+00, float* %2
store float 1.000000e+00, float* %3
store float 0x3F847AE140000000, float* %4
store float 1.000000e+00, float* %5
store float 1.000000e+00, float* %6
store float 0x3EB0C6F7A0000000, float* %7
store i32 1026, i32* %8
store i32 2050, i32* %9
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = mul nsw i32 %34, %35
store i32 %36, i32* %10
store i32 4194304, i32* %11
%37 = load float, float* %2
%38 = fdiv float %37, 2.048000e+03
store float %38, float* %12
%39 = load float, float* %3
%40 = fdiv float %39, 2.048000e+03
store float %40, float* %13
store i32 1000000, i32* %15
%41 = load i32, i32* %11
%42 = call i64 @calloc(i32 %41, i32 4)
%43 = inttoptr i64 %42 to float*
store float* %43, float** %16
%44 = load i32, i32* %11
%45 = call i64 @calloc(i32 %44, i32 4)
%46 = inttoptr i64 %45 to float*
store float* %46, float** %17
%47 = load i32, i32* %11
%48 = call i64 @calloc(i32 %47, i32 4)
%49 = inttoptr i64 %48 to float*
store float* %49, float** %18
%50 = load i32, i32* %11
%51 = call i64 @calloc(i32 %50, i32 4)
%52 = inttoptr i64 %51 to float*
store float* %52, float** %19
%53 = load i32, i32* %11
%54 = call i64 @calloc(i32 %53, i32 4)
%55 = inttoptr i64 %54 to float*
store float* %55, float** %20
%56 = load i32, i32* %11
%57 = call i64 @calloc(i32 %56, i32 4)
%58 = inttoptr i64 %57 to float*
store float* %58, float** %21
%59 = load i32, i32* %10
%60 = call i64 @calloc(i32 %59, i32 4)
%61 = inttoptr i64 %60 to float*
store float* %61, float** %22
%62 = load i32, i32* %10
%63 = call i64 @calloc(i32 %62, i32 4)
%64 = inttoptr i64 %63 to float*
store float* %64, float** %23
%65 = load float, float* %5
%66 = load float, float* %12
%67 = load float, float* %13
%68 = load float, float* %4
%69 = load float, float* %6
%70 = load float*, float** %16
%71 = load float*, float** %17
%72 = load float*, float** %18
%73 = load float*, float** %19
%74 = load float*, float** %20
%75 = load float*, float** %21
%76 = call i32 @fill_coeffs(i32 2048, i32 2048, float %65, float %66, float %67, float %68, float %69, float* %70, float* %71, float* %72, float* %73, float* %74, float* %75)
store i32 0, i32* %24
br label %77
77: ; preds = %90, %0
%78 = load i32, i32* %24
%79 = load i32, i32* %10
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %93
81: ; preds = %77
%82 = load float*, float** %22
%83 = load i32, i32* %24
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds float, float* %82, i64 %84
store float 0.000000e+00, float* %85
%86 = load float*, float** %23
%87 = load i32, i32* %24
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds float, float* %86, i64 %88
store float 0.000000e+00, float* %89
br label %90
90: ; preds = %81
%91 = load i32, i32* %24
%92 = add nsw i32 %91, 1
store i32 %92, i32* %24
br label %77
93: ; preds = %77
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 2048, i32 2048)
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1)
%96 = call i32 (...) @StartTimer()
store i32 1, i32* %14
br label %97
97: ; preds = %145, %93
%98 = load i32, i32* %14
%99 = load i32, i32* %15
%100 = icmp sle i32 %98, %99
br i1 %100, label %101, label %148
101: ; preds = %97
store float 0.000000e+00, float* %25
%102 = load float*, float** %16
%103 = load float*, float** %17
%104 = load float*, float** %18
%105 = load float*, float** %19
%106 = load float*, float** %20
%107 = load float*, float** %21
%108 = load float*, float** %23
%109 = load float*, float** %22
%110 = call i64 @red_kernel(float* %102, float* %103, float* %104, float* %105, float* %106, float* %107, float* %108, float* %109)
%111 = sitofp i64 %110 to float
%112 = load float, float* %25
%113 = fadd float %112, %111
store float %113, float* %25
%114 = load float*, float** %16
%115 = load float*, float** %17
%116 = load float*, float** %18
%117 = load float*, float** %19
%118 = load float*, float** %20
%119 = load float*, float** %21
%120 = load float*, float** %22
%121 = load float*, float** %23
%122 = call i64 @black_kernel(float* %114, float* %115, float* %116, float* %117, float* %118, float* %119, float* %120, float* %121)
%123 = sitofp i64 %122 to float
%124 = load float, float* %25
%125 = fadd float %124, %123
store float %125, float* %25
%126 = load float, float* %25
%127 = load i32, i32* %11
%128 = sitofp i32 %127 to float
%129 = fdiv float %126, %128
%130 = call float @sqrt(float %129)
store float %130, float* %25
%131 = load i32, i32* %14
%132 = srem i32 %131, 100
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %139
134: ; preds = %101
%135 = load i32, i32* %14
%136 = load float, float* %25
%137 = fpext float %136 to double
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %135, double %137)
br label %139
139: ; preds = %134, %101
%140 = load float, float* %25
%141 = load float, float* %7
%142 = fcmp olt float %140, %141
br i1 %142, label %143, label %144
143: ; preds = %139
br label %148
144: ; preds = %139
br label %145
145: ; preds = %144
%146 = load i32, i32* %14
%147 = add nsw i32 %146, 1
store i32 %147, i32* %14
br label %97
148: ; preds = %143, %97
%149 = call double (...) @GetTimer()
store double %149, double* %26
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%151 = load i32, i32* %14
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %151)
%153 = load double, double* %26
%154 = fdiv double %153, 1.000000e+03
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %154)
%156 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %156, i32** %27
%157 = load i32*, i32** %27
%158 = icmp ne i32* %157, null
br i1 %158, label %159, label %245
159: ; preds = %148
%160 = load i32*, i32** %27
%161 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %28
br label %162
162: ; preds = %241, %159
%163 = load i32, i32* %28
%164 = icmp slt i32 %163, 2049
br i1 %164, label %165, label %244
165: ; preds = %162
store i32 1, i32* %29
br label %166
166: ; preds = %235, %165
%167 = load i32, i32* %29
%168 = icmp slt i32 %167, 2049
br i1 %168, label %169, label %238
169: ; preds = %166
%170 = load i32, i32* %29
%171 = sub nsw i32 %170, 1
%172 = sitofp i32 %171 to float
%173 = load float, float* %12
%174 = load float, float* %12
%175 = fdiv float %174, 2.000000e+00
%176 = call float @llvm.fmuladd.f32(float %172, float %173, float %175)
store float %176, float* %30
%177 = load i32, i32* %28
%178 = sub nsw i32 %177, 1
%179 = sitofp i32 %178 to float
%180 = load float, float* %13
%181 = load float, float* %13
%182 = fdiv float %181, 2.000000e+00
%183 = call float @llvm.fmuladd.f32(float %179, float %180, float %182)
store float %183, float* %31
%184 = load i32, i32* %28
%185 = load i32, i32* %29
%186 = add nsw i32 %184, %185
%187 = srem i32 %186, 2
%188 = icmp eq i32 %187, 0
br i1 %188, label %189, label %211
189: ; preds = %169
%190 = load i32, i32* %29
%191 = load i32, i32* %8
%192 = mul nsw i32 %190, %191
%193 = load i32, i32* %28
%194 = load i32, i32* %29
%195 = srem i32 %194, 2
%196 = add nsw i32 %193, %195
%197 = sdiv i32 %196, 2
%198 = add nsw i32 %192, %197
store i32 %198, i32* %32
%199 = load i32*, i32** %27
%200 = load float, float* %30
%201 = fpext float %200 to double
%202 = load float, float* %31
%203 = fpext float %202 to double
%204 = load float*, float** %22
%205 = load i32, i32* %32
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds float, float* %204, i64 %206
%208 = load float, float* %207
%209 = fpext float %208 to double
%210 = call i32 (i32*, i8*, ...) @fprintf(i32* %199, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), double %201, double %203, double %209)
br label %234
211: ; preds = %169
%212 = load i32, i32* %29
%213 = load i32, i32* %8
%214 = mul nsw i32 %212, %213
%215 = load i32, i32* %28
%216 = load i32, i32* %29
%217 = add nsw i32 %216, 1
%218 = srem i32 %217, 2
%219 = add nsw i32 %215, %218
%220 = sdiv i32 %219, 2
%221 = add nsw i32 %214, %220
store i32 %221, i32* %33
%222 = load i32*, i32** %27
%223 = load float, float* %30
%224 = fpext float %223 to double
%225 = load float, float* %31
%226 = fpext float %225 to double
%227 = load float*, float** %23
%228 = load i32, i32* %33
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds float, float* %227, i64 %229
%231 = load float, float* %230
%232 = fpext float %231 to double
%233 = call i32 (i32*, i8*, ...) @fprintf(i32* %222, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), double %224, double %226, double %232)
br label %234
234: ; preds = %211, %189
br label %235
235: ; preds = %234
%236 = load i32, i32* %29
%237 = add nsw i32 %236, 1
store i32 %237, i32* %29
br label %166
238: ; preds = %166
%239 = load i32*, i32** %27
%240 = call i32 (i32*, i8*, ...) @fprintf(i32* %239, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %241
241: ; preds = %238
%242 = load i32, i32* %28
%243 = add nsw i32 %242, 1
store i32 %243, i32* %28
br label %162
244: ; preds = %162
br label %245
245: ; preds = %244, %148
%246 = load i32*, i32** %27
%247 = call i32 @fclose(i32* %246)
%248 = load float*, float** %16
%249 = call i32 @free(float* %248)
%250 = load float*, float** %17
%251 = call i32 @free(float* %250)
%252 = load float*, float** %18
%253 = call i32 @free(float* %252)
%254 = load float*, float** %19
%255 = call i32 @free(float* %254)
%256 = load float*, float** %20
%257 = call i32 @free(float* %256)
%258 = load float*, float** %21
%259 = call i32 @free(float* %258)
%260 = load float*, float** %22
%261 = call i32 @free(float* %260)
%262 = load float*, float** %23
%263 = call i32 @free(float* %262)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Problem size: %d x %d \0A\00"
@.str.1 = [17 x i8] c"Max threads: %d\0A\00"
@.str.2 = [12 x i8] c"%5d, %0.6f\0A\00"
@.str.4 = [16 x i8] c"Iterations: %i\0A\00"
@.str.5 = [18 x i8] c"Total time: %f s\0A\00"
@.str.6 = [13 x i8] c"temp_cpu.dat\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [14 x i8] c"#x\09y\09temp(K)\0A\00"
@.str.9 = [10 x i8] c"%f\09%f\09%f\0A\00"
@str = [4 x i8] c"CPU\00"
define i32 @main() {
%1 = tail call i64 @calloc(i32 4194304, i32 4)
%2 = inttoptr i64 %1 to float*
%3 = tail call i64 @calloc(i32 4194304, i32 4)
%4 = inttoptr i64 %3 to float*
%5 = tail call i64 @calloc(i32 4194304, i32 4)
%6 = inttoptr i64 %5 to float*
%7 = tail call i64 @calloc(i32 4194304, i32 4)
%8 = inttoptr i64 %7 to float*
%9 = tail call i64 @calloc(i32 4194304, i32 4)
%10 = inttoptr i64 %9 to float*
%11 = tail call i64 @calloc(i32 4194304, i32 4)
%12 = inttoptr i64 %11 to float*
%13 = tail call i64 @calloc(i32 2103300, i32 4)
%14 = inttoptr i64 %13 to float*
%15 = tail call i64 @calloc(i32 2103300, i32 4)
%16 = inttoptr i64 %15 to float*
%17 = tail call i32 @fill_coeffs(i32 2048, i32 2048, float 1.000000e+00, float 0x3F40000000000000, float 0x3F40000000000000, float 0x3F847AE140000000, float 1.000000e+00, float* %2, float* %4, float* %6, float* %8, float* %10, float* %12)
%18 = inttoptr i64 %15 to i8*
%19 = inttoptr i64 %13 to i8*
%20 = getelementptr float, float* %14, i64 2103300
%21 = bitcast float* %20 to i8*
%22 = getelementptr float, float* %16, i64 2103300
%23 = bitcast float* %22 to i8*
%24 = icmp ult i8* %19, %23
%25 = icmp ult i8* %18, %21
%26 = and i1 %24, %25
br i1 %26, label %66, label %27
27: ; preds = %0, %27
%28 = phi i64 [ %64, %27 ], [ 0, %0 ]
%29 = getelementptr inbounds float, float* %14, i64 %28
%30 = bitcast float* %29 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %30
%31 = getelementptr inbounds float, float* %29, i64 4
%32 = bitcast float* %31 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %32
%33 = getelementptr inbounds float, float* %16, i64 %28
%34 = bitcast float* %33 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %34
%35 = getelementptr inbounds float, float* %33, i64 4
%36 = bitcast float* %35 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %36
%37 = or i64 %28, 8
%38 = getelementptr inbounds float, float* %14, i64 %37
%39 = bitcast float* %38 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %39
%40 = getelementptr inbounds float, float* %38, i64 4
%41 = bitcast float* %40 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %41
%42 = getelementptr inbounds float, float* %16, i64 %37
%43 = bitcast float* %42 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %43
%44 = getelementptr inbounds float, float* %42, i64 4
%45 = bitcast float* %44 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %45
%46 = or i64 %28, 16
%47 = getelementptr inbounds float, float* %14, i64 %46
%48 = bitcast float* %47 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %48
%49 = getelementptr inbounds float, float* %47, i64 4
%50 = bitcast float* %49 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %50
%51 = getelementptr inbounds float, float* %16, i64 %46
%52 = bitcast float* %51 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %52
%53 = getelementptr inbounds float, float* %51, i64 4
%54 = bitcast float* %53 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %54
%55 = or i64 %28, 24
%56 = getelementptr inbounds float, float* %14, i64 %55
%57 = bitcast float* %56 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %57
%58 = getelementptr inbounds float, float* %56, i64 4
%59 = bitcast float* %58 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %59
%60 = getelementptr inbounds float, float* %16, i64 %55
%61 = bitcast float* %60 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %61
%62 = getelementptr inbounds float, float* %60, i64 4
%63 = bitcast float* %62 to <4 x float>*
store <4 x float> zeroinitializer, <4 x float>* %63
%64 = add nuw nsw i64 %28, 32
%65 = icmp eq i64 %64, 2103296
br i1 %65, label %66, label %27
66: ; preds = %27, %0
%67 = phi i64 [ 0, %0 ], [ 2103296, %27 ]
br label %68
68: ; preds = %68, %66
%69 = phi i64 [ %67, %66 ], [ %81, %68 ]
%70 = getelementptr inbounds float, float* %14, i64 %69
store float 0.000000e+00, float* %70
%71 = getelementptr inbounds float, float* %16, i64 %69
store float 0.000000e+00, float* %71
%72 = or i64 %69, 1
%73 = getelementptr inbounds float, float* %14, i64 %72
store float 0.000000e+00, float* %73
%74 = getelementptr inbounds float, float* %16, i64 %72
store float 0.000000e+00, float* %74
%75 = or i64 %69, 2
%76 = getelementptr inbounds float, float* %14, i64 %75
store float 0.000000e+00, float* %76
%77 = getelementptr inbounds float, float* %16, i64 %75
store float 0.000000e+00, float* %77
%78 = or i64 %69, 3
%79 = getelementptr inbounds float, float* %14, i64 %78
store float 0.000000e+00, float* %79
%80 = getelementptr inbounds float, float* %16, i64 %78
store float 0.000000e+00, float* %80
%81 = add nuw nsw i64 %69, 4
%82 = icmp eq i64 %81, 2103300
br i1 %82, label %83, label %68
83: ; preds = %68
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 2048, i32 2048)
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1)
%86 = tail call i32 (...) @StartTimer()
br label %87
87: ; preds = %83, %103
%88 = phi i32 [ 1, %83 ], [ %104, %103 ]
%89 = tail call i64 @red_kernel(float* %2, float* %4, float* %6, float* %8, float* %10, float* %12, float* %16, float* %14)
%90 = sitofp i64 %89 to float
%91 = tail call i64 @black_kernel(float* %2, float* %4, float* %6, float* %8, float* %10, float* %12, float* %14, float* %16)
%92 = sitofp i64 %91 to float
%93 = fadd float %90, %92
%94 = fmul float %93, 0x3E90000000000000
%95 = tail call float @sqrt(float %94)
%96 = urem i32 %88, 100
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %87
%99 = fpext float %95 to double
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %88, double %99)
br label %101
101: ; preds = %98, %87
%102 = fcmp olt float %95, 0x3EB0C6F7A0000000
br i1 %102, label %106, label %103
103: ; preds = %101
%104 = add nuw nsw i32 %88, 1
%105 = icmp eq i32 %104, 1000001
br i1 %105, label %106, label %87
106: ; preds = %101, %103
%107 = phi i32 [ %88, %101 ], [ 1000001, %103 ]
%108 = tail call double (...) @GetTimer()
%109 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%110 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %107)
%111 = fdiv double %108, 1.000000e+03
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %111)
%113 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%114 = icmp eq i32* %113, null
br i1 %114, label %152, label %115
115: ; preds = %106
%116 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 13, i64 1, i32* %113)
br label %117
117: ; preds = %115, %148
%118 = phi i32 [ 1, %115 ], [ %150, %148 ]
%119 = add nsw i32 %118, -1
%120 = sitofp i32 %119 to float
%121 = tail call float @llvm.fmuladd.f32(float %120, float 0x3F40000000000000, float 0x3F30000000000000)
%122 = fpext float %121 to double
br label %123
123: ; preds = %117, %123
%124 = phi i32 [ 1, %117 ], [ %146, %123 ]
%125 = add nsw i32 %124, -1
%126 = sitofp i32 %125 to float
%127 = tail call float @llvm.fmuladd.f32(float %126, float 0x3F40000000000000, float 0x3F30000000000000)
%128 = add nuw nsw i32 %124, %118
%129 = and i32 %128, 1
%130 = icmp eq i32 %129, 0
%131 = mul nuw nsw i32 %124, 1026
%132 = and i32 %124, 1
%133 = xor i1 %130, true
%134 = zext i1 %133 to i32
%135 = xor i32 %132, %134
%136 = select i1 %130, float* %14, float* %16
%137 = add nuw nsw i32 %135, %118
%138 = lshr i32 %137, 1
%139 = add nuw nsw i32 %138, %131
%140 = fpext float %127 to double
%141 = zext i32 %139 to i64
%142 = getelementptr inbounds float, float* %136, i64 %141
%143 = load float, float* %142
%144 = fpext float %143 to double
%145 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), double %140, double %122, double %144)
%146 = add nuw nsw i32 %124, 1
%147 = icmp eq i32 %146, 2049
br i1 %147, label %148, label %123
148: ; preds = %123
%149 = tail call i32 @fputc(i32 10, i32* %113)
%150 = add nuw nsw i32 %118, 1
%151 = icmp eq i32 %150, 2049
br i1 %151, label %152, label %117
152: ; preds = %148, %106
%153 = tail call i32 @fclose(i32* %113)
%154 = tail call i32 @free(float* %2)
%155 = tail call i32 @free(float* %4)
%156 = tail call i32 @free(float* %6)
%157 = tail call i32 @free(float* %8)
%158 = tail call i32 @free(float* %10)
%159 = tail call i32 @free(float* %12)
%160 = tail call i32 @free(float* %14)
%161 = tail call i32 @free(float* %16)
ret i32 0
}