#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ stderr;
int compute_clock(unsigned int ChipType, double target, double Fref,
                  unsigned int ClkMaxN, unsigned int ClkMaxM,
                  unsigned int *bestM, unsigned int *bestN, unsigned int *bestP,
                  unsigned int *bestPSN) {
  unsigned int M, N, P, PSN, PSNx;
  double bestError = 0, abest = 42, bestFout = 0;
  double Fvco, Fout;
  double error, aerror;
  unsigned int M_min = 3;
  unsigned int M_max = ClkMaxM;
  if (target < 1e6) {
    fprintf(stderr, "MHz assumed, changed to %g MHz\n", target);
    target *= 1e6;
  }
  if (target > 220.0e6) {
    fprintf(stderr, "too large\n");
    return 1;
  }
  for (PSNx = ((ChipType == 0x35) || (ChipType == 0x36)) ? 1 : 0; PSNx <= 1;
       PSNx++) {
    unsigned int low_N, high_N;
    double Fref4PSN;
    PSN = PSNx ? 1 : 4;
    low_N = 3;
    high_N = ClkMaxN;
    while (Fref / (PSN * low_N) >
           (((ChipType == 0x35) || (ChipType == 0x36)) ? 5.0e6 : 2.0e6))
      low_N++;
    while (Fref / (PSN * high_N) < 150.0e3)
      high_N--;
    Fref4PSN = Fref * 4 / PSN;
    for (N = low_N; N <= high_N; N++) {
      double tmp = Fref4PSN / N;
      for (P = (ChipType & 0x20 && (ChipType != 0x35) && (ChipType != 0x36))
                   ? 1
                   : 0;
           P <= 5; P++) {
        double Fvco_desired = target * (1 << P);
        double M_desired = Fvco_desired / tmp;
        unsigned int M_low = M_desired - 1;
        unsigned int M_hi = M_desired + 1;
        if (M_hi < M_min || M_low > M_max)
          continue;
        if (M_low < M_min)
          M_low = M_min;
        if (M_hi > M_max)
          M_hi = M_max;
        for (M = M_low; M <= M_hi; M++) {
          Fvco = tmp * M;
          if (Fvco <=
              ((ChipType == 0x35) || (ChipType == 0x36) ? 100e6 : 48.0e6))
            continue;
          if (Fvco > 220.0e6)
            break;
          Fout = Fvco / (1 << P);
          error = (target - Fout) / target;
          aerror = (error < 0) ? -error : error;
          if (aerror < abest) {
            abest = aerror;
            bestError = error;
            *bestM = M;
            *bestN = N;
            *bestP = P;
            *bestPSN = PSN;
            bestFout = Fout;
          }
        }
      }
    }
  }
  if (abest < 0.01) {
    printf("best: M=%d N=%d P=%d PSN=%d\n", *bestM, *bestN, *bestP, *bestPSN);
    if (bestFout > 1.0e6)
      printf("Fout = %g MHz", bestFout / 1.0e6);
    else if (bestFout > 1.0e3)
      printf("Fout = %g kHz", bestFout / 1.0e3);
    else
      printf("Fout = %g Hz", bestFout);
    printf(", error = %g\n", bestError);
    return 0;
  }
  printf("can't do it with less than %g error\n", bestError);
  return 1;
}


x86 assembly (clang, -O0):
<compute_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x3,-0x8c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x90(%rbp)
movsd  0xe7a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11bf <compute_clock+0x9f>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
movsd  -0x10(%rbp),%xmm0
lea    0xeba(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0xe4b(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f9 <compute_clock+0xd9>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17df <compute_clock+0x6bf>
mov    $0x1,%al
cmpl   $0x35,-0x8(%rbp)
mov    %al,-0xc1(%rbp)
je     1218 <compute_clock+0xf8>
cmpl   $0x36,-0x8(%rbp)
sete   %al
mov    %al,-0xc1(%rbp)
mov    -0xc1(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x1,-0x4c(%rbp)
ja     16da <compute_clock+0x5ba>
mov    -0x4c(%rbp),%edx
mov    $0x4,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x48(%rbp)
movl   $0x3,-0x94(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x98(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x48(%rbp),%eax
mov    -0x94(%rbp),%ecx
imul   %ecx,%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    $0x1,%al
cmpl   $0x35,-0x8(%rbp)
mov    %al,-0xc2(%rbp)
je     12a2 <compute_clock+0x182>
cmpl   $0x36,-0x8(%rbp)
sete   %al
mov    %al,-0xc2(%rbp)
mov    -0xc2(%rbp),%al
movsd  0xd78(%rip),%xmm0
movsd  0xd78(%rip),%xmm1
movsd  %xmm1,-0xe0(%rbp)
ff
test   $0x1,%al
movsd  %xmm0,-0xd8(%rbp)
ff
jne    12e0 <compute_clock+0x1c0>
movsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0xd8(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
jbe    130e <compute_clock+0x1ee>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1261 <compute_clock+0x141>
jmp    1313 <compute_clock+0x1f3>
movsd  -0x18(%rbp),%xmm1
mov    -0x48(%rbp),%eax
mov    -0x98(%rbp),%ecx
imul   %ecx,%eax
cvtsi2sd %rax,%xmm0
divsd  %xmm0,%xmm1
movsd  0xd03(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1353 <compute_clock+0x233>
mov    -0x98(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x98(%rbp)
jmp    1313 <compute_clock+0x1f3>
movsd  -0x18(%rbp),%xmm0
movsd  0xce0(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x48(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x94(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x98(%rbp),%eax
ja     16c7 <compute_clock+0x5a7>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x40(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x8(%rbp),%ecx
and    $0x20,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xe1(%rbp)
je     13e2 <compute_clock+0x2c2>
xor    %eax,%eax
cmpl   $0x35,-0x8(%rbp)
mov    %al,-0xe1(%rbp)
je     13e2 <compute_clock+0x2c2>
cmpl   $0x36,-0x8(%rbp)
setne  %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x5,-0x44(%rbp)
ja     16b4 <compute_clock+0x594>
movsd  -0x10(%rbp),%xmm0
mov    -0x44(%rbp),%cl
mov    $0x1,%eax
shl    %cl,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  0xbfb(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,-0xbc(%rbp)
movsd  -0xb8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jb     1497 <compute_clock+0x377>
mov    -0xbc(%rbp),%eax
cmp    -0x90(%rbp),%eax
jbe    149c <compute_clock+0x37c>
jmp    16a6 <compute_clock+0x586>
mov    -0xbc(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jae    14ba <compute_clock+0x39a>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0x90(%rbp),%eax
jbe    14d8 <compute_clock+0x3b8>
mov    -0x90(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0xbc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0xc0(%rbp),%eax
ja     16a1 <compute_clock+0x581>
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x3c(%rbp),%eax
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
mov    $0x1,%al
cmpl   $0x35,-0x8(%rbp)
mov    %al,-0xe2(%rbp)
je     1535 <compute_clock+0x415>
cmpl   $0x36,-0x8(%rbp)
sete   %al
mov    %al,-0xe2(%rbp)
mov    -0xe2(%rbp),%al
movsd  0xb0d(%rip),%xmm0
movsd  0xb0d(%rip),%xmm1
movsd  %xmm1,-0x100(%rbp)
ff
test   $0x1,%al
movsd  %xmm0,-0xf8(%rbp)
ff
jne    1573 <compute_clock+0x453>
movsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xf0(%rbp),%xmm1
ff
movsd  -0xf8(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jb     1592 <compute_clock+0x472>
jmp    1693 <compute_clock+0x573>
movsd  -0x70(%rbp),%xmm0
movsd  0xa71(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15ae <compute_clock+0x48e>
jmp    16a1 <compute_clock+0x581>
movsd  -0x70(%rbp),%xmm0
mov    -0x44(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    1615 <compute_clock+0x4f5>
movsd  -0x80(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
jmp    1622 <compute_clock+0x502>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0x108(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    168e <compute_clock+0x56e>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x3c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1693 <compute_clock+0x573>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14e1 <compute_clock+0x3c1>
jmp    16a6 <compute_clock+0x586>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    13f8 <compute_clock+0x2d8>
jmp    16b9 <compute_clock+0x599>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1381 <compute_clock+0x261>
jmp    16cc <compute_clock+0x5ac>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    122e <compute_clock+0x10e>
movsd  0x936(%rip),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    17c5 <compute_clock+0x6a5>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
cvtsi2sd %rax,%xmm0
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rax
mov    (%rax),%edx
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0x97a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x68(%rbp),%xmm0
movsd  0x8db(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1753 <compute_clock+0x633>
movsd  -0x68(%rbp),%xmm0
movsd  0x8c4(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0x961(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    17a6 <compute_clock+0x686>
movsd  -0x68(%rbp),%xmm0
movsd  0x8c0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    178e <compute_clock+0x66e>
movsd  -0x68(%rbp),%xmm0
movsd  0x8a9(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0x934(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    17a1 <compute_clock+0x681>
movsd  -0x68(%rbp),%xmm0
lea    0x92a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    17a6 <compute_clock+0x686>
movsd  -0x58(%rbp),%xmm0
lea    0x91f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    17df <compute_clock+0x6bf>
movsd  -0x58(%rbp),%xmm0
lea    0x90e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_clock>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %rsi,0x20(%rsp)
mov    %edi,%r13d
movsd  0xeb7(%rip),%xmm2
ucomisd %xmm0,%xmm2
movsd  %xmm1,0x18(%rsp)
jbe    1184 <compute_clock+0x64>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xf1b(%rip),%rsi
mov    $0x1,%al
movsd  %xmm0,(%rsp)
call   1040 <fprintf@plt>
movsd  (%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xe7c(%rip),%xmm0
ucomisd 0xe7c(%rip),%xmm0
jbe    11aa <compute_clock+0x8a>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xf02(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    14a8 <compute_clock+0x388>
movsd  %xmm0,(%rsp)
mov    0x70(%rsp),%rax
lea    -0x35(%r13),%ecx
xor    %r9d,%r9d
cmp    $0x2,%ecx
setb   %r9b
lea    0xe87(%rip),%rcx
movsd  (%rcx,%r9,8),%xmm11
movsd  0xe39(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %r13d,%ecx
and    $0x20,%ecx
shr    $0x5,%ecx
add    $0xffffffc9,%r13d
cmp    $0xfffffffe,%r13d
setb   %dl
and    %cl,%dl
movzbl %dl,%r10d
lea    0xe5e(%rip),%rcx
movsd  (%rcx,%r9,8),%xmm2
mov    0x20(%rsp),%rcx
add    $0x1,%ecx
mov    %ecx,0x14(%rsp)
movsd  0xdfc(%rip),%xmm7
xorpd  %xmm14,%xmm14
movsd  0xdf7(%rip),%xmm4
movsd  0xdf6(%rip),%xmm12
movsd  0xdf5(%rip),%xmm13
mov    $0x3,%r11d
movsd  0xdbe(%rip),%xmm9
movapd 0xe1d(%rip),%xmm15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
jmp    128c <compute_clock+0x16c>
nopl   0x0(%rax)
add    $0x1,%r9d
cmp    $0x2,%r9d
movsd  0x18(%rsp),%xmm1
movsd  0xd9a(%rip),%xmm4
je     1445 <compute_clock+0x325>
xor    %ecx,%ecx
test   %r9d,%r9d
sete   %cl
lea    (%rcx,%rcx,2),%edx
add    $0x1,%edx
lea    (%rdx,%rdx,2),%ecx
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%edi
xorps  %xmm0,%xmm0
cvtsi2sd %rdi,%xmm0
movapd %xmm1,%xmm3
divsd  %xmm0,%xmm3
add    $0x1,%esi
add    %edx,%ecx
ucomisd %xmm11,%xmm3
ja     12b0 <compute_clock+0x190>
mov    0x20(%rsp),%rcx
imul   %edx,%ecx
mov    0x14(%rsp),%r13d
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edi
xorps  %xmm0,%xmm0
cvtsi2sd %rdi,%xmm0
movapd %xmm1,%xmm3
divsd  %xmm0,%xmm3
add    $0xffffffff,%r13d
sub    %edx,%ecx
ucomisd %xmm3,%xmm4
ja     12e0 <compute_clock+0x1c0>
cmp    %r13d,%esi
ja     1270 <compute_clock+0x150>
mov    %edx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  0x30(%rsp),%xmm10
divsd  %xmm0,%xmm10
movsd  (%rsp),%xmm1
jmp    133c <compute_clock+0x21c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%esi
cmp    %r13d,%esi
ja     1270 <compute_clock+0x150>
mov    %esi,%ecx
xorps  %xmm3,%xmm3
cvtsi2sd %rcx,%xmm3
movapd %xmm10,%xmm0
divsd  %xmm3,%xmm0
mov    %r10d,%ecx
jmp    1368 <compute_clock+0x248>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
cmp    $0x6,%ecx
je     1330 <compute_clock+0x210>
mov    $0x1,%edi
shl    %cl,%edi
xorps  %xmm5,%xmm5
cvtsi2sd %edi,%xmm5
movapd %xmm1,%xmm4
mulsd  %xmm5,%xmm4
divsd  %xmm0,%xmm4
movapd %xmm4,%xmm3
addsd  %xmm12,%xmm3
addsd  %xmm13,%xmm4
cvttsd2si %xmm4,%rdi
cmp    $0x3,%edi
jb     1360 <compute_clock+0x240>
cvttsd2si %xmm3,%r12
cmp    %ebp,%r12d
ja     1360 <compute_clock+0x240>
cmp    $0x4,%r12d
cmovb  %r11d,%r12d
cmp    %ebp,%edi
cmova  %ebp,%edi
jmp    13c4 <compute_clock+0x2a4>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12d
cmp    %edi,%r12d
ja     1360 <compute_clock+0x240>
mov    %r12d,%r8d
xorps  %xmm6,%xmm6
cvtsi2sd %r8,%xmm6
mulsd  %xmm0,%xmm6
ucomisd %xmm6,%xmm2
jae    13c0 <compute_clock+0x2a0>
ucomisd %xmm9,%xmm6
ja     1360 <compute_clock+0x240>
divsd  %xmm5,%xmm6
movapd %xmm1,%xmm8
subsd  %xmm6,%xmm8
divsd  %xmm1,%xmm8
movapd %xmm8,%xmm4
xorpd  %xmm15,%xmm4
movapd %xmm8,%xmm3
cmpltsd %xmm14,%xmm3
andpd  %xmm3,%xmm4
andnpd %xmm8,%xmm3
orpd   %xmm4,%xmm3
ucomisd %xmm3,%xmm7
jbe    13c0 <compute_clock+0x2a0>
mov    %r12d,(%rbx)
mov    %esi,(%r15)
mov    %ecx,(%r14)
mov    %edx,(%rax)
movsd  %xmm6,0x28(%rsp)
movapd %xmm3,%xmm7
movsd  %xmm8,0x8(%rsp)
jmp    13c0 <compute_clock+0x2a0>
movsd  0xbeb(%rip),%xmm0
ucomisd %xmm7,%xmm0
jbe    1494 <compute_clock+0x374>
mov    (%rbx),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
mov    (%r15),%esi
mov    (%r14),%edx
mov    (%rax),%ecx
lea    0xc3f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x28(%rsp),%xmm0
ucomisd 0xb7f(%rip),%xmm0
jbe    14af <compute_clock+0x38f>
divsd  0xb75(%rip),%xmm0
lea    0xc36(%rip),%rdi
jmp    14d1 <compute_clock+0x3b1>
lea    0xc64(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x1,%eax
jmp    14ee <compute_clock+0x3ce>
ucomisd 0xb89(%rip),%xmm0
jbe    14ca <compute_clock+0x3aa>
divsd  0xb7f(%rip),%xmm0
lea    0xc0e(%rip),%rdi
jmp    14d1 <compute_clock+0x3b1>
lea    0xc13(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xc12(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"MHz assumed, changed to %g MHz\0A\00"
@.str.1 = [11 x i8] c"too large\0A\00"
@.str.2 = [29 x i8] c"best: M=%d N=%d P=%d PSN=%d\0A\00"
@.str.3 = [14 x i8] c"Fout = %g MHz\00"
@.str.4 = [14 x i8] c"Fout = %g kHz\00"
@.str.5 = [13 x i8] c"Fout = %g Hz\00"
@.str.6 = [14 x i8] c", error = %g\0A\00"
@.str.7 = [37 x i8] c"can't do it with less than %g error\0A\00"
define i32 @compute_clock(i32 %0, double %1, double %2, i32 %3, i32 %4, i32* %5, i32* %6, i32* %7, i32* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
%40 = alloca i32
%41 = alloca i32
store i32 %0, i32* %11
store double %1, double* %12
store double %2, double* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32* %5, i32** %16
store i32* %6, i32** %17
store i32* %7, i32** %18
store i32* %8, i32** %19
store double 0.000000e+00, double* %25
store double 4.200000e+01, double* %26
store double 0.000000e+00, double* %27
store i32 3, i32* %32
%42 = load i32, i32* %15
store i32 %42, i32* %33
%43 = load double, double* %12
%44 = fcmp olt double %43, 1.000000e+06
br i1 %44, label %45, label %51
45: ; preds = %9
%46 = load i32, i32* @stderr
%47 = load double, double* %12
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %47)
%49 = load double, double* %12
%50 = fmul double %49, 1.000000e+06
store double %50, double* %12
br label %51
51: ; preds = %45, %9
%52 = load double, double* %12
%53 = fcmp ogt double %52, 2.200000e+08
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* @stderr
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %10
br label %290
57: ; preds = %51
%58 = load i32, i32* %11
%59 = icmp eq i32 %58, 53
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i32, i32* %11
%62 = icmp eq i32 %61, 54
br label %63
63: ; preds = %60, %57
%64 = phi i1 [ true, %57 ], [ %62, %60 ]
%65 = zext i1 %64 to i64
%66 = select i1 %64, i32 1, i32 0
store i32 %66, i32* %24
br label %67
67: ; preds = %250, %63
%68 = load i32, i32* %24
%69 = icmp ule i32 %68, 1
br i1 %69, label %70, label %253
70: ; preds = %67
%71 = load i32, i32* %24
%72 = icmp ne i32 %71, 0
%73 = zext i1 %72 to i64
%74 = select i1 %72, i32 1, i32 4
store i32 %74, i32* %23
store i32 3, i32* %34
%75 = load i32, i32* %14
store i32 %75, i32* %35
br label %76
76: ; preds = %93, %70
%77 = load double, double* %13
%78 = load i32, i32* %23
%79 = load i32, i32* %34
%80 = mul i32 %78, %79
%81 = uitofp i32 %80 to double
%82 = fdiv double %77, %81
%83 = load i32, i32* %11
%84 = icmp eq i32 %83, 53
br i1 %84, label %88, label %85
85: ; preds = %76
%86 = load i32, i32* %11
%87 = icmp eq i32 %86, 54
br label %88
88: ; preds = %85, %76
%89 = phi i1 [ true, %76 ], [ %87, %85 ]
%90 = zext i1 %89 to i64
%91 = select i1 %89, double 5.000000e+06, double 2.000000e+06
%92 = fcmp ogt double %82, %91
br i1 %92, label %93, label %96
93: ; preds = %88
%94 = load i32, i32* %34
%95 = add i32 %94, 1
store i32 %95, i32* %34
br label %76
96: ; preds = %88
br label %97
97: ; preds = %105, %96
%98 = load double, double* %13
%99 = load i32, i32* %23
%100 = load i32, i32* %35
%101 = mul i32 %99, %100
%102 = uitofp i32 %101 to double
%103 = fdiv double %98, %102
%104 = fcmp olt double %103, 1.500000e+05
br i1 %104, label %105, label %108
105: ; preds = %97
%106 = load i32, i32* %35
%107 = add i32 %106, -1
store i32 %107, i32* %35
br label %97
108: ; preds = %97
%109 = load double, double* %13
%110 = fmul double %109, 4.000000e+00
%111 = load i32, i32* %23
%112 = uitofp i32 %111 to double
%113 = fdiv double %110, %112
store double %113, double* %36
%114 = load i32, i32* %34
store i32 %114, i32* %21
br label %115
115: ; preds = %246, %108
%116 = load i32, i32* %21
%117 = load i32, i32* %35
%118 = icmp ule i32 %116, %117
br i1 %118, label %119, label %249
119: ; preds = %115
%120 = load double, double* %36
%121 = load i32, i32* %21
%122 = uitofp i32 %121 to double
%123 = fdiv double %120, %122
store double %123, double* %37
%124 = load i32, i32* %11
%125 = and i32 %124, 32
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %133
127: ; preds = %119
%128 = load i32, i32* %11
%129 = icmp ne i32 %128, 53
br i1 %129, label %130, label %133
130: ; preds = %127
%131 = load i32, i32* %11
%132 = icmp ne i32 %131, 54
br label %133
133: ; preds = %130, %127, %119
%134 = phi i1 [ false, %127 ], [ false, %119 ], [ %132, %130 ]
%135 = zext i1 %134 to i64
%136 = select i1 %134, i32 1, i32 0
store i32 %136, i32* %22
br label %137
137: ; preds = %242, %133
%138 = load i32, i32* %22
%139 = icmp ule i32 %138, 5
br i1 %139, label %140, label %245
140: ; preds = %137
%141 = load double, double* %12
%142 = load i32, i32* %22
%143 = shl i32 1, %142
%144 = sitofp i32 %143 to double
%145 = fmul double %141, %144
store double %145, double* %38
%146 = load double, double* %38
%147 = load double, double* %37
%148 = fdiv double %146, %147
store double %148, double* %39
%149 = load double, double* %39
%150 = fsub double %149, 1.000000e+00
%151 = fptoui double %150 to i32
store i32 %151, i32* %40
%152 = load double, double* %39
%153 = fadd double %152, 1.000000e+00
%154 = fptoui double %153 to i32
store i32 %154, i32* %41
%155 = load i32, i32* %41
%156 = load i32, i32* %32
%157 = icmp ult i32 %155, %156
br i1 %157, label %162, label %158
158: ; preds = %140
%159 = load i32, i32* %40
%160 = load i32, i32* %33
%161 = icmp ugt i32 %159, %160
br i1 %161, label %162, label %163
162: ; preds = %158, %140
br label %242
163: ; preds = %158
%164 = load i32, i32* %40
%165 = load i32, i32* %32
%166 = icmp ult i32 %164, %165
br i1 %166, label %167, label %169
167: ; preds = %163
%168 = load i32, i32* %32
store i32 %168, i32* %40
br label %169
169: ; preds = %167, %163
%170 = load i32, i32* %41
%171 = load i32, i32* %33
%172 = icmp ugt i32 %170, %171
br i1 %172, label %173, label %175
173: ; preds = %169
%174 = load i32, i32* %33
store i32 %174, i32* %41
br label %175
175: ; preds = %173, %169
%176 = load i32, i32* %40
store i32 %176, i32* %20
br label %177
177: ; preds = %238, %175
%178 = load i32, i32* %20
%179 = load i32, i32* %41
%180 = icmp ule i32 %178, %179
br i1 %180, label %181, label %241
181: ; preds = %177
%182 = load double, double* %37
%183 = load i32, i32* %20
%184 = uitofp i32 %183 to double
%185 = fmul double %182, %184
store double %185, double* %28
%186 = load double, double* %28
%187 = load i32, i32* %11
%188 = icmp eq i32 %187, 53
br i1 %188, label %192, label %189
189: ; preds = %181
%190 = load i32, i32* %11
%191 = icmp eq i32 %190, 54
br label %192
192: ; preds = %189, %181
%193 = phi i1 [ true, %181 ], [ %191, %189 ]
%194 = zext i1 %193 to i64
%195 = select i1 %193, double 1.000000e+08, double 4.800000e+07
%196 = fcmp ole double %186, %195
br i1 %196, label %197, label %198
197: ; preds = %192
br label %238
198: ; preds = %192
%199 = load double, double* %28
%200 = fcmp ogt double %199, 2.200000e+08
br i1 %200, label %201, label %202
201: ; preds = %198
br label %241
202: ; preds = %198
%203 = load double, double* %28
%204 = load i32, i32* %22
%205 = shl i32 1, %204
%206 = sitofp i32 %205 to double
%207 = fdiv double %203, %206
store double %207, double* %29
%208 = load double, double* %12
%209 = load double, double* %29
%210 = fsub double %208, %209
%211 = load double, double* %12
%212 = fdiv double %210, %211
store double %212, double* %30
%213 = load double, double* %30
%214 = fcmp olt double %213, 0.000000e+00
br i1 %214, label %215, label %218
215: ; preds = %202
%216 = load double, double* %30
%217 = fneg double %216
br label %220
218: ; preds = %202
%219 = load double, double* %30
br label %220
220: ; preds = %218, %215
%221 = phi double [ %217, %215 ], [ %219, %218 ]
store double %221, double* %31
%222 = load double, double* %31
%223 = load double, double* %26
%224 = fcmp olt double %222, %223
br i1 %224, label %225, label %237
225: ; preds = %220
%226 = load double, double* %31
store double %226, double* %26
%227 = load double, double* %30
store double %227, double* %25
%228 = load i32, i32* %20
%229 = load i32*, i32** %16
store i32 %228, i32* %229
%230 = load i32, i32* %21
%231 = load i32*, i32** %17
store i32 %230, i32* %231
%232 = load i32, i32* %22
%233 = load i32*, i32** %18
store i32 %232, i32* %233
%234 = load i32, i32* %23
%235 = load i32*, i32** %19
store i32 %234, i32* %235
%236 = load double, double* %29
store double %236, double* %27
br label %237
237: ; preds = %225, %220
br label %238
238: ; preds = %237, %197
%239 = load i32, i32* %20
%240 = add i32 %239, 1
store i32 %240, i32* %20
br label %177
241: ; preds = %201, %177
br label %242
242: ; preds = %241, %162
%243 = load i32, i32* %22
%244 = add i32 %243, 1
store i32 %244, i32* %22
br label %137
245: ; preds = %137
br label %246
246: ; preds = %245
%247 = load i32, i32* %21
%248 = add i32 %247, 1
store i32 %248, i32* %21
br label %115
249: ; preds = %115
br label %250
250: ; preds = %249
%251 = load i32, i32* %24
%252 = add i32 %251, 1
store i32 %252, i32* %24
br label %67
253: ; preds = %67
%254 = load double, double* %26
%255 = fcmp olt double %254, 1.000000e-02
br i1 %255, label %256, label %287
256: ; preds = %253
%257 = load i32*, i32** %16
%258 = load i32, i32* %257
%259 = uitofp i32 %258 to double
%260 = load i32*, i32** %17
%261 = load i32, i32* %260
%262 = load i32*, i32** %18
%263 = load i32, i32* %262
%264 = load i32*, i32** %19
%265 = load i32, i32* %264
%266 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %259, i32 %261, i32 %263, i32 %265)
%267 = load double, double* %27
%268 = fcmp ogt double %267, 1.000000e+06
br i1 %268, label %269, label %273
269: ; preds = %256
%270 = load double, double* %27
%271 = fdiv double %270, 1.000000e+06
%272 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %271)
br label %284
273: ; preds = %256
%274 = load double, double* %27
%275 = fcmp ogt double %274, 1.000000e+03
br i1 %275, label %276, label %280
276: ; preds = %273
%277 = load double, double* %27
%278 = fdiv double %277, 1.000000e+03
%279 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %278)
br label %283
280: ; preds = %273
%281 = load double, double* %27
%282 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %281)
br label %283
283: ; preds = %280, %276
br label %284
284: ; preds = %283, %269
%285 = load double, double* %25
%286 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %285)
store i32 0, i32* %10
br label %290
287: ; preds = %253
%288 = load double, double* %25
%289 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %288)
store i32 1, i32* %10
br label %290
290: ; preds = %287, %284, %54
%291 = load i32, i32* %10
ret i32 %291
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"MHz assumed, changed to %g MHz\0A\00"
@.str.1 = [11 x i8] c"too large\0A\00"
@.str.2 = [29 x i8] c"best: M=%d N=%d P=%d PSN=%d\0A\00"
@.str.3 = [14 x i8] c"Fout = %g MHz\00"
@.str.4 = [14 x i8] c"Fout = %g kHz\00"
@.str.5 = [13 x i8] c"Fout = %g Hz\00"
@.str.6 = [14 x i8] c", error = %g\0A\00"
@.str.7 = [37 x i8] c"can't do it with less than %g error\0A\00"
define i32 @compute_clock(i32 %0, double %1, double %2, i32 %3, i32 %4, i32* nocapture %5, i32* nocapture %6, i32* nocapture %7, i32* nocapture %8) {
%10 = fcmp olt double %1, 1.000000e+06
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %1)
%14 = fmul double %1, 1.000000e+06
br label %15
15: ; preds = %11, %9
%16 = phi double [ %14, %11 ], [ %1, %9 ]
%17 = fcmp ogt double %16, 2.200000e+08
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %152
21: ; preds = %15
%22 = add i32 %0, -53
%23 = icmp ult i32 %22, 2
%24 = zext i1 %23 to i32
%25 = select i1 %23, double 5.000000e+06, double 2.000000e+06
%26 = fmul double %2, 4.000000e+00
%27 = and i32 %0, 32
%28 = icmp ne i32 %27, 0
%29 = add i32 %0, -55
%30 = icmp ult i32 %29, -2
%31 = and i1 %30, %28
%32 = zext i1 %31 to i32
%33 = select i1 %23, double 1.000000e+08, double 4.800000e+07
br label %34
34: ; preds = %21, %122
%35 = phi i32 [ %24, %21 ], [ %126, %122 ]
%36 = phi double [ 0.000000e+00, %21 ], [ %125, %122 ]
%37 = phi double [ 4.200000e+01, %21 ], [ %124, %122 ]
%38 = phi double [ 0.000000e+00, %21 ], [ %123, %122 ]
%39 = icmp eq i32 %35, 0
%40 = select i1 %39, i32 4, i32 1
br label %41
41: ; preds = %41, %34
%42 = phi i32 [ 3, %34 ], [ %47, %41 ]
%43 = mul i32 %42, %40
%44 = uitofp i32 %43 to double
%45 = fdiv double %2, %44
%46 = fcmp ogt double %45, %25
%47 = add i32 %42, 1
br i1 %46, label %41, label %48
48: ; preds = %41, %48
%49 = phi i32 [ %54, %48 ], [ %3, %41 ]
%50 = mul i32 %49, %40
%51 = uitofp i32 %50 to double
%52 = fdiv double %2, %51
%53 = fcmp olt double %52, 1.500000e+05
%54 = add i32 %49, -1
br i1 %53, label %48, label %55
55: ; preds = %48
%56 = uitofp i32 %40 to double
%57 = fdiv double %26, %56
%58 = icmp ugt i32 %42, %49
br i1 %58, label %122, label %59
59: ; preds = %55, %119
%60 = phi i32 [ %120, %119 ], [ %42, %55 ]
%61 = phi double [ %116, %119 ], [ %36, %55 ]
%62 = phi double [ %115, %119 ], [ %37, %55 ]
%63 = phi double [ %114, %119 ], [ %38, %55 ]
%64 = uitofp i32 %60 to double
%65 = fdiv double %57, %64
br label %66
66: ; preds = %59, %113
%67 = phi i32 [ %32, %59 ], [ %117, %113 ]
%68 = phi double [ %61, %59 ], [ %116, %113 ]
%69 = phi double [ %62, %59 ], [ %115, %113 ]
%70 = phi double [ %63, %59 ], [ %114, %113 ]
%71 = shl nuw nsw i32 1, %67
%72 = sitofp i32 %71 to double
%73 = fmul double %16, %72
%74 = fdiv double %73, %65
%75 = fadd double %74, -1.000000e+00
%76 = fptoui double %75 to i32
%77 = fadd double %74, 1.000000e+00
%78 = fptoui double %77 to i32
%79 = icmp ult i32 %78, 3
%80 = icmp ugt i32 %76, %4
%81 = select i1 %79, i1 true, i1 %80
br i1 %81, label %113, label %82
82: ; preds = %66
%83 = icmp ugt i32 %76, 3
%84 = select i1 %83, i32 %76, i32 3
%85 = icmp ugt i32 %78, %4
%86 = select i1 %85, i32 %4, i32 %78
%87 = icmp ugt i32 %84, %86
br i1 %87, label %113, label %88
88: ; preds = %82, %107
%89 = phi i32 [ %111, %107 ], [ %84, %82 ]
%90 = phi double [ %110, %107 ], [ %68, %82 ]
%91 = phi double [ %109, %107 ], [ %69, %82 ]
%92 = phi double [ %108, %107 ], [ %70, %82 ]
%93 = uitofp i32 %89 to double
%94 = fmul double %65, %93
%95 = fcmp ugt double %94, %33
br i1 %95, label %96, label %107
96: ; preds = %88
%97 = fcmp ogt double %94, 2.200000e+08
br i1 %97, label %113, label %98
98: ; preds = %96
%99 = fdiv double %94, %72
%100 = fsub double %16, %99
%101 = fdiv double %100, %16
%102 = fcmp olt double %101, 0.000000e+00
%103 = fneg double %101
%104 = select i1 %102, double %103, double %101
%105 = fcmp olt double %104, %91
br i1 %105, label %106, label %107
106: ; preds = %98
store i32 %89, i32* %5
store i32 %60, i32* %6
store i32 %67, i32* %7
store i32 %40, i32* %8
br label %107
107: ; preds = %98, %106, %88
%108 = phi double [ %92, %88 ], [ %99, %106 ], [ %92, %98 ]
%109 = phi double [ %91, %88 ], [ %104, %106 ], [ %91, %98 ]
%110 = phi double [ %90, %88 ], [ %101, %106 ], [ %90, %98 ]
%111 = add i32 %89, 1
%112 = icmp ugt i32 %111, %86
br i1 %112, label %113, label %88
113: ; preds = %96, %107, %82, %66
%114 = phi double [ %70, %66 ], [ %70, %82 ], [ %92, %96 ], [ %108, %107 ]
%115 = phi double [ %69, %66 ], [ %69, %82 ], [ %91, %96 ], [ %109, %107 ]
%116 = phi double [ %68, %66 ], [ %68, %82 ], [ %90, %96 ], [ %110, %107 ]
%117 = add nuw nsw i32 %67, 1
%118 = icmp eq i32 %117, 6
br i1 %118, label %119, label %66
119: ; preds = %113
%120 = add i32 %60, 1
%121 = icmp ugt i32 %120, %49
br i1 %121, label %122, label %59
122: ; preds = %119, %55
%123 = phi double [ %38, %55 ], [ %114, %119 ]
%124 = phi double [ %37, %55 ], [ %115, %119 ]
%125 = phi double [ %36, %55 ], [ %116, %119 ]
%126 = add nuw nsw i32 %35, 1
%127 = icmp eq i32 %126, 2
br i1 %127, label %128, label %34
128: ; preds = %122
%129 = fcmp olt double %124, 1.000000e-02
br i1 %129, label %130, label %150
130: ; preds = %128
%131 = load i32, i32* %5
%132 = uitofp i32 %131 to double
%133 = load i32, i32* %6
%134 = load i32, i32* %7
%135 = load i32, i32* %8
%136 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %132, i32 %133, i32 %134, i32 %135)
%137 = fcmp ogt double %123, 1.000000e+06
br i1 %137, label %138, label %141
138: ; preds = %130
%139 = fdiv double %123, 1.000000e+06
%140 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), double %139)
br label %148
141: ; preds = %130
%142 = fcmp ogt double %123, 1.000000e+03
br i1 %142, label %143, label %146
143: ; preds = %141
%144 = fdiv double %123, 1.000000e+03
%145 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %144)
br label %148
146: ; preds = %141
%147 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %123)
br label %148
148: ; preds = %143, %146, %138
%149 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %125)
br label %152
150: ; preds = %128
%151 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), double %125)
br label %152
152: ; preds = %150, %148, %18
%153 = phi i32 [ 1, %18 ], [ 0, %148 ], [ 1, %150 ]
ret i32 %153
}