#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 scalar_t__ k_val;

/* Variables and functions */
int /*<<< orphan*/ fc8300_write(void *, unsigned short, int, int);
int fc8300_tuner_set_pll_es(void *handle, unsigned short devid,
                            unsigned int freq, unsigned int offset) {
  unsigned char data_0x51, data_0x57, lo_select, lo_div;
  unsigned int f_diff, f_diff_shifted, n_val, k_val;
  unsigned int f_vco, f_comp, f_lo_kHz;
  unsigned int f_vco_max = 6200000;
  unsigned char lo_divide_ratio[8] = {8, 12, 16, 24, 32, 48, 64, 96};
  unsigned int r_val;
  unsigned char pre_shift_bits = 4;
  f_lo_kHz = freq;
  for (lo_select = 0; lo_select < 7; lo_select++)
    if (f_vco_max < f_lo_kHz * lo_divide_ratio[lo_select + 1])
      break;
  lo_div = lo_divide_ratio[lo_select];
  f_vco = f_lo_kHz * lo_div;
  r_val = 1;
  f_comp = 19200 / r_val;
  n_val = f_vco / f_comp;
  f_diff = f_vco - f_comp * n_val;
  f_diff_shifted = f_diff << (20 - pre_shift_bits);
  k_val = f_diff_shifted / (f_comp >> pre_shift_bits);
  k_val = k_val | 1;
  data_0x57 = ((n_val >> 3) & 0x20);
  data_0x57 += (r_val == 1) ? 0 : 0x10;
  data_0x57 += (k_val >> 16);
  data_0x51 = 0;
  data_0x51 += (lo_select * 2) + 1;
  fc8300_write(handle, devid, 0x7C, 0x00);
  fc8300_write(handle, devid, 0x7E, 0x00);
  fc8300_write(handle, devid, 0x7F, 0x00);
  fc8300_write(handle, devid, 0x80, 0x00);
  fc8300_write(handle, devid, 0x81, 0x00);
  fc8300_write(handle, devid, 0x15, 0x77);
  fc8300_write(handle, devid, 0x91, 0xA8);
  if (f_vco >= 6084000)
    fc8300_write(handle, devid, 0x5e, 0x07 + offset);
  else if ((f_vco < 6084000) && (f_vco >= 5796000))
    fc8300_write(handle, devid, 0x5e, 0x08 + offset);
  else if ((f_vco < 5796000) && (f_vco >= 5653000))
    fc8300_write(handle, devid, 0x5e, 0x09 + offset);
  else if ((f_vco < 5653000) && (f_vco >= 5547000))
    fc8300_write(handle, devid, 0x5e, 0x0a + offset);
  else if ((f_vco < 5547000) && (f_vco >= 5067000))
    fc8300_write(handle, devid, 0x5e, 0x0c + offset);
  else if ((f_vco < 5067000) && (f_vco >= 4731000))
    fc8300_write(handle, devid, 0x5e, 0x0d + offset);
  else if (f_vco < 4731000)
    fc8300_write(handle, devid, 0x5e, 0x14 + offset);
  fc8300_write(handle, devid, 0x51, data_0x51);
  fc8300_write(handle, devid, 0x57, data_0x57);
  fc8300_write(handle, devid, 0x58, (unsigned char)((k_val >> 8) & 0xFF));
  fc8300_write(handle, devid, 0x59, (unsigned char)((k_val)&0xFF));
  fc8300_write(handle, devid, 0x5a, (unsigned char)n_val);
  fc8300_write(handle, devid, 0x50, 0xe3);
  fc8300_write(handle, devid, 0x50, 0xff);
  fc8300_write(handle, devid, 0x91, 0x78);
  fc8300_write(handle, devid, 0x15, 0x46);
  fc8300_write(handle, devid, 0x7C, 0x30);
  fc8300_write(handle, devid, 0x7E, 0x05);
  fc8300_write(handle, devid, 0x7F, 0x0A);
  fc8300_write(handle, devid, 0x80, 0x3F);
  fc8300_write(handle, devid, 0x81, 0x3F);
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x5e9ac0,-0x38(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x40(%rbp)
movb   $0x4,-0x45(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x34(%rbp)
movb   $0x0,-0x17(%rbp)
movzbl -0x17(%rbp),%eax
cmp    $0x7,%eax
jge    118d <fc8300_tuner_set_pll_es+0x7d>
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
movzbl -0x17(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl -0x40(%rbp,%rdx,1),%edx
imul   %edx,%ecx
cmp    %ecx,%eax
jae    117b <fc8300_tuner_set_pll_es+0x6b>
jmp    118d <fc8300_tuner_set_pll_es+0x7d>
jmp    1180 <fc8300_tuner_set_pll_es+0x70>
mov    -0x17(%rbp),%al
add    $0x1,%al
mov    %al,-0x17(%rbp)
jmp    1149 <fc8300_tuner_set_pll_es+0x39>
movzbl -0x17(%rbp),%eax
mov    -0x40(%rbp,%rax,1),%al
mov    %al,-0x18(%rbp)
mov    -0x34(%rbp),%eax
movzbl -0x18(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x1,-0x44(%rbp)
mov    $0x4b00,%eax
xor    %edx,%edx
divl   -0x44(%rbp)
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
imul   -0x24(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
movzbl -0x45(%rbp),%edx
mov    $0x14,%ecx
sub    %edx,%ecx
shl    %cl,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x30(%rbp),%edx
movzbl -0x45(%rbp),%ecx
shr    %cl,%edx
mov    %edx,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
shr    $0x3,%eax
and    $0x20,%eax
mov    %al,-0x16(%rbp)
mov    -0x44(%rbp),%edx
mov    $0x10,%ecx
xor    %eax,%eax
cmp    $0x1,%edx
cmove  %eax,%ecx
movzbl -0x16(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x16(%rbp)
mov    -0x28(%rbp),%ecx
shr    $0x10,%ecx
movzbl -0x16(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x16(%rbp)
movb   $0x0,-0x15(%rbp)
movzbl -0x17(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movzbl -0x15(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7c,%edx
xor    %ecx,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7e,%edx
xor    %ecx,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7f,%edx
xor    %ecx,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x80,%edx
xor    %ecx,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x81,%edx
xor    %ecx,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x15,%edx
mov    $0x77,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x91,%edx
mov    $0xa8,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
cmpl   $0x5cd5a0,-0x2c(%rbp)
jb     130e <fc8300_tuner_set_pll_es+0x1fe>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0x7,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    1476 <fc8300_tuner_set_pll_es+0x366>
cmpl   $0x5cd5a0,-0x2c(%rbp)
jae    1348 <fc8300_tuner_set_pll_es+0x238>
cmpl   $0x5870a0,-0x2c(%rbp)
jb     1348 <fc8300_tuner_set_pll_es+0x238>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0x8,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    1471 <fc8300_tuner_set_pll_es+0x361>
cmpl   $0x5870a0,-0x2c(%rbp)
jae    1382 <fc8300_tuner_set_pll_es+0x272>
cmpl   $0x564208,-0x2c(%rbp)
jb     1382 <fc8300_tuner_set_pll_es+0x272>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0x9,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    146c <fc8300_tuner_set_pll_es+0x35c>
cmpl   $0x564208,-0x2c(%rbp)
jae    13bc <fc8300_tuner_set_pll_es+0x2ac>
cmpl   $0x54a3f8,-0x2c(%rbp)
jb     13bc <fc8300_tuner_set_pll_es+0x2ac>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0xa,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    1467 <fc8300_tuner_set_pll_es+0x357>
cmpl   $0x54a3f8,-0x2c(%rbp)
jae    13f6 <fc8300_tuner_set_pll_es+0x2e6>
cmpl   $0x4d50f8,-0x2c(%rbp)
jb     13f6 <fc8300_tuner_set_pll_es+0x2e6>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0xc,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    1462 <fc8300_tuner_set_pll_es+0x352>
cmpl   $0x4d50f8,-0x2c(%rbp)
jae    1430 <fc8300_tuner_set_pll_es+0x320>
cmpl   $0x483078,-0x2c(%rbp)
jb     1430 <fc8300_tuner_set_pll_es+0x320>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0xd,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    145d <fc8300_tuner_set_pll_es+0x34d>
cmpl   $0x483078,-0x2c(%rbp)
jae    1458 <fc8300_tuner_set_pll_es+0x348>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x14(%rbp),%ecx
add    $0x14,%ecx
mov    $0x5e,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
jmp    145d <fc8300_tuner_set_pll_es+0x34d>
jmp    1462 <fc8300_tuner_set_pll_es+0x352>
jmp    1467 <fc8300_tuner_set_pll_es+0x357>
jmp    146c <fc8300_tuner_set_pll_es+0x35c>
jmp    1471 <fc8300_tuner_set_pll_es+0x361>
jmp    1476 <fc8300_tuner_set_pll_es+0x366>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzbl -0x15(%rbp),%ecx
mov    $0x51,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzbl -0x16(%rbp),%ecx
mov    $0x57,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x28(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff,%ecx
movzbl %cl,%ecx
mov    $0x58,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x28(%rbp),%ecx
and    $0xff,%ecx
movzbl %cl,%ecx
mov    $0x59,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x24(%rbp),%ecx
movzbl %cl,%ecx
mov    $0x5a,%edx
movzwl %ax,%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x50,%edx
mov    $0xe3,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x50,%edx
mov    $0xff,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x91,%edx
mov    $0x78,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x15,%edx
mov    $0x46,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7c,%edx
mov    $0x30,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7e,%edx
mov    $0x5,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7f,%edx
mov    $0xa,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x80,%edx
mov    $0x3f,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x81,%edx
mov    $0x3f,%ecx
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_write@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,0x4(%rsp)
mov    %rdi,%r15
lea    0x0(,%rdx,4),%eax
lea    (%rax,%rax,2),%eax
cmp    $0x5e9ac0,%eax
jbe    1138 <fc8300_tuner_set_pll_es+0x28>
xor    %r12d,%r12d
jmp    1197 <fc8300_tuner_set_pll_es+0x87>
mov    %edx,%eax
shl    $0x4,%eax
mov    $0x1,%r12b
cmp    $0x5e9ac0,%eax
ja     1197 <fc8300_tuner_set_pll_es+0x87>
lea    0x0(,%rdx,8),%ecx
lea    (%rcx,%rcx,2),%ecx
mov    $0x2,%r12b
cmp    $0x5e9ac0,%ecx
ja     1197 <fc8300_tuner_set_pll_es+0x87>
mov    %edx,%ecx
shl    $0x5,%ecx
mov    $0x3,%r12b
cmp    $0x5e9ac0,%ecx
ja     1197 <fc8300_tuner_set_pll_es+0x87>
lea    (%rax,%rax,2),%eax
mov    $0x4,%r12b
cmp    $0x5e9ac0,%eax
ja     1197 <fc8300_tuner_set_pll_es+0x87>
mov    %edx,%eax
shl    $0x6,%eax
mov    $0x5,%r12b
cmp    $0x5e9ac0,%eax
ja     1197 <fc8300_tuner_set_pll_es+0x87>
lea    (%rcx,%rcx,2),%eax
cmp    $0x5e9ac1,%eax
mov    $0x7,%r12b
adc    $0xff,%r12b
movzbl %r12b,%eax
lea    0xe5e(%rip),%rcx
movzbl (%rax,%rcx,1),%ebx
imul   %edx,%ebx
imul   $0x1b4e81b5,%rbx,%r13
shr    $0x2b,%r13
imul   $0xffffb500,%r13d,%eax
add    %ebx,%eax
shl    $0x10,%eax
imul   $0x1b4e81b5,%rax,%r14
shr    $0x27,%r14
movzwl %si,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x7c,%edx
xor    %ecx,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x7e,%edx
xor    %ecx,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x7f,%edx
xor    %ecx,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x81,%edx
xor    %ecx,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x15,%edx
mov    $0x77,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x91,%edx
mov    $0xa8,%ecx
call   1030 <fc8300_write@plt>
mov    $0x7,%ecx
cmp    $0x5cd59f,%ebx
ja     129f <fc8300_tuner_set_pll_es+0x18f>
mov    $0x8,%ecx
cmp    $0x58709f,%ebx
ja     129f <fc8300_tuner_set_pll_es+0x18f>
mov    $0x9,%ecx
cmp    $0x564207,%ebx
ja     129f <fc8300_tuner_set_pll_es+0x18f>
mov    $0xa,%ecx
cmp    $0x54a3f7,%ebx
ja     129f <fc8300_tuner_set_pll_es+0x18f>
mov    $0xc,%ecx
cmp    $0x4d50f7,%ebx
ja     129f <fc8300_tuner_set_pll_es+0x18f>
cmp    $0x483078,%ebx
mov    $0xd,%eax
mov    $0x14,%ecx
cmovae %eax,%ecx
add    0x4(%rsp),%ecx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x5e,%edx
call   1030 <fc8300_write@plt>
add    %r12b,%r12b
or     $0x1,%r12b
mov    %r13d,%eax
shr    $0x3,%eax
and    $0x20,%eax
mov    %r14d,%ebx
shr    $0x10,%ebx
add    %eax,%ebx
movzbl %r12b,%ecx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x51,%edx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x57,%edx
mov    %ebx,%ecx
call   1030 <fc8300_write@plt>
mov    %r14,%rbx
movzbl %bh,%ecx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x58,%edx
call   1030 <fc8300_write@plt>
or     $0x1,%ebx
movzbl %bl,%ecx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x59,%edx
call   1030 <fc8300_write@plt>
movzbl %r13b,%ecx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x5a,%edx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x50,%edx
mov    $0xe3,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x50,%edx
mov    $0xff,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x91,%edx
mov    $0x78,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x15,%edx
mov    $0x46,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x7c,%edx
mov    $0x30,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x7e,%edx
mov    $0x5,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x7f,%edx
mov    $0xa,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x80,%edx
mov    $0x3f,%ecx
call   1030 <fc8300_write@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x81,%edx
mov    $0x3f,%ecx
call   1030 <fc8300_write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.fc8300_tuner_set_pll_es.lo_divide_ratio = [8 x i8] c"\08\0C\10\18 0@`"
define i32 @fc8300_tuner_set_pll_es(i8* %0, i16 zeroext %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca [8 x i8]
%22 = alloca i32
%23 = alloca i8
store i8* %0, i8** %5
store i16 %1, i16* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 6200000, i32* %20
%24 = bitcast [8 x i8]* %21 to i8*
store i8 4, i8* %23
%25 = load i32, i32* %7
store i32 %25, i32* %19
store i8 0, i8* %11
br label %26
26: ; preds = %44, %4
%27 = load i8, i8* %11
%28 = zext i8 %27 to i32
%29 = icmp slt i32 %28, 7
br i1 %29, label %30, label %47
30: ; preds = %26
%31 = load i32, i32* %20
%32 = load i32, i32* %19
%33 = load i8, i8* %11
%34 = zext i8 %33 to i32
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %21, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = mul i32 %32, %39
%41 = icmp ult i32 %31, %40
br i1 %41, label %42, label %43
42: ; preds = %30
br label %47
43: ; preds = %30
br label %44
44: ; preds = %43
%45 = load i8, i8* %11
%46 = add i8 %45, 1
store i8 %46, i8* %11
br label %26
47: ; preds = %42, %26
%48 = load i8, i8* %11
%49 = zext i8 %48 to i64
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %21, i64 0, i64 %49
%51 = load i8, i8* %50
store i8 %51, i8* %12
%52 = load i32, i32* %19
%53 = load i8, i8* %12
%54 = zext i8 %53 to i32
%55 = mul i32 %52, %54
store i32 %55, i32* %17
store i32 1, i32* %22
%56 = load i32, i32* %22
%57 = udiv i32 19200, %56
store i32 %57, i32* %18
%58 = load i32, i32* %17
%59 = load i32, i32* %18
%60 = udiv i32 %58, %59
store i32 %60, i32* %15
%61 = load i32, i32* %17
%62 = load i32, i32* %18
%63 = load i32, i32* %15
%64 = mul i32 %62, %63
%65 = sub i32 %61, %64
store i32 %65, i32* %13
%66 = load i32, i32* %13
%67 = load i8, i8* %23
%68 = zext i8 %67 to i32
%69 = sub nsw i32 20, %68
%70 = shl i32 %66, %69
store i32 %70, i32* %14
%71 = load i32, i32* %14
%72 = load i32, i32* %18
%73 = load i8, i8* %23
%74 = zext i8 %73 to i32
%75 = lshr i32 %72, %74
%76 = udiv i32 %71, %75
store i32 %76, i32* %16
%77 = load i32, i32* %16
%78 = or i32 %77, 1
store i32 %78, i32* %16
%79 = load i32, i32* %15
%80 = lshr i32 %79, 3
%81 = and i32 %80, 32
%82 = trunc i32 %81 to i8
store i8 %82, i8* %10
%83 = load i32, i32* %22
%84 = icmp eq i32 %83, 1
%85 = zext i1 %84 to i64
%86 = select i1 %84, i32 0, i32 16
%87 = load i8, i8* %10
%88 = zext i8 %87 to i32
%89 = add nsw i32 %88, %86
%90 = trunc i32 %89 to i8
store i8 %90, i8* %10
%91 = load i32, i32* %16
%92 = lshr i32 %91, 16
%93 = load i8, i8* %10
%94 = zext i8 %93 to i32
%95 = add i32 %94, %92
%96 = trunc i32 %95 to i8
store i8 %96, i8* %10
store i8 0, i8* %9
%97 = load i8, i8* %11
%98 = zext i8 %97 to i32
%99 = mul nsw i32 %98, 2
%100 = add nsw i32 %99, 1
%101 = load i8, i8* %9
%102 = zext i8 %101 to i32
%103 = add nsw i32 %102, %100
%104 = trunc i32 %103 to i8
store i8 %104, i8* %9
%105 = load i8*, i8** %5
%106 = load i16, i16* %6
%107 = call i32 @fc8300_write(i8* %105, i16 zeroext %106, i32 124, i32 0)
%108 = load i8*, i8** %5
%109 = load i16, i16* %6
%110 = call i32 @fc8300_write(i8* %108, i16 zeroext %109, i32 126, i32 0)
%111 = load i8*, i8** %5
%112 = load i16, i16* %6
%113 = call i32 @fc8300_write(i8* %111, i16 zeroext %112, i32 127, i32 0)
%114 = load i8*, i8** %5
%115 = load i16, i16* %6
%116 = call i32 @fc8300_write(i8* %114, i16 zeroext %115, i32 128, i32 0)
%117 = load i8*, i8** %5
%118 = load i16, i16* %6
%119 = call i32 @fc8300_write(i8* %117, i16 zeroext %118, i32 129, i32 0)
%120 = load i8*, i8** %5
%121 = load i16, i16* %6
%122 = call i32 @fc8300_write(i8* %120, i16 zeroext %121, i32 21, i32 119)
%123 = load i8*, i8** %5
%124 = load i16, i16* %6
%125 = call i32 @fc8300_write(i8* %123, i16 zeroext %124, i32 145, i32 168)
%126 = load i32, i32* %17
%127 = icmp uge i32 %126, 6084000
br i1 %127, label %128, label %134
128: ; preds = %47
%129 = load i8*, i8** %5
%130 = load i16, i16* %6
%131 = load i32, i32* %8
%132 = add i32 7, %131
%133 = call i32 @fc8300_write(i8* %129, i16 zeroext %130, i32 94, i32 %132)
br label %209
134: ; preds = %47
%135 = load i32, i32* %17
%136 = icmp ult i32 %135, 6084000
br i1 %136, label %137, label %146
137: ; preds = %134
%138 = load i32, i32* %17
%139 = icmp uge i32 %138, 5796000
br i1 %139, label %140, label %146
140: ; preds = %137
%141 = load i8*, i8** %5
%142 = load i16, i16* %6
%143 = load i32, i32* %8
%144 = add i32 8, %143
%145 = call i32 @fc8300_write(i8* %141, i16 zeroext %142, i32 94, i32 %144)
br label %208
146: ; preds = %137, %134
%147 = load i32, i32* %17
%148 = icmp ult i32 %147, 5796000
br i1 %148, label %149, label %158
149: ; preds = %146
%150 = load i32, i32* %17
%151 = icmp uge i32 %150, 5653000
br i1 %151, label %152, label %158
152: ; preds = %149
%153 = load i8*, i8** %5
%154 = load i16, i16* %6
%155 = load i32, i32* %8
%156 = add i32 9, %155
%157 = call i32 @fc8300_write(i8* %153, i16 zeroext %154, i32 94, i32 %156)
br label %207
158: ; preds = %149, %146
%159 = load i32, i32* %17
%160 = icmp ult i32 %159, 5653000
br i1 %160, label %161, label %170
161: ; preds = %158
%162 = load i32, i32* %17
%163 = icmp uge i32 %162, 5547000
br i1 %163, label %164, label %170
164: ; preds = %161
%165 = load i8*, i8** %5
%166 = load i16, i16* %6
%167 = load i32, i32* %8
%168 = add i32 10, %167
%169 = call i32 @fc8300_write(i8* %165, i16 zeroext %166, i32 94, i32 %168)
br label %206
170: ; preds = %161, %158
%171 = load i32, i32* %17
%172 = icmp ult i32 %171, 5547000
br i1 %172, label %173, label %182
173: ; preds = %170
%174 = load i32, i32* %17
%175 = icmp uge i32 %174, 5067000
br i1 %175, label %176, label %182
176: ; preds = %173
%177 = load i8*, i8** %5
%178 = load i16, i16* %6
%179 = load i32, i32* %8
%180 = add i32 12, %179
%181 = call i32 @fc8300_write(i8* %177, i16 zeroext %178, i32 94, i32 %180)
br label %205
182: ; preds = %173, %170
%183 = load i32, i32* %17
%184 = icmp ult i32 %183, 5067000
br i1 %184, label %185, label %194
185: ; preds = %182
%186 = load i32, i32* %17
%187 = icmp uge i32 %186, 4731000
br i1 %187, label %188, label %194
188: ; preds = %185
%189 = load i8*, i8** %5
%190 = load i16, i16* %6
%191 = load i32, i32* %8
%192 = add i32 13, %191
%193 = call i32 @fc8300_write(i8* %189, i16 zeroext %190, i32 94, i32 %192)
br label %204
194: ; preds = %185, %182
%195 = load i32, i32* %17
%196 = icmp ult i32 %195, 4731000
br i1 %196, label %197, label %203
197: ; preds = %194
%198 = load i8*, i8** %5
%199 = load i16, i16* %6
%200 = load i32, i32* %8
%201 = add i32 20, %200
%202 = call i32 @fc8300_write(i8* %198, i16 zeroext %199, i32 94, i32 %201)
br label %203
203: ; preds = %197, %194
br label %204
204: ; preds = %203, %188
br label %205
205: ; preds = %204, %176
br label %206
206: ; preds = %205, %164
br label %207
207: ; preds = %206, %152
br label %208
208: ; preds = %207, %140
br label %209
209: ; preds = %208, %128
%210 = load i8*, i8** %5
%211 = load i16, i16* %6
%212 = load i8, i8* %9
%213 = zext i8 %212 to i32
%214 = call i32 @fc8300_write(i8* %210, i16 zeroext %211, i32 81, i32 %213)
%215 = load i8*, i8** %5
%216 = load i16, i16* %6
%217 = load i8, i8* %10
%218 = zext i8 %217 to i32
%219 = call i32 @fc8300_write(i8* %215, i16 zeroext %216, i32 87, i32 %218)
%220 = load i8*, i8** %5
%221 = load i16, i16* %6
%222 = load i32, i32* %16
%223 = lshr i32 %222, 8
%224 = and i32 %223, 255
%225 = trunc i32 %224 to i8
%226 = zext i8 %225 to i32
%227 = call i32 @fc8300_write(i8* %220, i16 zeroext %221, i32 88, i32 %226)
%228 = load i8*, i8** %5
%229 = load i16, i16* %6
%230 = load i32, i32* %16
%231 = and i32 %230, 255
%232 = trunc i32 %231 to i8
%233 = zext i8 %232 to i32
%234 = call i32 @fc8300_write(i8* %228, i16 zeroext %229, i32 89, i32 %233)
%235 = load i8*, i8** %5
%236 = load i16, i16* %6
%237 = load i32, i32* %15
%238 = trunc i32 %237 to i8
%239 = zext i8 %238 to i32
%240 = call i32 @fc8300_write(i8* %235, i16 zeroext %236, i32 90, i32 %239)
%241 = load i8*, i8** %5
%242 = load i16, i16* %6
%243 = call i32 @fc8300_write(i8* %241, i16 zeroext %242, i32 80, i32 227)
%244 = load i8*, i8** %5
%245 = load i16, i16* %6
%246 = call i32 @fc8300_write(i8* %244, i16 zeroext %245, i32 80, i32 255)
%247 = load i8*, i8** %5
%248 = load i16, i16* %6
%249 = call i32 @fc8300_write(i8* %247, i16 zeroext %248, i32 145, i32 120)
%250 = load i8*, i8** %5
%251 = load i16, i16* %6
%252 = call i32 @fc8300_write(i8* %250, i16 zeroext %251, i32 21, i32 70)
%253 = load i8*, i8** %5
%254 = load i16, i16* %6
%255 = call i32 @fc8300_write(i8* %253, i16 zeroext %254, i32 124, i32 48)
%256 = load i8*, i8** %5
%257 = load i16, i16* %6
%258 = call i32 @fc8300_write(i8* %256, i16 zeroext %257, i32 126, i32 5)
%259 = load i8*, i8** %5
%260 = load i16, i16* %6
%261 = call i32 @fc8300_write(i8* %259, i16 zeroext %260, i32 127, i32 10)
%262 = load i8*, i8** %5
%263 = load i16, i16* %6
%264 = call i32 @fc8300_write(i8* %262, i16 zeroext %263, i32 128, i32 63)
%265 = load i8*, i8** %5
%266 = load i16, i16* %6
%267 = call i32 @fc8300_write(i8* %265, i16 zeroext %266, i32 129, i32 63)
ret i32 0
}

LLVM IR (-O2):
@__const.fc8300_tuner_set_pll_es.lo_divide_ratio = [8 x i8] c"\08\0C\10\18 0@`"
define i32 @fc8300_tuner_set_pll_es(i8* %0, i16 zeroext %1, i32 %2, i32 %3) {
%5 = mul i32 %2, 12
%6 = icmp ugt i32 %5, 6200000
br i1 %6, label %26, label %7
7: ; preds = %4
%8 = shl i32 %2, 4
%9 = icmp ugt i32 %8, 6200000
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = mul i32 %2, 24
%12 = icmp ugt i32 %11, 6200000
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = shl i32 %2, 5
%15 = icmp ugt i32 %14, 6200000
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = mul i32 %2, 48
%18 = icmp ugt i32 %17, 6200000
br i1 %18, label %26, label %19
19: ; preds = %16
%20 = shl i32 %2, 6
%21 = icmp ugt i32 %20, 6200000
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = mul i32 %2, 96
%24 = icmp ugt i32 %23, 6200000
%25 = select i1 %24, i8 6, i8 7
br label %26
26: ; preds = %22, %19, %16, %13, %10, %7, %4
%27 = phi i8 [ 0, %4 ], [ 1, %7 ], [ 2, %10 ], [ 3, %13 ], [ 4, %16 ], [ 5, %19 ], [ %25, %22 ]
%28 = zext i8 %27 to i64
%29 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.fc8300_tuner_set_pll_es.lo_divide_ratio, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = mul i32 %31, %2
%33 = udiv i32 %32, 19200
%34 = mul i32 %33, -19200
%35 = add i32 %34, %32
%36 = shl i32 %35, 16
%37 = udiv i32 %36, 1200
%38 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 124, i32 0)
%39 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 126, i32 0)
%40 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 127, i32 0)
%41 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 128, i32 0)
%42 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 129, i32 0)
%43 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 21, i32 119)
%44 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 145, i32 168)
%45 = icmp ugt i32 %32, 6083999
br i1 %45, label %57, label %46
46: ; preds = %26
%47 = icmp ugt i32 %32, 5795999
br i1 %47, label %57, label %48
48: ; preds = %46
%49 = icmp ugt i32 %32, 5652999
br i1 %49, label %57, label %50
50: ; preds = %48
%51 = icmp ugt i32 %32, 5546999
br i1 %51, label %57, label %52
52: ; preds = %50
%53 = icmp ugt i32 %32, 5066999
br i1 %53, label %57, label %54
54: ; preds = %52
%55 = icmp ugt i32 %32, 4730999
%56 = select i1 %55, i32 13, i32 20
br label %57
57: ; preds = %54, %52, %50, %48, %46, %26
%58 = phi i32 [ 7, %26 ], [ 8, %46 ], [ 9, %48 ], [ 10, %50 ], [ 12, %52 ], [ %56, %54 ]
%59 = add i32 %58, %3
%60 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 94, i32 %59)
%61 = shl nuw nsw i8 %27, 1
%62 = or i8 %61, 1
%63 = lshr i32 %33, 3
%64 = and i32 %63, 32
%65 = lshr i32 %37, 16
%66 = add nuw nsw i32 %65, %64
%67 = zext i8 %62 to i32
%68 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 81, i32 %67)
%69 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 87, i32 %66)
%70 = lshr i32 %37, 8
%71 = and i32 %70, 255
%72 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 88, i32 %71)
%73 = and i32 %37, 254
%74 = or i32 %73, 1
%75 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 89, i32 %74)
%76 = and i32 %33, 255
%77 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 90, i32 %76)
%78 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 80, i32 227)
%79 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 80, i32 255)
%80 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 145, i32 120)
%81 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 21, i32 70)
%82 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 124, i32 48)
%83 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 126, i32 5)
%84 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 127, i32 10)
%85 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 128, i32 63)
%86 = tail call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 129, i32 63)
ret i32 0
}