#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 */
typedef scalar_t__ uint;

/* Variables and functions */
int /*<<< orphan*/ DC(double, double *, scalar_t__ *, scalar_t__, double,
                      double, double);
double fabs(int);
double fmod(scalar_t__, double);
double pow(int, double);
void SAW(double amplitude, double frequency, double dutycycle, double *output,
         uint *index, uint Ni, double expon, double srate, double dt) {
  uint i;
  double tmp1, tmp2, tmp3, tmp4;
  if (frequency == 0.) {
    DC(amplitude / 2., output, index, Ni, expon, srate, dt);
    return;
  }
  tmp1 = (1. / frequency) / dt;
  tmp2 = (dutycycle * 0.01 * tmp1);
  tmp3 = amplitude / tmp2;
  tmp4 = amplitude / ((1. - dutycycle * 0.01) * tmp1);
  if (expon == -1)
    for (i = 0; i < Ni; i++)
      output[(*index)++] =
          fabs(2. * ((fmod(i, tmp1) <= (tmp2)) ? tmp3 * fmod(i, tmp1)
                                               : tmp4 * fmod(Ni - i, tmp1)) -
               amplitude);
  else if (expon == 0)
    for (i = 0; i < Ni; i++)
      output[(*index)++] =
          (((2. * ((fmod(i, tmp1) <= (tmp2)) ? tmp3 * fmod(i, tmp1)
                                             : tmp4 * fmod(Ni - i, tmp1)) -
             amplitude) > 0)
               ? 2. * ((fmod(i, tmp1) <= (tmp2)) ? tmp3 * fmod(i, tmp1)
                                                 : tmp4 * fmod(Ni - i, tmp1)) -
                     amplitude
               : 0.);
  else if (expon != 1)
    for (i = 0; i < Ni; i++)
      output[(*index)++] =
          pow(2. * ((fmod(i, tmp1) <= (tmp2)) ? tmp3 * fmod(i, tmp1)
                                              : tmp4 * fmod(Ni - i, tmp1)) -
                  amplitude,
              expon);
  else
    for (i = 0; i < Ni; i++)
      output[(*index)++] =
          2. * ((fmod(i, tmp1) <= (tmp2)) ? tmp3 * fmod(i, tmp1)
                                          : tmp4 * fmod(Ni - i, tmp1)) -
          amplitude;
  return;
}


x86 assembly (clang, -O0):
<SAW>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c3 <SAW+0x83>
jp     11c3 <SAW+0x83>
movsd  -0x8(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
call   1040 <DC@plt>
jmp    179c <SAW+0x65c>
movsd  0xe45(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe26(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xddf(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xddb(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdac(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    135d <SAW+0x21d>
jp     135d <SAW+0x21d>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    1358 <SAW+0x218>
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12c8 <SAW+0x188>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    12fb <SAW+0x1bb>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rdi
sub    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <fabs@plt>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    126c <SAW+0x12c>
jmp    1797 <SAW+0x657>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    155f <SAW+0x41f>
jp     155f <SAW+0x41f>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    155a <SAW+0x41a>
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     13e2 <SAW+0x2a2>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1418 <SAW+0x2d8>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x30(%rbp),%rdi
sub    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1517 <SAW+0x3d7>
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     14a8 <SAW+0x368>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    14de <SAW+0x39e>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x30(%rbp),%rdi
sub    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    1527 <SAW+0x3e7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    1527 <SAW+0x3e7>
movsd  -0xc0(%rbp),%xmm0
ff
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    137d <SAW+0x23d>
jmp    1792 <SAW+0x652>
movsd  -0x38(%rbp),%xmm0
movsd  0xaa4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1581 <SAW+0x441>
jp     1581 <SAW+0x441>
jmp    168e <SAW+0x54e>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    1689 <SAW+0x549>
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     15ee <SAW+0x4ae>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    1624 <SAW+0x4e4>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
mov    -0x30(%rbp),%rdi
sub    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  -0x38(%rbp),%xmm0
call   1060 <pow@plt>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1589 <SAW+0x449>
jmp    178d <SAW+0x64d>
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    1788 <SAW+0x648>
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     16fb <SAW+0x5bb>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
mov    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
jmp    1731 <SAW+0x5f1>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
mov    -0x30(%rbp),%rdi
sub    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1030 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1696 <SAW+0x556>
jmp    178d <SAW+0x64d>
jmp    1792 <SAW+0x652>
jmp    1797 <SAW+0x657>
jmp    179c <SAW+0x65c>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SAW>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xorpd  %xmm6,%xmm6
ucomisd %xmm6,%xmm1
jne    118e <SAW+0x4e>
jp     118e <SAW+0x4e>
mulsd  0xeae(%rip),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
movaps %xmm3,%xmm1
movaps %xmm4,%xmm2
movaps %xmm5,%xmm3
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <DC@plt>
movsd  0xe6a(%rip),%xmm6
movapd %xmm6,%xmm4
divsd  %xmm1,%xmm4
divsd  %xmm5,%xmm4
mulsd  0xe5e(%rip),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm4,%xmm1
movapd %xmm0,%xmm5
movsd  %xmm1,0x28(%rsp)
divsd  %xmm1,%xmm5
movapd %xmm5,0x30(%rsp)
subsd  %xmm2,%xmm6
mulsd  %xmm4,%xmm6
movapd %xmm0,%xmm1
divsd  %xmm6,%xmm1
movapd %xmm1,0x40(%rsp)
ucomisd 0xe2c(%rip),%xmm3
movsd  %xmm4,(%rsp)
movapd %xmm0,0x10(%rsp)
jne    12ad <SAW+0x16d>
jp     12ad <SAW+0x16d>
test   %r12,%r12
jle    1520 <SAW+0x3e0>
movapd 0x10(%rsp),%xmm0
xorpd  0xe0e(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %r12,%r13
neg    %r13
xor    %ebx,%ebx
jmp    1282 <SAW+0x142>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <fmod@plt>
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <fabs@plt>
movsd  (%rsp),%xmm4
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%rbx
add    $0xffffffffffffffff,%r12
mov    %r13,%rax
add    %rbx,%rax
je     1520 <SAW+0x3e0>
mov    %rbx,%rdi
movapd %xmm4,%xmm0
call   1030 <fmod@plt>
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %rbx,%rdi
cmovb  %r12,%rdi
movaps 0x40(%rsp),%xmm0
jb     1230 <SAW+0xf0>
movaps 0x30(%rsp),%xmm0
jmp    1230 <SAW+0xf0>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
jne    13c3 <SAW+0x283>
jp     13c3 <SAW+0x283>
test   %r12,%r12
jle    1520 <SAW+0x3e0>
movapd 0x10(%rsp),%xmm0
xorpd  0xd48(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %r12,%r13
neg    %r13
xor    %ebx,%ebx
jmp    1339 <SAW+0x1f9>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <fmod@plt>
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x10(%rsp),%xmm0
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%rbx
add    $0xffffffffffffffff,%r12
mov    %r13,%rax
add    %rbx,%rax
movsd  (%rsp),%xmm4
je     1520 <SAW+0x3e0>
mov    %rbx,%rdi
movapd %xmm4,%xmm0
call   1030 <fmod@plt>
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %rbx,%rdi
cmovb  %r12,%rdi
movaps 0x40(%rsp),%xmm0
jb     1362 <SAW+0x222>
movaps 0x30(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <fmod@plt>
movapd %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  0x10(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    1310 <SAW+0x1d0>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
call   1030 <fmod@plt>
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %rbx,%rdi
cmovb  %r12,%rdi
movaps 0x40(%rsp),%xmm0
jb     12f0 <SAW+0x1b0>
movaps 0x30(%rsp),%xmm0
jmp    12f0 <SAW+0x1b0>
ucomisd 0xc35(%rip),%xmm3
jne    13d3 <SAW+0x293>
jnp    1486 <SAW+0x346>
movsd  %xmm3,0x58(%rsp)
test   %r12,%r12
jle    1520 <SAW+0x3e0>
movapd 0x10(%rsp),%xmm0
xorpd  0xc30(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %r12,%r13
neg    %r13
xor    %ebx,%ebx
jmp    1458 <SAW+0x318>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <fmod@plt>
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0x58(%rsp),%xmm0
call   1060 <pow@plt>
movsd  (%rsp),%xmm4
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%rbx
add    $0xffffffffffffffff,%r12
mov    %r13,%rax
add    %rbx,%rax
je     1520 <SAW+0x3e0>
mov    %rbx,%rdi
movapd %xmm4,%xmm0
call   1030 <fmod@plt>
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %rbx,%rdi
cmovb  %r12,%rdi
movaps 0x40(%rsp),%xmm0
jb     1400 <SAW+0x2c0>
movaps 0x30(%rsp),%xmm0
jmp    1400 <SAW+0x2c0>
test   %r12,%r12
jle    1520 <SAW+0x3e0>
movapd 0x10(%rsp),%xmm0
xorpd  0xb83(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %r12,%r13
neg    %r13
xor    %ebx,%ebx
jmp    14f5 <SAW+0x3b5>
nopl   (%rax)
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <fmod@plt>
mulsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x10(%rsp),%xmm0
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%rbx
add    $0xffffffffffffffff,%r12
mov    %r13,%rax
add    %rbx,%rax
movsd  (%rsp),%xmm4
je     1520 <SAW+0x3e0>
mov    %rbx,%rdi
movapd %xmm4,%xmm0
call   1030 <fmod@plt>
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
mov    %rbx,%rdi
cmovb  %r12,%rdi
movaps 0x40(%rsp),%xmm0
jb     14b0 <SAW+0x370>
movaps 0x30(%rsp),%xmm0
jmp    14b0 <SAW+0x370>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @SAW(double %0, double %1, double %2, double* %3, i64* %4, i64 %5, double %6, double %7, double %8) {
%10 = fcmp oeq double %1, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = fmul double %0, 5.000000e-01
%13 = tail call i32 @DC(double %12, double* %3, i64* %4, i64 %5, double %6, double %7, double %8)
br label %120
14: ; preds = %9
%15 = fdiv double 1.000000e+00, %1
%16 = fdiv double %15, %8
%17 = fmul double %2, 1.000000e-02
%18 = fmul double %17, %16
%19 = fdiv double %0, %18
%20 = fneg double %2
%21 = tail call double @llvm.fmuladd.f64(double %20, double 1.000000e-02, double 1.000000e+00)
%22 = fmul double %21, %16
%23 = fdiv double %0, %22
%24 = fcmp oeq double %6, -1.000000e+00
br i1 %24, label %25, label %46
25: ; preds = %14
%26 = icmp sgt i64 %5, 0
br i1 %26, label %27, label %120
27: ; preds = %25
%28 = fneg double %0
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %44, %29 ]
%31 = tail call double @fmod(i64 %30, double %16)
%32 = fcmp ugt double %31, %18
%33 = sub nsw i64 %5, %30
%34 = select i1 %32, i64 %33, i64 %30
%35 = select i1 %32, double %23, double %19
%36 = tail call double @fmod(i64 %34, double %16)
%37 = fmul double %35, %36
%38 = tail call double @llvm.fmuladd.f64(double %37, double 2.000000e+00, double %28)
%39 = fptosi double %38 to i32
%40 = tail call double @fabs(i32 %39)
%41 = load i64, i64* %4
%42 = add nsw i64 %41, 1
store i64 %42, i64* %4
%43 = getelementptr inbounds double, double* %3, i64 %41
store double %40, double* %43
%44 = add nuw nsw i64 %30, 1
%45 = icmp eq i64 %44, %5
br i1 %45, label %120, label %29
46: ; preds = %14
%47 = fcmp oeq double %6, 0.000000e+00
br i1 %47, label %48, label %79
48: ; preds = %46
%49 = icmp sgt i64 %5, 0
br i1 %49, label %50, label %120
50: ; preds = %48
%51 = fneg double %0
br label %52
52: ; preds = %50, %72
%53 = phi i64 [ 0, %50 ], [ %77, %72 ]
%54 = tail call double @fmod(i64 %53, double %16)
%55 = fcmp ugt double %54, %18
%56 = sub nsw i64 %5, %53
%57 = select i1 %55, i64 %56, i64 %53
%58 = select i1 %55, double %23, double %19
%59 = tail call double @fmod(i64 %57, double %16)
%60 = fmul double %58, %59
%61 = tail call double @llvm.fmuladd.f64(double %60, double 2.000000e+00, double %51)
%62 = fcmp ogt double %61, 0.000000e+00
br i1 %62, label %63, label %72
63: ; preds = %52
%64 = tail call double @fmod(i64 %53, double %16)
%65 = fcmp ugt double %64, %18
%66 = sub nsw i64 %5, %53
%67 = select i1 %65, i64 %66, i64 %53
%68 = select i1 %65, double %23, double %19
%69 = tail call double @fmod(i64 %67, double %16)
%70 = fmul double %68, %69
%71 = tail call double @llvm.fmuladd.f64(double %70, double 2.000000e+00, double %51)
br label %72
72: ; preds = %52, %63
%73 = phi double [ %71, %63 ], [ 0.000000e+00, %52 ]
%74 = load i64, i64* %4
%75 = add nsw i64 %74, 1
store i64 %75, i64* %4
%76 = getelementptr inbounds double, double* %3, i64 %74
store double %73, double* %76
%77 = add nuw nsw i64 %53, 1
%78 = icmp eq i64 %77, %5
br i1 %78, label %120, label %52
79: ; preds = %46
%80 = fcmp une double %6, 1.000000e+00
%81 = icmp sgt i64 %5, 0
br i1 %80, label %85, label %82
82: ; preds = %79
br i1 %81, label %83, label %120
83: ; preds = %82
%84 = fneg double %0
br label %105
85: ; preds = %79
br i1 %81, label %86, label %120
86: ; preds = %85
%87 = fneg double %0
br label %88
88: ; preds = %86, %88
%89 = phi i64 [ 0, %86 ], [ %103, %88 ]
%90 = tail call double @fmod(i64 %89, double %16)
%91 = fcmp ugt double %90, %18
%92 = sub nsw i64 %5, %89
%93 = select i1 %91, i64 %92, i64 %89
%94 = select i1 %91, double %23, double %19
%95 = tail call double @fmod(i64 %93, double %16)
%96 = fmul double %94, %95
%97 = tail call double @llvm.fmuladd.f64(double %96, double 2.000000e+00, double %87)
%98 = fptosi double %97 to i32
%99 = tail call double @pow(i32 %98, double %6)
%100 = load i64, i64* %4
%101 = add nsw i64 %100, 1
store i64 %101, i64* %4
%102 = getelementptr inbounds double, double* %3, i64 %100
store double %99, double* %102
%103 = add nuw nsw i64 %89, 1
%104 = icmp eq i64 %103, %5
br i1 %104, label %120, label %88
105: ; preds = %83, %105
%106 = phi i64 [ 0, %83 ], [ %118, %105 ]
%107 = tail call double @fmod(i64 %106, double %16)
%108 = fcmp ugt double %107, %18
%109 = sub nsw i64 %5, %106
%110 = select i1 %108, i64 %109, i64 %106
%111 = select i1 %108, double %23, double %19
%112 = tail call double @fmod(i64 %110, double %16)
%113 = fmul double %111, %112
%114 = tail call double @llvm.fmuladd.f64(double %113, double 2.000000e+00, double %84)
%115 = load i64, i64* %4
%116 = add nsw i64 %115, 1
store i64 %116, i64* %4
%117 = getelementptr inbounds double, double* %3, i64 %115
store double %114, double* %117
%118 = add nuw nsw i64 %106, 1
%119 = icmp eq i64 %118, %5
br i1 %119, label %120, label %105
120: ; preds = %105, %88, %72, %29, %82, %85, %48, %25, %11
ret void
}