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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  cmpl   $0x2,-0x34(%rbp)
  je     L27
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D89(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
L27:
  mov    $0x1,%esi
  mov    $0x1000,%edi
  call   <calloc@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L239
  mov    $0x1,%esi
  mov    $0x1000,%edi
  call   <calloc@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L112
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  jmp    L201
L213:
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L259
  lea    D31(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L185
L259:
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x1,-0x2c(%rbp)
  jne    L206
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L206
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  jmp    L201
L206:
  cmpl   $0x2,-0x2c(%rbp)
  jne    L200
  mov    -0x28(%rbp),%rax
  mov    $0x2,%edx
  lea    D18(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L200
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L257
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L257
  mov    -0x18(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  je     L203
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L257
L203:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
L257:
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  jmp    L201
L200:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D57(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x18(%rbp),%rax
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <strnlen@plt>
  cmp    $0x1,%eax
  je     L214
  mov    -0x18(%rbp),%rax
  mov    $0x1,%edx
  lea    D71(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
L214:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x28(%rbp)
L201:
  mov    -0x28(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L219
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L213
L219:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L198
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L198
  cmpq   $0x0,-0x10(%rbp)
  jne    L198
  mov    -0x18(%rbp),%rax
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <strnlen@plt>
  cmp    $0x1,%eax
  je     L223
  mov    -0x18(%rbp),%rax
  mov    $0x1,%edx
  lea    D71(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
L223:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
L198:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L145
  mov    -0x18(%rbp),%rax
  mov    $0x1,%edx
  lea    D71(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
L145:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D76(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L185:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L249
L112:
  nop
L249:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L34
L239:
  nop
L34:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D89
type_guessed: string
name: parse_data
arguments: tag: D19
type_guessed: string
name: parse_data
arguments: tag: D31
type_guessed: string
name: parse_data
arguments: tag: D18
type_guessed: string
name: parse_data
arguments: tag: D57
type_guessed: string
name: parse_data
arguments: tag: D71
type_guessed: string
name: parse_data
arguments: tag: D76
type_guessed: string

tool: D89: 	Usage: %s directory


tool: D19:    ___________ old_path : %s _________


tool: D31:  directory formt error! 

tool: D18: ..

tool: D57: mid dir :%s


tool: D71: /

tool: D76:    ___________ 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;
}
```