#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*/ eddy(int, double, double *, double *, double *, double, int,
                        double, double);
int /*<<< orphan*/ energycalc(double *, double *, int, double, double, double *,
                              double *, double *);
double exp(int);
double fabs(double);
int /*<<< orphan*/ temp_area(double, double, int, double *, double *, double *,
                             double *, double, double *, int, double, double,
                             double *, double *, double *);
int /*<<< orphan*/ tracer_mixer(double *, int *, int, double *, int, double,
                                double, double *);
int water_under_ice(int freezeflag, double sw_ice, double wind, double *Ti,
                    double *water_density, double lat, int numnod, double dz,
                    double surfdz, double Tcutoff, double *qw, double *surface,
                    double *deltaH, double *water_cp, int mixdepth, double hice,
                    double sdepth, double dt, double *energy_out_bottom) {
  double Tnew[20];
  int k;
  int iterations;
  double jouleold;
  double joulenew;
  double error;
  double de[20];
  double epsilon = 0.0001;
  double qw_init, qw_mean, qw_final;
  double sw_underice_visible, sw_underice_nir;
  iterations = 0;
  for (k = 0; k < numnod; k++)
    Tnew[k] = Ti[k];
  eddy(freezeflag, wind, Ti, water_density, de, lat, numnod, dz, surfdz);
  qw_init = 0.57 * (Ti[0] - Tcutoff) / (surfdz / 2.);
  *qw = qw_init;
  qw_mean = -999.;
  energycalc(Ti, &jouleold, numnod, dz, surfdz, surface, water_cp,
             water_density);
  while ((fabs(qw_mean - *qw) > epsilon) && iterations < 50) {
    if (iterations == 0)
      *qw = qw_init;
    else
      *qw = qw_mean;
    sw_underice_visible = 0.7 * sw_ice * exp(-1. * (1.5 * hice + 6.0 * sdepth));
    sw_underice_nir = 0.3 * sw_ice * exp(-1. * (20 * hice + 20 * sdepth));
    temp_area(sw_underice_visible, sw_underice_nir, -1. * (*qw), Ti, Tnew,
              water_density, de, dt, surface, numnod, dz, surfdz, &joulenew,
              water_cp, energy_out_bottom);
    *deltaH = (joulenew - jouleold) / (surface[0] * dt * 3600);
    tracer_mixer(Tnew, &mixdepth, freezeflag, surface, numnod, dz, surfdz,
                 water_cp);
    qw_final = 0.57 * (Tnew[0] - Tcutoff) / (surfdz / 2.);
    qw_mean = (qw_final + *qw) / 2.;
    iterations += 1;
  }
  if (fabs(qw_mean - *qw) <= epsilon) {
    for (k = 0; k < numnod; k++)
      Ti[k] = Tnew[k];
    *qw = qw_mean;
    return (0);
  } else {
    *qw = 0.0;
    for (k = 0; k < numnod; k++)
      Ti[k] = Tcutoff;
    energycalc(Ti, &joulenew, numnod, dz, surfdz, surface, water_cp,
               water_density);
    *deltaH = (joulenew - jouleold) / (surface[0] * dt * 3600);
    return (0);
  }
}


x86 assembly (clang, -O0):
<water_under_ice>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x248,%rsp
mov    0x30(%rbp),%rax
movsd  0x28(%rbp),%xmm8
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
mov    %ecx,-0x3c(%rbp)
movsd  %xmm3,-0x48(%rbp)
movsd  %xmm4,-0x50(%rbp)
movsd  %xmm5,-0x58(%rbp)
mov    %r8,-0x60(%rbp)
mov    %r9,-0x68(%rbp)
movsd  %xmm6,-0x70(%rbp)
movsd  %xmm7,-0x78(%rbp)
movsd  0xe49(%rip),%xmm0
movsd  %xmm0,-0x1e8(%rbp)
ff
movl   $0x0,-0x128(%rbp)
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1216 <water_under_ice+0xc6>
mov    -0x28(%rbp),%rax
movslq -0x124(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x124(%rbp),%rax
movsd  %xmm0,-0x120(%rbp,%rax,8)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    11d3 <water_under_ice+0x83>
mov    -0x10(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    -0x1e0(%rbp),%rcx
movsd  -0x38(%rbp),%xmm1
mov    -0x3c(%rbp),%r8d
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
call   1060 <eddy@plt>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
subsd  -0x58(%rbp),%xmm1
movsd  0xdbe(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xda5(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x1f0(%rbp)
ff
movsd  -0x1f0(%rbp),%xmm0
ff
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd75(%rip),%xmm0
movsd  %xmm0,-0x1f8(%rbp)
ff
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%edx
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mov    -0x68(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    -0x130(%rbp),%rsi
call   1030 <energycalc@plt>
movsd  -0x1f8(%rbp),%xmm0
ff
mov    -0x60(%rbp),%rax
subsd  (%rax),%xmm0
movaps 0xd85(%rip),%xmm1
pand   %xmm1,%xmm0
xor    %eax,%eax
ucomisd -0x1e8(%rbp),%xmm0
ff
mov    %al,-0x211(%rbp)
jbe    1305 <water_under_ice+0x1b5>
cmpl   $0x32,-0x128(%rbp)
setl   %al
mov    %al,-0x211(%rbp)
mov    -0x211(%rbp),%al
test   $0x1,%al
jne    1318 <water_under_ice+0x1c8>
jmp    1552 <water_under_ice+0x402>
cmpl   $0x0,-0x128(%rbp)
jne    133a <water_under_ice+0x1ea>
movsd  -0x1f0(%rbp),%xmm0
ff
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    134a <water_under_ice+0x1fa>
movsd  -0x1f8(%rbp),%xmm0
ff
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xcfe(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x228(%rbp)
ff
movsd  -0x70(%rbp),%xmm1
movsd  0xcdc(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xcc7(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc9f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x228(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
movsd  0xc83(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x220(%rbp)
ff
movsd  -0x70(%rbp),%xmm1
movsd  0xc61(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xc54(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc3c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x220(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
movsd  -0x208(%rbp),%xmm0
ff
movsd  -0x210(%rbp),%xmm1
ff
mov    -0x60(%rbp),%rax
movsd  0xbfc(%rip),%xmm2
mulsd  (%rax),%xmm2
cvttsd2si %xmm2,%edi
mov    -0x28(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    -0x1e0(%rbp),%r8
movsd  0x28(%rbp),%xmm2
mov    -0x68(%rbp),%r9
mov    -0x3c(%rbp),%ebx
movsd  -0x48(%rbp),%xmm3
movsd  -0x50(%rbp),%xmm4
mov    0x18(%rbp),%r10
mov    0x30(%rbp),%rax
lea    -0x138(%rbp),%r11
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1050 <temp_area@plt>
movsd  -0x138(%rbp),%xmm0
ff
subsd  -0x130(%rbp),%xmm0
ff
mov    -0x68(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  0x28(%rbp),%xmm1
movsd  0xb75(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%edx
mov    -0x68(%rbp),%rcx
mov    -0x3c(%rbp),%r8d
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mov    0x18(%rbp),%r9
lea    0x20(%rbp),%rsi
call   1070 <tracer_mixer@plt>
movsd  -0x120(%rbp),%xmm1
ff
subsd  -0x58(%rbp),%xmm1
movsd  0xb1f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xb06(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x200(%rbp)
ff
movsd  -0x200(%rbp),%xmm0
ff
mov    -0x60(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0xade(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x1f8(%rbp)
ff
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    12c4 <water_under_ice+0x174>
movsd  -0x1f8(%rbp),%xmm1
ff
mov    -0x60(%rbp),%rax
subsd  (%rax),%xmm1
movaps 0xaf7(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x1e8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jb     15e8 <water_under_ice+0x498>
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    15cc <water_under_ice+0x47c>
movslq -0x124(%rbp),%rax
movsd  -0x120(%rbp,%rax,8),%xmm0
ff ff
mov    -0x28(%rbp),%rax
movslq -0x124(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    1589 <water_under_ice+0x439>
movsd  -0x1f8(%rbp),%xmm0
ff
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0xc(%rbp)
jmp    169a <water_under_ice+0x54a>
mov    -0x60(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1635 <water_under_ice+0x4e5>
movsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x124(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    15fd <water_under_ice+0x4ad>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%edx
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mov    -0x68(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    -0x138(%rbp),%rsi
call   1030 <energycalc@plt>
movsd  -0x138(%rbp),%xmm0
ff
subsd  -0x130(%rbp),%xmm0
ff
mov    -0x68(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  0x28(%rbp),%xmm1
movsd  0x99d(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x248,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<water_under_ice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8,%rsp
movsd  %xmm7,0x28(%rsp)
movaps %xmm6,0x80(%rsp)
mov    %r9,0x40(%rsp)
mov    %r8,0x20(%rsp)
movaps %xmm5,0x70(%rsp)
movsd  %xmm4,(%rsp)
movsd  %xmm3,0x10(%rsp)
mov    %ecx,%r15d
mov    %rdx,0x48(%rsp)
mov    %rsi,%rbx
movsd  %xmm0,0x38(%rsp)
mov    %edi,0x1c(%rsp)
test   %ecx,%ecx
jle    11e1 <water_under_ice+0x81>
mov    %r15d,%edx
shl    $0x3,%rdx
lea    0xa0(%rsp),%rdi
mov    %rbx,%rsi
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x30(%rsp)
call   1040 <memcpy@plt>
movsd  0x30(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
lea    0x140(%rsp),%rcx
mov    0x1c(%rsp),%edi
movaps %xmm1,%xmm0
mov    %rbx,%rsi
mov    0x48(%rsp),%r12
mov    %r12,%rdx
movaps %xmm2,%xmm1
mov    %r15d,%r8d
movsd  0x10(%rsp),%xmm2
movsd  (%rsp),%xmm3
call   1070 <eddy@plt>
movsd  (%rbx),%xmm0
subsd  0x70(%rsp),%xmm0
mulsd  0xddd(%rip),%xmm0
movsd  0xddd(%rip),%xmm2
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x98(%rsp)
divsd  %xmm2,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    0x20(%rsp),%rbp
movsd  %xmm0,0x0(%rbp)
lea    0x68(%rsp),%rsi
mov    %rbx,%rdi
mov    %r15,0x8(%rsp)
mov    %r15d,%edx
movsd  0x10(%rsp),%xmm0
mov    0x40(%rsp),%rcx
mov    0x228(%rsp),%r8
mov    %r12,%r9
call   1030 <energycalc@plt>
movsd  0xd8c(%rip),%xmm2
movapd %xmm2,%xmm0
subsd  0x0(%rbp),%xmm0
andpd  0xdbb(%rip),%xmm0
ucomisd 0xd7b(%rip),%xmm0
jbe    14c7 <water_under_ice+0x367>
movsd  0xd75(%rip),%xmm0
movsd  0x38(%rsp),%xmm2
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x90(%rsp)
movsd  0xd62(%rip),%xmm0
movsd  0x28(%rsp),%xmm4
mulsd  %xmm4,%xmm0
movsd  0xd58(%rip),%xmm1
movapd 0x80(%rsp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
movapd 0xd6f(%rip),%xmm0
xorpd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
mov    %eax,0x5c(%rsp)
mulsd  0xd33(%rip),%xmm2
movsd  %xmm2,0x38(%rsp)
movsd  0xd2d(%rip),%xmm1
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm3
xorpd  %xmm0,%xmm3
cvttsd2si %xmm3,%eax
mov    %eax,0x28(%rsp)
movsd  0xcdd(%rip),%xmm2
xor    %r12d,%r12d
mov    %rbx,0x60(%rsp)
mov    0x20(%rsp),%rbp
mov    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x30(%rsp),%xmm0
test   %r12d,%r12d
je     135f <water_under_ice+0x1ff>
movapd %xmm2,%xmm0
movsd  %xmm0,0x0(%rbp)
mov    0x5c(%rsp),%edi
call   1050 <exp@plt>
mulsd  0x90(%rsp),%xmm0
movsd  %xmm0,0x80(%rsp)
mov    0x28(%rsp),%edi
call   1050 <exp@plt>
movapd %xmm0,%xmm1
mulsd  0x38(%rsp),%xmm1
movsd  0x0(%rbp),%xmm0
xorpd  0xcc1(%rip),%xmm0
cvttsd2si %xmm0,%edi
movsd  0x80(%rsp),%xmm0
mov    %rbx,%rsi
lea    0xa0(%rsp),%r14
mov    %r14,%rdx
mov    0x48(%rsp),%rcx
lea    0x140(%rsp),%r8
movsd  0x238(%rsp),%xmm2
mov    0x40(%rsp),%rbx
mov    %rbx,%r9
movsd  0x10(%rsp),%xmm3
movsd  (%rsp),%xmm4
push   0x240(%rsp)
mov    0x230(%rsp),%r15
push   %r15
lea    0x60(%rsp),%rax
push   %rax
push   %r13
call   1060 <temp_area@plt>
add    $0x20,%rsp
movsd  0x50(%rsp),%xmm0
subsd  0x68(%rsp),%xmm0
movsd  (%rbx),%xmm1
mulsd  0x238(%rsp),%xmm1
mulsd  0xc22(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    0x220(%rsp),%rax
movsd  %xmm0,(%rax)
mov    %r14,%rdi
lea    0x230(%rsp),%rsi
mov    0x1c(%rsp),%edx
mov    %rbx,%rcx
mov    %r13d,%r8d
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    %r15,%r9
call   1080 <tracer_mixer@plt>
movsd  0xa0(%rsp),%xmm2
subsd  0x70(%rsp),%xmm2
mulsd  0xb8b(%rip),%xmm2
divsd  0x98(%rsp),%xmm2
movsd  0x0(%rbp),%xmm1
addsd  %xmm1,%xmm2
mulsd  0xb79(%rip),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
andpd  0xbb1(%rip),%xmm0
ucomisd 0xb71(%rip),%xmm0
jbe    14c2 <water_under_ice+0x362>
lea    0x1(%r12),%eax
cmp    $0x31,%r12d
mov    %eax,%r12d
mov    0x60(%rsp),%rbx
jb     1350 <water_under_ice+0x1f0>
jmp    14c7 <water_under_ice+0x367>
mov    0x60(%rsp),%rbx
movsd  0xb49(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1502 <water_under_ice+0x3a2>
mov    0x20(%rsp),%rax
movq   $0x0,(%rax)
mov    0x8(%rsp),%rdx
test   %edx,%edx
movapd 0x70(%rsp),%xmm1
jle    163e <water_under_ice+0x4de>
mov    %edx,%eax
cmp    $0x4,%edx
jae    1539 <water_under_ice+0x3d9>
xor    %ecx,%ecx
jmp    1630 <water_under_ice+0x4d0>
mov    0x8(%rsp),%rax
test   %eax,%eax
jle    152b <water_under_ice+0x3cb>
mov    %eax,%edx
shl    $0x3,%rdx
lea    0xa0(%rsp),%rsi
mov    %rbx,%rdi
movsd  %xmm2,(%rsp)
call   1040 <memcpy@plt>
movsd  (%rsp),%xmm2
mov    0x20(%rsp),%rax
movsd  %xmm2,(%rax)
jmp    169c <water_under_ice+0x53c>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm1,%xmm0
unpcklpd %xmm1,%xmm0
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%ebp
and    $0x7,%ebp
cmp    $0x1c,%rdi
jae    1567 <water_under_ice+0x407>
xor    %edi,%edi
jmp    15f5 <water_under_ice+0x495>
and    $0xfffffffffffffff8,%rsi
xor    %edi,%edi
nopl   (%rax)
movupd %xmm0,(%rbx,%rdi,8)
movupd %xmm0,0x10(%rbx,%rdi,8)
movupd %xmm0,0x20(%rbx,%rdi,8)
movupd %xmm0,0x30(%rbx,%rdi,8)
movupd %xmm0,0x40(%rbx,%rdi,8)
movupd %xmm0,0x50(%rbx,%rdi,8)
movupd %xmm0,0x60(%rbx,%rdi,8)
movupd %xmm0,0x70(%rbx,%rdi,8)
movupd %xmm0,0x80(%rbx,%rdi,8)
movupd %xmm0,0x90(%rbx,%rdi,8)
movupd %xmm0,0xa0(%rbx,%rdi,8)
movupd %xmm0,0xb0(%rbx,%rdi,8)
movupd %xmm0,0xc0(%rbx,%rdi,8)
movupd %xmm0,0xd0(%rbx,%rdi,8)
movupd %xmm0,0xe0(%rbx,%rdi,8)
movupd %xmm0,0xf0(%rbx,%rdi,8)
add    $0x20,%rdi
add    $0xfffffffffffffff8,%rsi
jne    1570 <water_under_ice+0x410>
test   %rbp,%rbp
je     1624 <water_under_ice+0x4c4>
lea    (%rbx,%rdi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%rbp
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movupd %xmm0,-0x10(%rsi,%rdi,1)
movupd %xmm0,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rbp
jne    1610 <water_under_ice+0x4b0>
cmp    %rax,%rcx
je     163e <water_under_ice+0x4de>
nopl   0x0(%rax)
movsd  %xmm1,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1630 <water_under_ice+0x4d0>
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    0x40(%rsp),%rbx
mov    %rbx,%rcx
mov    0x228(%rsp),%r8
mov    0x48(%rsp),%r9
call   1030 <energycalc@plt>
movsd  0x50(%rsp),%xmm0
subsd  0x68(%rsp),%xmm0
movsd  0x238(%rsp),%xmm1
mulsd  (%rbx),%xmm1
mulsd  0x9bc(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    0x220(%rsp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x1e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @water_under_ice(i32 %0, double %1, double %2, double* %3, double* %4, double %5, i32 %6, double %7, double %8, double %9, double* nocapture %10, double* %11, double* nocapture writeonly %12, double* %13, i32 %14, double %15, double %16, double %17, double* %18) {
%20 = bitcast double* %3 to i8*
%21 = alloca i32
%22 = alloca [20 x double]
%23 = bitcast [20 x double]* %22 to i8*
%24 = alloca double
%25 = alloca double
%26 = alloca [20 x double]
store i32 %14, i32* %21
%27 = bitcast double* %24 to i8*
%28 = bitcast double* %25 to i8*
%29 = bitcast [20 x double]* %26 to i8*
%30 = icmp sgt i32 %6, 0
br i1 %30, label %31, label %34
31: ; preds = %19
%32 = zext i32 %6 to i64
%33 = shl nuw nsw i64 %32, 3
br label %34
34: ; preds = %31, %19
%35 = getelementptr inbounds [20 x double], [20 x double]* %26, i64 0, i64 0
%36 = call i32 @eddy(i32 %0, double %2, double* %3, double* %4, double* %35, double %5, i32 %6, double %7, double %8)
%37 = load double, double* %3
%38 = fsub double %37, %9
%39 = fmul double %38, 5.700000e-01
%40 = fmul double %8, 5.000000e-01
%41 = fdiv double %39, %40
store double %41, double* %10
%42 = call i32 @energycalc(double* %3, double* %24, i32 %6, double %7, double %8, double* %11, double* %13, double* %4)
%43 = load double, double* %10
%44 = fsub double -9.990000e+02, %43
%45 = call double @llvm.fabs.f64(double %44)
%46 = fcmp ogt double %45, 1.000000e-04
br i1 %46, label %47, label %93
47: ; preds = %34
%48 = fmul double %1, 0x3FE6666666666666
%49 = fmul double %16, 6.000000e+00
%50 = call double @llvm.fmuladd.f64(double %15, double 1.500000e+00, double %49)
%51 = fneg double %50
%52 = fptosi double %51 to i32
%53 = fmul double %1, 3.000000e-01
%54 = fmul double %16, 2.000000e+01
%55 = call double @llvm.fmuladd.f64(double %15, double 2.000000e+01, double %54)
%56 = fneg double %55
%57 = fptosi double %56 to i32
%58 = getelementptr inbounds [20 x double], [20 x double]* %22, i64 0, i64 0
br label %59
59: ; preds = %47, %59
%60 = phi i32 [ 0, %47 ], [ %87, %59 ]
%61 = phi double [ -9.990000e+02, %47 ], [ %86, %59 ]
%62 = icmp eq i32 %60, 0
%63 = select i1 %62, double %41, double %61
store double %63, double* %10
%64 = call double @exp(i32 %52)
%65 = fmul double %48, %64
%66 = call double @exp(i32 %57)
%67 = fmul double %53, %66
%68 = load double, double* %10
%69 = fneg double %68
%70 = fptosi double %69 to i32
%71 = call i32 @temp_area(double %65, double %67, i32 %70, double* %3, double* %58, double* %4, double* %35, double %17, double* %11, i32 %6, double %7, double %8, double* %25, double* %13, double* %18)
%72 = load double, double* %25
%73 = load double, double* %24
%74 = fsub double %72, %73
%75 = load double, double* %11
%76 = fmul double %75, %17
%77 = fmul double %76, 3.600000e+03
%78 = fdiv double %74, %77
store double %78, double* %12
%79 = call i32 @tracer_mixer(double* %58, i32* %21, i32 %0, double* %11, i32 %6, double %7, double %8, double* %13)
%80 = load double, double* %58
%81 = fsub double %80, %9
%82 = fmul double %81, 5.700000e-01
%83 = fdiv double %82, %40
%84 = load double, double* %10
%85 = fadd double %84, %83
%86 = fmul double %85, 5.000000e-01
%87 = add nuw nsw i32 %60, 1
%88 = fsub double %86, %84
%89 = call double @llvm.fabs.f64(double %88)
%90 = fcmp ogt double %89, 1.000000e-04
%91 = icmp ult i32 %60, 49
%92 = select i1 %90, i1 %91, i1 false
br i1 %92, label %59, label %93
93: ; preds = %59, %34
%94 = phi double [ -9.990000e+02, %34 ], [ %86, %59 ]
%95 = phi double [ %45, %34 ], [ %89, %59 ]
%96 = fcmp ugt double %95, 1.000000e-04
br i1 %96, label %102, label %97
97: ; preds = %93
br i1 %30, label %98, label %101
98: ; preds = %97
%99 = zext i32 %6 to i64
%100 = shl nuw nsw i64 %99, 3
br label %101
101: ; preds = %98, %97
store double %94, double* %10
br label %195
102: ; preds = %93
store double 0.000000e+00, double* %10
br i1 %30, label %103, label %186
103: ; preds = %102
%104 = zext i32 %6 to i64
%105 = icmp ult i32 %6, 4
br i1 %105, label %179, label %106
106: ; preds = %103
%107 = and i64 %104, 4294967292
%108 = insertelement <2 x double> poison, double %9, i64 0
%109 = shufflevector <2 x double> %108, <2 x double> poison, <2 x i32> zeroinitializer
%110 = insertelement <2 x double> poison, double %9, i64 0
%111 = shufflevector <2 x double> %110, <2 x double> poison, <2 x i32> zeroinitializer
%112 = add nsw i64 %107, -4
%113 = lshr exact i64 %112, 2
%114 = add nuw nsw i64 %113, 1
%115 = and i64 %114, 7
%116 = icmp ult i64 %112, 28
br i1 %116, label %164, label %117
117: ; preds = %106
%118 = and i64 %114, 9223372036854775800
br label %119
119: ; preds = %119, %117
%120 = phi i64 [ 0, %117 ], [ %161, %119 ]
%121 = phi i64 [ 0, %117 ], [ %162, %119 ]
%122 = getelementptr inbounds double, double* %3, i64 %120
%123 = bitcast double* %122 to <2 x double>*
store <2 x double> %109, <2 x double>* %123
%124 = getelementptr inbounds double, double* %122, i64 2
%125 = bitcast double* %124 to <2 x double>*
store <2 x double> %111, <2 x double>* %125
%126 = or i64 %120, 4
%127 = getelementptr inbounds double, double* %3, i64 %126
%128 = bitcast double* %127 to <2 x double>*
store <2 x double> %109, <2 x double>* %128
%129 = getelementptr inbounds double, double* %127, i64 2
%130 = bitcast double* %129 to <2 x double>*
store <2 x double> %111, <2 x double>* %130
%131 = or i64 %120, 8
%132 = getelementptr inbounds double, double* %3, i64 %131
%133 = bitcast double* %132 to <2 x double>*
store <2 x double> %109, <2 x double>* %133
%134 = getelementptr inbounds double, double* %132, i64 2
%135 = bitcast double* %134 to <2 x double>*
store <2 x double> %111, <2 x double>* %135
%136 = or i64 %120, 12
%137 = getelementptr inbounds double, double* %3, i64 %136
%138 = bitcast double* %137 to <2 x double>*
store <2 x double> %109, <2 x double>* %138
%139 = getelementptr inbounds double, double* %137, i64 2
%140 = bitcast double* %139 to <2 x double>*
store <2 x double> %111, <2 x double>* %140
%141 = or i64 %120, 16
%142 = getelementptr inbounds double, double* %3, i64 %141
%143 = bitcast double* %142 to <2 x double>*
store <2 x double> %109, <2 x double>* %143
%144 = getelementptr inbounds double, double* %142, i64 2
%145 = bitcast double* %144 to <2 x double>*
store <2 x double> %111, <2 x double>* %145
%146 = or i64 %120, 20
%147 = getelementptr inbounds double, double* %3, i64 %146
%148 = bitcast double* %147 to <2 x double>*
store <2 x double> %109, <2 x double>* %148
%149 = getelementptr inbounds double, double* %147, i64 2
%150 = bitcast double* %149 to <2 x double>*
store <2 x double> %111, <2 x double>* %150
%151 = or i64 %120, 24
%152 = getelementptr inbounds double, double* %3, i64 %151
%153 = bitcast double* %152 to <2 x double>*
store <2 x double> %109, <2 x double>* %153
%154 = getelementptr inbounds double, double* %152, i64 2
%155 = bitcast double* %154 to <2 x double>*
store <2 x double> %111, <2 x double>* %155
%156 = or i64 %120, 28
%157 = getelementptr inbounds double, double* %3, i64 %156
%158 = bitcast double* %157 to <2 x double>*
store <2 x double> %109, <2 x double>* %158
%159 = getelementptr inbounds double, double* %157, i64 2
%160 = bitcast double* %159 to <2 x double>*
store <2 x double> %111, <2 x double>* %160
%161 = add nuw i64 %120, 32
%162 = add i64 %121, 8
%163 = icmp eq i64 %162, %118
br i1 %163, label %164, label %119
164: ; preds = %119, %106
%165 = phi i64 [ 0, %106 ], [ %161, %119 ]
%166 = icmp eq i64 %115, 0
br i1 %166, label %177, label %167
167: ; preds = %164, %167
%168 = phi i64 [ %174, %167 ], [ %165, %164 ]
%169 = phi i64 [ %175, %167 ], [ 0, %164 ]
%170 = getelementptr inbounds double, double* %3, i64 %168
%171 = bitcast double* %170 to <2 x double>*
store <2 x double> %109, <2 x double>* %171
%172 = getelementptr inbounds double, double* %170, i64 2
%173 = bitcast double* %172 to <2 x double>*
store <2 x double> %111, <2 x double>* %173
%174 = add nuw i64 %168, 4
%175 = add i64 %169, 1
%176 = icmp eq i64 %175, %115
br i1 %176, label %177, label %167
177: ; preds = %167, %164
%178 = icmp eq i64 %107, %104
br i1 %178, label %186, label %179
179: ; preds = %103, %177
%180 = phi i64 [ 0, %103 ], [ %107, %177 ]
br label %181
181: ; preds = %179, %181
%182 = phi i64 [ %184, %181 ], [ %180, %179 ]
%183 = getelementptr inbounds double, double* %3, i64 %182
store double %9, double* %183
%184 = add nuw nsw i64 %182, 1
%185 = icmp eq i64 %184, %104
br i1 %185, label %186, label %181
186: ; preds = %181, %177, %102
%187 = call i32 @energycalc(double* %3, double* %25, i32 %6, double %7, double %8, double* %11, double* %13, double* %4)
%188 = load double, double* %25
%189 = load double, double* %24
%190 = fsub double %188, %189
%191 = load double, double* %11
%192 = fmul double %191, %17
%193 = fmul double %192, 3.600000e+03
%194 = fdiv double %190, %193
store double %194, double* %12
br label %195
195: ; preds = %186, %101
ret i32 0
}