#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_read(void *, unsigned short, int, unsigned char *);
int /*<<< orphan*/ fc8300_write(void *, unsigned short, int, int);
int /*<<< orphan*/ msWait(int);
int /*<<< orphan*/ vco_cal(void *, unsigned short, unsigned char);
int fc8300_tuner_set_pll(void *handle, unsigned short devid, unsigned int freq,
                         unsigned int offset) {
  unsigned char data_0x51, data_0x57, lo_select;
  unsigned int f_diff, f_diff_shifted, n_val, k_val, f_vco;
  unsigned int f_vco_max = 6000000;
  unsigned char lo_divide_ratio[8] = {8, 12, 16, 24, 32, 48, 64, 96};
  unsigned char pre_shift_bits = 4;
  unsigned char lock_detect = 0;
  unsigned char lock_condition = 0x11;
  unsigned char i, j;
  for (lo_select = 0; lo_select < 7; lo_select++)
    if (f_vco_max < freq * lo_divide_ratio[lo_select + 1])
      break;
  f_vco = freq * lo_divide_ratio[lo_select];
  n_val = f_vco / 19200;
  f_diff = f_vco - 19200 * n_val;
  f_diff_shifted = f_diff << (20 - pre_shift_bits);
  k_val = f_diff_shifted / (19200 >> pre_shift_bits);
  k_val = k_val | 1;
  data_0x57 = ((n_val >> 3) & 0x20);
  data_0x57 += (k_val >> 16);
  data_0x51 = 0x00;
  data_0x51 += (lo_select * 2) + 1;
  for (j = 0; j < 4; j++) {
    fc8300_write(handle, devid, 0x5f, 0x40);
    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, 0x5a, (unsigned char)n_val);
    fc8300_write(handle, devid, 0x59, (unsigned char)((k_val)&0xff));
    fc8300_write(handle, devid, 0x50, 0xe3);
    fc8300_write(handle, devid, 0x50, 0xff);
    msWait(2);
    fc8300_write(handle, devid, 0x5f, 0x00);
    for (i = 1; i < 5; i++) {
      msWait(2);
      fc8300_read(handle, devid, 0x64, &lock_detect);
      if ((lock_detect & lock_condition) == lock_condition)
        break;
    }
    if ((lock_detect & lock_condition) != lock_condition) {
      fc8300_read(handle, devid, 0x74, &lock_detect);
      vco_cal(handle, devid, lock_detect);
    } else {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x5b8d80,-0x30(%rbp)
mov    0xe99(%rip),%rax
mov    %rax,-0x38(%rbp)
movb   $0x4,-0x39(%rbp)
movb   $0x0,-0x3a(%rbp)
movb   $0x11,-0x3b(%rbp)
movb   $0x0,-0x17(%rbp)
movzbl -0x17(%rbp),%eax
cmp    $0x7,%eax
jge    11bf <fc8300_tuner_set_pll+0x7f>
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%ecx
movzbl -0x17(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl -0x38(%rbp,%rdx,1),%edx
imul   %edx,%ecx
cmp    %ecx,%eax
jae    11ad <fc8300_tuner_set_pll+0x6d>
jmp    11bf <fc8300_tuner_set_pll+0x7f>
jmp    11b2 <fc8300_tuner_set_pll+0x72>
mov    -0x17(%rbp),%al
add    $0x1,%al
mov    %al,-0x17(%rbp)
jmp    117b <fc8300_tuner_set_pll+0x3b>
mov    -0x10(%rbp),%eax
movzbl -0x17(%rbp),%ecx
movzbl -0x38(%rbp,%rcx,1),%ecx
imul   %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x4b00,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
imul   $0x4b00,-0x24(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
movzbl -0x39(%rbp),%edx
mov    $0x14,%ecx
sub    %edx,%ecx
shl    %cl,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
movzbl -0x39(%rbp),%ecx
mov    $0x4b00,%edx
sar    %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    -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)
movb   $0x0,-0x3d(%rbp)
movzbl -0x3d(%rbp),%eax
cmp    $0x4,%eax
jge    1414 <fc8300_tuner_set_pll+0x2d4>
mov    -0x8(%rbp),%rdi
mov    $0x5f,%edx
mov    $0x40,%ecx
movzwl -0xa(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzbl -0x15(%rbp),%ecx
mov    $0x51,%edx
movzwl %ax,%esi
call   1060 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzbl -0x16(%rbp),%ecx
mov    $0x57,%edx
movzwl %ax,%esi
call   1060 <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   1060 <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   1060 <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   1060 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x50,%edx
mov    $0xe3,%ecx
movzwl -0xa(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x50,%edx
mov    $0xff,%ecx
movzwl -0xa(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    $0x2,%edi
call   1050 <msWait@plt>
mov    -0x8(%rbp),%rdi
mov    $0x5f,%edx
xor    %ecx,%ecx
movzwl -0xa(%rbp),%esi
call   1060 <fc8300_write@plt>
movb   $0x1,-0x3c(%rbp)
movzbl -0x3c(%rbp),%eax
cmp    $0x5,%eax
jge    13b8 <fc8300_tuner_set_pll+0x278>
mov    $0x2,%edi
call   1050 <msWait@plt>
mov    -0x8(%rbp),%rdi
mov    $0x64,%edx
lea    -0x3a(%rbp),%rcx
movzwl -0xa(%rbp),%esi
call   1040 <fc8300_read@plt>
movzbl -0x3a(%rbp),%eax
movzbl -0x3b(%rbp),%ecx
and    %ecx,%eax
movzbl -0x3b(%rbp),%ecx
cmp    %ecx,%eax
jne    13a6 <fc8300_tuner_set_pll+0x266>
jmp    13b8 <fc8300_tuner_set_pll+0x278>
jmp    13ab <fc8300_tuner_set_pll+0x26b>
mov    -0x3c(%rbp),%al
add    $0x1,%al
mov    %al,-0x3c(%rbp)
jmp    135e <fc8300_tuner_set_pll+0x21e>
movzbl -0x3a(%rbp),%eax
movzbl -0x3b(%rbp),%ecx
and    %ecx,%eax
movzbl -0x3b(%rbp),%ecx
cmp    %ecx,%eax
je     13fd <fc8300_tuner_set_pll+0x2bd>
mov    -0x8(%rbp),%rdi
mov    $0x74,%edx
lea    -0x3a(%rbp),%rcx
movzwl -0xa(%rbp),%esi
call   1040 <fc8300_read@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzwl %ax,%esi
movzbl -0x3a(%rbp),%edx
call   1030 <vco_cal@plt>
jmp    1402 <fc8300_tuner_set_pll+0x2c2>
jmp    1414 <fc8300_tuner_set_pll+0x2d4>
jmp    1407 <fc8300_tuner_set_pll+0x2c7>
mov    -0x3d(%rbp),%al
add    $0x1,%al
mov    %al,-0x3d(%rbp)
jmp    1258 <fc8300_tuner_set_pll+0x118>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movb   $0x0,0x7(%rsp)
lea    0x0(,%rdx,4),%eax
lea    (%rax,%rax,2),%eax
cmp    $0x5b8d80,%eax
jbe    116b <fc8300_tuner_set_pll+0x2b>
xor    %eax,%eax
jmp    11c5 <fc8300_tuner_set_pll+0x85>
mov    %edx,%ecx
shl    $0x4,%ecx
mov    $0x1,%al
cmp    $0x5b8d80,%ecx
ja     11c5 <fc8300_tuner_set_pll+0x85>
lea    0x0(,%rdx,8),%eax
lea    (%rax,%rax,2),%edi
mov    $0x2,%al
cmp    $0x5b8d80,%edi
ja     11c5 <fc8300_tuner_set_pll+0x85>
mov    %edx,%edi
shl    $0x5,%edi
mov    $0x3,%al
cmp    $0x5b8d80,%edi
ja     11c5 <fc8300_tuner_set_pll+0x85>
lea    (%rcx,%rcx,2),%ecx
mov    $0x4,%al
cmp    $0x5b8d80,%ecx
ja     11c5 <fc8300_tuner_set_pll+0x85>
mov    %edx,%ecx
shl    $0x6,%ecx
mov    $0x5,%al
cmp    $0x5b8d80,%ecx
ja     11c5 <fc8300_tuner_set_pll+0x85>
lea    (%rdi,%rdi,2),%eax
cmp    $0x5b8d81,%eax
mov    $0x7,%al
adc    $0xff,%al
movzbl %al,%eax
lea    0xe31(%rip),%rcx
movzbl (%rax,%rcx,1),%edi
imul   %edx,%edi
imul   $0x1b4e81b5,%rdi,%rdx
mov    %rdx,%rcx
shr    $0x2b,%rcx
imul   $0xffffb500,%ecx,%ebp
add    %edi,%ebp
shl    $0x10,%ebp
imul   $0x1b4e81b5,%rbp,%rdi
mov    %rdi,%rbp
shr    $0x27,%rbp
shr    $0x2e,%rdx
and    $0x20,%edx
mov    %rdi,%r14
shr    $0x37,%r14
add    %edx,%r14d
add    %al,%al
or     $0x1,%al
movzbl %al,%eax
mov    %eax,0x14(%rsp)
shr    $0x2f,%rdi
movzbl %dil,%eax
mov    %eax,0x10(%rsp)
movzbl %cl,%eax
mov    %eax,0xc(%rsp)
or     $0x1,%ebp
movzbl %bpl,%eax
mov    %eax,0x8(%rsp)
xor    %r13d,%r13d
movzwl %si,%r15d
lea    0x7(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x5f,%edx
mov    $0x40,%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x51,%edx
mov    0x14(%rsp),%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x57,%edx
mov    %r14d,%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x58,%edx
mov    0x10(%rsp),%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x5a,%edx
mov    0xc(%rsp),%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x59,%edx
mov    0x8(%rsp),%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x50,%edx
mov    $0xe3,%ecx
call   1060 <fc8300_write@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x50,%edx
mov    $0xff,%ecx
call   1060 <fc8300_write@plt>
mov    $0x2,%edi
call   1050 <msWait@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x5f,%edx
xor    %ecx,%ecx
call   1060 <fc8300_write@plt>
mov    $0x1,%bpl
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2,%edi
call   1050 <msWait@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x64,%edx
mov    %r12,%rcx
call   1040 <fc8300_read@plt>
movzbl 0x7(%rsp),%eax
and    $0x11,%al
cmp    $0x11,%al
je     1353 <fc8300_tuner_set_pll+0x213>
lea    0x1(%rbp),%ecx
cmp    $0x4,%bpl
mov    %ecx,%ebp
jb     1320 <fc8300_tuner_set_pll+0x1e0>
cmp    $0x11,%al
je     1388 <fc8300_tuner_set_pll+0x248>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x74,%edx
mov    %r12,%rcx
call   1040 <fc8300_read@plt>
movzbl 0x7(%rsp),%edx
mov    %rbx,%rdi
mov    %r15d,%esi
call   1030 <vco_cal@plt>
add    $0x1,%r13b
cmp    $0x4,%r13b
jne    1250 <fc8300_tuner_set_pll+0x110>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.fc8300_tuner_set_pll.lo_divide_ratio = [8 x i8] c"\08\0C\10\18 0@`"
define i32 @fc8300_tuner_set_pll(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 i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca [8 x i8]
%19 = alloca i8
%20 = alloca i8
%21 = alloca i8
%22 = alloca i8
%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 6000000, i32* %17
%24 = bitcast [8 x i8]* %18 to i8*
store i8 4, i8* %19
store i8 0, i8* %20
store i8 17, i8* %21
store i8 0, i8* %11
br label %25
25: ; preds = %43, %4
%26 = load i8, i8* %11
%27 = zext i8 %26 to i32
%28 = icmp slt i32 %27, 7
br i1 %28, label %29, label %46
29: ; preds = %25
%30 = load i32, i32* %17
%31 = load i32, i32* %7
%32 = load i8, i8* %11
%33 = zext i8 %32 to i32
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %18, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = mul i32 %31, %38
%40 = icmp ult i32 %30, %39
br i1 %40, label %41, label %42
41: ; preds = %29
br label %46
42: ; preds = %29
br label %43
43: ; preds = %42
%44 = load i8, i8* %11
%45 = add i8 %44, 1
store i8 %45, i8* %11
br label %25
46: ; preds = %41, %25
%47 = load i32, i32* %7
%48 = load i8, i8* %11
%49 = zext i8 %48 to i64
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %18, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = mul i32 %47, %52
store i32 %53, i32* %16
%54 = load i32, i32* %16
%55 = udiv i32 %54, 19200
store i32 %55, i32* %14
%56 = load i32, i32* %16
%57 = load i32, i32* %14
%58 = mul i32 19200, %57
%59 = sub i32 %56, %58
store i32 %59, i32* %12
%60 = load i32, i32* %12
%61 = load i8, i8* %19
%62 = zext i8 %61 to i32
%63 = sub nsw i32 20, %62
%64 = shl i32 %60, %63
store i32 %64, i32* %13
%65 = load i32, i32* %13
%66 = load i8, i8* %19
%67 = zext i8 %66 to i32
%68 = ashr i32 19200, %67
%69 = udiv i32 %65, %68
store i32 %69, i32* %15
%70 = load i32, i32* %15
%71 = or i32 %70, 1
store i32 %71, i32* %15
%72 = load i32, i32* %14
%73 = lshr i32 %72, 3
%74 = and i32 %73, 32
%75 = trunc i32 %74 to i8
store i8 %75, i8* %10
%76 = load i32, i32* %15
%77 = lshr i32 %76, 16
%78 = load i8, i8* %10
%79 = zext i8 %78 to i32
%80 = add i32 %79, %77
%81 = trunc i32 %80 to i8
store i8 %81, i8* %10
store i8 0, i8* %9
%82 = load i8, i8* %11
%83 = zext i8 %82 to i32
%84 = mul nsw i32 %83, 2
%85 = add nsw i32 %84, 1
%86 = load i8, i8* %9
%87 = zext i8 %86 to i32
%88 = add nsw i32 %87, %85
%89 = trunc i32 %88 to i8
store i8 %89, i8* %9
store i8 0, i8* %23
br label %90
90: ; preds = %180, %46
%91 = load i8, i8* %23
%92 = zext i8 %91 to i32
%93 = icmp slt i32 %92, 4
br i1 %93, label %94, label %183
94: ; preds = %90
%95 = load i8*, i8** %5
%96 = load i16, i16* %6
%97 = call i32 @fc8300_write(i8* %95, i16 zeroext %96, i32 95, i32 64)
%98 = load i8*, i8** %5
%99 = load i16, i16* %6
%100 = load i8, i8* %9
%101 = zext i8 %100 to i32
%102 = call i32 @fc8300_write(i8* %98, i16 zeroext %99, i32 81, i32 %101)
%103 = load i8*, i8** %5
%104 = load i16, i16* %6
%105 = load i8, i8* %10
%106 = zext i8 %105 to i32
%107 = call i32 @fc8300_write(i8* %103, i16 zeroext %104, i32 87, i32 %106)
%108 = load i8*, i8** %5
%109 = load i16, i16* %6
%110 = load i32, i32* %15
%111 = lshr i32 %110, 8
%112 = and i32 %111, 255
%113 = trunc i32 %112 to i8
%114 = zext i8 %113 to i32
%115 = call i32 @fc8300_write(i8* %108, i16 zeroext %109, i32 88, i32 %114)
%116 = load i8*, i8** %5
%117 = load i16, i16* %6
%118 = load i32, i32* %14
%119 = trunc i32 %118 to i8
%120 = zext i8 %119 to i32
%121 = call i32 @fc8300_write(i8* %116, i16 zeroext %117, i32 90, i32 %120)
%122 = load i8*, i8** %5
%123 = load i16, i16* %6
%124 = load i32, i32* %15
%125 = and i32 %124, 255
%126 = trunc i32 %125 to i8
%127 = zext i8 %126 to i32
%128 = call i32 @fc8300_write(i8* %122, i16 zeroext %123, i32 89, i32 %127)
%129 = load i8*, i8** %5
%130 = load i16, i16* %6
%131 = call i32 @fc8300_write(i8* %129, i16 zeroext %130, i32 80, i32 227)
%132 = load i8*, i8** %5
%133 = load i16, i16* %6
%134 = call i32 @fc8300_write(i8* %132, i16 zeroext %133, i32 80, i32 255)
%135 = call i32 @msWait(i32 2)
%136 = load i8*, i8** %5
%137 = load i16, i16* %6
%138 = call i32 @fc8300_write(i8* %136, i16 zeroext %137, i32 95, i32 0)
store i8 1, i8* %22
br label %139
139: ; preds = %158, %94
%140 = load i8, i8* %22
%141 = zext i8 %140 to i32
%142 = icmp slt i32 %141, 5
br i1 %142, label %143, label %161
143: ; preds = %139
%144 = call i32 @msWait(i32 2)
%145 = load i8*, i8** %5
%146 = load i16, i16* %6
%147 = call i32 @fc8300_read(i8* %145, i16 zeroext %146, i32 100, i8* %20)
%148 = load i8, i8* %20
%149 = zext i8 %148 to i32
%150 = load i8, i8* %21
%151 = zext i8 %150 to i32
%152 = and i32 %149, %151
%153 = load i8, i8* %21
%154 = zext i8 %153 to i32
%155 = icmp eq i32 %152, %154
br i1 %155, label %156, label %157
156: ; preds = %143
br label %161
157: ; preds = %143
br label %158
158: ; preds = %157
%159 = load i8, i8* %22
%160 = add i8 %159, 1
store i8 %160, i8* %22
br label %139
161: ; preds = %156, %139
%162 = load i8, i8* %20
%163 = zext i8 %162 to i32
%164 = load i8, i8* %21
%165 = zext i8 %164 to i32
%166 = and i32 %163, %165
%167 = load i8, i8* %21
%168 = zext i8 %167 to i32
%169 = icmp ne i32 %166, %168
br i1 %169, label %170, label %178
170: ; preds = %161
%171 = load i8*, i8** %5
%172 = load i16, i16* %6
%173 = call i32 @fc8300_read(i8* %171, i16 zeroext %172, i32 116, i8* %20)
%174 = load i8*, i8** %5
%175 = load i16, i16* %6
%176 = load i8, i8* %20
%177 = call i32 @vco_cal(i8* %174, i16 zeroext %175, i8 zeroext %176)
br label %179
178: ; preds = %161
br label %183
179: ; preds = %170
br label %180
180: ; preds = %179
%181 = load i8, i8* %23
%182 = add i8 %181, 1
store i8 %182, i8* %23
br label %90
183: ; preds = %178, %90
ret i32 0
}

LLVM IR (-O2):
@__const.fc8300_tuner_set_pll.lo_divide_ratio = [8 x i8] c"\08\0C\10\18 0@`"
define i32 @fc8300_tuner_set_pll(i8* %0, i16 zeroext %1, i32 %2, i32 %3) {
%5 = alloca i8
store i8 0, i8* %5
%6 = mul i32 %2, 12
%7 = icmp ugt i32 %6, 6000000
br i1 %7, label %27, label %8
8: ; preds = %4
%9 = shl i32 %2, 4
%10 = icmp ugt i32 %9, 6000000
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = mul i32 %2, 24
%13 = icmp ugt i32 %12, 6000000
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = shl i32 %2, 5
%16 = icmp ugt i32 %15, 6000000
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = mul i32 %2, 48
%19 = icmp ugt i32 %18, 6000000
br i1 %19, label %27, label %20
20: ; preds = %17
%21 = shl i32 %2, 6
%22 = icmp ugt i32 %21, 6000000
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = mul i32 %2, 96
%25 = icmp ugt i32 %24, 6000000
%26 = select i1 %25, i8 6, i8 7
br label %27
27: ; preds = %23, %20, %17, %14, %11, %8, %4
%28 = phi i8 [ 0, %4 ], [ 1, %8 ], [ 2, %11 ], [ 3, %14 ], [ 4, %17 ], [ 5, %20 ], [ %26, %23 ]
%29 = zext i8 %28 to i64
%30 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.fc8300_tuner_set_pll.lo_divide_ratio, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = mul i32 %32, %2
%34 = udiv i32 %33, 19200
%35 = mul i32 %34, -19200
%36 = add i32 %35, %33
%37 = shl i32 %36, 16
%38 = udiv i32 %37, 1200
%39 = lshr i32 %34, 3
%40 = and i32 %39, 32
%41 = lshr i32 %38, 16
%42 = add nuw nsw i32 %41, %40
%43 = shl nuw nsw i8 %28, 1
%44 = or i8 %43, 1
%45 = zext i8 %44 to i32
%46 = lshr i32 %38, 8
%47 = and i32 %46, 255
%48 = and i32 %34, 255
%49 = and i32 %38, 254
%50 = or i32 %49, 1
br label %51
51: ; preds = %27, %75
%52 = phi i8 [ 0, %27 ], [ %79, %75 ]
%53 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 95, i32 64)
%54 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 81, i32 %45)
%55 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 87, i32 %42)
%56 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 88, i32 %47)
%57 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 90, i32 %48)
%58 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 89, i32 %50)
%59 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 80, i32 227)
%60 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 80, i32 255)
%61 = call i32 @msWait(i32 2)
%62 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 95, i32 0)
br label %63
63: ; preds = %63, %51
%64 = phi i8 [ 1, %51 ], [ %70, %63 ]
%65 = call i32 @msWait(i32 2)
%66 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 100, i8* %5)
%67 = load i8, i8* %5
%68 = and i8 %67, 17
%69 = icmp ne i8 %68, 17
%70 = add nuw nsw i8 %64, 1
%71 = icmp ult i8 %64, 4
%72 = select i1 %69, i1 %71, i1 false
br i1 %72, label %63, label %73
73: ; preds = %63
%74 = icmp eq i8 %68, 17
br i1 %74, label %81, label %75
75: ; preds = %73
%76 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 116, i8* %5)
%77 = load i8, i8* %5
%78 = call i32 @vco_cal(i8* %0, i16 zeroext %1, i8 zeroext %77)
%79 = add nuw nsw i8 %52, 1
%80 = icmp eq i8 %79, 4
br i1 %80, label %81, label %51
81: ; preds = %73, %75
ret i32 0
}