#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*/ apply_vel_boundary_conditions(double *, double *);
int /*<<< orphan*/ exit(int);
int fabs(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ solve_pressure_poisson(double *, double, double, double,
                                          double *, double *, double *);
int /*<<< orphan*/ solve_stokes_momentum(double *, double *, double *, double *,
                                         double *, double *, double *, double,
                                         double, double);
void solve_flow(double *restrict u, double *restrict v, double dx, double dy,
                double *restrict p, double *restrict rho, double *restrict nu,
                double dt) {
  int i, j;
  int stepcount = 0;
  double un[51 * 101];
  double vn[51 * 101];
  double diff = 1000.;
  double udif, vdif, unt, vnt;
  while (1) {
    if (stepcount >= 50000) {
      printf("\033[0m");
      printf("Unable to solve: sc = %d, diff = %e\n", stepcount, diff);
      exit(1);
    }
    if (diff < 1e-5 && stepcount >= 2)
      break;
#pragma omp parallel for
    for (i = 0; i < 101 * 51; i++) {
      un[i] = u[i];
      vn[i] = v[i];
    }
    solve_pressure_poisson(p, dx, dy, dt, u, v, rho);
    solve_stokes_momentum(u, v, un, vn, p, rho, nu, dt, dx, dy);
    apply_vel_boundary_conditions(u, v);
    printf("sc: %d\n", stepcount);
    udif = 0.;
    vdif = 0.;
    unt = 0.;
    vnt = 0.;
#pragma omp parallel for
    for (i = 0; i < 101 * 51; i++) {
      udif += fabs(fabs(u[i]) - fabs(un[i]));
      unt += fabs(un[i]);
      vdif += fabs(fabs(v[i]) - fabs(vn[i]));
      vnt += fabs(vn[i]);
    }
    if (unt > 0. && vnt > 0.)
      diff = fabs(fabs(udif / unt) - fabs(vdif / vnt)) / 2.;
    else
      diff = 1.0;
    stepcount++;
  }
}


x86 assembly (clang, -O0):
<solve_flow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x14290,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movl   $0x0,-0x4c(%rbp)
movsd  0xe63(%rip),%xmm0
movsd  %xmm0,-0x14258(%rbp)
ff
cmpl   $0xc350,-0x4c(%rbp)
jl     11e3 <solve_flow+0x83>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%esi
movsd  -0x14258(%rbp),%xmm0
ff
lea    0xe53(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
movsd  0xe1d(%rip),%xmm0
ucomisd -0x14258(%rbp),%xmm0
ff
jbe    1208 <solve_flow+0xa8>
cmpl   $0x2,-0x4c(%rbp)
jl     1208 <solve_flow+0xa8>
jmp    14b4 <solve_flow+0x354>
movl   $0x0,-0x44(%rbp)
cmpl   $0x141f,-0x44(%rbp)
jge    125e <solve_flow+0xfe>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x44(%rbp),%rax
movsd  %xmm0,-0xa150(%rbp,%rax,8)
ff ff
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x44(%rbp),%rax
movsd  %xmm0,-0x14250(%rbp,%rax,8)
fe ff
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    120f <solve_flow+0xaf>
mov    -0x28(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1070 <solve_pressure_poisson@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xa150(%rbp),%rdx
lea    -0x14250(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%rax
movsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    %rax,(%rsp)
call   1060 <solve_stokes_momentum@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <apply_vel_boundary_conditions@plt>
mov    -0x4c(%rbp),%esi
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x14260(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x14268(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x14270(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x14278(%rbp)
ff
movl   $0x0,-0x44(%rbp)
cmpl   $0x141f,-0x44(%rbp)
jge    140a <solve_flow+0x2aa>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
call   1050 <fabs@plt>
mov    %eax,-0x14280(%rbp)
movslq -0x44(%rbp),%rax
cvttsd2si -0xa150(%rbp,%rax,8),%edi
ff ff
call   1050 <fabs@plt>
mov    -0x14280(%rbp),%edi
sub    %eax,%edi
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x14260(%rbp),%xmm0
ff
movsd  %xmm0,-0x14260(%rbp)
ff
movslq -0x44(%rbp),%rax
cvttsd2si -0xa150(%rbp,%rax,8),%edi
ff ff
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x14270(%rbp),%xmm0
ff
movsd  %xmm0,-0x14270(%rbp)
ff
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
call   1050 <fabs@plt>
mov    %eax,-0x1427c(%rbp)
movslq -0x44(%rbp),%rax
cvttsd2si -0x14250(%rbp,%rax,8),%edi
fe ff
call   1050 <fabs@plt>
mov    -0x1427c(%rbp),%edi
sub    %eax,%edi
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x14268(%rbp),%xmm0
ff
movsd  %xmm0,-0x14268(%rbp)
ff
movslq -0x44(%rbp),%rax
cvttsd2si -0x14250(%rbp,%rax,8),%edi
fe ff
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x14278(%rbp),%xmm0
ff
movsd  %xmm0,-0x14278(%rbp)
ff
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    130d <solve_flow+0x1ad>
movsd  -0x14270(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1496 <solve_flow+0x336>
movsd  -0x14278(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1496 <solve_flow+0x336>
movsd  -0x14260(%rbp),%xmm0
ff
divsd  -0x14270(%rbp),%xmm0
ff
cvttsd2si %xmm0,%edi
call   1050 <fabs@plt>
mov    %eax,-0x14284(%rbp)
movsd  -0x14268(%rbp),%xmm0
ff
divsd  -0x14278(%rbp),%xmm0
ff
cvttsd2si %xmm0,%edi
call   1050 <fabs@plt>
mov    -0x14284(%rbp),%edi
sub    %eax,%edi
call   1050 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xb93(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x14258(%rbp)
ff
jmp    14a6 <solve_flow+0x346>
movsd  0xb72(%rip),%xmm0
movsd  %xmm0,-0x14258(%rbp)
ff
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11a5 <solve_flow+0x45>
add    $0x14290,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_flow>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x14258,%rsp
movsd  %xmm2,0x40(%rsp)
mov    %r8,0x58(%rsp)
mov    %rcx,0x50(%rsp)
mov    %rdx,0x48(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    %rsi,%r13
mov    %rdi,%rbx
movsd  0xe50(%rip),%xmm4
xor    %r15d,%r15d
jmp    11d1 <solve_flow+0x61>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
cmp    $0xc350,%r15d
je     1424 <solve_flow+0x2b4>
movsd  0xe2f(%rip),%xmm0
ucomisd %xmm4,%xmm0
jbe    11e9 <solve_flow+0x79>
cmp    $0x1,%r15d
ja     1412 <solve_flow+0x2a2>
mov    $0xa0f8,%edx
lea    0x60(%rsp),%rdi
mov    %rbx,%rsi
call   1060 <memcpy@plt>
mov    $0xa0f8,%edx
lea    0xa160(%rsp),%r12
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <memcpy@plt>
mov    0x48(%rsp),%r14
mov    %r14,%rdi
movsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
mov    %rbx,%rsi
mov    %r13,%rdx
mov    0x50(%rsp),%rbp
mov    %rbp,%rcx
call   1080 <solve_pressure_poisson@plt>
mov    0x58(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x60(%rsp),%rdx
mov    %r12,%rcx
mov    %r14,%r8
mov    %rbp,%r9
movsd  0x40(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
call   1070 <solve_stokes_momentum@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <apply_vel_boundary_conditions@plt>
lea    0xdcc(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
xor    %r12d,%r12d
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x18(%rsp)
cvttsd2si (%rbx,%r12,8),%edi
call   1050 <fabs@plt>
mov    %eax,%r14d
cvttsd2si 0x60(%rsp,%r12,8),%edi
call   1050 <fabs@plt>
sub    %eax,%r14d
mov    %r14d,%edi
call   1050 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
cvttsd2si 0x60(%rsp,%r12,8),%edi
call   1050 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
cvttsd2si 0x0(%r13,%r12,8),%edi
call   1050 <fabs@plt>
mov    %eax,%ebp
cvttsd2si 0xa160(%rsp,%r12,8),%edi
call   1050 <fabs@plt>
sub    %eax,%ebp
mov    %ebp,%edi
call   1050 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
cvttsd2si 0xa160(%rsp,%r12,8),%edi
call   1050 <fabs@plt>
movsd  0x18(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm1
add    $0x1,%r12
cmp    $0x141f,%r12
jne    12c0 <solve_flow+0x150>
movsd  0x28(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
ucomisd 0xc79(%rip),%xmm2
movsd  0xc61(%rip),%xmm4
jbe    11c0 <solve_flow+0x50>
ucomisd 0xc63(%rip),%xmm1
movsd  0xc4b(%rip),%xmm4
jbe    11c0 <solve_flow+0x50>
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%edi
movsd  %xmm1,0x18(%rsp)
call   1050 <fabs@plt>
mov    %eax,%ebp
movsd  0x20(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <fabs@plt>
sub    %eax,%ebp
mov    %ebp,%edi
call   1050 <fabs@plt>
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
mulsd  0xc0b(%rip),%xmm4
jmp    11c0 <solve_flow+0x50>
add    $0x14258,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbfd(%rip),%rdi
xor    %eax,%eax
movsd  %xmm4,0x10(%rsp)
call   1040 <printf@plt>
lea    0xbee(%rip),%rdi
mov    $0xc350,%esi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[0m\00"
@.str.1 = [37 x i8] c"Unable to solve: sc = %d, diff = %e\0A\00"
@.str.2 = [8 x i8] c"sc: %d\0A\00"
define void @solve_flow(double* noalias %0, double* noalias %1, double %2, double %3, double* noalias %4, double* noalias %5, double* noalias %6, double %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca [5151 x double]
%21 = alloca [5151 x double]
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store double* %0, double** %9
store double* %1, double** %10
store double %2, double* %11
store double %3, double* %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double %7, double* %16
store i32 0, i32* %19
store double 1.000000e+03, double* %22
br label %27
27: ; preds = %8, %175
%28 = load i32, i32* %19
%29 = icmp sge i32 %28, 50000
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* %19
%33 = load double, double* %22
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %32, double %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %27
%37 = load double, double* %22
%38 = fcmp olt double %37, 1.000000e-05
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* %19
%41 = icmp sge i32 %40, 2
br i1 %41, label %42, label %43
42: ; preds = %39
br label %178
43: ; preds = %39, %36
store i32 0, i32* %17
br label %44
44: ; preds = %64, %43
%45 = load i32, i32* %17
%46 = icmp slt i32 %45, 5151
br i1 %46, label %47, label %67
47: ; preds = %44
%48 = load double*, double** %9
%49 = load i32, i32* %17
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load i32, i32* %17
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [5151 x double], [5151 x double]* %20, i64 0, i64 %54
store double %52, double* %55
%56 = load double*, double** %10
%57 = load i32, i32* %17
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load i32, i32* %17
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [5151 x double], [5151 x double]* %21, i64 0, i64 %62
store double %60, double* %63
br label %64
64: ; preds = %47
%65 = load i32, i32* %17
%66 = add nsw i32 %65, 1
store i32 %66, i32* %17
br label %44
67: ; preds = %44
%68 = load double*, double** %13
%69 = load double, double* %11
%70 = load double, double* %12
%71 = load double, double* %16
%72 = load double*, double** %9
%73 = load double*, double** %10
%74 = load double*, double** %14
%75 = call i32 @solve_pressure_poisson(double* %68, double %69, double %70, double %71, double* %72, double* %73, double* %74)
%76 = load double*, double** %9
%77 = load double*, double** %10
%78 = getelementptr inbounds [5151 x double], [5151 x double]* %20, i64 0, i64 0
%79 = getelementptr inbounds [5151 x double], [5151 x double]* %21, i64 0, i64 0
%80 = load double*, double** %13
%81 = load double*, double** %14
%82 = load double*, double** %15
%83 = load double, double* %16
%84 = load double, double* %11
%85 = load double, double* %12
%86 = call i32 @solve_stokes_momentum(double* %76, double* %77, double* %78, double* %79, double* %80, double* %81, double* %82, double %83, double %84, double %85)
%87 = load double*, double** %9
%88 = load double*, double** %10
%89 = call i32 @apply_vel_boundary_conditions(double* %87, double* %88)
%90 = load i32, i32* %19
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %90)
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 i32 0, i32* %17
br label %92
92: ; preds = %150, %67
%93 = load i32, i32* %17
%94 = icmp slt i32 %93, 5151
br i1 %94, label %95, label %153
95: ; preds = %92
%96 = load double*, double** %9
%97 = load i32, i32* %17
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %96, i64 %98
%100 = load double, double* %99
%101 = fptosi double %100 to i32
%102 = call i32 @fabs(i32 %101)
%103 = load i32, i32* %17
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [5151 x double], [5151 x double]* %20, i64 0, i64 %104
%106 = load double, double* %105
%107 = fptosi double %106 to i32
%108 = call i32 @fabs(i32 %107)
%109 = sub nsw i32 %102, %108
%110 = call i32 @fabs(i32 %109)
%111 = sitofp i32 %110 to double
%112 = load double, double* %23
%113 = fadd double %112, %111
store double %113, double* %23
%114 = load i32, i32* %17
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [5151 x double], [5151 x double]* %20, i64 0, i64 %115
%117 = load double, double* %116
%118 = fptosi double %117 to i32
%119 = call i32 @fabs(i32 %118)
%120 = sitofp i32 %119 to double
%121 = load double, double* %25
%122 = fadd double %121, %120
store double %122, double* %25
%123 = load double*, double** %10
%124 = load i32, i32* %17
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = fptosi double %127 to i32
%129 = call i32 @fabs(i32 %128)
%130 = load i32, i32* %17
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [5151 x double], [5151 x double]* %21, i64 0, i64 %131
%133 = load double, double* %132
%134 = fptosi double %133 to i32
%135 = call i32 @fabs(i32 %134)
%136 = sub nsw i32 %129, %135
%137 = call i32 @fabs(i32 %136)
%138 = sitofp i32 %137 to double
%139 = load double, double* %24
%140 = fadd double %139, %138
store double %140, double* %24
%141 = load i32, i32* %17
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [5151 x double], [5151 x double]* %21, i64 0, i64 %142
%144 = load double, double* %143
%145 = fptosi double %144 to i32
%146 = call i32 @fabs(i32 %145)
%147 = sitofp i32 %146 to double
%148 = load double, double* %26
%149 = fadd double %148, %147
store double %149, double* %26
br label %150
150: ; preds = %95
%151 = load i32, i32* %17
%152 = add nsw i32 %151, 1
store i32 %152, i32* %17
br label %92
153: ; preds = %92
%154 = load double, double* %25
%155 = fcmp ogt double %154, 0.000000e+00
br i1 %155, label %156, label %174
156: ; preds = %153
%157 = load double, double* %26
%158 = fcmp ogt double %157, 0.000000e+00
br i1 %158, label %159, label %174
159: ; preds = %156
%160 = load double, double* %23
%161 = load double, double* %25
%162 = fdiv double %160, %161
%163 = fptosi double %162 to i32
%164 = call i32 @fabs(i32 %163)
%165 = load double, double* %24
%166 = load double, double* %26
%167 = fdiv double %165, %166
%168 = fptosi double %167 to i32
%169 = call i32 @fabs(i32 %168)
%170 = sub nsw i32 %164, %169
%171 = call i32 @fabs(i32 %170)
%172 = sitofp i32 %171 to double
%173 = fdiv double %172, 2.000000e+00
store double %173, double* %22
br label %175
174: ; preds = %156, %153
store double 1.000000e+00, double* %22
br label %175
175: ; preds = %174, %159
%176 = load i32, i32* %19
%177 = add nsw i32 %176, 1
store i32 %177, i32* %19
br label %27
178: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[0m\00"
@.str.1 = [37 x i8] c"Unable to solve: sc = %d, diff = %e\0A\00"
@.str.2 = [8 x i8] c"sc: %d\0A\00"
define void @solve_flow(double* noalias %0, double* noalias %1, double %2, double %3, double* noalias %4, double* noalias %5, double* noalias %6, double %7) {
%9 = bitcast double* %0 to i8*
%10 = bitcast double* %1 to i8*
%11 = alloca [5151 x double]
%12 = bitcast [5151 x double]* %11 to i8*
%13 = alloca [5151 x double]
%14 = bitcast [5151 x double]* %13 to i8*
%15 = getelementptr inbounds [5151 x double], [5151 x double]* %11, i64 0, i64 0
%16 = getelementptr inbounds [5151 x double], [5151 x double]* %13, i64 0, i64 0
br label %21
17: ; preds = %89
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 50000, double %90)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %8, %89
%22 = phi double [ 1.000000e+03, %8 ], [ %90, %89 ]
%23 = phi i32 [ 0, %8 ], [ %91, %89 ]
%24 = fcmp olt double %22, 1.000000e-05
%25 = icmp ugt i32 %23, 1
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %93, label %27
27: ; preds = %21
%28 = call i32 @solve_pressure_poisson(double* %4, double %2, double %3, double %7, double* %0, double* %1, double* %5)
%29 = call i32 @solve_stokes_momentum(double* %0, double* %1, double* %15, double* %16, double* %4, double* %5, double* %6, double %7, double %2, double %3)
%30 = call i32 @apply_vel_boundary_conditions(double* %0, double* %1)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %32
32: ; preds = %27, %32
%33 = phi i64 [ 0, %27 ], [ %72, %32 ]
%34 = phi double [ 0.000000e+00, %27 ], [ %71, %32 ]
%35 = phi double [ 0.000000e+00, %27 ], [ %54, %32 ]
%36 = phi double [ 0.000000e+00, %27 ], [ %66, %32 ]
%37 = phi double [ 0.000000e+00, %27 ], [ %49, %32 ]
%38 = getelementptr inbounds double, double* %0, i64 %33
%39 = load double, double* %38
%40 = fptosi double %39 to i32
%41 = call i32 @fabs(i32 %40)
%42 = getelementptr inbounds [5151 x double], [5151 x double]* %11, i64 0, i64 %33
%43 = load double, double* %42
%44 = fptosi double %43 to i32
%45 = call i32 @fabs(i32 %44)
%46 = sub nsw i32 %41, %45
%47 = call i32 @fabs(i32 %46)
%48 = sitofp i32 %47 to double
%49 = fadd double %37, %48
%50 = load double, double* %42
%51 = fptosi double %50 to i32
%52 = call i32 @fabs(i32 %51)
%53 = sitofp i32 %52 to double
%54 = fadd double %35, %53
%55 = getelementptr inbounds double, double* %1, i64 %33
%56 = load double, double* %55
%57 = fptosi double %56 to i32
%58 = call i32 @fabs(i32 %57)
%59 = getelementptr inbounds [5151 x double], [5151 x double]* %13, i64 0, i64 %33
%60 = load double, double* %59
%61 = fptosi double %60 to i32
%62 = call i32 @fabs(i32 %61)
%63 = sub nsw i32 %58, %62
%64 = call i32 @fabs(i32 %63)
%65 = sitofp i32 %64 to double
%66 = fadd double %36, %65
%67 = load double, double* %59
%68 = fptosi double %67 to i32
%69 = call i32 @fabs(i32 %68)
%70 = sitofp i32 %69 to double
%71 = fadd double %34, %70
%72 = add nuw nsw i64 %33, 1
%73 = icmp eq i64 %72, 5151
br i1 %73, label %74, label %32
74: ; preds = %32
%75 = fcmp ogt double %54, 0.000000e+00
%76 = fcmp ogt double %71, 0.000000e+00
%77 = select i1 %75, i1 %76, i1 false
br i1 %77, label %78, label %89
78: ; preds = %74
%79 = fdiv double %49, %54
%80 = fptosi double %79 to i32
%81 = call i32 @fabs(i32 %80)
%82 = fdiv double %66, %71
%83 = fptosi double %82 to i32
%84 = call i32 @fabs(i32 %83)
%85 = sub nsw i32 %81, %84
%86 = call i32 @fabs(i32 %85)
%87 = sitofp i32 %86 to double
%88 = fmul double %87, 5.000000e-01
br label %89
89: ; preds = %74, %78
%90 = phi double [ %88, %78 ], [ 1.000000e+00, %74 ]
%91 = add nuw nsw i32 %23, 1
%92 = icmp eq i32 %91, 50000
br i1 %92, label %17, label %21
93: ; preds = %21
ret void
}