user: Converte this assembly snippet into its equivalent C code:

```asm
<_hash_sha1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,%r15
  mov    %rsi,%rbx
  mov    %edx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  movl   $0x61687324,0x9(%rsp)
  movw   $0x2431,0xd(%rsp)
  movb   $0x0,0xf(%rsp)
  movabs $0x2a29282726252221,%rax
  movabs $0x4342412f2e2d2c2b,%rdx
  mov    %rax,0x10(%rsp)
  mov    %rdx,0x18(%rsp)
  movabs $0x4b4a494847464544,%rax
  movabs $0x535251504f4e4d4c,%rdx
  mov    %rax,0x20(%rsp)
  mov    %rdx,0x28(%rsp)
  movabs $0x615a595857565554,%rax
  movabs $0x6968676665646362,%rdx
  mov    %rax,0x30(%rsp)
  mov    %rdx,0x38(%rsp)
  movabs $0x71706f6e6d6c6b6a,%rax
  movabs $0x7978777675747372,%rdx
  mov    %rax,0x40(%rsp)
  mov    %rdx,0x48(%rsp)
  movabs $0x363534333231307a,%rax
  movabs $0x3e3d3c3b3a393837,%rdx
  mov    %rax,0x50(%rsp)
  mov    %rdx,0x58(%rsp)
  movabs $0x605f5e5d5c5b403f,%rax
  mov    %rax,0x60(%rsp)
  movb   $0x0,0x68(%rsp)
  test   %ebp,%ebp
  jle    L73
L7:
  mov    $0x0,%r13d
  test   %rbx,%rbx
  je     L67
L105:
  mov    %rbx,%rdi
  call   <strlen@plt>
  movslq %eax,%r14
  add    $0x13,%r14
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L109
  lea    0x9(%rsp),%rcx
  sub    $0x8,%rsp
  push   %rbx
  mov    $0x24,%r9d
  mov    %ebp,%r8d
  lea    D30(%rip),%rdx
  mov    %r14,%rsi
  mov    %rax,%rdi
  call   <snprintf@plt>
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <crypt@plt>
  mov    %rax,%rbx
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  add    $0x10,%rsp
  test   %rbx,%rbx
  je     L98
  mov    %rbx,%rdi
  call   <strdup@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L20
L117:
  mov    0x78(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  mov    %rbx,%rax
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L73:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0xe,%edx
  lea    (%rax,%rdx,1),%ebp
  and    $0x3ffff,%ebp
  sub    %edx,%ebp
  jmp    L7
L67:
  lea    0x10(%rsp),%rdi
  mov    $0x40,%edx
  mov    $0x8,%esi
  call   <_makepasswd_password@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L117
  mov    %rax,%r13
  jmp    L105
L109:
  mov    $0x1,%esi
  lea    D6(%rip),%rdi
  call   <_error@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r12,%rbx
  jmp    L117
L98:
  mov    $0x1,%esi
  lea    D31(%rip),%rdi
  call   <_error@plt>
  jmp    L117
L20:
  mov    $0x1,%esi
  lea    D6(%rip),%rdi
  call   <_error@plt>
  jmp    L117
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D30
datatype: string
name: unpack_data
arguments: label: D6
datatype: string
name: unpack_data
arguments: label: D31
datatype: string

tool: D30: %s%u%c%s

tool: D6: malloc

tool: D31: crypt

assistant: ```c
char *_hash_sha1(char const *password, char const *salt, int iterations) {
  const char prefix[] = "$sha1$";
  const char characters[] = "!\"%&'()*+,-./ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                            "abcdefghijklmnopqrstuvwxyz0123456789:;<=>?@[\\]^_`";
  char *ret;
  char *p = NULL;
  size_t len;
  char *s;
  if (iterations <= 0)
    iterations = rand() % (1 << 18);
  if (salt == NULL) {
    if ((p = _makepasswd_password(characters, 8, 64)) == NULL)
      return NULL;
    salt = p;
  }
  len = sizeof(prefix) + 11 + strlen(salt) + 1;
  if ((s = malloc(len)) == NULL) {
    _error("malloc", 1);
    free(p);
    return NULL;
  }
  snprintf(s, len, "%s%u%c%s", prefix, iterations, '$', salt);
  ret = crypt(password, s);
  free(p);
  free(s);
  if (ret == NULL)
    _error("crypt", 1);
  else if ((ret = strdup(ret)) == NULL)
    _error("malloc", 1);
  return ret;
}
```