#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 */
struct timeval {
  double tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double **allocate2d(int, int);
int atoi(char *);
int /*<<< orphan*/ black(double **, double **, int, int, int, int, double);
double *calloc(int, int);
int converge(double **, double **, int, int, int, int);
int /*<<< orphan*/ copy2d(double **, double **, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprint2d(char *, double **, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ init2d(double **, int, int);
int omp_get_thread_num();
int /*<<< orphan*/ omp_set_num_threads(int);
int /*<<< orphan*/ printf(char *, int, double, double);
int /*<<< orphan*/ red(double **, double **, int, int, int, int, double);
int sin(double);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int global[2], local[2];
  int global_padded[2];
  int grid[2];
  double time = 0;
  struct timeval tts, ttf;
  double **u_current, **u_previous, **swap;
  double omega;
  if (argc != 5) {
    fprintf(stderr, "Usage: ./execname X Y Px Py\n");
    exit(-1);
  } else {
    global[0] = atoi(argv[1]);
    global[1] = atoi(argv[2]);
    grid[0] = atoi(argv[3]);
    grid[1] = atoi(argv[4]);
  }
  omega = 2.0 / (1 + sin(3.14 / global[0]));
  int i;
  for (i = 0; i < 2; i++) {
    if (global[i] % grid[i] == 0) {
      local[i] = global[i] / grid[i];
      global_padded[i] = global[i];
    } else {
      local[i] = (global[i] / grid[i]) + 1;
      global_padded[i] = local[i] * grid[i];
    }
  }
  u_previous = allocate2d(global_padded[0], global_padded[1]);
  init2d(u_previous, global[0], global[1]);
  u_current = allocate2d(global_padded[0], global_padded[1]);
  copy2d(u_current, u_previous, global[0], global[1]);
  int nthreads = grid[0] * grid[1];
  omp_set_num_threads(nthreads);
  int converged = 0;
  int globalConv = 0;
  int iters = 0;
  double compTime = 0;
  double *comps = calloc(nthreads, sizeof(double));
#pragma omp parallel
  {
    int tid = omp_get_thread_num();
    int i, j, endi, endj;
    int conv = 0;
    struct timeval tcs, tcf;
    i = (global_padded[0] / grid[0]) * (tid % grid[0]);
    j = (global_padded[1] / grid[1]) * (tid / grid[0]);
    endi = ((i + local[0]) < global[0]) ? i + local[0] : (global[0] - 1);
    endj = ((j + local[1]) < global[1]) ? j + local[1] : (global[1] - 1);
    i += (i == 0);
    j += (j == 0);
    while (!globalConv) {
#pragma omp single
      {
        ++iters;
        gettimeofday(&tts, NULL);
      }
      gettimeofday(&tcs, NULL);
      red(u_previous, u_current, i, endi, j, endj, omega);
      black(u_previous, u_current, i, endi, j, endj, omega);
      gettimeofday(&tcf, NULL);
      comps[tid] +=
          (tcf.tv_sec - tcs.tv_sec) + (tcf.tv_usec - tcs.tv_usec) * 0.000001;
      conv = converge(u_previous, u_current, i, endi, j, endj);
#pragma omp atomic
      converged += conv;
#pragma omp barrier
      if ((iters % 100 == 0) && (tid == 0)) {
        if (converged == nthreads) {
          globalConv = 1;
        }
      }
#pragma omp single
      {
        converged = 0;
        swap = u_previous;
        u_previous = u_current;
        u_current = swap;
        gettimeofday(&ttf, NULL);
        time +=
            (ttf.tv_sec - tts.tv_sec) + (ttf.tv_usec - tts.tv_usec) * 0.000001;
      }
    }
  }
  for (i = 0; i < nthreads; ++i)
    compTime = (compTime >= comps[i]) ? compTime : comps[i];
  printf("RedBlackSOR\tIters: %d Time: %.3lf \t Computation: %.3lf\n", iters,
         time, compTime);
  fprint2d("testredblack.out", u_current, global[0], global[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     124a <main+0x4a>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xddd(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  0xd71(%rip),%xmm0
divsd  %xmm1,%xmm0
call   10b0 <sin@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xd51(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x2,-0x7c(%rbp)
jge    135d <main+0x15d>
movslq -0x7c(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%eax
movslq -0x7c(%rbp),%rcx
cltd
idivl  -0x30(%rbp,%rcx,4)
cmp    $0x0,%edx
jne    1313 <main+0x113>
movslq -0x7c(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%eax
movslq -0x7c(%rbp),%rcx
cltd
idivl  -0x30(%rbp,%rcx,4)
mov    %eax,%ecx
movslq -0x7c(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0x7c(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%ecx
movslq -0x7c(%rbp),%rax
mov    %ecx,-0x28(%rbp,%rax,4)
jmp    134a <main+0x14a>
movslq -0x7c(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%eax
movslq -0x7c(%rbp),%rcx
cltd
idivl  -0x30(%rbp,%rcx,4)
mov    %eax,%ecx
add    $0x1,%ecx
movslq -0x7c(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0x7c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x7c(%rbp),%rax
imul   -0x30(%rbp,%rax,4),%ecx
movslq -0x7c(%rbp),%rax
mov    %ecx,-0x28(%rbp,%rax,4)
jmp    134f <main+0x14f>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12bf <main+0xbf>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1080 <allocate2d@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10c0 <init2d@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1080 <allocate2d@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   10e0 <copy2d@plt>
mov    -0x30(%rbp),%eax
imul   -0x2c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%edi
call   10f0 <omp_set_num_threads@plt>
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x80(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0xa0(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0xa4(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0x28(%rbp),%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,-0xe0(%rbp)
mov    -0xa4(%rbp),%eax
cltd
idivl  -0x30(%rbp)
mov    -0xe0(%rbp),%eax
imul   %edx,%eax
mov    %eax,-0xa8(%rbp)
mov    -0x24(%rbp),%eax
cltd
idivl  -0x2c(%rbp)
mov    %eax,-0xdc(%rbp)
mov    -0xa4(%rbp),%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,%ecx
mov    -0xdc(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xac(%rbp)
mov    -0xa8(%rbp),%eax
add    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1477 <main+0x277>
mov    -0xa8(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0xe4(%rbp)
jmp    1483 <main+0x283>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0xac(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14b5 <main+0x2b5>
mov    -0xac(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0xe8(%rbp)
jmp    14c1 <main+0x2c1>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xe8(%rbp)
mov    -0xe8(%rbp),%eax
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xa8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    -0xa8(%rbp),%eax
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xac(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    -0xac(%rbp),%eax
mov    %eax,-0xac(%rbp)
cmpl   $0x0,-0x88(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    151c <main+0x31c>
jmp    16e1 <main+0x4e1>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
lea    -0xc8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0xa8(%rbp),%edx
mov    -0xb0(%rbp),%ecx
mov    -0xac(%rbp),%r8d
mov    -0xb4(%rbp),%r9d
movsd  -0x78(%rbp),%xmm0
call   1040 <red@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0xa8(%rbp),%edx
mov    -0xb0(%rbp),%ecx
mov    -0xac(%rbp),%r8d
mov    -0xb4(%rbp),%r9d
movsd  -0x78(%rbp),%xmm0
call   1070 <black@plt>
lea    -0xd8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0xd0(%rbp),%rax
sub    -0xc0(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
subsd  -0xc8(%rbp),%xmm0
ff
movsd  0xa35(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0xa0(%rbp),%rax
movslq -0xa4(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0xa8(%rbp),%edx
mov    -0xb0(%rbp),%ecx
mov    -0xac(%rbp),%r8d
mov    -0xb4(%rbp),%r9d
call   10d0 <converge@plt>
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
add    -0x84(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x8c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    167c <main+0x47c>
cmpl   $0x0,-0xa4(%rbp)
jne    167c <main+0x47c>
mov    -0x84(%rbp),%eax
cmp    -0x80(%rbp),%eax
jne    1677 <main+0x477>
movl   $0x1,-0x88(%rbp)
jmp    167c <main+0x47c>
movl   $0x0,-0x84(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x50(%rbp),%rax
sub    -0x40(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  -0x58(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  0x946(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1503 <main+0x303>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    175d <main+0x55d>
movsd  -0x98(%rbp),%xmm0
ff
mov    -0xa0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jb     1727 <main+0x527>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    173f <main+0x53f>
mov    -0xa0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    16e8 <main+0x4e8>
mov    -0x8c(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
movsd  -0x98(%rbp),%xmm1
ff
lea    0x8be(%rip),%rdi
call   1050 <printf@plt>
mov    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0x8e0(%rip),%rdi
call   1100 <fprint2d@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
cmp    $0x5,%edi
jne    16de <main+0x4de>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1110 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%r15d
mov    0x20(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%ebx
cvtsi2sd %ebp,%xmm1
movsd  0xda9(%rip),%xmm0
divsd  %xmm1,%xmm0
call   10b0 <sin@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
mov    %r15d,0xc(%rsp)
idiv   %r15d
add    $0x1,%ecx
lea    0x1(%rax),%esi
mov    %esi,%r13d
imul   %r15d,%r13d
test   %edx,%edx
cmove  %ebp,%r13d
mov    %rbp,%r15
mov    %rbp,0x10(%rsp)
cmove  %eax,%esi
mov    %esi,0x38(%rsp)
mov    %r14,%rsi
mov    %esi,%eax
cltd
mov    %ebx,0x8(%rsp)
idiv   %ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
lea    0x1(%rax),%r12d
mov    %r12d,%r14d
imul   %ebx,%r14d
test   %edx,%edx
cmove  %esi,%r14d
mov    %rsi,%rbx
cmove  %eax,%r12d
movsd  0xd46(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x60(%rsp)
mov    %r13d,%edi
mov    %r14d,%esi
call   1080 <allocate2d@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %rbx,%r15
mov    %rbx,0x28(%rsp)
call   10c0 <init2d@plt>
mov    %r13d,%edi
mov    %r14d,%esi
call   1080 <allocate2d@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,0x58(%rsp)
mov    %rbp,%rsi
mov    0x10(%rsp),%rdx
mov    %r15d,%ecx
call   10e0 <copy2d@plt>
mov    0x8(%rsp),%r15d
mov    0xc(%rsp),%ebp
imul   %ebp,%r15d
mov    %r15d,%edi
call   10f0 <omp_set_num_threads@plt>
mov    %r15d,0x24(%rsp)
mov    %r15d,%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,0x30(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%edi
mov    %r13d,%eax
cltd
mov    %ebp,%esi
idiv   %ebp
mov    %eax,%ecx
mov    %edi,%eax
cltd
idiv   %ebp
mov    %eax,%r8d
mov    %edx,%esi
imul   %ecx,%esi
mov    %r14d,%eax
cltd
idivl  0x8(%rsp)
imul   %r8d,%eax
mov    0x38(%rsp),%ebp
add    %esi,%ebp
mov    0x10(%rsp),%rdx
lea    -0x1(%rdx),%ecx
cmp    %edx,%ebp
cmovl  %ebp,%ecx
mov    %ecx,0x4c(%rsp)
add    %eax,%r12d
mov    0x28(%rsp),%rdx
lea    -0x1(%rdx),%ecx
cmp    %edx,%r12d
cmovl  %r12d,%ecx
mov    %ecx,0x48(%rsp)
cmp    $0x1,%esi
adc    $0x0,%esi
mov    %esi,0x54(%rsp)
cmp    $0x1,%eax
adc    $0x0,%eax
mov    %eax,0x50(%rsp)
mov    %edi,0x44(%rsp)
movslq %edi,%rax
mov    %rax,0x68(%rsp)
xorpd  %xmm0,%xmm0
mov    $0x1,%eax
mov    0x4c(%rsp),%r14d
mov    0x50(%rsp),%ebp
mov    0x48(%rsp),%r15d
nopl   0x0(%rax,%rax,1)
mov    %eax,0x8(%rsp)
movsd  %xmm0,0x38(%rsp)
mov    0x18(%rsp),%r13
mov    %r13d,%ecx
mov    %rcx,0x70(%rsp)
mov    0x58(%rsp),%r13
mov    %rbx,%r12
mov    0x8(%rsp),%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
add    $0xffffffff,%eax
mov    %eax,0xc(%rsp)
lea    0x1(%rcx),%eax
mov    %rax,0x18(%rsp)
lea    0xa8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
lea    0x88(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    0x54(%rsp),%ebx
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    %r15d,%r9d
movsd  0x60(%rsp),%xmm0
call   1040 <red@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    %r15d,%r9d
movsd  0x60(%rsp),%xmm0
call   1070 <black@plt>
lea    0x78(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x80(%rsp),%rax
sub    0x90(%rsp),%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x78(%rsp),%xmm1
subsd  0x88(%rsp),%xmm1
movsd  0xb5b(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    0x30(%rsp),%rax
mov    0x68(%rsp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  %xmm1,(%rax,%rcx,8)
mov    %r13,%rdi
mov    %r12,0x58(%rsp)
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    %r15d,%r9d
call   10d0 <converge@plt>
mov    %eax,%r12d
lea    0x98(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
movsd  0x38(%rsp),%xmm0
mov    0xa0(%rsp),%rax
sub    0xb0(%rsp),%rax
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
mov    0x8(%rsp),%eax
add    $0x1,%eax
movsd  0x98(%rsp),%xmm1
subsd  0xa8(%rsp),%xmm1
mulsd  0xad3(%rip),%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    %r13,%rbx
mov    0x70(%rsp),%rcx
cmp    %ecx,0xc(%rsp)
jne    13e0 <main+0x1e0>
mov    %r13,%rbx
cmpl   $0x0,0x44(%rsp)
jne    13e0 <main+0x1e0>
mov    %r13,%rbx
cmp    0x24(%rsp),%r12d
jne    13e0 <main+0x1e0>
mov    0x24(%rsp),%eax
test   %eax,%eax
jle    15ab <main+0x3ab>
mov    %eax,%ecx
lea    -0x1(%rcx),%rdx
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%rdx
jae    15c3 <main+0x3c3>
xorpd  %xmm5,%xmm5
xor    %edx,%edx
mov    0x10(%rsp),%rbx
mov    0x28(%rsp),%rbp
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdi
jmp    1668 <main+0x468>
xorpd  %xmm1,%xmm1
mov    0x10(%rsp),%rbx
mov    0x28(%rsp),%rbp
mov    0x18(%rsp),%rsi
jmp    16ab <main+0x4ab>
and    $0xfffffffc,%ecx
xorpd  %xmm5,%xmm5
xor    %edx,%edx
mov    0x10(%rsp),%rbx
mov    0x28(%rsp),%rbp
mov    0x18(%rsp),%rsi
mov    0x30(%rsp),%rdi
movsd  (%rdi,%rdx,8),%xmm1
movsd  0x8(%rdi,%rdx,8),%xmm2
movapd %xmm1,%xmm3
cmplesd %xmm5,%xmm3
movapd %xmm3,%xmm4
andnpd %xmm1,%xmm4
andpd  %xmm5,%xmm3
orpd   %xmm4,%xmm3
movapd %xmm2,%xmm4
cmplesd %xmm3,%xmm4
movapd %xmm4,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm4
orpd   %xmm1,%xmm4
movsd  0x10(%rdi,%rdx,8),%xmm1
movapd %xmm1,%xmm2
cmplesd %xmm4,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm4,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movsd  0x18(%rdi,%rdx,8),%xmm1
movapd %xmm1,%xmm5
cmplesd %xmm2,%xmm5
movapd %xmm5,%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm1,%xmm5
orpd   %xmm3,%xmm5
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    15e0 <main+0x3e0>
movapd %xmm5,%xmm1
test   %rax,%rax
je     16ab <main+0x4ab>
lea    (%rdi,%rdx,8),%rcx
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movsd  (%rcx,%rdx,8),%xmm2
movapd %xmm2,%xmm1
cmplesd %xmm5,%xmm1
movapd %xmm1,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm5,%xmm1
orpd   %xmm3,%xmm1
add    $0x1,%rdx
movapd %xmm1,%xmm5
cmp    %rdx,%rax
jne    1680 <main+0x480>
lea    0x983(%rip),%rdi
call   1050 <printf@plt>
lea    0x9af(%rip),%rdi
mov    %r13,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1100 <fprint2d@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x28fb(%rip),%rax
mov    (%rax),%edi
lea    0x92a(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>

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

LLVM IR (-O2):
%struct.timeval = type { double, i64 }
@stderr = global i32 0
@.str = [29 x i8] c"Usage: ./execname X Y Px Py\0A\00"
@.str.1 = [56 x i8] c"RedBlackSOR\09Iters: %d Time: %.3lf \09 Computation: %.3lf\0A\00"
@.str.2 = [17 x i8] c"testredblack.out\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = alloca %struct.timeval
%7 = bitcast %struct.timeval* %3 to i8*
%8 = bitcast %struct.timeval* %4 to i8*
%9 = icmp eq i32 %0, 5
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = getelementptr inbounds i8*, i8** %1, i64 4
%25 = load i8*, i8** %24
%26 = tail call i32 @atoi(i8* %25)
%27 = sitofp i32 %17 to double
%28 = fdiv double 3.140000e+00, %27
%29 = tail call i32 @sin(double %28)
%30 = add nsw i32 %29, 1
%31 = sitofp i32 %30 to double
%32 = srem i32 %17, %23
%33 = icmp eq i32 %32, 0
%34 = sdiv i32 %17, %23
%35 = add nsw i32 %34, 1
%36 = mul nsw i32 %35, %23
%37 = select i1 %33, i32 %17, i32 %36
%38 = select i1 %33, i32 %34, i32 %35
%39 = srem i32 %20, %26
%40 = icmp eq i32 %39, 0
%41 = sdiv i32 %20, %26
%42 = add nsw i32 %41, 1
%43 = mul nsw i32 %42, %26
%44 = select i1 %40, i32 %20, i32 %43
%45 = select i1 %40, i32 %41, i32 %42
%46 = fdiv double 2.000000e+00, %31
%47 = tail call double** @allocate2d(i32 %37, i32 %44)
%48 = tail call i32 @init2d(double** %47, i32 %17, i32 %20)
%49 = tail call double** @allocate2d(i32 %37, i32 %44)
%50 = tail call i32 @copy2d(double** %49, double** %47, i32 %17, i32 %20)
%51 = mul nsw i32 %26, %23
%52 = tail call i32 @omp_set_num_threads(i32 %51)
%53 = tail call double* @calloc(i32 %51, i32 8)
%54 = tail call i32 (...) @omp_get_thread_num()
%55 = bitcast %struct.timeval* %5 to i8*
%56 = bitcast %struct.timeval* %6 to i8*
%57 = sdiv i32 %37, %23
%58 = srem i32 %54, %23
%59 = mul nsw i32 %58, %57
%60 = sdiv i32 %44, %26
%61 = sdiv i32 %54, %23
%62 = mul nsw i32 %61, %60
%63 = add nsw i32 %38, %59
%64 = icmp slt i32 %63, %17
%65 = add nsw i32 %17, -1
%66 = select i1 %64, i32 %63, i32 %65
%67 = add nsw i32 %45, %62
%68 = icmp slt i32 %67, %20
%69 = add nsw i32 %20, -1
%70 = select i1 %68, i32 %67, i32 %69
%71 = icmp eq i32 %59, 0
%72 = zext i1 %71 to i32
%73 = add nsw i32 %59, %72
%74 = icmp eq i32 %62, 0
%75 = zext i1 %74 to i32
%76 = add nsw i32 %62, %75
%77 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%78 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%79 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%80 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%81 = sext i32 %54 to i64
%82 = getelementptr inbounds double, double* %53, i64 %81
%83 = icmp ne i32 %54, 0
%84 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%85 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%86 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%87 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
br label %88
88: ; preds = %14, %88
%89 = phi double [ 0.000000e+00, %14 ], [ %124, %88 ]
%90 = phi double** [ %49, %14 ], [ %91, %88 ]
%91 = phi double** [ %47, %14 ], [ %90, %88 ]
%92 = phi i32 [ 0, %14 ], [ %93, %88 ]
%93 = add nuw nsw i32 %92, 1
%94 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%95 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%96 = tail call i32 @red(double** %91, double** %90, i32 %73, i32 %66, i32 %76, i32 %70, double %46)
%97 = tail call i32 @black(double** %91, double** %90, i32 %73, i32 %66, i32 %76, i32 %70, double %46)
%98 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%99 = load i64, i64* %77
%100 = load i64, i64* %78
%101 = sub nsw i64 %99, %100
%102 = sitofp i64 %101 to double
%103 = load double, double* %79
%104 = load double, double* %80
%105 = fsub double %103, %104
%106 = tail call double @llvm.fmuladd.f64(double %105, double 0x3EB0C6F7A0B5ED8D, double %102)
%107 = load double, double* %82
%108 = fadd double %107, %106
store double %108, double* %82
%109 = tail call i32 @converge(double** %91, double** %90, i32 %73, i32 %66, i32 %76, i32 %70)
%110 = urem i32 %93, 100
%111 = icmp ne i32 %110, 0
%112 = select i1 %111, i1 true, i1 %83
%113 = icmp ne i32 %109, %51
%114 = select i1 %112, i1 true, i1 %113
%115 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%116 = load i64, i64* %84
%117 = load i64, i64* %85
%118 = sub nsw i64 %116, %117
%119 = sitofp i64 %118 to double
%120 = load double, double* %86
%121 = load double, double* %87
%122 = fsub double %120, %121
%123 = tail call double @llvm.fmuladd.f64(double %122, double 0x3EB0C6F7A0B5ED8D, double %119)
%124 = fadd double %89, %123
br i1 %114, label %88, label %125
125: ; preds = %88
%126 = icmp sgt i32 %51, 0
br i1 %126, label %127, label %176
127: ; preds = %125
%128 = zext i32 %51 to i64
%129 = add nsw i64 %128, -1
%130 = and i64 %128, 3
%131 = icmp ult i64 %129, 3
br i1 %131, label %160, label %132
132: ; preds = %127
%133 = and i64 %128, 4294967292
br label %134
134: ; preds = %134, %132
%135 = phi i64 [ 0, %132 ], [ %157, %134 ]
%136 = phi double [ 0.000000e+00, %132 ], [ %156, %134 ]
%137 = phi i64 [ 0, %132 ], [ %158, %134 ]
%138 = getelementptr inbounds double, double* %53, i64 %135
%139 = load double, double* %138
%140 = fcmp oge double %136, %139
%141 = select i1 %140, double %136, double %139
%142 = or i64 %135, 1
%143 = getelementptr inbounds double, double* %53, i64 %142
%144 = load double, double* %143
%145 = fcmp oge double %141, %144
%146 = select i1 %145, double %141, double %144
%147 = or i64 %135, 2
%148 = getelementptr inbounds double, double* %53, i64 %147
%149 = load double, double* %148
%150 = fcmp oge double %146, %149
%151 = select i1 %150, double %146, double %149
%152 = or i64 %135, 3
%153 = getelementptr inbounds double, double* %53, i64 %152
%154 = load double, double* %153
%155 = fcmp oge double %151, %154
%156 = select i1 %155, double %151, double %154
%157 = add nuw nsw i64 %135, 4
%158 = add i64 %137, 4
%159 = icmp eq i64 %158, %133
br i1 %159, label %160, label %134
160: ; preds = %134, %127
%161 = phi double [ undef, %127 ], [ %156, %134 ]
%162 = phi i64 [ 0, %127 ], [ %157, %134 ]
%163 = phi double [ 0.000000e+00, %127 ], [ %156, %134 ]
%164 = icmp eq i64 %130, 0
br i1 %164, label %176, label %165
165: ; preds = %160, %165
%166 = phi i64 [ %173, %165 ], [ %162, %160 ]
%167 = phi double [ %172, %165 ], [ %163, %160 ]
%168 = phi i64 [ %174, %165 ], [ 0, %160 ]
%169 = getelementptr inbounds double, double* %53, i64 %166
%170 = load double, double* %169
%171 = fcmp oge double %167, %170
%172 = select i1 %171, double %167, double %170
%173 = add nuw nsw i64 %166, 1
%174 = add i64 %168, 1
%175 = icmp eq i64 %174, %130
br i1 %175, label %176, label %165
176: ; preds = %160, %165, %125
%177 = phi double [ 0.000000e+00, %125 ], [ %161, %160 ], [ %172, %165 ]
%178 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 %93, double %124, double %177)
%179 = tail call i32 @fprint2d(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double** %91, i32 %17, i32 %20)
ret i32 0
}