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

```asm
<fc8300_tuner_set_pll>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,%eax
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %ax,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x5b8d80,-0x28(%rbp)
  movabs $0x6040302018100c08,%rax
  mov    %rax,-0x10(%rbp)
  movb   $0x4,-0x2c(%rbp)
  movb   $0x0,-0x30(%rbp)
  movb   $0x11,-0x2b(%rbp)
  movb   $0x0,-0x2f(%rbp)
  jmp    L87
L102:
  movzbl -0x2f(%rbp),%eax
  add    $0x1,%eax
  cltq
  movzbl -0x10(%rbp,%rax,1),%eax
  movzbl %al,%eax
  imul   -0x40(%rbp),%eax
  cmp    %eax,-0x28(%rbp)
  jb     L5
  movzbl -0x2f(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x2f(%rbp)
L87:
  cmpb   $0x6,-0x2f(%rbp)
  jbe    L102
  jmp    L67
L5:
  nop
L67:
  movzbl -0x2f(%rbp),%eax
  cltq
  movzbl -0x10(%rbp,%rax,1),%eax
  movzbl %al,%eax
  mov    -0x40(%rbp),%edx
  imul   %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%eax
  imul   $0x1b4e81b5,%rax,%rax
  shr    $0x20,%rax
  shr    $0xb,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  imul   $0x4b00,%eax,%edx
  mov    -0x24(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  movzbl -0x2c(%rbp),%edx
  mov    $0x14,%eax
  sub    %edx,%eax
  mov    -0x1c(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x18(%rbp)
  movzbl -0x2c(%rbp),%eax
  mov    $0x4b00,%edx
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edi
  mov    -0x18(%rbp),%eax
  mov    $0x0,%edx
  div    %edi
  mov    %eax,-0x14(%rbp)
  orl    $0x1,-0x14(%rbp)
  mov    -0x20(%rbp),%eax
  shr    $0x3,%eax
  and    $0x20,%eax
  mov    %al,-0x2a(%rbp)
  mov    -0x14(%rbp),%eax
  shr    $0x10,%eax
  add    %al,-0x2a(%rbp)
  movb   $0x0,-0x29(%rbp)
  movzbl -0x2f(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  movzbl -0x29(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %al,-0x29(%rbp)
  movb   $0x0,-0x2d(%rbp)
  jmp    L23
L59:
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    $0x40,%ecx
  mov    $0x5f,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  movzbl -0x29(%rbp),%edx
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x51,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  movzbl -0x2a(%rbp),%edx
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x57,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  mov    -0x14(%rbp),%eax
  shr    $0x8,%eax
  movzbl %al,%edx
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x58,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  mov    -0x20(%rbp),%eax
  movzbl %al,%edx
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x5a,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  mov    -0x14(%rbp),%eax
  movzbl %al,%edx
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x59,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    $0xe3,%ecx
  mov    $0x50,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    $0xff,%ecx
  mov    $0x50,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  mov    $0x2,%edi
  call   <msWait@plt>
  movzwl -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    $0x0,%ecx
  mov    $0x5f,%edx
  mov    %rax,%rdi
  call   <fc8300_write@plt>
  movb   $0x1,-0x2e(%rbp)
  jmp    L66
L119:
  mov    $0x2,%edi
  call   <msWait@plt>
  movzwl -0x3c(%rbp),%esi
  lea    -0x30(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x64,%edx
  mov    %rax,%rdi
  call   <fc8300_read@plt>
  movzbl -0x30(%rbp),%eax
  and    -0x2b(%rbp),%al
  cmp    %al,-0x2b(%rbp)
  je     L97
  movzbl -0x2e(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x2e(%rbp)
L66:
  cmpb   $0x4,-0x2e(%rbp)
  jbe    L119
  jmp    L62
L97:
  nop
L62:
  movzbl -0x30(%rbp),%eax
  and    -0x2b(%rbp),%al
  cmp    %al,-0x2b(%rbp)
  je     L93
  movzwl -0x3c(%rbp),%esi
  lea    -0x30(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x74,%edx
  mov    %rax,%rdi
  call   <fc8300_read@plt>
  movzbl -0x30(%rbp),%eax
  movzbl %al,%edx
  movzwl -0x3c(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <vco_cal@plt>
  movzbl -0x2d(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x2d(%rbp)
L23:
  cmpb   $0x3,-0x2d(%rbp)
  jbe    L59
  jmp    L129
L93:
  nop
L129:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L46
  call   <__stack_chk_fail@plt>
L46:
  leave
  ret
```

assistant: ```c
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;
}
```