#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*/ complex;

/* Variables and functions */
int M_PI;
double cabs(int /*<<< orphan*/);
int /*<<< orphan*/ pz2res(double, double, int /*<<< orphan*/ *, double,
                          int /*<<< orphan*/ *, double);
double sqrt(double);
void firstparams(double fref, double fl, double nz, complex *zr, double np,
                 complex *pl, double sg, double *gain_factor, double *fc,
                 double *h) {
  double w0, w, amp01;
  w0 = 2 * M_PI * fref;
  *gain_factor = cabs(pz2res(w0, nz, zr, np, pl, sg));
  w = 2 * M_PI * fl;
  amp01 = cabs(pz2res(w, nz, zr, np, pl, sg));
  *fc = fl * sqrt((*gain_factor) / amp01);
  w = 2 * M_PI * (*fc);
  amp01 = cabs(pz2res(w, nz, zr, np, pl, sg));
  *h = (*gain_factor) / (2. * amp01);
}


x86 assembly (clang, -O0):
<firstparams>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm2
mov    -0x30(%rbp),%rsi
movsd  -0x38(%rbp),%xmm3
call   1040 <pz2res@plt>
mov    %eax,%edi
call   1030 <cabs@plt>
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm2
mov    -0x30(%rbp),%rsi
movsd  -0x38(%rbp),%xmm3
call   1040 <pz2res@plt>
mov    %eax,%edi
call   1030 <cabs@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x68(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x48(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm2
mov    -0x30(%rbp),%rsi
movsd  -0x38(%rbp),%xmm3
call   1040 <pz2res@plt>
mov    %eax,%edi
call   1030 <cabs@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd80(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<firstparams>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%r15
movsd  %xmm4,0x20(%rsp)
mov    %rsi,%r12
movsd  %xmm3,0x18(%rsp)
mov    %rdi,%rbx
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
mov    0x2e7c(%rip),%rbp
mov    0x0(%rbp),%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
movaps %xmm4,%xmm3
call   1040 <pz2res@plt>
mov    %eax,%edi
call   1030 <cabs@plt>
movsd  %xmm0,(%r15)
mov    0x0(%rbp),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm2
mov    %r12,%rsi
movsd  0x20(%rsp),%xmm3
call   1040 <pz2res@plt>
mov    %eax,%edi
call   1030 <cabs@plt>
movapd %xmm0,%xmm1
movsd  (%r15),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e9 <firstparams+0xb9>
sqrtsd %xmm0,%xmm0
jmp    11ee <firstparams+0xbe>
call   1050 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x0(%r13)
mov    0x0(%rbp),%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm2
mov    %r12,%rsi
movsd  0x20(%rsp),%xmm3
call   1040 <pz2res@plt>
mov    %eax,%edi
call   1030 <cabs@plt>
movsd  (%r15),%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define void @firstparams(double %0, double %1, double %2, i32* %3, double %4, i32* %5, double %6, double* %7, double* %8, double* %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32*
%15 = alloca double
%16 = alloca i32*
%17 = alloca double
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store i32* %3, i32** %14
store double %4, double* %15
store i32* %5, i32** %16
store double %6, double* %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
%24 = load i32, i32* @M_PI
%25 = mul nsw i32 2, %24
%26 = sitofp i32 %25 to double
%27 = load double, double* %11
%28 = fmul double %26, %27
store double %28, double* %21
%29 = load double, double* %21
%30 = load double, double* %13
%31 = load i32*, i32** %14
%32 = load double, double* %15
%33 = load i32*, i32** %16
%34 = load double, double* %17
%35 = call i32 @pz2res(double %29, double %30, i32* %31, double %32, i32* %33, double %34)
%36 = call double @cabs(i32 %35)
%37 = load double*, double** %18
store double %36, double* %37
%38 = load i32, i32* @M_PI
%39 = mul nsw i32 2, %38
%40 = sitofp i32 %39 to double
%41 = load double, double* %12
%42 = fmul double %40, %41
store double %42, double* %22
%43 = load double, double* %22
%44 = load double, double* %13
%45 = load i32*, i32** %14
%46 = load double, double* %15
%47 = load i32*, i32** %16
%48 = load double, double* %17
%49 = call i32 @pz2res(double %43, double %44, i32* %45, double %46, i32* %47, double %48)
%50 = call double @cabs(i32 %49)
store double %50, double* %23
%51 = load double, double* %12
%52 = load double*, double** %18
%53 = load double, double* %52
%54 = load double, double* %23
%55 = fdiv double %53, %54
%56 = call double @sqrt(double %55)
%57 = fmul double %51, %56
%58 = load double*, double** %19
store double %57, double* %58
%59 = load i32, i32* @M_PI
%60 = mul nsw i32 2, %59
%61 = sitofp i32 %60 to double
%62 = load double*, double** %19
%63 = load double, double* %62
%64 = fmul double %61, %63
store double %64, double* %22
%65 = load double, double* %22
%66 = load double, double* %13
%67 = load i32*, i32** %14
%68 = load double, double* %15
%69 = load i32*, i32** %16
%70 = load double, double* %17
%71 = call i32 @pz2res(double %65, double %66, i32* %67, double %68, i32* %69, double %70)
%72 = call double @cabs(i32 %71)
store double %72, double* %23
%73 = load double*, double** %18
%74 = load double, double* %73
%75 = load double, double* %23
%76 = fmul double 2.000000e+00, %75
%77 = fdiv double %74, %76
%78 = load double*, double** %20
store double %77, double* %78
ret void
}

LLVM IR (-O2):
@M_PI = global i32 0
define void @firstparams(double %0, double %1, double %2, i32* %3, double %4, i32* %5, double %6, double* nocapture %7, double* nocapture writeonly %8, double* nocapture writeonly %9) {
%11 = load i32, i32* @M_PI
%12 = shl nsw i32 %11, 1
%13 = sitofp i32 %12 to double
%14 = fmul double %13, %0
%15 = tail call i32 @pz2res(double %14, double %2, i32* %3, double %4, i32* %5, double %6)
%16 = tail call double @cabs(i32 %15)
store double %16, double* %7
%17 = load i32, i32* @M_PI
%18 = shl nsw i32 %17, 1
%19 = sitofp i32 %18 to double
%20 = fmul double %19, %1
%21 = tail call i32 @pz2res(double %20, double %2, i32* %3, double %4, i32* %5, double %6)
%22 = tail call double @cabs(i32 %21)
%23 = load double, double* %7
%24 = fdiv double %23, %22
%25 = tail call double @sqrt(double %24)
%26 = fmul double %25, %1
store double %26, double* %8
%27 = load i32, i32* @M_PI
%28 = shl nsw i32 %27, 1
%29 = sitofp i32 %28 to double
%30 = fmul double %26, %29
%31 = tail call i32 @pz2res(double %30, double %2, i32* %3, double %4, i32* %5, double %6)
%32 = tail call double @cabs(i32 %31)
%33 = load double, double* %7
%34 = fmul double %32, 2.000000e+00
%35 = fdiv double %33, %34
store double %35, double* %9
ret void
}