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

```asm
<CPU_old>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x18(%rsp)
  mov    $0x1,%r13d
  mov    $0x0,%r12d
  lea    D32(%rip),%r15
  lea    D42(%rip),%r14
  jmp    L57
L91:
  mov    0x4(%rsp),%edi
  call   <read_ram@plt>
  mov    %eax,0xc(%rsp)
  mov    %r13d,%r12d
  jmp    L111
  mov    %r13d,%r12d
  jmp    L111
  mov    0x4(%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <write_ram@plt>
  mov    %r13d,%r12d
L111:
  lea    0x1(%r12),%r13d
  cmp    $0x63,%r12d
  jg     L29
L57:
  mov    0x18(%rsp),%edx
  mov    %r13d,%esi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%edi
  mov    %edi,%esi
  call   <show_ram@plt>
  mov    0x18(%rsp),%ebx
  lea    0x18(%rsp),%rdi
  call   <increment_PC@plt>
  mov    %ebx,%edi
  call   <fetch_instruction@plt>
  mov    %eax,%ebx
  mov    $0x14,%edx
  mov    $0xf00000,%esi
  mov    %eax,%edi
  call   <decode@plt>
  mov    %eax,%ebp
  mov    $0x10,%edx
  mov    $0x30000,%esi
  mov    %ebx,%edi
  call   <decode@plt>
  mov    %eax,0x8(%rsp)
  mov    $0x0,%edx
  mov    $0xffff,%esi
  mov    %ebx,%edi
  call   <decode@plt>
  mov    %eax,0x4(%rsp)
  mov    $0x12,%edx
  mov    $0x40000,%esi
  mov    %ebx,%edi
  call   <decode@plt>
  mov    %eax,%ebx
  cmp    $0x1,%ebp
  je     L91
  cmp    $0xf,%ebp
  ja     L40
  mov    %ebp,%ebp
  movslq (%r14,%rbp,4),%rax
  add    %r14,%rax
  notrack jmp *%rax
  addl   $0x1,0xc(%rsp)
  mov    %r13d,%r12d
  jmp    L111
  mov    0xc(%rsp),%esi
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r13d,%r12d
  jmp    L111
  mov    0x4(%rsp),%eax
  mov    %eax,0x18(%rsp)
  mov    %r13d,%r12d
  jmp    L111
  mov    0x18(%rsp),%esi
  lea    D2(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L29:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L83
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L40:
  mov    0x4(%rsp),%edi
  call   <read_ram@plt>
  mov    %eax,%ebp
  lea    D20(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0xc(%rsp),%r13d
  mov    %r13d,%edi
  call   <hex32@plt>
  lea    D10(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %ebp,%edi
  call   <hex32@plt>
  sub    $0x8,%rsp
  lea    0x28(%rsp),%rax
  push   %rax
  lea    0x34(%rsp),%r9
  lea    0x2c(%rsp),%r8
  mov    %ebx,%ecx
  mov    0x18(%rsp),%edx
  mov    %ebp,%esi
  mov    %r13d,%edi
  call   <ALU@plt>
  mov    %eax,0x1c(%rsp)
  add    $0x2,%r12d
  add    $0x10,%rsp
  jmp    L111
  mov    %r13d,%r12d
  mov    0x4(%rsp),%eax
  mov    %eax,0xc(%rsp)
  jmp    L111
L83:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D32
type_guessed: string
name: read_data
arguments: tag: D7
type_guessed: string
name: read_data
arguments: tag: D2
type_guessed: string
name: read_data
arguments: tag: D20
type_guessed: string
name: read_data
arguments: tag: D10
type_guessed: string

tool: D32: Clock Cycle: %d	PC: %d


tool: D7: Syscall output: %d


tool: D2: Program Halted execution at PC: %d


tool: D20: A_reg: 

tool: D10: B_reg: 

assistant: ```c
void CPU_old() {
  int instruction;
  int PC;
  int MAR;
  int DRR;
  int A;
  int opcodes, address, Binvert, cpu_codes;
  int carryOut;
  int overflow;
  int zr;
  int op_shift = 16, address_shift = 0, Binvert_shift = 18, CPUcodes_shift = 20;
  int mask_CPUcodes = 0x00f00000;
  int mask_opcodes = 0x00030000;
  int mask_Binvert = 0x00040000;
  int mask_address = 0x0000ffff;
  PC = 0;
  int clock_counter = 0;
  while ((clock_counter++) < 100) {
    printf("Clock Cycle: %d\tPC: %d\n", clock_counter, PC);
    show_ram(PC, PC);
    MAR = PC;
    increment_PC(&PC);
    instruction = fetch_instruction(MAR);
    cpu_codes = decode(instruction, mask_CPUcodes, CPUcodes_shift);
    opcodes = decode(instruction, mask_opcodes, op_shift);
    address = decode(instruction, mask_address, address_shift);
    Binvert = decode(instruction, mask_Binvert, Binvert_shift);
    if (cpu_codes == 1) {
      A = read_ram(address);
      continue;
    } else if (cpu_codes == 2) {
      A = address;
      continue;
    } else if (cpu_codes == 3) {
      write_ram(A, address);
      continue;
    } else if (cpu_codes == 4) {
      A += 1;
      continue;
    } else if (cpu_codes == 12) {
      printf("Syscall output: %d\n", A);
      continue;
    } else if (cpu_codes == 13) {
      PC = address;
      continue;
    } else if (cpu_codes == 14) {
      continue;
    } else if (cpu_codes == 15) {
      printf("Program Halted execution at PC: %d\n", PC);
      return;
    }
    DRR = read_ram(address);
    printf("A_reg: ");
    hex32(A);
    printf("B_reg: ");
    hex32(DRR);
    A = ALU(A, DRR, opcodes, Binvert, &carryOut, &zr, &overflow);
    clock_counter++;
  }
}
```