#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 */
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ gridprint(double **, int);
scalar_t__ malloc(int);
scalar_t__ omp_get_wtime();
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  int gridSize = 10, numIters = 10;
  double temp, maxdiff, timestamp = 0;
  switch (argc) {
  case 3:
    numIters = atoi(argv[2]);
  case 2:
    gridSize = atoi(argv[1]);
  }
  printf("gridSize: %d\n", gridSize);
  printf("numIters: %d\n", numIters);
  gridSize += 2;
  double **grid = (double **)malloc(gridSize * sizeof(double *));
  double **new = (double **)malloc(gridSize * sizeof(double *));
  for (int i = 0; i < gridSize; i++) {
    grid[i] = (double *)malloc(gridSize * sizeof(double));
    new[i] = (double *)malloc(gridSize * sizeof(double));
  }
  for (int i = 0; i < gridSize; i++) {
    grid[0][i] = 1;
    new[0][i] = 1;
    grid[gridSize - 1][i] = 1;
    new[gridSize - 1][i] = 1;
    grid[i][0] = 1;
    new[i][0] = 1;
    grid[i][gridSize - 1] = 1;
    new[i][gridSize - 1] = 1;
  }
  for (int i = 1; i < gridSize - 1; i++) {
    for (int j = 1; j < gridSize - 1; j++) {
      grid[i][j] = 0;
    }
  }
  timestamp -= omp_get_wtime();
  for (int k = 0; k < numIters; k++) {
    for (int i = 1; i < gridSize - 1; i++) {
      for (int j = 1; j < gridSize - 1; j++) {
        new[i][j] = (grid[i - 1][j] + grid[i + 1][j] + grid[i][j - 1] +
                     grid[i][j + 1]) *
                    0.25;
      }
    }
    for (int i = 1; i < gridSize - 1; i++) {
      for (int j = 1; j < gridSize - 1; j++) {
        grid[i][j] =
            (new[i - 1][j] + new[i + 1][j] + new[i][j - 1] + new[i][j + 1]) *
            0.25;
      }
    }
  }
  timestamp += omp_get_wtime();
  gridprint(grid, gridSize);
  printf("Jacobi iterations runtime: %f seconds\n", timestamp);
  printf("Maximum final error: %f\n",
         1.0 - grid[(gridSize + 1) / 2][(gridSize + 1) / 2]);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x68(%rbp)
sub    $0x2,%eax
je     11c4 <main+0x64>
jmp    11a3 <main+0x43>
mov    -0x68(%rbp),%eax
sub    $0x3,%eax
jne    11d4 <main+0x74>
jmp    11b4 <main+0x54>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
cvtsi2sdl -0x18(%rbp),%xmm0
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1282 <main+0x122>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    122c <main+0xcc>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    138b <main+0x22b>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
movslq -0x48(%rbp),%rcx
movsd  0xd58(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
movslq -0x48(%rbp),%rcx
movsd  0xd40(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x48(%rbp),%rcx
movsd  0xd1e(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x48(%rbp),%rcx
movsd  0xcfc(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xce3(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xccb(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xcaa(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xc88(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1289 <main+0x129>
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13f4 <main+0x294>
movl   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13e1 <main+0x281>
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x50(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    13aa <main+0x24a>
jmp    13e6 <main+0x286>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1392 <main+0x232>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
cvtsi2sd %rax,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15e8 <main+0x488>
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14fb <main+0x39b>
movl   $0x1,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14e8 <main+0x388>
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x5c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xb47(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1440 <main+0x2e0>
jmp    14ed <main+0x38d>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1428 <main+0x2c8>
movl   $0x1,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    15d5 <main+0x475>
movl   $0x1,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    15c2 <main+0x462>
mov    -0x40(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x64(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x64(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xa6d(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    151a <main+0x3ba>
jmp    15c7 <main+0x467>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1502 <main+0x3a2>
jmp    15da <main+0x47a>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1415 <main+0x2b5>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <gridprint@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xa16(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x78(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x70(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
movsd  0x99f(%rip),%xmm0
subsd  (%rax,%rcx,8),%xmm0
lea    0x9e6(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
movl   $0xa,0x14(%rsp)
cmp    $0x2,%edi
je     11a6 <main+0x36>
mov    $0xa,%r14d
cmp    $0x3,%edi
jne    11b2 <main+0x42>
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,0x14(%rsp)
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
cvtsi2sd %r14d,%xmm0
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm0
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
lea    0x2(%r14),%r15d
lea    0x10(,%r14,8),%r13d
mov    %r13d,%edi
call   1060 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    %r13d,%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rsp)
movb   $0x1,0x7(%rsp)
cmp    $0xffffffff,%r14d
mov    %r15d,0x2c(%rsp)
jl     1403 <main+0x293>
mov    %r15d,%ebx
xor    %ebp,%ebp
mov    0x18(%rsp),%r12
nopl   0x0(%rax)
mov    %r13d,%edi
call   1060 <malloc@plt>
mov    0x20(%rsp),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    %r13d,%edi
call   1060 <malloc@plt>
mov    %rax,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1220 <main+0xb0>
cmp    $0xffffffff,%r14d
jl     1403 <main+0x293>
mov    0x20(%rsp),%rcx
mov    (%rcx),%r8
mov    %r15d,%edx
mov    0x18(%rsp),%r15
mov    (%r15),%r9
lea    0x1(%r14),%eax
mov    (%rcx,%rax,8),%r10
cmp    $0x2,%edx
mov    $0x1,%ecx
cmovge %edx,%ecx
mov    (%r15,%rax,8),%rdi
lea    -0x8(,%rcx,8),%rbp
ff
xor    %ebx,%ebx
movabs $0x3ff0000000000000,%rcx
mov    %r9,%rdx
mov    %r8,%rsi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rcx,(%r8,%rbx,1)
mov    %rcx,(%r9,%rbx,1)
mov    %rcx,(%r10,%rbx,1)
mov    %rcx,(%rdi,%rbx,1)
mov    %rcx,(%rsi)
mov    %rcx,(%rdx)
mov    %rcx,(%rsi,%rax,8)
mov    %rcx,(%rdx,%rax,8)
cmp    %rbx,%rbp
je     12d8 <main+0x168>
mov    0x20(%rsp),%rdx
mov    0x8(%rdx,%rbx,1),%rsi
mov    0x8(%r15,%rbx,1),%rdx
add    $0x8,%rbx
jmp    12a0 <main+0x130>
test   %r14d,%r14d
setle  %cl
jle    1408 <main+0x298>
mov    %cl,0x8(%rsp)
mov    %r14d,%r13d
shl    $0x3,%r13
lea    -0x1(%rax),%rbx
add    $0xfffffffffffffffe,%rax
mov    %ebx,%r15d
and    $0x7,%r15d
mov    $0x1,%r12d
cmp    $0x7,%rax
jb     13c9 <main+0x259>
and    $0xfffffffffffffff8,%rbx
xor    %r12d,%r12d
mov    0x20(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    0x8(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x10(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x18(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x20(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x28(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x30(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x38(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
mov    0x40(%rbp,%r12,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
add    $0x8,%r12
cmp    %r12,%rbx
jne    1320 <main+0x1b0>
add    $0x1,%r12
test   %r15,%r15
je     13fb <main+0x28b>
mov    0x20(%rsp),%rax
lea    (%rax,%r12,8),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    13e0 <main+0x270>
mov    0x8(%rsp),%al
mov    %al,0x7(%rsp)
mov    0x18(%rsp),%r15
mov    %r14,0x30(%rsp)
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
mov    %rax,0x50(%rsp)
cmpl   $0x0,0x14(%rsp)
jle    1862 <main+0x6f2>
mov    0x30(%rsp),%rax
lea    0x1(%rax),%ecx
lea    0x1(%rcx),%rax
mov    %rax,0x48(%rsp)
lea    -0x1(%rcx),%r9
mov    %r9,%r11
and    $0xfffffffffffffffc,%r11
lea    0x1(%r11),%rax
mov    %rax,0x38(%rsp)
mov    %rcx,%rax
neg    %rax
mov    %rax,0x8(%rsp)
movsd  0xbb2(%rip),%xmm0
movapd 0xb9a(%rip),%xmm1
mov    %r9,0x40(%rsp)
jmp    1482 <main+0x312>
nopl   (%rax)
mov    0x58(%rsp),%rbx
add    $0x1,%ebx
cmp    0x14(%rsp),%ebx
je     1862 <main+0x6f2>
mov    %rbx,0x58(%rsp)
cmpb   $0x0,0x7(%rsp)
jne    1470 <main+0x300>
mov    $0x1,%edi
jmp    14a9 <main+0x339>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %rcx,%rdi
je     1680 <main+0x510>
mov    0x20(%rsp),%rdx
mov    -0x8(%rdx,%rdi,8),%rbp
mov    (%rdx,%rdi,8),%rsi
mov    (%r15,%rdi,8),%r12
add    $0x1,%rdi
mov    %edi,%eax
mov    (%rdx,%rax,8),%rbx
mov    $0x1,%eax
cmp    $0x4,%r9
jb     15e0 <main+0x470>
lea    0x8(%r12),%rax
lea    (%r12,%rcx,8),%r13
lea    0x8(%rbp),%r8
lea    0x0(,%rcx,8),%r9
add    %rbp,%r9
lea    0x8(%rbx),%r10
lea    (%rbx,%rcx,8),%r14
mov    0x48(%rsp),%rdx
lea    (%rsi,%rdx,8),%rdx
cmp    %r9,%rax
mov    %rdi,0x60(%rsp)
setb   %dil
cmp    %r13,%r8
setb   %r9b
cmp    %r14,%rax
setb   %r14b
cmp    %r13,%r10
setb   %r10b
cmp    %rdx,%rax
mov    0x18(%rsp),%r15
setb   %r8b
cmp    %r13,%rsi
setb   %dl
mov    $0x1,%eax
test   %r9b,%dil
mov    0x60(%rsp),%rdi
mov    0x40(%rsp),%r9
jne    15e0 <main+0x470>
mov    $0x1,%eax
and    %r10b,%r14b
jne    15e0 <main+0x470>
mov    $0x1,%eax
and    %dl,%r8b
jne    15e0 <main+0x470>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movupd 0x8(%rbp,%rax,8),%xmm2
movupd 0x18(%rbp,%rax,8),%xmm3
movupd 0x8(%rbx,%rax,8),%xmm4
addpd  %xmm2,%xmm4
movupd 0x18(%rbx,%rax,8),%xmm2
addpd  %xmm3,%xmm2
movupd (%rsi,%rax,8),%xmm3
addpd  %xmm4,%xmm3
movupd 0x10(%rsi,%rax,8),%xmm4
movupd 0x20(%rsi,%rax,8),%xmm5
addpd  %xmm4,%xmm2
addpd  %xmm5,%xmm2
addpd  %xmm4,%xmm3
mulpd  %xmm1,%xmm3
mulpd  %xmm1,%xmm2
movupd %xmm3,0x8(%r12,%rax,8)
movupd %xmm2,0x18(%r12,%rax,8)
add    $0x4,%rax
cmp    %rax,%r11
jne    1570 <main+0x400>
mov    0x38(%rsp),%rax
cmp    %r11,%r9
je     14a0 <main+0x330>
xchg   %ax,%ax
mov    %rax,%r8
test   $0x1,%cl
jne    160d <main+0x49d>
movsd  0x0(%rbp,%rax,8),%xmm2
addsd  (%rbx,%rax,8),%xmm2
addsd  -0x8(%rsi,%rax,8),%xmm2
lea    0x1(%rax),%r8
addsd  0x8(%rsi,%rax,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%r12,%rax,8)
not    %rax
cmp    0x8(%rsp),%rax
je     14a0 <main+0x330>
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r8,8),%xmm2
addsd  (%rbx,%r8,8),%xmm2
addsd  -0x8(%rsi,%r8,8),%xmm2
addsd  0x8(%rsi,%r8,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%r12,%r8,8)
movsd  0x8(%rbp,%r8,8),%xmm2
addsd  0x8(%rbx,%r8,8),%xmm2
addsd  (%rsi,%r8,8),%xmm2
addsd  0x10(%rsi,%r8,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%r12,%r8,8)
lea    0x2(%r8),%rax
mov    %rax,%r8
cmp    %rax,%rcx
jne    1620 <main+0x4b0>
jmp    14a0 <main+0x330>
nopl   0x0(%rax)
cmpb   $0x0,0x7(%rsp)
jne    1470 <main+0x300>
mov    $0x1,%r12d
jmp    16a9 <main+0x539>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %rcx,%r12
je     1470 <main+0x300>
mov    -0x8(%r15,%r12,8),%rbp
mov    (%r15,%r12,8),%rsi
mov    0x20(%rsp),%rax
mov    (%rax,%r12,8),%rbx
add    $0x1,%r12
mov    %r12d,%eax
mov    (%r15,%rax,8),%rdx
mov    $0x1,%edi
cmp    $0x4,%r9
jb     17d0 <main+0x660>
lea    0x8(%rbx),%rdi
lea    (%rbx,%rcx,8),%r15
lea    0x8(%rbp),%r8
lea    0x0(,%rcx,8),%r9
add    %rbp,%r9
lea    0x8(%rdx),%r10
lea    (%rdx,%rcx,8),%r14
mov    0x48(%rsp),%rax
lea    (%rsi,%rax,8),%rax
cmp    %r9,%rdi
setb   %r13b
cmp    %r15,%r8
setb   %r9b
cmp    %r14,%rdi
setb   %r14b
cmp    %r15,%r10
setb   %r10b
cmp    %rax,%rdi
setb   %r8b
cmp    %r15,%rsi
setb   %al
mov    $0x1,%edi
test   %r9b,%r13b
mov    0x40(%rsp),%r9
mov    0x18(%rsp),%r15
jne    17d0 <main+0x660>
mov    $0x1,%edi
and    %r10b,%r14b
jne    17d0 <main+0x660>
mov    $0x1,%edi
and    %al,%r8b
jne    17d0 <main+0x660>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movupd 0x8(%rbp,%rax,8),%xmm2
movupd 0x18(%rbp,%rax,8),%xmm3
movupd 0x8(%rdx,%rax,8),%xmm4
addpd  %xmm2,%xmm4
movupd 0x18(%rdx,%rax,8),%xmm2
addpd  %xmm3,%xmm2
movupd (%rsi,%rax,8),%xmm3
addpd  %xmm4,%xmm3
movupd 0x10(%rsi,%rax,8),%xmm4
movupd 0x20(%rsi,%rax,8),%xmm5
addpd  %xmm4,%xmm2
addpd  %xmm5,%xmm2
addpd  %xmm4,%xmm3
mulpd  %xmm1,%xmm3
mulpd  %xmm1,%xmm2
movupd %xmm3,0x8(%rbx,%rax,8)
movupd %xmm2,0x18(%rbx,%rax,8)
add    $0x4,%rax
cmp    %rax,%r11
jne    1760 <main+0x5f0>
mov    0x38(%rsp),%rdi
cmp    %r11,%r9
je     16a0 <main+0x530>
nopl   0x0(%rax)
mov    %rdi,%rax
test   $0x1,%cl
jne    17fc <main+0x68c>
movsd  0x0(%rbp,%rdi,8),%xmm2
addsd  (%rdx,%rdi,8),%xmm2
addsd  -0x8(%rsi,%rdi,8),%xmm2
lea    0x1(%rdi),%rax
addsd  0x8(%rsi,%rdi,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%rbx,%rdi,8)
not    %rdi
cmp    0x8(%rsp),%rdi
je     16a0 <main+0x530>
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rax,8),%xmm2
addsd  (%rdx,%rax,8),%xmm2
addsd  -0x8(%rsi,%rax,8),%xmm2
addsd  0x8(%rsi,%rax,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%rbx,%rax,8)
movsd  0x8(%rbp,%rax,8),%xmm2
addsd  0x8(%rdx,%rax,8),%xmm2
addsd  (%rsi,%rax,8),%xmm2
addsd  0x10(%rsi,%rax,8),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbx,%rax,8)
lea    0x2(%rax),%rdi
mov    %rdi,%rax
cmp    %rdi,%rcx
jne    1810 <main+0x6a0>
jmp    16a0 <main+0x530>
xorps  %xmm0,%xmm0
cvtsi2sdq 0x50(%rsp),%xmm0
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    0x2c(%rsp),%esi
call   1090 <gridprint@plt>
lea    0x78f(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
mov    0x30(%rsp),%rcx
mov    %ecx,%eax
add    $0x3,%eax
shr    $0x1f,%eax
add    %ecx,%eax
add    $0x3,%eax
sar    %eax
cltq
mov    (%rbx,%rax,8),%rcx
movsd  0x73e(%rip),%xmm0
subsd  (%rcx,%rax,8),%xmm0
lea    0x77d(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"gridSize: %d\0A\00"
@.str.1 = [14 x i8] c"numIters: %d\0A\00"
@.str.2 = [39 x i8] c"Jacobi iterations runtime: %f seconds\0A\00"
@.str.3 = [25 x i8] c"Maximum final error: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %12 [
i32 3, label %3
i32 2, label %7
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 2
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
br label %7
7: ; preds = %2, %3
%8 = phi i32 [ 10, %2 ], [ %6, %3 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ 10, %2 ], [ %8, %7 ]
%14 = phi i32 [ 10, %2 ], [ %11, %7 ]
%15 = sitofp i32 %14 to double
%16 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %15)
%17 = sitofp i32 %13 to double
%18 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = add nsw i32 %14, 2
%20 = shl i32 %19, 3
%21 = tail call i64 @malloc(i32 %20)
%22 = inttoptr i64 %21 to double**
%23 = tail call i64 @malloc(i32 %20)
%24 = inttoptr i64 %23 to double**
%25 = icmp sgt i32 %14, -2
br i1 %25, label %26, label %91
26: ; preds = %12
%27 = zext i32 %19 to i64
br label %40
28: ; preds = %40
br i1 %25, label %29, label %91
29: ; preds = %28
%30 = load double*, double** %22
%31 = load double*, double** %24
%32 = add nsw i32 %14, 1
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds double*, double** %22, i64 %33
%35 = load double*, double** %34
%36 = getelementptr inbounds double*, double** %24, i64 %33
%37 = load double*, double** %36
%38 = call i32 @llvm.smax.i32(i32 %19, i32 1)
%39 = zext i32 %38 to i64
br label %61
40: ; preds = %26, %40
%41 = phi i64 [ 0, %26 ], [ %48, %40 ]
%42 = tail call i64 @malloc(i32 %20)
%43 = inttoptr i64 %42 to double*
%44 = getelementptr inbounds double*, double** %22, i64 %41
store double* %43, double** %44
%45 = tail call i64 @malloc(i32 %20)
%46 = inttoptr i64 %45 to double*
%47 = getelementptr inbounds double*, double** %24, i64 %41
store double* %46, double** %47
%48 = add nuw nsw i64 %41, 1
%49 = icmp eq i64 %48, %27
br i1 %49, label %28, label %40
50: ; preds = %61
%51 = icmp slt i32 %14, 1
br i1 %51, label %91, label %52
52: ; preds = %50
%53 = zext i32 %14 to i64
%54 = shl nuw nsw i64 %53, 3
%55 = add nsw i64 %33, -1
%56 = add nsw i64 %33, -2
%57 = and i64 %55, 7
%58 = icmp ult i64 %56, 7
br i1 %58, label %78, label %59
59: ; preds = %52
%60 = and i64 %55, -8
br label %117
61: ; preds = %73, %29
%62 = phi double* [ %31, %29 ], [ %77, %73 ]
%63 = phi double* [ %30, %29 ], [ %75, %73 ]
%64 = phi i64 [ 0, %29 ], [ %71, %73 ]
%65 = getelementptr inbounds double, double* %30, i64 %64
store double 1.000000e+00, double* %65
%66 = getelementptr inbounds double, double* %31, i64 %64
store double 1.000000e+00, double* %66
%67 = getelementptr inbounds double, double* %35, i64 %64
store double 1.000000e+00, double* %67
%68 = getelementptr inbounds double, double* %37, i64 %64
store double 1.000000e+00, double* %68
store double 1.000000e+00, double* %63
store double 1.000000e+00, double* %62
%69 = getelementptr inbounds double, double* %63, i64 %33
store double 1.000000e+00, double* %69
%70 = getelementptr inbounds double, double* %62, i64 %33
store double 1.000000e+00, double* %70
%71 = add nuw nsw i64 %64, 1
%72 = icmp eq i64 %71, %39
br i1 %72, label %50, label %73
73: ; preds = %61
%74 = getelementptr inbounds double*, double** %22, i64 %71
%75 = load double*, double** %74
%76 = getelementptr inbounds double*, double** %24, i64 %71
%77 = load double*, double** %76
br label %61
78: ; preds = %117, %52
%79 = phi i64 [ 1, %52 ], [ %159, %117 ]
%80 = icmp eq i64 %57, 0
br i1 %80, label %91, label %81
81: ; preds = %78, %81
%82 = phi i64 [ %88, %81 ], [ %79, %78 ]
%83 = phi i64 [ %89, %81 ], [ 0, %78 ]
%84 = getelementptr inbounds double*, double** %22, i64 %82
%85 = load double*, double** %84
%86 = getelementptr double, double* %85, i64 1
%87 = bitcast double* %86 to i8*
%88 = add nuw nsw i64 %82, 1
%89 = add i64 %83, 1
%90 = icmp eq i64 %89, %57
br i1 %90, label %91, label %81
91: ; preds = %78, %81, %12, %28, %50
%92 = phi i1 [ true, %50 ], [ true, %28 ], [ true, %12 ], [ %51, %81 ], [ %51, %78 ]
%93 = tail call i64 (...) @omp_get_wtime()
%94 = icmp sgt i32 %13, 0
br i1 %94, label %95, label %164
95: ; preds = %91
%96 = add i32 %14, 1
%97 = zext i32 %96 to i64
%98 = zext i32 %96 to i64
%99 = add nuw nsw i64 %97, 1
%100 = add nsw i64 %97, -1
%101 = add nuw nsw i64 %97, 1
%102 = add nsw i64 %97, -1
%103 = icmp ult i64 %102, 4
%104 = and i64 %102, -4
%105 = or i64 %104, 1
%106 = icmp eq i64 %102, %104
%107 = and i64 %97, 1
%108 = icmp eq i64 %107, 0
%109 = sub nsw i64 0, %97
%110 = icmp ult i64 %100, 4
%111 = and i64 %100, -4
%112 = or i64 %111, 1
%113 = icmp eq i64 %100, %111
%114 = and i64 %97, 1
%115 = icmp eq i64 %114, 0
%116 = sub nsw i64 0, %97
br label %162
117: ; preds = %117, %59
%118 = phi i64 [ 1, %59 ], [ %159, %117 ]
%119 = phi i64 [ 0, %59 ], [ %160, %117 ]
%120 = getelementptr inbounds double*, double** %22, i64 %118
%121 = load double*, double** %120
%122 = getelementptr double, double* %121, i64 1
%123 = bitcast double* %122 to i8*
%124 = add nuw nsw i64 %118, 1
%125 = getelementptr inbounds double*, double** %22, i64 %124
%126 = load double*, double** %125
%127 = getelementptr double, double* %126, i64 1
%128 = bitcast double* %127 to i8*
%129 = add nuw nsw i64 %118, 2
%130 = getelementptr inbounds double*, double** %22, i64 %129
%131 = load double*, double** %130
%132 = getelementptr double, double* %131, i64 1
%133 = bitcast double* %132 to i8*
%134 = add nuw nsw i64 %118, 3
%135 = getelementptr inbounds double*, double** %22, i64 %134
%136 = load double*, double** %135
%137 = getelementptr double, double* %136, i64 1
%138 = bitcast double* %137 to i8*
%139 = add nuw nsw i64 %118, 4
%140 = getelementptr inbounds double*, double** %22, i64 %139
%141 = load double*, double** %140
%142 = getelementptr double, double* %141, i64 1
%143 = bitcast double* %142 to i8*
%144 = add nuw nsw i64 %118, 5
%145 = getelementptr inbounds double*, double** %22, i64 %144
%146 = load double*, double** %145
%147 = getelementptr double, double* %146, i64 1
%148 = bitcast double* %147 to i8*
%149 = add nuw nsw i64 %118, 6
%150 = getelementptr inbounds double*, double** %22, i64 %149
%151 = load double*, double** %150
%152 = getelementptr double, double* %151, i64 1
%153 = bitcast double* %152 to i8*
%154 = add nuw nsw i64 %118, 7
%155 = getelementptr inbounds double*, double** %22, i64 %154
%156 = load double*, double** %155
%157 = getelementptr double, double* %156, i64 1
%158 = bitcast double* %157 to i8*
%159 = add nuw nsw i64 %118, 8
%160 = add i64 %119, 8
%161 = icmp eq i64 %160, %60
br i1 %161, label %78, label %117
162: ; preds = %95, %411
%163 = phi i32 [ 0, %95 ], [ %412, %411 ]
br i1 %92, label %411, label %183
164: ; preds = %411, %91
%165 = sitofp i64 %93 to double
%166 = fsub double 0.000000e+00, %165
%167 = tail call i64 (...) @omp_get_wtime()
%168 = sitofp i64 %167 to double
%169 = fadd double %166, %168
%170 = tail call i32 @gridprint(double** %22, i32 %19)
%171 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), double %169)
%172 = add nsw i32 %14, 3
%173 = sdiv i32 %172, 2
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double*, double** %22, i64 %174
%176 = load double*, double** %175
%177 = getelementptr inbounds double, double* %176, i64 %174
%178 = load double, double* %177
%179 = fsub double 1.000000e+00, %178
%180 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %179)
%181 = tail call i32 @exit(i32 0)
unreachable
182: ; preds = %280
br i1 %92, label %411, label %314
183: ; preds = %162, %280
%184 = phi i64 [ %188, %280 ], [ 1, %162 ]
%185 = add nsw i64 %184, -1
%186 = getelementptr inbounds double*, double** %22, i64 %185
%187 = load double*, double** %186
%188 = add nuw nsw i64 %184, 1
%189 = and i64 %188, 4294967295
%190 = getelementptr inbounds double*, double** %22, i64 %189
%191 = load double*, double** %190
%192 = getelementptr inbounds double*, double** %22, i64 %184
%193 = load double*, double** %192
%194 = getelementptr inbounds double*, double** %24, i64 %184
%195 = load double*, double** %194
br i1 %103, label %258, label %196
196: ; preds = %183
%197 = getelementptr double, double* %195, i64 1
%198 = getelementptr double, double* %195, i64 %97
%199 = getelementptr double, double* %187, i64 1
%200 = getelementptr double, double* %187, i64 %97
%201 = getelementptr double, double* %191, i64 1
%202 = getelementptr double, double* %191, i64 %97
%203 = getelementptr double, double* %193, i64 %101
%204 = icmp ult double* %197, %200
%205 = icmp ult double* %199, %198
%206 = and i1 %204, %205
%207 = icmp ult double* %197, %202
%208 = icmp ult double* %201, %198
%209 = and i1 %207, %208
%210 = or i1 %206, %209
%211 = icmp ult double* %197, %203
%212 = icmp ult double* %193, %198
%213 = and i1 %211, %212
%214 = or i1 %210, %213
br i1 %214, label %258, label %215
215: ; preds = %196, %215
%216 = phi i64 [ %255, %215 ], [ 0, %196 ]
%217 = or i64 %216, 1
%218 = getelementptr inbounds double, double* %187, i64 %217
%219 = bitcast double* %218 to <2 x double>*
%220 = load <2 x double>, <2 x double>* %219
%221 = getelementptr inbounds double, double* %218, i64 2
%222 = bitcast double* %221 to <2 x double>*
%223 = load <2 x double>, <2 x double>* %222
%224 = getelementptr inbounds double, double* %191, i64 %217
%225 = bitcast double* %224 to <2 x double>*
%226 = load <2 x double>, <2 x double>* %225
%227 = getelementptr inbounds double, double* %224, i64 2
%228 = bitcast double* %227 to <2 x double>*
%229 = load <2 x double>, <2 x double>* %228
%230 = fadd <2 x double> %220, %226
%231 = fadd <2 x double> %223, %229
%232 = getelementptr inbounds double, double* %193, i64 %216
%233 = bitcast double* %232 to <2 x double>*
%234 = load <2 x double>, <2 x double>* %233
%235 = getelementptr inbounds double, double* %232, i64 2
%236 = bitcast double* %235 to <2 x double>*
%237 = load <2 x double>, <2 x double>* %236
%238 = fadd <2 x double> %230, %234
%239 = fadd <2 x double> %231, %237
%240 = or i64 %216, 2
%241 = getelementptr inbounds double, double* %193, i64 %240
%242 = bitcast double* %241 to <2 x double>*
%243 = load <2 x double>, <2 x double>* %242
%244 = getelementptr inbounds double, double* %241, i64 2
%245 = bitcast double* %244 to <2 x double>*
%246 = load <2 x double>, <2 x double>* %245
%247 = fadd <2 x double> %238, %243
%248 = fadd <2 x double> %239, %246
%249 = fmul <2 x double> %247, <double 2.500000e-01, double 2.500000e-01>
%250 = fmul <2 x double> %248, <double 2.500000e-01, double 2.500000e-01>
%251 = getelementptr inbounds double, double* %195, i64 %217
%252 = bitcast double* %251 to <2 x double>*
store <2 x double> %249, <2 x double>* %252
%253 = getelementptr inbounds double, double* %251, i64 2
%254 = bitcast double* %253 to <2 x double>*
store <2 x double> %250, <2 x double>* %254
%255 = add nuw i64 %216, 4
%256 = icmp eq i64 %255, %104
br i1 %256, label %257, label %215
257: ; preds = %215
br i1 %106, label %280, label %258
258: ; preds = %196, %183, %257
%259 = phi i64 [ 1, %196 ], [ 1, %183 ], [ %105, %257 ]
%260 = xor i64 %259, -1
br i1 %108, label %261, label %277
261: ; preds = %258
%262 = getelementptr inbounds double, double* %187, i64 %259
%263 = load double, double* %262
%264 = getelementptr inbounds double, double* %191, i64 %259
%265 = load double, double* %264
%266 = fadd double %263, %265
%267 = add nsw i64 %259, -1
%268 = getelementptr inbounds double, double* %193, i64 %267
%269 = load double, double* %268
%270 = fadd double %266, %269
%271 = add nuw nsw i64 %259, 1
%272 = getelementptr inbounds double, double* %193, i64 %271
%273 = load double, double* %272
%274 = fadd double %270, %273
%275 = fmul double %274, 2.500000e-01
%276 = getelementptr inbounds double, double* %195, i64 %259
store double %275, double* %276
br label %277
277: ; preds = %261, %258
%278 = phi i64 [ %259, %258 ], [ %271, %261 ]
%279 = icmp eq i64 %260, %109
br i1 %279, label %280, label %282
280: ; preds = %277, %282, %257
%281 = icmp eq i64 %188, %97
br i1 %281, label %182, label %183
282: ; preds = %277, %282
%283 = phi i64 [ %307, %282 ], [ %278, %277 ]
%284 = getelementptr inbounds double, double* %187, i64 %283
%285 = load double, double* %284
%286 = getelementptr inbounds double, double* %191, i64 %283
%287 = load double, double* %286
%288 = fadd double %285, %287
%289 = add nsw i64 %283, -1
%290 = getelementptr inbounds double, double* %193, i64 %289
%291 = load double, double* %290
%292 = fadd double %288, %291
%293 = add nuw nsw i64 %283, 1
%294 = getelementptr inbounds double, double* %193, i64 %293
%295 = load double, double* %294
%296 = fadd double %292, %295
%297 = fmul double %296, 2.500000e-01
%298 = getelementptr inbounds double, double* %195, i64 %283
store double %297, double* %298
%299 = getelementptr inbounds double, double* %187, i64 %293
%300 = load double, double* %299
%301 = getelementptr inbounds double, double* %191, i64 %293
%302 = load double, double* %301
%303 = fadd double %300, %302
%304 = getelementptr inbounds double, double* %193, i64 %283
%305 = load double, double* %304
%306 = fadd double %303, %305
%307 = add nuw nsw i64 %283, 2
%308 = getelementptr inbounds double, double* %193, i64 %307
%309 = load double, double* %308
%310 = fadd double %306, %309
%311 = fmul double %310, 2.500000e-01
%312 = getelementptr inbounds double, double* %195, i64 %293
store double %311, double* %312
%313 = icmp eq i64 %307, %97
br i1 %313, label %280, label %282
314: ; preds = %182, %414
%315 = phi i64 [ %319, %414 ], [ 1, %182 ]
%316 = add nsw i64 %315, -1
%317 = getelementptr inbounds double*, double** %24, i64 %316
%318 = load double*, double** %317
%319 = add nuw nsw i64 %315, 1
%320 = and i64 %319, 4294967295
%321 = getelementptr inbounds double*, double** %24, i64 %320
%322 = load double*, double** %321
%323 = getelementptr inbounds double*, double** %24, i64 %315
%324 = load double*, double** %323
%325 = getelementptr inbounds double*, double** %22, i64 %315
%326 = load double*, double** %325
br i1 %110, label %389, label %327
327: ; preds = %314
%328 = getelementptr double, double* %326, i64 1
%329 = getelementptr double, double* %326, i64 %97
%330 = getelementptr double, double* %318, i64 1
%331 = getelementptr double, double* %318, i64 %97
%332 = getelementptr double, double* %322, i64 1
%333 = getelementptr double, double* %322, i64 %97
%334 = getelementptr double, double* %324, i64 %99
%335 = icmp ult double* %328, %331
%336 = icmp ult double* %330, %329
%337 = and i1 %335, %336
%338 = icmp ult double* %328, %333
%339 = icmp ult double* %332, %329
%340 = and i1 %338, %339
%341 = or i1 %337, %340
%342 = icmp ult double* %328, %334
%343 = icmp ult double* %324, %329
%344 = and i1 %342, %343
%345 = or i1 %341, %344
br i1 %345, label %389, label %346
346: ; preds = %327, %346
%347 = phi i64 [ %386, %346 ], [ 0, %327 ]
%348 = or i64 %347, 1
%349 = getelementptr inbounds double, double* %318, i64 %348
%350 = bitcast double* %349 to <2 x double>*
%351 = load <2 x double>, <2 x double>* %350
%352 = getelementptr inbounds double, double* %349, i64 2
%353 = bitcast double* %352 to <2 x double>*
%354 = load <2 x double>, <2 x double>* %353
%355 = getelementptr inbounds double, double* %322, i64 %348
%356 = bitcast double* %355 to <2 x double>*
%357 = load <2 x double>, <2 x double>* %356
%358 = getelementptr inbounds double, double* %355, i64 2
%359 = bitcast double* %358 to <2 x double>*
%360 = load <2 x double>, <2 x double>* %359
%361 = fadd <2 x double> %351, %357
%362 = fadd <2 x double> %354, %360
%363 = getelementptr inbounds double, double* %324, i64 %347
%364 = bitcast double* %363 to <2 x double>*
%365 = load <2 x double>, <2 x double>* %364
%366 = getelementptr inbounds double, double* %363, i64 2
%367 = bitcast double* %366 to <2 x double>*
%368 = load <2 x double>, <2 x double>* %367
%369 = fadd <2 x double> %361, %365
%370 = fadd <2 x double> %362, %368
%371 = or i64 %347, 2
%372 = getelementptr inbounds double, double* %324, i64 %371
%373 = bitcast double* %372 to <2 x double>*
%374 = load <2 x double>, <2 x double>* %373
%375 = getelementptr inbounds double, double* %372, i64 2
%376 = bitcast double* %375 to <2 x double>*
%377 = load <2 x double>, <2 x double>* %376
%378 = fadd <2 x double> %369, %374
%379 = fadd <2 x double> %370, %377
%380 = fmul <2 x double> %378, <double 2.500000e-01, double 2.500000e-01>
%381 = fmul <2 x double> %379, <double 2.500000e-01, double 2.500000e-01>
%382 = getelementptr inbounds double, double* %326, i64 %348
%383 = bitcast double* %382 to <2 x double>*
store <2 x double> %380, <2 x double>* %383
%384 = getelementptr inbounds double, double* %382, i64 2
%385 = bitcast double* %384 to <2 x double>*
store <2 x double> %381, <2 x double>* %385
%386 = add nuw i64 %347, 4
%387 = icmp eq i64 %386, %111
br i1 %387, label %388, label %346
388: ; preds = %346
br i1 %113, label %414, label %389
389: ; preds = %327, %314, %388
%390 = phi i64 [ 1, %327 ], [ 1, %314 ], [ %112, %388 ]
%391 = xor i64 %390, -1
br i1 %115, label %392, label %408
392: ; preds = %389
%393 = getelementptr inbounds double, double* %318, i64 %390
%394 = load double, double* %393
%395 = getelementptr inbounds double, double* %322, i64 %390
%396 = load double, double* %395
%397 = fadd double %394, %396
%398 = add nsw i64 %390, -1
%399 = getelementptr inbounds double, double* %324, i64 %398
%400 = load double, double* %399
%401 = fadd double %397, %400
%402 = add nuw nsw i64 %390, 1
%403 = getelementptr inbounds double, double* %324, i64 %402
%404 = load double, double* %403
%405 = fadd double %401, %404
%406 = fmul double %405, 2.500000e-01
%407 = getelementptr inbounds double, double* %326, i64 %390
store double %406, double* %407
br label %408
408: ; preds = %392, %389
%409 = phi i64 [ %390, %389 ], [ %402, %392 ]
%410 = icmp eq i64 %391, %116
br i1 %410, label %414, label %416
411: ; preds = %414, %162, %182
%412 = add nuw nsw i32 %163, 1
%413 = icmp eq i32 %412, %13
br i1 %413, label %164, label %162
414: ; preds = %408, %416, %388
%415 = icmp eq i64 %319, %98
br i1 %415, label %411, label %314
416: ; preds = %408, %416
%417 = phi i64 [ %441, %416 ], [ %409, %408 ]
%418 = getelementptr inbounds double, double* %318, i64 %417
%419 = load double, double* %418
%420 = getelementptr inbounds double, double* %322, i64 %417
%421 = load double, double* %420
%422 = fadd double %419, %421
%423 = add nsw i64 %417, -1
%424 = getelementptr inbounds double, double* %324, i64 %423
%425 = load double, double* %424
%426 = fadd double %422, %425
%427 = add nuw nsw i64 %417, 1
%428 = getelementptr inbounds double, double* %324, i64 %427
%429 = load double, double* %428
%430 = fadd double %426, %429
%431 = fmul double %430, 2.500000e-01
%432 = getelementptr inbounds double, double* %326, i64 %417
store double %431, double* %432
%433 = getelementptr inbounds double, double* %318, i64 %427
%434 = load double, double* %433
%435 = getelementptr inbounds double, double* %322, i64 %427
%436 = load double, double* %435
%437 = fadd double %434, %436
%438 = getelementptr inbounds double, double* %324, i64 %417
%439 = load double, double* %438
%440 = fadd double %437, %439
%441 = add nuw nsw i64 %417, 2
%442 = getelementptr inbounds double, double* %324, i64 %441
%443 = load double, double* %442
%444 = fadd double %440, %443
%445 = fmul double %444, 2.500000e-01
%446 = getelementptr inbounds double, double* %326, i64 %427
store double %445, double* %446
%447 = icmp eq i64 %441, %98
br i1 %447, label %414, label %416
}