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

```asm
<dump_sel_arg_struct>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x14(%rsp)
  test   %edi,%edi
  js     L19
  mov    %rcx,%r12
  mov    %esi,%r13d
  mov    %edi,%r14d
  mov    $0x28,%edi
  call   <malloc@plt>
  lea    0x4(%r13),%edi
  mov    %r12,%rsi
  mov    %rax,%rbp
  call   <read_ptr_from_mem@plt>
  lea    0x8(%r13),%edi
  mov    %r12,%rsi
  mov    %eax,%r15d
  call   <read_ptr_from_mem@plt>
  lea    0xc(%r13),%edi
  mov    %r12,%rsi
  mov    %eax,0x4(%rsp)
  call   <read_ptr_from_mem@plt>
  lea    0x10(%r13),%edi
  mov    %r12,%rsi
  mov    %eax,0x8(%rsp)
  call   <read_ptr_from_mem@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  mov    %eax,0xc(%rsp)
  test   %r14d,%r14d
  je     L16
  call   <dump_long_unsigned_int_from_mem@plt>
  lea    0x8(%rbp),%rsi
  mov    %r12,%rdx
  mov    %r15d,%edi
  add    %eax,0x14(%rsp)
  call   <dump_long_unsigned_int_from_mem@plt>
  mov    0x4(%rsp),%edi
  lea    0x10(%rbp),%rsi
  mov    %r12,%rdx
  add    %eax,0x14(%rsp)
  call   <dump_long_unsigned_int_from_mem@plt>
  mov    0x8(%rsp),%edi
  lea    0x18(%rbp),%rsi
  mov    %r12,%rdx
  add    %eax,0x14(%rsp)
  call   <dump_long_unsigned_int_from_mem@plt>
  mov    0xc(%rsp),%esi
  lea    0x20(%rbp),%rdx
  mov    %r12,%rcx
  lea    -0x1(%r14),%edi
  add    %eax,0x14(%rsp)
  call   <dump_timeval@plt>
L38:
  lea    0x14(%rsp),%rdx
  mov    $0x5,%esi
  mov    %rbp,%rdi
  add    %eax,0x14(%rsp)
  call   <copy_params@plt>
  mov    $0x5,%esi
  mov    %rbp,%rdi
  mov    %rax,(%rbx)
  call   <free_dumped_params@plt>
  mov    0x14(%rsp),%eax
L44:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L16:
  call   <dump_long_unsigned_int_from_mem@plt>
  lea    0x8(%rbp),%rsi
  mov    %r15d,%edi
  add    %eax,0x14(%rsp)
  call   <dump_ptr@plt>
  mov    0x4(%rsp),%edi
  lea    0x10(%rbp),%rsi
  add    %eax,0x14(%rsp)
  call   <dump_ptr@plt>
  mov    0x8(%rsp),%edi
  lea    0x18(%rbp),%rsi
  add    %eax,0x14(%rsp)
  call   <dump_ptr@plt>
  mov    0xc(%rsp),%edi
  lea    0x20(%rbp),%rsi
  add    %eax,0x14(%rsp)
  call   <dump_ptr@plt>
  jmp    L38
  nopl   (%rax)
L19:
  xor    %edi,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  mov    0x14(%rsp),%eax
  jmp    L44
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int dump_sel_arg_struct(int depth, unsigned int addr, char **dumped_params, struct target *target) {
  char **dumped_type_params;
  unsigned int arm_tracing_n = addr;
  unsigned int arm_tracing_inp = addr + 4;
  unsigned int arm_tracing_outp = addr + 8;
  unsigned int arm_tracing_exp = addr + 12;
  unsigned int arm_tracing_tvp = addr + 16;
  int len = 0;
  if (depth < 0) {
    *dumped_params = malloc(0);
    return len;
  }
  dumped_type_params = malloc(5 * (sizeof(char *)));
  arm_tracing_inp = read_ptr_from_mem(arm_tracing_inp, target);
  arm_tracing_outp = read_ptr_from_mem(arm_tracing_outp, target);
  arm_tracing_exp = read_ptr_from_mem(arm_tracing_exp, target);
  arm_tracing_tvp = read_ptr_from_mem(arm_tracing_tvp, target);
  if (depth == 0) {
    len += dump_long_unsigned_int_from_mem(arm_tracing_n, &dumped_type_params[0], target);
    len += dump_ptr(arm_tracing_inp, &dumped_type_params[1]);
    len += dump_ptr(arm_tracing_outp, &dumped_type_params[2]);
    len += dump_ptr(arm_tracing_exp, &dumped_type_params[3]);
    len += dump_ptr(arm_tracing_tvp, &dumped_type_params[4]);
    *dumped_params = copy_params(dumped_type_params, 5, &len);
    free_dumped_params(dumped_type_params, 5);
    return len;
  }
  if (depth >= 1) {
    len += dump_long_unsigned_int_from_mem(arm_tracing_n, &dumped_type_params[0], target);
    len += dump_long_unsigned_int_from_mem(arm_tracing_inp, &dumped_type_params[1], target);
    len += dump_long_unsigned_int_from_mem(arm_tracing_outp, &dumped_type_params[2], target);
    len += dump_long_unsigned_int_from_mem(arm_tracing_exp, &dumped_type_params[3], target);
    len += dump_timeval(depth - 1, arm_tracing_tvp, &dumped_type_params[4], target);
  }
  *dumped_params = copy_params(dumped_type_params, 5, &len);
  free_dumped_params(dumped_type_params, 5);
  return len;
}
```