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

```asm
<main>:
  endbr64
  push   %rbp
  lea    D212(%rip),%rdi
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    -0x48(%rbp),%rsi
  lea    D114(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  lea    D234(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    -0x44(%rbp),%rsi
  lea    D114(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    -0x48(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %rsp,%rsi
  sub    $0x1,%eax
  movslq %eax,%rdx
  lea    0xf(,%rdx,4),%rdx
  mov    %rdx,%rcx
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L14
L157:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L157
L14:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L32
L524:
  lea    0x3(%rsp),%rbx
  mov    %rbx,%r15
  and    $0xfffffffffffffffc,%rbx
  shr    $0x2,%r15
  test   %eax,%eax
  js     L137
  mov    %eax,%eax
  mov    %rbx,%r12
  lea    D12(%rip),%r13
  lea    0x4(%rbx,%rax,4),%r14
  nopl   0x0(%rax)
L135:
  mov    %r12,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x4,%r12
  call   <scanf@plt>
  cmp    %r12,%r14
  jne    L135
L137:
  mov    -0x48(%rbp),%ecx
  xor    %r12d,%r12d
  lea    D209(%rip),%r13
  test   %ecx,%ecx
  jle    L342
  nopw   0x0(%rax,%rax,1)
L450:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x44(%rbp),%eax
  mov    %eax,%edx
  imul   %r12d,%edx
  add    $0x1,%r12d
  movslq %edx,%r14
  test   %eax,%eax
  jle    L266
  xchg   %ax,%ax
L387:
  mov    (%rbx,%r14,4),%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x1,%r14
  call   <printf@plt>
  mov    -0x44(%rbp),%eax
  imul   %r12d,%eax
  cmp    %r14d,%eax
  jg     L387
L266:
  cmp    %r12d,-0x48(%rbp)
  jg     L450
L342:
  xor    %eax,%eax
  xor    %r12d,%r12d
  lea    D209(%rip),%r13
  call   <getch@plt>
  lea    D95(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    -0x3c(%rbp),%rsi
  lea    D114(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  lea    D227(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    -0x40(%rbp),%rsi
  lea    D114(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    -0x44(%rbp),%edx
  mov    -0x40(%rbp),%ecx
  mov    %rbx,%rdi
  mov    -0x3c(%rbp),%esi
  xor    %eax,%eax
  call   <cofactor@plt>
  lea    D231(%rip),%rdi
  call   <puts@plt>
  mov    -0x48(%rbp),%edx
  test   %edx,%edx
  jle    L54
  nopl   0x0(%rax,%rax,1)
L523:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x44(%rbp),%eax
  mov    %eax,%edx
  imul   %r12d,%edx
  add    $0x1,%r12d
  movslq %edx,%r14
  test   %eax,%eax
  jle    L232
  xchg   %ax,%ax
L282:
  mov    (%rbx,%r14,4),%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x1,%r14
  call   <printf@plt>
  mov    -0x44(%rbp),%eax
  imul   %r12d,%eax
  cmp    %r14d,%eax
  jg     L282
L232:
  cmp    %r12d,-0x48(%rbp)
  jg     L523
L54:
  xor    %eax,%eax
  call   <getch@plt>
  lea    D231(%rip),%rdi
  call   <puts@plt>
  mov    -0x44(%rbp),%eax
  mov    %rsp,%rcx
  lea    -0x1(%rax),%r14d
  imul   %r14d,%r14d
  lea    -0x1(%r14),%eax
  mov    %eax,-0x54(%rbp)
  cltq
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L413
L191:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L191
L413:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L116
L400:
  lea    0x3(%rsp),%r12
  lea    D209(%rip),%r13
  mov    %r12,%rax
  and    $0xfffffffffffffffc,%r12
  shr    $0x2,%rax
  mov    %r12,-0x60(%rbp)
  xor    %r12d,%r12d
  cmpl   $0x0,-0x48(%rbp)
  mov    %rax,-0x68(%rbp)
  jle    L238
  nopw   0x0(%rax,%rax,1)
L511:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x44(%rbp),%eax
  mov    %eax,%edx
  imul   %r12d,%edx
  add    $0x1,%r12d
  movslq %edx,%r14
  test   %eax,%eax
  jg     L505
  jmp    L558
L60:
  mov    %eax,%esi
  add    $0x1,%r14
  imul   %r12d,%esi
  cmp    %r14d,%esi
  jle    L558
L505:
  mov    (%rbx,%r14,4),%esi
  test   %esi,%esi
  je     L60
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x1,%r14
  call   <printf@plt>
  mov    -0x44(%rbp),%eax
  mov    %eax,%esi
  imul   %r12d,%esi
  cmp    %r14d,%esi
  jg     L505
L558:
  cmp    %r12d,-0x48(%rbp)
  jg     L511
L238:
  mov    0x0(,%r15,4),%ebx
  test   %ebx,%ebx
  je     L181
  cmpl   $0xffffffff,-0x54(%rbp)
  jne    L351
  mov    0x4(,%r15,4),%ebx
  test   %ebx,%ebx
  je     L479
  xor    %ebx,%ebx
L156:
  cmpl   $0x0,0x8(,%r15,4)
  je     L378
L436:
  cmpl   $0x0,0xc(,%r15,4)
  je     L429
L352:
  cmpl   $0x0,0x10(,%r15,4)
  je     L234
L16:
  cmpl   $0x0,0x14(,%r15,4)
  je     L493
L211:
  mov    0x1c(,%r15,4),%eax
  test   %eax,%eax
  je     L257
  cmp    %ebx,-0x54(%rbp)
  jge    L414
L218:
  cmpl   $0xffffffff,-0x54(%rbp)
  lea    D12(%rip),%r13
  je     L18
L229:
  mov    -0x60(%rbp),%r12
  mov    -0x54(%rbp),%r14d
  lea    0x4(%r12,%r14,4),%rbx
  nopl   0x0(%rax)
L445:
  mov    (%r12),%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x4,%r12
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L445
L18:
  xor    %eax,%eax
  call   <getch@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L351:
  lea    D12(%rip),%r13
  xor    %esi,%esi
  xor    %eax,%eax
  mov    $0x1,%ebx
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x0(,%r15,4),%eax
  mov    -0x68(%rbp),%rcx
  mov    %eax,0x0(,%rcx,4)
L181:
  cmpl   $0x0,0x4(,%r15,4)
  je     L479
  cmp    %ebx,-0x54(%rbp)
  jl     L156
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x4(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%rcx,%rax,4)
L479:
  cmpl   $0x0,0x8(,%r15,4)
  je     L378
  cmp    %ebx,-0x54(%rbp)
  jl     L436
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x8(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%rcx,%rax,4)
L378:
  cmpl   $0x0,0xc(,%r15,4)
  je     L429
  cmp    %ebx,-0x54(%rbp)
  jl     L352
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0xc(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%rcx,%rax,4)
L429:
  cmpl   $0x0,0x10(,%r15,4)
  je     L234
  cmp    %ebx,-0x54(%rbp)
  jl     L16
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x10(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%rcx,%rax,4)
L234:
  cmpl   $0x0,0x14(,%r15,4)
  je     L493
  cmp    %ebx,-0x54(%rbp)
  jl     L211
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x14(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%rcx,%rax,4)
L493:
  cmpl   $0x0,0x18(,%r15,4)
  je     L211
  cmp    %ebx,-0x54(%rbp)
  jge    L500
  cmpl   $0x0,0x1c(,%r15,4)
  jne    L218
L257:
  cmpl   $0x0,0x20(,%r15,4)
  je     L218
L314:
  cmp    %ebx,-0x54(%rbp)
  jl     L218
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  movslq %ebx,%rbx
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x20(,%r15,4),%eax
  mov    -0x60(%rbp),%rcx
  mov    %eax,(%rcx,%rbx,4)
  jmp    L229
L500:
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x18(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %edx,(%rcx,%rax,4)
  jmp    L211
L116:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L400
L32:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L524
L414:
  lea    D12(%rip),%r13
  mov    %ebx,%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <printf@plt>
  mov    0x1c(,%r15,4),%edx
  mov    -0x60(%rbp),%rcx
  movslq %ebx,%rax
  add    $0x1,%ebx
  cmpl   $0x0,0x20(,%r15,4)
  mov    %edx,(%rcx,%rax,4)
  jne    L314
  jmp    L229
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D212
data_type: string
name: retrieve_data
arguments: tag: D114
data_type: string
name: retrieve_data
arguments: tag: D234
data_type: string
name: retrieve_data
arguments: tag: D12
data_type: string
name: retrieve_data
arguments: tag: D209
data_type: string
name: retrieve_data
arguments: tag: D95
data_type: string
name: retrieve_data
arguments: tag: D227
data_type: string
name: retrieve_data
arguments: tag: D231
data_type: string

tool: D212: Please enter number of rows:

tool: D114: %d

tool: D234: Please enter number of columns:

tool: D12: %d


tool: D209: %d	

tool: D95: Which element to be searched for?

tool: D227: Please enter row number:

tool: D231: 
-------------------------------------------------

assistant: ```c
main() {
  int order_r, order_c, p;
  printf("Please enter number of rows:");
  scanf("%d", &order_r);
  printf("Please enter number of columns:");
  scanf("%d", &order_c);
  p = (order_r * order_c) - 1;
  int matrix[p];
  int i;
  int j;
  for (i = 0; i <= p; ++i) {
    scanf("%d\n", &matrix[i]);
  }
  for (i = 0; i <= order_r - 1; ++i) {
    printf("\n");
    for (j = (i * order_c); j <= ((order_c) * (i + 1)) - 1; ++j) {
      printf("%d\t", matrix[j]);
    }
  }
  getch();
  int k;
  int l;
  printf("Which element to be searched for?");
  scanf("%d", &l);
  printf("Please enter row number:");
  scanf("%d", &k);
  cofactor(matrix, l, order_c, k);
  printf("\n-------------------------------------------------\n");
  for (i = 0; i <= order_r - 1; ++i) {
    printf("\n");
    for (j = (i * order_c); j <= ((order_c) * (i + 1)) - 1; ++j) {
      printf("%d\t", matrix[j]);
    }
  }
  getch();
  printf("\n-------------------------------------------------\n");
  int new_order;
  new_order = order_c - 1;
  int m;
  m = (new_order * new_order) - 1;
  int newmatrix[m];
  for (i = 0; i <= order_r - 1; ++i) {
    printf("\n");
    for (j = (i * order_c); j <= ((order_c) * (i + 1)) - 1; ++j) {
      if (matrix[j] != 0) {
        printf("%d\t", matrix[j]);
      }
    }
  }
  j = 0;
  int u;
  u = 0;
  while (j >= 0 && j <= 8) {
    while (matrix[j] != 0 && u >= 0 && u <= m) {
      printf("%d\n", u);
      newmatrix[u] = matrix[j];
      ++u;
      break;
    }
    ++j;
  }
  for (i = 0; i <= m; ++i) {
    printf("%d\n", newmatrix[i]);
  }
  getch();
}
```