#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ConvertToIeeeExtended(int, unsigned char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fputc(unsigned short, int /*<<< orphan*/ *);
void Write_AIFF(FILE *fptr, double *samples, long nsamples, int nfreq, int bits,
                double amp) {
  unsigned short v;
  int i;
  unsigned long totalsize;
  double themin, themax, scale, themid;
  unsigned char bit80[10];
  fprintf(fptr, "FORM");
  totalsize = 4 + 8 + 18 + 8 + (bits / 8) * nsamples + 8;
  fputc((totalsize & 0xff000000) >> 24, fptr);
  fputc((totalsize & 0x00ff0000) >> 16, fptr);
  fputc((totalsize & 0x0000ff00) >> 8, fptr);
  fputc((totalsize & 0x000000ff), fptr);
  fprintf(fptr, "AIFF");
  fprintf(fptr, "COMM");
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(18, fptr);
  fputc(0, fptr);
  fputc(1, fptr);
  fputc((nsamples & 0xff000000) >> 24, fptr);
  fputc((nsamples & 0x00ff0000) >> 16, fptr);
  fputc((nsamples & 0x0000ff00) >> 8, fptr);
  fputc((nsamples & 0x000000ff), fptr);
  fputc(0, fptr);
  fputc(bits, fptr);
  ConvertToIeeeExtended(nfreq, bit80);
  for (i = 0; i < 10; i++)
    fputc(bit80[i], fptr);
  fprintf(fptr, "SSND");
  fputc((((bits / 8) * nsamples + 8) & 0xff000000) >> 24, fptr);
  fputc((((bits / 8) * nsamples + 8) & 0x00ff0000) >> 16, fptr);
  fputc((((bits / 8) * nsamples + 8) & 0x0000ff00) >> 8, fptr);
  fputc((((bits / 8) * nsamples + 8) & 0x000000ff), fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  fputc(0, fptr);
  themin = samples[0];
  themax = themin;
  for (i = 1; i < nsamples; i++) {
    if (samples[i] > themax)
      themax = samples[i];
    if (samples[i] < themin)
      themin = samples[i];
  }
  if (themin >= themax) {
    themin -= 1;
    themax += 1;
  }
  themid = (themin + themax) / 2;
  themin -= themid;
  themax -= themid;
  if ((((themin) < 0) ? -(themin) : (themin)) >
      (((themax) < 0) ? -(themax) : (themax)))
    themax = (((themin) < 0) ? -(themin) : (themin));
  scale = amp * ((bits == 16) ? 32760 : 124) / (themax);
  for (i = 0; i < nsamples; i++) {
    if (bits == 16) {
      v = (unsigned short)(scale * (samples[i] - themid));
      fputc((v & 0xff00) >> 8, fptr);
      fputc((v & 0x00ff), fptr);
    } else {
      v = (unsigned char)(scale * (samples[i] - themid));
      fputc(v, fptr);
    }
  }
}


x86 assembly (clang, -O0):
<Write_AIFF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
imul   -0x18(%rbp),%rax
add    $0x26,%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
movabs $0xff000000,%rax
and    -0x38(%rbp),%rax
shr    $0x18,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x38(%rbp),%rax
and    $0xff0000,%rax
shr    $0x10,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x38(%rbp),%rax
and    $0xff00,%rax
shr    $0x8,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x38(%rbp),%rax
and    $0xff,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
mov    $0x12,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1040 <fputc@plt>
movabs $0xff000000,%rax
and    -0x18(%rbp),%rax
sar    $0x18,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rax
and    $0xff0000,%rax
sar    $0x10,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rax
and    $0xff00,%rax
sar    $0x8,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rax
and    $0xff,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x20(%rbp),%eax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x1c(%rbp),%edi
lea    -0x62(%rbp),%rsi
call   1030 <ConvertToIeeeExtended@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0xa,-0x30(%rbp)
jge    1313 <Write_AIFF+0x1e3>
movslq -0x30(%rbp),%rax
movzbl -0x62(%rbp,%rax,1),%eax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12e6 <Write_AIFF+0x1b6>
mov    -0x8(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
imul   -0x18(%rbp),%rax
add    $0x8,%rax
movabs $0xff000000,%rcx
and    %rcx,%rax
sar    $0x18,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x20(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
imul   -0x18(%rbp),%rax
add    $0x8,%rax
and    $0xff0000,%rax
sar    $0x10,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x20(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
imul   -0x18(%rbp),%rax
add    $0x8,%rax
and    $0xff00,%rax
sar    $0x8,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x20(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
imul   -0x18(%rbp),%rax
add    $0x8,%rax
and    $0xff,%rax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1040 <fputc@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x30(%rbp)
movslq -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    14c5 <Write_AIFF+0x395>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1484 <Write_AIFF+0x354>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14b2 <Write_AIFF+0x382>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    14b7 <Write_AIFF+0x387>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    144c <Write_AIFF+0x31c>
movsd  -0x40(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     14fd <Write_AIFF+0x3cd>
movsd  -0x40(%rbp),%xmm0
movsd  0xb1e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xb0d(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  0xaf9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1572 <Write_AIFF+0x442>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    157c <Write_AIFF+0x44c>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    15ba <Write_AIFF+0x48a>
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    15c4 <Write_AIFF+0x494>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1629 <Write_AIFF+0x4f9>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    160f <Write_AIFF+0x4df>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    161c <Write_AIFF+0x4ec>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%edx
mov    $0x7c,%eax
mov    $0x7ff8,%ecx
cmp    $0x10,%edx
cmove  %ecx,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x30(%rbp)
movslq -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1718 <Write_AIFF+0x5e8>
cmpl   $0x10,-0x20(%rbp)
jne    16cb <Write_AIFF+0x59b>
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x58(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %ax,-0x2a(%rbp)
movzwl -0x2a(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
movzwl -0x2a(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
jmp    1705 <Write_AIFF+0x5d5>
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x58(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%eax
mov    %ax,-0x2a(%rbp)
mov    -0x2a(%rbp),%ax
mov    -0x8(%rbp),%rsi
movzwl %ax,%edi
call   1040 <fputc@plt>
jmp    170a <Write_AIFF+0x5da>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    165a <Write_AIFF+0x52a>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Write_AIFF>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm0,0x38(%rsp)
mov    %r8d,%r14d
mov    %ecx,0x18(%rsp)
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
lea    0xed5(%rip),%rdi
mov    $0x1,%ebp
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1050 <fwrite@plt>
lea    0x7(%r14),%eax
test   %r14d,%r14d
cmovns %r14d,%eax
sar    $0x3,%eax
imul   %r12,%rax
mov    %r12,0x40(%rsp)
mov    %rax,0x20(%rsp)
lea    0x2e(%rax),%ebx
mov    %ebx,%eax
shr    $0x18,%eax
mov    %eax,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bh,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bl,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
lea    0xe68(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1050 <fwrite@plt>
lea    0xe54(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1050 <fwrite@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
mov    $0x12,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
mov    $0x1,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
mov    %r12d,%eax
shr    $0x18,%eax
mov    %eax,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
mov    %r12d,%eax
mov    %r12,%rbx
shr    $0x10,%eax
movzbl %al,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bh,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bl,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzwl %r14w,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
lea    0xe(%rsp),%rsi
mov    0x18(%rsp),%edi
call   1030 <ConvertToIeeeExtended@plt>
movzbl 0xe(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0xf(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x10(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x11(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x12(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x13(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x14(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x15(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x16(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl 0x17(%rsp),%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
lea    0xd1e(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1050 <fwrite@plt>
mov    0x20(%rsp),%rbx
add    $0x8,%ebx
mov    %ebx,%eax
shr    $0x18,%eax
mov    %eax,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bh,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bl,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movsd  (%r15),%xmm0
mov    0x40(%rsp),%rax
mov    %rax,%r12
cmp    $0x2,%rax
jl     13f1 <Write_AIFF+0x2c1>
mov    %r12,%rax
lea    -0x1(%r12),%rcx
lea    -0x2(%r12),%rdx
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%rdx
jae    13fe <Write_AIFF+0x2ce>
movapd %xmm0,%xmm2
jmp    1469 <Write_AIFF+0x339>
movapd %xmm0,%xmm3
movapd %xmm0,%xmm1
jmp    14a2 <Write_AIFF+0x372>
and    $0xfffffffffffffffc,%rcx
xor    %ebp,%ebp
movapd %xmm0,%xmm2
nopl   0x0(%rax,%rax,1)
movsd  0x8(%r15,%rbp,8),%xmm1
movsd  0x10(%r15,%rbp,8),%xmm3
movapd %xmm1,%xmm4
maxsd  %xmm0,%xmm4
minsd  %xmm2,%xmm1
movapd %xmm3,%xmm0
maxsd  %xmm4,%xmm0
minsd  %xmm1,%xmm3
movsd  0x18(%r15,%rbp,8),%xmm1
movapd %xmm1,%xmm4
maxsd  %xmm0,%xmm4
minsd  %xmm3,%xmm1
movsd  0x20(%r15,%rbp,8),%xmm2
movapd %xmm2,%xmm0
maxsd  %xmm4,%xmm0
minsd  %xmm1,%xmm2
add    $0x4,%rbp
cmp    %rbp,%rcx
jne    1410 <Write_AIFF+0x2e0>
add    $0x1,%rbp
movapd %xmm2,%xmm3
movapd %xmm0,%xmm1
test   %rax,%rax
je     14a2 <Write_AIFF+0x372>
lea    (%r15,%rbp,8),%rcx
xor    %edx,%edx
nopl   0x0(%rax)
movsd  (%rcx,%rdx,8),%xmm3
movapd %xmm3,%xmm1
maxsd  %xmm0,%xmm1
minsd  %xmm2,%xmm3
add    $0x1,%rdx
movapd %xmm1,%xmm0
movapd %xmm3,%xmm2
cmp    %rdx,%rax
jne    1480 <Write_AIFF+0x350>
ucomisd %xmm1,%xmm3
movapd %xmm1,%xmm0
jb     14b8 <Write_AIFF+0x388>
movsd  0xb54(%rip),%xmm0
addsd  %xmm1,%xmm0
cmp    $0x10,%r14d
mov    $0x7ff8,%ecx
mov    $0x7c,%eax
cmove  %ecx,%eax
mov    %r12,%rcx
test   %r12,%r12
jle    15da <Write_AIFF+0x4aa>
movsd  0xb23(%rip),%xmm2
addsd  %xmm3,%xmm2
cmpnlesd %xmm3,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm2,%xmm1
orpd   %xmm3,%xmm1
movapd %xmm1,%xmm2
addsd  %xmm0,%xmm2
mulsd  0xb0e(%rip),%xmm2
subsd  %xmm2,%xmm1
movapd %xmm2,0x20(%rsp)
subsd  %xmm2,%xmm0
movapd 0xb08(%rip),%xmm2
movapd %xmm1,%xmm3
xorpd  %xmm2,%xmm3
xorpd  %xmm4,%xmm4
movapd %xmm1,%xmm5
cmpltsd %xmm4,%xmm5
andpd  %xmm5,%xmm3
andnpd %xmm1,%xmm5
orpd   %xmm3,%xmm5
xorpd  %xmm0,%xmm2
movapd %xmm0,%xmm1
cmpltsd %xmm4,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
cmpltsd %xmm5,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm5,%xmm2
andnpd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
orpd   %xmm2,%xmm1
mulsd  0x38(%rsp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
xor    %ebp,%ebp
jmp    15ae <Write_AIFF+0x47e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cvttsd2si %xmm0,%eax
movzbl %al,%eax
movzwl %ax,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbp
mov    %r12,%rax
cmp    %rbp,%r12
je     15da <Write_AIFF+0x4aa>
movsd  (%r15,%rbp,8),%xmm0
subsd  0x20(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
cmp    $0x10,%r14d
jne    1590 <Write_AIFF+0x460>
cvttsd2si %xmm0,%ebx
movzbl %bh,%edi
mov    %r13,%rsi
call   1040 <fputc@plt>
movzbl %bl,%eax
jmp    1597 <Write_AIFF+0x467>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"FORM\00"
@.str.1 = [5 x i8] c"AIFF\00"
@.str.2 = [5 x i8] c"COMM\00"
@.str.3 = [5 x i8] c"SSND\00"
define void @Write_AIFF(i32* %0, double* %1, i64 %2, i32 %3, i32 %4, double %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca i16
%14 = alloca i32
%15 = alloca i64
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca [10 x i8]
store i32* %0, i32** %7
store double* %1, double** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double %5, double* %12
%21 = load i32*, i32** %7
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %11
%24 = sdiv i32 %23, 8
%25 = sext i32 %24 to i64
%26 = load i64, i64* %9
%27 = mul nsw i64 %25, %26
%28 = add nsw i64 38, %27
%29 = add nsw i64 %28, 8
store i64 %29, i64* %15
%30 = load i64, i64* %15
%31 = and i64 %30, 4278190080
%32 = lshr i64 %31, 24
%33 = trunc i64 %32 to i16
%34 = load i32*, i32** %7
%35 = call i32 @fputc(i16 zeroext %33, i32* %34)
%36 = load i64, i64* %15
%37 = and i64 %36, 16711680
%38 = lshr i64 %37, 16
%39 = trunc i64 %38 to i16
%40 = load i32*, i32** %7
%41 = call i32 @fputc(i16 zeroext %39, i32* %40)
%42 = load i64, i64* %15
%43 = and i64 %42, 65280
%44 = lshr i64 %43, 8
%45 = trunc i64 %44 to i16
%46 = load i32*, i32** %7
%47 = call i32 @fputc(i16 zeroext %45, i32* %46)
%48 = load i64, i64* %15
%49 = and i64 %48, 255
%50 = trunc i64 %49 to i16
%51 = load i32*, i32** %7
%52 = call i32 @fputc(i16 zeroext %50, i32* %51)
%53 = load i32*, i32** %7
%54 = call i32 @fprintf(i32* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%55 = load i32*, i32** %7
%56 = call i32 @fprintf(i32* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%57 = load i32*, i32** %7
%58 = call i32 @fputc(i16 zeroext 0, i32* %57)
%59 = load i32*, i32** %7
%60 = call i32 @fputc(i16 zeroext 0, i32* %59)
%61 = load i32*, i32** %7
%62 = call i32 @fputc(i16 zeroext 0, i32* %61)
%63 = load i32*, i32** %7
%64 = call i32 @fputc(i16 zeroext 18, i32* %63)
%65 = load i32*, i32** %7
%66 = call i32 @fputc(i16 zeroext 0, i32* %65)
%67 = load i32*, i32** %7
%68 = call i32 @fputc(i16 zeroext 1, i32* %67)
%69 = load i64, i64* %9
%70 = and i64 %69, 4278190080
%71 = ashr i64 %70, 24
%72 = trunc i64 %71 to i16
%73 = load i32*, i32** %7
%74 = call i32 @fputc(i16 zeroext %72, i32* %73)
%75 = load i64, i64* %9
%76 = and i64 %75, 16711680
%77 = ashr i64 %76, 16
%78 = trunc i64 %77 to i16
%79 = load i32*, i32** %7
%80 = call i32 @fputc(i16 zeroext %78, i32* %79)
%81 = load i64, i64* %9
%82 = and i64 %81, 65280
%83 = ashr i64 %82, 8
%84 = trunc i64 %83 to i16
%85 = load i32*, i32** %7
%86 = call i32 @fputc(i16 zeroext %84, i32* %85)
%87 = load i64, i64* %9
%88 = and i64 %87, 255
%89 = trunc i64 %88 to i16
%90 = load i32*, i32** %7
%91 = call i32 @fputc(i16 zeroext %89, i32* %90)
%92 = load i32*, i32** %7
%93 = call i32 @fputc(i16 zeroext 0, i32* %92)
%94 = load i32, i32* %11
%95 = trunc i32 %94 to i16
%96 = load i32*, i32** %7
%97 = call i32 @fputc(i16 zeroext %95, i32* %96)
%98 = load i32, i32* %10
%99 = getelementptr inbounds [10 x i8], [10 x i8]* %20, i64 0, i64 0
%100 = call i32 @ConvertToIeeeExtended(i32 %98, i8* %99)
store i32 0, i32* %14
br label %101
101: ; preds = %112, %6
%102 = load i32, i32* %14
%103 = icmp slt i32 %102, 10
br i1 %103, label %104, label %115
104: ; preds = %101
%105 = load i32, i32* %14
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [10 x i8], [10 x i8]* %20, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = zext i8 %108 to i16
%110 = load i32*, i32** %7
%111 = call i32 @fputc(i16 zeroext %109, i32* %110)
br label %112
112: ; preds = %104
%113 = load i32, i32* %14
%114 = add nsw i32 %113, 1
store i32 %114, i32* %14
br label %101
115: ; preds = %101
%116 = load i32*, i32** %7
%117 = call i32 @fprintf(i32* %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%118 = load i32, i32* %11
%119 = sdiv i32 %118, 8
%120 = sext i32 %119 to i64
%121 = load i64, i64* %9
%122 = mul nsw i64 %120, %121
%123 = add nsw i64 %122, 8
%124 = and i64 %123, 4278190080
%125 = ashr i64 %124, 24
%126 = trunc i64 %125 to i16
%127 = load i32*, i32** %7
%128 = call i32 @fputc(i16 zeroext %126, i32* %127)
%129 = load i32, i32* %11
%130 = sdiv i32 %129, 8
%131 = sext i32 %130 to i64
%132 = load i64, i64* %9
%133 = mul nsw i64 %131, %132
%134 = add nsw i64 %133, 8
%135 = and i64 %134, 16711680
%136 = ashr i64 %135, 16
%137 = trunc i64 %136 to i16
%138 = load i32*, i32** %7
%139 = call i32 @fputc(i16 zeroext %137, i32* %138)
%140 = load i32, i32* %11
%141 = sdiv i32 %140, 8
%142 = sext i32 %141 to i64
%143 = load i64, i64* %9
%144 = mul nsw i64 %142, %143
%145 = add nsw i64 %144, 8
%146 = and i64 %145, 65280
%147 = ashr i64 %146, 8
%148 = trunc i64 %147 to i16
%149 = load i32*, i32** %7
%150 = call i32 @fputc(i16 zeroext %148, i32* %149)
%151 = load i32, i32* %11
%152 = sdiv i32 %151, 8
%153 = sext i32 %152 to i64
%154 = load i64, i64* %9
%155 = mul nsw i64 %153, %154
%156 = add nsw i64 %155, 8
%157 = and i64 %156, 255
%158 = trunc i64 %157 to i16
%159 = load i32*, i32** %7
%160 = call i32 @fputc(i16 zeroext %158, i32* %159)
%161 = load i32*, i32** %7
%162 = call i32 @fputc(i16 zeroext 0, i32* %161)
%163 = load i32*, i32** %7
%164 = call i32 @fputc(i16 zeroext 0, i32* %163)
%165 = load i32*, i32** %7
%166 = call i32 @fputc(i16 zeroext 0, i32* %165)
%167 = load i32*, i32** %7
%168 = call i32 @fputc(i16 zeroext 0, i32* %167)
%169 = load i32*, i32** %7
%170 = call i32 @fputc(i16 zeroext 0, i32* %169)
%171 = load i32*, i32** %7
%172 = call i32 @fputc(i16 zeroext 0, i32* %171)
%173 = load i32*, i32** %7
%174 = call i32 @fputc(i16 zeroext 0, i32* %173)
%175 = load i32*, i32** %7
%176 = call i32 @fputc(i16 zeroext 0, i32* %175)
%177 = load double*, double** %8
%178 = getelementptr inbounds double, double* %177, i64 0
%179 = load double, double* %178
store double %179, double* %16
%180 = load double, double* %16
store double %180, double* %17
store i32 1, i32* %14
br label %181
181: ; preds = %215, %115
%182 = load i32, i32* %14
%183 = sext i32 %182 to i64
%184 = load i64, i64* %9
%185 = icmp slt i64 %183, %184
br i1 %185, label %186, label %218
186: ; preds = %181
%187 = load double*, double** %8
%188 = load i32, i32* %14
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds double, double* %187, i64 %189
%191 = load double, double* %190
%192 = load double, double* %17
%193 = fcmp ogt double %191, %192
br i1 %193, label %194, label %200
194: ; preds = %186
%195 = load double*, double** %8
%196 = load i32, i32* %14
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds double, double* %195, i64 %197
%199 = load double, double* %198
store double %199, double* %17
br label %200
200: ; preds = %194, %186
%201 = load double*, double** %8
%202 = load i32, i32* %14
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double, double* %201, i64 %203
%205 = load double, double* %204
%206 = load double, double* %16
%207 = fcmp olt double %205, %206
br i1 %207, label %208, label %214
208: ; preds = %200
%209 = load double*, double** %8
%210 = load i32, i32* %14
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds double, double* %209, i64 %211
%213 = load double, double* %212
store double %213, double* %16
br label %214
214: ; preds = %208, %200
br label %215
215: ; preds = %214
%216 = load i32, i32* %14
%217 = add nsw i32 %216, 1
store i32 %217, i32* %14
br label %181
218: ; preds = %181
%219 = load double, double* %16
%220 = load double, double* %17
%221 = fcmp oge double %219, %220
br i1 %221, label %222, label %227
222: ; preds = %218
%223 = load double, double* %16
%224 = fsub double %223, 1.000000e+00
store double %224, double* %16
%225 = load double, double* %17
%226 = fadd double %225, 1.000000e+00
store double %226, double* %17
br label %227
227: ; preds = %222, %218
%228 = load double, double* %16
%229 = load double, double* %17
%230 = fadd double %228, %229
%231 = fdiv double %230, 2.000000e+00
store double %231, double* %19
%232 = load double, double* %19
%233 = load double, double* %16
%234 = fsub double %233, %232
store double %234, double* %16
%235 = load double, double* %19
%236 = load double, double* %17
%237 = fsub double %236, %235
store double %237, double* %17
%238 = load double, double* %16
%239 = fcmp olt double %238, 0.000000e+00
br i1 %239, label %240, label %243
240: ; preds = %227
%241 = load double, double* %16
%242 = fneg double %241
br label %245
243: ; preds = %227
%244 = load double, double* %16
br label %245
245: ; preds = %243, %240
%246 = phi double [ %242, %240 ], [ %244, %243 ]
%247 = load double, double* %17
%248 = fcmp olt double %247, 0.000000e+00
br i1 %248, label %249, label %252
249: ; preds = %245
%250 = load double, double* %17
%251 = fneg double %250
br label %254
252: ; preds = %245
%253 = load double, double* %17
br label %254
254: ; preds = %252, %249
%255 = phi double [ %251, %249 ], [ %253, %252 ]
%256 = fcmp ogt double %246, %255
br i1 %256, label %257, label %267
257: ; preds = %254
%258 = load double, double* %16
%259 = fcmp olt double %258, 0.000000e+00
br i1 %259, label %260, label %263
260: ; preds = %257
%261 = load double, double* %16
%262 = fneg double %261
br label %265
263: ; preds = %257
%264 = load double, double* %16
br label %265
265: ; preds = %263, %260
%266 = phi double [ %262, %260 ], [ %264, %263 ]
store double %266, double* %17
br label %267
267: ; preds = %265, %254
%268 = load double, double* %12
%269 = load i32, i32* %11
%270 = icmp eq i32 %269, 16
%271 = zext i1 %270 to i64
%272 = select i1 %270, i32 32760, i32 124
%273 = sitofp i32 %272 to double
%274 = fmul double %268, %273
%275 = load double, double* %17
%276 = fdiv double %274, %275
store double %276, double* %18
store i32 0, i32* %14
br label %277
277: ; preds = %325, %267
%278 = load i32, i32* %14
%279 = sext i32 %278 to i64
%280 = load i64, i64* %9
%281 = icmp slt i64 %279, %280
br i1 %281, label %282, label %328
282: ; preds = %277
%283 = load i32, i32* %11
%284 = icmp eq i32 %283, 16
br i1 %284, label %285, label %309
285: ; preds = %282
%286 = load double, double* %18
%287 = load double*, double** %8
%288 = load i32, i32* %14
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds double, double* %287, i64 %289
%291 = load double, double* %290
%292 = load double, double* %19
%293 = fsub double %291, %292
%294 = fmul double %286, %293
%295 = fptoui double %294 to i16
store i16 %295, i16* %13
%296 = load i16, i16* %13
%297 = zext i16 %296 to i32
%298 = and i32 %297, 65280
%299 = ashr i32 %298, 8
%300 = trunc i32 %299 to i16
%301 = load i32*, i32** %7
%302 = call i32 @fputc(i16 zeroext %300, i32* %301)
%303 = load i16, i16* %13
%304 = zext i16 %303 to i32
%305 = and i32 %304, 255
%306 = trunc i32 %305 to i16
%307 = load i32*, i32** %7
%308 = call i32 @fputc(i16 zeroext %306, i32* %307)
br label %324
309: ; preds = %282
%310 = load double, double* %18
%311 = load double*, double** %8
%312 = load i32, i32* %14
%313 = sext i32 %312 to i64
%314 = getelementptr inbounds double, double* %311, i64 %313
%315 = load double, double* %314
%316 = load double, double* %19
%317 = fsub double %315, %316
%318 = fmul double %310, %317
%319 = fptoui double %318 to i8
%320 = zext i8 %319 to i16
store i16 %320, i16* %13
%321 = load i16, i16* %13
%322 = load i32*, i32** %7
%323 = call i32 @fputc(i16 zeroext %321, i32* %322)
br label %324
324: ; preds = %309, %285
br label %325
325: ; preds = %324
%326 = load i32, i32* %14
%327 = add nsw i32 %326, 1
store i32 %327, i32* %14
br label %277
328: ; preds = %277
ret void
}

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