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

```asm
<test_plot_lattice>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0xc8,0x8(%rsp)
  movl   $0xc8,0xc(%rsp)
  mov    D17(%rip),%rax
  mov    %rax,0x10(%rsp)
  lea    D46(%rip),%r15
  cmp    $0x2,%edi
  jle    L65
  mov    %rsi,%r14
  lea    0x10(%rsi),%rbx
  lea    -0x3(%rdi),%eax
  lea    0x18(%rsi,%rax,8),%r13
  lea    D32(%rip),%r12
  jmp    L18
L33:
  lea    0x10(%rsp),%rdx
  lea    D49(%rip),%rsi
  mov    (%rbx),%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L83
L39:
  add    $0x8,%rbx
  cmp    %r13,%rbx
  je     L29
L18:
  lea    0x8(%rsp),%rdx
  mov    %r12,%rsi
  mov    (%rbx),%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L39
  lea    0xc(%rsp),%rdx
  lea    D37(%rip),%rsi
  mov    (%rbx),%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L39
  lea    0x8(%rsp),%rdx
  lea    D45(%rip),%rsi
  mov    (%rbx),%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L33
  mov    0x8(%rsp),%eax
  mov    %eax,0xc(%rsp)
  jmp    L39
L83:
  mov    $0x2,%edx
  lea    D12(%rip),%rsi
  mov    (%rbx),%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L14
  mov    (%rbx),%r15
  add    $0x2,%r15
  jmp    L39
L14:
  mov    0x8(%r14),%rsi
  mov    $0x0,%edx
  mov    (%r14),%rdi
  call   <usage@plt>
  jmp    L39
L29:
  cmpl   $0x2,0x8(%rsp)
  jle    L125
  cmpl   $0x2,0xc(%rsp)
  jg     L65
L125:
  mov    0x8(%r14),%rsi
  mov    $0x1,%edx
  mov    (%r14),%rdi
  call   <usage@plt>
L65:
  mov    $0x0,%edx
  mov    0xc(%rsp),%esi
  mov    0x8(%rsp),%edi
  call   <allocate_matrix@plt>
  mov    %rax,%rbp
  mov    $0x0,%edx
  mov    0xc(%rsp),%esi
  mov    0x8(%rsp),%edi
  call   <allocate_matrix@plt>
  mov    %rax,%rbx
  mov    $0x2e,%edx
  mov    0xc(%rsp),%esi
  mov    0x8(%rsp),%edi
  call   <allocate_matrix@plt>
  mov    %rax,%r12
  lea    0x20(%rsp),%r14
  lea    0x18(%rsp),%r13
  mov    0xc(%rsp),%ecx
  mov    0x8(%rsp),%edx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <set_A1_A2@plt>
  movsd  0x10(%rsp),%xmm0
  mov    0xc(%rsp),%ecx
  mov    0x8(%rsp),%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <populate_bonds@plt>
  push   %r15
  push   %r14
  mov    %r13,%r9
  mov    0x1c(%rsp),%r8d
  mov    0x18(%rsp),%ecx
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <plot_lattice@plt>
  mov    %r15,%rsi
  lea    D51(%rip),%rdi
  call   <printf@plt>
  mov    0x1c(%rsp),%edx
  mov    0x18(%rsp),%esi
  mov    %rbp,%rdi
  call   <free_matrix@plt>
  mov    0x1c(%rsp),%edx
  mov    0x18(%rsp),%esi
  mov    %rbx,%rdi
  call   <free_matrix@plt>
  mov    0x1c(%rsp),%edx
  mov    0x18(%rsp),%esi
  mov    %r12,%rdi
  call   <free_matrix@plt>
  add    $0x10,%rsp
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L120
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L120:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D17
type: f64
name: extract_symbolic_data
arguments: label: D46
type: string
name: extract_symbolic_data
arguments: label: D32
type: string
name: extract_symbolic_data
arguments: label: D49
type: string
name: extract_symbolic_data
arguments: label: D37
type: string
name: extract_symbolic_data
arguments: label: D45
type: string
name: extract_symbolic_data
arguments: label: D12
type: string
name: extract_symbolic_data
arguments: label: D51
type: string

tool: D17: 0.6

tool: D46: p2.ppm

tool: D32: M=%d

tool: D49: p=%lf

tool: D37: N=%d

tool: D45: MN=%d

tool: D12: f=

tool: D51: Wrote %s.


assistant: ```c
void test_plot_lattice(int argc, char **argv) {
  int M = 200;
  int N = 200;
  double p = 0.6;
  int argi;
  int **vbonds;
  int **hbonds;
  int **site_marks;
  int A1[2];
  int A2[2];
  char *image_file_name = "p2.ppm";
  for (argi = 2; argi < argc; argi++) {
    if (sscanf(argv[argi], "M=%d", &M) == 1)
      ;
    else if (sscanf(argv[argi], "N=%d", &N) == 1)
      ;
    else if (sscanf(argv[argi], "MN=%d", &M) == 1)
      N = M;
    else if (sscanf(argv[argi], "p=%lf", &p) == 1)
      ;
    else if (strncmp(argv[argi], "f=", 2) == 0)
      image_file_name = &argv[argi][2];
    else
      usage(argv[0], argv[1], 0);
  }
  if ((M < 3) || (N < 3))
    usage(argv[0], argv[1], 1);
  vbonds = allocate_matrix(M, N, 0);
  hbonds = allocate_matrix(M, N, 0);
  site_marks = allocate_matrix(M, N, '.');
  set_A1_A2(A1, A2, M, N);
  populate_bonds(vbonds, hbonds, M, N, p);
  plot_lattice(site_marks, vbonds, hbonds, M, N, A1, A2, image_file_name);
  printf("Wrote %s.\n", image_file_name);
  free_matrix(vbonds, M, N);
  free_matrix(hbonds, M, N);
  free_matrix(site_marks, M, N);
}
```