user: Please show me the C implementation that matches the assembly code listed below:

```asm
<phone_process>:
  endbr64
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x445441,0xe(%rsp)
  movabs $0x505548432b5441,%rax
  mov    %rax,0x16(%rsp)
  movabs $0x3d50494c432b5441,%rax
  mov    %rax,0x1e(%rsp)
  mov    $0x31,%eax
  movl   $0x415441,0x12(%rsp)
  mov    %ax,0x26(%rsp)
  movb   $0xd,0xc(%rsp)
  movb   $0x3b,0xd(%rsp)
  test   %esi,%esi
  je     L27
  cmp    $0x1,%esi
  je     L74
  cmp    $0x2,%esi
  je     L60
  cmp    $0x3,%esi
  je     L1
L22:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L36
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L27:
  mov    %rdx,%r12
  xor    %eax,%eax
  mov    %edi,%edx
  mov    %r12,%rsi
  lea    D7(%rip),%rdi
  call   <printf@plt>
  lea    0xe(%rsp),%rsi
  mov    $0x3,%edx
  mov    %ebp,%edi
  call   <write@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  mov    %eax,%edx
  call   <write@plt>
  lea    0xd(%rsp),%rsi
  mov    $0x1,%edx
L44:
  mov    %ebp,%edi
  call   <write@plt>
  lea    0xc(%rsp),%rsi
  mov    $0x1,%edx
  mov    %ebp,%edi
  call   <write@plt>
  jmp    L22
  nopw   0x0(%rax,%rax,1)
L60:
  mov    %edi,%esi
  xor    %eax,%eax
  lea    D23(%rip),%rdi
  call   <printf@plt>
  lea    0x16(%rsp),%rsi
  mov    $0x7,%edx
  jmp    L44
  nopl   0x0(%rax)
L74:
  mov    %edi,%esi
  xor    %eax,%eax
  lea    D31(%rip),%rdi
  call   <printf@plt>
  lea    0x1e(%rsp),%rsi
  mov    $0x9,%edx
  jmp    L44
  nopl   0x0(%rax)
L1:
  mov    %edi,%esi
  xor    %eax,%eax
  lea    D29(%rip),%rdi
  call   <printf@plt>
  lea    0x12(%rsp),%rsi
  mov    $0x3,%edx
  jmp    L44
L36:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D7
type_infered: string
name: unpack_data
arguments: data_label: D23
type_infered: string
name: unpack_data
arguments: data_label: D31
type_infered: string
name: unpack_data
arguments: data_label: D29
type_infered: string

tool: D7: call Phone %s through serial fd %d


tool: D23: reject incoming call on fd %d


tool: D31: open incoming phone number display on fd %d


tool: D29: accept incoming call on fd %d


assistant: ```c
int phone_process(int fd, int type, char *phone_number) {
  int nread, nwrite, i, j;
  char buff0[4] = "ATD";
  char buff1[4] = "ATA";
  char buff2[8] = "AT+CHUP";
  char buff3[10] = "AT+CLIP=1";
  char end = '\r';
  char end_sent = ';';
  if (type == 0) {
    printf("call Phone %s through serial fd %d\r\n", phone_number, fd);
    write(fd, buff0, 3);
    write(fd, phone_number, strlen(phone_number));
    write(fd, &end_sent, 1);
    write(fd, &end, 1);
  } else if (type == 1) {
    printf("open incoming phone number display on fd %d\r\n", fd);
    write(fd, buff3, 9);
    write(fd, &end, 1);
  } else if (type == 2) {
    printf("reject incoming call on fd %d\r\n", fd);
    write(fd, buff2, 7);
    write(fd, &end, 1);
  } else if (type == 3) {
    printf("accept incoming call on fd %d\r\n", fd);
    write(fd, buff1, 3);
    write(fd, &end, 1);
  }
  return 0;
}
```