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

```asm
<build_level>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %rcx,-0x48(%rbp)
  mov    %r8,-0x50(%rbp)
  mov    %r9d,-0x54(%rbp)
  mov    -0x3c(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  shr    %rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  shr    %rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,-0x8(%rbp)
  mov    -0x54(%rbp),%r9d
  mov    -0x18(%rbp),%r8
  mov    -0x48(%rbp),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  lea    D6(%rip),%rdi
  push   %rdi
  push   -0x8(%rbp)
  push   $0x1
  push   $0x0
  push   $0x2
  push   $0x0
  push   $0x1
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    -0x54(%rbp),%r9d
  mov    -0x18(%rbp),%r8
  mov    -0x50(%rbp),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  lea    D6(%rip),%rdi
  push   %rdi
  push   -0x10(%rbp)
  push   $0x1
  push   $0x0
  push   $0x2
  push   $0x1
  push   $0x1
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x18(%rbp),%r8
  mov    -0x48(%rbp),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x8(%rbp),%rax
  sub    $0x8,%rsp
  lea    D6(%rip),%rdi
  push   %rdi
  push   0x10(%rbp)
  push   $0x2
  push   $0x0
  push   $0x1
  push   $0x0
  mov    -0x54(%rbp),%edi
  push   %rdi
  mov    $0x1,%r9d
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    -0x24(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x20(%rbp)
  mov    -0x18(%rbp),%r8
  mov    -0x50(%rbp),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x8(%rbp),%rax
  sub    $0x8,%rsp
  lea    D6(%rip),%rdi
  push   %rdi
  push   -0x20(%rbp)
  push   $0x2
  push   $0x1
  push   $0x1
  push   $0x0
  mov    -0x54(%rbp),%edi
  push   %rdi
  mov    $0x1,%r9d
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    -0x24(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x20(%rbp)
  mov    -0x18(%rbp),%r8
  mov    -0x48(%rbp),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x10(%rbp),%rax
  sub    $0x8,%rsp
  lea    D6(%rip),%rdi
  push   %rdi
  push   -0x20(%rbp)
  push   $0x2
  push   $0x0
  push   $0x1
  push   $0x0
  mov    -0x54(%rbp),%edi
  push   %rdi
  mov    $0x1,%r9d
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    -0x40(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%ecx
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  mov    %ecx,%esi
  mov    0x10(%rbp),%rdi
  mov    $0x0,%eax
  call   <internal_transpose@plt>
  mov    -0x24(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x20(%rbp)
  mov    -0x18(%rbp),%r8
  mov    -0x50(%rbp),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%esi
  mov    -0x10(%rbp),%rax
  sub    $0x8,%rsp
  lea    D6(%rip),%rdi
  push   %rdi
  push   -0x20(%rbp)
  push   $0x2
  push   $0x1
  push   $0x1
  push   $0x0
  mov    -0x54(%rbp),%edi
  push   %rdi
  mov    $0x1,%r9d
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    $0x1,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D6
type_guessed: string

tool: D6: reflect1

assistant: ```c
int build_level(image, level_x_size, level_y_size, lo_filter, hi_filter, filter_size, result_block)
int level_x_size, level_y_size, filter_size;
float *image, *result_block, *lo_filter, *hi_filter;
{
  float *hi_imagetemp, *lo_imagetemp, *filtertemp;
  int total_size = level_x_size * level_y_size, i;
  float *tresult_block = result_block;
  filtertemp = (float *)check_malloc(filter_size * sizeof(float));
  hi_imagetemp = (float *)check_malloc(total_size * sizeof(float) / 2);
  lo_imagetemp = (float *)check_malloc(total_size * sizeof(float) / 2);
  internal_filter(image, level_x_size, level_y_size, lo_filter, filtertemp, filter_size, 1, 0, 2, 0, 1, lo_imagetemp, "reflect1");
  internal_filter(image, level_x_size, level_y_size, hi_filter, filtertemp, filter_size, 1, 1, 2, 0, 1, hi_imagetemp, "reflect1");
  level_x_size /= 2;
  internal_filter(lo_imagetemp, level_x_size, level_y_size, lo_filter, filtertemp, 1, filter_size, 0, 1, 0, 2, result_block, "reflect1");
  internal_filter(lo_imagetemp, level_x_size, level_y_size, hi_filter, filtertemp, 1, filter_size, 0, 1, 1, 2, (tresult_block += (total_size / 4)), "reflect1");
  internal_filter(hi_imagetemp, level_x_size, level_y_size, lo_filter, filtertemp, 1, filter_size, 0, 1, 0, 2, (tresult_block += (total_size / 4)), "reflect1");
  internal_transpose(result_block, level_y_size / 2, level_x_size);
  internal_filter(hi_imagetemp, level_x_size, level_y_size, hi_filter, filtertemp, 1, filter_size, 0, 1, 1, 2, (tresult_block += (total_size / 4)), "reflect1");
  check_free((char *)filtertemp);
  check_free((char *)hi_imagetemp);
  check_free((char *)lo_imagetemp);
  return 1;
}
```