user: Converte this assembly snippet into its equivalent C code:

```asm
<fc8080_tuner_init>:
  endbr64
  push   %r15
  xor    %edx,%edx
  xor    %esi,%esi
  push   %r14
  push   %r13
  mov    $0xff,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x12(%rsp),%r12
  lea    0x18(%rsp),%r14
  mov    %r12,%rbx
  call   <fc8080_write@plt>
  mov    $0x11,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x2,%esi
  call   <fc8080_write@plt>
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_set_filter@plt>
  mov    $0x78,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xb3,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x9c,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0x1,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x9d,%esi
  call   <fc8080_write@plt>
  mov    $0x2,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x9e,%esi
  call   <fc8080_write@plt>
  mov    $0xa,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x9f,%esi
  call   <fc8080_write@plt>
  mov    $0x2a,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa0,%esi
  call   <fc8080_write@plt>
  mov    $0x32,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa1,%esi
  call   <fc8080_write@plt>
  mov    $0x52,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa2,%esi
  call   <fc8080_write@plt>
  mov    $0x56,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa3,%esi
  call   <fc8080_write@plt>
  mov    $0x76,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa4,%esi
  call   <fc8080_write@plt>
  mov    $0x7e,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa5,%esi
  call   <fc8080_write@plt>
  xor    %eax,%eax
  mov    $0x7f,%edx
  mov    %rbp,%rdi
  mov    $0xa6,%esi
  xor    %r15d,%r15d
  call   <fc8080_write@plt>
  mov    $0x9f,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa7,%esi
  call   <fc8080_write@plt>
  mov    $0xc0,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xa8,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0xd0,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  xor    %edx,%edx
  movl   $0x0,0x12(%rsp)
  mov    %dx,0x16(%rsp)
  nopw   0x0(%rax,%rax,1)
L25:
  mov    %rbx,%rdx
  xor    %eax,%eax
  mov    $0xd8,%esi
  mov    %rbp,%rdi
  call   <fc8080_read@plt>
  movzbl (%rbx),%eax
  cmp    %al,%r15b
  cmovb  %eax,%r15d
  cmp    %al,%r13b
  cmova  %eax,%r13d
  add    $0x1,%rbx
  cmp    %rbx,%r14
  jne    L25
  movzbl 0x13(%rsp),%edx
  movzbl 0x12(%rsp),%eax
  mov    $0x7f,%esi
  mov    %rbp,%rdi
  lea    0xc(%rsp),%rbx
  add    %edx,%eax
  movzbl 0x14(%rsp),%edx
  add    %edx,%eax
  movzbl 0x15(%rsp),%edx
  add    %edx,%eax
  movzbl 0x16(%rsp),%edx
  add    %edx,%eax
  movzbl 0x17(%rsp),%edx
  add    %edx,%eax
  sub    %r15d,%eax
  sub    %r13d,%eax
  mov    $0xff,%r13d
  lea    0x3(%rax),%edx
  cmovns %eax,%edx
  xor    %eax,%eax
  xor    %r14d,%r14d
  sar    $0x2,%edx
  movzbl %dl,%edx
  call   <fc8080_write@plt>
  xor    %eax,%eax
  movl   $0x0,0xc(%rsp)
  mov    %ax,0x10(%rsp)
  nopw   0x0(%rax,%rax,1)
L8:
  mov    %rbx,%rdx
  xor    %eax,%eax
  mov    $0xd6,%esi
  mov    %rbp,%rdi
  call   <fc8080_read@plt>
  movzbl (%rbx),%eax
  cmp    %al,%r14b
  cmovb  %eax,%r14d
  cmp    %al,%r13b
  cmova  %eax,%r13d
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L8
  movzbl 0xd(%rsp),%edx
  movzbl 0xc(%rsp),%eax
  mov    $0x7e,%esi
  mov    %rbp,%rdi
  add    %edx,%eax
  movzbl 0xe(%rsp),%edx
  add    %edx,%eax
  movzbl 0xf(%rsp),%edx
  add    %edx,%eax
  movzbl 0x10(%rsp),%edx
  add    %edx,%eax
  movzbl 0x11(%rsp),%edx
  add    %edx,%eax
  sub    %r14d,%eax
  sub    %r13d,%eax
  lea    0x3(%rax),%edx
  cmovns %eax,%edx
  xor    %eax,%eax
  sar    $0x2,%edx
  movzbl %dl,%edx
  call   <fc8080_write@plt>
  mov    $0x26,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x79,%esi
  call   <fc8080_write@plt>
  mov    $0x21,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x7a,%esi
  call   <fc8080_write@plt>
  mov    $0xff,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x7b,%esi
  call   <fc8080_write@plt>
  mov    $0x1b,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x7c,%esi
  call   <fc8080_write@plt>
  mov    $0x18,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x7d,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x84,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xd,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x85,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x86,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0x10,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x87,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x88,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xe,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x89,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x8a,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xe,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x8b,%esi
  call   <fc8080_write@plt>
  mov    $0x3,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x8c,%esi
  call   <fc8080_write@plt>
  mov    $0x10,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x8d,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x8e,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0x10,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x8f,%esi
  call   <fc8080_write@plt>
  mov    $0x4,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x90,%esi
  call   <fc8080_write@plt>
  mov    $0x10,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x91,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x92,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x93,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x94,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xe,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x95,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x96,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xe,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x97,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x98,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xe,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x99,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0x9a,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xe,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x9b,%esi
  call   <fc8080_write@plt>
  mov    $0x3d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x80,%esi
  call   <fc8080_write@plt>
  mov    $0x20,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x81,%esi
  call   <fc8080_write@plt>
  mov    $0x25,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x82,%esi
  call   <fc8080_write@plt>
  mov    $0xa,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x83,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0xd0,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0x1d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xd2,%esi
  call   <fc8080_write@plt>
  mov    $0x33,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xd4,%esi
  call   <fc8080_write@plt>
  mov    $0x36,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xae,%esi
  call   <fc8080_write@plt>
  mov    $0x8b,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xad,%esi
  call   <fc8080_write@plt>
  mov    $0x63,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x14,%esi
  call   <fc8080_write@plt>
  mov    $0x2,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x15,%esi
  call   <fc8080_write@plt>
  mov    $0x43,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x18,%esi
  call   <fc8080_write@plt>
  mov    $0x21,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x19,%esi
  call   <fc8080_write@plt>
  mov    $0x82,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x27,%esi
  call   <fc8080_write@plt>
  mov    $0x33,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x28,%esi
  call   <fc8080_write@plt>
  mov    $0x43,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x33,%esi
  call   <fc8080_write@plt>
  mov    $0x41,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x53,%esi
  call   <fc8080_write@plt>
  mov    $0x1,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x54,%esi
  call   <fc8080_write@plt>
  mov    $0xf6,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0x66,%esi
  call   <fc8080_write@plt>
  mov    $0x14,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xaf,%esi
  call   <fc8080_write@plt>
  xor    %edx,%edx
  mov    $0xb6,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <fc8080_write@plt>
  mov    $0xb0,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    $0xb8,%esi
  call   <fc8080_write@plt>
  xor    %eax,%eax
  mov    $0xc4,%edx
  mov    %rbp,%rdi
  mov    $0xb9,%esi
  call   <fc8080_write@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fc8080_tuner_init(void *handle, unsigned int band) {
  int i;
  int n_rfagc_pd1_avg, n_rfagc_pd2_avg;
  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;
  fc8080_write(handle, 0x00, 0x00);
  fc8080_write(handle, 0x02, 0x11);
  fc8080_set_filter(handle);
  fc8080_write(handle, 0xb3, 0x78);
  fc8080_write(handle, 0x9c, 0x00);
  fc8080_write(handle, 0x9d, 0x01);
  fc8080_write(handle, 0x9e, 0x02);
  fc8080_write(handle, 0x9f, 0x0a);
  fc8080_write(handle, 0xa0, 0x2a);
  fc8080_write(handle, 0xa1, 0x32);
  fc8080_write(handle, 0xa2, 0x52);
  fc8080_write(handle, 0xa3, 0x56);
  fc8080_write(handle, 0xa4, 0x76);
  fc8080_write(handle, 0xa5, 0x7e);
  fc8080_write(handle, 0xa6, 0x7f);
  fc8080_write(handle, 0xa7, 0x9f);
  fc8080_write(handle, 0xa8, 0xc0);
  fc8080_write(handle, 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++) {
    fc8080_read(handle, 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;
  fc8080_write(handle, 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++) {
    fc8080_read(handle, 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;
  fc8080_write(handle, 0x7e, rfagc_pd2_avg);
  fc8080_write(handle, 0x79, 0x26);
  fc8080_write(handle, 0x7a, 0x21);
  fc8080_write(handle, 0x7b, 0xff);
  fc8080_write(handle, 0x7c, 0x1b);
  fc8080_write(handle, 0x7d, 0x18);
  fc8080_write(handle, 0x84, 0x00);
  fc8080_write(handle, 0x85, 0x0d);
  fc8080_write(handle, 0x86, 0x00);
  fc8080_write(handle, 0x87, 0x10);
  fc8080_write(handle, 0x88, 0x00);
  fc8080_write(handle, 0x89, 0x0e);
  fc8080_write(handle, 0x8a, 0x00);
  fc8080_write(handle, 0x8b, 0x0e);
  fc8080_write(handle, 0x8c, 0x03);
  fc8080_write(handle, 0x8d, 0x10);
  fc8080_write(handle, 0x8e, 0x00);
  fc8080_write(handle, 0x8f, 0x10);
  fc8080_write(handle, 0x90, 0x04);
  fc8080_write(handle, 0x91, 0x10);
  fc8080_write(handle, 0x92, 0x00);
  fc8080_write(handle, 0x93, 0x00);
  fc8080_write(handle, 0x94, 0x00);
  fc8080_write(handle, 0x95, 0x0e);
  fc8080_write(handle, 0x96, 0x00);
  fc8080_write(handle, 0x97, 0x0e);
  fc8080_write(handle, 0x98, 0x00);
  fc8080_write(handle, 0x99, 0x0e);
  fc8080_write(handle, 0x9a, 0x00);
  fc8080_write(handle, 0x9b, 0x0e);
  fc8080_write(handle, 0x80, 0x3d);
  fc8080_write(handle, 0x81, 0x20);
  fc8080_write(handle, 0x82, 0x25);
  fc8080_write(handle, 0x83, 0x0a);
  fc8080_write(handle, 0xd0, 0x00);
  fc8080_write(handle, 0xd2, 0x1d);
  fc8080_write(handle, 0xd4, 0x33);
  fc8080_write(handle, 0xae, 0x36);
  fc8080_write(handle, 0xad, 0x8b);
  fc8080_write(handle, 0x14, 0x63);
  fc8080_write(handle, 0x15, 0x02);
  fc8080_write(handle, 0x18, 0x43);
  fc8080_write(handle, 0x19, 0x21);
  fc8080_write(handle, 0x27, 0x82);
  fc8080_write(handle, 0x28, 0x33);
  fc8080_write(handle, 0x33, 0x43);
  fc8080_write(handle, 0x53, 0x41);
  fc8080_write(handle, 0x54, 0x01);
  fc8080_write(handle, 0x66, 0xf6);
  fc8080_write(handle, 0xaf, 0x14);
  fc8080_write(handle, 0xb6, 0x00);
  fc8080_write(handle, 0xb8, 0xb0);
  fc8080_write(handle, 0xb9, 0xc4);
  return 0;
}
```