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    -0xf4000(%rsp),%r11
L28:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L28
  sub    $0x308,%rsp
  mov    $0xd,%ecx
  lea    D12(%rip),%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0xf42f8(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rdi
  lea    0x14(%rsp),%rsi
  mov    %rdi,0x8(%rsp)
  rep stos %rax,%es:(%rdi)
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x14(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x14(%rsp)
  test   %eax,%eax
  je     L94
  lea    0x1c(%rsp),%r15
  lea    0x18(%rsp),%r14
  lea    0x88(%rsp),%rbx
  lea    0xb0(%rsp),%r13
  nopl   0x0(%rax)
L22:
  mov    %r15,%rsi
  mov    %rbp,%rdi
  xor    %r12d,%r12d
  call   <scanf@plt>
  xor    %eax,%eax
  call   <getchar@plt>
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L54
  nopl   (%rax)
L120:
  xor    %eax,%eax
  add    $0x1,%r12d
  call   <getchar@plt>
  movsbl %al,%eax
  sub    $0x61,%eax
  cltq
  addl   $0x1,0x20(%rsp,%rax,4)
  cmp    %r12d,0x1c(%rsp)
  jg     L120
L54:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  movl   $0x1,0x1c(%rsp)
  mov    0x8(%rsp),%rax
  xor    %esi,%esi
  mov    $0x61,%edx
  mov    $0x1,%ecx
  nopl   0x0(%rax,%rax,1)
L165:
  cmpl   $0x1,(%rax)
  je     L57
  movl   $0x0,(%rax)
  add    $0x4,%rax
  add    $0x1,%edx
  cmp    %rbx,%rax
  jne    L165
  xor    %edi,%edi
  test   %sil,%sil
  je     L66
L79:
  lea    -0x1(%rcx),%edi
L66:
  mov    0x18(%rsp),%ecx
  mov    %edi,0x1c(%rsp)
  test   %ecx,%ecx
  je     L21
  mov    $0x1,%esi
  lea    0xaf(%rsp),%r8
  movslq %edi,%r9
  jmp    L27
  nopw   0x0(%rax,%rax,1)
L154:
  movslq %edx,%rdx
  movzbl 0x90(%rsp,%rdx,1),%edx
  mov    %dl,(%r8,%rsi,1)
  movslq %esi,%rdx
  add    $0x1,%rsi
  test   %ecx,%ecx
  je     L37
L27:
  mov    %ecx,%eax
  cltd
  idiv   %edi
  mov    %eax,%ecx
  test   %edx,%edx
  jne    L154
  movzbl 0x90(%rsp,%r9,1),%edx
  mov    %dl,(%r8,%rsi,1)
  movslq %esi,%rdx
  add    $0x1,%rsi
  test   %ecx,%ecx
  jne    L27
L37:
  mov    %eax,0x18(%rsp)
L78:
  mov    %r13,%rsi
  lea    D17(%rip),%rdi
  movb   $0x0,0xb0(%rsp,%rdx,1)
  call   <printf@plt>
  mov    0x14(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x14(%rsp)
  test   %eax,%eax
  jne    L22
L94:
  mov    0xf42f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L82
  add    $0xf4308,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L57:
  movslq %ecx,%rsi
  movl   $0x0,(%rax)
  add    $0x4,%rax
  add    $0x1,%ecx
  mov    %dl,0x90(%rsp,%rsi,1)
  add    $0x1,%edx
  cmp    %rax,%rbx
  je     L79
  mov    $0x1,%esi
  jmp    L165
L21:
  xor    %edx,%edx
  jmp    L78
L82:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D12
type_infered: string
name: retrieve_data
arguments: data_tag: D17
type_infered: string

tool: D12: %d

tool: D17: %s


assistant: ```c
int main() {
  int t, s[26] = {0};
  scanf("%d", &t);
  int n, l, k, i, r;
  char c, b[26], res[1000000];
  while (t--) {
    scanf("%d", &l);
    getchar();
    for (i = 0; i < l; i++) {
      c = getchar();
      s[c - 'a'] += 1;
    }
    scanf("%d", &n);
    l = 1;
    for (i = 0; i < 26; i++) {
      if (s[i] == 1) {
        b[l] = i + 'a';
        l = l + 1;
      }
      s[i] = 0;
    }
    k = 0;
    l = l - 1;
    while (n != 0) {
      r = n % l;
      n = n / l;
      if (r == 0)
        r = l;
      res[k] = b[r];
      k = k + 1;
    }
    res[k] = '\0';
    printf("%s\n", res);
  }
  return 0;
}
```