// File: /workspace/github_c_makefile_star2_O0/randyrossi[P]fisher-modem/mkfilter/src/mkfilter.C
// Function: compute_bpres()
static void compute_bpres() { /* compute Z-plane pole & zero positions for
                                 bandpass resonator */
  zplane.numpoles = zplane.numzeros = 2;
  zplane.zeros[0] = 1.0;
  zplane.zeros[1] = -1.0;
  double theta = TWOPI * raw_alpha1; /* where we want the peak to be */
  if (infq) {                        /* oscillator */
    complex zp = expj(theta);
    zplane.poles[0] = zp;
    zplane.poles[1] = cconj(zp);
  } else { /* must iterate to find exact pole positions */
    complex topcoeffs[MAXPZ + 1];
    expand(zplane.zeros, zplane.numzeros, topcoeffs);
    double r = exp(-theta / (2.0 * qfactor));
    double thm = theta, th1 = 0.0, th2 = PI;
    bool cvg = false;
    for (int i = 0; i < 50 && !cvg; i++) {
      complex zp = r * expj(thm);
      zplane.poles[0] = zp;
      zplane.poles[1] = cconj(zp);
      complex botcoeffs[MAXPZ + 1];
      expand(zplane.poles, zplane.numpoles, botcoeffs);
      complex g = evaluate(topcoeffs, zplane.numzeros, botcoeffs,
                           zplane.numpoles, expj(theta));
      double phi = g.im / g.re; /* approx to atan2 */
      if (phi > 0.0)
        th2 = thm;
      else
        th1 = thm;
      if (fabs(phi) < EPS)
        cvg = true;
      thm = 0.5 * (th1 + th2);
    }
    unless(cvg) fprintf(stderr, "mkfilter: warning: failed to converge\n");
  }
}

// Assembly:
subq $0x4178, %rsp           # imm = 0x4178
movl $0x2, 0xf7db(%rip)      # 0x112ec
movl $0x2, 0xf7cd(%rip)      # 0x112e8
leaq 0x4168(%rsp), %rdi
movsd 0x44f5(%rip), %xmm0     # 0x6020
xorps %xmm1, %xmm1
callq 0x4ea0
movq 0x4168(%rsp), %rax
movq %rax, 0xd7a6(%rip)      # 0xf2e8
movq 0x4170(%rsp), %rax
movq %rax, 0xd79f(%rip)      # 0xf2f0
leaq 0x4158(%rsp), %rdi
movsd 0x44b7(%rip), %xmm0     # 0x6018
xorps %xmm1, %xmm1
callq 0x4ea0
movq 0x4158(%rsp), %rax
movq %rax, 0xd780(%rip)      # 0xf2f8
movq 0x4160(%rsp), %rax
movq %rax, 0xd779(%rip)      # 0xf300
movsd 0x4481(%rip), %xmm0     # 0x6010
mulsd 0xf7a9(%rip), %xmm0     # 0x11340
movsd %xmm0, 0x4150(%rsp)
testb $0x1, 0xf7b9(%rip)      # 0x11360
je 0x1c57
movsd 0x4150(%rsp), %xmm0
callq 0x5750
movsd %xmm0, 0x4140(%rsp)
movsd %xmm1, 0x4148(%rsp)
movq 0x4140(%rsp), %rax
movq %rax, 0xb70c(%rip)      # 0xd2e8
movq 0x4148(%rsp), %rax
movq %rax, 0xb705(%rip)      # 0xd2f0
movq 0x4140(%rsp), %rax
movq %rax, 0x4120(%rsp)
movq 0x4148(%rsp), %rax
movq %rax, 0x4128(%rsp)
movsd 0x4120(%rsp), %xmm0
movsd 0x4128(%rsp), %xmm1
callq 0x4f60
movsd %xmm0, 0x4130(%rsp)
movsd %xmm1, 0x4138(%rsp)
movq 0x4130(%rsp), %rax
movq %rax, 0xb6b5(%rip)      # 0xd2f8
movq 0x4138(%rsp), %rax
movq %rax, 0xb6ae(%rip)      # 0xd300
jmp 0x1ffe
leaq 0x2110(%rsp), %rax
movq %rax, %rcx
addq $0x2010, %rcx           # imm = 0x2010
movq %rcx, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x4e90
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, 0x60(%rsp)
jne 0x1c73
movl 0xf64c(%rip), %esi      # 0x112ec
leaq 0x2110(%rsp), %rdx
leaq 0xb639(%rip), %rdi      # 0xd2e8
addq $0x2000, %rdi           # imm = 0x2000
callq 0x43e0
movsd 0x4150(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x434d(%rip), %xmm1     # 0x6030
mulsd 0xf67d(%rip), %xmm1     # 0x11368
divsd %xmm1, %xmm0
callq 0x1170
movsd %xmm0, 0x2108(%rsp)
movsd 0x4150(%rsp), %xmm0
movsd %xmm0, 0x2100(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x20f8(%rsp)
movsd 0x4305(%rip), %xmm0     # 0x6028
movsd %xmm0, 0x20f0(%rsp)
movb $0x0, 0x20ef(%rsp)
movl $0x0, 0x20e8(%rsp)
xorl %eax, %eax
cmpl $0x32, 0x20e8(%rsp)
movb %al, 0x4f(%rsp)
jge 0x1d5c
movb 0x20ef(%rsp), %al
xorb $-0x1, %al
movb %al, 0x4f(%rsp)
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x1d69
jmp 0x1fda
movsd 0x2108(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x2100(%rsp), %xmm0
callq 0x5750
movaps %xmm0, %xmm2
movsd 0x30(%rsp), %xmm0
movsd %xmm2, 0x20c8(%rsp)
movsd %xmm1, 0x20d0(%rsp)
movsd 0x20c8(%rsp), %xmm1
movsd 0x20d0(%rsp), %xmm2
callq 0x5030
movsd %xmm0, 0x20d8(%rsp)
movsd %xmm1, 0x20e0(%rsp)
movq 0x20d8(%rsp), %rax
movq %rax, 0xb50f(%rip)      # 0xd2e8
movq 0x20e0(%rsp), %rax
movq %rax, 0xb508(%rip)      # 0xd2f0
movq 0x20d8(%rsp), %rax
movq %rax, 0x20a8(%rsp)
movq 0x20e0(%rsp), %rax
movq %rax, 0x20b0(%rsp)
movsd 0x20a8(%rsp), %xmm0
movsd 0x20b0(%rsp), %xmm1
callq 0x4f60
movsd %xmm0, 0x20b8(%rsp)
movsd %xmm1, 0x20c0(%rsp)
movq 0x20b8(%rsp), %rax
movq %rax, 0xb4b8(%rip)      # 0xd2f8
movq 0x20c0(%rsp), %rax
movq %rax, 0xb4b1(%rip)      # 0xd300
leaq 0x90(%rsp), %rax
movq %rax, %rcx
addq $0x2010, %rcx           # imm = 0x2010
movq %rcx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x4e90
movq 0x28(%rsp), %rax
movq 0x38(%rsp), %rcx
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x1e6b
movl 0xf450(%rip), %esi      # 0x112e8
leaq 0x90(%rsp), %rdx
leaq 0xb441(%rip), %rdi      # 0xd2e8
callq 0x43e0
leaq 0x2110(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0xf42d(%rip), %eax      # 0x112ec
movl %eax, 0x14(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0xf412(%rip), %eax      # 0x112e8
movl %eax, 0x24(%rsp)
movsd 0x4150(%rsp), %xmm0
callq 0x5750
movq 0x8(%rsp), %rdi
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %rdx
movl 0x24(%rsp), %ecx
movsd %xmm0, 0x70(%rsp)
movsd %xmm1, 0x78(%rsp)
movsd 0x70(%rsp), %xmm0
movsd 0x78(%rsp), %xmm1
callq 0x5330
movsd %xmm0, 0x80(%rsp)
movsd %xmm1, 0x88(%rsp)
movsd 0x88(%rsp), %xmm0
divsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x68(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1f64
movsd 0x2100(%rsp), %xmm0
movsd %xmm0, 0x20f0(%rsp)
jmp 0x1f76
movsd 0x2100(%rsp), %xmm0
movsd %xmm0, 0x20f8(%rsp)
movsd 0x68(%rsp), %xmm1
movaps 0x40dd(%rip), %xmm0     # 0x6060
pand %xmm0, %xmm1
movsd 0x40a9(%rip), %xmm0     # 0x6038
ucomisd %xmm1, %xmm0
jbe 0x1f9d
movb $0x1, 0x20ef(%rsp)
movsd 0x20f8(%rsp), %xmm1
addsd 0x20f0(%rsp), %xmm1
movsd 0x4089(%rip), %xmm0     # 0x6040
mulsd %xmm1, %xmm0
movsd %xmm0, 0x2100(%rsp)
movl 0x20e8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20e8(%rsp)
jmp 0x1d3f
testb $0x1, 0x20ef(%rsp)
jne 0x1ffc
movq 0x6ff5(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
leaq 0x46e2(%rip), %rsi      # 0x66d7
movb $0x0, %al
callq 0x1140
jmp 0x1ffe
addq $0x4178, %rsp           # imm = 0x4178
retq
nopw %cs:(%rax,%rax)