user: Converte this assembly snippet into its equivalent C code:

```asm
<SMS_ProcessMessage>:
  endbr64
  push   %r14
  push   %r13
  mov    %edi,%r13d
  mov    %rsi,%rdi
  mov    $0x2c,%esi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x230,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  call   <strrchr@plt>
  test   %rax,%rax
  je     L31
  lea    0x1(%rax),%rdi
  lea    0x20(%rsp),%r14
  mov    %rsp,%rbp
  call   <atoi@plt>
  lea    D12(%rip),%rdi
  mov    %eax,%esi
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <logcat@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %r14,%rdi
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x20,%edx
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    %rbp,%rcx
  mov    %r14,%rdx
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <SMS_ReadMessage@plt>
  test   %rax,%rax
  js     L69
  mov    $0x3,%edx
  lea    D13(%rip),%rsi
  mov    %rbp,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L34
  mov    %rbp,%rdi
  call   <SMS_CheckPhone@plt>
  test   %rax,%rax
  je     L15
L26:
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <SMS_DelMessage@plt>
  xor    %eax,%eax
L107:
  mov    0x228(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L103
  add    $0x230,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L34:
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x3(%rsp),%rsi
  mov    %rbp,%rdi
  movslq %eax,%rbx
  lea    -0x3(%rbx),%edx
  call   <memmove@plt>
  lea    -0x3(%rbp,%rbx,1),%rdi
  xor    %esi,%esi
  mov    $0x3,%edx
  call   <memset@plt>
  mov    %rbp,%rdi
  call   <SMS_CheckPhone@plt>
  test   %rax,%rax
  jne    L26
L15:
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <SMS_CMDProcess@plt>
  test   %rax,%rax
  jne    L40
  lea    D33(%rip),%rdx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  call   <SMS_SendMessage@plt>
  jmp    L26
  nopl   0x0(%rax,%rax,1)
L40:
  lea    D6(%rip),%rdx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  call   <SMS_SendMessage@plt>
  jmp    L26
L31:
  mov    $0xffffffff,%eax
  jmp    L107
L69:
  lea    D22(%rip),%rdi
  xor    %eax,%eax
  call   <logcat@plt>
  mov    $0xffffffff,%eax
  jmp    L107
L103:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D12
type: string
name: read_data
arguments: data_label: D13
type: string
name: read_data
arguments: data_label: D33
type: string
name: read_data
arguments: data_label: D6
type: string
name: read_data
arguments: data_label: D22
type: string

tool: D12: New Message Index = %d 


tool: D13: +86

tool: D33: Command Sucess.

tool: D6: Command Failure.

tool: D22: SMS Read message error.


assistant: ```c
int SMS_ProcessMessage(int fd, char *msg) {
  int index = 0;
  char *p = NULL;
  char data[512];
  char phone[32];
  p = strrchr(msg, 0x2c);
  if (p != NULL) {
    index = atoi(p + 1);
    logcat("New Message Index = %d \n", index);
  } else
    return -1;
  memset(data, 0, 512);
  memset(phone, 0, 32);
  if (SMS_ReadMessage(fd, index, data, phone) < 0) {
    logcat("SMS Read message error.\n");
    return -1;
  }
  if (memcmp(phone, "+86", 3) == 0) {
    int len = strlen(phone);
    memmove(phone, (phone + 3), len - 3);
    memset((phone + len - 3), 0, 3);
  }
  if (SMS_CheckPhone(phone) == 0) {
    if (SMS_CMDProcess(data, phone) == 0) {
      SMS_SendMessage(fd, phone, "Command Sucess.");
    } else {
      SMS_SendMessage(fd, phone, "Command Failure.");
    }
  }
  SMS_DelMessage(fd, index);
  return 0;
}
```