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

```asm
<gen_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,-0x38(%rbp)
  mov    -0x38(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  cmpl   $0x2,-0x34(%rbp)
  je     L44
  cmpl   $0x2,-0x34(%rbp)
  jg     L63
  cmpl   $0x0,-0x34(%rbp)
  je     L122
  cmpl   $0x1,-0x34(%rbp)
  je     L58
  jmp    L63
L122:
  lea    D18(%rip),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L105
L90:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%ebx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%esi
  mov    %ebx,%eax
  cltd
  idiv   %esi
  mov    %edx,%ecx
  mov    %ecx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x28(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x28(%rbp)
L105:
  mov    -0x28(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L90
  jmp    L15
L58:
  lea    D16(%rip),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L87
L60:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%ebx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ecx
  mov    %ebx,%eax
  cltd
  idiv   %ecx
  mov    %edx,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x29(%rbp)
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x29(%rbp),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x28(%rbp)
L87:
  mov    -0x28(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L60
  jmp    L15
L44:
  movl   $0x0,-0x28(%rbp)
  jmp    L81
L110:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x28(%rbp)
L81:
  mov    -0x28(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L110
L63:
  nop
L15:
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D18
type_infered: string
name: unpack_data
arguments: data_label: D16
type_infered: string

tool: D18: ABCDEFGHIJKLMNOPQRSTUVWXYZ

tool: D16: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

assistant: ```c
char *gen_data(int scope, int size) {
  char *charset, *buf;
  unsigned char byte;
  int num;
  int i;
  buf = malloc(size);
  memset(buf, 0, size);
  switch (scope) {
  case 0:
    charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for (i = 0; i < size; i++) {
      buf[i] = charset[rand() % strlen(charset)];
    }
    break;
  case 1:
    charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    for (i = 0; i < size; i++) {
      num = rand() % strlen(charset);
      byte = charset[num];
      if (0)
        printf("DEBUG: random byte[%d] = %d %02X\n", i, num, byte);
      buf[i] = byte;
    }
    break;
  case 2:
    for (i = 0; i < size; i++) {
      buf[i] = rand() % 256;
    }
  default:
    break;
  }
  return buf;
}
```