#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*/ get_face_grad_2d(int, int, int, int, int, int, int, double *,
                                    double *);
int /*<<< orphan*/ get_uface_2d(int, int, int, int, int, int, int, int,
                                double *, double *);
void update_cell_2D_PTRS(
    double *sc_old, double *sc_new, double *u_buff, int iX, int iY, int nX,
    int nY, double delta_t, double alpha, int scheme,
    void (*get_face_2d_ptr)(int iX, int iY, int nX, int nY, int X_nbr,
                            int Y_nbr, int nrm, int tid, double delta_t,
                            double u_face, double dummy, double *sc_face,
                            double *sc_old)) {
  int tid;
  double sum_face_a = 0.;
  double sum_face_d = 0.;
  double u_face;
  double u_face_t = 0.;
  double sc_face;
  double sc_face_grad;
  tid = iY * nX + iX;
  get_uface_2d(iX, iY, nX, nY, 1, 0, 0, tid, &u_face, u_buff);
  if (scheme == 4 || scheme == 5 || scheme == 6)
    get_uface_2d(iX, iY, nX, nY, 1, 0, 1, tid, &u_face_t, u_buff);
  get_face_2d_ptr(iX, iY, nX, nY, 1, 0, 1, tid, delta_t, u_face, u_face_t,
                  &sc_face, sc_old);
  get_face_grad_2d(iX, iY, nX, nY, 1, 0, tid, &sc_face_grad, sc_old);
  sum_face_a += sc_face * u_face;
  sum_face_d += sc_face_grad;
  get_uface_2d(iX, iY, nX, nY, -1, 0, 0, tid, &u_face, u_buff);
  if (scheme == 4 || scheme == 5 || scheme == 6)
    get_uface_2d(iX, iY, nX, nY, -1, 0, 1, tid, &u_face_t, u_buff);
  get_face_2d_ptr(iX, iY, nX, nY, -1, 0, -1, tid, delta_t, u_face, u_face_t,
                  &sc_face, sc_old);
  get_face_grad_2d(iX, iY, nX, nY, -1, 0, tid, &sc_face_grad, sc_old);
  sum_face_a -= sc_face * u_face;
  sum_face_d += sc_face_grad;
  get_uface_2d(iX, iY, nX, nY, 0, 1, 1, tid, &u_face, u_buff);
  if (scheme == 4 || scheme == 5 || scheme == 6)
    get_uface_2d(iX, iY, nX, nY, 0, 1, 0, tid, &u_face_t, u_buff);
  get_face_2d_ptr(iX, iY, nX, nY, 0, 1, 1, tid, delta_t, u_face, u_face_t,
                  &sc_face, sc_old);
  get_face_grad_2d(iX, iY, nX, nY, 0, 1, tid, &sc_face_grad, sc_old);
  sum_face_a += sc_face * u_face;
  sum_face_d += sc_face_grad;
  get_uface_2d(iX, iY, nX, nY, 0, -1, 1, tid, &u_face, u_buff);
  if (scheme == 4 || scheme == 5 || scheme == 6)
    get_uface_2d(iX, iY, nX, nY, 0, -1, 0, tid, &u_face_t, u_buff);
  get_face_2d_ptr(iX, iY, nX, nY, 0, -1, -1, tid, delta_t, u_face, u_face_t,
                  &sc_face, sc_old);
  get_face_grad_2d(iX, iY, nX, nY, 0, -1, tid, &sc_face_grad, sc_old);
  sum_face_a -= sc_face * u_face;
  sum_face_d += sc_face_grad;
  *(sc_new + tid) =
      *(sc_old + tid) + 1. * delta_t * (1. * alpha * sum_face_d - sum_face_a);
}


x86 assembly (clang, -O0):
<update_cell_2D_PTRS>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x98,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%eax
imul   -0x2c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
mov    $0x1,%r8d
xor    %r9d,%r9d
lea    -0x60(%rbp),%r10
movl   $0x0,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
cmpl   $0x4,0x18(%rbp)
je     11d6 <update_cell_2D_PTRS+0xb6>
cmpl   $0x5,0x18(%rbp)
je     11d6 <update_cell_2D_PTRS+0xb6>
cmpl   $0x6,0x18(%rbp)
jne    1212 <update_cell_2D_PTRS+0xf2>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
mov    $0x1,%r8d
xor    %r9d,%r9d
lea    -0x68(%rbp),%r10
movl   $0x1,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
mov    0x20(%rbp),%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%ebx
movsd  -0x38(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
mov    -0x10(%rbp),%r10
mov    $0x1,%r8d
xor    %r9d,%r9d
lea    -0x70(%rbp),%r11
movl   $0x1,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
call   *%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x10(%rbp),%rax
mov    $0x1,%r8d
xor    %r9d,%r9d
lea    -0x78(%rbp),%r10
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <get_face_grad_2d@plt>
movsd  -0x70(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x78(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
lea    -0x60(%rbp),%r10
movl   $0x0,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
cmpl   $0x4,0x18(%rbp)
je     1315 <update_cell_2D_PTRS+0x1f5>
cmpl   $0x5,0x18(%rbp)
je     1315 <update_cell_2D_PTRS+0x1f5>
cmpl   $0x6,0x18(%rbp)
jne    1351 <update_cell_2D_PTRS+0x231>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
lea    -0x68(%rbp),%r10
movl   $0x1,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
mov    0x20(%rbp),%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%ebx
movsd  -0x38(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
mov    -0x10(%rbp),%r10
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
lea    -0x70(%rbp),%r11
movl   $0xffffffff,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
call   *%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x10(%rbp),%rax
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
lea    -0x78(%rbp),%r10
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <get_face_grad_2d@plt>
movsd  -0x70(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x78(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
xor    %r8d,%r8d
mov    $0x1,%r9d
lea    -0x60(%rbp),%r10
movl   $0x1,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
cmpl   $0x4,0x18(%rbp)
je     146b <update_cell_2D_PTRS+0x34b>
cmpl   $0x5,0x18(%rbp)
je     146b <update_cell_2D_PTRS+0x34b>
cmpl   $0x6,0x18(%rbp)
jne    14a7 <update_cell_2D_PTRS+0x387>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
xor    %r8d,%r8d
mov    $0x1,%r9d
lea    -0x68(%rbp),%r10
movl   $0x0,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
mov    0x20(%rbp),%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%ebx
movsd  -0x38(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
mov    -0x10(%rbp),%r10
xor    %r8d,%r8d
mov    $0x1,%r9d
lea    -0x70(%rbp),%r11
movl   $0x1,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
call   *%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x10(%rbp),%rax
xor    %r8d,%r8d
mov    $0x1,%r9d
lea    -0x78(%rbp),%r10
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <get_face_grad_2d@plt>
movsd  -0x70(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x78(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
lea    -0x60(%rbp),%r10
movl   $0x1,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
cmpl   $0x4,0x18(%rbp)
je     15aa <update_cell_2D_PTRS+0x48a>
cmpl   $0x5,0x18(%rbp)
je     15aa <update_cell_2D_PTRS+0x48a>
cmpl   $0x6,0x18(%rbp)
jne    15e6 <update_cell_2D_PTRS+0x4c6>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x20(%rbp),%rax
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
lea    -0x68(%rbp),%r10
movl   $0x0,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <get_uface_2d@plt>
mov    0x20(%rbp),%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%ebx
movsd  -0x38(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
mov    -0x10(%rbp),%r10
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
lea    -0x70(%rbp),%r11
movl   $0xffffffff,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
call   *%rax
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x44(%rbp),%r11d
mov    -0x10(%rbp),%rax
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
lea    -0x78(%rbp),%r10
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <get_face_grad_2d@plt>
movsd  -0x70(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x78(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0x945(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0x938(%rip),%xmm2
mulsd  -0x40(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_cell_2D_PTRS>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movsd  %xmm1,0x90(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    %r9d,%ebp
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %rdx,%rax
mov    %rsi,0x88(%rsp)
mov    %rdi,0x80(%rsp)
mov    0xd0(%rsp),%ecx
mov    0xd8(%rsp),%ebx
movq   $0x0,0x8(%rsp)
mov    %r9d,%r13d
imul   %r8d,%r13d
add    %r12d,%r13d
mov    %rsp,%r10
mov    %r12d,%edi
mov    %r8d,%esi
mov    %r9d,%edx
mov    $0x1,%r8d
xor    %r9d,%r9d
mov    %rax,0x10(%rsp)
push   %rax
push   %r10
push   %r13
push   $0x0
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
add    $0xfffffffc,%ebx
xorps  %xmm2,%xmm2
mov    %ebx,0x2c(%rsp)
cmp    $0x2,%ebx
ja     11eb <update_cell_2D_PTRS+0xcb>
lea    0x8(%rsp),%rax
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%ecx
mov    $0x1,%r8d
xor    %r9d,%r9d
push   0x10(%rsp)
push   %rax
push   %r13
push   $0x1
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm1
lea    0x20(%rsp),%rax
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%r14d
mov    %r14d,%ecx
mov    $0x1,%r8d
xor    %r9d,%r9d
movsd  0x30(%rsp),%xmm0
mov    0x80(%rsp),%rbx
push   %rbx
push   %rax
push   %r13
push   $0x1
call   *0x100(%rsp)
add    $0x18,%rsp
lea    0x20(%rsp),%rax
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    $0x1,%r8d
xor    %r9d,%r9d
push   %rbx
push   %rax
push   %r13
call   1040 <get_face_grad_2d@plt>
add    $0x20,%rsp
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x78(%rsp)
movsd  (%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
push   0x10(%rsp)
lea    0x8(%rsp),%rax
push   %rax
push   %r13
push   $0x0
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
cmpl   $0x2,0x2c(%rsp)
ja     12da <update_cell_2D_PTRS+0x1ba>
lea    0x8(%rsp),%rax
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
push   0x10(%rsp)
push   %rax
push   %r13
push   $0x1
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%r14d
mov    %r14d,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
movsd  0x30(%rsp),%xmm0
push   %rbx
lea    0x28(%rsp),%rax
push   %rax
push   %r13
push   $0xffffffffffffffff
call   *0x100(%rsp)
add    $0x18,%rsp
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
push   %rbx
lea    0x28(%rsp),%rax
push   %rax
push   %r13
call   1040 <get_face_grad_2d@plt>
add    $0x20,%rsp
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x68(%rsp)
movsd  (%rsp),%xmm0
movsd  %xmm0,0x60(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   0x10(%rsp)
lea    0x8(%rsp),%rax
push   %rax
push   %r13
push   $0x1
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
cmpl   $0x2,0x2c(%rsp)
ja     13c7 <update_cell_2D_PTRS+0x2a7>
lea    0x8(%rsp),%rax
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   0x10(%rsp)
push   %rax
push   %r13
push   $0x0
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%r14d
mov    %r14d,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
movsd  0x30(%rsp),%xmm0
push   %rbx
lea    0x28(%rsp),%rax
push   %rax
push   %r13
push   $0x1
call   *0x100(%rsp)
add    $0x18,%rsp
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   %rbx
lea    0x28(%rsp),%rax
push   %rax
push   %r13
call   1040 <get_face_grad_2d@plt>
add    $0x20,%rsp
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  (%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
push   0x10(%rsp)
lea    0x8(%rsp),%rax
push   %rax
push   %r13
push   $0x1
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
cmpl   $0x2,0x2c(%rsp)
ja     14b4 <update_cell_2D_PTRS+0x394>
lea    0x8(%rsp),%rax
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%ecx
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
push   0x10(%rsp)
push   %rax
push   %r13
push   $0x0
call   1030 <get_uface_2d@plt>
add    $0x20,%rsp
xorpd  %xmm0,%xmm0
movsd  0x40(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  0x58(%rsp),%xmm1
addsd  0x48(%rsp),%xmm1
movsd  %xmm1,0x40(%rsp)
movsd  0x78(%rsp),%xmm1
mulsd  0x70(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x68(%rsp),%xmm0
mulsd  0x60(%rsp),%xmm0
subsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
mulsd  0x50(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0xd0(%rsp),%r14d
mov    %r14d,%ecx
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
movsd  0x30(%rsp),%xmm0
push   %rbx
lea    0x28(%rsp),%rax
push   %rax
push   %r13
push   $0xffffffffffffffff
call   *0x100(%rsp)
add    $0x18,%rsp
mov    %r12d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %r8d,%r8d
mov    $0xffffffff,%r9d
push   %rbx
lea    0x28(%rsp),%rax
push   %rax
push   %r13
call   1040 <get_face_grad_2d@plt>
add    $0x20,%rsp
movsd  0x20(%rsp),%xmm0
mulsd  (%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
addsd  0x18(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
subsd  %xmm0,%xmm2
movslq %r13d,%rax
movsd  0x90(%rsp),%xmm0
mulsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
mulsd  0x30(%rsp),%xmm0
addsd  (%rbx,%rax,8),%xmm0
mov    0x88(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @update_cell_2D_PTRS(double* %0, double* %1, double* %2, i32 %3, i32 %4, i32 %5, i32 %6, double %7, double %8, i32 %9, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)* %10) {
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca i32
%22 = alloca void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)*
%23 = alloca i32
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
store double* %0, double** %12
store double* %1, double** %13
store double* %2, double** %14
store i32 %3, i32* %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store double %7, double* %19
store double %8, double* %20
store i32 %9, i32* %21
store void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)* %10, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)** %22
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %27
%30 = load i32, i32* %16
%31 = load i32, i32* %17
%32 = mul nsw i32 %30, %31
%33 = load i32, i32* %15
%34 = add nsw i32 %32, %33
store i32 %34, i32* %23
%35 = load i32, i32* %15
%36 = load i32, i32* %16
%37 = load i32, i32* %17
%38 = load i32, i32* %18
%39 = load i32, i32* %23
%40 = load double*, double** %14
%41 = call i32 @get_uface_2d(i32 %35, i32 %36, i32 %37, i32 %38, i32 1, i32 0, i32 0, i32 %39, double* %26, double* %40)
%42 = load i32, i32* %21
%43 = icmp eq i32 %42, 4
br i1 %43, label %50, label %44
44: ; preds = %11
%45 = load i32, i32* %21
%46 = icmp eq i32 %45, 5
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* %21
%49 = icmp eq i32 %48, 6
br i1 %49, label %50, label %58
50: ; preds = %47, %44, %11
%51 = load i32, i32* %15
%52 = load i32, i32* %16
%53 = load i32, i32* %17
%54 = load i32, i32* %18
%55 = load i32, i32* %23
%56 = load double*, double** %14
%57 = call i32 @get_uface_2d(i32 %51, i32 %52, i32 %53, i32 %54, i32 1, i32 0, i32 1, i32 %55, double* %27, double* %56)
br label %58
58: ; preds = %50, %47
%59 = load void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)*, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)** %22
%60 = load i32, i32* %15
%61 = load i32, i32* %16
%62 = load i32, i32* %17
%63 = load i32, i32* %18
%64 = load i32, i32* %23
%65 = load double, double* %19
%66 = load double, double* %26
%67 = load double, double* %27
%68 = load double*, double** %12
%69 = load i32, i32* %15
%70 = load i32, i32* %16
%71 = load i32, i32* %17
%72 = load i32, i32* %18
%73 = load i32, i32* %23
%74 = load double*, double** %12
%75 = call i32 @get_face_grad_2d(i32 %69, i32 %70, i32 %71, i32 %72, i32 1, i32 0, i32 %73, double* %29, double* %74)
%76 = load double, double* %28
%77 = load double, double* %26
%78 = load double, double* %24
%79 = call double @llvm.fmuladd.f64(double %76, double %77, double %78)
store double %79, double* %24
%80 = load double, double* %29
%81 = load double, double* %25
%82 = fadd double %81, %80
store double %82, double* %25
%83 = load i32, i32* %15
%84 = load i32, i32* %16
%85 = load i32, i32* %17
%86 = load i32, i32* %18
%87 = load i32, i32* %23
%88 = load double*, double** %14
%89 = call i32 @get_uface_2d(i32 %83, i32 %84, i32 %85, i32 %86, i32 -1, i32 0, i32 0, i32 %87, double* %26, double* %88)
%90 = load i32, i32* %21
%91 = icmp eq i32 %90, 4
br i1 %91, label %98, label %92
92: ; preds = %58
%93 = load i32, i32* %21
%94 = icmp eq i32 %93, 5
br i1 %94, label %98, label %95
95: ; preds = %92
%96 = load i32, i32* %21
%97 = icmp eq i32 %96, 6
br i1 %97, label %98, label %106
98: ; preds = %95, %92, %58
%99 = load i32, i32* %15
%100 = load i32, i32* %16
%101 = load i32, i32* %17
%102 = load i32, i32* %18
%103 = load i32, i32* %23
%104 = load double*, double** %14
%105 = call i32 @get_uface_2d(i32 %99, i32 %100, i32 %101, i32 %102, i32 -1, i32 0, i32 1, i32 %103, double* %27, double* %104)
br label %106
106: ; preds = %98, %95
%107 = load void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)*, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)** %22
%108 = load i32, i32* %15
%109 = load i32, i32* %16
%110 = load i32, i32* %17
%111 = load i32, i32* %18
%112 = load i32, i32* %23
%113 = load double, double* %19
%114 = load double, double* %26
%115 = load double, double* %27
%116 = load double*, double** %12
%117 = load i32, i32* %15
%118 = load i32, i32* %16
%119 = load i32, i32* %17
%120 = load i32, i32* %18
%121 = load i32, i32* %23
%122 = load double*, double** %12
%123 = call i32 @get_face_grad_2d(i32 %117, i32 %118, i32 %119, i32 %120, i32 -1, i32 0, i32 %121, double* %29, double* %122)
%124 = load double, double* %28
%125 = load double, double* %26
%126 = load double, double* %24
%127 = fneg double %124
%128 = call double @llvm.fmuladd.f64(double %127, double %125, double %126)
store double %128, double* %24
%129 = load double, double* %29
%130 = load double, double* %25
%131 = fadd double %130, %129
store double %131, double* %25
%132 = load i32, i32* %15
%133 = load i32, i32* %16
%134 = load i32, i32* %17
%135 = load i32, i32* %18
%136 = load i32, i32* %23
%137 = load double*, double** %14
%138 = call i32 @get_uface_2d(i32 %132, i32 %133, i32 %134, i32 %135, i32 0, i32 1, i32 1, i32 %136, double* %26, double* %137)
%139 = load i32, i32* %21
%140 = icmp eq i32 %139, 4
br i1 %140, label %147, label %141
141: ; preds = %106
%142 = load i32, i32* %21
%143 = icmp eq i32 %142, 5
br i1 %143, label %147, label %144
144: ; preds = %141
%145 = load i32, i32* %21
%146 = icmp eq i32 %145, 6
br i1 %146, label %147, label %155
147: ; preds = %144, %141, %106
%148 = load i32, i32* %15
%149 = load i32, i32* %16
%150 = load i32, i32* %17
%151 = load i32, i32* %18
%152 = load i32, i32* %23
%153 = load double*, double** %14
%154 = call i32 @get_uface_2d(i32 %148, i32 %149, i32 %150, i32 %151, i32 0, i32 1, i32 0, i32 %152, double* %27, double* %153)
br label %155
155: ; preds = %147, %144
%156 = load void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)*, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)** %22
%157 = load i32, i32* %15
%158 = load i32, i32* %16
%159 = load i32, i32* %17
%160 = load i32, i32* %18
%161 = load i32, i32* %23
%162 = load double, double* %19
%163 = load double, double* %26
%164 = load double, double* %27
%165 = load double*, double** %12
%166 = load i32, i32* %15
%167 = load i32, i32* %16
%168 = load i32, i32* %17
%169 = load i32, i32* %18
%170 = load i32, i32* %23
%171 = load double*, double** %12
%172 = call i32 @get_face_grad_2d(i32 %166, i32 %167, i32 %168, i32 %169, i32 0, i32 1, i32 %170, double* %29, double* %171)
%173 = load double, double* %28
%174 = load double, double* %26
%175 = load double, double* %24
%176 = call double @llvm.fmuladd.f64(double %173, double %174, double %175)
store double %176, double* %24
%177 = load double, double* %29
%178 = load double, double* %25
%179 = fadd double %178, %177
store double %179, double* %25
%180 = load i32, i32* %15
%181 = load i32, i32* %16
%182 = load i32, i32* %17
%183 = load i32, i32* %18
%184 = load i32, i32* %23
%185 = load double*, double** %14
%186 = call i32 @get_uface_2d(i32 %180, i32 %181, i32 %182, i32 %183, i32 0, i32 -1, i32 1, i32 %184, double* %26, double* %185)
%187 = load i32, i32* %21
%188 = icmp eq i32 %187, 4
br i1 %188, label %195, label %189
189: ; preds = %155
%190 = load i32, i32* %21
%191 = icmp eq i32 %190, 5
br i1 %191, label %195, label %192
192: ; preds = %189
%193 = load i32, i32* %21
%194 = icmp eq i32 %193, 6
br i1 %194, label %195, label %203
195: ; preds = %192, %189, %155
%196 = load i32, i32* %15
%197 = load i32, i32* %16
%198 = load i32, i32* %17
%199 = load i32, i32* %18
%200 = load i32, i32* %23
%201 = load double*, double** %14
%202 = call i32 @get_uface_2d(i32 %196, i32 %197, i32 %198, i32 %199, i32 0, i32 -1, i32 0, i32 %200, double* %27, double* %201)
br label %203
203: ; preds = %195, %192
%204 = load void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)*, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)** %22
%205 = load i32, i32* %15
%206 = load i32, i32* %16
%207 = load i32, i32* %17
%208 = load i32, i32* %18
%209 = load i32, i32* %23
%210 = load double, double* %19
%211 = load double, double* %26
%212 = load double, double* %27
%213 = load double*, double** %12
%214 = load i32, i32* %15
%215 = load i32, i32* %16
%216 = load i32, i32* %17
%217 = load i32, i32* %18
%218 = load i32, i32* %23
%219 = load double*, double** %12
%220 = call i32 @get_face_grad_2d(i32 %214, i32 %215, i32 %216, i32 %217, i32 0, i32 -1, i32 %218, double* %29, double* %219)
%221 = load double, double* %28
%222 = load double, double* %26
%223 = load double, double* %24
%224 = fneg double %221
%225 = call double @llvm.fmuladd.f64(double %224, double %222, double %223)
store double %225, double* %24
%226 = load double, double* %29
%227 = load double, double* %25
%228 = fadd double %227, %226
store double %228, double* %25
%229 = load double*, double** %12
%230 = load i32, i32* %23
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds double, double* %229, i64 %231
%233 = load double, double* %232
%234 = load double, double* %19
%235 = fmul double 1.000000e+00, %234
%236 = load double, double* %20
%237 = fmul double 1.000000e+00, %236
%238 = load double, double* %25
%239 = load double, double* %24
%240 = fneg double %239
%241 = call double @llvm.fmuladd.f64(double %237, double %238, double %240)
%242 = call double @llvm.fmuladd.f64(double %235, double %241, double %233)
%243 = load double*, double** %13
%244 = load i32, i32* %23
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %243, i64 %245
store double %242, double* %246
ret void
}

LLVM IR (-O2):
define void @update_cell_2D_PTRS(double* %0, double* nocapture writeonly %1, double* %2, i32 %3, i32 %4, i32 %5, i32 %6, double %7, double %8, i32 %9, void (i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double*, double*)* nocapture %10) {
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = bitcast double* %12 to i8*
%17 = bitcast double* %13 to i8*
store double 0.000000e+00, double* %13
%18 = bitcast double* %14 to i8*
%19 = bitcast double* %15 to i8*
%20 = mul nsw i32 %5, %4
%21 = add nsw i32 %20, %3
%22 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 1, i32 0, i32 0, i32 %21, double* %12, double* %2)
%23 = add i32 %9, -4
%24 = icmp ult i32 %23, 3
br i1 %24, label %25, label %28
25: ; preds = %11
%26 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 1, i32 0, i32 1, i32 %21, double* %13, double* %2)
%27 = load double, double* %13
br label %28
28: ; preds = %11, %25
%29 = phi double [ 0.000000e+00, %11 ], [ %27, %25 ]
%30 = load double, double* %12
%31 = call i32 @get_face_grad_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 1, i32 0, i32 %21, double* %15, double* %0)
%32 = load double, double* %14
%33 = load double, double* %12
%34 = load double, double* %15
%35 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 -1, i32 0, i32 0, i32 %21, double* %12, double* %2)
br i1 %24, label %36, label %38
36: ; preds = %28
%37 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 -1, i32 0, i32 1, i32 %21, double* %13, double* %2)
br label %38
38: ; preds = %28, %36
%39 = load double, double* %12
%40 = load double, double* %13
%41 = call i32 @get_face_grad_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 -1, i32 0, i32 %21, double* %15, double* %0)
%42 = load double, double* %14
%43 = load double, double* %12
%44 = load double, double* %15
%45 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 0, i32 1, i32 1, i32 %21, double* %12, double* %2)
br i1 %24, label %46, label %48
46: ; preds = %38
%47 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 0, i32 1, i32 0, i32 %21, double* %13, double* %2)
br label %48
48: ; preds = %38, %46
%49 = load double, double* %12
%50 = load double, double* %13
%51 = call i32 @get_face_grad_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 0, i32 1, i32 %21, double* %15, double* %0)
%52 = load double, double* %14
%53 = load double, double* %12
%54 = load double, double* %15
%55 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 0, i32 -1, i32 1, i32 %21, double* %12, double* %2)
br i1 %24, label %56, label %58
56: ; preds = %48
%57 = call i32 @get_uface_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 0, i32 -1, i32 0, i32 %21, double* %13, double* %2)
br label %58
58: ; preds = %48, %56
%59 = fadd double %34, 0.000000e+00
%60 = fadd double %59, %44
%61 = fadd double %60, %54
%62 = fneg double %42
%63 = call double @llvm.fmuladd.f64(double %32, double %33, double 0.000000e+00)
%64 = call double @llvm.fmuladd.f64(double %62, double %43, double %63)
%65 = call double @llvm.fmuladd.f64(double %52, double %53, double %64)
%66 = load double, double* %12
%67 = load double, double* %13
%68 = call i32 @get_face_grad_2d(i32 %3, i32 %4, i32 %5, i32 %6, i32 0, i32 -1, i32 %21, double* %15, double* %0)
%69 = load double, double* %14
%70 = load double, double* %12
%71 = fneg double %69
%72 = call double @llvm.fmuladd.f64(double %71, double %70, double %65)
%73 = load double, double* %15
%74 = fadd double %61, %73
%75 = sext i32 %21 to i64
%76 = getelementptr inbounds double, double* %0, i64 %75
%77 = load double, double* %76
%78 = fneg double %72
%79 = call double @llvm.fmuladd.f64(double %8, double %74, double %78)
%80 = call double @llvm.fmuladd.f64(double %7, double %79, double %77)
%81 = getelementptr inbounds double, double* %1, i64 %75
store double %80, double* %81
ret void
}