user: What is the c source code of the assembly code below:

```asm
<xmrcv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  mov    $0x15,%edi
  call   <send_byte@plt>
  mov    %r15,%r14
  lea    0x1c(%rsp),%r12
  jmp    L113
L212:
  lea    0x1d(%rsp),%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L256
  lea    0x1e(%rsp),%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L15
  lea    0x20(%rsp),%rbx
  lea    0xa0(%rsp),%r13
  mov    $0x0,%ebp
L72:
  mov    %rbx,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L224
  add    (%rbx),%bpl
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L72
  lea    0x1f(%rsp),%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L223
  movzbl 0x1d(%rsp),%eax
  movzbl 0x1e(%rsp),%edx
  cmp    %bpl,0x1f(%rsp)
  je     L73
L247:
  mov    $0x15,%edi
  call   <send_byte@plt>
  jmp    L113
L73:
  movzbl %al,%eax
  movzbl %dl,%edx
  add    %edx,%eax
  cmp    $0xff,%eax
  jne    L247
  mov    $0x6,%edi
  call   <send_byte@plt>
  mov    $0x0,%eax
L88:
  movzbl 0x20(%rsp,%rax,1),%edx
  mov    %dl,(%r14,%rax,1)
  add    $0x1,%rax
  cmp    $0x80,%rax
  jne    L88
  sub    $0xffffffffffffff80,%r14
  jmp    L113
L27:
  mov    %r12,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L74
  cmpb   $0x18,0x1c(%rsp)
  je     L174
L113:
  mov    %r12,%rdi
  call   <receive_byte@plt>
  test   %rax,%rax
  js     L241
  movzbl 0x1c(%rsp),%eax
  cmp    $0x1,%al
  je     L212
  cmp    $0x18,%al
  je     L27
  cmp    $0x4,%al
  jne    L113
  mov    $0x6,%edi
  call   <send_byte@plt>
L187:
  mov    %r14,%rax
  sub    $0x1,%r14
  cmpb   $0x1a,(%r14)
  je     L187
  sub    %r15,%rax
  mov    0x8(%rsp),%rcx
  mov    %rax,(%rcx)
  mov    $0x0,%eax
  jmp    L143
L241:
  mov    $0xffffffff,%eax
  jmp    L143
L256:
  mov    $0xffffffff,%eax
  jmp    L143
L15:
  mov    $0xffffffff,%eax
  jmp    L143
L224:
  mov    $0xffffffff,%eax
L143:
  mov    0xa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L223:
  mov    $0xffffffff,%eax
  jmp    L143
L74:
  mov    $0xffffffff,%eax
  jmp    L143
L174:
  mov    $0xffffffff,%eax
  jmp    L143
L5:
  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;
    }
  }
}
```