user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D2(%rip),%r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    D23(%rip),%rbx
  mov    %rbx,%rdi
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x18(%rsp),%rsi
  lea    0x10(%rsp),%r14
  call   <scanf@plt>
  mov    0x18(%rsp),%rax
  lea    0x20(%rsp),%rdi
  mov    %rdi,0x8(%rsp)
  lea    -0x1(%rax),%rdx
  mov    %rdx,0x18(%rsp)
  test   %rax,%rax
  je     L28
  nopl   0x0(%rax,%rax,1)
L132:
  mov    %r14,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x10(%rsp),%rax
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  mov    %r13,%rdi
  mov    %rax,%r15
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x8(%rsp),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  movzbl (%r15),%eax
  mov    %r15,%rsi
  test   %al,%al
  je     L58
  nopl   (%rax)
L15:
  mov    %rsi,%rdx
  nopl   0x0(%rax,%rax,1)
L111:
  movzbl (%rsi),%ecx
  cmp    %al,%cl
  jle    L116
  mov    %al,(%rsi)
  mov    %cl,(%rdx)
L116:
  movzbl 0x1(%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  jne    L111
  movzbl 0x1(%rsi),%eax
  add    $0x1,%rsi
  test   %al,%al
  jne    L15
L58:
  mov    0x20(%rsp),%rdi
  mov    0x10(%rsp),%rsi
  mov    %rdi,%rax
  cqto
  idiv   %rsi
  mov    %rax,%r12
  test   %rax,%rax
  je     L126
  xor    %r12d,%r12d
  nopl   0x0(%rax)
L23:
  sub    %rsi,%rdi
  imul   %rsi,%rsi
  add    $0x1,%r12
  mov    %rdi,%rax
  cqto
  idiv   %rsi
  test   %rax,%rax
  jne    L23
  mov    %rdi,0x20(%rsp)
  mov    %rdx,%rbp
  test   %rdx,%rdx
  jle    L41
L18:
  add    $0x1,%r12
L41:
  lea    0x1(%r12),%rdi
  call   <malloc@plt>
  mov    %rax,%r9
  mov    %rax,%r10
  cmp    $0x1,%r12
  je     L65
  mov    0x10(%rsp),%rdx
  mov    $0x1,%esi
  mov    $0x1,%eax
  nopw   0x0(%rax,%rax,1)
L140:
  add    $0x1,%rax
  imul   %rdx,%rsi
  cmp    %r12,%rax
  jne    L140
L45:
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L78:
  mov    %rbp,%rax
  cqto
  idiv   %rsi
  cmp    $0x1,%rdx
  sbb    $0x0,%rax
  add    $0x1,%rdi
  movzbl (%r15,%rax,1),%edx
  imul   %rsi,%rax
  mov    %dl,-0x1(%rdi,%r9,1)
  sub    %rax,%rbp
  cmp    %r12,%rdi
  jl     L78
  add    %r12,%r9
L152:
  movb   $0x0,(%r9)
  mov    %r10,%rsi
  lea    D17(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,0x18(%rsp)
  test   %rax,%rax
  jne    L132
L28:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L126:
  mov    %rdx,%rbp
  test   %rdx,%rdx
  jg     L18
  mov    $0x1,%edi
  call   <malloc@plt>
  mov    %rax,%r9
  mov    %rax,%r10
  jmp    L152
L25:
  call   <__stack_chk_fail@plt>
L65:
  mov    $0x1,%esi
  jmp    L45
```

tool_calls: name: parse_data
arguments: tag: D2
datatype: string
name: parse_data
arguments: tag: D23
datatype: string
name: parse_data
arguments: tag: D17
datatype: string

tool: D2: %s

tool: D23: %lld

tool: D17: %s


assistant: ```c
int main() {
  long long int i, m1, c, j, k, l, m, T, n, d;
  char *a, x, *b;
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld", &m);
    a = (char *)malloc((m + 1) * sizeof(char));
    scanf("%s", a);
    scanf("%lld", &n);
    for (i = 0; a[i] != '\0'; i++) {
      for (j = i; a[j] != '\0'; j++) {
        l = a[i];
        k = a[j];
        if (l > k) {
          x = a[i];
          a[i] = a[j];
          a[j] = x;
        }
      }
    }
    c = 0;
    m1 = m;
    while (n / m1 != 0) {
      n = n - m1;
      m1 = m1 * m1;
      c++;
    }
    d = n % m1;
    if (d > 0)
      c++;
    k = 0;
    b = (char *)malloc(c + 1 * sizeof(char));
    l = 1;
    for (j = 1; j <= c - 1; j++) {
      l *= m;
    }
    for (j = 0; j < c; j++) {
      i = d / l;
      if (d % l == 0)
        i--;
      b[k] = a[i];
      k++;
      d = d - l * i;
    }
    b[k] = '\0';
    printf("%s\n", b);
  }
  return 0;
}
```