#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 atan(double);
double ceil(unsigned int);
double cos(double);
double sin(double);
void subsamplingCal(unsigned int M, double alpha, double *f_def,
                    unsigned int *Sk) {
  unsigned int i, k;
  for (i = 0; i < M + 1; i++) {
    double w = 2.0 * 3.14159265358979323846 * (i / (double)(2 * M));
    f_def[i] = (w - 2.0 * atan((alpha * sin(w)) / (alpha * cos(w) - 1))) /
               (2.0 * 3.14159265358979323846);
  }
  double a_def = 2.0 * 3.14159265358979323846 * (1.0 / (double)(2 * M)) +
                 3.14159265358979323846 / (double)(2 * M);
  double fs_def =
      (a_def - 2.0 * atan(alpha * sin(a_def) / (alpha * cos(a_def) - 1.0))) /
      (2.0 * 3.14159265358979323846);
  double fU, fL;
  for (k = 0; k < M; k++) {
    Sk[k] = 1;
    if (k == 0) {
      fU = fs_def;
      fL = f_def[k];
    } else if (k == (M - 1)) {
      fU = f_def[k + 1];
      fL = f_def[k - 1];
    } else {
      fU = f_def[k + 2];
      fL = f_def[k - 1];
    }
    double B = fU - fL;
    unsigned int nk_max = (unsigned int)(fU / B);
    for (unsigned int nk = 0; nk < nk_max; nk++) {
      unsigned int ub = (unsigned int)((nk + 1) / (2 * fU));
      unsigned int lb =
          (unsigned int)(((ceil(nk / (2 * fL))) > (1.0)) ? (ceil(nk / (2 * fL)))
                                                         : (1.0)) -
          1;
      if (ub >= lb) {
        for (unsigned int s = lb; s < ub; s++) {
          if ((s + 1.0) * B <= 0.5)
            Sk[k] = (((Sk[k]) > ((s + 1))) ? (Sk[k]) : ((s + 1)));
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<subsamplingCal>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    1245 <subsamplingCal+0x105>
mov    -0x24(%rbp),%eax
cvtsi2sd %rax,%xmm1
mov    -0x4(%rbp),%eax
add    %eax,%eax
cvtsi2sd %rax,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1060 <cos@plt>
movsd  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm2,%xmm1
movsd  0xe06(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xdd9(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1162 <subsamplingCal+0x22>
mov    -0x4(%rbp),%eax
add    %eax,%eax
cvtsi2sd %rax,%xmm2
movsd  0xdc1(%rip),%xmm0
divsd  %xmm2,%xmm0
movsd  0xdad(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0xd91(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1060 <cos@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
movsd  0xd1b(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xceb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1591 <subsamplingCal+0x451>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
movl   $0x1,(%rax,%rcx,4)
cmpl   $0x0,-0x28(%rbp)
jne    1369 <subsamplingCal+0x229>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13dc <subsamplingCal+0x29c>
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    13ab <subsamplingCal+0x26b>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13d7 <subsamplingCal+0x297>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x2,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13dc <subsamplingCal+0x29c>
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jae    157e <subsamplingCal+0x43e>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %rax,%xmm0
movsd  -0x48(%rbp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x50(%rbp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
call   1030 <ceil@plt>
movsd  0xbb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1499 <subsamplingCal+0x359>
mov    -0x60(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x50(%rbp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
call   1030 <ceil@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    14ae <subsamplingCal+0x36e>
movsd  0xb77(%rip),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    14ae <subsamplingCal+0x36e>
movsd  -0xb8(%rbp),%xmm0
ff
cvttsd2si %xmm0,%rax
sub    $0x1,%eax
mov    %eax,-0x68(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x68(%rbp),%eax
jb     156b <subsamplingCal+0x42b>
mov    -0x68(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jae    1566 <subsamplingCal+0x426>
mov    -0x6c(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  0xb29(%rip),%xmm0
addsd  %xmm0,%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  0xb20(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1553 <subsamplingCal+0x413>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    -0x6c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jbe    1537 <subsamplingCal+0x3f7>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0xbc(%rbp)
jmp    1543 <subsamplingCal+0x403>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
mov    -0xbc(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
jmp    1558 <subsamplingCal+0x418>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    14d3 <subsamplingCal+0x393>
jmp    156b <subsamplingCal+0x42b>
jmp    1570 <subsamplingCal+0x430>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    140c <subsamplingCal+0x2cc>
jmp    1583 <subsamplingCal+0x443>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1325 <subsamplingCal+0x1e5>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subsamplingCal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
movsd  %xmm0,0x8(%rsp)
mov    %edi,%r15d
lea    (%r15,%r15,1),%ecx
mov    %edi,%eax
cvtsi2sd %rcx,%xmm1
inc    %eax
je     1210 <subsamplingCal+0xd0>
mov    %eax,%ebx
xor    %ebp,%ebp
movsd  %xmm1,0x20(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
divsd  %xmm1,%xmm2
movsd  0xe6a(%rip),%xmm0
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
movapd %xmm2,%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0xe3a(%rip),%xmm0
movsd  0x28(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <atan@plt>
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm2
divsd  0xe03(%rip),%xmm2
movsd  %xmm2,(%r14,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1180 <subsamplingCal+0x40>
movsd  0xdf8(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xdf4(%rip),%xmm2
divsd  %xmm1,%xmm2
mulsd  0xdd0(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0xda4(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <atan@plt>
test   %r15d,%r15d
je     142c <subsamplingCal+0x2ec>
addsd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0xd6a(%rip),%xmm1
movsd  %xmm1,0x18(%rsp)
lea    -0x1(%r15),%eax
mov    %r15d,%ecx
mov    %rcx,0x40(%rsp)
mov    %rax,0x38(%rsp)
lea    (%r14,%rax,8),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,0x30(%rsp)
xor    %ebp,%ebp
jmp    12cf <subsamplingCal+0x18f>
xchg   %ax,%ax
add    $0x1,%rbp
cmp    0x40(%rsp),%rbp
je     142c <subsamplingCal+0x2ec>
movl   $0x1,(%r12,%rbp,4)
mov    %r14,%rax
movsd  0x18(%rsp),%xmm3
test   %rbp,%rbp
je     1311 <subsamplingCal+0x1d1>
mov    0x38(%rsp),%rax
cmp    %rax,%rbp
jne    1300 <subsamplingCal+0x1c0>
movsd  0x8(%r14,%rax,8),%xmm3
mov    0x30(%rsp),%rax
jmp    1311 <subsamplingCal+0x1d1>
nopl   (%rax)
lea    0x2(%rbp),%eax
movsd  (%r14,%rax,8),%xmm3
lea    (%r14,%rbp,8),%rax
add    $0xfffffffffffffff8,%rax
movsd  (%rax),%xmm0
movapd %xmm3,%xmm4
movsd  %xmm0,0x8(%rsp)
subsd  %xmm0,%xmm4
movapd %xmm3,%xmm0
divsd  %xmm4,%xmm0
cvttsd2si %xmm0,%r13
test   %r13d,%r13d
je     12c0 <subsamplingCal+0x180>
addsd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %r15d,%r15d
xorpd  %xmm0,%xmm0
movsd  %xmm3,0x28(%rsp)
movsd  %xmm4,0x20(%rsp)
jmp    1373 <subsamplingCal+0x233>
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm0
addsd  %xmm2,%xmm0
cmp    %r13d,%r15d
je     12c0 <subsamplingCal+0x180>
add    $0x1,%r15d
movsd  %xmm0,0x10(%rsp)
divsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%rbx
mov    %ebx,%edi
call   1030 <ceil@plt>
movsd  0xc79(%rip),%xmm2
ucomisd %xmm2,%xmm0
movapd %xmm2,%xmm0
jbe    13b0 <subsamplingCal+0x270>
mov    %ebx,%edi
call   1030 <ceil@plt>
movsd  0xc60(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %r15,%xmm1
movsd  0x28(%rsp),%xmm3
divsd  %xmm3,%xmm1
cvttsd2si %xmm1,%rax
cvttsd2si %xmm0,%rcx
add    $0xffffffff,%ecx
cmp    %eax,%ecx
movsd  0xc47(%rip),%xmm1
movsd  0x20(%rsp),%xmm4
jb     1408 <subsamplingCal+0x2c8>
jmp    1360 <subsamplingCal+0x220>
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%edx
add    $0x1,%ecx
cmp    %ecx,%edx
cmovbe %ecx,%edx
mov    %edx,(%r12,%rbp,4)
cmp    %eax,%ecx
je     1360 <subsamplingCal+0x220>
mov    %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %rdx,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm4,%xmm0
ucomisd %xmm0,%xmm1
jae    13f0 <subsamplingCal+0x2b0>
add    $0x1,%ecx
cmp    %eax,%ecx
jne    1408 <subsamplingCal+0x2c8>
jmp    1360 <subsamplingCal+0x220>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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