user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<read_mosaic_contact>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x988,%rsp
  mov    %rdi,%r13
  mov    %rdi,0x8(%rsp)
  mov    %rsi,0x70(%rsp)
  mov    %rdx,0x78(%rsp)
  mov    %rcx,0x58(%rsp)
  mov    %r8,0x60(%rsp)
  mov    %r9,0x68(%rsp)
  mov    0x29c0(%rsp),%rax
  mov    %rax,0x10(%rsp)
  mov    0x29c8(%rsp),%rax
  mov    %rax,0x18(%rsp)
  mov    0x29d0(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    0x29d8(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    0x29e0(%rsp),%rax
  mov    %rax,0x30(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x2978(%rsp)
  xor    %eax,%eax
  lea    D159(%rip),%rsi
  call   <get_dimlen@plt>
  mov    %eax,%r12d
  mov    %eax,0x50(%rsp)
  movslq %eax,%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rax,%r15
  movl   $0x0,0x88(%rsp)
  test   %r12d,%r12d
  jle    L91
  mov    $0x0,%ebx
  lea    D61(%rip),%rbp
L8:
  mov    $0xff,%edi
  call   <malloc@plt>
  mov    %rax,%rdx
  movslq %ebx,%rbx
  mov    %rax,(%r15,%rbx,8)
  lea    0x88(%rsp),%rcx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <get_string_data_level@plt>
  mov    0x88(%rsp),%eax
  lea    0x1(%rax),%ebx
  mov    %ebx,0x88(%rsp)
  cmp    %r12d,%ebx
  jl     L8
  lea    D87(%rip),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <get_dimlen@plt>
  mov    %eax,0x54(%rsp)
  movl   $0x0,0x88(%rsp)
  test   %eax,%eax
  jle    L127
L152:
  lea    0x88(%rsp),%rax
  mov    %rax,0x38(%rsp)
  lea    0x2870(%rsp),%rax
  mov    %rax,0x40(%rsp)
  lea    0x8c(%rsp),%rax
  mov    %rax,0x48(%rsp)
  lea    0x90(%rsp),%rax
  mov    %rax,(%rsp)
  jmp    L251
L111:
  lea    D139(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L250
L330:
  movslq 0x88(%rsp),%rax
  add    $0x1,%ebp
  mov    0x70(%rsp),%rdx
  mov    %ebp,(%rdx,%rax,4)
L301:
  mov    $0x0,%ebx
  lea    0x38d(%rsp),%r12
  mov    0x50(%rsp),%r13d
L204:
  mov    %ebx,%ebp
  mov    (%r15,%rbx,8),%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L56
  add    $0x1,%rbx
  cmp    %ebx,%r13d
  jg     L204
L328:
  lea    D85(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
L180:
  mov    0x38(%rsp),%rcx
  mov    0x40(%rsp),%rbx
  mov    %rbx,%rdx
  lea    D15(%rip),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <get_string_data_level@plt>
  mov    0x48(%rsp),%r9
  mov    (%rsp),%r8
  mov    $0x28,%ecx
  mov    $0xff,%edx
  lea    D127(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <tokenize@plt>
  cmpl   $0x8,0x8c(%rsp)
  jne    L141
L41:
  lea    0x90(%rsp),%r13
  mov    $0x0,%r12d
  lea    D19(%rip),%r14
  jmp    L84
L56:
  movslq 0x88(%rsp),%rax
  add    $0x1,%ebp
  mov    0x78(%rsp),%rdx
  mov    %ebp,(%rdx,%rax,4)
  jmp    L180
L141:
  lea    D72(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  cmpl   $0x0,0x8c(%rsp)
  jne    L41
L32:
  movslq 0x88(%rsp),%rax
  mov    0x58(%rsp),%r14
  lea    (%r14,%rax,4),%rbx
  mov    (%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x60(%rsp),%rbp
  lea    0x0(%rbp,%rax,4),%rbx
  lea    0x18f(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x68(%rsp),%r12
  lea    (%r12,%rax,4),%rbx
  lea    0x28e(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x10(%rsp),%rdx
  lea    (%rdx,%rax,4),%rbx
  lea    0x38d(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x18(%rsp),%rcx
  lea    (%rcx,%rax,4),%rbx
  lea    0x48c(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x20(%rsp),%rsi
  lea    (%rsi,%rax,4),%rbx
  lea    0x58b(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x28(%rsp),%rdi
  lea    (%rdi,%rax,4),%rbx
  lea    0x68a(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  mov    0x30(%rsp),%rbx
  lea    (%rbx,%rax,4),%rbx
  lea    0x789(%rsp),%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %eax,(%rbx)
  movslq 0x88(%rsp),%rax
  shl    $0x2,%rax
  lea    0x0(%rbp,%rax,1),%rcx
  add    %r14,%rax
  mov    $0x2,%r8d
  mov    %rax,%rdx
  mov    (%rcx),%esi
  mov    (%rax),%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,%r13d
  movslq 0x88(%rsp),%rax
  shl    $0x2,%rax
  mov    0x10(%rsp),%rdx
  lea    (%rdx,%rax,1),%rcx
  add    %r12,%rax
  mov    $0x2,%r8d
  mov    %rax,%rdx
  mov    (%rcx),%esi
  mov    (%rax),%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,%r12d
  movslq 0x88(%rsp),%rax
  shl    $0x2,%rax
  mov    0x20(%rsp),%rsi
  lea    (%rsi,%rax,1),%rcx
  add    0x18(%rsp),%rax
  mov    $0x2,%r8d
  mov    %rax,%rdx
  mov    (%rcx),%esi
  mov    (%rax),%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,%ebx
  movslq 0x88(%rsp),%rax
  shl    $0x2,%rax
  mov    0x30(%rsp),%rdx
  lea    (%rdx,%rax,1),%rcx
  add    0x28(%rsp),%rax
  mov    $0x2,%r8d
  mov    %rax,%rdx
  mov    (%rcx),%esi
  mov    (%rax),%edi
  mov    $0x0,%eax
  call   <transfer_to_model_index@plt>
  mov    %eax,%ebp
  mov    %r13d,%eax
  or     %r12d,%eax
  je     L99
L316:
  mov    %ebx,%eax
  or     %ebp,%eax
  je     L59
L61:
  add    %r12d,%r13d
  add    %ebp,%ebx
  cmp    %ebx,%r13d
  jne    L277
L329:
  mov    0x88(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x88(%rsp)
  cmp    0x54(%rsp),%eax
  jge    L80
L251:
  mov    0x38(%rsp),%rcx
  mov    0x40(%rsp),%rbx
  mov    %rbx,%rdx
  lea    D32(%rip),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <get_string_data_level@plt>
  mov    0x48(%rsp),%r9
  mov    (%rsp),%r8
  mov    $0x28,%ecx
  mov    $0xff,%edx
  lea    D39(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <tokenize@plt>
  cmpl   $0x4,0x8c(%rsp)
  jne    L111
L250:
  mov    0x50(%rsp),%eax
  test   %eax,%eax
  jle    L256
  mov    %eax,%r13d
  mov    $0x0,%ebx
  lea    0x18f(%rsp),%r12
L16:
  mov    %ebx,%ebp
  mov    (%r15,%rbx,8),%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L330
  add    $0x1,%rbx
  cmp    %rbx,%r13
  jne    L16
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L301
L43:
  add    $0x1,%rbx
L11:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %rbx,%rax
  jbe    L220
  movzbl 0x0(%rbp,%rbx,1),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L43
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L43
L220:
  add    $0x1,%r12d
  add    $0xff,%r13
  cmp    %r12d,0x8c(%rsp)
  jbe    L32
L84:
  mov    %r13,%rbp
  mov    $0x0,%ebx
  jmp    L11
L99:
  lea    D52(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L316
L59:
  lea    D54(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L61
L277:
  lea    D13(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L329
L80:
  cmpl   $0x0,0x50(%rsp)
  jle    L239
L127:
  mov    $0x0,%ebx
  mov    0x50(%rsp),%ebp
L283:
  mov    (%r15,%rbx,8),%rdi
  call   <free@plt>
  add    $0x1,%rbx
  cmp    %ebx,%ebp
  jg     L283
L239:
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x2978(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L178
  add    $0x2988,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L91:
  lea    D87(%rip),%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <get_dimlen@plt>
  mov    %eax,0x54(%rsp)
  movl   $0x0,0x88(%rsp)
  test   %eax,%eax
  jg     L152
  jmp    L239
L256:
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <error_handler@plt>
  jmp    L328
L178:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D159
type_guessed: string
name: extract_symbolic_data
arguments: tag: D61
type_guessed: string
name: extract_symbolic_data
arguments: tag: D87
type_guessed: string
name: extract_symbolic_data
arguments: tag: D139
type_guessed: string
name: extract_symbolic_data
arguments: tag: D85
type_guessed: string
name: extract_symbolic_data
arguments: tag: D15
type_guessed: string
name: extract_symbolic_data
arguments: tag: D127
type_guessed: string
name: extract_symbolic_data
arguments: tag: D19
type_guessed: string
name: extract_symbolic_data
arguments: tag: D72
type_guessed: string
name: extract_symbolic_data
arguments: tag: D32
type_guessed: string
name: extract_symbolic_data
arguments: tag: D39
type_guessed: string
name: extract_symbolic_data
arguments: tag: D7
type_guessed: string
name: extract_symbolic_data
arguments: tag: D52
type_guessed: string
name: extract_symbolic_data
arguments: tag: D54
type_guessed: string
name: extract_symbolic_data
arguments: tag: D13
type_guessed: string

tool: D159: ntiles

tool: D61: gridtiles

tool: D87: ncontact

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

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

tool: D15: contact_index

tool: D127: :,

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

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

tool: D32: contacts

tool: D39: :

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

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

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

tool: D13: 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);
}
```