user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<loadmap>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %edi,%r12d
  mov    %rsi,%rdi
  lea    D45(%rip),%rsi
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %ecx,%ebx
  imul   %ebx,%ebp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  lea    D8(%rip),%rsi
  mov    %r13,%rdi
  mov    %rax,%r14
  call   <fopen@plt>
  lea    0x0(,%rbp,8),%edi
  mov    %ebp,0x14(%rsp)
  mov    %rax,0x8(%rsp)
  call   <malloc@plt>
  movl   $0x0,0x24(%rsp)
  mov    %rax,0x18(%rsp)
  test   %ebp,%ebp
  jle    L42
  movslq %ebp,%rbp
  mov    %rax,%r15
  lea    D35(%rip),%r13
  mov    %rax,%rbx
  add    %rax,%rbp
  lea    0x24(%rsp),%rax
  mov    %rax,(%rsp)
  jmp    L31
  nopl   0x0(%rax,%rax,1)
L91:
  cmp    $0x1,%r12d
  je     L55
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L96:
  mov    0x24(%rsp),%eax
  add    $0x1,%r15
  mov    %al,-0x1(%r15)
  cmp    %rbp,%r15
  je     L92
L31:
  test   %r12d,%r12d
  jne    L91
  mov    (%rsp),%rdx
  lea    D9(%rip),%rsi
  mov    %r14,%rdi
  add    $0x1,%r15
  call   <fscanf@plt>
  mov    0x24(%rsp),%eax
  mov    %al,-0x1(%r15)
  cmp    %rbp,%r15
  jne    L31
L92:
  mov    0x8(%rsp),%rcx
  mov    0x14(%rsp),%edx
  mov    $0x1,%esi
  mov    0x18(%rsp),%rdi
  call   <fwrite@plt>
  nopw   0x0(%rax,%rax,1)
L26:
  movsbl (%rbx),%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <printf@plt>
  cmp    %rbp,%rbx
  jne    L26
L4:
  mov    %r14,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L55:
  mov    (%rsp),%rdx
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <fscanf@plt>
  jmp    L96
  nopl   0x0(%rax)
L42:
  mov    0x8(%rsp),%rcx
  mov    0x14(%rsp),%edx
  mov    $0x1,%esi
  mov    0x18(%rsp),%rdi
  call   <fwrite@plt>
  jmp    L4
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D45
type: string
name: retrieve_data
arguments: data_label: D8
type: string
name: retrieve_data
arguments: data_label: D35
type: string
name: retrieve_data
arguments: data_label: D20
type: string
name: retrieve_data
arguments: data_label: D9
type: string

tool: D45: r

tool: D8: wb

tool: D35: %d

tool: D20: error,tipo no soportado

tool: D9: %d%*c

assistant: ```c
void loadmap(int type, char *path_old, int numtilex, int numtiley, char *path_new) {
  FILE *old;
  FILE *new;
  old = fopen(path_old, "r");
  new = fopen(path_new, "wb");
  int numtiles = numtilex * numtiley;
  char *temparray = (char *)malloc(numtiles * sizeof(char *));
  int i = 0;
  int v = 0;
  for (i = 0; i < (numtilex * numtiley); i++) {
    if (type == 0) {
      fscanf(old, "%d%*c", &v);
    } else if (type == 1) {
      fscanf(old, "%d", &v);
    } else {
      printf("error,tipo no soportado");
    }
    temparray[i] = v;
  }
  fwrite(temparray, sizeof(char), numtiles, new);
  for (i = 0; i < (numtilex * numtiley); i++) {
    printf("%d", temparray[i]);
  }
  fclose(old);
  fclose(new);
}
```