user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ta>:
  endbr64
  push   %r14
  lea    D87(%rip),%rdi
  push   %r13
  push   %r12
  lea    D137(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x810,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x808(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  call   <printf@plt>
  xor    %edx,%edx
  mov    $0xe100,%esi
  lea    D165(%rip),%rdi
  call   <serOpen@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x1,%esi
  mov    %eax,%ebp
  lea    D143(%rip),%r9
  mov    %eax,%edx
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    $0x800,%edx
  mov    %r13,%rsi
  mov    %ebp,%edi
  call   <serRead@plt>
  mov    %ebp,%edi
  call   <serDataAvailable@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x2,%esi
  lea    D155(%rip),%r9
  mov    %eax,%edx
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  mov    %eax,%edx
  call   <serWrite@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x3,%esi
  mov    %eax,%edx
  lea    D82(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    $0xaa,%esi
  mov    %ebp,%edi
  call   <serWriteByte@plt>
  mov    $0x55,%esi
  mov    %ebp,%edi
  call   <serWriteByte@plt>
  xor    %esi,%esi
  mov    %ebp,%edi
  call   <serWriteByte@plt>
  mov    $0xff,%esi
  mov    %ebp,%edi
  call   <serWriteByte@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x4,%esi
  mov    %eax,%edx
  lea    D55(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  movsd  D167(%rip),%xmm0
  call   <time_sleep@plt>
  mov    %ebp,%edi
  call   <serDataAvailable@plt>
  mov    %r12,%rdi
  mov    %eax,%r14d
  call   <strlen@plt>
  xor    %r8d,%r8d
  mov    %r14d,%edx
  mov    $0x5,%esi
  lea    0x4(%rax),%ecx
  lea    D155(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r13,%rsi
  mov    %ebp,%edi
  mov    %eax,%edx
  call   <serRead@plt>
  mov    %r12,%rdi
  movslq %eax,%rbx
  call   <strlen@plt>
  xor    %r8d,%r8d
  mov    %ebx,%edx
  mov    $0x6,%esi
  mov    %eax,%ecx
  lea    D122(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  test   %ebx,%ebx
  js     L0
  movb   $0x0,(%rsp,%rbx,1)
L0:
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0x7,%esi
  mov    %eax,%edx
  lea    D122(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %ebp,%edi
  call   <serReadByte@plt>
  xor    %r8d,%r8d
  mov    $0xaa,%ecx
  lea    D54(%rip),%r9
  mov    %eax,%edx
  mov    $0x8,%esi
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %ebp,%edi
  call   <serReadByte@plt>
  xor    %r8d,%r8d
  mov    $0x55,%ecx
  lea    D54(%rip),%r9
  mov    %eax,%edx
  mov    $0x9,%esi
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %ebp,%edi
  call   <serReadByte@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0xa,%esi
  mov    %eax,%edx
  lea    D54(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %ebp,%edi
  call   <serReadByte@plt>
  xor    %r8d,%r8d
  mov    $0xff,%ecx
  lea    D54(%rip),%r9
  mov    %eax,%edx
  mov    $0xb,%esi
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %ebp,%edi
  call   <serDataAvailable@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0xc,%esi
  mov    %eax,%edx
  lea    D13(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    %ebp,%edi
  call   <serClose@plt>
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  mov    $0xd,%esi
  mov    %eax,%edx
  lea    D120(%rip),%r9
  mov    $0xa,%edi
  call   <CHECK@plt>
  mov    0x808(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L12
  add    $0x810,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L12:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D87
datatype: string
name: unpack_data
arguments: tag: D137
datatype: string
name: unpack_data
arguments: tag: D165
datatype: string
name: unpack_data
arguments: tag: D143
datatype: string
name: unpack_data
arguments: tag: D155
datatype: string
name: unpack_data
arguments: tag: D82
datatype: string
name: unpack_data
arguments: tag: D55
datatype: string
name: unpack_data
arguments: tag: D167
datatype: f64
name: unpack_data
arguments: tag: D122
datatype: string
name: unpack_data
arguments: tag: D54
datatype: string
name: unpack_data
arguments: tag: D13
datatype: string
name: unpack_data
arguments: tag: D120
datatype: string

tool: D87: Serial link tests.


tool: D137: To be, or not to be, that is the question-Whether 'tis Nobler in the mind to sufferThe Slings and Arrows of outrageous Fortune,Or to take Arms against a Sea of troubles,

tool: D165: /dev/ttyAMA0

tool: D143: serial open

tool: D155: serial data available

tool: D82: serial write

tool: D55: serial write byte

tool: D167: 0.1

tool: D122: serial read

tool: D54: serial read byte

tool: D13: serial data availabe

tool: D120: serial close

assistant: ```c
void ta() {
  int h, b, e;
  char *TEXT;
  char text[2048];
  printf("Serial link tests.\n");
  h = serOpen("/dev/ttyAMA0", 57600, 0);
  CHECK(10, 1, h, 0, 0, "serial open");
  b = serRead(h, text, sizeof(text));
  b = serDataAvailable(h);
  CHECK(10, 2, b, 0, 0, "serial data available");
  TEXT = "To be, or not to be, that is the question-Whether 'tis Nobler in the mind to sufferThe Slings and Arrows of outrageous Fortune,Or to take Arms against a Sea of troubles,";
  e = serWrite(h, TEXT, strlen(TEXT));
  CHECK(10, 3, e, 0, 0, "serial write");
  e = serWriteByte(h, 0xAA);
  e = serWriteByte(h, 0x55);
  e = serWriteByte(h, 0x00);
  e = serWriteByte(h, 0xFF);
  CHECK(10, 4, e, 0, 0, "serial write byte");
  time_sleep(0.1);
  b = serDataAvailable(h);
  CHECK(10, 5, b, strlen(TEXT) + 4, 0, "serial data available");
  b = serRead(h, text, strlen(TEXT));
  CHECK(10, 6, b, strlen(TEXT), 0, "serial read");
  if (b >= 0)
    text[b] = 0;
  CHECK(10, 7, strcmp(TEXT, text), 0, 0, "serial read");
  b = serReadByte(h);
  CHECK(10, 8, b, 0xAA, 0, "serial read byte");
  b = serReadByte(h);
  CHECK(10, 9, b, 0x55, 0, "serial read byte");
  b = serReadByte(h);
  CHECK(10, 10, b, 0x00, 0, "serial read byte");
  b = serReadByte(h);
  CHECK(10, 11, b, 0xFF, 0, "serial read byte");
  b = serDataAvailable(h);
  CHECK(10, 12, b, 0, 0, "serial data availabe");
  e = serClose(h);
  CHECK(10, 13, e, 0, 0, "serial close");
}
```