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

```asm
<build_level>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %esi,%r13d
  mov    %edx,%ebx
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %r9d,%r14d
  mov    %esi,%ebp
  imul   %edx,%ebp
  movslq %r9d,%rdi
  shl    $0x2,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  movslq %eax,%r12
  movslq %ebp,%r15
  shl    $0x2,%r15
  shr    %r15
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  cltq
  mov    %rax,0x10(%rsp)
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <check_malloc@plt>
  movslq %eax,%rdx
  push   $0x0
  lea    D9(%rip),%r15
  push   %r15
  mov    %rdx,0x18(%rsp)
  push   %rdx
  push   $0x1
  push   $0x0
  push   $0x2
  push   $0x0
  push   $0x1
  mov    %r14d,%r9d
  mov    %r12,%r8
  mov    0x58(%rsp),%rcx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    0x68(%rsp),%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  push   $0x0
  push   %r15
  push   0x20(%rsp)
  push   $0x1
  push   $0x0
  push   $0x2
  push   $0x1
  push   $0x1
  mov    %r14d,%r9d
  mov    %r12,%r8
  mov    0x60(%rsp),%rcx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    0x68(%rsp),%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %eax,%r13d
  sar    %r13d
  add    $0x40,%rsp
  push   $0x0
  push   %r15
  push   0x80(%rsp)
  push   $0x2
  push   $0x0
  push   $0x1
  push   $0x0
  push   %r14
  mov    $0x1,%r9d
  mov    %r12,%r8
  mov    0x58(%rsp),%rcx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    0x48(%rsp),%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  lea    0x3(%rbp),%eax
  add    $0x40,%rsp
  test   %ebp,%ebp
  cmovns %ebp,%eax
  sar    $0x2,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    %rsi,0x28(%rsp)
  mov    %rsi,%rbp
  add    0x70(%rsp),%rbp
  push   $0x0
  push   %r15
  push   %rbp
  push   $0x2
  push   $0x1
  push   $0x1
  push   $0x0
  push   %r14
  mov    $0x1,%r9d
  mov    %r12,%r8
  mov    0x60(%rsp),%rcx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    0x48(%rsp),%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    0x68(%rsp),%rbp
  add    $0x40,%rsp
  push   $0x0
  push   %r15
  push   %rbp
  push   $0x2
  push   $0x0
  push   $0x1
  push   $0x0
  push   %r14
  mov    $0x1,%r9d
  mov    %r12,%r8
  mov    0x58(%rsp),%rcx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    0x50(%rsp),%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    %ebx,%esi
  shr    $0x1f,%esi
  add    %ebx,%esi
  sar    %esi
  mov    %r13d,%edx
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <internal_transpose@plt>
  push   $0x0
  push   %r15
  add    0x38(%rsp),%rbp
  push   %rbp
  push   $0x2
  push   $0x1
  push   $0x1
  push   $0x0
  push   %r14
  mov    $0x1,%r9d
  mov    %r12,%r8
  mov    0x60(%rsp),%rcx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    0x50(%rsp),%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <internal_filter@plt>
  add    $0x40,%rsp
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <check_free@plt>
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: label: D9
datatype: string

tool: D9: reflect1

assistant: ```c
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;
  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", 0);
  internal_filter(image, level_x_size, level_y_size, hi_filter, filtertemp, filter_size, 1, 1, 2, 0, 1, hi_imagetemp, "reflect1", 0);
  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", 0);
  internal_filter(lo_imagetemp, level_x_size, level_y_size, hi_filter, filtertemp, 1, filter_size, 0, 1, 1, 2, (result_block += (total_size / 4)), "reflect1", 0);
  internal_filter(hi_imagetemp, level_x_size, level_y_size, lo_filter, filtertemp, 1, filter_size, 0, 1, 0, 2, (result_block += (total_size / 4)), "reflect1", 0);
  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, (result_block += (total_size / 4)), "reflect1", 0);
  check_free((char *)filtertemp);
  check_free((char *)hi_imagetemp);
  check_free((char *)lo_imagetemp);
}
```