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

```asm
<zipcode_read_sector>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  mov    $0x1,%edx
  push   %rbp
  mov    %rcx,%rbp
  mov    %r14,%rcx
  push   %rbx
  mov    %esi,%ebx
  mov    $0x1,%esi
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x12(%rsp),%rdi
  call   <fread@plt>
  mov    %r14,%rcx
  mov    $0x1,%edx
  lea    0x13(%rsp),%rdi
  mov    $0x1,%esi
  mov    %eax,%r13d
  call   <fread@plt>
  movzbl 0x13(%rsp),%edx
  mov    %edx,(%r12)
  movzbl 0x12(%rsp),%edx
  mov    %edx,%ecx
  and    $0x3f,%ecx
  cmp    %ebx,%ecx
  jne    L4
  test   %r13d,%r13d
  je     L4
  test   %eax,%eax
  je     L4
  test   %dl,%dl
  js     L254
  and    $0x40,%edx
  je     L69
  lea    0x17(%rsp),%rdi
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  test   %eax,%eax
  je     L172
  movabs $0x101010101010101,%rdi
  movzbl 0x17(%rsp),%ecx
  mov    %rcx,%rax
  mov    %rcx,%rsi
  mul    %rdi
  imul   %rdi,%rsi
  mov    %rax,0x0(%rbp)
  mov    %rcx,%rax
  add    %rdx,%rsi
  mul    %rdi
  mov    %rsi,0x8(%rbp)
  mov    %rsi,0x18(%rbp)
  mov    %rax,0x10(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rsi,0x28(%rbp)
  mov    %rsi,0x38(%rbp)
  mov    %rsi,0x48(%rbp)
  mov    %rax,0x20(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rsi,0x58(%rbp)
  mov    %rsi,0x68(%rbp)
  mov    %rsi,0x78(%rbp)
  mov    %rax,0x30(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rsi,0x88(%rbp)
  mov    %rsi,0x98(%rbp)
  mov    %rsi,0xa8(%rbp)
  mov    %rax,0x40(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rsi,0xb8(%rbp)
  mov    %rsi,0xc8(%rbp)
  mov    %rsi,0xd8(%rbp)
  mov    %rax,0x50(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rsi,0xe8(%rbp)
  mov    %rax,0x60(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0x70(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0x80(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0x90(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0xa0(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0xb0(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0xc0(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0xd0(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0xe0(%rbp)
  mov    %rcx,%rax
  mul    %rdi
  mov    %rax,0xf0(%rbp)
  mov    %rsi,0xf8(%rbp)
L102:
  xor    %eax,%eax
L74:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L131
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L69:
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    $0x100,%esi
  mov    %rbp,%rdi
  call   <fread@plt>
  test   %eax,%eax
  jg     L102
  mov    $0xfffffffb,%eax
  jmp    L74
L254:
  lea    0x14(%rsp),%rdi
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  lea    0x15(%rsp),%rdi
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    %eax,%ebx
  mov    $0x1,%esi
  call   <fread@plt>
  test   %ebx,%ebx
  je     L117
  test   %eax,%eax
  je     L117
  xor    %ebx,%ebx
  lea    0x17(%rsp),%r12
  lea    0x16(%rsp),%r13
  xor    %r15d,%r15d
  cmpb   $0x0,0x14(%rsp)
  jne    L78
  jmp    L102
  nopl   0x0(%rax,%rax,1)
L24:
  mov    %ebx,%edx
  add    $0x1,%ebx
  mov    %al,0x0(%rbp,%rdx,1)
L3:
  movzbl 0x14(%rsp),%eax
  add    $0x1,%r15d
  cmp    %r15d,%eax
  jbe    L102
L78:
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fread@plt>
  test   %eax,%eax
  je     L51
  movzbl 0x17(%rsp),%eax
  cmp    0x15(%rsp),%al
  jne    L24
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %r13,%rdi
  call   <fread@plt>
  mov    %r14,%rcx
  mov    $0x1,%edx
  mov    %r12,%rdi
  mov    $0x1,%esi
  mov    %eax,0xc(%rsp)
  call   <fread@plt>
  mov    0xc(%rsp),%r8d
  test   %r8d,%r8d
  je     L15
  test   %eax,%eax
  je     L15
  movzbl 0x16(%rsp),%edx
  add    $0x2,%r15d
  test   %edx,%edx
  je     L3
  movzbl 0x17(%rsp),%ecx
  add    %ebx,%edx
  nop
L39:
  mov    %ebx,%eax
  add    $0x1,%ebx
  mov    %cl,0x0(%rbp,%rax,1)
  cmp    %edx,%ebx
  jne    L39
  jmp    L3
L51:
  mov    $0xfffffffd,%eax
  jmp    L74
L4:
  mov    $0xffffffff,%eax
  jmp    L74
L15:
  mov    $0x1,%eax
  jmp    L74
L172:
  mov    $0xfffffffc,%eax
  jmp    L74
L117:
  mov    $0xfffffffe,%eax
  jmp    L74
L131:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int zipcode_read_sector(FILE *zip_fd, int track, int *sector, char *buf) {
  unsigned char trk, sec, len, rep, repnum, chra;
  unsigned int i, j, count;
  size_t t1, t2;
  t1 = fread((char *)&trk, 1, 1, zip_fd);
  t2 = fread((char *)&sec, 1, 1, zip_fd);
  *sector = sec;
  if ((trk & 0x3f) != track || !t1 || !t2) {
    return -1;
  }
  if (trk & 0x80) {
    t1 = fread((char *)&len, 1, 1, zip_fd);
    t2 = fread((char *)&rep, 1, 1, zip_fd);
    if (!t1 || !t2) {
      return -2;
    }
    count = 0;
    for (i = 0; i < len; i++) {
      if ((t1 = fread((char *)&chra, 1, 1, zip_fd)) == 0) {
        return -3;
      }
      if (chra != rep) {
        buf[count++] = chra;
        continue;
      }
      t1 = fread((char *)&repnum, 1, 1, zip_fd);
      t2 = fread((char *)&chra, 1, 1, zip_fd);
      if (!t1 || !t2) {
        return 1;
      }
      i += 2;
      for (j = 0; j < repnum; j++)
        buf[count++] = chra;
    }
    return 0;
  }
  if (trk & 0x40) {
    if ((t1 = fread((char *)&chra, 1, 1, zip_fd)) == 0) {
      return -4;
    }
    for (i = 0; i < 256; i++)
      buf[i] = chra;
    return 0;
  }
  if (fread(buf, 256, 1, zip_fd) < 1) {
    return -5;
  }
  return 0;
}
```