user: What would the C source look like for the assembly code provided here?

```asm
<fc8300_tuner_set_pll>:
  endbr64
  push   %r15
  xor    %ecx,%ecx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  movabs $0x6040302018100c08,%rax
  lea    0x21(%rsp),%rdi
  movb   $0x0,0x1f(%rsp)
  mov    %rax,0x20(%rsp)
  mov    $0xc,%eax
  jmp    L67
  nopw   0x0(%rax,%rax,1)
L45:
  movzbl (%rdi,%rcx,1),%eax
L67:
  imul   %edx,%eax
  mov    %ecx,%esi
  cmp    $0x5b8d80,%eax
  ja     L23
  add    $0x1,%rcx
  cmp    $0x7,%rcx
  jne    L45
  movl   $0xf,0x8(%rsp)
  mov    $0x60,%eax
L19:
  imul   %eax,%edx
  movb   $0x4,0xf(%rsp)
  movzwl %bx,%ebx
  lea    0x1f(%rsp),%r14
  mov    %edx,%r13d
  imul   $0x1b4e81b5,%r13,%r13
  mov    %r13,%rax
  shr    $0x2e,%r13
  shr    $0x2b,%rax
  and    $0x20,%r13d
  mov    %rax,%r15
  imul   $0x4b00,%eax,%eax
  movzbl %r15b,%r15d
  sub    %eax,%edx
  shl    $0x10,%edx
  mov    %edx,%eax
  imul   $0x1b4e81b5,%rax,%rax
  shr    $0x27,%rax
  movzbl %ah,%esi
  mov    %eax,%edx
  movzbl %al,%eax
  or     $0x1,%eax
  shr    $0x10,%edx
  mov    %esi,(%rsp)
  mov    %eax,0x4(%rsp)
  add    %edx,%r13d
  movzbl %r13b,%r13d
L10:
  mov    $0x40,%ecx
  mov    $0x5f,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_write@plt>
  mov    0x8(%rsp),%ecx
  mov    $0x51,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  mov    $0x4,%r12d
  call   <fc8300_write@plt>
  mov    %r13d,%ecx
  mov    $0x57,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_write@plt>
  mov    (%rsp),%ecx
  mov    $0x58,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_write@plt>
  mov    %r15d,%ecx
  mov    $0x5a,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_write@plt>
  mov    0x4(%rsp),%ecx
  mov    $0x59,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_write@plt>
  mov    $0xe3,%ecx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  mov    $0x50,%edx
  call   <fc8300_write@plt>
  mov    $0xff,%ecx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  mov    $0x50,%edx
  call   <fc8300_write@plt>
  mov    $0x2,%edi
  call   <msWait@plt>
  xor    %ecx,%ecx
  mov    $0x5f,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_write@plt>
L49:
  mov    $0x2,%edi
  call   <msWait@plt>
  mov    %r14,%rcx
  mov    $0x64,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_read@plt>
  movzbl 0x1f(%rsp),%eax
  and    $0x11,%eax
  cmp    $0x11,%al
  je     L68
  sub    $0x1,%r12b
  jne    L49
  mov    %r14,%rcx
  mov    $0x74,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <fc8300_read@plt>
  movzbl 0x1f(%rsp),%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <vco_cal@plt>
  subb   $0x1,0xf(%rsp)
  jne    L10
L68:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L23:
  lea    0x1(%rsi,%rsi,1),%esi
  movzbl %cl,%eax
  movzbl %sil,%esi
  movzbl 0x20(%rsp,%rax,1),%eax
  mov    %esi,0x8(%rsp)
  jmp    L19
L25:
  call   <__stack_chk_fail@plt>
```

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;
}
```