user: 请从给定的汇编指令推导出C源代码:

```asm
<fc8300b_tuner_set_pll>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbp
  mov    %si,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movabs $0x6040302018100c08,%rax
  mov    %rax,0x30(%rsp)
  movb   $0x0,0x2e(%rsp)
  movb   $0x0,0x2f(%rsp)
  lea    0x31(%rsp),%rcx
  mov    $0x0,%r13d
L66:
  movzbl (%rcx),%eax
  imul   %edx,%eax
  cmp    $0x5b8d80,%eax
  ja     L134
  add    $0x1,%r13d
  add    $0x1,%rcx
  cmp    $0x7,%r13b
  jne    L66
L134:
  movzbl %r13b,%eax
  movzbl 0x30(%rsp,%rax,1),%eax
  imul   %edx,%eax
  mov    %eax,0x1c(%rsp)
  mov    %eax,%edx
  imul   $0x1b4e81b5,%rdx,%rdx
  mov    %rdx,%rsi
  shr    $0x2b,%rsi
  mov    %rsi,%rdi
  imul   $0x4b00,%esi,%ecx
  sub    %ecx,%eax
  shl    $0x10,%eax
  mov    %eax,%eax
  imul   $0x1b4e81b5,%rax,%rax
  shr    $0x27,%rax
  shr    $0x2e,%rdx
  and    $0x20,%edx
  mov    %eax,%ecx
  shr    $0x10,%ecx
  lea    (%rdx,%rcx,1),%esi
  mov    %sil,0x13(%rsp)
  lea    0x1(%r13,%r13,1),%esi
  mov    %sil,0x1a(%rsp)
  movzbl %ah,%esi
  mov    %esi,0xc(%rsp)
  mov    $0x4,%r15d
  movzbl %al,%eax
  or     $0x1,%eax
  mov    %eax,0x14(%rsp)
  mov    %r13b,0x1b(%rsp)
  mov    %edi,%r13d
  jmp    L57
L59:
  cmpb   $0x1,0x2f(%rsp)
  ja     L40
  cmp    $0x4,%r12b
  ja     L108
L26:
  add    $0x1,%r12d
L38:
  mov    %r14,%rcx
  mov    $0x64,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_read@plt>
  lea    0x2f(%rsp),%rcx
  mov    $0x65,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_read@plt>
  movzbl 0x2e(%rsp),%eax
  and    $0x11,%eax
  cmp    $0x11,%al
  je     L59
  cmp    $0x4,%r12b
  jbe    L26
L6:
  lea    0x2e(%rsp),%rcx
  mov    $0x74,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_read@plt>
  movzbl 0x2e(%rsp),%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <vco_cal@plt>
  sub    $0x1,%r15b
  je     L108
L57:
  movzwl 0x18(%rsp),%ebx
  mov    $0x31,%ecx
  mov    $0x75,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    $0x0,%ecx
  mov    $0x77,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  movzbl 0x1a(%rsp),%ecx
  mov    $0x51,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  movzbl 0x13(%rsp),%ecx
  mov    $0x57,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  movzbl %r13b,%ecx
  mov    $0x5a,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    $0xe3,%ecx
  mov    $0x50,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    $0xff,%ecx
  mov    $0x50,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    0xc(%rsp),%ecx
  mov    $0x58,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    0x14(%rsp),%ecx
  mov    $0x59,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    $0x2,%edi
  call   <msWait@plt>
  mov    $0x2,%r12d
  lea    0x2e(%rsp),%r14
  jmp    L38
L40:
  lea    0x2f(%rsp),%rcx
  mov    $0x76,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_read@plt>
  cmpb   $0x3d,0x2f(%rsp)
  ja     L119
  testb  $0x1,0x1b(%rsp)
  jne    L86
  cmpl   $0x5e9ac0,0x1c(%rsp)
  jbe    L119
L86:
  mov    $0x2,%ecx
  mov    $0x77,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    $0xe3,%ecx
  mov    $0x50,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
  mov    $0xff,%ecx
  mov    $0x50,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300b_write@plt>
L119:
  movzbl 0x2e(%rsp),%eax
  and    $0x11,%eax
  cmp    $0x11,%al
  jne    L6
L108:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L36
  mov    $0x0,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L36:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fc8300b_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_bank = 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++) {
    fc8300b_write(handle, devid, 0x75, 0x31);
    fc8300b_write(handle, devid, 0x77, 0x00);
    fc8300b_write(handle, devid, 0x51, data_0x51);
    fc8300b_write(handle, devid, 0x57, data_0x57);
    fc8300b_write(handle, devid, 0x5a, (unsigned char)n_val);
    fc8300b_write(handle, devid, 0x50, 0xe3);
    fc8300b_write(handle, devid, 0x50, 0xff);
    fc8300b_write(handle, devid, 0x58, (unsigned char)((k_val >> 8) & 0xff));
    fc8300b_write(handle, devid, 0x59, (unsigned char)((k_val)&0xff));
    msWait(2);
    for (i = 1; i < 5; i++) {
      fc8300b_read(handle, devid, 0x64, &lock_detect);
      fc8300b_read(handle, devid, 0x65, &lock_bank);
      if (((lock_detect & lock_condition) == lock_condition) && (lock_bank > 1)) {
        fc8300b_read(handle, devid, 0x76, &lock_bank);
        if (lock_bank < 62) {
          if (((lo_select % 2) != 0) || (f_vco > 6200000)) {
            fc8300b_write(handle, devid, 0x77, 0x02);
            fc8300b_write(handle, devid, 0x50, 0xe3);
            fc8300b_write(handle, devid, 0x50, 0xff);
          }
        }
        break;
      }
    }
    if ((lock_detect & lock_condition) != lock_condition) {
      fc8300b_read(handle, devid, 0x74, &lock_detect);
      vco_cal(handle, devid, lock_detect);
    } else {
      break;
    }
  }
  return 0;
}
```