#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 M_PI;
int ceil(double);
double lsx_kaiser_beta(double, double);
void lsx_kaiser_params(double att, double Fc, double tr_bw, double *beta,
                       int *num_taps) {
  *beta = *beta < 0 ? lsx_kaiser_beta(att, tr_bw * .5 / Fc) : *beta;
  att = att < 60 ? (att - 7.95) / (2.285 * M_PI * 2)
                 : ((.0007528358 - 1.577737e-05 * *beta) * *beta + .6248022) *
                           *beta +
                       .06186902;
  *num_taps = !*num_taps ? ceil(att / tr_bw + 1) : *num_taps;
}


x86 assembly (clang, -O0):
<lsx_kaiser_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    1176 <lsx_kaiser_params+0x56>
movsd  -0x8(%rbp),%xmm0
movsd  0xea3(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
call   1040 <lsx_kaiser_beta@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    1183 <lsx_kaiser_params+0x63>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe70(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11e1 <lsx_kaiser_params+0xc1>
movsd  -0x8(%rbp),%xmm0
movsd  0xe90(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe7c(%rip),%xmm1
mov    0x2e25(%rip),%rax
mulsd  (%rax),%xmm1
movsd  0xe61(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1236 <lsx_kaiser_params+0x116>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe2f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2b(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe03(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1270 <lsx_kaiser_params+0x150>
movsd  -0x8(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  0xde9(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x3c(%rbp)
jmp    1279 <lsx_kaiser_params+0x159>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsx_kaiser_params>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm3
movsd  (%rdi),%xmm0
xorpd  %xmm4,%xmm4
ucomisd %xmm0,%xmm4
jbe    1174 <lsx_kaiser_params+0x54>
movsd  0xeb9(%rip),%xmm4
mulsd  %xmm2,%xmm4
divsd  %xmm1,%xmm4
movapd %xmm3,%xmm0
movapd %xmm4,%xmm1
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1040 <lsx_kaiser_beta@plt>
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  %xmm0,(%rbx)
movsd  0xe88(%rip),%xmm1
ucomisd %xmm3,%xmm1
jbe    11ab <lsx_kaiser_params+0x8b>
addsd  0xea2(%rip),%xmm3
mov    0x2e53(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xe97(%rip),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm3
jmp    11d7 <lsx_kaiser_params+0xb7>
movsd  0xe5d(%rip),%xmm3
mulsd  %xmm0,%xmm3
addsd  0xe59(%rip),%xmm3
mulsd  %xmm0,%xmm3
addsd  0xe55(%rip),%xmm3
mulsd  %xmm0,%xmm3
addsd  0xe51(%rip),%xmm3
mov    (%r14),%eax
test   %eax,%eax
jne    11f3 <lsx_kaiser_params+0xd3>
divsd  %xmm2,%xmm3
addsd  0xe56(%rip),%xmm3
movapd %xmm3,%xmm0
call   1030 <ceil@plt>
mov    %eax,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @lsx_kaiser_params(double %0, double %1, double %2, double* %3, i32* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca i32*
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store i32* %4, i32** %10
%11 = load double*, double** %9
%12 = load double, double* %11
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %21
14: ; preds = %5
%15 = load double, double* %6
%16 = load double, double* %8
%17 = fmul double %16, 5.000000e-01
%18 = load double, double* %7
%19 = fdiv double %17, %18
%20 = call double @lsx_kaiser_beta(double %15, double %19)
br label %24
21: ; preds = %5
%22 = load double*, double** %9
%23 = load double, double* %22
br label %24
24: ; preds = %21, %14
%25 = phi double [ %20, %14 ], [ %23, %21 ]
%26 = load double*, double** %9
store double %25, double* %26
%27 = load double, double* %6
%28 = fcmp olt double %27, 6.000000e+01
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = load double, double* %6
%31 = fsub double %30, 7.950000e+00
%32 = load double, double* @M_PI
%33 = fmul double 2.285000e+00, %32
%34 = fmul double %33, 2.000000e+00
%35 = fdiv double %31, %34
br label %46
36: ; preds = %24
%37 = load double*, double** %9
%38 = load double, double* %37
%39 = call double @llvm.fmuladd.f64(double 0xBEF08B349C54E2EE, double %38, double 0x3F48AB3E91F3F95B)
%40 = load double*, double** %9
%41 = load double, double* %40
%42 = call double @llvm.fmuladd.f64(double %39, double %41, double 0x3FE3FE612EEF00D4)
%43 = load double*, double** %9
%44 = load double, double* %43
%45 = call double @llvm.fmuladd.f64(double %42, double %44, double 0x3FAFAD4BD3123638)
br label %46
46: ; preds = %36, %29
%47 = phi double [ %35, %29 ], [ %45, %36 ]
store double %47, double* %6
%48 = load i32*, i32** %10
%49 = load i32, i32* %48
%50 = icmp ne i32 %49, 0
br i1 %50, label %57, label %51
51: ; preds = %46
%52 = load double, double* %6
%53 = load double, double* %8
%54 = fdiv double %52, %53
%55 = fadd double %54, 1.000000e+00
%56 = call i32 @ceil(double %55)
br label %60
57: ; preds = %46
%58 = load i32*, i32** %10
%59 = load i32, i32* %58
br label %60
60: ; preds = %57, %51
%61 = phi i32 [ %56, %51 ], [ %59, %57 ]
%62 = load i32*, i32** %10
store i32 %61, i32* %62
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @lsx_kaiser_params(double %0, double %1, double %2, double* nocapture %3, i32* nocapture %4) {
%6 = load double, double* %3
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = fmul double %2, 5.000000e-01
%10 = fdiv double %9, %1
%11 = tail call double @lsx_kaiser_beta(double %0, double %10)
br label %12
12: ; preds = %5, %8
%13 = phi double [ %11, %8 ], [ %6, %5 ]
store double %13, double* %3
%14 = fcmp olt double %0, 6.000000e+01
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = fadd double %0, -7.950000e+00
%17 = load double, double* @M_PI
%18 = fmul double %17, 2.285000e+00
%19 = fmul double %18, 2.000000e+00
%20 = fdiv double %16, %19
br label %25
21: ; preds = %12
%22 = tail call double @llvm.fmuladd.f64(double %13, double 0xBEF08B349C54E2EE, double 0x3F48AB3E91F3F95B)
%23 = tail call double @llvm.fmuladd.f64(double %22, double %13, double 0x3FE3FE612EEF00D4)
%24 = tail call double @llvm.fmuladd.f64(double %23, double %13, double 0x3FAFAD4BD3123638)
br label %25
25: ; preds = %21, %15
%26 = phi double [ %20, %15 ], [ %24, %21 ]
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = fdiv double %26, %2
%31 = fadd double %30, 1.000000e+00
%32 = tail call i32 @ceil(double %31)
br label %33
33: ; preds = %25, %29
%34 = phi i32 [ %32, %29 ], [ %27, %25 ]
store i32 %34, i32* %4
ret void
}