#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 */
double GetTimer();
int /*<<< orphan*/ StartTimer();
float asinf(float);
float expf(float const);
int /*<<< orphan*/ fabsf(float);
float fmaxf(float, int /*<<< orphan*/);
int /*<<< orphan*/ memset(float **, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, double, ...);
float sinf(float const);
int main(int argc, char **argv) {
  int n = 4096;
  int m = 4096;
  int iter_max = 1000;
  const float pi = 2.0f * asinf(1.0f);
  const float tol = 1.0e-5f;
  float error = 1.0f;
  float A[n][m];
  float Anew[n][m];
  float y0[n];
  memset(A, 0, n * m * sizeof(float));
  for (int i = 0; i < m; i++) {
    A[0][i] = 0.f;
    A[n - 1][i] = 0.f;
  }
  for (int j = 0; j < n; j++) {
    y0[j] = sinf(pi * j / (n - 1));
    A[j][0] = y0[j];
    A[j][m - 1] = y0[j] * expf(-pi);
  }
  printf("Jacobi relaxation Calculation: %d x %d mesh\n", n, m);
  StartTimer();
  int iter = 0;
#pragma omp parallel for shared(Anew)
  for (int i = 1; i < m; i++) {
    Anew[0][i] = 0.f;
    Anew[n - 1][i] = 0.f;
  }
#pragma omp parallel for shared(Anew)
  for (int j = 1; j < n; j++) {
    Anew[j][0] = y0[j];
    Anew[j][m - 1] = y0[j] * expf(-pi);
  }
#pragma acc data copy(A), create(Anew)
  while (error > tol && iter < iter_max) {
    error = 0.f;
#pragma omp parallel for shared(m, n, Anew, A)
#pragma acc kernels loop gang(32), vector(16)
    for (int j = 1; j < n - 1; j++) {
#pragma acc loop gang(16), vector(32)
      for (int i = 1; i < m - 1; i++) {
        Anew[j][i] =
            0.25f * (A[j][i + 1] + A[j][i - 1] + A[j - 1][i] + A[j + 1][i]);
        error = fmaxf(error, fabsf(Anew[j][i] - A[j][i]));
      }
    }
#pragma omp parallel for shared(m, n, Anew, A)
#pragma acc kernels loop
    for (int j = 1; j < n - 1; j++) {
#pragma acc loop gang(16), vector(32)
      for (int i = 1; i < m - 1; i++) {
        A[j][i] = Anew[j][i];
      }
    }
    if (iter % 100 == 0)
      printf("%5d, %0.6f\n", iter, error);
    iter++;
  }
  double runtime = GetTimer();
  printf(" total: %f s\n", runtime / 1000.f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1000,-0x14(%rbp)
movl   $0x1000,-0x18(%rbp)
movl   $0x3e8,-0x1c(%rbp)
movss  0xe3a(%rip),%xmm0
call   10b0 <asinf@plt>
addss  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x3727c5ac,-0x24(%rbp)
movl   $0x3f800000,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %rax,-0xb0(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0xa8(%rbp)
mov    %rdi,%rsp
mov    %rcx,-0x38(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %rax,-0xa0(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x98(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
mov    -0x14(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1080 <memset@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12ff <main+0x16f>
mov    -0xa8(%rbp),%rax
mov    -0xb0(%rbp),%rdx
imul   $0x0,%rdx,%rsi
shl    $0x2,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
movslq -0x5c(%rbp),%rsi
xorps  %xmm0,%xmm0
movss  %xmm0,(%rcx,%rsi,4)
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x5c(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    129d <main+0x10d>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13d7 <main+0x247>
movss  -0x20(%rbp),%xmm0
cvtsi2ssl -0x60(%rbp),%xmm1
mulss  %xmm1,%xmm0
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
call   1040 <sinf@plt>
mov    -0x90(%rbp),%rax
mov    -0xb0(%rbp),%rsi
mov    -0xa8(%rbp),%rcx
movslq -0x60(%rbp),%rdx
movss  %xmm0,(%rax,%rdx,4)
movslq -0x60(%rbp),%rdx
movss  (%rax,%rdx,4),%xmm0
movslq -0x60(%rbp),%rdx
imul   %rsi,%rdx
movss  %xmm0,(%rcx,%rdx,4)
movslq -0x60(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0xb4(%rbp)
ff
movss  -0x20(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1070 <expf@plt>
mov    -0xb0(%rbp),%rdx
mov    -0xa8(%rbp),%rax
movaps %xmm0,%xmm1
movss  -0xb4(%rbp),%xmm0
ff
mulss  %xmm1,%xmm0
movslq -0x60(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1306 <main+0x176>
cvtsi2sdl -0x14(%rbp),%xmm0
mov    -0x18(%rbp),%esi
lea    0xc32(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <StartTimer@plt>
movl   $0x0,-0x64(%rbp)
movl   $0x1,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1464 <main+0x2d4>
mov    -0x98(%rbp),%rax
mov    -0xa0(%rbp),%rdx
imul   $0x0,%rdx,%rsi
shl    $0x2,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
movslq -0x68(%rbp),%rsi
xorps  %xmm0,%xmm0
movss  %xmm0,(%rcx,%rsi,4)
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x68(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1402 <main+0x272>
movl   $0x1,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1512 <main+0x382>
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%rsi
mov    -0x90(%rbp),%rax
movslq -0x6c(%rbp),%rdx
movss  (%rax,%rdx,4),%xmm0
movslq -0x6c(%rbp),%rdx
imul   %rsi,%rdx
movss  %xmm0,(%rcx,%rdx,4)
movslq -0x6c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0xb8(%rbp)
ff
movss  -0x20(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1070 <expf@plt>
mov    -0xa0(%rbp),%rdx
mov    -0x98(%rbp),%rax
movaps %xmm0,%xmm1
movss  -0xb8(%rbp),%xmm0
ff
mulss  %xmm1,%xmm0
movslq -0x6c(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    146b <main+0x2db>
jmp    1517 <main+0x387>
movss  -0x28(%rbp),%xmm0
xor    %eax,%eax
movss  0xade(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0xb9(%rbp)
jbe    1544 <main+0x3b4>
mov    -0x64(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
mov    %al,-0xb9(%rbp)
mov    -0xb9(%rbp),%al
test   $0x1,%al
jne    1557 <main+0x3c7>
jmp    17ad <main+0x61d>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x1,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    16d2 <main+0x542>
movl   $0x1,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    16bf <main+0x52f>
mov    -0xa8(%rbp),%rax
mov    -0xb0(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%rdi
movslq -0x70(%rbp),%r8
imul   %rdx,%r8
shl    $0x2,%r8
mov    %rax,%rsi
add    %r8,%rsi
mov    -0x74(%rbp),%r8d
add    $0x1,%r8d
movslq %r8d,%r8
movss  (%rsi,%r8,4),%xmm1
movslq -0x70(%rbp),%r8
imul   %rdx,%r8
shl    $0x2,%r8
mov    %rax,%rsi
add    %r8,%rsi
mov    -0x74(%rbp),%r8d
sub    $0x1,%r8d
movslq %r8d,%r8
addss  (%rsi,%r8,4),%xmm1
mov    -0x70(%rbp),%esi
sub    $0x1,%esi
movslq %esi,%r8
imul   %rdx,%r8
shl    $0x2,%r8
mov    %rax,%rsi
add    %r8,%rsi
movslq -0x74(%rbp),%r8
addss  (%rsi,%r8,4),%xmm1
mov    -0x70(%rbp),%esi
add    $0x1,%esi
movslq %esi,%r8
imul   %rdx,%r8
shl    $0x2,%r8
mov    %rax,%rsi
add    %r8,%rsi
movslq -0x74(%rbp),%r8
addss  (%rsi,%r8,4),%xmm1
movss  0x9cd(%rip),%xmm0
mulss  %xmm1,%xmm0
movslq -0x70(%rbp),%r8
imul   %rdi,%r8
shl    $0x2,%r8
mov    %rcx,%rsi
add    %r8,%rsi
movslq -0x74(%rbp),%r8
movss  %xmm0,(%rsi,%r8,4)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0xc0(%rbp)
ff
movslq -0x70(%rbp),%rsi
imul   %rdi,%rsi
shl    $0x2,%rsi
add    %rsi,%rcx
movslq -0x74(%rbp),%rsi
movss  (%rcx,%rsi,4),%xmm0
movslq -0x70(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x74(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
call   1030 <fabsf@plt>
movss  -0xc0(%rbp),%xmm0
ff
mov    %eax,%edi
call   1090 <fmaxf@plt>
movss  %xmm0,-0x28(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    157e <main+0x3ee>
jmp    16c4 <main+0x534>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1566 <main+0x3d6>
movl   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    176f <main+0x5df>
movl   $0x1,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    175c <main+0x5cc>
mov    -0xa8(%rbp),%rax
mov    -0xb0(%rbp),%rdx
mov    -0x98(%rbp),%rcx
mov    -0xa0(%rbp),%rdi
movslq -0x78(%rbp),%rsi
imul   %rdi,%rsi
shl    $0x2,%rsi
add    %rsi,%rcx
movslq -0x7c(%rbp),%rsi
movss  (%rcx,%rsi,4),%xmm0
movslq -0x78(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x7c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    16f1 <main+0x561>
jmp    1761 <main+0x5d1>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    16d9 <main+0x549>
mov    -0x64(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    179f <main+0x60f>
cvtsi2sdl -0x64(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0x8ad(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1517 <main+0x387>
mov    $0x0,%al
call   1050 <GetTimer@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  0x844(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0x87a(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8004018,%rsp
lea    0x4004010(%rsp),%rbx
04
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4000000,%edx
call   1070 <memset@plt>
mov    $0x4000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x8000010(%rsp),%rdi
08
mov    $0x4000,%edx
xor    %esi,%esi
call   1070 <memset@plt>
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mulss  0xe21(%rip),%xmm0
divss  0xe1d(%rip),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x10(%rsp,%rbp,4)
movss  %xmm0,(%rbx)
mulss  0xe0a(%rip),%xmm0
movss  %xmm0,0x3ffc(%rbx)
add    $0x1,%rbp
add    $0x4000,%rbx
cmp    $0x1000,%rbp
jne    11d0 <main+0x50>
lea    0xe07(%rip),%rdi
movsd  0xdef(%rip),%xmm0
mov    $0x1000,%esi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <StartTimer@plt>
lea    0x4014(%rsp),%rdi
mov    $0x3ffc,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x4000014(%rsp),%rdi
04
mov    $0x3ffc,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x1400c(%rsp),%rax
movss  0xd92(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movss  0x14(%rsp,%rbx,4),%xmm0
movss  %xmm0,-0xbffc(%rax)
ff
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8000(%rax)
ff
movss  0x18(%rsp,%rbx,4),%xmm0
movss  %xmm0,-0x7ffc(%rax)
ff
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4000(%rax)
ff
movss  0x1c(%rsp,%rbx,4),%xmm0
movss  %xmm0,-0x3ffc(%rax)
ff
mulss  %xmm1,%xmm0
movss  %xmm0,(%rax)
add    $0x3,%rbx
add    $0xc000,%rax
cmp    $0xfff,%rbx
jne    1280 <main+0x100>
lea    0x400c014(%rsp),%r12
04
xor    %eax,%eax
lea    0xc014(%rsp),%r13
movss  0xd15(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
mov    %rax,0x8(%rsp)
xorps  %xmm0,%xmm0
mov    $0x1,%r15d
lea    0x8014(%rsp),%rbp
mov    %r12,%rbx
nopl   0x0(%rax)
add    $0x1,%r15
mov    $0xfffffffffffff002,%r14
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x4(%rsp)
movss  -0x4(%rbx,%r14,4),%xmm0
addss  -0xc(%rbx,%r14,4),%xmm0
addss  -0x4008(%rbx,%r14,4),%xmm0
bf ff ff
addss  0x3ff8(%rbx,%r14,4),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x3ff8(%rbp,%r14,4)
subss  -0x8(%rbx,%r14,4),%xmm0
call   1030 <fabsf@plt>
movss  0x4(%rsp),%xmm0
mov    %eax,%edi
call   1080 <fmaxf@plt>
movss  0xc85(%rip),%xmm1
inc    %r14
jne    1330 <main+0x1b0>
add    $0x4000,%rbx
add    $0x4000,%rbp
cmp    $0xfff,%r15
jne    1320 <main+0x1a0>
movss  %xmm0,0x4(%rsp)
xor    %ebp,%ebp
nop
lea    (%r12,%rbp,1),%r15
lea    (%r12,%rbp,1),%rdi
add    $0xffffffffffffc000,%rdi
mov    %r13,%rbx
add    %rbp,%rbx
lea    -0x4000(,%rbp,1),%rsi
ff
add    %r13,%rsi
mov    $0x3ff8,%edx
call   1090 <memcpy@plt>
mov    $0x3ff8,%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <memcpy@plt>
add    $0x8000,%rbp
cmp    $0x3ff8000,%rbp
jne    13b0 <main+0x230>
mov    0x8(%rsp),%rbx
imul   $0xc28f5c29,%ebx,%eax
ror    $0x2,%eax
cmp    $0x28f5c28,%eax
ja     142e <main+0x2ae>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xc2e(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xbd5(%rip),%xmm0
movss  0xbc9(%rip),%xmm1
jbe    1454 <main+0x2d4>
lea    0x1(%rbx),%eax
cmp    $0x3e7,%ebx
jb     1300 <main+0x180>
xor    %eax,%eax
call   1050 <GetTimer@plt>
divsd  0xbbd(%rip),%xmm0
lea    0xbf7(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8004018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Jacobi relaxation Calculation: %d x %d mesh\0A\00"
@.str.1 = [12 x i8] c"%5d, %0.6f\0A\00"
@.str.2 = [14 x i8] c" total: %f s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4096, i32* %6
store i32 4096, i32* %7
store i32 1000, i32* %8
%28 = call float @asinf(float 1.000000e+00)
%29 = fmul float 2.000000e+00, %28
store float %29, float* %9
store float 0x3EE4F8B580000000, float* %10
store float 1.000000e+00, float* %11
%30 = load i32, i32* %6
%31 = zext i32 %30 to i64
%32 = load i32, i32* %7
%33 = zext i32 %32 to i64
%34 = call i8* @llvm.stacksave()
store i8* %34, i8** %12
%35 = mul nuw i64 %31, %33
%36 = alloca float, i64 %35
store i64 %31, i64* %13
store i64 %33, i64* %14
%37 = load i32, i32* %6
%38 = zext i32 %37 to i64
%39 = load i32, i32* %7
%40 = zext i32 %39 to i64
%41 = mul nuw i64 %38, %40
%42 = alloca float, i64 %41
store i64 %38, i64* %15
store i64 %40, i64* %16
%43 = load i32, i32* %6
%44 = zext i32 %43 to i64
%45 = alloca float, i64 %44
store i64 %44, i64* %17
%46 = bitcast float* %36 to float**
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = mul nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = mul i64 %50, 4
%52 = trunc i64 %51 to i32
%53 = call i32 @memset(float** %46, i32 0, i32 %52)
store i32 0, i32* %18
br label %54
54: ; preds = %72, %2
%55 = load i32, i32* %18
%56 = load i32, i32* %7
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %75
58: ; preds = %54
%59 = mul nsw i64 0, %33
%60 = getelementptr inbounds float, float* %36, i64 %59
%61 = load i32, i32* %18
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds float, float* %60, i64 %62
store float 0.000000e+00, float* %63
%64 = load i32, i32* %6
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = mul nsw i64 %66, %33
%68 = getelementptr inbounds float, float* %36, i64 %67
%69 = load i32, i32* %18
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds float, float* %68, i64 %70
store float 0.000000e+00, float* %71
br label %72
72: ; preds = %58
%73 = load i32, i32* %18
%74 = add nsw i32 %73, 1
store i32 %74, i32* %18
br label %54
75: ; preds = %54
store i32 0, i32* %19
br label %76
76: ; preds = %118, %75
%77 = load i32, i32* %19
%78 = load i32, i32* %6
%79 = icmp slt i32 %77, %78
br i1 %79, label %80, label %121
80: ; preds = %76
%81 = load float, float* %9
%82 = load i32, i32* %19
%83 = sitofp i32 %82 to float
%84 = fmul float %81, %83
%85 = load i32, i32* %6
%86 = sub nsw i32 %85, 1
%87 = sitofp i32 %86 to float
%88 = fdiv float %84, %87
%89 = call float @sinf(float %88)
%90 = load i32, i32* %19
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds float, float* %45, i64 %91
store float %89, float* %92
%93 = load i32, i32* %19
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds float, float* %45, i64 %94
%96 = load float, float* %95
%97 = load i32, i32* %19
%98 = sext i32 %97 to i64
%99 = mul nsw i64 %98, %33
%100 = getelementptr inbounds float, float* %36, i64 %99
%101 = getelementptr inbounds float, float* %100, i64 0
store float %96, float* %101
%102 = load i32, i32* %19
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds float, float* %45, i64 %103
%105 = load float, float* %104
%106 = load float, float* %9
%107 = fneg float %106
%108 = call float @expf(float %107)
%109 = fmul float %105, %108
%110 = load i32, i32* %19
%111 = sext i32 %110 to i64
%112 = mul nsw i64 %111, %33
%113 = getelementptr inbounds float, float* %36, i64 %112
%114 = load i32, i32* %7
%115 = sub nsw i32 %114, 1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds float, float* %113, i64 %116
store float %109, float* %117
br label %118
118: ; preds = %80
%119 = load i32, i32* %19
%120 = add nsw i32 %119, 1
store i32 %120, i32* %19
br label %76
121: ; preds = %76
%122 = load i32, i32* %6
%123 = sitofp i32 %122 to double
%124 = load i32, i32* %7
%125 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), double %123, i32 %124)
%126 = call i32 (...) @StartTimer()
store i32 0, i32* %20
store i32 1, i32* %21
br label %127
127: ; preds = %145, %121
%128 = load i32, i32* %21
%129 = load i32, i32* %7
%130 = icmp slt i32 %128, %129
br i1 %130, label %131, label %148
131: ; preds = %127
%132 = mul nsw i64 0, %40
%133 = getelementptr inbounds float, float* %42, i64 %132
%134 = load i32, i32* %21
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds float, float* %133, i64 %135
store float 0.000000e+00, float* %136
%137 = load i32, i32* %6
%138 = sub nsw i32 %137, 1
%139 = sext i32 %138 to i64
%140 = mul nsw i64 %139, %40
%141 = getelementptr inbounds float, float* %42, i64 %140
%142 = load i32, i32* %21
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds float, float* %141, i64 %143
store float 0.000000e+00, float* %144
br label %145
145: ; preds = %131
%146 = load i32, i32* %21
%147 = add nsw i32 %146, 1
store i32 %147, i32* %21
br label %127
148: ; preds = %127
store i32 1, i32* %22
br label %149
149: ; preds = %179, %148
%150 = load i32, i32* %22
%151 = load i32, i32* %6
%152 = icmp slt i32 %150, %151
br i1 %152, label %153, label %182
153: ; preds = %149
%154 = load i32, i32* %22
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds float, float* %45, i64 %155
%157 = load float, float* %156
%158 = load i32, i32* %22
%159 = sext i32 %158 to i64
%160 = mul nsw i64 %159, %40
%161 = getelementptr inbounds float, float* %42, i64 %160
%162 = getelementptr inbounds float, float* %161, i64 0
store float %157, float* %162
%163 = load i32, i32* %22
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds float, float* %45, i64 %164
%166 = load float, float* %165
%167 = load float, float* %9
%168 = fneg float %167
%169 = call float @expf(float %168)
%170 = fmul float %166, %169
%171 = load i32, i32* %22
%172 = sext i32 %171 to i64
%173 = mul nsw i64 %172, %40
%174 = getelementptr inbounds float, float* %42, i64 %173
%175 = load i32, i32* %7
%176 = sub nsw i32 %175, 1
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds float, float* %174, i64 %177
store float %170, float* %178
br label %179
179: ; preds = %153
%180 = load i32, i32* %22
%181 = add nsw i32 %180, 1
store i32 %181, i32* %22
br label %149
182: ; preds = %149
br label %183
183: ; preds = %324, %182
%184 = load float, float* %11
%185 = fcmp ogt float %184, 0x3EE4F8B580000000
br i1 %185, label %186, label %190
186: ; preds = %183
%187 = load i32, i32* %20
%188 = load i32, i32* %8
%189 = icmp slt i32 %187, %188
br label %190
190: ; preds = %186, %183
%191 = phi i1 [ false, %183 ], [ %189, %186 ]
br i1 %191, label %192, label %327
192: ; preds = %190
store float 0.000000e+00, float* %11
store i32 1, i32* %23
br label %193
193: ; preds = %276, %192
%194 = load i32, i32* %23
%195 = load i32, i32* %6
%196 = sub nsw i32 %195, 1
%197 = icmp slt i32 %194, %196
br i1 %197, label %198, label %279
198: ; preds = %193
store i32 1, i32* %24
br label %199
199: ; preds = %272, %198
%200 = load i32, i32* %24
%201 = load i32, i32* %7
%202 = sub nsw i32 %201, 1
%203 = icmp slt i32 %200, %202
br i1 %203, label %204, label %275
204: ; preds = %199
%205 = load i32, i32* %23
%206 = sext i32 %205 to i64
%207 = mul nsw i64 %206, %33
%208 = getelementptr inbounds float, float* %36, i64 %207
%209 = load i32, i32* %24
%210 = add nsw i32 %209, 1
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds float, float* %208, i64 %211
%213 = load float, float* %212
%214 = load i32, i32* %23
%215 = sext i32 %214 to i64
%216 = mul nsw i64 %215, %33
%217 = getelementptr inbounds float, float* %36, i64 %216
%218 = load i32, i32* %24
%219 = sub nsw i32 %218, 1
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds float, float* %217, i64 %220
%222 = load float, float* %221
%223 = fadd float %213, %222
%224 = load i32, i32* %23
%225 = sub nsw i32 %224, 1
%226 = sext i32 %225 to i64
%227 = mul nsw i64 %226, %33
%228 = getelementptr inbounds float, float* %36, i64 %227
%229 = load i32, i32* %24
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds float, float* %228, i64 %230
%232 = load float, float* %231
%233 = fadd float %223, %232
%234 = load i32, i32* %23
%235 = add nsw i32 %234, 1
%236 = sext i32 %235 to i64
%237 = mul nsw i64 %236, %33
%238 = getelementptr inbounds float, float* %36, i64 %237
%239 = load i32, i32* %24
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds float, float* %238, i64 %240
%242 = load float, float* %241
%243 = fadd float %233, %242
%244 = fmul float 2.500000e-01, %243
%245 = load i32, i32* %23
%246 = sext i32 %245 to i64
%247 = mul nsw i64 %246, %40
%248 = getelementptr inbounds float, float* %42, i64 %247
%249 = load i32, i32* %24
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds float, float* %248, i64 %250
store float %244, float* %251
%252 = load float, float* %11
%253 = load i32, i32* %23
%254 = sext i32 %253 to i64
%255 = mul nsw i64 %254, %40
%256 = getelementptr inbounds float, float* %42, i64 %255
%257 = load i32, i32* %24
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds float, float* %256, i64 %258
%260 = load float, float* %259
%261 = load i32, i32* %23
%262 = sext i32 %261 to i64
%263 = mul nsw i64 %262, %33
%264 = getelementptr inbounds float, float* %36, i64 %263
%265 = load i32, i32* %24
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds float, float* %264, i64 %266
%268 = load float, float* %267
%269 = fsub float %260, %268
%270 = call i32 @fabsf(float %269)
%271 = call float @fmaxf(float %252, i32 %270)
store float %271, float* %11
br label %272
272: ; preds = %204
%273 = load i32, i32* %24
%274 = add nsw i32 %273, 1
store i32 %274, i32* %24
br label %199
275: ; preds = %199
br label %276
276: ; preds = %275
%277 = load i32, i32* %23
%278 = add nsw i32 %277, 1
store i32 %278, i32* %23
br label %193
279: ; preds = %193
store i32 1, i32* %25
br label %280
280: ; preds = %311, %279
%281 = load i32, i32* %25
%282 = load i32, i32* %6
%283 = sub nsw i32 %282, 1
%284 = icmp slt i32 %281, %283
br i1 %284, label %285, label %314
285: ; preds = %280
store i32 1, i32* %26
br label %286
286: ; preds = %307, %285
%287 = load i32, i32* %26
%288 = load i32, i32* %7
%289 = sub nsw i32 %288, 1
%290 = icmp slt i32 %287, %289
br i1 %290, label %291, label %310
291: ; preds = %286
%292 = load i32, i32* %25
%293 = sext i32 %292 to i64
%294 = mul nsw i64 %293, %40
%295 = getelementptr inbounds float, float* %42, i64 %294
%296 = load i32, i32* %26
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds float, float* %295, i64 %297
%299 = load float, float* %298
%300 = load i32, i32* %25
%301 = sext i32 %300 to i64
%302 = mul nsw i64 %301, %33
%303 = getelementptr inbounds float, float* %36, i64 %302
%304 = load i32, i32* %26
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds float, float* %303, i64 %305
store float %299, float* %306
br label %307
307: ; preds = %291
%308 = load i32, i32* %26
%309 = add nsw i32 %308, 1
store i32 %309, i32* %26
br label %286
310: ; preds = %286
br label %311
311: ; preds = %310
%312 = load i32, i32* %25
%313 = add nsw i32 %312, 1
store i32 %313, i32* %25
br label %280
314: ; preds = %280
%315 = load i32, i32* %20
%316 = srem i32 %315, 100
%317 = icmp eq i32 %316, 0
br i1 %317, label %318, label %324
318: ; preds = %314
%319 = load i32, i32* %20
%320 = sitofp i32 %319 to double
%321 = load float, float* %11
%322 = fpext float %321 to double
%323 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %320, double %322)
br label %324
324: ; preds = %318, %314
%325 = load i32, i32* %20
%326 = add nsw i32 %325, 1
store i32 %326, i32* %20
br label %183
327: ; preds = %190
%328 = call double (...) @GetTimer()
store double %328, double* %27
%329 = load double, double* %27
%330 = fdiv double %329, 1.000000e+03
%331 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %330)
%332 = load i8*, i8** %12
%333 = load i32, i32* %3
ret i32 %333
}

LLVM IR (-O2):
@.str = [45 x i8] c"Jacobi relaxation Calculation: %d x %d mesh\0A\00"
@.str.1 = [12 x i8] c"%5d, %0.6f\0A\00"
@.str.2 = [14 x i8] c" total: %f s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16777216 x float]
%4 = bitcast [16777216 x float]* %3 to i8*
%5 = alloca [16777216 x float]
%6 = alloca [4096 x float]
%7 = bitcast [16777216 x float]* %3 to float**
%8 = call i32 @memset(float** %7, i32 0, i32 67108864)
%9 = getelementptr inbounds [16777216 x float], [16777216 x float]* %3, i64 0, i64 16773120
%10 = bitcast float* %9 to i8*
br label %18
11: ; preds = %18
%12 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), double 4.096000e+03, i32 4096)
%13 = call i32 (...) @StartTimer()
%14 = getelementptr inbounds [16777216 x float], [16777216 x float]* %5, i64 0, i64 1
%15 = bitcast float* %14 to i8*
%16 = getelementptr inbounds [16777216 x float], [16777216 x float]* %5, i64 0, i64 16773121
%17 = bitcast float* %16 to i8*
br label %32
18: ; preds = %2, %18
%19 = phi i64 [ 0, %2 ], [ %30, %18 ]
%20 = trunc i64 %19 to i32
%21 = sitofp i32 %20 to float
%22 = fmul float %21, 0x400921FB60000000
%23 = fdiv float %22, 4.095000e+03
%24 = call float @sinf(float %23)
%25 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %19
store float %24, float* %25
%26 = shl nuw nsw i64 %19, 12
%27 = getelementptr inbounds [16777216 x float], [16777216 x float]* %3, i64 0, i64 %26
store float %24, float* %27
%28 = fmul float %24, 0x3FA6202260000000
%29 = getelementptr inbounds float, float* %27, i64 4095
store float %28, float* %29
%30 = add nuw nsw i64 %19, 1
%31 = icmp eq i64 %30, 4096
br i1 %31, label %11, label %18
32: ; preds = %32, %11
%33 = phi i64 [ 1, %11 ], [ %54, %32 ]
%34 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %33
%35 = load float, float* %34
%36 = shl nuw nsw i64 %33, 12
%37 = getelementptr inbounds [16777216 x float], [16777216 x float]* %5, i64 0, i64 %36
store float %35, float* %37
%38 = fmul float %35, 0x3FA6202260000000
%39 = getelementptr inbounds float, float* %37, i64 4095
store float %38, float* %39
%40 = add nuw nsw i64 %33, 1
%41 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %40
%42 = load float, float* %41
%43 = shl nuw nsw i64 %40, 12
%44 = getelementptr inbounds [16777216 x float], [16777216 x float]* %5, i64 0, i64 %43
store float %42, float* %44
%45 = fmul float %42, 0x3FA6202260000000
%46 = getelementptr inbounds float, float* %44, i64 4095
store float %45, float* %46
%47 = add nuw nsw i64 %33, 2
%48 = getelementptr inbounds [4096 x float], [4096 x float]* %6, i64 0, i64 %47
%49 = load float, float* %48
%50 = shl nuw nsw i64 %47, 12
%51 = getelementptr inbounds [16777216 x float], [16777216 x float]* %5, i64 0, i64 %50
store float %49, float* %51
%52 = fmul float %49, 0x3FA6202260000000
%53 = getelementptr inbounds float, float* %51, i64 4095
store float %52, float* %53
%54 = add nuw nsw i64 %33, 3
%55 = icmp eq i64 %54, 4096
br i1 %55, label %56, label %32
56: ; preds = %32, %119
%57 = phi i32 [ %120, %119 ], [ 0, %32 ]
br label %58
58: ; preds = %56, %70
%59 = phi i64 [ 1, %56 ], [ %66, %70 ]
%60 = phi float [ 0.000000e+00, %56 ], [ %94, %70 ]
%61 = shl nuw nsw i64 %59, 12
%62 = getelementptr inbounds [16777216 x float], [16777216 x float]* %3, i64 0, i64 %61
%63 = shl i64 %59, 12
%64 = add i64 %63, -4096
%65 = getelementptr inbounds [16777216 x float], [16777216 x float]* %3, i64 0, i64 %64
%66 = add nuw nsw i64 %59, 1
%67 = shl nuw nsw i64 %66, 12
%68 = getelementptr inbounds [16777216 x float], [16777216 x float]* %3, i64 0, i64 %67
%69 = getelementptr inbounds [16777216 x float], [16777216 x float]* %5, i64 0, i64 %61
br label %72
70: ; preds = %72
%71 = icmp eq i64 %66, 4095
br i1 %71, label %96, label %58
72: ; preds = %58, %72
%73 = phi i64 [ 1, %58 ], [ %75, %72 ]
%74 = phi float [ %60, %58 ], [ %94, %72 ]
%75 = add nuw nsw i64 %73, 1
%76 = getelementptr inbounds float, float* %62, i64 %75
%77 = load float, float* %76
%78 = add nsw i64 %73, -1
%79 = getelementptr inbounds float, float* %62, i64 %78
%80 = load float, float* %79
%81 = fadd float %77, %80
%82 = getelementptr inbounds float, float* %65, i64 %73
%83 = load float, float* %82
%84 = fadd float %81, %83
%85 = getelementptr inbounds float, float* %68, i64 %73
%86 = load float, float* %85
%87 = fadd float %84, %86
%88 = fmul float %87, 2.500000e-01
%89 = getelementptr inbounds float, float* %69, i64 %73
store float %88, float* %89
%90 = getelementptr inbounds float, float* %62, i64 %73
%91 = load float, float* %90
%92 = fsub float %88, %91
%93 = call i32 @fabsf(float %92)
%94 = call float @fmaxf(float %74, i32 %93)
%95 = icmp eq i64 %75, 4095
br i1 %95, label %70, label %72
96: ; preds = %70, %96
%97 = phi i64 [ %110, %96 ], [ 0, %70 ]
%98 = shl nuw nsw i64 %97, 12
%99 = or i64 %98, 4097
%100 = getelementptr [16777216 x float], [16777216 x float]* %3, i64 0, i64 %99
%101 = bitcast float* %100 to i8*
%102 = getelementptr [16777216 x float], [16777216 x float]* %5, i64 0, i64 %99
%103 = bitcast float* %102 to i8*
%104 = shl i64 %97, 12
%105 = add i64 %104, 8193
%106 = getelementptr [16777216 x float], [16777216 x float]* %3, i64 0, i64 %105
%107 = bitcast float* %106 to i8*
%108 = getelementptr [16777216 x float], [16777216 x float]* %5, i64 0, i64 %105
%109 = bitcast float* %108 to i8*
%110 = add nuw nsw i64 %97, 2
%111 = icmp eq i64 %110, 4094
br i1 %111, label %112, label %96
112: ; preds = %96
%113 = urem i32 %57, 100
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %119
115: ; preds = %112
%116 = sitofp i32 %57 to double
%117 = fpext float %94 to double
%118 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %116, double %117)
br label %119
119: ; preds = %115, %112
%120 = add nuw nsw i32 %57, 1
%121 = fcmp ogt float %94, 0x3EE4F8B580000000
%122 = icmp ult i32 %57, 999
%123 = select i1 %121, i1 %122, i1 false
br i1 %123, label %56, label %124
124: ; preds = %119
%125 = call double (...) @GetTimer()
%126 = fdiv double %125, 1.000000e+03
%127 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %126)
ret i32 0
}