user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0xf4000(%rsp),%r11
L1:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L1
  sub    $0x2f0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xf42e8(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rdi
  mov    $0xd,%ecx
  rep stos %rax,%es:(%rdi)
  lea    0x4(%rsp),%rsi
  lea    D7(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  test   %eax,%eax
  je     L4
  lea    0xc(%rsp),%r13
  lea    D7(%rip),%rbp
  mov    $0x1,%ebx
  lea    D29(%rip),%r12
  jmp    L87
L51:
  movl   $0x0,(%rcx)
  add    $0x4,%rax
  add    $0x1,%edx
  cmp    %rdi,%rax
  je     L49
L140:
  mov    %rax,%rcx
  cmpl   $0x1,(%rax)
  jne    L51
  movslq %esi,%r8
  mov    %dl,0x80(%rsp,%r8,1)
  add    $0x1,%esi
  mov    %ebx,%r8d
  jmp    L51
L49:
  test   %r8b,%r8b
  je     L139
  mov    %esi,0xc(%rsp)
L139:
  mov    0xc(%rsp),%eax
  lea    -0x1(%rax),%ecx
  mov    %ecx,0xc(%rsp)
  mov    0x8(%rsp),%esi
  test   %esi,%esi
  je     L14
  lea    0xa0(%rsp),%rdi
  mov    $0x0,%r8d
  jmp    L130
L43:
  mov    %edx,%r8d
L130:
  mov    %esi,%eax
  cltd
  idiv   %ecx
  mov    %eax,%esi
  test   %edx,%edx
  cmove  %ecx,%edx
  movslq %edx,%rdx
  movzbl 0x80(%rsp,%rdx,1),%r9d
  mov    %r9b,(%rdi)
  lea    0x1(%r8),%edx
  add    $0x1,%rdi
  test   %eax,%eax
  jne    L43
  movl   $0x0,0x8(%rsp)
  movslq %r8d,%r8
  mov    %r9b,0xa0(%rsp,%r8,1)
L85:
  movslq %edx,%rdx
  movb   $0x0,0xa0(%rsp,%rdx,1)
  lea    0xa0(%rsp),%rsi
  mov    %r12,%rdi
  call   <printf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  test   %eax,%eax
  je     L4
L87:
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  cmpl   $0x0,0xc(%rsp)
  jle    L29
  mov    $0x0,%r14d
L145:
  mov    $0x0,%eax
  call   <getchar@plt>
  movsbl %al,%eax
  sub    $0x61,%eax
  cltq
  addl   $0x1,0x10(%rsp,%rax,4)
  add    $0x1,%r14d
  cmp    %r14d,0xc(%rsp)
  jg     L145
L29:
  lea    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  movl   $0x1,0xc(%rsp)
  lea    0x10(%rsp),%rax
  lea    0x78(%rsp),%rdi
  mov    $0x61,%edx
  mov    $0x0,%r8d
  mov    $0x1,%esi
  jmp    L140
L14:
  mov    %esi,%edx
  jmp    L85
L4:
  mov    0xf42e8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  mov    $0x0,%eax
  add    $0xf42f0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L68:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D7
data_type: string
name: disassemble_data
arguments: tag: D29
data_type: string

tool: D7: %d

tool: D29: %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;
}
```