user: Translate the below assembly code into C programming language:

```asm
<process_select_module>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  movslq %edi,%rbp
  lea    D77(%rip),%rdi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x10,%rsp
  call   <puts@plt>
  cmp    %r12d,%ebp
  jge    L1
  mov    (%rbx,%rbp,8),%rdi
  mov    $0x10,%edx
  xor    %esi,%esi
  call   <strtoul@plt>
  mov    %rax,%rbp
  cmp    $0xf,%rax
  ja     L24
  mov    $0xffffffff,%edx
  mov    $0x1,%esi
  mov    $0x1,%edi
  call   <crc32@plt>
  mov    %ebp,%edi
  mov    $0x4,%esi
  mov    %eax,%edx
  call   <crc32@plt>
  mov    %rbp,%rdi
  mov    $0x4,%esi
  mov    %rax,%r12
  call   <reverse_bits@plt>
  mov    %r12,%rdi
  mov    $0x20,%esi
  mov    %rax,%rbx
  call   <reverse_bits@plt>
  mov    $0xa,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L9
  xor    %esi,%esi
  mov    $0xa,%edx
  mov    %rax,%rdi
  call   <memset@plt>
  mov    %r12d,%edx
  lea    (%rbx,%rbx,1),%eax
  mov    %rbp,%rsi
  shl    $0x5,%edx
  lea    D94(%rip),%rdi
  or     %edx,%eax
  mov    $0xa,%edx
  or     $0x1,%eax
  mov    %al,0x0(%rbp)
  mov    %r12,%rax
  shr    $0x3,%rax
  mov    %al,0x1(%rbp)
  mov    %r12,%rax
  shr    $0xb,%rax
  mov    %al,0x2(%rbp)
  mov    %r12,%rax
  shr    $0x1b,%r12
  shr    $0x13,%rax
  mov    %r12b,0x4(%rbp)
  mov    %al,0x3(%rbp)
  call   <dump_jreg@plt>
  mov    $0x49,%esi
  mov    %rbp,%rdi
  call   <or1ksim_jtag_shift_dr@plt>
  mov    $0xa,%edx
  mov    %rbp,%rsi
  lea    D0(%rip),%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <dump_jreg@plt>
  movzbl 0x5(%rbp),%eax
  movzbl 0x6(%rbp),%r12d
  mov    $0x4,%esi
  mov    %eax,%edx
  shl    $0x7,%r12
  lea    0x0(,%rax,8),%edi
  shr    %dl
  movzbl %dl,%edx
  or     %rdx,%r12
  movzbl 0x7(%rbp),%edx
  shl    $0xf,%rdx
  or     %rdx,%r12
  movzbl 0x8(%rbp),%edx
  shl    $0x17,%rdx
  or     %rdx,%r12
  movzbl 0x9(%rbp),%edx
  shl    $0x1f,%rdx
  or     %rdx,%r12
  movzbl 0x4(%rbp),%edx
  shr    $0x5,%dl
  or     %edx,%edi
  and    $0xf,%edi
  call   <reverse_bits@plt>
  mov    %r12,%rdi
  mov    $0x20,%esi
  mov    %rax,%rbx
  call   <reverse_bits@plt>
  movzbl %bl,%r12d
  mov    $0xffffffff,%edx
  mov    $0x4,%esi
  mov    %r12d,%edi
  mov    %rax,%r14
  call   <crc32@plt>
  mov    %r12d,%esi
  lea    D15(%rip),%rdi
  mov    %rax,%r13
  xor    %eax,%eax
  call   <printf@plt>
  cmp    %r13,%r14
  movsd  0x8(%rsp),%xmm0
  jne    L27
L54:
  lea    D81(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  add    $0x10,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L24:
  mov    %rax,%rsi
  lea    D101(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
L10:
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L1:
  lea    D40(%rip),%rdi
  call   <puts@plt>
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L27:
  lea    D52(%rip),%rdi
  call   <puts@plt>
  mov    %r14,%rsi
  lea    D39(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r13,%rsi
  lea    D38(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  0x8(%rsp),%xmm0
  jmp    L54
  nopl   0x0(%rax)
L9:
  lea    D87(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  jmp    L10
```

tool_calls: name: read_data
arguments: label: D77
type: string
name: read_data
arguments: label: D94
type: string
name: read_data
arguments: label: D0
type: string
name: read_data
arguments: label: D15
type: string
name: read_data
arguments: label: D81
type: string
name: read_data
arguments: label: D101
type: string
name: read_data
arguments: label: D40
type: string
name: read_data
arguments: label: D52
type: string
name: read_data
arguments: label: D39
type: string
name: read_data
arguments: label: D38
type: string
name: read_data
arguments: label: D87
type: string

tool: D77: Selecting module.

tool: D94:   shifting in

tool: D0:   shifted out

tool: D15:   status:       0x%01x


tool: D81:   time taken:   %.12fs


tool: D101: ERROR: module value 0x%lx too large


tool: D40: ERROR: no module specified.

tool: D52:   CRC mismatch

tool: D39:     CRC out:      0x%08lx


tool: D38:     CRC computed: 0x%08lx


tool: D87: ERROR: malloc for SELECT_MODULE register failed.

assistant: ```c
int process_select_module(int next_jreg, int argc, char *argv[]) {
  printf("Selecting module.\n");
  if (next_jreg >= argc) {
    printf("ERROR: no module specified.\n");
    return 0;
  }
  unsigned long int module_id = strtoul(argv[next_jreg], NULL, 16);
  if (module_id > 0xf) {
    printf("ERROR: module value 0x%lx too large\n", module_id);
    return 0;
  }
  unsigned long int crc_in;
  crc_in = crc32(1, 1, 0xffffffff);
  crc_in = crc32(module_id, 4, crc_in);
  module_id = reverse_bits(module_id, 4);
  crc_in = reverse_bits(crc_in, 32);
  int num_bytes = 10;
  unsigned char *jreg = malloc(num_bytes);
  if (NULL == jreg) {
    printf("ERROR: malloc for SELECT_MODULE register failed.\n");
    return 0;
  }
  memset(jreg, 0, num_bytes);
  jreg[0] = 0x01;
  jreg[0] |= module_id << 1;
  jreg[0] |= crc_in << 5;
  jreg[1] = crc_in >> 3;
  jreg[2] = crc_in >> 11;
  jreg[3] = crc_in >> 19;
  jreg[4] = crc_in >> 27;
  dump_jreg("  shifting in", jreg, num_bytes);
  double t = or1ksim_jtag_shift_dr(jreg, 32 + 4 + 32 + 4 + 1);
  dump_jreg("  shifted out", jreg, num_bytes);
  unsigned char status;
  unsigned long int crc_out;
  status = ((jreg[4] >> 5) | (jreg[5] << 3)) & 0xf;
  crc_out = ((unsigned long int)jreg[5] >> 1) | ((unsigned long int)jreg[6] << 7) | ((unsigned long int)jreg[7] << 15) | ((unsigned long int)jreg[8] << 23) | ((unsigned long int)jreg[9] << 31);
  status = reverse_bits(status, 4);
  crc_out = reverse_bits(crc_out, 32);
  unsigned long int crc_computed = crc32(status, 4, 0xffffffff);
  printf("  status:       0x%01x\n", status);
  if (crc_out != crc_computed) {
    printf("  CRC mismatch\n");
    printf("    CRC out:      0x%08lx\n", crc_out);
    printf("    CRC computed: 0x%08lx\n", crc_computed);
  }
  printf("  time taken:   %.12fs\n", t);
  free(jreg);
  return 1;
}
```