#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_thermal_boundary_conditions(double *);
int /*<<< orphan*/ apply_vel_boundary_conditions(double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ solve_advection_diffusion(double *, double *, double *,
                                             double, double, double *, double,
                                             double, double *, double);
int /*<<< orphan*/ solve_flow(double *, double *, double, double, double *,
                              double *, double *, double);
int /*<<< orphan*/ update_k(double *, double *);
int /*<<< orphan*/ update_nu(double *, double *);
int /*<<< orphan*/ update_rho(double *, double *);
int /*<<< orphan*/ visualise(double *, int, int, int);
int main() {
  double current_time;
  double dx = (5. - 0.) / (101 - 1);
  double dy = (2.5 - 0.) / (51 - 1);
  double u[51 * 101];
  double v[51 * 101];
  double p[51 * 101];
  double rho[51 * 101];
  double nu[51 * 101];
  double t[51 * 101];
  double k[51 * 101];
  double cp = 60.;
  double H = 0.;
  double dt = 9e-7;
  double ref_rho = 100.;
  int i, j;
  int timestep;
  for (j = 0; j < 51; j++) {
    for (i = 0; i < 101; i++) {
      u[101 * j + i] = 0.;
      v[101 * j + i] = 0.;
      p[101 * j + i] = ref_rho * dy * 0.0003 * (51 - j);
      rho[101 * j + i] = ref_rho;
      nu[101 * j + i] = 1.;
      if (j < 4 && i < (int)(101 / 2))
        t[101 * j + i] = 1000.;
      else if (j > 51 - 5 && i > (int)(101 / 2))
        t[101 * j + i] = 0.;
      else
        t[101 * j + i] = 500.;
      k[101 * j + i] = 100.;
    }
  }
  apply_vel_boundary_conditions(u, v);
  apply_thermal_boundary_conditions(t);
  timestep = 0;
  current_time = 0;
  while (1) {
    if (timestep % 1000 == 0) {
      visualise(t, 0., 1000., 1);
      printf("Timestep: %06d, Current time: %.4f, dt: %e\n", timestep,
             current_time, dt);
      printf("\n");
    }
    solve_advection_diffusion(t, u, v, dx, dy, rho, dt, cp, k, H);
    update_rho(rho, t);
    update_nu(nu, t);
    update_k(k, t);
    solve_flow(u, v, dx, dy, p, rho, nu, dt);
    current_time += dt;
    timestep++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x46750,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe6e(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe61(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe4c(%rip),%xmm0
movsd  %xmm0,-0x46728(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x46730(%rbp)
ff
movsd  0xe29(%rip),%xmm0
movsd  %xmm0,-0x46738(%rbp)
ff
movsd  0xe11(%rip),%xmm0
movsd  %xmm0,-0x46740(%rbp)
ff
movl   $0x0,-0x46748(%rbp)
cmpl   $0x33,-0x46748(%rbp)
jge    13ca <main+0x23a>
movl   $0x0,-0x46744(%rbp)
cmpl   $0x65,-0x46744(%rbp)
jge    13b1 <main+0x221>
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa120(%rbp,%rax,8)
ff ff
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x14220(%rbp,%rax,8)
fe ff
movsd  -0x46740(%rbp),%xmm0
ff
mulsd  -0x20(%rbp),%xmm0
movsd  0xdb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    $0x33,%eax
sub    -0x46748(%rbp),%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
movsd  %xmm0,-0x1e320(%rbp,%rax,8)
fe ff
movsd  -0x46740(%rbp),%xmm0
ff
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
movsd  %xmm0,-0x28420(%rbp,%rax,8)
fd ff
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
movsd  0xd4a(%rip),%xmm0
movsd  %xmm0,-0x32520(%rbp,%rax,8)
fc ff
cmpl   $0x4,-0x46748(%rbp)
jge    131e <main+0x18e>
cmpl   $0x32,-0x46744(%rbp)
jge    131e <main+0x18e>
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
movsd  0xd28(%rip),%xmm0
movsd  %xmm0,-0x3c620(%rbp,%rax,8)
fc ff
jmp    137d <main+0x1ed>
cmpl   $0x2e,-0x46748(%rbp)
jle    1358 <main+0x1c8>
cmpl   $0x32,-0x46744(%rbp)
jle    1358 <main+0x1c8>
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x3c620(%rbp,%rax,8)
fc ff
jmp    1378 <main+0x1e8>
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
movsd  0xcc1(%rip),%xmm0
movsd  %xmm0,-0x3c620(%rbp,%rax,8)
fc ff
jmp    137d <main+0x1ed>
imul   $0x65,-0x46748(%rbp),%eax
add    -0x46744(%rbp),%eax
cltq
movsd  0xc6c(%rip),%xmm0
movsd  %xmm0,-0x46720(%rbp,%rax,8)
fb ff
mov    -0x46744(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x46744(%rbp)
jmp    1218 <main+0x88>
jmp    13b6 <main+0x226>
mov    -0x46748(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x46748(%rbp)
jmp    1201 <main+0x71>
lea    -0xa120(%rbp),%rdi
lea    -0x14220(%rbp),%rsi
call   1040 <apply_vel_boundary_conditions@plt>
lea    -0x3c620(%rbp),%rdi
call   10a0 <apply_thermal_boundary_conditions@plt>
movl   $0x0,-0x4674c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4674c(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1459 <main+0x2c9>
lea    -0x3c620(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
mov    $0x1,%ecx
call   1080 <visualise@plt>
mov    -0x4674c(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
movsd  -0x46738(%rbp),%xmm1
ff
lea    0xbfc(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x3c620(%rbp),%rdi
lea    -0xa120(%rbp),%rsi
lea    -0x14220(%rbp),%rdx
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    -0x28420(%rbp),%rcx
movsd  -0x46738(%rbp),%xmm2
ff
movsd  -0x46728(%rbp),%xmm3
ff
lea    -0x46720(%rbp),%r8
movsd  -0x46730(%rbp),%xmm4
ff
call   1070 <solve_advection_diffusion@plt>
lea    -0x28420(%rbp),%rdi
lea    -0x3c620(%rbp),%rsi
call   1030 <update_rho@plt>
lea    -0x32520(%rbp),%rdi
lea    -0x3c620(%rbp),%rsi
call   10b0 <update_nu@plt>
lea    -0x46720(%rbp),%rdi
lea    -0x3c620(%rbp),%rsi
call   1090 <update_k@plt>
lea    -0xa120(%rbp),%rdi
lea    -0x14220(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    -0x1e320(%rbp),%rdx
lea    -0x28420(%rbp),%rcx
lea    -0x32520(%rbp),%r8
movsd  -0x46738(%rbp),%xmm2
ff
call   1060 <solve_flow@plt>
movsd  -0x46738(%rbp),%xmm0
ff
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4674c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4674c(%rbp)
jmp    13fb <main+0x26b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x46708,%rsp
lea    0x14210(%rsp),%rdi
xor    %ebx,%ebx
mov    $0xa0f8,%edx
xor    %esi,%esi
call   1080 <memset@plt>
lea    0xa110(%rsp),%rdi
mov    $0xa0f8,%edx
xor    %esi,%esi
call   1080 <memset@plt>
lea    0x10(%rsp),%rax
lea    0x1e310(%rsp),%rcx
lea    0x28410(%rsp),%rdx
lea    0x32510(%rsp),%rsi
lea    0x3c610(%rsp),%rdi
movsd  0xde8(%rip),%xmm0
movabs $0x4059000000000000,%r11
movabs $0x3ff0000000000000,%r8
movabs $0x408f400000000000,%r9
40 8f 40
movabs $0x407f400000000000,%r10
40 7f 40
jmp    127c <main+0xcc>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
add    $0x328,%rax
add    $0x328,%rcx
add    $0x328,%rdx
add    $0x328,%rsi
add    $0x328,%rdi
cmp    $0x33,%rbx
je     12f6 <main+0x146>
mov    $0x33,%ebp
sub    %ebx,%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
mulsd  %xmm0,%xmm1
xor    %ebp,%ebp
jmp    12b2 <main+0x102>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r10,(%rax,%rbp,8)
mov    %r11,(%rcx,%rbp,8)
add    $0x1,%rbp
cmp    $0x65,%rbp
je     1250 <main+0xa0>
movsd  %xmm1,(%rdi,%rbp,8)
mov    %r11,(%rsi,%rbp,8)
mov    %r8,(%rdx,%rbp,8)
cmp    $0x3,%rbx
ja     12e0 <main+0x130>
cmp    $0x31,%rbp
ja     12e0 <main+0x130>
mov    %r9,(%rax,%rbp,8)
jmp    12a4 <main+0xf4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x2f,%rbx
jb     12a0 <main+0xf0>
cmp    $0x33,%rbp
jb     12a0 <main+0xf0>
movq   $0x0,(%rax,%rbp,8)
jmp    12a4 <main+0xf4>
lea    0x14210(%rsp),%rdi
lea    0xa110(%rsp),%rsi
call   1050 <apply_vel_boundary_conditions@plt>
lea    0x10(%rsp),%rdi
call   10c0 <apply_thermal_boundary_conditions@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    1402 <main+0x252>
nopl   0x0(%rax)
xorps  %xmm4,%xmm4
lea    0x10(%rsp),%r15
mov    %r15,%rdi
lea    0x14210(%rsp),%rsi
lea    0xa110(%rsp),%rdx
movsd  0xcbd(%rip),%xmm0
movaps %xmm0,%xmm1
mov    %ebx,%r12d
lea    0x32510(%rsp),%rbx
mov    %rbx,%rcx
movsd  0xc9c(%rip),%xmm2
movsd  0xca4(%rip),%xmm3
lea    0x1e310(%rsp),%r13
mov    %r13,%r8
call   1090 <solve_advection_diffusion@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <update_rho@plt>
lea    0x28410(%rsp),%rbp
mov    %rbp,%rdi
mov    %r15,%rsi
call   10d0 <update_nu@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   10b0 <update_k@plt>
lea    0x14210(%rsp),%rdi
lea    0xa110(%rsp),%rsi
movsd  0xc4b(%rip),%xmm0
movapd %xmm0,%xmm1
lea    0x3c610(%rsp),%rdx
mov    %rbx,%rcx
mov    %r12d,%ebx
mov    %rbp,%r8
movsd  0xc26(%rip),%xmm2
call   1070 <solve_flow@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xc13(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x1,%ebx
add    $0xffffffff,%r14d
mov    %ebx,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
imul   $0x3e8,%eax,%eax
add    %r14d,%eax
jne    1330 <main+0x180>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
mov    $0x1,%ecx
call   10a0 <visualise@plt>
lea    0xbe5(%rip),%rdi
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm0
movsd  0xbbd(%rip),%xmm1
mov    $0x2,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1330 <main+0x180>

LLVM IR (-O0):
@.str = [44 x i8] c"Timestep: %06d, Current time: %.4f, dt: %e\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca [5151 x double]
%6 = alloca [5151 x double]
%7 = alloca [5151 x double]
%8 = alloca [5151 x double]
%9 = alloca [5151 x double]
%10 = alloca [5151 x double]
%11 = alloca [5151 x double]
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %1
store double 5.000000e-02, double* %3
store double 5.000000e-02, double* %4
store double 6.000000e+01, double* %12
store double 0.000000e+00, double* %13
store double 0x3EAE32F0EE144531, double* %14
store double 1.000000e+02, double* %15
store i32 0, i32* %17
br label %19
19: ; preds = %110, %0
%20 = load i32, i32* %17
%21 = icmp slt i32 %20, 51
br i1 %21, label %22, label %113
22: ; preds = %19
store i32 0, i32* %16
br label %23
23: ; preds = %106, %22
%24 = load i32, i32* %16
%25 = icmp slt i32 %24, 101
br i1 %25, label %26, label %109
26: ; preds = %23
%27 = load i32, i32* %17
%28 = mul nsw i32 101, %27
%29 = load i32, i32* %16
%30 = add nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5151 x double], [5151 x double]* %5, i64 0, i64 %31
store double 0.000000e+00, double* %32
%33 = load i32, i32* %17
%34 = mul nsw i32 101, %33
%35 = load i32, i32* %16
%36 = add nsw i32 %34, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5151 x double], [5151 x double]* %6, i64 0, i64 %37
store double 0.000000e+00, double* %38
%39 = load double, double* %15
%40 = load double, double* %4
%41 = fmul double %39, %40
%42 = fmul double %41, 3.000000e-04
%43 = load i32, i32* %17
%44 = sub nsw i32 51, %43
%45 = sitofp i32 %44 to double
%46 = fmul double %42, %45
%47 = load i32, i32* %17
%48 = mul nsw i32 101, %47
%49 = load i32, i32* %16
%50 = add nsw i32 %48, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [5151 x double], [5151 x double]* %7, i64 0, i64 %51
store double %46, double* %52
%53 = load double, double* %15
%54 = load i32, i32* %17
%55 = mul nsw i32 101, %54
%56 = load i32, i32* %16
%57 = add nsw i32 %55, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 %58
store double %53, double* %59
%60 = load i32, i32* %17
%61 = mul nsw i32 101, %60
%62 = load i32, i32* %16
%63 = add nsw i32 %61, %62
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [5151 x double], [5151 x double]* %9, i64 0, i64 %64
store double 1.000000e+00, double* %65
%66 = load i32, i32* %17
%67 = icmp slt i32 %66, 4
br i1 %67, label %68, label %78
68: ; preds = %26
%69 = load i32, i32* %16
%70 = icmp slt i32 %69, 50
br i1 %70, label %71, label %78
71: ; preds = %68
%72 = load i32, i32* %17
%73 = mul nsw i32 101, %72
%74 = load i32, i32* %16
%75 = add nsw i32 %73, %74
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 %76
store double 1.000000e+03, double* %77
br label %99
78: ; preds = %68, %26
%79 = load i32, i32* %17
%80 = icmp sgt i32 %79, 46
br i1 %80, label %81, label %91
81: ; preds = %78
%82 = load i32, i32* %16
%83 = icmp sgt i32 %82, 50
br i1 %83, label %84, label %91
84: ; preds = %81
%85 = load i32, i32* %17
%86 = mul nsw i32 101, %85
%87 = load i32, i32* %16
%88 = add nsw i32 %86, %87
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 %89
store double 0.000000e+00, double* %90
br label %98
91: ; preds = %81, %78
%92 = load i32, i32* %17
%93 = mul nsw i32 101, %92
%94 = load i32, i32* %16
%95 = add nsw i32 %93, %94
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 %96
store double 5.000000e+02, double* %97
br label %98
98: ; preds = %91, %84
br label %99
99: ; preds = %98, %71
%100 = load i32, i32* %17
%101 = mul nsw i32 101, %100
%102 = load i32, i32* %16
%103 = add nsw i32 %101, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [5151 x double], [5151 x double]* %11, i64 0, i64 %104
store double 1.000000e+02, double* %105
br label %106
106: ; preds = %99
%107 = load i32, i32* %16
%108 = add nsw i32 %107, 1
store i32 %108, i32* %16
br label %23
109: ; preds = %23
br label %110
110: ; preds = %109
%111 = load i32, i32* %17
%112 = add nsw i32 %111, 1
store i32 %112, i32* %17
br label %19
113: ; preds = %19
%114 = getelementptr inbounds [5151 x double], [5151 x double]* %5, i64 0, i64 0
%115 = getelementptr inbounds [5151 x double], [5151 x double]* %6, i64 0, i64 0
%116 = call i32 @apply_vel_boundary_conditions(double* %114, double* %115)
%117 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 0
%118 = call i32 @apply_thermal_boundary_conditions(double* %117)
store i32 0, i32* %18
store double 0.000000e+00, double* %2
br label %119
119: ; preds = %113, %131
%120 = load i32, i32* %18
%121 = srem i32 %120, 1000
%122 = icmp eq i32 %121, 0
br i1 %122, label %123, label %131
123: ; preds = %119
%124 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 0
%125 = call i32 @visualise(double* %124, i32 0, i32 1000, i32 1)
%126 = load i32, i32* %18
%127 = load double, double* %2
%128 = load double, double* %14
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %126, double %127, double %128)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %131
131: ; preds = %123, %119
%132 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 0
%133 = getelementptr inbounds [5151 x double], [5151 x double]* %5, i64 0, i64 0
%134 = getelementptr inbounds [5151 x double], [5151 x double]* %6, i64 0, i64 0
%135 = load double, double* %3
%136 = load double, double* %4
%137 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 0
%138 = load double, double* %14
%139 = load double, double* %12
%140 = getelementptr inbounds [5151 x double], [5151 x double]* %11, i64 0, i64 0
%141 = load double, double* %13
%142 = call i32 @solve_advection_diffusion(double* %132, double* %133, double* %134, double %135, double %136, double* %137, double %138, double %139, double* %140, double %141)
%143 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 0
%144 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 0
%145 = call i32 @update_rho(double* %143, double* %144)
%146 = getelementptr inbounds [5151 x double], [5151 x double]* %9, i64 0, i64 0
%147 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 0
%148 = call i32 @update_nu(double* %146, double* %147)
%149 = getelementptr inbounds [5151 x double], [5151 x double]* %11, i64 0, i64 0
%150 = getelementptr inbounds [5151 x double], [5151 x double]* %10, i64 0, i64 0
%151 = call i32 @update_k(double* %149, double* %150)
%152 = getelementptr inbounds [5151 x double], [5151 x double]* %5, i64 0, i64 0
%153 = getelementptr inbounds [5151 x double], [5151 x double]* %6, i64 0, i64 0
%154 = load double, double* %3
%155 = load double, double* %4
%156 = getelementptr inbounds [5151 x double], [5151 x double]* %7, i64 0, i64 0
%157 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 0
%158 = getelementptr inbounds [5151 x double], [5151 x double]* %9, i64 0, i64 0
%159 = load double, double* %14
%160 = call i32 @solve_flow(double* %152, double* %153, double %154, double %155, double* %156, double* %157, double* %158, double %159)
%161 = load double, double* %14
%162 = load double, double* %2
%163 = fadd double %162, %161
store double %163, double* %2
%164 = load i32, i32* %18
%165 = add nsw i32 %164, 1
store i32 %165, i32* %18
br label %119
}

LLVM IR (-O2):
@.str = [44 x i8] c"Timestep: %06d, Current time: %.4f, dt: %e\0A\00"
define i32 @main() {
%1 = alloca [5151 x double]
%2 = bitcast [5151 x double]* %1 to i8*
%3 = alloca [5151 x double]
%4 = bitcast [5151 x double]* %3 to i8*
%5 = alloca [5151 x double]
%6 = alloca [5151 x double]
%7 = alloca [5151 x double]
%8 = alloca [5151 x double]
%9 = alloca [5151 x double]
%10 = bitcast [5151 x double]* %5 to i8*
%11 = bitcast [5151 x double]* %6 to i8*
%12 = bitcast [5151 x double]* %7 to i8*
%13 = bitcast [5151 x double]* %8 to i8*
%14 = bitcast [5151 x double]* %9 to i8*
br label %15
15: ; preds = %0, %44
%16 = phi i64 [ 0, %0 ], [ %45, %44 ]
%17 = mul nuw nsw i64 %16, 101
%18 = trunc i64 %16 to i32
%19 = sub i32 51, %18
%20 = sitofp i32 %19 to double
%21 = fmul double %20, 0x3F589374BC6A7EF9
%22 = icmp ult i64 %16, 4
%23 = icmp ugt i64 %16, 46
br label %24
24: ; preds = %15, %40
%25 = phi i64 [ 0, %15 ], [ %42, %40 ]
%26 = add nuw nsw i64 %25, %17
%27 = getelementptr inbounds [5151 x double], [5151 x double]* %5, i64 0, i64 %26
store double %21, double* %27
%28 = getelementptr inbounds [5151 x double], [5151 x double]* %6, i64 0, i64 %26
store double 1.000000e+02, double* %28
%29 = getelementptr inbounds [5151 x double], [5151 x double]* %7, i64 0, i64 %26
store double 1.000000e+00, double* %29
%30 = icmp ult i64 %25, 50
%31 = select i1 %22, i1 %30, i1 false
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 %26
store double 1.000000e+03, double* %33
br label %40
34: ; preds = %24
%35 = icmp ugt i64 %25, 50
%36 = select i1 %23, i1 %35, i1 false
%37 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 %26
br i1 %36, label %38, label %39
38: ; preds = %34
store double 0.000000e+00, double* %37
br label %40
39: ; preds = %34
store double 5.000000e+02, double* %37
br label %40
40: ; preds = %38, %39, %32
%41 = getelementptr inbounds [5151 x double], [5151 x double]* %9, i64 0, i64 %26
store double 1.000000e+02, double* %41
%42 = add nuw nsw i64 %25, 1
%43 = icmp eq i64 %42, 101
br i1 %43, label %44, label %24
44: ; preds = %40
%45 = add nuw nsw i64 %16, 1
%46 = icmp eq i64 %45, 51
br i1 %46, label %47, label %15
47: ; preds = %44
%48 = getelementptr inbounds [5151 x double], [5151 x double]* %1, i64 0, i64 0
%49 = getelementptr inbounds [5151 x double], [5151 x double]* %3, i64 0, i64 0
%50 = call i32 @apply_vel_boundary_conditions(double* %48, double* %49)
%51 = getelementptr inbounds [5151 x double], [5151 x double]* %8, i64 0, i64 0
%52 = call i32 @apply_thermal_boundary_conditions(double* %51)
%53 = getelementptr inbounds [5151 x double], [5151 x double]* %6, i64 0, i64 0
%54 = getelementptr inbounds [5151 x double], [5151 x double]* %9, i64 0, i64 0
%55 = getelementptr inbounds [5151 x double], [5151 x double]* %7, i64 0, i64 0
%56 = getelementptr inbounds [5151 x double], [5151 x double]* %5, i64 0, i64 0
br label %57
57: ; preds = %66, %47
%58 = phi double [ 0.000000e+00, %47 ], [ %72, %66 ]
%59 = phi i32 [ 0, %47 ], [ %73, %66 ]
%60 = urem i32 %59, 1000
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %57
%63 = call i32 @visualise(double* %51, i32 0, i32 1000, i32 1)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %59, double %58, double 0x3EAE32F0EE144531)
%65 = call i32 @putchar(i32 10)
br label %66
66: ; preds = %62, %57
%67 = call i32 @solve_advection_diffusion(double* %51, double* %48, double* %49, double 5.000000e-02, double 5.000000e-02, double* %53, double 0x3EAE32F0EE144531, double 6.000000e+01, double* %54, double 0.000000e+00)
%68 = call i32 @update_rho(double* %53, double* %51)
%69 = call i32 @update_nu(double* %55, double* %51)
%70 = call i32 @update_k(double* %54, double* %51)
%71 = call i32 @solve_flow(double* %48, double* %49, double 5.000000e-02, double 5.000000e-02, double* %56, double* %53, double* %55, double 0x3EAE32F0EE144531)
%72 = fadd double %58, 0x3EAE32F0EE144531
%73 = add nuw nsw i32 %59, 1
br label %57
}