void limit_inflow_2d(int iX, int iY, int nX, int nY, int X_nbr, int Y_nbr,
                     int nrm, int fid, int tid, double *u_face, double delta_t,
                     double *sc_old, double *sc_min, double *sc_max,
                     double *sc_face, int *out, double *outflow, double *inflow,
                     double *influx_min, double *influx_max, double *abs_min,
                     double *abs_max) {
  int nbrid;
  double crntxnrm;
  crntxnrm = u_face[fid] * delta_t * 1. * nrm;
  if (crntxnrm > 0) {
    out[fid] = 1;
    *outflow += crntxnrm;
    nbrid = (iY + Y_nbr) * nX + iX + X_nbr;
    sc_face[fid] =
        (((sc_face[fid]) <
          ((((*(sc_old + nbrid)) > (sc_max[fid])) ? (*(sc_old + nbrid))
                                                  : (sc_max[fid]))))
             ? (sc_face[fid])
             : ((((*(sc_old + nbrid)) > (sc_max[fid])) ? (*(sc_old + nbrid))
                                                       : (sc_max[fid]))));
    sc_face[fid] =
        (((sc_face[fid]) >
          ((((*(sc_old + nbrid)) < (sc_min[fid])) ? (*(sc_old + nbrid))
                                                  : (sc_min[fid]))))
             ? (sc_face[fid])
             : ((((*(sc_old + nbrid)) < (sc_min[fid])) ? (*(sc_old + nbrid))
                                                       : (sc_min[fid]))));
  } else {
    *inflow -= crntxnrm;
    sc_face[fid] =
        (((sc_face[fid]) <
          ((((*(sc_old + tid)) > (sc_max[fid])) ? (*(sc_old + tid))
                                                : (sc_max[fid]))))
             ? (sc_face[fid])
             : ((((*(sc_old + tid)) > (sc_max[fid])) ? (*(sc_old + tid))
                                                     : (sc_max[fid]))));
    sc_face[fid] =
        (((sc_face[fid]) >
          ((((*(sc_old + tid)) < (sc_min[fid])) ? (*(sc_old + tid))
                                                : (sc_min[fid]))))
             ? (sc_face[fid])
             : ((((*(sc_old + tid)) < (sc_min[fid])) ? (*(sc_old + tid))
                                                     : (sc_min[fid]))));
    sc_min[fid] =
        (((sc_min[fid]) < (sc_face[fid])) ? (sc_min[fid]) : (sc_face[fid]));
    sc_max[fid] =
        (((sc_max[fid]) > (sc_face[fid])) ? (sc_max[fid]) : (sc_face[fid]));
    *influx_min -= crntxnrm * sc_min[fid];
    *influx_max -= crntxnrm * sc_max[fid];
    *abs_max = (((*abs_max) > (sc_max[fid])) ? (*abs_max) : (sc_max[fid]));
    *abs_min = (((*abs_min) < (sc_min[fid])) ? (*abs_min) : (sc_min[fid]));
  }
}


x86 assembly (clang, -O0):
<limit_inflow_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x80(%rbp),%rax
mov    0x78(%rbp),%rax
mov    0x70(%rbp),%rax
mov    0x68(%rbp),%rax
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    0x28(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe89(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl 0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13b1 <limit_inflow_2d+0x2b1>
mov    0x50(%rbp),%rax
movslq 0x18(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movsd  -0x30(%rbp),%xmm0
mov    0x58(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1217 <limit_inflow_2d+0x117>
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1229 <limit_inflow_2d+0x129>
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1254 <limit_inflow_2d+0x154>
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    12a7 <limit_inflow_2d+0x1a7>
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    128b <limit_inflow_2d+0x18b>
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    129d <limit_inflow_2d+0x19d>
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1306 <limit_inflow_2d+0x206>
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1318 <limit_inflow_2d+0x218>
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1343 <limit_inflow_2d+0x243>
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    139a <limit_inflow_2d+0x29a>
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    137e <limit_inflow_2d+0x27e>
mov    0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1390 <limit_inflow_2d+0x290>
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    17d4 <limit_inflow_2d+0x6d4>
movsd  -0x30(%rbp),%xmm1
mov    0x60(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    140f <limit_inflow_2d+0x30f>
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1421 <limit_inflow_2d+0x321>
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    144f <limit_inflow_2d+0x34f>
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    14ae <limit_inflow_2d+0x3ae>
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1489 <limit_inflow_2d+0x389>
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    149e <limit_inflow_2d+0x39e>
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1516 <limit_inflow_2d+0x416>
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    152b <limit_inflow_2d+0x42b>
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0xa0(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
jbe    155f <limit_inflow_2d+0x45f>
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    15c2 <limit_inflow_2d+0x4c2>
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    159d <limit_inflow_2d+0x49d>
mov    0x30(%rbp),%rax
movslq 0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    15b2 <limit_inflow_2d+0x4b2>
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1615 <limit_inflow_2d+0x515>
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    162a <limit_inflow_2d+0x52a>
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1679 <limit_inflow_2d+0x579>
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    168e <limit_inflow_2d+0x58e>
mov    0x48(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x68(%rbp),%rax
movsd  (%rax),%xmm1
movq   %xmm0,%rcx
movabs $0x8000000000000000,%rdx
xor    %rdx,%rcx
movq   %rcx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x70(%rbp),%rax
movsd  (%rax),%xmm1
movq   %xmm0,%rcx
movabs $0x8000000000000000,%rdx
xor    %rdx,%rcx
movq   %rcx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    0x80(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1753 <limit_inflow_2d+0x653>
mov    0x80(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    1768 <limit_inflow_2d+0x668>
mov    0x40(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
mov    0x80(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x78(%rbp),%rax
movsd  (%rax),%xmm1
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    17af <limit_inflow_2d+0x6af>
mov    0x78(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    17c4 <limit_inflow_2d+0x6c4>
mov    0x38(%rbp),%rax
movslq 0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
mov    0x78(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limit_inflow_2d>:
push   %r15
push   %r14
push   %rbx
mov    0x58(%rsp),%r15
mov    0x50(%rsp),%r11
mov    0x48(%rsp),%r10
mov    0x40(%rsp),%r14
movslq 0x28(%rsp),%rax
mov    0x38(%rsp),%rbx
mulsd  (%rbx,%rax,8),%xmm0
cvtsi2sdl 0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    119c <limit_inflow_2d+0x9c>
mov    0x68(%rsp),%rbx
mov    0x60(%rsp),%rcx
movl   $0x1,(%rcx,%rax,4)
addsd  (%rbx),%xmm1
movsd  %xmm1,(%rbx)
add    %esi,%r9d
imul   %edx,%r9d
add    %edi,%r8d
add    %r9d,%r8d
movslq %r8d,%rcx
movsd  (%r14,%rcx,8),%xmm0
maxsd  (%r11,%rax,8),%xmm0
movsd  (%r15,%rax,8),%xmm1
minsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rax,8)
movsd  (%r14,%rcx,8),%xmm0
minsd  (%r10,%rax,8),%xmm0
maxsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rax,8)
jmp    1269 <limit_inflow_2d+0x169>
mov    0x90(%rsp),%rsi
mov    0x88(%rsp),%rdx
mov    0x80(%rsp),%rdi
mov    0x70(%rsp),%rcx
mov    0x30(%rsp),%ebx
movsd  (%rcx),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rcx)
movsd  (%r15,%rax,8),%xmm0
movslq %ebx,%rcx
movsd  (%r14,%rcx,8),%xmm2
maxsd  (%r11,%rax,8),%xmm2
minsd  %xmm2,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  (%r14,%rcx,8),%xmm2
minsd  (%r10,%rax,8),%xmm2
maxsd  %xmm2,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  (%r10,%rax,8),%xmm2
minsd  %xmm0,%xmm2
movsd  %xmm2,(%r10,%rax,8)
movsd  (%r11,%rax,8),%xmm0
maxsd  (%r15,%rax,8),%xmm0
mov    0x78(%rsp),%rcx
movsd  %xmm0,(%r11,%rax,8)
movsd  (%rcx),%xmm0
movsd  (%r10,%rax,8),%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,(%rcx)
movsd  (%rdi),%xmm0
mulsd  (%r11,%rax,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rdi)
movsd  (%rsi),%xmm0
maxsd  (%r11,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
movsd  (%rdx),%xmm0
minsd  (%r10,%rax,8),%xmm0
movsd  %xmm0,(%rdx)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @limit_inflow_2d(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, double* nocapture %9, double %10, double* nocapture %11, double* nocapture %12, double* nocapture %13, double* nocapture %14, i32* nocapture writeonly %15, double* nocapture %16, double* nocapture %17, double* nocapture %18, double* nocapture %19, double* nocapture %20, double* nocapture %21) {
%23 = sext i32 %7 to i64
%24 = getelementptr inbounds double, double* %9, i64 %23
%25 = load double, double* %24
%26 = fmul double %25, %10
%27 = sitofp i32 %6 to double
%28 = fmul double %26, %27
%29 = fcmp ogt double %28, 0.000000e+00
br i1 %29, label %30, label %56
30: ; preds = %22
%31 = getelementptr inbounds i32, i32* %15, i64 %23
store i32 1, i32* %31
%32 = load double, double* %16
%33 = fadd double %28, %32
store double %33, double* %16
%34 = add nsw i32 %5, %1
%35 = mul nsw i32 %34, %2
%36 = add i32 %4, %0
%37 = add i32 %36, %35
%38 = getelementptr inbounds double, double* %14, i64 %23
%39 = load double, double* %38
%40 = sext i32 %37 to i64
%41 = getelementptr inbounds double, double* %11, i64 %40
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %13, i64 %23
%44 = load double, double* %43
%45 = fcmp ogt double %42, %44
%46 = select i1 %45, double %42, double %44
%47 = fcmp olt double %39, %46
%48 = select i1 %47, double %39, double %46
store double %48, double* %38
%49 = load double, double* %41
%50 = getelementptr inbounds double, double* %12, i64 %23
%51 = load double, double* %50
%52 = fcmp olt double %49, %51
%53 = select i1 %52, double %49, double %51
%54 = fcmp ogt double %48, %53
%55 = select i1 %54, double %48, double %53
store double %55, double* %38
br label %99
56: ; preds = %22
%57 = load double, double* %17
%58 = fsub double %57, %28
store double %58, double* %17
%59 = getelementptr inbounds double, double* %14, i64 %23
%60 = load double, double* %59
%61 = sext i32 %8 to i64
%62 = getelementptr inbounds double, double* %11, i64 %61
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %13, i64 %23
%65 = load double, double* %64
%66 = fcmp ogt double %63, %65
%67 = select i1 %66, double %63, double %65
%68 = fcmp olt double %60, %67
%69 = select i1 %68, double %60, double %67
store double %69, double* %59
%70 = load double, double* %62
%71 = getelementptr inbounds double, double* %12, i64 %23
%72 = load double, double* %71
%73 = fcmp olt double %70, %72
%74 = select i1 %73, double %70, double %72
%75 = fcmp ogt double %69, %74
%76 = select i1 %75, double %69, double %74
store double %76, double* %59
%77 = load double, double* %71
%78 = fcmp olt double %77, %76
%79 = select i1 %78, double %77, double %76
store double %79, double* %71
%80 = load double, double* %64
%81 = load double, double* %59
%82 = fcmp ogt double %80, %81
%83 = select i1 %82, double %80, double %81
store double %83, double* %64
%84 = load double, double* %71
%85 = load double, double* %18
%86 = fneg double %28
%87 = tail call double @llvm.fmuladd.f64(double %86, double %84, double %85)
store double %87, double* %18
%88 = load double, double* %64
%89 = load double, double* %19
%90 = tail call double @llvm.fmuladd.f64(double %86, double %88, double %89)
store double %90, double* %19
%91 = load double, double* %21
%92 = load double, double* %64
%93 = fcmp ogt double %91, %92
%94 = select i1 %93, double %91, double %92
store double %94, double* %21
%95 = load double, double* %20
%96 = load double, double* %71
%97 = fcmp olt double %95, %96
%98 = select i1 %97, double %95, double %96
store double %98, double* %20
br label %99
99: ; preds = %56, %30
ret void
}