#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 */
double calc_density(double);
void tracer_mixer(double *T, int *mixdepth, int freezeflag, double *surface,
                  int numnod, double dz, double surfdz, double *cp) {
  int k, j, m;
  int mixprev;
  double avet, avev;
  double vol;
  double heatcon;
  double Tav, densnew;
  double rho_max;
  double water_density[20];
  for (k = 0; k < numnod; k++)
    water_density[k] = calc_density(T[k]);
  mixprev = 0;
  for (k = 0; k < numnod - 1; k++) {
    avet = 0.0;
    avev = 0.0;
    if (water_density[k] > water_density[k + 1]) {
      if (mixprev == 0 && (k + 1) > *mixdepth) {
        *mixdepth = k + 1;
      }
      for (m = mixprev; m <= k + 1; m++) {
        if (m == 0) {
          heatcon = surfdz * (1.e3 + water_density[m]) * cp[m] * surface[m];
          vol = surfdz * surface[m];
        } else {
          heatcon = dz * (1.e3 + water_density[m]) * cp[m] * surface[m];
          vol = dz * surface[m];
        }
        avet = avet + T[m] * heatcon;
        avev = avev + heatcon;
      }
      Tav = avet / avev;
      densnew = calc_density(Tav);
      rho_max = 0.0;
      for (j = 0; j < mixprev; j++) {
        if ((1000. + water_density[j]) > rho_max) {
          rho_max = 1000. + water_density[j];
        }
      }
      for (j = mixprev; j <= k + 1; j++) {
        T[j] = Tav;
        water_density[j] = densnew;
      }
      if (rho_max > (1000. + densnew)) {
        mixprev = 0;
        k = -1;
      }
    } else {
      mixprev = k + 1;
    }
  }
  for (k = 0; k < numnod; k++) {
    water_density[k] = calc_density(T[k]);
  }
}


x86 assembly (clang, -O0):
<tracer_mixer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    117c <tracer_mixer+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <calc_density@plt>
movslq -0x44(%rbp),%rax
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1143 <tracer_mixer+0x33>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    142c <tracer_mixer+0x31c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movslq -0x44(%rbp),%rax
movsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
mov    -0x44(%rbp),%eax
add    $0x1,%eax
cltq
ucomisd -0x130(%rbp,%rax,8),%xmm0
ff ff
jbe    1410 <tracer_mixer+0x300>
cmpl   $0x0,-0x50(%rbp)
jne    11f7 <tracer_mixer+0xe7>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jle    11f7 <tracer_mixer+0xe7>
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x50(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1306 <tracer_mixer+0x1f6>
cmpl   $0x0,-0x4c(%rbp)
jne    1271 <tracer_mixer+0x161>
movsd  -0x38(%rbp),%xmm0
movslq -0x4c(%rbp),%rax
movsd  0xdd7(%rip),%xmm1
addsd  -0x130(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12c5 <tracer_mixer+0x1b5>
movsd  -0x30(%rbp),%xmm0
movslq -0x4c(%rbp),%rax
movsd  0xd7e(%rip),%xmm1
addsd  -0x130(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x70(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x60(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11fd <tracer_mixer+0xed>
movsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1030 <calc_density@plt>
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1395 <tracer_mixer+0x285>
movslq -0x48(%rbp),%rax
movsd  0xcb2(%rip),%xmm0
addsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
ucomisd -0x88(%rbp),%xmm0
ff
jbe    1382 <tracer_mixer+0x272>
movslq -0x48(%rbp),%rax
movsd  0xc8f(%rip),%xmm0
addsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1387 <tracer_mixer+0x277>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1336 <tracer_mixer+0x226>
mov    -0x50(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     13de <tracer_mixer+0x2ce>
movsd  -0x78(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
movslq -0x48(%rbp),%rax
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    139b <tracer_mixer+0x28b>
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xc12(%rip),%xmm1
addsd  -0x80(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    140b <tracer_mixer+0x2fb>
movl   $0x0,-0x50(%rbp)
movl   $0xffffffff,-0x44(%rbp)
jmp    1419 <tracer_mixer+0x309>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    141e <tracer_mixer+0x30e>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    118a <tracer_mixer+0x7a>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    146c <tracer_mixer+0x35c>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <calc_density@plt>
movslq -0x44(%rbp),%rax
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1433 <tracer_mixer+0x323>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tracer_mixer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
movsd  %xmm1,0x68(%rsp)
mov    %rsi,0x18(%rsp)
test   %r8d,%r8d
jle    152a <tracer_mixer+0x41a>
mov    %r8d,%r14d
mov    %rdi,%r12
mov    %rcx,0x50(%rsp)
movsd  %xmm0,0x58(%rsp)
mov    %r9,0x60(%rsp)
mov    %r8d,%ebp
xor    %ebx,%ebx
movsd  (%r12,%rbx,8),%xmm0
call   1030 <calc_density@plt>
movsd  %xmm0,0x70(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <tracer_mixer+0x40>
mov    %rbp,0x48(%rsp)
mov    %r14,0x10(%rsp)
cmp    $0x2,%r14d
jl     1500 <tracer_mixer+0x3f0>
mov    0x10(%rsp),%rax
lea    -0x1(%rax),%ebx
lea    0x70(%r12),%rax
mov    %rax,0x38(%rsp)
lea    0x10(%r12),%rax
mov    %rax,0x40(%rsp)
xor    %r15d,%r15d
movsd  0xe63(%rip),%xmm5
xor    %r14d,%r14d
mov    %ebx,0xc(%rsp)
jmp    11c0 <tracer_mixer+0xb0>
xchg   %ax,%ax
mov    %r13d,%r14d
add    $0x1,%r15d
cmp    %ebx,%r15d
jge    1500 <tracer_mixer+0x3f0>
movslq %r15d,%rax
movsd  0x70(%rsp,%rax,8),%xmm0
lea    0x1(%rax),%r13d
ucomisd 0x78(%rsp,%rax,8),%xmm0
jbe    11b0 <tracer_mixer+0xa0>
test   %r14d,%r14d
jne    11f0 <tracer_mixer+0xe0>
mov    0x18(%rsp),%rax
cmp    (%rax),%r15d
jl     11f0 <tracer_mixer+0xe0>
mov    0x18(%rsp),%rax
mov    %r13d,(%rax)
nopl   0x0(%rax)
movsd  0xe08(%rip),%xmm0
cmp    %r13d,%r14d
jg     12a8 <tracer_mixer+0x198>
movsd  0x70(%rsp),%xmm6
addsd  %xmm5,%xmm6
mulsd  0x68(%rsp),%xmm6
movslq %r14d,%rdi
lea    (%r12,%rdi,8),%rax
lea    0x70(%rsp,%rdi,8),%r8
mov    0x60(%rsp),%r10
lea    (%r10,%rdi,8),%r9
mov    0x50(%rsp),%rdx
lea    (%rdx,%rdi,8),%rsi
neg    %rdi
mov    %r15d,%ebp
sub    %r14d,%ebp
add    $0x2,%ebp
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
movsd  0x58(%rsp),%xmm4
jmp    1288 <tracer_mixer+0x178>
nopl   (%rax)
movsd  (%r8,%rbx,8),%xmm2
addsd  %xmm5,%xmm2
mulsd  %xmm4,%xmm2
mulsd  (%r9,%rbx,8),%xmm2
mov    %rsi,%rcx
mulsd  (%rcx),%xmm2
movsd  (%rax,%rbx,8),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm3,%xmm0
addsd  %xmm2,%xmm1
add    $0x1,%rbx
add    $0x8,%rsi
cmp    %ebx,%ebp
je     12a0 <tracer_mixer+0x190>
cmp    %rbx,%rdi
jne    1250 <tracer_mixer+0x140>
movsd  (%r10),%xmm2
mulsd  %xmm6,%xmm2
mov    %rdx,%rcx
jmp    1267 <tracer_mixer+0x157>
nopl   0x0(%rax,%rax,1)
divsd  %xmm1,%xmm0
mov    0xc(%rsp),%ebx
movapd %xmm0,0x20(%rsp)
call   1030 <calc_density@plt>
test   %r14d,%r14d
jle    12e0 <tracer_mixer+0x1d0>
mov    %r14d,%ecx
lea    -0x1(%rcx),%rdx
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%rdx
jae    12f7 <tracer_mixer+0x1e7>
xorpd  %xmm2,%xmm2
xor    %edx,%edx
movsd  0xd30(%rip),%xmm5
movapd 0x20(%rsp),%xmm4
jmp    1357 <tracer_mixer+0x247>
xorpd  %xmm1,%xmm1
movsd  0xd1c(%rip),%xmm5
movapd 0x20(%rsp),%xmm4
jmp    138a <tracer_mixer+0x27a>
and    $0xfffffffc,%ecx
xorpd  %xmm2,%xmm2
xor    %edx,%edx
movsd  0xd00(%rip),%xmm5
movapd 0x20(%rsp),%xmm4
xchg   %ax,%ax
movsd  0x70(%rsp,%rdx,8),%xmm1
addsd  %xmm5,%xmm1
maxsd  %xmm2,%xmm1
movsd  0x78(%rsp,%rdx,8),%xmm2
addsd  %xmm5,%xmm2
maxsd  %xmm1,%xmm2
movsd  0x80(%rsp,%rdx,8),%xmm1
addsd  %xmm5,%xmm1
maxsd  %xmm2,%xmm1
movsd  0x88(%rsp,%rdx,8),%xmm2
addsd  %xmm5,%xmm2
maxsd  %xmm1,%xmm2
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    1310 <tracer_mixer+0x200>
movapd %xmm2,%xmm1
test   %rax,%rax
je     138a <tracer_mixer+0x27a>
lea    (%rsp,%rdx,8),%rcx
add    $0x70,%rcx
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movsd  (%rcx,%rdx,8),%xmm1
addsd  %xmm5,%xmm1
maxsd  %xmm2,%xmm1
add    $0x1,%rdx
movapd %xmm1,%xmm2
cmp    %rdx,%rax
jne    1370 <tracer_mixer+0x260>
cmp    %r13d,%r14d
jg     14e4 <tracer_mixer+0x3d4>
movslq %r14d,%rax
mov    %r15d,%ecx
sub    %r14d,%ecx
add    $0x1,%ecx
cmp    $0x3,%ecx
jb     14bb <tracer_mixer+0x3ab>
add    $0x1,%rcx
mov    %rcx,%r8
and    $0xfffffffffffffffc,%r8
movapd %xmm4,%xmm2
unpcklpd %xmm4,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
lea    -0x4(%r8),%rdx
mov    %rdx,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%esi
and    $0x3,%esi
cmp    $0xc,%rdx
jae    13e4 <tracer_mixer+0x2d4>
xor    %ebp,%ebp
jmp    1468 <tracer_mixer+0x358>
and    $0xfffffffffffffffc,%rdi
lea    0xe0(%rsp),%rdx
lea    (%rdx,%rax,8),%rbx
mov    0x38(%rsp),%rdx
lea    (%rdx,%rax,8),%rdx
xor    %ebp,%ebp
nop
movupd %xmm2,-0x70(%rdx,%rbp,8)
movupd %xmm2,-0x60(%rdx,%rbp,8)
movupd %xmm3,-0x70(%rbx,%rbp,8)
movupd %xmm3,-0x60(%rbx,%rbp,8)
movupd %xmm2,-0x50(%rdx,%rbp,8)
movupd %xmm2,-0x40(%rdx,%rbp,8)
movupd %xmm3,-0x50(%rbx,%rbp,8)
movupd %xmm3,-0x40(%rbx,%rbp,8)
movupd %xmm2,-0x30(%rdx,%rbp,8)
movupd %xmm2,-0x20(%rdx,%rbp,8)
movupd %xmm3,-0x30(%rbx,%rbp,8)
movupd %xmm3,-0x20(%rbx,%rbp,8)
movupd %xmm2,-0x10(%rdx,%rbp,8)
movupd %xmm2,(%rdx,%rbp,8)
movupd %xmm3,-0x10(%rbx,%rbp,8)
movupd %xmm3,(%rbx,%rbp,8)
add    $0x10,%rbp
add    $0xfffffffffffffffc,%rdi
jne    1400 <tracer_mixer+0x2f0>
test   %rsi,%rsi
je     14af <tracer_mixer+0x39f>
add    %rax,%rbp
lea    0xe0(%rsp),%rdx
lea    (%rdx,%rbp,8),%rdx
add    $0xffffffffffffffa0,%rdx
mov    0x40(%rsp),%rdi
lea    (%rdi,%rbp,8),%rdi
shl    $0x5,%rsi
xor    %ebp,%ebp
nop
movupd %xmm2,-0x10(%rdi,%rbp,1)
movupd %xmm2,(%rdi,%rbp,1)
movupd %xmm3,-0x10(%rdx,%rbp,1)
movupd %xmm3,(%rdx,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%rsi
jne    1490 <tracer_mixer+0x380>
cmp    %r8,%rcx
mov    0xc(%rsp),%ebx
je     14e4 <tracer_mixer+0x3d4>
add    %r8,%rax
lea    0x2(%r15),%ecx
mov    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm4,(%r12,%rax,8)
movsd  %xmm0,0x70(%rsp,%rax,8)
add    $0x1,%rax
cmp    %eax,%ecx
jne    14d0 <tracer_mixer+0x3c0>
addsd  %xmm5,%xmm0
ucomisd %xmm0,%xmm1
jbe    11b3 <tracer_mixer+0xa3>
mov    $0xffffffff,%r15d
xor    %r14d,%r14d
jmp    11b3 <tracer_mixer+0xa3>
cmpl   $0x0,0x10(%rsp)
mov    0x48(%rsp),%rbp
jle    152a <tracer_mixer+0x41a>
xor    %ebx,%ebx
xchg   %ax,%ax
movsd  (%r12,%rbx,8),%xmm0
call   1030 <calc_density@plt>
movsd  %xmm0,0x70(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1510 <tracer_mixer+0x400>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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