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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x9000(%rsp),%r11
L29:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L29
  sub    $0xc68,%rsp
  lea    D27(%rip),%rdi
  lea    D11(%rip),%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x9c58(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rdx
  lea    0x8(%rsp),%rsi
  call   <scanf@plt>
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jle    L15
  mov    0xc(%rsp),%eax
  xor    %r13d,%r13d
  xor    %r12d,%r12d
  lea    0x10(%rsp),%r14
  test   %eax,%eax
  jle    L15
  nopl   0x0(%rax)
L55:
  lea    (%r14,%r13,4),%rbp
  xor    %ebx,%ebx
  cs nopw 0x0(%rax,%rax,1)
L157:
  mov    %rbp,%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  add    $0x1,%ebx
  call   <scanf@plt>
  mov    0xc(%rsp),%eax
  add    $0x4,%rbp
  cmp    %ebx,%eax
  jg     L157
  add    $0x1,%r12d
  cmp    0x8(%rsp),%r12d
  jge    L15
  add    $0x64,%r13
  test   %eax,%eax
  jg     L55
L15:
  mov    %rsp,%rsi
  lea    0x4(%rsp),%rdx
  lea    D27(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    (%rsp),%esi
  test   %esi,%esi
  jne    L56
  mov    0xc(%rsp),%r9d
  test   %r9d,%r9d
  jle    L171
  lea    -0x1(%r9),%edx
  mov    0x4(%rsp),%eax
  cmp    $0x2,%edx
  jbe    L65
  movslq %eax,%rdi
  pxor   %xmm0,%xmm0
  imul   $0x190,%rdi,%rax
  lea    0x10(%rsp,%rax,1),%rdx
  mov    %r9d,%eax
  shr    $0x2,%eax
  lea    -0x1(%rax),%ecx
  lea    0x10(%rdx),%rax
  shl    $0x4,%rcx
  add    %rax,%rcx
  jmp    L74
  nopl   0x0(%rax,%rax,1)
L75:
  add    $0x10,%rax
L74:
  paddd  (%rdx),%xmm0
  mov    %rax,%rdx
  cmp    %rcx,%rax
  jne    L75
  movdqa %xmm0,%xmm1
  mov    %r9d,%edx
  psrldq $0x8,%xmm1
  and    $0xfffffffc,%edx
  paddd  %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%esi
  test   $0x3,%r9b
  je     L171
L77:
  imul   $0x64,%rdi,%rax
  movslq %edx,%rcx
  add    %rax,%rcx
  add    0x10(%rsp,%rcx,4),%esi
  lea    0x1(%rdx),%ecx
  cmp    %r9d,%ecx
  jge    L171
  movslq %ecx,%rcx
  add    $0x2,%edx
  add    %rax,%rcx
  add    0x10(%rsp,%rcx,4),%esi
  cmp    %edx,%r9d
  jle    L171
  movslq %edx,%rdx
  add    %rdx,%rax
  add    0x10(%rsp,%rax,4),%esi
L171:
  mov    %r15,%rdi
  call   <printf@plt>
  mov    0x9c58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L88
  add    $0x9c68,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L56:
  mov    0x8(%rsp),%edx
  test   %edx,%edx
  jle    L163
  sub    $0x1,%edx
  movslq 0x4(%rsp),%rcx
  xor    %esi,%esi
  imul   $0x64,%rdx,%rdx
  lea    0x10(%rsp,%rcx,4),%rax
  add    %rcx,%rdx
  lea    0x1a0(%rsp,%rdx,4),%rdx
  nopl   0x0(%rax)
L26:
  add    (%rax),%esi
  add    $0x190,%rax
  cmp    %rdx,%rax
  jne    L26
  jmp    L171
L163:
  xor    %esi,%esi
  jmp    L171
L65:
  xor    %edx,%edx
  movslq %eax,%rdi
  jmp    L77
L88:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D27
type_infered: string
name: disassemble_data
arguments: data_label: D11
type_infered: string

tool: D27: %d %d

tool: D11: %d

assistant: ```c
int main() {
  int i, j, n, sum = 0, isCol, position, row, col, box[100][100];
  scanf("%d %d", &row, &col);
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) {
      scanf("%d", &box[i][j]);
    }
  }
  scanf("%d %d", &isCol, &position);
  if (isCol) {
    for (i = 0; i < row; i++) {
      sum += box[i][position];
    }
  } else {
    for (i = 0; i < col; i++) {
      sum += box[position][i];
    }
  }
  printf("%d", sum);
  return 0;
}
```