user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<xmrcv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rdi,(%rsp)
  mov    $0x15,%edi
  lea    0x1c(%rsp),%rbp
  lea    0x1d(%rsp),%r15
  mov    %rsi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  call   <send_byte@plt>
  nopl   0x0(%rax,%rax,1)
L98:
  mov    %rbp,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L26
  movzbl 0x1c(%rsp),%eax
  cmp    $0x1,%al
  je     L161
  cmp    $0x18,%al
  je     L20
  cmp    $0x4,%al
  jne    L98
  mov    $0x6,%edi
  call   <send_byte@plt>
  nopl   0x0(%rax)
L109:
  mov    %r13,%rax
  sub    $0x1,%r13
  cmpb   $0x1a,0x0(%r13)
  je     L109
  mov    (%rsp),%rcx
  sub    0x8(%rsp),%rax
  mov    %rax,(%rcx)
  xor    %eax,%eax
  jmp    L33
  xchg   %ax,%ax
L20:
  mov    %rbp,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L26
  cmpb   $0x18,0x1c(%rsp)
  jne    L98
  nopl   0x0(%rax)
L26:
  mov    $0xffffffff,%eax
L33:
  mov    0xa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L71
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L161:
  mov    %r15,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L26
  lea    0x1e(%rsp),%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L26
  lea    0x20(%rsp),%r14
  lea    0xa0(%rsp),%r12
  xor    %ebx,%ebx
  jmp    L193
  nopl   (%rax)
L68:
  add    (%r14),%bl
  add    $0x1,%r14
  cmp    %r14,%r12
  je     L195
L193:
  mov    %r14,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L68
  jmp    L26
  xchg   %ax,%ax
L195:
  lea    0x1f(%rsp),%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L26
  movzbl 0x1d(%rsp),%eax
  movzbl 0x1e(%rsp),%edx
  add    %edx,%eax
  cmp    $0xff,%eax
  je     L158
L61:
  mov    $0x15,%edi
  call   <send_byte@plt>
  jmp    L98
L158:
  cmp    %bl,0x1f(%rsp)
  jne    L61
  mov    $0x6,%edi
  sub    $0xffffffffffffff80,%r13
  call   <send_byte@plt>
  movdqa 0x20(%rsp),%xmm0
  movdqa 0x30(%rsp),%xmm1
  movdqa 0x40(%rsp),%xmm2
  movdqa 0x50(%rsp),%xmm3
  movdqa 0x60(%rsp),%xmm4
  movdqa 0x70(%rsp),%xmm5
  movups %xmm0,-0x80(%r13)
  movdqa 0x80(%rsp),%xmm6
  movups %xmm1,-0x70(%r13)
  movdqa 0x90(%rsp),%xmm7
  movups %xmm2,-0x60(%r13)
  movups %xmm3,-0x50(%r13)
  movups %xmm4,-0x40(%r13)
  movups %xmm5,-0x30(%r13)
  movups %xmm6,-0x20(%r13)
  movups %xmm7,-0x10(%r13)
  jmp    L98
L71:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int xmrcv(long *bytes_rcvd, unsigned char *buf) {
  int err = 0, x, i, packetno = 0;
  unsigned char ch, seq, cmpl_seq, cksum, their_cksum;
  unsigned char data[128];
  unsigned char *start_buf = buf;
  send_byte(0x15);
  while (1) {
    if (receive_byte(&ch) < 0) {
      return -1;
    }
    if (ch == 0x01) {
      packetno++;
      err = 0;
      if (receive_byte(&seq) < 0) {
        return -1;
      }
      if (receive_byte(&cmpl_seq) < 0) {
        return -1;
      }
      cksum = 0;
      for (x = 0; x < 128; x++) {
        if (receive_byte(&data[x]) < 0) {
          return -1;
        }
        cksum += data[x];
      }
      if (receive_byte(&their_cksum) < 0) {
        return -1;
      }
      if (seq + cmpl_seq != 255) {
        err++;
      }
      if (their_cksum != cksum) {
        err++;
      }
      if (err) {
        send_byte(0x15);
      } else {
        send_byte(0x06);
        for (i = 0; i < 128; i++) {
          *buf++ = data[i];
        }
      }
    } else if (ch == 0x18) {
      if (receive_byte(&ch) < 0) {
        return -1;
      }
      if (ch == 0x18) {
        return -1;
      } else {
        continue;
      }
    } else if (ch == 0x04) {
      send_byte(0x06);
      while (*--buf == 0x1a)
        ;
      buf++;
      *bytes_rcvd = (buf - start_buf);
      return 0;
    }
  }
}
```