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    $0x78,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    D40(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L76
L32:
  mov    %rsp,%rax
  mov    %rax,-0x98(%rbp)
  mov    -0x5c(%rbp),%esi
  mov    -0x60(%rbp),%edi
  movslq %esi,%rax
  sub    $0x1,%rax
  mov    %rax,-0x50(%rbp)
  movslq %esi,%rax
  mov    %rax,-0x90(%rbp)
  movq   $0x0,-0x88(%rbp)
  movslq %esi,%rbx
  movslq %edi,%rax
  sub    $0x1,%rax
  mov    %rax,-0x48(%rbp)
  movslq %esi,%rax
  mov    %rax,%r12
  mov    $0x0,%r13d
  movslq %edi,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  mov    %r13,%rdx
  imul   %r14,%rdx
  mov    %r15,%rax
  imul   %r12,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    %r12,%rax
  mul    %r14
  add    %rdx,%rcx
  mov    %rcx,%rdx
  movslq %esi,%rax
  mov    %rax,-0x70(%rbp)
  movq   $0x0,-0x68(%rbp)
  movslq %edi,%rax
  mov    %rax,-0x80(%rbp)
  movq   $0x0,-0x78(%rbp)
  mov    -0x70(%rbp),%r8
  mov    -0x68(%rbp),%r9
  mov    %r9,%rdx
  mov    -0x80(%rbp),%r10
  mov    -0x78(%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
  mov    $0x10,%edx
  sub    $0x1,%rdx
  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
L13:
  cmp    %rdx,%rsp
  je     L71
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L13
L71:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L49
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L49:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x58(%rbp)
  jmp    L91
L22:
  movl   $0x0,-0x54(%rbp)
  jmp    L25
L47:
  mov    -0x54(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x58(%rbp),%eax
  cltq
  imul   %rbx,%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D54(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  addl   $0x1,-0x54(%rbp)
L25:
  mov    -0x5c(%rbp),%eax
  cmp    %eax,-0x54(%rbp)
  jl     L47
  addl   $0x1,-0x58(%rbp)
L91:
  mov    -0x60(%rbp),%eax
  cmp    %eax,-0x58(%rbp)
  jl     L22
  mov    -0x5c(%rbp),%ecx
  mov    -0x60(%rbp),%eax
  mov    -0x40(%rbp),%rdx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <min_strips@plt>
  mov    %eax,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x98(%rbp),%rsp
L76:
  lea    -0x5c(%rbp),%rdx
  lea    -0x60(%rbp),%rax
  mov    %rax,%rsi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  cmp    $0x2,%eax
  je     L32
  mov    $0x0,%eax
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L30
  call   <__stack_chk_fail@plt>
L30:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D40
data_type: string
name: unpack_data
arguments: data_label: D50
data_type: string
name: unpack_data
arguments: data_label: D54
data_type: string
name: unpack_data
arguments: data_label: D22
data_type: string
name: unpack_data
arguments: data_label: D7
data_type: string

tool: D40: Enter grid dimensions, followed by each element

tool: D50: > 

tool: D54:  %c

tool: D22: Min strips = %d


tool: D7: %d%d

assistant: ```c
int main(void) {
  printf("Enter grid dimensions, followed by each element\n");
  printf("> ");
  int rows, cols;
  while (scanf("%d%d", &rows, &cols) == 2) {
    char grid[rows][cols];
    int i, j;
    for (i = 0; i < rows; i++) {
      for (j = 0; j < cols; j++) {
        scanf(" %c", &grid[i][j]);
      }
    }
    printf("Min strips = %d\n", min_strips(rows, cols, grid));
    printf("> ");
  }
  return 0;
}
```