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

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x18,%rsp
  lea    D123(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x2008(%rsp)
  xor    %eax,%eax
  mov    %rsi,%rbx
  mov    0x8(%rsi),%rsi
  call   <printf@plt>
  mov    0x8(%rbx),%rdi
  lea    D57(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L86
  mov    %rsp,%rbp
  mov    %rax,%rcx
  mov    $0x300,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fread@plt>
  cmp    $0x300,%eax
  je     L68
  mov    0x8(%rbx),%rsi
  lea    D97(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L1
L93:
  xor    %r12d,%r12d
L128:
  mov    0x2008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  add    $0x2018,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L68:
  lea    0xc00(%rsp),%r13
  mov    %rbp,%rsi
  mov    $0x300,%edx
  mov    %r13,%rdi
  lea    0x1800(%rsp),%rbp
  call   <memcpy@plt>
  movdqa D51(%rip),%xmm0
  lea    0x1c00(%rsp),%rax
  nopl   (%rax)
L92:
  movaps %xmm0,0x0(%rbp)
  add    $0x10,%rbp
  cmp    %rax,%rbp
  jne    L92
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L88
  mov    0x8(%rbx),%rdx
  lea    D93(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  lea    D84(%rip),%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L89
  mov    %rax,%rcx
  mov    $0x400,%edx
  mov    $0x1,%esi
  mov    %r13,%rdi
  call   <fwrite@plt>
  cmp    $0x400,%eax
  je     L130
  lea    D36(%rip),%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  je     L93
  lea    D24(%rip),%rdi
  xor    %r12d,%r12d
  call   <puts@plt>
  jmp    L128
L130:
  mov    %r12,%rdi
  mov    $0x1,%r12d
  call   <fclose@plt>
  test   %rax,%rax
  je     L128
  lea    D107(%rip),%rdi
  call   <puts@plt>
  jmp    L128
L86:
  mov    0x8(%rbx),%rsi
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L128
L88:
  lea    D42(%rip),%rdi
  xor    %r12d,%r12d
  call   <puts@plt>
  jmp    L128
L1:
  lea    D76(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L93
L89:
  mov    %rbp,%rsi
  lea    D89(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L128
L18:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D123
datatype: string
name: extract_symbolic_data
arguments: tag: D57
datatype: string
name: extract_symbolic_data
arguments: tag: D97
datatype: string
name: extract_symbolic_data
arguments: tag: D51
datatype: byte[16]
name: extract_symbolic_data
arguments: tag: D93
datatype: string
name: extract_symbolic_data
arguments: tag: D84
datatype: string
name: extract_symbolic_data
arguments: tag: D36
datatype: string
name: extract_symbolic_data
arguments: tag: D24
datatype: string
name: extract_symbolic_data
arguments: tag: D107
datatype: string
name: extract_symbolic_data
arguments: tag: D3
datatype: string
name: extract_symbolic_data
arguments: tag: D42
datatype: string
name: extract_symbolic_data
arguments: tag: D76
datatype: string
name: extract_symbolic_data
arguments: tag: D89
datatype: string

tool: D123: Reading LUT at %s


tool: D57: rb

tool: D97: File %s does not have 768 bytes.


tool: {"D51": [0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00]}

tool: D93: %s.rgba

tool: D84: w+b

tool: D36: Unable to write RGBA file.

tool: D24: Additionally, an error occured closing the file.

tool: D107: Error closing the RGBA file

tool: D3: Unable to open LUT at %s


tool: D42: Error closing LUT file.

tool: D76: Additionally, an error occured closing the file

tool: D89: Unable to open RGBA file at %s


assistant: ```c
int main(int argc, char **argv) {
  FILE *lut = NULL;
  char RGBAfile[1024];
  uint8_t lutBufferRGB[768];
  uint8_t lutBufferRGBA[1024];
  int32_t readBytes = 0, i = 0;
  printf("Reading LUT at %s\n", argv[1]);
  lut = fopen(argv[1], "rb");
  if (lut == NULL) {
    printf("Unable to open LUT at %s\n", argv[1]);
    return 0;
  }
  readBytes = (int32_t)fread(lutBufferRGB, 1, 768, lut);
  if (readBytes != 768) {
    printf("File %s does not have 768 bytes.\n", argv[1]);
    if (fclose(lut) != 0) {
      printf("Additionally, an error occured closing the file");
    }
    return 0;
  }
  memcpy(lutBufferRGBA, lutBufferRGB, 768);
  for (i = 768; i < 1024; i++)
    lutBufferRGBA[i] = 0x80;
  if (fclose(lut) != 0) {
    printf("Error closing LUT file.\n");
    return 0;
  }
  sprintf(RGBAfile, "%s.rgba", argv[1]);
  lut = fopen(RGBAfile, "w+b");
  if (lut == NULL) {
    printf("Unable to open RGBA file at %s\n", RGBAfile);
    return 0;
  }
  if (fwrite(lutBufferRGBA, 1, 1024, lut) != 1024) {
    printf("Unable to write RGBA file.\n");
    if (fclose(lut) != 0)
      printf("Additionally, an error occured closing the file.\n");
    return 0;
  }
  if (fclose(lut) != 0)
    printf("Error closing the RGBA file\n");
  return 1;
}
```