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

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x5a59,%edx
  lea    D24(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  movdqa D39(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  lea    0x38(%rsp),%rsi
  mov    %dx,0x58(%rsp)
  movabs $0x5857565554535251,%rax
  mov    %rax,0x50(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x5a(%rsp)
  movaps %xmm0,0x40(%rsp)
  call   <scanf@plt>
  mov    0x38(%rsp),%ecx
  lea    0x3c(%rsp),%rax
  movl   $0x1,0x24(%rsp)
  mov    %rax,0x28(%rsp)
  test   %ecx,%ecx
  jle    L60
L77:
  mov    0x28(%rsp),%rsi
  lea    D24(%rip),%rdi
  xor    %eax,%eax
  xor    %r15d,%r15d
  call   <scanf@plt>
  mov    0x3c(%rsp),%eax
  test   %eax,%eax
  jle    L11
  lea    0x60(%rsp),%rax
  movl   $0x0,0x20(%rsp)
  lea    0x40(%rsp),%r13
  mov    %rax,0x18(%rsp)
  nopl   (%rax)
L2:
  mov    0x18(%rsp),%rbx
  lea    D17(%rip),%rdi
  xor    %eax,%eax
  xor    %ebp,%ebp
  mov    %rbx,%rsi
  call   <scanf@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  movslq %eax,%rcx
  mov    %rcx,0x10(%rsp)
  test   %eax,%eax
  jle    L6
  nopl   0x0(%rax)
L63:
  mov    0x18(%rsp),%rax
  mov    %ebp,0xc(%rsp)
  xor    %r14d,%r14d
  lea    (%rax,%rbp,1),%r12
L23:
  lea    0x0(%r13,%r14,1),%rsi
  mov    $0x1,%edx
  mov    %r12,%rdi
  mov    %r14d,%ebx
  call   <strncmp@plt>
  add    $0x1,%r14
  test   %rax,%rax
  jne    L23
  mov    0x20(%rsp),%eax
  add    %r15d,%ebx
  add    0xc(%rsp),%ebx
  add    $0x1,%rbp
  lea    (%rbx,%rax,1),%r15d
  cmp    0x10(%rsp),%rbp
  jne    L63
L6:
  addl   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%eax
  cmp    %eax,0x3c(%rsp)
  jg     L2
L11:
  mov    %r15d,%esi
  lea    D49(%rip),%rdi
  call   <printf@plt>
  addl   $0x1,0x24(%rsp)
  mov    0x24(%rsp),%eax
  cmp    %eax,0x38(%rsp)
  jge    L77
L60:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0xa8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L7:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D24
type_guessed: string
name: read_data
arguments: data_label: D39
type_guessed: byte[16]
name: read_data
arguments: data_label: D17
type_guessed: string
name: read_data
arguments: data_label: D49
type_guessed: string

tool: D24: %d

tool: {"D39": [0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50]}

tool: D17: %s

tool: D49: %d


assistant: ```c
int main() {
  char Alfa[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", String0[51];
  int Cont, N, NLin, Cont2, Lim, Cont3, Cont4, Som = 0, Cond = 0;
  scanf("%d", &N);
  for (Cont = 1; Cont <= N; Cont++) {
    scanf("%d", &NLin);
    Som = 0;
    for (Cont2 = 0; Cont2 < NLin; Cont2++) {
      scanf("%s", String0);
      Lim = strlen(String0) - 1;
      Cont4 = 0;
      for (Cont3 = 0; Cont3 <= Lim; Cont3++) {
        Cond = 0;
        while (Cond != 1) {
          if (strncmp(&String0[Cont3], &Alfa[Cont4], 1) == 0) {
            Som = Som + Cont4;
            Som = Som + Cont3;
            Som = Som + Cont2;
            Cond = 1;
            Cont4 = 0;
          } else
            Cont4++;
        }
      }
    }
    printf("%d\n", Som);
  }
  return 0;
}
```