#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 /*<<< orphan*/ boundaryvalues(int, int, double **, double **);
int /*<<< orphan*/ calculate_dt(double, double, double *, double, double, int,
                                int, double **, double **);
int /*<<< orphan*/ calculate_fg(double, double, double, double, double, double,
                                double, int, int, double **, double **,
                                double **, double **);
int /*<<< orphan*/ calculate_rs(double, double, double, int, int, double **,
                                double **, double **);
int /*<<< orphan*/ calculate_uv(double, double, double, int, int, double **,
                                double **, double **, double **, double **);
int /*<<< orphan*/ free_matrix(double **, int /*<<< orphan*/, int,
                               int /*<<< orphan*/, int);
int /*<<< orphan*/ init_uvp(double, double, double, int, int, double ***,
                            double ***, double ***);
double **matrix(int /*<<< orphan*/, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int read_parameters(char const *, double *, double *, double *, double *,
                    double *, double *, double *, double *, double *, double *,
                    double *, double *, int *, int *, double *, double *,
                    double *, int *, double *, double *);
int /*<<< orphan*/ sor(double, double, double, int, int, double **, double **,
                       double *);
int main(int argn, char **args) {
  const char *szFileName = "cavity100.dat";
  int readParamError = 0;
  double xlength = 0;
  double ylength = 0;
  int imax = 0;
  int jmax = 0;
  double dx = 0;
  double dy = 0;
  double t = 0;
  double t_end = 0;
  double dt = 0;
  double tau = 0;
  double dt_value = 0;
  int n = 0;
  int itermax = 0;
  int it = 0;
  double res = 0;
  double eps = 0;
  double omg = 0;
  double alpha = 0;
  double Re = 0;
  double GX = 0;
  double GY = 0;
  double UI = 0;
  double VI = 0;
  double PI = 0;
  double **U = 0;
  double **V = 0;
  double **P = 0;
  double **RS = 0;
  double **F = 0;
  double **G = 0;
  readParamError = read_parameters(
      szFileName, &Re, &UI, &VI, &PI, &GX, &GY, &t_end, &xlength, &ylength, &dt,
      &dx, &dy, &imax, &jmax, &alpha, &omg, &tau, &itermax, &eps, &dt_value);
  if (readParamError != 1) {
    printf("ERROR: Input parameters potentially corrupt!");
    return 0;
  }
  init_uvp(UI, VI, PI, imax, jmax, &U, &V, &P);
  RS = matrix(0, imax + 1, 0, jmax + 1);
  F = matrix(0, imax + 1, 0, jmax + 1);
  G = matrix(0, imax + 1, 0, jmax + 1);
  while (t < t_end) {
    calculate_dt(Re, tau, &dt, dx, dy, imax, jmax, U, V);
    boundaryvalues(imax, jmax, U, V);
    calculate_fg(Re, GX, GY, alpha, dt, dx, dy, imax, jmax, U, V, F, G);
    calculate_rs(dt, dx, dy, imax, jmax, F, G, RS);
    it = 0;
    do {
      sor(omg, dx, dy, imax, jmax, P, RS, &res);
      it++;
    } while (it < itermax && res > eps);
    printf("res=%f, it=%u ", res, it);
    calculate_uv(dt, dx, dy, imax, jmax, U, V, F, G, P);
    n++;
    t += dt;
  }
  printf("End of simulation...hooray! \n");
  free_matrix(U, 0, imax + 1, 0, jmax + 1);
  free_matrix(V, 0, imax + 1, 0, jmax + 1);
  free_matrix(P, 0, imax + 1, 0, jmax + 1);
  free_matrix(RS, 0, imax + 1, 0, jmax + 1);
  free_matrix(F, 0, imax + 1, 0, jmax + 1);
  free_matrix(G, 0, imax + 1, 0, jmax + 1);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c8,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
lea    0xe27(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x0,-0x9c(%rbp)
movl   $0x0,-0xa0(%rbp)
movl   $0x0,-0xa4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movq   $0x0,-0x100(%rbp)
movq   $0x0,-0x108(%rbp)
movq   $0x0,-0x110(%rbp)
movq   $0x0,-0x118(%rbp)
movq   $0x0,-0x120(%rbp)
movq   $0x0,-0x128(%rbp)
mov    -0x40(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0xe8(%rbp),%rdx
lea    -0xf0(%rbp),%rcx
lea    -0xf8(%rbp),%r8
lea    -0xd8(%rbp),%r9
lea    -0xe0(%rbp),%rax
mov    %rax,-0x168(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x160(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x158(%rbp)
lea    -0x58(%rbp),%rax
mov    %rax,-0x150(%rbp)
lea    -0x88(%rbp),%rax
mov    %rax,-0x148(%rbp)
lea    -0x68(%rbp),%rax
mov    %rax,-0x140(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x138(%rbp)
lea    -0x5c(%rbp),%r13
lea    -0x60(%rbp),%r12
lea    -0xc8(%rbp),%r15
lea    -0xc0(%rbp),%r14
lea    -0x90(%rbp),%rbx
lea    -0xa0(%rbp),%r11
lea    -0xb8(%rbp),%r10
lea    -0x98(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x168(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x160(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x158(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x150(%rbp),%rax
mov    %rax,0x18(%rsp)
mov    -0x148(%rbp),%rax
mov    %rax,0x20(%rsp)
mov    -0x140(%rbp),%rax
mov    %rax,0x28(%rsp)
mov    -0x138(%rbp),%rax
mov    %rax,0x30(%rsp)
mov    -0x130(%rbp),%rax
mov    %r13,0x38(%rsp)
mov    %r12,0x40(%rsp)
mov    %r15,0x48(%rsp)
mov    %r14,0x50(%rsp)
mov    %rbx,0x58(%rsp)
mov    %r11,0x60(%rsp)
mov    %r10,0x68(%rsp)
mov    %rax,0x70(%rsp)
call   1070 <read_parameters@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x1,-0x44(%rbp)
je     1472 <main+0x2c2>
lea    0xbaf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x2c(%rbp)
jmp    17cb <main+0x61b>
movsd  -0xe8(%rbp),%xmm0
ff
movsd  -0xf0(%rbp),%xmm1
ff
movsd  -0xf8(%rbp),%xmm2
ff
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
lea    -0x100(%rbp),%rdx
lea    -0x108(%rbp),%rcx
lea    -0x110(%rbp),%r8
call   10d0 <init_uvp@plt>
mov    -0x5c(%rbp),%esi
add    $0x1,%esi
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
xor    %edx,%edx
mov    %edx,%edi
call   1090 <matrix@plt>
mov    %rax,-0x118(%rbp)
mov    -0x5c(%rbp),%esi
add    $0x1,%esi
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
xor    %edx,%edx
mov    %edx,%edi
call   1090 <matrix@plt>
mov    %rax,-0x120(%rbp)
mov    -0x5c(%rbp),%esi
add    $0x1,%esi
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
xor    %edx,%edx
mov    %edx,%edi
call   1090 <matrix@plt>
mov    %rax,-0x128(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1702 <main+0x552>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
mov    -0x5c(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x100(%rbp),%rcx
mov    -0x108(%rbp),%r8
lea    -0x88(%rbp),%rdi
call   10c0 <calculate_dt@plt>
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
mov    -0x100(%rbp),%rdx
mov    -0x108(%rbp),%rcx
call   1050 <boundaryvalues@plt>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm2
ff
movsd  -0xc8(%rbp),%xmm3
ff
movsd  -0x88(%rbp),%xmm4
ff
movsd  -0x68(%rbp),%xmm5
movsd  -0x70(%rbp),%xmm6
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
mov    -0x100(%rbp),%rdx
mov    -0x108(%rbp),%rcx
mov    -0x120(%rbp),%r8
mov    -0x128(%rbp),%r9
call   10a0 <calculate_fg@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
mov    -0x120(%rbp),%rdx
mov    -0x128(%rbp),%rcx
mov    -0x118(%rbp),%r8
call   1030 <calculate_rs@plt>
movl   $0x0,-0xa4(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
mov    -0x110(%rbp),%rdx
mov    -0x118(%rbp),%rcx
lea    -0xb0(%rbp),%r8
call   10b0 <sor@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%ecx
xor    %eax,%eax
cmp    -0xa0(%rbp),%ecx
mov    %al,-0x169(%rbp)
jge    166e <main+0x4be>
movsd  -0xb0(%rbp),%xmm0
ff
ucomisd -0xb8(%rbp),%xmm0
ff
seta   %al
mov    %al,-0x169(%rbp)
mov    -0x169(%rbp),%al
test   $0x1,%al
jne    15fa <main+0x44a>
movsd  -0xb0(%rbp),%xmm0
ff
mov    -0xa4(%rbp),%esi
lea    0x9aa(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
mov    -0x100(%rbp),%rdx
mov    -0x108(%rbp),%rcx
mov    -0x120(%rbp),%r8
mov    -0x128(%rbp),%r9
mov    -0x110(%rbp),%rax
mov    %rax,(%rsp)
call   1080 <calculate_uv@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    14fe <main+0x34e>
lea    0x941(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x100(%rbp),%rdi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%r8d
add    $0x1,%r8d
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <free_matrix@plt>
mov    -0x108(%rbp),%rdi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%r8d
add    $0x1,%r8d
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <free_matrix@plt>
mov    -0x110(%rbp),%rdi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%r8d
add    $0x1,%r8d
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <free_matrix@plt>
mov    -0x118(%rbp),%rdi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%r8d
add    $0x1,%r8d
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <free_matrix@plt>
mov    -0x120(%rbp),%rdi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%r8d
add    $0x1,%r8d
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <free_matrix@plt>
mov    -0x128(%rbp),%rdi
mov    -0x5c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%r8d
add    $0x1,%r8d
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <free_matrix@plt>
movl   $0xffffffff,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1c8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
movq   $0x0,0xc0(%rsp)
movq   $0x0,0xb8(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movq   $0x0,0x30(%rsp)
movq   $0x0,0x28(%rsp)
movq   $0x0,0x50(%rsp)
movq   $0x0,0x20(%rsp)
movq   $0x0,0xa0(%rsp)
movq   $0x0,0xb0(%rsp)
movl   $0x0,0x3c(%rsp)
movq   $0x0,0x98(%rsp)
movq   $0x0,0x90(%rsp)
movq   $0x0,0x88(%rsp)
movq   $0x0,0x80(%rsp)
movq   $0x0,0x48(%rsp)
movq   $0x0,0x78(%rsp)
movq   $0x0,0x70(%rsp)
movq   $0x0,0x68(%rsp)
movq   $0x0,0x60(%rsp)
movq   $0x0,0x58(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x40(%rsp)
sub    $0x8,%rsp
lea    0xb8(%rsp),%rax
lea    0x98(%rsp),%r10
lea    0x44(%rsp),%r11
lea    0xa8(%rsp),%rbx
lea    0x90(%rsp),%r14
lea    0x88(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0x14(%rsp),%rbp
lea    0x30(%rsp),%r13
lea    0xcfb(%rip),%rdi
lea    0x50(%rsp),%rsi
lea    0x70(%rsp),%rdx
lea    0x68(%rsp),%rcx
lea    0x60(%rsp),%r8
lea    0x80(%rsp),%r9
push   %rax
push   %r10
push   %r11
push   %rbx
push   %r14
push   %r15
push   %r12
push   %rbp
push   %r13
lea    0x80(%rsp),%rax
push   %rax
lea    0x78(%rsp),%rax
push   %rax
lea    0x118(%rsp),%rax
push   %rax
lea    0x128(%rsp),%rax
push   %rax
lea    0xc0(%rsp),%rax
push   %rax
lea    0xe8(%rsp),%rax
push   %rax
call   1080 <read_parameters@plt>
add    $0x80,%rsp
cmp    $0x1,%eax
jne    15b5 <main+0x3f5>
movsd  0x68(%rsp),%xmm0
movsd  0x60(%rsp),%xmm1
movsd  0x58(%rsp),%xmm2
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x40(%rsp),%r8
call   10e0 <init_uvp@plt>
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    0x8(%rsp),%ecx
add    $0x1,%ecx
xor    %edi,%edi
xor    %edx,%edx
call   10a0 <matrix@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    0x8(%rsp),%ecx
add    $0x1,%ecx
xor    %edi,%edi
xor    %edx,%edx
call   10a0 <matrix@plt>
mov    %rax,%r14
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    0x8(%rsp),%ecx
add    $0x1,%ecx
xor    %edi,%edi
xor    %edx,%edx
call   10a0 <matrix@plt>
mov    %rax,%r15
movsd  0x50(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15ca <main+0x40a>
lea    0x98(%rsp),%r13
lea    0xc24(%rip),%rbp
jmp    1487 <main+0x2c7>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r12d,%esi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
sub    $0x8,%rsp
mov    %r14,%r8
mov    %r15,%r9
push   0x48(%rsp)
call   1090 <calculate_uv@plt>
add    $0x10,%rsp
movsd  0xa8(%rsp),%xmm1
addsd  0x20(%rsp),%xmm1
movsd  0x50(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jbe    15ca <main+0x40a>
movsd  %xmm1,0xa8(%rsp)
movsd  0x48(%rsp),%xmm0
movsd  0xa0(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x18(%rsp),%rcx
mov    0x10(%rsp),%r8
lea    0x20(%rsp),%rdi
call   10d0 <calculate_dt@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
call   1060 <boundaryvalues@plt>
movsd  0x48(%rsp),%xmm0
movsd  0x78(%rsp),%xmm1
movsd  0x70(%rsp),%xmm2
movsd  0x80(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x28(%rsp),%xmm6
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    %r14,%r8
mov    %r15,%r9
call   10b0 <calculate_fg@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1040 <calculate_rs@plt>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x88(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x40(%rsp),%rdx
mov    %rbx,%rcx
mov    %r13,%r8
call   10c0 <sor@plt>
add    $0x1,%r12d
movsd  0x98(%rsp),%xmm0
cmp    0x3c(%rsp),%r12d
jge    1420 <main+0x260>
ucomisd 0x90(%rsp),%xmm0
ja     1560 <main+0x3a0>
jmp    1420 <main+0x260>
lea    0xa52(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1689 <main+0x4c9>
lea    0xa79(%rip),%rdi
call   1030 <puts@plt>
mov    0x18(%rsp),%rdi
mov    0xc(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%r8d
add    $0x1,%r8d
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <free_matrix@plt>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%r8d
add    $0x1,%r8d
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <free_matrix@plt>
mov    0x40(%rsp),%rdi
mov    0xc(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%r8d
add    $0x1,%r8d
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <free_matrix@plt>
mov    0xc(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%r8d
add    $0x1,%r8d
mov    %rbx,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <free_matrix@plt>
mov    0xc(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%r8d
add    $0x1,%r8d
mov    %r14,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <free_matrix@plt>
mov    0xc(%rsp),%edx
add    $0x1,%edx
mov    0x8(%rsp),%r8d
add    $0x1,%r8d
mov    %r15,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <free_matrix@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"cavity100.dat\00"
@.str.1 = [45 x i8] c"ERROR: Input parameters potentially corrupt!\00"
@.str.2 = [15 x i8] c"res=%f, it=%u \00"
@.str.3 = [30 x i8] c"End of simulation...hooray! \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double**
%33 = alloca double**
%34 = alloca double**
%35 = alloca double**
%36 = alloca double**
%37 = alloca double**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store i32 0, i32* %10
store i32 0, i32* %11
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %14
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %17
store double 0.000000e+00, double* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %27
store double 0.000000e+00, double* %28
store double 0.000000e+00, double* %29
store double 0.000000e+00, double* %30
store double 0.000000e+00, double* %31
store double** null, double*** %32
store double** null, double*** %33
store double** null, double*** %34
store double** null, double*** %35
store double** null, double*** %36
store double** null, double*** %37
%38 = load i8*, i8** %6
%39 = call i32 @read_parameters(i8* %38, double* %26, double* %29, double* %30, double* %31, double* %27, double* %28, double* %15, double* %8, double* %9, double* %16, double* %12, double* %13, i32* %10, i32* %11, double* %25, double* %24, double* %17, i32* %20, double* %23, double* %18)
store i32 %39, i32* %7
%40 = load i32, i32* %7
%41 = icmp ne i32 %40, 1
br i1 %41, label %42, label %44
42: ; preds = %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %187
44: ; preds = %2
%45 = load double, double* %29
%46 = load double, double* %30
%47 = load double, double* %31
%48 = load i32, i32* %10
%49 = load i32, i32* %11
%50 = call i32 @init_uvp(double %45, double %46, double %47, i32 %48, i32 %49, double*** %32, double*** %33, double*** %34)
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
%55 = call double** @matrix(i32 0, i32 %52, i32 0, i32 %54)
store double** %55, double*** %35
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
%58 = load i32, i32* %11
%59 = add nsw i32 %58, 1
%60 = call double** @matrix(i32 0, i32 %57, i32 0, i32 %59)
store double** %60, double*** %36
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
%63 = load i32, i32* %11
%64 = add nsw i32 %63, 1
%65 = call double** @matrix(i32 0, i32 %62, i32 0, i32 %64)
store double** %65, double*** %37
br label %66
66: ; preds = %129, %44
%67 = load double, double* %14
%68 = load double, double* %15
%69 = fcmp olt double %67, %68
br i1 %69, label %70, label %149
70: ; preds = %66
%71 = load double, double* %26
%72 = load double, double* %17
%73 = load double, double* %12
%74 = load double, double* %13
%75 = load i32, i32* %10
%76 = load i32, i32* %11
%77 = load double**, double*** %32
%78 = load double**, double*** %33
%79 = call i32 @calculate_dt(double %71, double %72, double* %16, double %73, double %74, i32 %75, i32 %76, double** %77, double** %78)
%80 = load i32, i32* %10
%81 = load i32, i32* %11
%82 = load double**, double*** %32
%83 = load double**, double*** %33
%84 = call i32 @boundaryvalues(i32 %80, i32 %81, double** %82, double** %83)
%85 = load double, double* %26
%86 = load double, double* %27
%87 = load double, double* %28
%88 = load double, double* %25
%89 = load double, double* %16
%90 = load double, double* %12
%91 = load double, double* %13
%92 = load i32, i32* %10
%93 = load i32, i32* %11
%94 = load double**, double*** %32
%95 = load double**, double*** %33
%96 = load double**, double*** %36
%97 = load double**, double*** %37
%98 = call i32 @calculate_fg(double %85, double %86, double %87, double %88, double %89, double %90, double %91, i32 %92, i32 %93, double** %94, double** %95, double** %96, double** %97)
%99 = load double, double* %16
%100 = load double, double* %12
%101 = load double, double* %13
%102 = load i32, i32* %10
%103 = load i32, i32* %11
%104 = load double**, double*** %36
%105 = load double**, double*** %37
%106 = load double**, double*** %35
%107 = call i32 @calculate_rs(double %99, double %100, double %101, i32 %102, i32 %103, double** %104, double** %105, double** %106)
store i32 0, i32* %21
br label %108
108: ; preds = %127, %70
%109 = load double, double* %24
%110 = load double, double* %12
%111 = load double, double* %13
%112 = load i32, i32* %10
%113 = load i32, i32* %11
%114 = load double**, double*** %34
%115 = load double**, double*** %35
%116 = call i32 @sor(double %109, double %110, double %111, i32 %112, i32 %113, double** %114, double** %115, double* %22)
%117 = load i32, i32* %21
%118 = add nsw i32 %117, 1
store i32 %118, i32* %21
br label %119
119: ; preds = %108
%120 = load i32, i32* %21
%121 = load i32, i32* %20
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %127
123: ; preds = %119
%124 = load double, double* %22
%125 = load double, double* %23
%126 = fcmp ogt double %124, %125
br label %127
127: ; preds = %123, %119
%128 = phi i1 [ false, %119 ], [ %126, %123 ]
br i1 %128, label %108, label %129
129: ; preds = %127
%130 = load double, double* %22
%131 = load i32, i32* %21
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %130, i32 %131)
%133 = load double, double* %16
%134 = load double, double* %12
%135 = load double, double* %13
%136 = load i32, i32* %10
%137 = load i32, i32* %11
%138 = load double**, double*** %32
%139 = load double**, double*** %33
%140 = load double**, double*** %36
%141 = load double**, double*** %37
%142 = load double**, double*** %34
%143 = call i32 @calculate_uv(double %133, double %134, double %135, i32 %136, i32 %137, double** %138, double** %139, double** %140, double** %141, double** %142)
%144 = load i32, i32* %19
%145 = add nsw i32 %144, 1
store i32 %145, i32* %19
%146 = load double, double* %16
%147 = load double, double* %14
%148 = fadd double %147, %146
store double %148, double* %14
br label %66
149: ; preds = %66
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%151 = load double**, double*** %32
%152 = load i32, i32* %10
%153 = add nsw i32 %152, 1
%154 = load i32, i32* %11
%155 = add nsw i32 %154, 1
%156 = call i32 @free_matrix(double** %151, i32 0, i32 %153, i32 0, i32 %155)
%157 = load double**, double*** %33
%158 = load i32, i32* %10
%159 = add nsw i32 %158, 1
%160 = load i32, i32* %11
%161 = add nsw i32 %160, 1
%162 = call i32 @free_matrix(double** %157, i32 0, i32 %159, i32 0, i32 %161)
%163 = load double**, double*** %34
%164 = load i32, i32* %10
%165 = add nsw i32 %164, 1
%166 = load i32, i32* %11
%167 = add nsw i32 %166, 1
%168 = call i32 @free_matrix(double** %163, i32 0, i32 %165, i32 0, i32 %167)
%169 = load double**, double*** %35
%170 = load i32, i32* %10
%171 = add nsw i32 %170, 1
%172 = load i32, i32* %11
%173 = add nsw i32 %172, 1
%174 = call i32 @free_matrix(double** %169, i32 0, i32 %171, i32 0, i32 %173)
%175 = load double**, double*** %36
%176 = load i32, i32* %10
%177 = add nsw i32 %176, 1
%178 = load i32, i32* %11
%179 = add nsw i32 %178, 1
%180 = call i32 @free_matrix(double** %175, i32 0, i32 %177, i32 0, i32 %179)
%181 = load double**, double*** %37
%182 = load i32, i32* %10
%183 = add nsw i32 %182, 1
%184 = load i32, i32* %11
%185 = add nsw i32 %184, 1
%186 = call i32 @free_matrix(double** %181, i32 0, i32 %183, i32 0, i32 %185)
store i32 -1, i32* %3
br label %187
187: ; preds = %149, %42
%188 = load i32, i32* %3
ret i32 %188
}

LLVM IR (-O2):
@.str = [14 x i8] c"cavity100.dat\00"
@.str.1 = [45 x i8] c"ERROR: Input parameters potentially corrupt!\00"
@.str.2 = [15 x i8] c"res=%f, it=%u \00"
@str = [29 x i8] c"End of simulation...hooray! \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double**
%25 = alloca double**
%26 = alloca double**
%27 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%28 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%29 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%30 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%31 = bitcast double* %7 to i8*
store double 0.000000e+00, double* %7
%32 = bitcast double* %8 to i8*
store double 0.000000e+00, double* %8
%33 = bitcast double* %9 to i8*
store double 0.000000e+00, double* %9
%34 = bitcast double* %10 to i8*
store double 0.000000e+00, double* %10
%35 = bitcast double* %11 to i8*
store double 0.000000e+00, double* %11
%36 = bitcast double* %12 to i8*
store double 0.000000e+00, double* %12
%37 = bitcast i32* %13 to i8*
store i32 0, i32* %13
%38 = bitcast double* %14 to i8*
store double 0.000000e+00, double* %14
%39 = bitcast double* %15 to i8*
store double 0.000000e+00, double* %15
%40 = bitcast double* %16 to i8*
store double 0.000000e+00, double* %16
%41 = bitcast double* %17 to i8*
store double 0.000000e+00, double* %17
%42 = bitcast double* %18 to i8*
store double 0.000000e+00, double* %18
%43 = bitcast double* %19 to i8*
store double 0.000000e+00, double* %19
%44 = bitcast double* %20 to i8*
store double 0.000000e+00, double* %20
%45 = bitcast double* %21 to i8*
store double 0.000000e+00, double* %21
%46 = bitcast double* %22 to i8*
store double 0.000000e+00, double* %22
%47 = bitcast double* %23 to i8*
store double 0.000000e+00, double* %23
%48 = bitcast double*** %24 to i8*
store double** null, double*** %24
%49 = bitcast double*** %25 to i8*
store double** null, double*** %25
%50 = bitcast double*** %26 to i8*
store double** null, double*** %26
%51 = call i32 @read_parameters(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double* %18, double* %21, double* %22, double* %23, double* %19, double* %20, double* %9, double* %3, double* %4, double* %10, double* %7, double* %8, i32* %5, i32* %6, double* %17, double* %16, double* %11, i32* %13, double* %15, double* %12)
%52 = icmp eq i32 %51, 1
br i1 %52, label %55, label %53
53: ; preds = %2
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %179
55: ; preds = %2
%56 = load double, double* %21
%57 = load double, double* %22
%58 = load double, double* %23
%59 = load i32, i32* %5
%60 = load i32, i32* %6
%61 = call i32 @init_uvp(double %56, double %57, double %58, i32 %59, i32 %60, double*** %24, double*** %25, double*** %26)
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
%66 = call double** @matrix(i32 0, i32 %63, i32 0, i32 %65)
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
%71 = call double** @matrix(i32 0, i32 %68, i32 0, i32 %70)
%72 = load i32, i32* %5
%73 = add nsw i32 %72, 1
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 1
%76 = call double** @matrix(i32 0, i32 %73, i32 0, i32 %75)
%77 = load double, double* %9
%78 = fcmp ogt double %77, 0.000000e+00
br i1 %78, label %79, label %144
79: ; preds = %55, %129
%80 = phi double [ %141, %129 ], [ 0.000000e+00, %55 ]
%81 = load double, double* %18
%82 = load double, double* %11
%83 = load double, double* %7
%84 = load double, double* %8
%85 = load i32, i32* %5
%86 = load i32, i32* %6
%87 = load double**, double*** %24
%88 = load double**, double*** %25
%89 = call i32 @calculate_dt(double %81, double %82, double* %10, double %83, double %84, i32 %85, i32 %86, double** %87, double** %88)
%90 = load i32, i32* %5
%91 = load i32, i32* %6
%92 = load double**, double*** %24
%93 = load double**, double*** %25
%94 = call i32 @boundaryvalues(i32 %90, i32 %91, double** %92, double** %93)
%95 = load double, double* %18
%96 = load double, double* %19
%97 = load double, double* %20
%98 = load double, double* %17
%99 = load double, double* %10
%100 = load double, double* %7
%101 = load double, double* %8
%102 = load i32, i32* %5
%103 = load i32, i32* %6
%104 = load double**, double*** %24
%105 = load double**, double*** %25
%106 = call i32 @calculate_fg(double %95, double %96, double %97, double %98, double %99, double %100, double %101, i32 %102, i32 %103, double** %104, double** %105, double** %71, double** %76)
%107 = load double, double* %10
%108 = load double, double* %7
%109 = load double, double* %8
%110 = load i32, i32* %5
%111 = load i32, i32* %6
%112 = call i32 @calculate_rs(double %107, double %108, double %109, i32 %110, i32 %111, double** %71, double** %76, double** %66)
br label %113
113: ; preds = %113, %79
%114 = phi i32 [ 0, %79 ], [ %122, %113 ]
%115 = load double, double* %16
%116 = load double, double* %7
%117 = load double, double* %8
%118 = load i32, i32* %5
%119 = load i32, i32* %6
%120 = load double**, double*** %26
%121 = call i32 @sor(double %115, double %116, double %117, i32 %118, i32 %119, double** %120, double** %66, double* %14)
%122 = add nuw nsw i32 %114, 1
%123 = load i32, i32* %13
%124 = icmp slt i32 %122, %123
%125 = load double, double* %14
%126 = load double, double* %15
%127 = fcmp ogt double %125, %126
%128 = select i1 %124, i1 %127, i1 false
br i1 %128, label %113, label %129
129: ; preds = %113
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %125, i32 %122)
%131 = load double, double* %10
%132 = load double, double* %7
%133 = load double, double* %8
%134 = load i32, i32* %5
%135 = load i32, i32* %6
%136 = load double**, double*** %24
%137 = load double**, double*** %25
%138 = load double**, double*** %26
%139 = call i32 @calculate_uv(double %131, double %132, double %133, i32 %134, i32 %135, double** %136, double** %137, double** %71, double** %76, double** %138)
%140 = load double, double* %10
%141 = fadd double %80, %140
%142 = load double, double* %9
%143 = fcmp olt double %141, %142
br i1 %143, label %79, label %144
144: ; preds = %129, %55
%145 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%146 = load double**, double*** %24
%147 = load i32, i32* %5
%148 = add nsw i32 %147, 1
%149 = load i32, i32* %6
%150 = add nsw i32 %149, 1
%151 = call i32 @free_matrix(double** %146, i32 0, i32 %148, i32 0, i32 %150)
%152 = load double**, double*** %25
%153 = load i32, i32* %5
%154 = add nsw i32 %153, 1
%155 = load i32, i32* %6
%156 = add nsw i32 %155, 1
%157 = call i32 @free_matrix(double** %152, i32 0, i32 %154, i32 0, i32 %156)
%158 = load double**, double*** %26
%159 = load i32, i32* %5
%160 = add nsw i32 %159, 1
%161 = load i32, i32* %6
%162 = add nsw i32 %161, 1
%163 = call i32 @free_matrix(double** %158, i32 0, i32 %160, i32 0, i32 %162)
%164 = load i32, i32* %5
%165 = add nsw i32 %164, 1
%166 = load i32, i32* %6
%167 = add nsw i32 %166, 1
%168 = call i32 @free_matrix(double** %66, i32 0, i32 %165, i32 0, i32 %167)
%169 = load i32, i32* %5
%170 = add nsw i32 %169, 1
%171 = load i32, i32* %6
%172 = add nsw i32 %171, 1
%173 = call i32 @free_matrix(double** %71, i32 0, i32 %170, i32 0, i32 %172)
%174 = load i32, i32* %5
%175 = add nsw i32 %174, 1
%176 = load i32, i32* %6
%177 = add nsw i32 %176, 1
%178 = call i32 @free_matrix(double** %76, i32 0, i32 %175, i32 0, i32 %177)
br label %179
179: ; preds = %144, %53
%180 = phi i32 [ 0, %53 ], [ -1, %144 ]
ret i32 %180
}