user: Demonstrate the C code that generates the assembly output below:

```asm
<UARTRecv>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%r13
  mov    %rdx,%r12
  mov    %ecx,%ebp
  mov    0x38(%rsp),%r14d
  test   %r8b,%r8b
  jne    L188
  mov    D149(%rip),%esi
  mov    %ecx,%eax
  sub    %esi,%eax
  lea    0x4(%rax),%edx
  movslq %esi,%rsi
  lea    D85(%rip),%rax
  add    %rax,%rsi
  movzbl %dil,%edi
  mov    $0x0,%ecx
  call   <mdaq_uart_read@plt>
  mov    %eax,%ebx
  test   %r14b,%r14b
  jne    L147
  test   %ebx,%ebx
  mov    $0x0,%eax
  cmovns %ebx,%eax
  mov    %eax,(%r12)
  jmp    L208
L154:
  mov    %ebp,%edx
  lea    D85(%rip),%rsi
  mov    %r13,%rdi
  call   <memcpy@plt>
  mov    %ebp,(%r12)
  movl   $0x0,D149(%rip)
  jmp    L208
L69:
  mov    D12(%rip),%ecx
  movslq %edi,%r8
  lea    D85(%rip),%rax
  add    %r8,%rax
  mov    $0x0,%edx
  jmp    L75
L78:
  add    $0x1,%ecx
  cmp    $0x4,%ecx
  je     L137
L116:
  add    $0x1,%edx
  add    $0x1,%rax
  cmp    %ebx,%edx
  je     L41
L75:
  movslq %ecx,%rsi
  movzbl 0x30(%rsp,%rsi,1),%esi
  cmp    %sil,(%rax)
  je     L78
  mov    $0x0,%ecx
  jmp    L116
L137:
  movl   $0x4,D12(%rip)
  lea    0x1(%rdx),%r14d
  add    %ebx,%edi
  sub    %r14d,%edi
  cmp    %ebp,%edi
  je     L14
  mov    %ebx,%ebp
  sub    %r14d,%ebp
  mov    $0x200,%edx
  cmp    %edx,%ebp
  cmovle %ebp,%edx
  movslq %r14d,%rsi
  add    %r8,%rsi
  lea    D85(%rip),%rdi
  add    %rdi,%rsi
  call   <memmove@plt>
  mov    %ebp,D128(%rip)
  movl   $0xffffffff,(%r12)
L112:
  movl   $0x0,D12(%rip)
  cmp    %ebx,%r14d
  jne    L208
L190:
  movl   $0xffffffff,(%r12)
  jmp    L208
L14:
  mov    %ebx,%edx
  sub    %r14d,%edx
  mov    $0x200,%eax
  cmp    %eax,%edx
  cmovg  %eax,%edx
  movslq %r14d,%rsi
  add    %r8,%rsi
  lea    D85(%rip),%rax
  add    %rax,%rsi
  mov    %r13,%rdi
  call   <memcpy@plt>
  mov    %ebp,(%r12)
  movl   $0x0,D128(%rip)
  jmp    L112
L41:
  mov    %ecx,D128(%rip)
  cmp    $0x3,%ecx
  ja     L208
  jmp    L190
L93:
  mov    %ebx,(%r12)
  jmp    L208
L65:
  mov    %ebx,(%r12)
L208:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L188:
  mov    D128(%rip),%esi
  mov    %ecx,%eax
  sub    %esi,%eax
  lea    0x4(%rax),%edx
  movslq %esi,%rsi
  lea    D85(%rip),%rax
  add    %rax,%rsi
  movzbl %dil,%edi
  mov    %r9d,%ecx
  call   <mdaq_uart_read@plt>
  mov    %eax,%ebx
  test   %r14b,%r14b
  je     L65
L147:
  test   %ebx,%ebx
  jle    L93
  mov    D128(%rip),%edi
  test   %edi,%edi
  je     L69
  cmpl   $0x0,D128(%rip)
  jne    L69
  add    %ebx,%edi
  cmp    %ebp,%edi
  jae    L154
  mov    %edi,D128(%rip)
  jmp    L208
```

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