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

```asm
<fc8150_tuner_init>:
  endbr64
  push   %r14
  lea    D1(%rip),%rsi
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    $0xff,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbx
  lea    0x16(%rsp),%r14
  call   <PRINTF@plt>
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x81,%edx
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x2,%edx
  mov    $0x15,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x33,%edx
  mov    $0x20,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x62,%edx
  mov    $0x28,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0xaa,%edx
  mov    $0x35,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x28,%edx
  mov    $0x38,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x1,%edx
  mov    $0x3b,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    %rbp,%rdi
  call   <fc8150_set_filter@plt>
  xor    %edx,%edx
  mov    $0x3b,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x1,%edx
  mov    $0x56,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x86,%edx
  mov    $0x57,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0xa7,%edx
  mov    $0x58,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x4d,%edx
  mov    $0x59,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x17,%edx
  mov    $0x80,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x48,%edx
  mov    $0xab,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0xc0,%edx
  mov    $0xa0,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  xor    %edx,%edx
  mov    $0xd0,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  xor    %edx,%edx
  movl   $0x0,0x10(%rsp)
  mov    %dx,0x14(%rsp)
  nop
L47:
  mov    %rbx,%rdx
  mov    $0xd8,%esi
  mov    %rbp,%rdi
  call   <fc8150_read@plt>
  movzbl (%rbx),%eax
  cmp    %al,%r13b
  cmovb  %eax,%r13d
  cmp    %al,%r12b
  cmova  %eax,%r12d
  add    $0x1,%rbx
  cmp    %rbx,%r14
  jne    L47
  movzbl 0x11(%rsp),%edx
  movzbl 0x10(%rsp),%eax
  mov    $0x7f,%esi
  mov    %rbp,%rdi
  lea    0x8(%rsp),%rbx
  lea    0xe(%rsp),%r14
  add    %edx,%eax
  movzbl 0x12(%rsp),%edx
  add    %edx,%eax
  movzbl 0x13(%rsp),%edx
  add    %edx,%eax
  movzbl 0x14(%rsp),%edx
  add    %edx,%eax
  movzbl 0x15(%rsp),%edx
  add    %edx,%eax
  sub    %r13d,%eax
  sub    %r12d,%eax
  mov    $0xff,%r12d
  lea    0x3(%rax),%edx
  cmovns %eax,%edx
  xor    %r13d,%r13d
  sar    $0x2,%edx
  movzbl %dl,%edx
  call   <fc8150_write@plt>
  xor    %eax,%eax
  movl   $0x0,0x8(%rsp)
  mov    %ax,0xc(%rsp)
  nopl   0x0(%rax,%rax,1)
L33:
  mov    %rbx,%rdx
  mov    $0xd6,%esi
  mov    %rbp,%rdi
  call   <fc8150_read@plt>
  movzbl (%rbx),%eax
  cmp    %al,%r13b
  cmovb  %eax,%r13d
  cmp    %al,%r12b
  cmova  %eax,%r12d
  add    $0x1,%rbx
  cmp    %rbx,%r14
  jne    L33
  movzbl 0x9(%rsp),%edx
  movzbl 0x8(%rsp),%eax
  mov    $0x7e,%esi
  mov    %rbp,%rdi
  add    %edx,%eax
  movzbl 0xa(%rsp),%edx
  add    %edx,%eax
  movzbl 0xb(%rsp),%edx
  add    %edx,%eax
  movzbl 0xc(%rsp),%edx
  add    %edx,%eax
  movzbl 0xd(%rsp),%edx
  add    %edx,%eax
  sub    %r13d,%eax
  sub    %r12d,%eax
  lea    0x3(%rax),%edx
  cmovns %eax,%edx
  sar    $0x2,%edx
  movzbl %dl,%edx
  call   <fc8150_write@plt>
  lea    0x7(%rsp),%rdx
  mov    $0xd6,%esi
  mov    %rbp,%rdi
  call   <fc8150_read@plt>
  cmpb   $0x0,0x7(%rsp)
  js     L49
  mov    $0x88,%edx
  mov    $0x7b,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
L36:
  mov    $0x32,%edx
  mov    $0x79,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x2c,%edx
  mov    $0x7a,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x12,%edx
  mov    $0x7c,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0xc,%edx
  mov    $0x7d,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0xa,%edx
  mov    $0x81,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  xor    %edx,%edx
  mov    $0x84,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  xor    %edx,%edx
  mov    $0x92,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0xc,%edx
  mov    $0x93,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x69,%edx
  mov    $0xa5,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x25,%edx
  mov    $0xa6,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    $0x81,%edx
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L49:
  mov    $0x8f,%edx
  mov    $0x7b,%esi
  mov    %rbp,%rdi
  call   <fc8150_write@plt>
  jmp    L36
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D1
type_infered: string

tool: D1: fc8150_init


assistant: ```c
int fc8150_tuner_init(void *hDevice, unsigned int band) {
  int i;
  int n_RFAGC_PD1_AVG, n_RFAGC_PD2_AVG;
  unsigned char RFPD_REF;
  unsigned char RFAGC_PD2[6], RFAGC_PD2_AVG, RFAGC_PD2_MAX, RFAGC_PD2_MIN;
  unsigned char RFAGC_PD1[6], RFAGC_PD1_AVG, RFAGC_PD1_MAX, RFAGC_PD1_MIN;
  PRINTF(hDevice, "fc8150_init\n");
  fc8150_write(hDevice, 0x00, 0x00);
  fc8150_write(hDevice, 0x02, 0x81);
  fc8150_write(hDevice, 0x15, 0x02);
  fc8150_write(hDevice, 0x20, 0x33);
  fc8150_write(hDevice, 0x28, 0x62);
  fc8150_write(hDevice, 0x35, 0xAA);
  fc8150_write(hDevice, 0x38, 0x28);
  fc8150_write(hDevice, 0x3B, 0x01);
  fc8150_set_filter(hDevice);
  fc8150_write(hDevice, 0x3B, 0x00);
  fc8150_write(hDevice, 0x56, 0x01);
  fc8150_write(hDevice, 0x57, 0x86);
  fc8150_write(hDevice, 0x58, 0xA7);
  fc8150_write(hDevice, 0x59, 0x4D);
  fc8150_write(hDevice, 0x80, 0x17);
  fc8150_write(hDevice, 0xAB, 0x48);
  fc8150_write(hDevice, 0xA0, 0xC0);
  fc8150_write(hDevice, 0xD0, 0x00);
  RFAGC_PD1[0] = 0;
  RFAGC_PD1[1] = 0;
  RFAGC_PD1[2] = 0;
  RFAGC_PD1[3] = 0;
  RFAGC_PD1[4] = 0;
  RFAGC_PD1[5] = 0;
  RFAGC_PD1_MAX = 0;
  RFAGC_PD1_MIN = 255;
  for (i = 0; i < 6; i++) {
    fc8150_read(hDevice, 0xD8, &RFAGC_PD1[i]);
    if (RFAGC_PD1[i] >= RFAGC_PD1_MAX)
      RFAGC_PD1_MAX = RFAGC_PD1[i];
    if (RFAGC_PD1[i] <= RFAGC_PD1_MIN)
      RFAGC_PD1_MIN = RFAGC_PD1[i];
  }
  n_RFAGC_PD1_AVG = (RFAGC_PD1[0] + RFAGC_PD1[1] + RFAGC_PD1[2] + RFAGC_PD1[3] + RFAGC_PD1[4] + RFAGC_PD1[5] - RFAGC_PD1_MAX - RFAGC_PD1_MIN) / 4;
  RFAGC_PD1_AVG = (unsigned char)n_RFAGC_PD1_AVG;
  fc8150_write(hDevice, 0x7F, RFAGC_PD1_AVG);
  RFAGC_PD2[0] = 0;
  RFAGC_PD2[1] = 0;
  RFAGC_PD2[2] = 0;
  RFAGC_PD2[3] = 0;
  RFAGC_PD2[4] = 0;
  RFAGC_PD2[5] = 0;
  RFAGC_PD2_MAX = 0;
  RFAGC_PD2_MIN = 255;
  for (i = 0; i < 6; i++) {
    fc8150_read(hDevice, 0xD6, &RFAGC_PD2[i]);
    if (RFAGC_PD2[i] >= RFAGC_PD2_MAX)
      RFAGC_PD2_MAX = RFAGC_PD2[i];
    if (RFAGC_PD2[i] <= RFAGC_PD2_MIN)
      RFAGC_PD2_MIN = RFAGC_PD2[i];
  }
  n_RFAGC_PD2_AVG = (RFAGC_PD2[0] + RFAGC_PD2[1] + RFAGC_PD2[2] + RFAGC_PD2[3] + RFAGC_PD2[4] + RFAGC_PD2[5] - RFAGC_PD2_MAX - RFAGC_PD2_MIN) / 4;
  RFAGC_PD2_AVG = (unsigned char)n_RFAGC_PD2_AVG;
  fc8150_write(hDevice, 0x7E, RFAGC_PD2_AVG);
  fc8150_read(hDevice, 0xD6, &RFPD_REF);
  if (0x80 <= RFPD_REF)
    fc8150_write(hDevice, 0x7B, 0x8F);
  else if (RFPD_REF < 0x80)
    fc8150_write(hDevice, 0x7B, 0x88);
  fc8150_write(hDevice, 0x79, 0x32);
  fc8150_write(hDevice, 0x7A, 0x2C);
  fc8150_write(hDevice, 0x7C, 0x12);
  fc8150_write(hDevice, 0x7D, 0x0C);
  fc8150_write(hDevice, 0x81, 0x0A);
  fc8150_write(hDevice, 0x84, 0x00);
  fc8150_write(hDevice, 0x92, 0x00);
  fc8150_write(hDevice, 0x93, 0x0C);
  fc8150_write(hDevice, 0xA5, 0x69);
  fc8150_write(hDevice, 0xA6, 0x25);
  fc8150_write(hDevice, 0x02, 0x81);
  return 0;
}
```