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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xf8,%rsp
  mov    %edi,-0x94(%rbp)
  mov    %rsi,-0xa0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,-0x118(%rbp)
  movl   $0x0,-0x74(%rbp)
  lea    -0x80(%rbp),%rdx
  lea    -0x84(%rbp),%rax
  mov    %rax,%rsi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x80(%rbp),%esi
  mov    -0x84(%rbp),%edi
  movslq %esi,%rax
  sub    $0x1,%rax
  mov    %rax,-0x70(%rbp)
  movslq %esi,%rax
  mov    %rax,-0xd0(%rbp)
  movq   $0x0,-0xc8(%rbp)
  movslq %esi,%rax
  lea    0x0(,%rax,4),%rbx
  movslq %edi,%rax
  sub    $0x1,%rax
  mov    %rax,-0x68(%rbp)
  movslq %esi,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  movslq %edi,%rax
  mov    %rax,%r12
  mov    $0x0,%r13d
  mov    %r15,%rdx
  imul   %r12,%rdx
  mov    %r13,%rax
  imul   %r14,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r14,%rax
  mul    %r12
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rax
  mov    %rax,-0xb0(%rbp)
  movq   $0x0,-0xa8(%rbp)
  movslq %edi,%rax
  mov    %rax,-0xc0(%rbp)
  movq   $0x0,-0xb8(%rbp)
  mov    -0xb0(%rbp),%r8
  mov    -0xa8(%rbp),%r9
  mov    %r9,%rdx
  mov    -0xc0(%rbp),%r10
  mov    -0xb8(%rbp),%r11
  imul   %r10,%rdx
  mov    %r11,%rax
  imul   %r8,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r8,%rax
  mul    %r10
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rdx
  movslq %edi,%rax
  imul   %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L1:
  cmp    %rdx,%rsp
  je     L133
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L1
L133:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L10
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L10:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x84(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x58(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xe0(%rbp)
  movq   $0x0,-0xd8(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xf0(%rbp)
  movq   $0x0,-0xe8(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L125:
  cmp    %rdx,%rsp
  je     L43
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L125
L43:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L28
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L28:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x80(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0x100(%rbp)
  movq   $0x0,-0xf8(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0x110(%rbp)
  movq   $0x0,-0x108(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L25:
  cmp    %rdx,%rsp
  je     L27
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L25
L27:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L47
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L47:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x7c(%rbp)
  jmp    L19
L40:
  movl   $0x0,-0x78(%rbp)
  jmp    L130
L35:
  mov    %rbx,%rdx
  shr    $0x2,%rdx
  mov    -0x78(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x7c(%rbp),%eax
  cltq
  imul   %rdx,%rax
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    %rbx,%rcx
  shr    $0x2,%rcx
  mov    -0x60(%rbp),%rax
  mov    -0x78(%rbp),%edx
  movslq %edx,%rdx
  imul   %rcx,%rdx
  mov    (%rax,%rdx,4),%ecx
  mov    -0x40(%rbp),%rax
  mov    -0x78(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
  addl   $0x1,-0x78(%rbp)
L130:
  mov    -0x80(%rbp),%eax
  cmp    %eax,-0x78(%rbp)
  jl     L35
  mov    %rbx,%rcx
  shr    $0x2,%rcx
  mov    -0x60(%rbp),%rax
  mov    -0x7c(%rbp),%edx
  movslq %edx,%rdx
  imul   %rcx,%rdx
  mov    (%rax,%rdx,4),%ecx
  mov    -0x50(%rbp),%rax
  mov    -0x7c(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
  addl   $0x1,-0x7c(%rbp)
L19:
  mov    -0x84(%rbp),%eax
  cmp    %eax,-0x7c(%rbp)
  jl     L40
  mov    -0x80(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <selection_sort@plt>
  mov    %rax,%rbx
  mov    -0x84(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <selection_sort@plt>
  add    %rbx,%rax
  mov    %eax,%edx
  mov    -0x74(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x74(%rbp)
  mov    -0x74(%rbp),%eax
  mov    %eax,%esi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x118(%rbp),%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L75
  call   <__stack_chk_fail@plt>
L75:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: label: D27
type: string
name: read_data
arguments: label: D4
type: string

tool: D27: %d %d

tool: D4: %d

assistant: ```c
int main(int argc, char const *argv[]) {
  int a, b, i, j, count = 0;
  scanf("%d %d", &a, &b);
  int c[a][b], d[a], e[b];
  for (i = 0; i < a; ++i) {
    for (j = 0; j < b; ++j) {
      scanf("%d", &c[i][j]);
      e[j] = c[j][0];
    }
    d[i] = c[i][0];
  }
  count += selection_sort(e, b) + selection_sort(d, a);
  printf("%d", count);
  return 0;
}
```