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    D77(%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    D73(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L47
  mov    %rsp,%rbp
  mov    %rax,%rcx
  mov    $0x300,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fread@plt>
  cmp    $0x300,%eax
  je     L60
  mov    0x8(%rbx),%rsi
  lea    D60(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L131
L19:
  xor    %r12d,%r12d
L87:
  mov    0x2008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L112
  add    $0x2018,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L60:
  lea    0xc00(%rsp),%r13
  mov    %rbp,%rsi
  mov    $0x300,%edx
  mov    %r13,%rdi
  lea    0x1800(%rsp),%rbp
  call   <memcpy@plt>
  lea    0x1c00(%rsp),%rax
  nopl   (%rax)
L116:
  movl   $0x80,0x0(%rbp)
  add    $0x4,%rbp
  cmp    %rax,%rbp
  jne    L116
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L128
  mov    0x8(%rbx),%rdx
  lea    D99(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L45
  mov    %rax,%rcx
  mov    $0x400,%edx
  mov    $0x1,%esi
  mov    %r13,%rdi
  call   <fwrite@plt>
  cmp    $0x400,%eax
  je     L17
  lea    D46(%rip),%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  je     L19
  lea    D74(%rip),%rdi
  xor    %r12d,%r12d
  call   <puts@plt>
  jmp    L87
L17:
  mov    %r12,%rdi
  mov    $0x1,%r12d
  call   <fclose@plt>
  test   %rax,%rax
  je     L87
  lea    D75(%rip),%rdi
  call   <puts@plt>
  jmp    L87
L47:
  mov    0x8(%rbx),%rsi
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L87
L128:
  lea    D55(%rip),%rdi
  xor    %r12d,%r12d
  call   <puts@plt>
  jmp    L87
L131:
  lea    D111(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L19
L45:
  mov    %rbp,%rsi
  lea    D34(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L87
L112:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D77
type: string
name: parse_data
arguments: data_label: D73
type: string
name: parse_data
arguments: data_label: D60
type: string
name: parse_data
arguments: data_label: D99
type: string
name: parse_data
arguments: data_label: D22
type: string
name: parse_data
arguments: data_label: D46
type: string
name: parse_data
arguments: data_label: D74
type: string
name: parse_data
arguments: data_label: D75
type: string
name: parse_data
arguments: data_label: D0
type: string
name: parse_data
arguments: data_label: D55
type: string
name: parse_data
arguments: data_label: D111
type: string
name: parse_data
arguments: data_label: D34
type: string

tool: D77: Reading LUT at %s


tool: D73: rb

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


tool: D99: %s.rgba

tool: D22: w+b

tool: D46: Unable to write RGBA file.

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

tool: D75: Error closing the RGBA file

tool: D0: Unable to open LUT at %s


tool: D55: Error closing LUT file.

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

tool: D34: 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;
}
```