user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  lea    -0x4000(%rsp),%r11
L142:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L142
  sub    $0xf50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x420(%rbp)
  movq   $0x0,-0x418(%rbp)
  lea    -0x410(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7e,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  movl   $0x0,-0x4f54(%rbp)
  movl   $0x0,-0x4f50(%rbp)
  mov    $0x1c200,%esi
  lea    D89(%rip),%rax
  mov    %rax,%rdi
  call   <serialOpen@plt>
  mov    %eax,-0x4f44(%rbp)
  lea    D93(%rip),%rax
  mov    %rax,%rsi
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x4f38(%rbp)
  mov    -0x4f44(%rbp),%eax
  mov    $0x31,%esi
  mov    %eax,%edi
  call   <sendShot@plt>
  lea    -0x4f50(%rbp),%rdx
  lea    -0x4f54(%rbp),%rcx
  mov    -0x4f44(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <readImageDetails@plt>
  mov    -0x4f50(%rbp),%edx
  mov    -0x4f54(%rbp),%eax
  mov    %eax,%esi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x4f54(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x4f30(%rbp)
  mov    -0x4f50(%rbp),%ecx
  mov    -0x4f54(%rbp),%edx
  mov    -0x4f30(%rbp),%rsi
  mov    -0x4f44(%rbp),%eax
  mov    %eax,%edi
  call   <readImage@plt>
  mov    -0x4f44(%rbp),%eax
  mov    %eax,%edi
  call   <serialClose@plt>
  mov    $0x0,%eax
  call   <njInit@plt>
  mov    -0x4f54(%rbp),%edx
  mov    -0x4f30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <njDecode@plt>
  test   %rax,%rax
  je     L63
  lea    D92(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L197
L63:
  mov    $0x0,%eax
  call   <njGetHeight@plt>
  mov    %eax,%ebx
  mov    $0x0,%eax
  call   <njGetWidth@plt>
  mov    %ebx,%edx
  mov    %eax,%esi
  lea    D88(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <njGetHeight@plt>
  mov    %eax,%r12d
  mov    $0x0,%eax
  call   <njGetWidth@plt>
  mov    %eax,%ebx
  mov    $0x0,%eax
  call   <njIsColor@plt>
  test   %rax,%rax
  je     L75
  mov    $0x6,%edx
  jmp    L72
L75:
  mov    $0x5,%edx
L72:
  mov    -0x4f38(%rbp),%rax
  mov    %r12d,%r8d
  mov    %ebx,%ecx
  lea    D56(%rip),%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    $0x0,%eax
  call   <njGetWidth@plt>
  mov    %eax,-0x4f40(%rbp)
  mov    $0x0,%eax
  call   <njGetHeight@plt>
  mov    %eax,-0x4f3c(%rbp)
  mov    $0x0,%eax
  call   <njGetImageSize@plt>
  mov    %eax,%ebx
  mov    $0x0,%eax
  call   <njGetImage@plt>
  mov    %rax,%rdi
  mov    -0x4f38(%rbp),%rax
  mov    %rax,%rcx
  mov    %ebx,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    $0x0,%eax
  call   <njGetImage@plt>
  mov    %rax,-0x4f28(%rbp)
  movl   $0x0,-0x4f4c(%rbp)
  jmp    L135
L180:
  movl   $0x0,-0x4f48(%rbp)
  jmp    L125
L73:
  mov    -0x4f48(%rbp),%eax
  imul   -0x4f40(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4f4c(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  mov    %eax,%edx
  mov    -0x4f28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  D72(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x4f48(%rbp),%eax
  imul   -0x4f40(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4f4c(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x4f28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movsd  D46(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x4f48(%rbp),%eax
  imul   -0x4f40(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4f4c(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    $0x2,%eax
  mov    %eax,%edx
  mov    -0x4f28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movsd  D70(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,%ecx
  mov    -0x4f48(%rbp),%esi
  mov    -0x4f4c(%rbp),%edx
  mov    %rdx,%rax
  shl    $0x4,%rax
  sub    %rdx,%rax
  shl    $0x3,%rax
  lea    -0x10(%rax),%rax
  add    %rbp,%rax
  add    %rsi,%rax
  sub    $0x4f10,%rax
  mov    %cl,(%rax)
  addl   $0x1,-0x4f48(%rbp)
L125:
  mov    -0x4f48(%rbp),%eax
  cmp    -0x4f3c(%rbp),%eax
  jb     L73
  addl   $0x1,-0x4f4c(%rbp)
L135:
  mov    -0x4f4c(%rbp),%eax
  cmp    -0x4f40(%rbp),%eax
  jb     L180
  movl   $0x0,-0x4f48(%rbp)
  jmp    L84
L116:
  movl   $0x0,-0x4f4c(%rbp)
  jmp    L2
L187:
  mov    -0x4f48(%rbp),%ecx
  mov    -0x4f4c(%rbp),%edx
  mov    %rdx,%rax
  shl    $0x4,%rax
  sub    %rdx,%rax
  shl    $0x3,%rax
  lea    -0x10(%rax),%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x4f10,%rax
  movzbl (%rax),%eax
  cmp    $0x3e,%al
  ja     L168
  mov    $0x40,%edi
  call   <putchar@plt>
  jmp    L19
L168:
  mov    -0x4f48(%rbp),%ecx
  mov    -0x4f4c(%rbp),%edx
  mov    %rdx,%rax
  shl    $0x4,%rax
  sub    %rdx,%rax
  shl    $0x3,%rax
  lea    -0x10(%rax),%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x4f10,%rax
  movzbl (%rax),%eax
  test   %al,%al
  js     L109
  mov    $0x2a,%edi
  call   <putchar@plt>
  jmp    L19
L109:
  mov    -0x4f48(%rbp),%ecx
  mov    -0x4f4c(%rbp),%edx
  mov    %rdx,%rax
  shl    $0x4,%rax
  sub    %rdx,%rax
  shl    $0x3,%rax
  lea    -0x10(%rax),%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x4f10,%rax
  movzbl (%rax),%eax
  cmp    $0xbe,%al
  ja     L74
  mov    $0x2b,%edi
  call   <putchar@plt>
  jmp    L19
L74:
  mov    $0x2d,%edi
  call   <putchar@plt>
L19:
  addl   $0x1,-0x4f4c(%rbp)
L2:
  mov    -0x4f4c(%rbp),%eax
  cmp    -0x4f40(%rbp),%eax
  jb     L187
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0x4f48(%rbp)
L84:
  mov    -0x4f48(%rbp),%eax
  cmp    -0x4f3c(%rbp),%eax
  jb     L116
  mov    -0x4f38(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  call   <njDone@plt>
  mov    $0x0,%eax
L197:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L169
  call   <__stack_chk_fail@plt>
L169:
  add    $0x4f50,%rsp
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: data_label: D89
type_infered: string
name: parse_data
arguments: data_label: D93
type_infered: string
name: parse_data
arguments: data_label: D41
type_infered: string
name: parse_data
arguments: data_label: D8
type_infered: string
name: parse_data
arguments: data_label: D92
type_infered: string
name: parse_data
arguments: data_label: D88
type_infered: string
name: parse_data
arguments: data_label: D56
type_infered: string
name: parse_data
arguments: data_label: D72
type_infered: f64
name: parse_data
arguments: data_label: D46
type_infered: f64
name: parse_data
arguments: data_label: D70
type_infered: f64

tool: D89: /dev/ttyUSB1

tool: D93: w

tool: D41: ./image.ppm

tool: D8: size: %d
packets count: %d


tool: D92: Error decoding the input file.

tool: D88: size:
%d %d


tool: D56: P%d
%d %d
255


tool: D72: 0.21

tool: D46: 0.72

tool: D70: 0.07

assistant: ```c
int main() {
  unsigned char buffer[1024] = {0};
  unsigned int picSize = 0;
  unsigned int packNum = 0;
  unsigned int packSize;
  unsigned short int checksum;
  unsigned int width, height;
  unsigned int i, j;
  unsigned char bytes[2];
  unsigned char image[160][120];
  int fd = serialOpen("/dev/ttyUSB1", 115200);
  FILE *filefd = fopen("./image.ppm", "w");
  unsigned char *bufptr;
  sendShot(fd, 0x31);
  readImageDetails(fd, &picSize, &packNum);
  printf("size: %d\npackets count: %d\n", picSize, packNum);
  unsigned char *imgBuffer = (unsigned char *)malloc((picSize + 1) * sizeof(unsigned char));
  readImage(fd, imgBuffer, picSize, packNum);
  serialClose(fd);
  njInit();
  if (njDecode(imgBuffer, picSize)) {
    printf("Error decoding the input file.\n");
    return 1;
  }
  printf("size:\n%d %d\n", njGetWidth(), njGetHeight());
  fprintf(filefd, "P%d\n%d %d\n255\n", njIsColor() ? 6 : 5, njGetWidth(), njGetHeight());
  width = njGetWidth();
  height = njGetHeight();
  fwrite(njGetImage(), 1, njGetImageSize(), filefd);
  bufptr = njGetImage();
  for (i = 0; i < width; i++) {
    for (j = 0; j < height; j++) {
      image[i][j] = (char)((0.21 * (double)bufptr[(i + j * width) * 3]) + 0.72 * (double)bufptr[(i + j * width) * 3 + 1] + 0.07 * (double)bufptr[(i + j * width) * 3 + 2]);
    }
  }
  for (j = 0; j < height; j++) {
    for (i = 0; i < width; i++) {
      if (image[i][j] < 63)
        printf("@");
      else if (image[i][j] < 128)
        printf("*");
      else if (image[i][j] < 191)
        printf("+");
      else
        printf("-");
    }
    printf("\n");
  }
  fclose(filefd);
  njDone();
}
```