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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%edi
  jle    L119
  mov    0x8(%rsi),%rdi
  lea    D14(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L119
  lea    D27(%rip),%rsi
  lea    D29(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L119
  lea    0x24(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  mov    %r13,%rdi
  call   <spng_dec_read_size@plt>
  mov    0x24(%rsp),%edx
  mov    0x20(%rsp),%esi
  mov    %r12,%rdi
  call   <write_ppm_header@plt>
  mov    %r13,%rdi
  call   <spng_dec_read_palet@plt>
  mov    %r13,%rdi
  call   <spng_dec_go_to_image_data@plt>
  mov    $0x3,%esi
  mov    %r13,%rdi
  call   <spng_dec_read_bits@plt>
  cmpl   $0x0,0x24(%rsp)
  je     L122
  movl   $0x0,0xc(%rsp)
  lea    0x1f(%rsp),%r14
  nopl   (%rax)
L54:
  mov    %r13,%rdi
  call   <spng_dec_read_literal@plt>
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  je     L31
  xor    %ebp,%ebp
  jmp    L103
  nopl   0x0(%rax,%rax,1)
L89:
  lea    0x1e(%rsp),%rcx
  lea    0x1d(%rsp),%rdx
  mov    %r13,%rdi
  mov    %r14,%r8
  call   <spng_dec_literal_to_rgb@plt>
  movzbl 0x1f(%rsp),%ecx
  mov    %r12,%rdi
  add    $0x1,%ebp
  movzbl 0x1e(%rsp),%edx
  movzbl 0x1d(%rsp),%esi
  call   <write_ppm_pixel@plt>
L2:
  cmp    %ebp,0x20(%rsp)
  jbe    L31
L103:
  mov    %r13,%rdi
  call   <spng_dec_read_literal@plt>
  mov    %eax,%esi
  cmp    $0xff,%eax
  jbe    L89
  mov    %r13,%rdi
  call   <spng_dec_read_length@plt>
  mov    $0x5,%esi
  mov    %r13,%rdi
  mov    %eax,%ebx
  add    %eax,%ebp
  call   <spng_dec_read_bits@plt>
  test   %ebx,%ebx
  je     L2
  xor    %r15d,%r15d
  cs nopw 0x0(%rax,%rax,1)
L81:
  movzbl 0x1f(%rsp),%ecx
  movzbl 0x1e(%rsp),%edx
  mov    %r12,%rdi
  add    $0x1,%r15d
  movzbl 0x1d(%rsp),%esi
  call   <write_ppm_pixel@plt>
  cmp    %r15d,%ebx
  jne    L81
  cmp    %ebp,0x20(%rsp)
  ja     L103
L31:
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %eax,0x24(%rsp)
  ja     L54
L122:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L109:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L36
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L119:
  xor    %eax,%eax
  call   <usage@plt>
  mov    $0x2,%eax
  jmp    L109
L36:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D14
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D27
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D29
type_guessed: string

tool: D14: r

tool: D27: w

tool: D29: out.ppm

assistant: ```c
int main(int argc, char *argv[]) {
  unsigned char r, g, b;
  unsigned int i, x, y;
  unsigned int w, h;
  unsigned int lit;
  FILE *fp = NULL;
  FILE *fpppm = NULL;
  if (argc > 1) {
    fp = fopen(argv[1], "r");
  }
  if (!fp) {
    usage();
    return 2;
  }
  fpppm = fopen("out.ppm", "w");
  if (!fpppm) {
    usage();
    return 2;
  }
  spng_dec_read_size(fp, &w, &h);
  write_ppm_header(fpppm, w, h);
  spng_dec_read_palet(fp);
  spng_dec_go_to_image_data(fp);
  spng_dec_read_bits(fp, 3);
  y = 0;
  while (y < h) {
    spng_dec_read_literal(fp);
    x = 0;
    while (x < w) {
      lit = spng_dec_read_literal(fp);
      if (lit < 256) {
        spng_dec_literal_to_rgb(fp, lit, &r, &g, &b);
        x++;
        write_ppm_pixel(fpppm, r, g, b);
      } else {
        lit = spng_dec_read_length(fp, lit);
        x += lit;
        spng_dec_read_bits(fp, 5);
        for (i = 0; i < lit; i++) {
          write_ppm_pixel(fpppm, r, g, b);
        }
      }
    }
    y++;
  }
  fclose(fpppm);
  fclose(fp);
  return 1;
}
```