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

```asm
<conv_file>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,0x18(%rsp)
  mov    %edx,%edi
  mov    %edx,0xc(%rsp)
  mov    %ecx,%r15d
  mov    %ecx,%esi
  call   <inputFrameSize@plt>
  mov    %eax,%ebx
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    %ebx,%esi
  lea    D44(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r12,%r12
  je     L11
  mov    %r15d,%esi
  mov    0xc(%rsp),%edi
  call   <outputFrameSize@plt>
  mov    %eax,%ebp
  mov    %eax,%esi
  lea    D16(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L85
  mov    $0x0,%r14d
  jmp    L94
L11:
  lea    D32(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L0
L85:
  lea    D78(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L0
L61:
  mov    %r14d,%esi
  lea    D37(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
L0:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L16:
  lea    D31(%rip),%rdi
  call   <puts@plt>
  mov    $0xffffffff,%eax
  jmp    L0
L13:
  mov    0x18(%rsp),%rcx
  mov    %ebp,%edx
  mov    $0x1,%esi
  mov    %r13,%rdi
  call   <fwrite@plt>
  movslq %ebp,%rdx
  cmp    %rax,%rdx
  jne    L37
  add    $0x1,%r14d
L94:
  mov    0x10(%rsp),%rcx
  mov    %ebx,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fread@plt>
  test   %rax,%rax
  je     L61
  movslq %ebx,%rdx
  cmp    %rax,%rdx
  jne    L16
  mov    0xc(%rsp),%ecx
  mov    %r15d,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <conv_frame@plt>
  test   %eax,%eax
  jns    L13
  lea    D0(%rip),%rdi
  call   <puts@plt>
  jmp    L13
L37:
  mov    %ebp,%edx
  mov    %rax,%rsi
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L0
```

tool_calls: name: disassemble_data
arguments: data_label: D44
type_infered: string
name: disassemble_data
arguments: data_label: D16
type_infered: string
name: disassemble_data
arguments: data_label: D32
type_infered: string
name: disassemble_data
arguments: data_label: D78
type_infered: string
name: disassemble_data
arguments: data_label: D37
type_infered: string
name: disassemble_data
arguments: data_label: D31
type_infered: string
name: disassemble_data
arguments: data_label: D0
type_infered: string
name: disassemble_data
arguments: data_label: D35
type_infered: string

tool: D44: i %d


tool: D16: o %d


tool: D32: err malloc 1

tool: D78: err malloc 2

tool: D37: OK end of file %d


tool: D31: fread err

tool: D0: frame ng

tool: D35: fwrite err %d %d


assistant: ```c
int conv_file(FILE *input, FILE *output, int width, int height) {
  void *inbuf;
  void *outbuf;
  int i;
  int input_framesize = inputFrameSize(width, height);
  inbuf = malloc(input_framesize);
  printf("i %d\n", input_framesize);
  if (inbuf == NULL) {
    printf("err malloc 1\n");
    return -1;
  }
  int output_framesize = outputFrameSize(width, height);
  printf("o %d\n", output_framesize);
  outbuf = malloc(output_framesize);
  if (outbuf == NULL) {
    printf("err malloc 2\n");
    return -1;
  }
  for (i = 0;; i++) {
    size_t readsize = fread(inbuf, 1, input_framesize, input);
    if (readsize == 0) {
      printf("OK end of file %d\n", i);
      return 0;
    } else if (readsize != input_framesize) {
      printf("fread err\n");
      return -1;
    } else {
    }
    int ret = conv_frame(inbuf, outbuf, height, width);
    if (ret < 0) {
      printf("frame ng\n");
    }
    size_t writesize = fwrite(outbuf, 1, output_framesize, output);
    if (writesize != output_framesize) {
      printf("fwrite err %d %d\n", writesize, output_framesize);
      return -1;
    } else {
    }
  }
  return 0;
}
```