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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbx
  cmp    $0x2,%edi
  jne    L30
L136:
  mov    $0x1,%esi
  mov    $0x1000,%edi
  call   <calloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L59
  mov    $0x1,%esi
  mov    $0x1000,%edi
  call   <calloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L0
  mov    0x8(%rbx),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  mov    %r13,%rsi
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x1(%r13),%rbp
  lea    D31(%rip),%r14
  lea    D9(%rip),%r15
  jmp    L101
L30:
  mov    (%rsi),%rsi
  lea    D2(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  jmp    L136
L281:
  lea    D77(%rip),%rdi
  call   <puts@plt>
  jmp    L128
L73:
  cmpb   $0x2e,0x0(%rbp)
  je     L152
L213:
  mov    %rbp,%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x2,%esi
  mov    %r12,%rdi
  call   <strnlen@plt>
  cmp    $0x1,%eax
  jne    L204
L267:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    0x1(%rbx),%rbp
L101:
  mov    $0x2f,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L29
  cmpb   $0x0,0x0(%rbp)
  je     L144
  cmpb   $0x2f,0x1(%rbx)
  je     L281
  movb   $0x0,(%rbx)
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L73
  cmp    $0x2,%eax
  jne    L213
  mov    $0x2,%edx
  lea    D15(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L213
  cmpb   $0x0,(%r12)
  je     L14
  cmpb   $0x0,0x1(%r12)
  jne    L37
L14:
  lea    0x1(%rbx),%rbp
  jmp    L101
L152:
  lea    0x1(%rbx),%rbp
  jmp    L101
L37:
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strrchr@plt>
  cmp    %rax,%r12
  je     L48
  movb   $0x0,(%rax)
  jmp    L14
L48:
  movb   $0x0,0x1(%rax)
  jmp    L14
L204:
  mov    $0x1,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <strncat@plt>
  jmp    L267
L29:
  movzbl 0x0(%rbp),%eax
  test   %al,%al
  je     L144
  cmp    $0x2e,%al
  jne    L172
L144:
  cmpb   $0x0,(%r12)
  je     L10
L158:
  mov    %r12,%rsi
  lea    D36(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L128:
  mov    %r12,%rdi
  call   <free@plt>
L0:
  mov    %r13,%rdi
  call   <free@plt>
L59:
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L172:
  mov    $0x2,%esi
  mov    %r12,%rdi
  call   <strnlen@plt>
  cmp    $0x1,%eax
  jne    L132
L216:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  jmp    L144
L132:
  mov    $0x1,%edx
  lea    D9(%rip),%rsi
  mov    %r12,%rdi
  call   <strncat@plt>
  jmp    L216
L10:
  mov    $0x1,%edx
  lea    D9(%rip),%rsi
  mov    %r12,%rdi
  call   <strncat@plt>
  jmp    L158
```

tool_calls: name: parse_data
arguments: data_tag: D1
type: string
name: parse_data
arguments: data_tag: D31
type: string
name: parse_data
arguments: data_tag: D9
type: string
name: parse_data
arguments: data_tag: D2
type: string
name: parse_data
arguments: data_tag: D77
type: string
name: parse_data
arguments: data_tag: D15
type: string
name: parse_data
arguments: data_tag: D36
type: string

tool: D1:    ___________ old_path : %s _________


tool: D31: mid dir :%s


tool: D9: /

tool: D2: 	Usage: %s directory


tool: D77:  directory formt error! 

tool: D15: ..

tool: D36:    ___________ new_path : %s _________


assistant: ```c
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("	Usage: %s directory\n", argv[0]);
    exit(-1);
  }
  char *old_path = calloc(4096, 1);
  if (!old_path)
    goto out1;
  char *new_path = calloc(4096, 1);
  if (!new_path)
    goto out2;
  strcpy(old_path, argv[1]);
  printf("   ___________ old_path : %s _________\n", old_path);
  char *slash = NULL, *tmp_slash = NULL, *dir_start = old_path + 1;
  while ((slash = strchr(dir_start, '/')) != NULL && *dir_start != '\0') {
    if (*(slash + 1) == '/') {
      printf(" directory formt error! \n");
      goto out3;
    }
    *slash = '\0';
    int mid_dir_len = strlen(dir_start);
    if (mid_dir_len == 1 && *dir_start == '.') {
      dir_start = slash + 1;
    } else if (mid_dir_len == 2 && !strncmp(dir_start, "..", 2)) {
      if (*new_path != '\0' && *(new_path + 1) != '\0') {
        tmp_slash = strrchr(new_path, '/');
        if (new_path != tmp_slash)
          *tmp_slash = '\0';
        else
          *(tmp_slash + 1) = '\0';
      }
      dir_start = slash + 1;
    } else {
      printf("mid dir :%s\n", dir_start);
      if (strnlen(new_path, 2) != 1)
        strncat(new_path, "/", 1);
      strcat(new_path, dir_start);
      dir_start = slash + 1;
    }
  }
  if (*dir_start != '\0' && *dir_start != '.' && !slash) {
    if (strnlen(new_path, 2) != 1)
      strncat(new_path, "/", 1);
    strcat(new_path, dir_start);
  }
  if (*new_path == '\0') {
    strncat(new_path, "/", 1);
  }
  printf("   ___________ new_path : %s _________\n", new_path);
out3:
  free(new_path);
out2:
  free(old_path);
out1:
  return 0;
}
```