#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();
double 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.0 * 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, Anew)
  while (error > tol && iter < iter_max) {
    error = 0.f;
#pragma omp parallel for shared(m, n, Anew, A)
#pragma acc kernels
    for (int j = 1; j < n - 1; j++) {
      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
    for (int j = 1; j < n - 1; j++) {
      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>
addsd  %xmm0,%xmm0
cvtsd2ss %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    1303 <main+0x173>
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    12a1 <main+0x111>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13db <main+0x24b>
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    130a <main+0x17a>
cvtsi2sdl -0x14(%rbp),%xmm0
mov    -0x18(%rbp),%esi
lea    0xc2e(%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    1468 <main+0x2d8>
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    1406 <main+0x276>
movl   $0x1,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1516 <main+0x386>
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    146f <main+0x2df>
jmp    151b <main+0x38b>
movss  -0x28(%rbp),%xmm0
xor    %eax,%eax
movss  0xada(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0xb9(%rbp)
jbe    1548 <main+0x3b8>
mov    -0x64(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
mov    %al,-0xb9(%rbp)
mov    -0xb9(%rbp),%al
test   $0x1,%al
jne    155b <main+0x3cb>
jmp    17b1 <main+0x621>
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    16d6 <main+0x546>
movl   $0x1,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    16c3 <main+0x533>
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  0x9c9(%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    1582 <main+0x3f2>
jmp    16c8 <main+0x538>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    156a <main+0x3da>
movl   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1773 <main+0x5e3>
movl   $0x1,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1760 <main+0x5d0>
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    16f5 <main+0x565>
jmp    1765 <main+0x5d5>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    16dd <main+0x54d>
mov    -0x64(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    17a3 <main+0x613>
cvtsi2sdl -0x64(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0x8a9(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    151b <main+0x38b>
mov    $0x0,%al
call   1050 <GetTimer@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  0x840(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0x876(%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    $0x8004038,%rsp
movss  0xe47(%rip),%xmm0
call   10c0 <asinf@plt>
addsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x4004030(%rsp),%rbx
04
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4000000,%edx
call   1080 <memset@plt>
mov    $0x4000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
lea    0x8000030(%rsp),%rdi
08
mov    $0x4000,%edx
xor    %esi,%esi
call   1080 <memset@plt>
movsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm1
movaps 0xdfb(%rip),%xmm0
movaps %xmm1,0x20(%rsp)
xorps  %xmm1,%xmm0
movaps %xmm0,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mulss  0x20(%rsp),%xmm0
divss  0xdbf(%rip),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x8(%rsp)
movss  %xmm0,0x30(%rsp,%rbp,4)
movss  %xmm0,(%rbx)
movaps 0x10(%rsp),%xmm0
call   1070 <expf@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x3ffc(%rbx)
add    $0x1,%rbp
add    $0x4000,%rbx
cmp    $0x1000,%rbp
jne    1230 <main+0x90>
lea    0xda3(%rip),%rdi
movsd  0xd8b(%rip),%xmm0
mov    $0x1000,%esi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   10b0 <StartTimer@plt>
lea    0x4034(%rsp),%rdi
mov    $0x3ffc,%edx
xor    %esi,%esi
call   1080 <memset@plt>
lea    0x4000034(%rsp),%rdi
04
mov    $0x3ffc,%edx
xor    %esi,%esi
call   1080 <memset@plt>
lea    0x8030(%rsp),%rbx
mov    $0x1,%ebp
nopl   (%rax)
movss  0x30(%rsp,%rbp,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  %xmm0,(%rbx)
movaps 0x10(%rsp),%xmm0
call   1070 <expf@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x3ffc(%rbx)
add    $0x1,%rbp
add    $0x4000,%rbx
cmp    $0x1000,%rbp
jne    12e0 <main+0x140>
lea    0x400c034(%rsp),%r12
04
xor    %eax,%eax
lea    0xc034(%rsp),%r13
movss  0xcd2(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
mov    %rax,0x8(%rsp)
xorps  %xmm0,%xmm0
mov    $0x1,%r15d
lea    0x8034(%rsp),%rbp
mov    %r12,%rbx
nopl   0x0(%rax)
add    $0x1,%r15
mov    $0xfffffffffffff002,%r14
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x10(%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  0x10(%rsp),%xmm0
mov    %eax,%edi
call   1090 <fmaxf@plt>
movss  0xc41(%rip),%xmm1
inc    %r14
jne    1370 <main+0x1d0>
add    $0x4000,%rbx
add    $0x4000,%rbp
cmp    $0xfff,%r15
jne    1360 <main+0x1c0>
movss  %xmm0,0x10(%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   10a0 <memcpy@plt>
mov    $0x3ff8,%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   10a0 <memcpy@plt>
add    $0x8000,%rbp
cmp    $0x3ff8000,%rbp
jne    13f0 <main+0x250>
mov    0x8(%rsp),%rbx
imul   $0xc28f5c29,%ebx,%eax
ror    $0x2,%eax
cmp    $0x28f5c28,%eax
ja     146e <main+0x2ce>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xbf6(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movss  0x10(%rsp),%xmm0
ucomiss 0xb91(%rip),%xmm0
movss  0xb85(%rip),%xmm1
jbe    1494 <main+0x2f4>
lea    0x1(%rbx),%eax
cmp    $0x3e7,%ebx
jb     1340 <main+0x1a0>
xor    %eax,%eax
call   1050 <GetTimer@plt>
divsd  0xb85(%rip),%xmm0
lea    0xbbf(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8004038,%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 double @asinf(float 1.000000e+00)
%29 = fmul double 2.000000e+00, %28
%30 = fptrunc double %29 to float
store float %30, float* %9
store float 0x3EE4F8B580000000, float* %10
store float 1.000000e+00, float* %11
%31 = load i32, i32* %6
%32 = zext i32 %31 to i64
%33 = load i32, i32* %7
%34 = zext i32 %33 to i64
%35 = call i8* @llvm.stacksave()
store i8* %35, i8** %12
%36 = mul nuw i64 %32, %34
%37 = alloca float, i64 %36
store i64 %32, i64* %13
store i64 %34, i64* %14
%38 = load i32, i32* %6
%39 = zext i32 %38 to i64
%40 = load i32, i32* %7
%41 = zext i32 %40 to i64
%42 = mul nuw i64 %39, %41
%43 = alloca float, i64 %42
store i64 %39, i64* %15
store i64 %41, i64* %16
%44 = load i32, i32* %6
%45 = zext i32 %44 to i64
%46 = alloca float, i64 %45
store i64 %45, i64* %17
%47 = bitcast float* %37 to float**
%48 = load i32, i32* %6
%49 = load i32, i32* %7
%50 = mul nsw i32 %48, %49
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 4
%53 = trunc i64 %52 to i32
%54 = call i32 @memset(float** %47, i32 0, i32 %53)
store i32 0, i32* %18
br label %55
55: ; preds = %73, %2
%56 = load i32, i32* %18
%57 = load i32, i32* %7
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %76
59: ; preds = %55
%60 = mul nsw i64 0, %34
%61 = getelementptr inbounds float, float* %37, i64 %60
%62 = load i32, i32* %18
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds float, float* %61, i64 %63
store float 0.000000e+00, float* %64
%65 = load i32, i32* %6
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = mul nsw i64 %67, %34
%69 = getelementptr inbounds float, float* %37, i64 %68
%70 = load i32, i32* %18
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds float, float* %69, i64 %71
store float 0.000000e+00, float* %72
br label %73
73: ; preds = %59
%74 = load i32, i32* %18
%75 = add nsw i32 %74, 1
store i32 %75, i32* %18
br label %55
76: ; preds = %55
store i32 0, i32* %19
br label %77
77: ; preds = %119, %76
%78 = load i32, i32* %19
%79 = load i32, i32* %6
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %122
81: ; preds = %77
%82 = load float, float* %9
%83 = load i32, i32* %19
%84 = sitofp i32 %83 to float
%85 = fmul float %82, %84
%86 = load i32, i32* %6
%87 = sub nsw i32 %86, 1
%88 = sitofp i32 %87 to float
%89 = fdiv float %85, %88
%90 = call float @sinf(float %89)
%91 = load i32, i32* %19
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds float, float* %46, i64 %92
store float %90, float* %93
%94 = load i32, i32* %19
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds float, float* %46, i64 %95
%97 = load float, float* %96
%98 = load i32, i32* %19
%99 = sext i32 %98 to i64
%100 = mul nsw i64 %99, %34
%101 = getelementptr inbounds float, float* %37, i64 %100
%102 = getelementptr inbounds float, float* %101, i64 0
store float %97, float* %102
%103 = load i32, i32* %19
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds float, float* %46, i64 %104
%106 = load float, float* %105
%107 = load float, float* %9
%108 = fneg float %107
%109 = call float @expf(float %108)
%110 = fmul float %106, %109
%111 = load i32, i32* %19
%112 = sext i32 %111 to i64
%113 = mul nsw i64 %112, %34
%114 = getelementptr inbounds float, float* %37, i64 %113
%115 = load i32, i32* %7
%116 = sub nsw i32 %115, 1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds float, float* %114, i64 %117
store float %110, float* %118
br label %119
119: ; preds = %81
%120 = load i32, i32* %19
%121 = add nsw i32 %120, 1
store i32 %121, i32* %19
br label %77
122: ; preds = %77
%123 = load i32, i32* %6
%124 = sitofp i32 %123 to double
%125 = load i32, i32* %7
%126 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), double %124, i32 %125)
%127 = call i32 (...) @StartTimer()
store i32 0, i32* %20
store i32 1, i32* %21
br label %128
128: ; preds = %146, %122
%129 = load i32, i32* %21
%130 = load i32, i32* %7
%131 = icmp slt i32 %129, %130
br i1 %131, label %132, label %149
132: ; preds = %128
%133 = mul nsw i64 0, %41
%134 = getelementptr inbounds float, float* %43, i64 %133
%135 = load i32, i32* %21
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds float, float* %134, i64 %136
store float 0.000000e+00, float* %137
%138 = load i32, i32* %6
%139 = sub nsw i32 %138, 1
%140 = sext i32 %139 to i64
%141 = mul nsw i64 %140, %41
%142 = getelementptr inbounds float, float* %43, i64 %141
%143 = load i32, i32* %21
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds float, float* %142, i64 %144
store float 0.000000e+00, float* %145
br label %146
146: ; preds = %132
%147 = load i32, i32* %21
%148 = add nsw i32 %147, 1
store i32 %148, i32* %21
br label %128
149: ; preds = %128
store i32 1, i32* %22
br label %150
150: ; preds = %180, %149
%151 = load i32, i32* %22
%152 = load i32, i32* %6
%153 = icmp slt i32 %151, %152
br i1 %153, label %154, label %183
154: ; preds = %150
%155 = load i32, i32* %22
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds float, float* %46, i64 %156
%158 = load float, float* %157
%159 = load i32, i32* %22
%160 = sext i32 %159 to i64
%161 = mul nsw i64 %160, %41
%162 = getelementptr inbounds float, float* %43, i64 %161
%163 = getelementptr inbounds float, float* %162, i64 0
store float %158, float* %163
%164 = load i32, i32* %22
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds float, float* %46, i64 %165
%167 = load float, float* %166
%168 = load float, float* %9
%169 = fneg float %168
%170 = call float @expf(float %169)
%171 = fmul float %167, %170
%172 = load i32, i32* %22
%173 = sext i32 %172 to i64
%174 = mul nsw i64 %173, %41
%175 = getelementptr inbounds float, float* %43, i64 %174
%176 = load i32, i32* %7
%177 = sub nsw i32 %176, 1
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds float, float* %175, i64 %178
store float %171, float* %179
br label %180
180: ; preds = %154
%181 = load i32, i32* %22
%182 = add nsw i32 %181, 1
store i32 %182, i32* %22
br label %150
183: ; preds = %150
br label %184
184: ; preds = %325, %183
%185 = load float, float* %11
%186 = fcmp ogt float %185, 0x3EE4F8B580000000
br i1 %186, label %187, label %191
187: ; preds = %184
%188 = load i32, i32* %20
%189 = load i32, i32* %8
%190 = icmp slt i32 %188, %189
br label %191
191: ; preds = %187, %184
%192 = phi i1 [ false, %184 ], [ %190, %187 ]
br i1 %192, label %193, label %328
193: ; preds = %191
store float 0.000000e+00, float* %11
store i32 1, i32* %23
br label %194
194: ; preds = %277, %193
%195 = load i32, i32* %23
%196 = load i32, i32* %6
%197 = sub nsw i32 %196, 1
%198 = icmp slt i32 %195, %197
br i1 %198, label %199, label %280
199: ; preds = %194
store i32 1, i32* %24
br label %200
200: ; preds = %273, %199
%201 = load i32, i32* %24
%202 = load i32, i32* %7
%203 = sub nsw i32 %202, 1
%204 = icmp slt i32 %201, %203
br i1 %204, label %205, label %276
205: ; preds = %200
%206 = load i32, i32* %23
%207 = sext i32 %206 to i64
%208 = mul nsw i64 %207, %34
%209 = getelementptr inbounds float, float* %37, i64 %208
%210 = load i32, i32* %24
%211 = add nsw i32 %210, 1
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds float, float* %209, i64 %212
%214 = load float, float* %213
%215 = load i32, i32* %23
%216 = sext i32 %215 to i64
%217 = mul nsw i64 %216, %34
%218 = getelementptr inbounds float, float* %37, i64 %217
%219 = load i32, i32* %24
%220 = sub nsw i32 %219, 1
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds float, float* %218, i64 %221
%223 = load float, float* %222
%224 = fadd float %214, %223
%225 = load i32, i32* %23
%226 = sub nsw i32 %225, 1
%227 = sext i32 %226 to i64
%228 = mul nsw i64 %227, %34
%229 = getelementptr inbounds float, float* %37, i64 %228
%230 = load i32, i32* %24
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds float, float* %229, i64 %231
%233 = load float, float* %232
%234 = fadd float %224, %233
%235 = load i32, i32* %23
%236 = add nsw i32 %235, 1
%237 = sext i32 %236 to i64
%238 = mul nsw i64 %237, %34
%239 = getelementptr inbounds float, float* %37, i64 %238
%240 = load i32, i32* %24
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds float, float* %239, i64 %241
%243 = load float, float* %242
%244 = fadd float %234, %243
%245 = fmul float 2.500000e-01, %244
%246 = load i32, i32* %23
%247 = sext i32 %246 to i64
%248 = mul nsw i64 %247, %41
%249 = getelementptr inbounds float, float* %43, i64 %248
%250 = load i32, i32* %24
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds float, float* %249, i64 %251
store float %245, float* %252
%253 = load float, float* %11
%254 = load i32, i32* %23
%255 = sext i32 %254 to i64
%256 = mul nsw i64 %255, %41
%257 = getelementptr inbounds float, float* %43, i64 %256
%258 = load i32, i32* %24
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds float, float* %257, i64 %259
%261 = load float, float* %260
%262 = load i32, i32* %23
%263 = sext i32 %262 to i64
%264 = mul nsw i64 %263, %34
%265 = getelementptr inbounds float, float* %37, i64 %264
%266 = load i32, i32* %24
%267 = sext i32 %266 to i64
%268 = getelementptr inbounds float, float* %265, i64 %267
%269 = load float, float* %268
%270 = fsub float %261, %269
%271 = call i32 @fabsf(float %270)
%272 = call float @fmaxf(float %253, i32 %271)
store float %272, float* %11
br label %273
273: ; preds = %205
%274 = load i32, i32* %24
%275 = add nsw i32 %274, 1
store i32 %275, i32* %24
br label %200
276: ; preds = %200
br label %277
277: ; preds = %276
%278 = load i32, i32* %23
%279 = add nsw i32 %278, 1
store i32 %279, i32* %23
br label %194
280: ; preds = %194
store i32 1, i32* %25
br label %281
281: ; preds = %312, %280
%282 = load i32, i32* %25
%283 = load i32, i32* %6
%284 = sub nsw i32 %283, 1
%285 = icmp slt i32 %282, %284
br i1 %285, label %286, label %315
286: ; preds = %281
store i32 1, i32* %26
br label %287
287: ; preds = %308, %286
%288 = load i32, i32* %26
%289 = load i32, i32* %7
%290 = sub nsw i32 %289, 1
%291 = icmp slt i32 %288, %290
br i1 %291, label %292, label %311
292: ; preds = %287
%293 = load i32, i32* %25
%294 = sext i32 %293 to i64
%295 = mul nsw i64 %294, %41
%296 = getelementptr inbounds float, float* %43, i64 %295
%297 = load i32, i32* %26
%298 = sext i32 %297 to i64
%299 = getelementptr inbounds float, float* %296, i64 %298
%300 = load float, float* %299
%301 = load i32, i32* %25
%302 = sext i32 %301 to i64
%303 = mul nsw i64 %302, %34
%304 = getelementptr inbounds float, float* %37, i64 %303
%305 = load i32, i32* %26
%306 = sext i32 %305 to i64
%307 = getelementptr inbounds float, float* %304, i64 %306
store float %300, float* %307
br label %308
308: ; preds = %292
%309 = load i32, i32* %26
%310 = add nsw i32 %309, 1
store i32 %310, i32* %26
br label %287
311: ; preds = %287
br label %312
312: ; preds = %311
%313 = load i32, i32* %25
%314 = add nsw i32 %313, 1
store i32 %314, i32* %25
br label %281
315: ; preds = %281
%316 = load i32, i32* %20
%317 = srem i32 %316, 100
%318 = icmp eq i32 %317, 0
br i1 %318, label %319, label %325
319: ; preds = %315
%320 = load i32, i32* %20
%321 = sitofp i32 %320 to double
%322 = load float, float* %11
%323 = fpext float %322 to double
%324 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %321, double %323)
br label %325
325: ; preds = %319, %315
%326 = load i32, i32* %20
%327 = add nsw i32 %326, 1
store i32 %327, i32* %20
br label %184
328: ; preds = %191
%329 = call double (...) @GetTimer()
store double %329, double* %27
%330 = load double, double* %27
%331 = fdiv double %330, 1.000000e+03
%332 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %331)
%333 = load i8*, i8** %12
%334 = load i32, i32* %3
ret i32 %334
}

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