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

```asm
<int2key>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x3c(%rbp)
  cmpl   $0x0,-0x3c(%rbp)
  jne    L130
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rcx
  lea    D2(%rip),%rdx
  mov    %rax,%rdi
  call   <snprintf@plt>
  jmp    L34
L130:
  cmpl   $0x1,-0x3c(%rbp)
  jne    L200
  cmpq   $0x10,-0x30(%rbp)
  jbe    L73
  movq   $0x10,-0x30(%rbp)
L73:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <int2int@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <int2alphakey@plt>
  jmp    L34
L200:
  cmpl   $0x2,-0x3c(%rbp)
  jne    L0
  cmpq   $0x10,-0x30(%rbp)
  jbe    L29
  movq   $0x10,-0x30(%rbp)
L29:
  mov    $0x0,%eax
  call   <rc4rand@plt>
  cltq
  mov    $0x0,%edx
  divq   -0x30(%rbp)
  mov    %rdx,%rax
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L224
L72:
  mov    $0x0,%eax
  call   <rc4rand@plt>
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    %dl,(%rax)
  addl   $0x1,-0x18(%rbp)
L224:
  mov    -0x18(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L72
  mov    -0x4(%rbp),%eax
  cltq
  jmp    L34
L0:
  cmpl   $0x3,-0x3c(%rbp)
  jne    L122
  cmpq   $0x10,-0x30(%rbp)
  jbe    L152
  movq   $0x10,-0x30(%rbp)
L152:
  mov    $0x0,%eax
  call   <rc4rand@plt>
  cltq
  mov    $0x0,%edx
  divq   -0x30(%rbp)
  mov    %rdx,%rax
  mov    %eax,-0x8(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L100
L58:
  mov    $0x0,%eax
  call   <rc4rand@plt>
  movslq %eax,%rdx
  imul   $0xffffffff8d3dcb09,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x3a,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  lea    0x41(%rax),%ecx
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x14(%rbp)
L100:
  mov    -0x14(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jl     L58
  mov    -0x8(%rbp),%eax
  cltq
  jmp    L34
L122:
  cmpl   $0x4,-0x3c(%rbp)
  jne    L11
  cmpq   $0x10,-0x30(%rbp)
  jbe    L127
  movq   $0x10,-0x30(%rbp)
L127:
  mov    $0x0,%eax
  call   <rc4rand@plt>
  cltq
  mov    $0x0,%edx
  divq   -0x30(%rbp)
  mov    %rdx,%rax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L105
L39:
  mov    $0x0,%eax
  call   <rc4rand@plt>
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  lea    0x41(%rax),%ecx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x10(%rbp)
L105:
  mov    -0x10(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L39
  mov    -0xc(%rbp),%eax
  cltq
  jmp    L34
L11:
  cmpl   $0x5,-0x3c(%rbp)
  jne    L197
  mov    -0x38(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jbe    L174
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x38(%rbp)
L174:
  mov    -0x38(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    $0x41,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x38(%rbp),%rax
  jmp    L34
L197:
  mov    $0x0,%eax
L34:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D2
data_type: string

tool: D2: %lu

assistant: ```c
size_t int2key(char *s, size_t maxlen, uint32_t i, int mode) {
  if (mode == 0) {
    return snprintf(s, maxlen, "%lu", (unsigned long)i);
  } else if (mode == 1) {
    if (maxlen > 16)
      maxlen = 16;
    i = int2int(i);
    return int2alphakey(s, maxlen, i);
  } else if (mode == 2) {
    if (maxlen > 16)
      maxlen = 16;
    int r = rc4rand() % maxlen;
    for (int i = 0; i < r; i++)
      s[i] = rc4rand() & 0xff;
    return r;
  } else if (mode == 3) {
    if (maxlen > 16)
      maxlen = 16;
    int r = rc4rand() % maxlen;
    for (int i = 0; i < r; i++)
      s[i] = 'A' + rc4rand() % ('z' - 'A' + 1);
    return r;
  } else if (mode == 4) {
    if (maxlen > 16)
      maxlen = 16;
    int r = rc4rand() % maxlen;
    for (int i = 0; i < r; i++)
      s[i] = 'A' + rc4rand() % 4;
    return r;
  } else if (mode == 5) {
    if (i > maxlen)
      i = maxlen;
    memset(s, 'A', i);
    return i;
  } else {
    return 0;
  }
}
```