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

```asm
<UARTRecv>:
  endbr64
  push   %r15
  mov    %ecx,%eax
  lea    D8(%rip),%r15
  movzbl %dil,%edi
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x18,%rsp
  movslq D95(%rip),%rsi
  mov    0x58(%rsp),%r14d
  sub    %esi,%eax
  add    %r15,%rsi
  lea    0x4(%rax),%edx
  test   %r8b,%r8b
  je     L103
  mov    %r9d,%ecx
  call   <mdaq_uart_read@plt>
  mov    %eax,%r13d
  test   %r14b,%r14b
  je     L41
L22:
  test   %r13d,%r13d
  jle    L41
  mov    D95(%rip),%edi
  mov    D45(%rip),%eax
  test   %edi,%edi
  jne    L82
L156:
  movslq %edi,%r8
  xor    %edx,%edx
  lea    (%r15,%r8,1),%rcx
  jmp    L147
L78:
  xor    %eax,%eax
L108:
  add    $0x1,%edx
  add    $0x1,%rcx
  cmp    %r13d,%edx
  je     L107
L147:
  movslq %eax,%rsi
  movzbl 0x50(%rsp,%rsi,1),%esi
  cmp    %sil,(%rcx)
  jne    L78
  add    $0x1,%eax
  cmp    $0x4,%eax
  jne    L108
  lea    0x1(%rdx),%r14d
  mov    %r13d,%ecx
  mov    $0x200,%edx
  movl   $0x4,D45(%rip)
  sub    %r14d,%ecx
  movslq %r14d,%rsi
  cmp    %edx,%ecx
  cmovle %ecx,%edx
  add    %r13d,%edi
  add    %r8,%rsi
  sub    %r14d,%edi
  add    %r15,%rsi
  cmp    %ebx,%edi
  je     L109
  mov    %r15,%rdi
  mov    %ecx,0xc(%rsp)
  call   <memmove@plt>
  mov    0xc(%rsp),%ecx
  movl   $0xffffffff,0x0(%rbp)
  mov    %ecx,D101(%rip)
L43:
  movl   $0x0,D45(%rip)
  cmp    %r13d,%r14d
  jne    L38
L137:
  movl   $0xffffffff,0x0(%rbp)
  jmp    L38
  nopl   0x0(%rax)
L41:
  mov    %r13d,0x0(%rbp)
L38:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L103:
  xor    %ecx,%ecx
  call   <mdaq_uart_read@plt>
  mov    %eax,%r13d
  test   %r14b,%r14b
  jne    L22
  xor    %eax,%eax
  test   %r13d,%r13d
  cmovns %r13d,%eax
  mov    %eax,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L82:
  test   %eax,%eax
  jne    L156
  add    %r13d,%edi
  cmp    %ebx,%edi
  jae    L172
  mov    %edi,D101(%rip)
  jmp    L38
  nopw   0x0(%rax,%rax,1)
L107:
  mov    %eax,D101(%rip)
  cmp    $0x3,%eax
  jbe    L137
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L172:
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  mov    %ebx,0x0(%rbp)
  movl   $0x0,D101(%rip)
  jmp    L38
  nop
L109:
  mov    %r12,%rdi
  call   <memcpy@plt>
  mov    %ebx,0x0(%rbp)
  movl   $0x0,D101(%rip)
  jmp    L43
```

assistant: ```c
void UARTRecv(unsigned char module, unsigned char *data, int *status, unsigned int size, unsigned char blocking, unsigned int timeout, unsigned int msg_header, unsigned char use_msg_header) {
  int data_idx = 0;
  static unsigned char rx_buffer[(512) + 4];
  static int rx_buf_idx = 0;
  static int msg_header_at = 0;
  int result = mdaq_uart_read(module, rx_buffer + rx_buf_idx, size + (sizeof(msg_header) - rx_buf_idx), blocking ? timeout : 0);
  if (use_msg_header) {
    if (result > 0) {
      if (rx_buf_idx && !msg_header_at) {
        if (rx_buf_idx + result >= size) {
          memcpy(data, rx_buffer, size);
          *status = size;
          rx_buf_idx = 0;
        } else {
          rx_buf_idx += result;
        }
      } else {
        for (data_idx = 0; data_idx < result; data_idx++) {
          if (rx_buffer[data_idx + rx_buf_idx] == *(((unsigned char *)(&msg_header)) + msg_header_at))
            msg_header_at++;
          else
            msg_header_at = 0;
          if (msg_header_at == sizeof(msg_header)) {
            data_idx++;
            if (size == rx_buf_idx + result - data_idx) {
              memcpy(data, rx_buffer + rx_buf_idx + data_idx, (result - data_idx) > (512) ? (512) : result - data_idx);
              *status = size;
              rx_buf_idx = 0;
            } else {
              memmove(rx_buffer, rx_buffer + rx_buf_idx + data_idx, (result - data_idx) > (512) ? (512) : result - data_idx);
              rx_buf_idx = result - data_idx;
              *status = (-1);
            }
            msg_header_at = 0;
            break;
          }
        }
        if (data_idx == result && msg_header_at < sizeof(msg_header))
          *status = -1;
      }
    } else {
      *status = result;
    }
  } else {
    if (blocking)
      *status = result;
    else
      *status = result > 0 ? result : 0;
  }
}
```