user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x748,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x2738(%rsp)
  xor    %eax,%eax
  mov    %rsi,%rbx
  cmp    $0x2,%edi
  jle    L108
L161:
  pxor   %xmm0,%xmm0
  mov    $0x2700,%edx
  lea    0x30(%rsp),%rdi
  xor    %esi,%esi
  movaps %xmm0,0x20(%rsp)
  lea    D192(%rip),%r13
  call   <memset@plt>
  mov    0x8(%rbx),%rdi
  call   <atoi@plt>
  lea    0x0(,%rax,4),%edi
  mov    %eax,%r12d
  call   <malloc@plt>
  mov    0x10(%rbx),%r14
  mov    %rax,(%rsp)
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    $0x2f,%ecx
  mov    %cx,(%r14,%rax,1)
  mov    0x10(%rbx),%rdi
  lea    D103(%rip),%rbx
  call   <opendir@plt>
  lea    D68(%rip),%rsi
  mov    %r13,%rdi
  mov    %rax,%rbp
  call   <fopen@plt>
  mov    %rax,%r15
  jmp    L41
  cs nopw 0x0(%rax,%rax,1)
L37:
  mov    (%rax),%rdx
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <fprintf@plt>
L41:
  mov    %rbp,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  jne    L37
  mov    %rbp,%rdi
  lea    D185(%rip),%rbx
  call   <closedir@plt>
  mov    %r15,%rdi
  lea    0x20(%rsp),%r15
  call   <fclose@plt>
  lea    D118(%rip),%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  mov    (%rsp),%rcx
  movq   $0x1,0x10(%rsp)
  mov    %rax,%rbp
  mov    %r12d,%eax
  lea    (%rcx,%rax,4),%rax
  mov    %rax,0x8(%rsp)
  jmp    L102
  nopl   0x0(%rax)
L7:
  mov    %r15,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cltq
  cmpb   $0xa,0x20(%rsp,%rax,1)
  jne    L136
  movb   $0x0,0x20(%rsp,%rax,1)
L136:
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L69
L102:
  mov    %rbp,%rdx
  mov    $0x2710,%esi
  mov    %r15,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L7
  mov    %rbp,%rdi
  call   <fclose@plt>
  sub    $0x8,%rsp
  lea    D131(%rip),%r9
  lea    D105(%rip),%r8
  push   $0x0
  lea    D156(%rip),%rcx
  lea    D32(%rip),%rdx
  push   %r13
  lea    D45(%rip),%rsi
  lea    D182(%rip),%rdi
  push   %r13
  call   <execlp@plt>
  add    $0x20,%rsp
  xor    %eax,%eax
L114:
  mov    0x2738(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L106
  add    $0x2748,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L69:
  lea    D95(%rip),%rsi
  mov    %r15,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L102
  call   <fork@plt>
  test   %eax,%eax
  je     L82
  mov    (%rsp),%rdx
  mov    0x10(%rsp),%rcx
  mov    %eax,-0x4(%rdx,%rcx,4)
  cmp    %ecx,%r12d
  jle    L138
L50:
  addq   $0x1,0x10(%rsp)
  jmp    L102
L108:
  lea    D113(%rip),%rdi
  call   <perror@plt>
  xor    %edi,%edi
  call   <exit@plt>
  jmp    L161
L82:
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strcat@plt>
  lea    D131(%rip),%r9
  lea    D105(%rip),%r8
  push   %rdx
  lea    D156(%rip),%rcx
  lea    D32(%rip),%rdx
  push   $0x0
  lea    D45(%rip),%rsi
  lea    D182(%rip),%rdi
  push   %r14
  push   %r14
  call   <execlp@plt>
  add    $0x20,%rsp
  lea    D191(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L114
L138:
  mov    (%rsp),%rcx
  jmp    L156
L135:
  mov    (%rcx),%edi
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rcx,0x18(%rsp)
  call   <waitpid@plt>
  mov    0x18(%rsp),%rcx
  add    $0x4,%rcx
L156:
  cmp    0x8(%rsp),%rcx
  jne    L135
  jmp    L50
L106:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D192
data_type: string
name: extract_symbolic_data
arguments: data_label: D103
data_type: string
name: extract_symbolic_data
arguments: data_label: D68
data_type: string
name: extract_symbolic_data
arguments: data_label: D185
data_type: string
name: extract_symbolic_data
arguments: data_label: D118
data_type: string
name: extract_symbolic_data
arguments: data_label: D131
data_type: string
name: extract_symbolic_data
arguments: data_label: D105
data_type: string
name: extract_symbolic_data
arguments: data_label: D156
data_type: string
name: extract_symbolic_data
arguments: data_label: D32
data_type: string
name: extract_symbolic_data
arguments: data_label: D45
data_type: string
name: extract_symbolic_data
arguments: data_label: D182
data_type: string
name: extract_symbolic_data
arguments: data_label: D95
data_type: string
name: extract_symbolic_data
arguments: data_label: D113
data_type: string
name: extract_symbolic_data
arguments: data_label: D191
data_type: string

tool: D192: list.txt

tool: D103: %s


tool: D68: w+

tool: D185: .

tool: D118: r

tool: D131: -o

tool: D105: -u

tool: D156: 1

tool: D32: -k

tool: D45: -n

tool: D182: sort

tool: D95: ..

tool: D113: The number of args is wrong!


tool: D191: error2


assistant: ```c
int main(int argc, char *argv[]) {
  if (argc < 3) {
    perror("The number of args is wrong!\n");
    exit(0);
  }
  int pid = 0;
  int len = 0;
  char buf[10000] = {0};
  int max = atoi(argv[1]);
  int *maxptr = malloc(sizeof(int) * max);
  int i = 0;
  char *dirname = strcat(argv[2], "/");
  DIR *dir;
  FILE *fp;
  struct dirent *ptr;
  dir = opendir(argv[2]);
  fp = fopen("list.txt", "w+");
  while ((ptr = readdir(dir)) != NULL) {
    fprintf(fp, "%s\n", ptr->d_name);
  }
  closedir(dir);
  fclose(fp);
  fp = fopen("list.txt", "r");
  while (fgets(buf, 10000, fp) != NULL) {
    len = (int)strlen(buf) - 1;
    if ('\n' == buf[len]) {
      buf[len] = '\0';
    }
    if ((strcmp(buf, ".") != 0) && (strcmp(buf, "..") != 0)) {
      pid = fork();
      if (0 == pid) {
        execlp("sort", "-n", "-k", "1", "-u", "-o", strcat(dirname, buf), dirname, (char *)NULL);
        printf("error2\n");
        return 1;
      } else {
        maxptr[i++] = pid;
      }
      if (i >= max) {
        for (int j = 0; j != max; ++j) {
          waitpid(maxptr[j], NULL, 0);
        }
      }
    }
  }
  fclose(fp);
  execlp("sort", "-n", "-k", "1", "-u", "-o", "list.txt", "list.txt", (char *)NULL);
  return 0;
}
```