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

```asm
<xmrcv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xc0,%rsp
  mov    %rdi,-0xb8(%rbp)
  mov    %rsi,-0xc0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xa8(%rbp)
  movl   $0x0,-0x9c(%rbp)
  mov    -0xc0(%rbp),%rax
  mov    %rax,-0x98(%rbp)
  mov    $0x15,%edi
  call   <send_byte@plt>
L42:
  lea    -0xad(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L93
  mov    $0xffffffff,%eax
  jmp    L17
L93:
  movzbl -0xad(%rbp),%eax
  cmp    $0x1,%al
  jne    L280
  addl   $0x1,-0x9c(%rbp)
  movl   $0x0,-0xa8(%rbp)
  lea    -0xac(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L125
  mov    $0xffffffff,%eax
  jmp    L17
L125:
  lea    -0xab(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L74
  mov    $0xffffffff,%eax
  jmp    L17
L74:
  movb   $0x0,-0xa9(%rbp)
  movl   $0x0,-0xa4(%rbp)
  jmp    L61
L16:
  lea    -0x90(%rbp),%rdx
  mov    -0xa4(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L226
  mov    $0xffffffff,%eax
  jmp    L17
L226:
  mov    -0xa4(%rbp),%eax
  cltq
  movzbl -0x90(%rbp,%rax,1),%eax
  add    %al,-0xa9(%rbp)
  addl   $0x1,-0xa4(%rbp)
L61:
  cmpl   $0x7f,-0xa4(%rbp)
  jle    L16
  lea    -0xaa(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L19
  mov    $0xffffffff,%eax
  jmp    L17
L19:
  movzbl -0xac(%rbp),%eax
  movzbl %al,%edx
  movzbl -0xab(%rbp),%eax
  movzbl %al,%eax
  add    %edx,%eax
  cmp    $0xff,%eax
  je     L206
  addl   $0x1,-0xa8(%rbp)
L206:
  movzbl -0xaa(%rbp),%eax
  cmp    %al,-0xa9(%rbp)
  je     L173
  addl   $0x1,-0xa8(%rbp)
L173:
  cmpl   $0x0,-0xa8(%rbp)
  je     L75
  mov    $0x15,%edi
  call   <send_byte@plt>
  jmp    L42
L75:
  mov    $0x6,%edi
  call   <send_byte@plt>
  movl   $0x0,-0xa0(%rbp)
  jmp    L150
L227:
  mov    -0xc0(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0xc0(%rbp)
  mov    -0xa0(%rbp),%edx
  movslq %edx,%rdx
  movzbl -0x90(%rbp,%rdx,1),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0xa0(%rbp)
L150:
  cmpl   $0x7f,-0xa0(%rbp)
  jle    L227
  jmp    L42
L280:
  movzbl -0xad(%rbp),%eax
  cmp    $0x18,%al
  jne    L232
  lea    -0xad(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  jns    L230
  mov    $0xffffffff,%eax
  jmp    L17
L230:
  movzbl -0xad(%rbp),%eax
  cmp    $0x18,%al
  jne    L247
  mov    $0xffffffff,%eax
  jmp    L17
L232:
  movzbl -0xad(%rbp),%eax
  cmp    $0x4,%al
  jne    L42
  mov    $0x6,%edi
  call   <send_byte@plt>
  nop
L29:
  subq   $0x1,-0xc0(%rbp)
  mov    -0xc0(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x1a,%al
  je     L29
  addq   $0x1,-0xc0(%rbp)
  mov    -0xc0(%rbp),%rax
  sub    -0x98(%rbp),%rax
  mov    %rax,%rdx
  mov    -0xb8(%rbp),%rax
  mov    %rdx,(%rax)
  mov    $0x0,%eax
  jmp    L17
L247:
  nop
  jmp    L42
L17:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L117
  call   <__stack_chk_fail@plt>
L117:
  leave
  ret
```

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