user: Please show me the C implementation that matches the assembly code listed below:

```asm
<conv_file>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %ecx,-0x48(%rbp)
  mov    -0x44(%rbp),%eax
  imul   -0x48(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x44(%rbp),%eax
  imul   -0x48(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  add    %ecx,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L4
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L47
L4:
  mov    -0x44(%rbp),%eax
  imul   -0x48(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x44(%rbp),%eax
  imul   -0x48(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L41
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
  jmp    L47
L41:
  mov    -0x38(%rbp),%rdx
  mov    -0x2c(%rbp),%esi
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <fread@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x44(%rbp),%ecx
  mov    -0x48(%rbp),%edx
  mov    -0x18(%rbp),%rsi
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <conv_frame@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jns    L44
  lea    D17(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L44:
  mov    -0x40(%rbp),%rdx
  mov    -0x28(%rbp),%esi
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  cmp    %rax,-0x8(%rbp)
  je     L41
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0xffffffff,%eax
L47:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D26
type_infered: string
name: parse_data
arguments: label: D19
type_infered: string
name: parse_data
arguments: label: D17
type_infered: string
name: parse_data
arguments: label: D10
type_infered: string

tool: D26: err malloc 1


tool: D19: err malloc 2


tool: D17: frame ng


tool: D10: fwrite err


assistant: ```c
int conv_file(FILE *input, FILE *output, int width, int height) {
  void *inbuf;
  void *outbuf;
  int input_framesize = (width * height) + ((width * height) / 4);
  inbuf = malloc(input_framesize);
  if (inbuf == NULL) {
    printf("err malloc 1\n");
    return -1;
  }
  int output_framesize = ((width * height) * 2) + (((width * height) / 4) * 2);
  outbuf = malloc(output_framesize);
  if (outbuf == NULL) {
    printf("err malloc 2\n");
    return -1;
  }
  for (;;) {
    size_t readsize = fread(inbuf, input_framesize, 1, input);
    if (readsize != readsize) {
      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, output_framesize, 1, output);
    if (writesize != output_framesize) {
      printf("fwrite err\n");
      return -1;
    } else {
    }
  }
  return 0;
}
```