user: 请将以下的汇编代码转换成C语言代码：

```asm
<read_mosaic_contact>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x998,%rsp
  mov    %rdi,-0x2948(%rbp)
  mov    %rsi,-0x2950(%rbp)
  mov    %rdx,-0x2958(%rbp)
  mov    %rcx,-0x2960(%rbp)
  mov    %r8,-0x2968(%rbp)
  mov    %r9,-0x2970(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x2978(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0x2980(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0x2988(%rbp)
  mov    0x28(%rbp),%rax
  mov    %rax,-0x2990(%rbp)
  mov    0x30(%rbp),%rax
  mov    %rax,-0x2998(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0x2,-0x2928(%rbp)
  movl   $0x2,-0x2924(%rbp)
  mov    -0x2948(%rbp),%rax
  lea    D32(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_dimlen@plt>
  mov    %eax,-0x2920(%rbp)
  mov    -0x2920(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x2908(%rbp)
  movl   $0x0,-0x293c(%rbp)
  jmp    L25
L90:
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x2908(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    $0xff,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x2908(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  lea    -0x293c(%rbp),%rcx
  mov    -0x2948(%rbp),%rax
  lea    D11(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_string_data_level@plt>
  mov    -0x293c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x293c(%rbp)
L25:
  mov    -0x293c(%rbp),%eax
  cmp    %eax,-0x2920(%rbp)
  jg     L90
  mov    -0x2948(%rbp),%rax
  lea    D108(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_dimlen@plt>
  mov    %eax,-0x291c(%rbp)
  movl   $0x0,-0x293c(%rbp)
  jmp    L47
L64:
  lea    -0x293c(%rbp),%rcx
  lea    -0x120(%rbp),%rdx
  mov    -0x2948(%rbp),%rax
  lea    D18(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_string_data_level@plt>
  lea    -0x2938(%rbp),%rcx
  lea    -0x2900(%rbp),%rdx
  lea    -0x120(%rbp),%rax
  mov    %rcx,%r9
  mov    %rdx,%r8
  mov    $0x28,%ecx
  mov    $0xff,%edx
  lea    D74(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <tokenize@plt>
  mov    -0x2938(%rbp),%eax
  cmp    $0x4,%eax
  je     L133
  lea    D95(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L133:
  movl   $0x0,-0x292c(%rbp)
  movl   $0x0,-0x2934(%rbp)
  jmp    L166
L50:
  mov    -0x2934(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x2908(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    -0x2900(%rbp),%rdx
  add    $0xff,%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L0
  movl   $0x1,-0x292c(%rbp)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2950(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2934(%rbp),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  jmp    L73
L0:
  addl   $0x1,-0x2934(%rbp)
L166:
  mov    -0x2934(%rbp),%eax
  cmp    -0x2920(%rbp),%eax
  jl     L50
L73:
  cmpl   $0x0,-0x292c(%rbp)
  jne    L13
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L13:
  movl   $0x0,-0x292c(%rbp)
  movl   $0x0,-0x2934(%rbp)
  jmp    L267
L159:
  mov    -0x2934(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x2908(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    -0x2900(%rbp),%rdx
  add    $0x2fd,%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L239
  movl   $0x1,-0x292c(%rbp)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2958(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2934(%rbp),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  jmp    L4
L239:
  addl   $0x1,-0x2934(%rbp)
L267:
  mov    -0x2934(%rbp),%eax
  cmp    -0x2920(%rbp),%eax
  jl     L159
L4:
  cmpl   $0x0,-0x292c(%rbp)
  jne    L57
  lea    D136(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L57:
  lea    -0x293c(%rbp),%rcx
  lea    -0x120(%rbp),%rdx
  mov    -0x2948(%rbp),%rax
  lea    D126(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_string_data_level@plt>
  lea    -0x2938(%rbp),%rcx
  lea    -0x2900(%rbp),%rdx
  lea    -0x120(%rbp),%rax
  mov    %rcx,%r9
  mov    %rdx,%r8
  mov    $0x28,%ecx
  mov    $0xff,%edx
  lea    D72(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <tokenize@plt>
  mov    -0x2938(%rbp),%eax
  cmp    $0x8,%eax
  je     L15
  lea    D91(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L15:
  movl   $0x0,-0x2934(%rbp)
  jmp    L107
L101:
  movl   $0x0,-0x2930(%rbp)
  jmp    L75
L53:
  mov    -0x2930(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x2934(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x8,%rax
  sub    %rdx,%rax
  lea    -0x10(%rax),%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x28f0,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L33
  mov    -0x2930(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x2934(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x8,%rax
  sub    %rdx,%rax
  lea    -0x10(%rax),%rax
  add    %rbp,%rax
  add    %rcx,%rax
  sub    $0x28f0,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jg     L182
L33:
  lea    D129(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L182:
  addl   $0x1,-0x2930(%rbp)
L75:
  mov    -0x2930(%rbp),%eax
  movslq %eax,%rbx
  lea    -0x2900(%rbp),%rcx
  mov    -0x2934(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  shl    $0x8,%rax
  sub    %rdx,%rax
  add    %rcx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %rax,%rbx
  jb     L53
  addl   $0x1,-0x2934(%rbp)
L107:
  mov    -0x2934(%rbp),%edx
  mov    -0x2938(%rbp),%eax
  cmp    %eax,%edx
  jb     L101
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2960(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2968(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0xff,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2970(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0x1fe,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2978(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0x2fd,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2980(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0x3fc,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2988(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0x4fb,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2990(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0x5fa,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2998(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x2900(%rbp),%rax
  add    $0x6f9,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2968(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2960(%rbp),%rax
  add    %rax,%rdx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x2968(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%esi
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdi
  mov    -0x2960(%rbp),%rax
  add    %rdi,%rax
  mov    (%rax),%eax
  mov    -0x2928(%rbp),%edi
  mov    %edi,%r8d
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,-0x2918(%rbp)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2978(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2970(%rbp),%rax
  add    %rax,%rdx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x2978(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%esi
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdi
  mov    -0x2970(%rbp),%rax
  add    %rdi,%rax
  mov    (%rax),%eax
  mov    -0x2924(%rbp),%edi
  mov    %edi,%r8d
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,-0x2914(%rbp)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2988(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2980(%rbp),%rax
  add    %rax,%rdx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x2988(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%esi
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdi
  mov    -0x2980(%rbp),%rax
  add    %rdi,%rax
  mov    (%rax),%eax
  mov    -0x2928(%rbp),%edi
  mov    %edi,%r8d
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,-0x2910(%rbp)
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2998(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x2990(%rbp),%rax
  add    %rax,%rdx
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x2998(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%esi
  mov    -0x293c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdi
  mov    -0x2990(%rbp),%rax
  add    %rdi,%rax
  mov    (%rax),%eax
  mov    -0x2924(%rbp),%edi
  mov    %edi,%r8d
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,-0x290c(%rbp)
  cmpl   $0x0,-0x2918(%rbp)
  jne    L103
  cmpl   $0x0,-0x2914(%rbp)
  jne    L103
  lea    D71(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L103:
  cmpl   $0x0,-0x2910(%rbp)
  jne    L5
  cmpl   $0x0,-0x290c(%rbp)
  jne    L5
  lea    D99(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L5:
  mov    -0x2918(%rbp),%edx
  mov    -0x2914(%rbp),%eax
  add    %eax,%edx
  mov    -0x2910(%rbp),%ecx
  mov    -0x290c(%rbp),%eax
  add    %ecx,%eax
  cmp    %eax,%edx
  je     L243
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L243:
  mov    -0x293c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x293c(%rbp)
L47:
  mov    -0x293c(%rbp),%eax
  cmp    %eax,-0x291c(%rbp)
  jg     L64
  movl   $0x0,-0x2934(%rbp)
  jmp    L271
L48:
  mov    -0x2934(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x2908(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x2934(%rbp)
L271:
  mov    -0x2934(%rbp),%eax
  cmp    -0x2920(%rbp),%eax
  jl     L48
  mov    -0x2908(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L287
  call   <__stack_chk_fail@plt>
L287:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D32
type_guessed: string
name: unpack_data
arguments: data_tag: D11
type_guessed: string
name: unpack_data
arguments: data_tag: D108
type_guessed: string
name: unpack_data
arguments: data_tag: D18
type_guessed: string
name: unpack_data
arguments: data_tag: D74
type_guessed: string
name: unpack_data
arguments: data_tag: D95
type_guessed: string
name: unpack_data
arguments: data_tag: D34
type_guessed: string
name: unpack_data
arguments: data_tag: D136
type_guessed: string
name: unpack_data
arguments: data_tag: D126
type_guessed: string
name: unpack_data
arguments: data_tag: D72
type_guessed: string
name: unpack_data
arguments: data_tag: D91
type_guessed: string
name: unpack_data
arguments: data_tag: D129
type_guessed: string
name: unpack_data
arguments: data_tag: D71
type_guessed: string
name: unpack_data
arguments: data_tag: D99
type_guessed: string
name: unpack_data
arguments: data_tag: D60
type_guessed: string

tool: D32: ntiles

tool: D11: gridtiles

tool: D108: ncontact

tool: D18: contacts

tool: D74: :

tool: D95: Error from read_mosaic: number of elements in contact seperated by :/:: should be 4

tool: D34: error from read_mosaic: the first tile name specified in contact is not found in tile list

tool: D136: error from read_mosaic: the second tile name specified in contact is not found in tile list

tool: D126: contact_index

tool: D72: :,

tool: D91: Error from read_mosaic: number of elements in contact_index seperated by :/, should be 8

tool: D129: Error from read_mosaic: some of the character in contact_indices except token is not digit number

tool: D71: Error from read_mosaic_contact:istart1==iend1 and jstart1==jend1

tool: D99: Error from read_mosaic_contact:istart2==iend2 and jstart2==jend2

tool: D60: Error from read_mosaic_contact: It is not a line or overlap contact

assistant: ```c
void read_mosaic_contact(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1, int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2) {
  char contacts[255];
  char **gridtiles;
  char pstring[40][255];
  int ntiles, ncontacts, n, m, l, found;
  unsigned int nstr;
  const int x_refine = 2, y_refine = 2;
  int i1_type, j1_type, i2_type, j2_type;
  ntiles = get_dimlen(mosaic_file, "ntiles");
  gridtiles = (char **)malloc(ntiles * sizeof(char *));
  for (n = 0; n < ntiles; n++) {
    gridtiles[n] = (char *)malloc(255 * sizeof(char));
    get_string_data_level(mosaic_file, "gridtiles", gridtiles[n], &n);
  }
  ncontacts = get_dimlen(mosaic_file, "ncontact");
  for (n = 0; n < ncontacts; n++) {
    get_string_data_level(mosaic_file, "contacts", contacts, &n);
    tokenize(contacts, ":", 255, 40, (char *)pstring, &nstr);
    if (nstr != 4)
      error_handler("Error from read_mosaic: number of elements "
                    "in contact seperated by :/:: should be 4");
    found = 0;
    for (m = 0; m < ntiles; m++) {
      if (strcmp(gridtiles[m], pstring[1]) == 0) {
        found = 1;
        tile1[n] = m + 1;
        break;
      }
    }
    if (!found)
      error_handler("error from read_mosaic: the first tile name specified "
                    "in contact is not found in tile list");
    found = 0;
    for (m = 0; m < ntiles; m++) {
      if (strcmp(gridtiles[m], pstring[3]) == 0) {
        found = 1;
        tile2[n] = m + 1;
        break;
      }
    }
    if (!found)
      error_handler("error from read_mosaic: the second tile name specified "
                    "in contact is not found in tile list");
    get_string_data_level(mosaic_file, "contact_index", contacts, &n);
    tokenize(contacts, ":,", 255, 40, (char *)pstring, &nstr);
    if (nstr != 8)
      error_handler("Error from read_mosaic: number of elements "
                    "in contact_index seperated by :/, should be 8");
    for (m = 0; m < nstr; m++)
      for (l = 0; l < strlen(pstring[m]); l++) {
        if (pstring[m][l] > '9' || pstring[m][l] < '0') {
          error_handler("Error from read_mosaic: some of the character in "
                        "contact_indices except token is not digit number");
        }
      }
    istart1[n] = atoi(pstring[0]);
    iend1[n] = atoi(pstring[1]);
    jstart1[n] = atoi(pstring[2]);
    jend1[n] = atoi(pstring[3]);
    istart2[n] = atoi(pstring[4]);
    iend2[n] = atoi(pstring[5]);
    jstart2[n] = atoi(pstring[6]);
    jend2[n] = atoi(pstring[7]);
    i1_type = transfer_to_model_index(istart1[n], iend1[n], istart1 + n, iend1 + n, x_refine);
    j1_type = transfer_to_model_index(jstart1[n], jend1[n], jstart1 + n, jend1 + n, y_refine);
    i2_type = transfer_to_model_index(istart2[n], iend2[n], istart2 + n, iend2 + n, x_refine);
    j2_type = transfer_to_model_index(jstart2[n], jend2[n], jstart2 + n, jend2 + n, y_refine);
    if (i1_type == 0 && j1_type == 0)
      error_handler("Error from read_mosaic_contact:istart1==iend1 and jstart1==jend1");
    if (i2_type == 0 && j2_type == 0)
      error_handler("Error from read_mosaic_contact:istart2==iend2 and jstart2==jend2");
    if (i1_type + j1_type != i2_type + j2_type)
      error_handler("Error from read_mosaic_contact: It is not a line or overlap contact");
  }
  for (m = 0; m < ntiles; m++) {
    free(gridtiles[m]);
  }
  free(gridtiles);
}
```