#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned char *inEx(int /*<<< orphan*/ *, int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ printf(char *);
unsigned char round(double);
unsigned char *resample(unsigned char *data, int offset, int len, int inputRate,
                        int outputRate, int align, int *outSize) {
  FILE *f = fopen("tmp.bin", "wb+");
  if (f == NULL) {
    printf("Error: cannot open file tmp.bin\n");
    return NULL;
  }
  const double step = (double)inputRate / (double)outputRate;
  double value;
  double lastSample;
  double sample = 0;
  unsigned char byte;
  double dOff;
  int off;
  int outOff;
  value = 0;
  lastSample = 0;
  off = 0;
  outOff = 0;
  for (dOff = 0; dOff < len; dOff += step) {
    sample = 0;
    if (step >= 1) {
      if (value < 0)
        sample += lastSample * -value;
      value += step;
      while (value > 0) {
        lastSample = (data[off + offset] & 0xFF) - 0x80;
        off++;
        if (value >= 1)
          sample += lastSample;
        else
          sample += lastSample * value;
        value--;
      }
      sample /= step;
    } else {
      sample = (data[(int)dOff + offset] & 0xFF) - 0x80;
    }
    byte = round(sample);
    fwrite(&byte, 1, 1, f);
    outOff++;
  }
  if (align > 1) {
    const int mask = align - 1;
    const int size = align - (outOff & mask);
    if (size != align) {
      double reduce = sample / size;
      int i;
      for (i = 0; i < size; i++) {
        sample -= reduce;
        byte = round(sample);
        fwrite(&byte, 1, 1, f);
        outOff++;
      }
    }
  }
  unsigned char *result = inEx(f, 0, outOff, outSize);
  fclose(f);
  return result;
}


x86 assembly (clang, -O0):
<resample>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
lea    0xe85(%rip),%rdi
lea    0xe86(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11bf <resample+0x5f>
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1471 <resample+0x311>
cvtsi2sdl -0x1c(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    139c <resample+0x23c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdd7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1338 <resample+0x1d8>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1274 <resample+0x114>
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1320 <resample+0x1c0>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
sub    $0x80,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xd31(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12ed <resample+0x18d>
movsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1309 <resample+0x1a9>
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcf7(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1283 <resample+0x123>
movsd  -0x38(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    135e <resample+0x1fe>
mov    -0x10(%rbp),%rax
cvttsd2si -0x60(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
sub    $0x80,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1070 <round@plt>
mov    %al,-0x51(%rbp)
mov    -0x30(%rbp),%rcx
lea    -0x51(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1080 <fwrite@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1200 <resample+0xa0>
cmpl   $0x1,-0x24(%rbp)
jle    1444 <resample+0x2e4>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x68(%rbp),%ecx
and    -0x6c(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     143f <resample+0x2df>
movsd  -0x50(%rbp),%xmm0
cvtsi2sdl -0x70(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    143a <resample+0x2da>
movsd  -0x78(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1070 <round@plt>
mov    %al,-0x51(%rbp)
mov    -0x30(%rbp),%rcx
lea    -0x51(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1080 <fwrite@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    13e3 <resample+0x283>
jmp    143f <resample+0x2df>
jmp    1444 <resample+0x2e4>
mov    -0x30(%rbp),%rdi
mov    -0x68(%rbp),%edx
mov    0x10(%rbp),%rcx
xor    %esi,%esi
call   1030 <inEx@plt>
mov    %rax,-0x88(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x88(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resample>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x28(%rsp)
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %rdi,%r12
lea    0xea4(%rip),%rdi
lea    0xe81(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     132a <resample+0x1ca>
mov    %rax,%r13
test   %ebp,%ebp
jle    133d <resample+0x1dd>
cvtsi2sd %r14d,%xmm8
cvtsi2sd %ebx,%xmm0
divsd  %xmm0,%xmm8
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x38(%rsp)
movslq %r15d,%r14
add    %r12,%r14
xor    %ebp,%ebp
xorpd  %xmm10,%xmm10
movsd  0xe28(%rip),%xmm5
movsd  0xe27(%rip),%xmm9
xorpd  %xmm4,%xmm4
xorpd  %xmm6,%xmm6
xor    %ebx,%ebx
xorpd  %xmm7,%xmm7
movsd  %xmm8,0x30(%rsp)
jmp    1280 <resample+0x120>
nopl   0x0(%rax,%rax,1)
movapd %xmm4,0x40(%rsp)
movsd  %xmm6,0x8(%rsp)
cvttsd2si %xmm7,%eax
add    %r15d,%eax
cltq
movzbl (%r12,%rax,1),%eax
add    $0xffffff80,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,0x10(%rsp)
call   1080 <round@plt>
movsbl %al,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
add    $0x1,%ebp
movsd  (%rsp),%xmm7
movsd  0x30(%rsp),%xmm8
addsd  %xmm8,%xmm7
movsd  0x38(%rsp),%xmm0
ucomisd %xmm7,%xmm0
xorpd  %xmm10,%xmm10
movsd  0xd9b(%rip),%xmm5
movsd  0xd9a(%rip),%xmm9
movsd  0x8(%rsp),%xmm6
movapd 0x40(%rsp),%xmm4
jbe    1349 <resample+0x1e9>
ucomisd %xmm5,%xmm8
movsd  %xmm7,(%rsp)
jb     1200 <resample+0xa0>
movapd %xmm6,%xmm0
mulsd  %xmm4,%xmm0
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm8,%xmm3
addsd  %xmm4,%xmm3
cmpltsd %xmm10,%xmm4
andpd  %xmm1,%xmm4
ucomisd %xmm10,%xmm3
jbe    1310 <resample+0x1b0>
movslq %ebx,%rax
add    %r14,%rax
movzbl (%rax),%ecx
add    $0xffffff80,%ecx
xorps  %xmm6,%xmm6
cvtsi2sd %ecx,%xmm6
movapd %xmm6,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm4,%xmm1
addsd  %xmm6,%xmm4
movapd %xmm5,%xmm0
cmpnlesd %xmm3,%xmm0
movapd %xmm0,%xmm2
andnpd %xmm4,%xmm2
andpd  %xmm1,%xmm0
orpd   %xmm2,%xmm0
addsd  %xmm9,%xmm3
add    $0x1,%rax
add    $0x1,%ebx
ucomisd %xmm10,%xmm3
movapd %xmm0,%xmm4
ja     12c0 <resample+0x160>
jmp    1314 <resample+0x1b4>
nop
movapd %xmm4,%xmm0
movsd  %xmm6,0x8(%rsp)
divsd  %xmm8,%xmm0
movapd %xmm3,0x40(%rsp)
jmp    1224 <resample+0xc4>
lea    0xce3(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
jmp    13d3 <resample+0x273>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
movapd 0x10(%rsp),%xmm0
mov    0x90(%rsp),%r15
mov    0x28(%rsp),%rcx
cmp    $0x2,%ecx
jl     13b6 <resample+0x256>
lea    -0x1(%rcx),%eax
and    %ebp,%eax
je     13b6 <resample+0x256>
mov    %ecx,%ebx
sub    %eax,%ebx
test   %ebx,%ebx
jle    13b6 <resample+0x256>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
add    %ecx,%ebp
sub    %eax,%ebp
nopl   0x0(%rax,%rax,1)
subsd  (%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
call   1080 <round@plt>
movsbl %al,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
movapd 0x10(%rsp),%xmm0
add    $0xffffffff,%ebx
jne    1390 <resample+0x230>
mov    %r13,%rdi
xor    %esi,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1030 <inEx@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %rbp,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"tmp.bin\00"
@.str.1 = [4 x i8] c"wb+\00"
@.str.2 = [33 x i8] c"Error: cannot open file tmp.bin\0A\00"
define i8* @resample(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca i8
%22 = alloca double
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca double
%28 = alloca i32
%29 = alloca i8*
store i8* %0, i8** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32* %6, i32** %15
%30 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %16
%31 = load i32*, i32** %16
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %35
33: ; preds = %7
%34 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i8* null, i8** %8
br label %167
35: ; preds = %7
%36 = load i32, i32* %12
%37 = sitofp i32 %36 to double
%38 = load i32, i32* %13
%39 = sitofp i32 %38 to double
%40 = fdiv double %37, %39
store double %40, double* %17
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store i32 0, i32* %23
store i32 0, i32* %24
store double 0.000000e+00, double* %22
br label %41
41: ; preds = %117, %35
%42 = load double, double* %22
%43 = load i32, i32* %11
%44 = sitofp i32 %43 to double
%45 = fcmp olt double %42, %44
br i1 %45, label %46, label %121
46: ; preds = %41
store double 0.000000e+00, double* %20
%47 = load double, double* %17
%48 = fcmp oge double %47, 1.000000e+00
br i1 %48, label %49, label %97
49: ; preds = %46
%50 = load double, double* %18
%51 = fcmp olt double %50, 0.000000e+00
br i1 %51, label %52, label %58
52: ; preds = %49
%53 = load double, double* %19
%54 = load double, double* %18
%55 = fneg double %54
%56 = load double, double* %20
%57 = call double @llvm.fmuladd.f64(double %53, double %55, double %56)
store double %57, double* %20
br label %58
58: ; preds = %52, %49
%59 = load double, double* %17
%60 = load double, double* %18
%61 = fadd double %60, %59
store double %61, double* %18
br label %62
62: ; preds = %90, %58
%63 = load double, double* %18
%64 = fcmp ogt double %63, 0.000000e+00
br i1 %64, label %65, label %93
65: ; preds = %62
%66 = load i8*, i8** %9
%67 = load i32, i32* %23
%68 = load i32, i32* %10
%69 = add nsw i32 %67, %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %66, i64 %70
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = and i32 %73, 255
%75 = sub nsw i32 %74, 128
%76 = sitofp i32 %75 to double
store double %76, double* %19
%77 = load i32, i32* %23
%78 = add nsw i32 %77, 1
store i32 %78, i32* %23
%79 = load double, double* %18
%80 = fcmp oge double %79, 1.000000e+00
br i1 %80, label %81, label %85
81: ; preds = %65
%82 = load double, double* %19
%83 = load double, double* %20
%84 = fadd double %83, %82
store double %84, double* %20
br label %90
85: ; preds = %65
%86 = load double, double* %19
%87 = load double, double* %18
%88 = load double, double* %20
%89 = call double @llvm.fmuladd.f64(double %86, double %87, double %88)
store double %89, double* %20
br label %90
90: ; preds = %85, %81
%91 = load double, double* %18
%92 = fadd double %91, -1.000000e+00
store double %92, double* %18
br label %62
93: ; preds = %62
%94 = load double, double* %17
%95 = load double, double* %20
%96 = fdiv double %95, %94
store double %96, double* %20
br label %110
97: ; preds = %46
%98 = load i8*, i8** %9
%99 = load double, double* %22
%100 = fptosi double %99 to i32
%101 = load i32, i32* %10
%102 = add nsw i32 %100, %101
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %98, i64 %103
%105 = load i8, i8* %104
%106 = zext i8 %105 to i32
%107 = and i32 %106, 255
%108 = sub nsw i32 %107, 128
%109 = sitofp i32 %108 to double
store double %109, double* %20
br label %110
110: ; preds = %97, %93
%111 = load double, double* %20
%112 = call zeroext i8 @round(double %111)
store i8 %112, i8* %21
%113 = load i32*, i32** %16
%114 = call i32 @fwrite(i8* %21, i32 1, i32 1, i32* %113)
%115 = load i32, i32* %24
%116 = add nsw i32 %115, 1
store i32 %116, i32* %24
br label %117
117: ; preds = %110
%118 = load double, double* %17
%119 = load double, double* %22
%120 = fadd double %119, %118
store double %120, double* %22
br label %41
121: ; preds = %41
%122 = load i32, i32* %14
%123 = icmp sgt i32 %122, 1
br i1 %123, label %124, label %159
124: ; preds = %121
%125 = load i32, i32* %14
%126 = sub nsw i32 %125, 1
store i32 %126, i32* %25
%127 = load i32, i32* %14
%128 = load i32, i32* %24
%129 = load i32, i32* %25
%130 = and i32 %128, %129
%131 = sub nsw i32 %127, %130
store i32 %131, i32* %26
%132 = load i32, i32* %26
%133 = load i32, i32* %14
%134 = icmp ne i32 %132, %133
br i1 %134, label %135, label %158
135: ; preds = %124
%136 = load double, double* %20
%137 = load i32, i32* %26
%138 = sitofp i32 %137 to double
%139 = fdiv double %136, %138
store double %139, double* %27
store i32 0, i32* %28
br label %140
140: ; preds = %154, %135
%141 = load i32, i32* %28
%142 = load i32, i32* %26
%143 = icmp slt i32 %141, %142
br i1 %143, label %144, label %157
144: ; preds = %140
%145 = load double, double* %27
%146 = load double, double* %20
%147 = fsub double %146, %145
store double %147, double* %20
%148 = load double, double* %20
%149 = call zeroext i8 @round(double %148)
store i8 %149, i8* %21
%150 = load i32*, i32** %16
%151 = call i32 @fwrite(i8* %21, i32 1, i32 1, i32* %150)
%152 = load i32, i32* %24
%153 = add nsw i32 %152, 1
store i32 %153, i32* %24
br label %154
154: ; preds = %144
%155 = load i32, i32* %28
%156 = add nsw i32 %155, 1
store i32 %156, i32* %28
br label %140
157: ; preds = %140
br label %158
158: ; preds = %157, %124
br label %159
159: ; preds = %158, %121
%160 = load i32*, i32** %16
%161 = load i32, i32* %24
%162 = load i32*, i32** %15
%163 = call i8* @inEx(i32* %160, i32 0, i32 %161, i32* %162)
store i8* %163, i8** %29
%164 = load i32*, i32** %16
%165 = call i32 @fclose(i32* %164)
%166 = load i8*, i8** %29
store i8* %166, i8** %8
br label %167
167: ; preds = %159, %33
%168 = load i8*, i8** %8
ret i8* %168
}

LLVM IR (-O2):
@.str = [8 x i8] c"tmp.bin\00"
@.str.1 = [4 x i8] c"wb+\00"
@str = [32 x i8] c"Error: cannot open file tmp.bin\00"
define i8* @resample(i8* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %110
12: ; preds = %7
%13 = sitofp i32 %3 to double
%14 = sitofp i32 %4 to double
%15 = fdiv double %13, %14
%16 = sitofp i32 %2 to double
%17 = icmp sgt i32 %2, 0
br i1 %17, label %18, label %81
18: ; preds = %12
%19 = fcmp ult double %15, 1.000000e+00
%20 = sext i32 %1 to i64
br label %21
21: ; preds = %18, %70
%22 = phi double [ 0.000000e+00, %18 ], [ %74, %70 ]
%23 = phi double [ 0.000000e+00, %18 ], [ %73, %70 ]
%24 = phi i32 [ 0, %18 ], [ %78, %70 ]
%25 = phi i32 [ 0, %18 ], [ %72, %70 ]
%26 = phi double [ 0.000000e+00, %18 ], [ %79, %70 ]
br i1 %19, label %61, label %27
27: ; preds = %21
%28 = fcmp olt double %22, 0.000000e+00
%29 = fneg double %22
%30 = tail call double @llvm.fmuladd.f64(double %23, double %29, double 0.000000e+00)
%31 = select i1 %28, double %30, double 0.000000e+00
%32 = fadd double %15, %22
%33 = fcmp ogt double %32, 0.000000e+00
br i1 %33, label %34, label %55
34: ; preds = %27
%35 = sext i32 %25 to i64
br label %36
36: ; preds = %34, %36
%37 = phi i64 [ %35, %34 ], [ %46, %36 ]
%38 = phi double [ %32, %34 ], [ %51, %36 ]
%39 = phi double [ %31, %34 ], [ %50, %36 ]
%40 = add nsw i64 %37, %20
%41 = getelementptr inbounds i8, i8* %0, i64 %40
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = add nsw i32 %43, -128
%45 = sitofp i32 %44 to double
%46 = add i64 %37, 1
%47 = fcmp ult double %38, 1.000000e+00
%48 = fadd double %39, %45
%49 = tail call double @llvm.fmuladd.f64(double %45, double %38, double %39)
%50 = select i1 %47, double %49, double %48
%51 = fadd double %38, -1.000000e+00
%52 = fcmp ogt double %51, 0.000000e+00
br i1 %52, label %36, label %53
53: ; preds = %36
%54 = trunc i64 %46 to i32
br label %55
55: ; preds = %53, %27
%56 = phi double [ %31, %27 ], [ %50, %53 ]
%57 = phi i32 [ %25, %27 ], [ %54, %53 ]
%58 = phi double [ %23, %27 ], [ %45, %53 ]
%59 = phi double [ %32, %27 ], [ %51, %53 ]
%60 = fdiv double %56, %15
br label %70
61: ; preds = %21
%62 = fptosi double %26 to i32
%63 = add nsw i32 %62, %1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %0, i64 %64
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = add nsw i32 %67, -128
%69 = sitofp i32 %68 to double
br label %70
70: ; preds = %61, %55
%71 = phi double [ %60, %55 ], [ %69, %61 ]
%72 = phi i32 [ %57, %55 ], [ %25, %61 ]
%73 = phi double [ %58, %55 ], [ %23, %61 ]
%74 = phi double [ %59, %55 ], [ %22, %61 ]
%75 = tail call zeroext i8 @round(double %71)
%76 = sext i8 %75 to i32
%77 = tail call i32 @fputc(i32 %76, i32* %8)
%78 = add nuw nsw i32 %24, 1
%79 = fadd double %15, %26
%80 = fcmp olt double %79, %16
br i1 %80, label %21, label %81
81: ; preds = %70, %12
%82 = phi double [ 0.000000e+00, %12 ], [ %71, %70 ]
%83 = phi i32 [ 0, %12 ], [ %78, %70 ]
%84 = icmp sgt i32 %5, 1
br i1 %84, label %85, label %106
85: ; preds = %81
%86 = add nsw i32 %5, -1
%87 = and i32 %83, %86
%88 = sub nsw i32 %5, %87
%89 = icmp eq i32 %87, 0
br i1 %89, label %106, label %90
90: ; preds = %85
%91 = sitofp i32 %88 to double
%92 = fdiv double %82, %91
%93 = icmp sgt i32 %88, 0
br i1 %93, label %94, label %106
94: ; preds = %90
%95 = add i32 %83, %5
%96 = sub i32 %95, %87
br label %97
97: ; preds = %94, %97
%98 = phi i32 [ %104, %97 ], [ %83, %94 ]
%99 = phi double [ %100, %97 ], [ %82, %94 ]
%100 = fsub double %99, %92
%101 = tail call zeroext i8 @round(double %100)
%102 = sext i8 %101 to i32
%103 = tail call i32 @fputc(i32 %102, i32* %8)
%104 = add i32 %98, 1
%105 = icmp eq i32 %104, %96
br i1 %105, label %106, label %97
106: ; preds = %97, %90, %85, %81
%107 = phi i32 [ %83, %81 ], [ %83, %85 ], [ %83, %90 ], [ %96, %97 ]
%108 = tail call i8* @inEx(i32* %8, i32 0, i32 %107, i32* %6)
%109 = tail call i32 @fclose(i32* %8)
br label %110
110: ; preds = %106, %10
%111 = phi i8* [ null, %10 ], [ %108, %106 ]
ret i8* %111
}