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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x818,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x808(%rsp)
  xor    %eax,%eax
  cmp    $0x3,%edi
  jle    L57
  mov    0x8(%rsi),%r14
  mov    0x10(%rsi),%r13
  mov    0x18(%rsi),%r12
  cmp    $0x5,%edi
  je     L51
  lea    D64(%rip),%rdi
  mov    %rsp,%rbp
  lea    0x400(%rsp),%rbx
  call   <getpass@plt>
  mov    %rbp,%rdi
  mov    %rax,%rsi
  call   <strcpy@plt>
  lea    D60(%rip),%rdi
  call   <getpass@plt>
  mov    %rbx,%rdi
  mov    %rax,%r15
  mov    %rax,%rsi
  call   <strcpy@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  xor    %esi,%esi
  mov    %r15,%rdi
  mov    %eax,%edx
  call   <memset@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L13
L0:
  mov    %rbp,%rsi
  mov    %rbp,%rdi
  call   <crypt@plt>
  lea    D5(%rip),%rsi
  mov    %r14,%rdi
  mov    %rax,%r15
  call   <fopen@plt>
  mov    %r15,%r8
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rax,%rbp
  lea    D81(%rip),%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
L58:
  mov    0x808(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L29
  add    $0x818,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L51:
  mov    %rsp,%rbp
  mov    0x20(%rsi),%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  jmp    L0
L57:
  lea    D44(%rip),%rdi
  call   <printf@plt>
  lea    D54(%rip),%rdi
  call   <printf@plt>
  lea    D51(%rip),%rdi
  call   <printf@plt>
  lea    D76(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L58
L13:
  lea    D23(%rip),%rdi
  call   <printf@plt>
  mov    $0x2,%eax
  jmp    L58
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D64
type: string
name: extract_symbolic_data
arguments: label: D60
type: string
name: extract_symbolic_data
arguments: label: D5
type: string
name: extract_symbolic_data
arguments: label: D81
type: string
name: extract_symbolic_data
arguments: label: D44
type: string
name: extract_symbolic_data
arguments: label: D54
type: string
name: extract_symbolic_data
arguments: label: D51
type: string
name: extract_symbolic_data
arguments: label: D76
type: string
name: extract_symbolic_data
arguments: label: D23
type: string

tool: D64: Password: 

tool: D60: Password (again): 

tool: D5: a

tool: D81: %s:%s:%s


tool: D44: Usage:



tool: D54: htdigest passwordfile realm username


tool: D51: htdigest passwordfile realm username password



tool: D76: Creates or updates an Apache/nginx compatible htdigest file


tool: D23: Passwords did not match


assistant: ```c
int main(int argc, char **argv) {
  char password_first[1024], password_repeat[1024];
  char *input, *passwordfile, *username, *realm, *encrypted;
  FILE *htpasswd_file;
  if (argc < 4) {
    printf("Usage:\n\n");
    printf("htdigest passwordfile realm username\n");
    printf("htdigest passwordfile realm username password\n\n");
    printf("Creates or updates an Apache/nginx compatible htdigest file\n");
    return 1;
  }
  passwordfile = argv[1];
  realm = argv[2];
  username = argv[3];
  if (argc != 5) {
    input = getpass("Password: ");
    strcpy(password_first, input);
    input = getpass("Password (again): ");
    strcpy(password_repeat, input);
    memset(input, 0, strlen(input));
    int password_compare = strcmp(password_first, password_repeat);
    if (password_compare != 0) {
      printf("Passwords did not match\n");
      return 2;
    }
  } else {
    strcpy(password_first, argv[4]);
  }
  encrypted = (char *)crypt(password_first, password_first);
  htpasswd_file = fopen(passwordfile, "a");
  fprintf(htpasswd_file, "%s:%s:%s\n", username, realm, encrypted);
  fclose(htpasswd_file);
  return 0;
}
```