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

```asm
<string_to_key>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <Getc@plt>
  mov    %rax,%rbx
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <Getc@plt>
  cmp    $0x2,%ebx
  je     L177
  mov    %eax,%ebp
  jle    L51
  cmp    $0x3,%ebx
  je     L16
  cmp    $0x65,%ebx
  jne    L132
  lea    0x4(%rsp),%r12
  lea    0x8(%rsp),%rbp
  mov    %r12,%rbx
L134:
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <Getc@plt>
  mov    %al,-0x1(%rbx)
  cmp    %rbp,%rbx
  jne    L134
  mov    $0x3,%edx
  lea    D96(%rip),%rsi
  mov    %r12,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jne    L6
  movsbl 0x7(%rsp),%eax
  lea    0x3e8(%rax),%esi
  cmp    $0x1,%eax
  je     L168
  cmp    $0x3ea,%esi
  je     L75
  lea    D56(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L171:
  xor    %r12d,%r12d
  jmp    L149
L51:
  test   %ebx,%ebx
  je     L107
  cmp    $0x1,%ebx
  jne    L132
  mov    $0x1,%esi
  lea    D50(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  mov    %ebp,%edi
  call   <hash_algs@plt>
  lea    D95(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x8,%edi
  call   <dump@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  nopl   0x0(%rax,%rax,1)
L149:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L106
  add    $0x10,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L107:
  xor    %esi,%esi
  lea    D89(%rip),%rdi
  xor    %eax,%eax
  mov    $0x1,%r12d
  call   <printf@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  mov    %ebp,%edi
  call   <hash_algs@plt>
  jmp    L149
  nopl   0x0(%rax)
L177:
  mov    $0x2,%esi
  lea    D60(%rip),%rdi
  xor    %eax,%eax
  mov    $0x1,%r12d
  call   <printf@plt>
  jmp    L149
  nopl   0x0(%rax,%rax,1)
L16:
  mov    $0x3,%esi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  mov    $0x1,%r12d
  call   <printf@plt>
  mov    $0x9,%edi
  call   <putchar@plt>
  mov    %ebp,%edi
  call   <hash_algs@plt>
  lea    D95(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x8,%edi
  call   <dump@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  xor    %eax,%eax
  call   <Getc@plt>
  lea    D20(%rip),%rdi
  mov    %eax,%esi
  mov    %eax,%edx
  sar    $0x4,%eax
  and    $0xf,%esi
  lea    0x6(%rax),%ecx
  xor    %eax,%eax
  add    $0x10,%esi
  shl    %cl,%esi
  call   <printf@plt>
  jmp    L149
L132:
  mov    %r12d,%esi
  lea    D93(%rip),%rdi
  xor    %eax,%eax
  mov    $0x1,%r12d
  call   <printf@plt>
  jmp    L149
  nopl   0x0(%rax)
L6:
  mov    $0x65,%esi
  lea    D11(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L171
L168:
  mov    $0x3e9,%esi
  lea    D9(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L171
  nopl   0x0(%rax,%rax,1)
L75:
  xor    %eax,%eax
  call   <Getc@plt>
  mov    $0x3ea,%esi
  lea    D2(%rip),%rdi
  mov    %rax,%rbx
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebx,%edi
  call   <dump@plt>
  lea    D85(%rip),%rdi
  call   <puts@plt>
  jmp    L171
L106:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D96
data_type: string
name: parse_data
arguments: data_label: D56
data_type: string
name: parse_data
arguments: data_label: D50
data_type: string
name: parse_data
arguments: data_label: D95
data_type: string
name: parse_data
arguments: data_label: D89
data_type: string
name: parse_data
arguments: data_label: D60
data_type: string
name: parse_data
arguments: data_label: D40
data_type: string
name: parse_data
arguments: data_label: D20
data_type: string
name: parse_data
arguments: data_label: D93
data_type: string
name: parse_data
arguments: data_label: D11
data_type: string
name: parse_data
arguments: data_label: D9
data_type: string
name: parse_data
arguments: data_label: D2
data_type: string
name: parse_data
arguments: data_label: D85
data_type: string

tool: D96: GNU

tool: D56: 	GnuPG unknown extension (s2k %d)


tool: D50: 	Salted string-to-key(s2k %d):


tool: D95: 		Salt - 

tool: D89: 	Simple string-to-key(s2k %d):


tool: D60: 	Reserved string-to-key(s2k %d)


tool: D40: 	Iterated and salted string-to-key(s2k %d):


tool: D20: 		Count - %d(coded count %d)


tool: D93: 	Unknown string-to-key(s2k %d)


tool: D11: 	Private/experimental string-to-key(s2k %d)


tool: D9: 	GnuPG gnu-dummy (s2k %d)


tool: D2: 	GnuPG gnu-divert-to-card (s2k %d)
	Serial Number: 

tool: 

assistant: ```c
extern int string_to_key(void) {
  int has_iv = 1;
  int type = Getc();
  int hash = Getc();
  switch (type) {
  case 0:
    printf("\tSimple string-to-key(s2k %d):\n", type);
    printf("\t");
    hash_algs(hash);
    break;
  case 1:
    printf("\tSalted string-to-key(s2k %d):\n", type);
    printf("\t");
    hash_algs(hash);
    printf("\t\tSalt - ");
    dump(8);
    printf("\n");
    break;
  case 2:
    printf("\tReserved string-to-key(s2k %d)\n", type);
    break;
  case 3:
    printf("\tIterated and salted string-to-key(s2k %d):\n", type);
    printf("\t");
    hash_algs(hash);
    printf("\t\tSalt - ");
    dump(8);
    printf("\n");
    {
      int count, c = Getc();
      count = (16 + (c & 15)) << ((c >> 4) + 6);
      printf("\t\tCount - %d(coded count %d)\n", count, c);
    }
    break;
  case 101:
    has_iv = 0;
    {
      char temp[4];
      int j, snlen;
      for (j = 0; j < 4; j++)
        temp[j] = Getc();
      if (!memcmp(temp, "GNU", 3)) {
        type = 1000 + temp[3];
        switch (type) {
        case 1001:
          printf("\tGnuPG gnu-dummy (s2k %d)\n", type);
          break;
        case 1002:
          snlen = Getc();
          printf("\tGnuPG gnu-divert-to-card (s2k %d)\n\tSerial Number: ", type);
          dump(snlen);
          puts("");
          break;
        default:
          printf("\tGnuPG unknown extension (s2k %d)\n", type);
          break;
        }
      } else {
        printf("\tPrivate/experimental string-to-key(s2k %d)\n", type);
      }
    }
    break;
  default:
    printf("\tUnknown string-to-key(s2k %d)\n", type);
  }
  return has_iv;
}
```