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

```asm
<disable_prefetch_nhm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  cmpl   $0xffffffff,-0x24(%rbp)
  jne    L41
  movl   $0x0,-0x14(%rbp)
  movl   $0x400,-0x10(%rbp)
  jmp    L169
L41:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x10(%rbp)
L169:
  mov    -0x14(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L129
L36:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <open_msr@plt>
  mov    %eax,-0x8(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  js     L112
  mov    -0x8(%rbp),%eax
  mov    $0x1a4,%esi
  mov    %eax,%edi
  call   <read_msr@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L109
  mov    $0x4e,%edi
  jmp    L39
L109:
  mov    $0x59,%edi
L39:
  mov    -0x4(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L116
  mov    $0x4e,%esi
  jmp    L12
L116:
  mov    $0x59,%esi
L12:
  mov    -0x4(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L161
  mov    $0x4e,%ecx
  jmp    L157
L161:
  mov    $0x59,%ecx
L157:
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L178
  mov    $0x4e,%edx
  jmp    L73
L178:
  mov    $0x59,%edx
L73:
  mov    -0xc(%rbp),%eax
  mov    %edi,%r9d
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x8(%rbp),%eax
  mov    $0xf,%edx
  mov    $0x1a4,%esi
  mov    %eax,%edi
  call   <write_msr@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  mov    $0x1a4,%esi
  mov    %eax,%edi
  call   <read_msr@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L11
  mov    $0x4e,%edi
  jmp    L205
L11:
  mov    $0x59,%edi
L205:
  mov    -0x4(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L93
  mov    $0x4e,%esi
  jmp    L188
L93:
  mov    $0x59,%esi
L188:
  mov    -0x4(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L14
  mov    $0x4e,%ecx
  jmp    L59
L14:
  mov    $0x59,%ecx
L59:
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L16
  mov    $0x4e,%edx
  jmp    L5
L16:
  mov    $0x59,%edx
L5:
  mov    -0xc(%rbp),%eax
  mov    %edi,%r9d
  mov    %esi,%r8d
  mov    %eax,%esi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  addl   $0x1,-0xc(%rbp)
L129:
  mov    -0xc(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jle    L36
  jmp    L136
L112:
  nop
L136:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D13
type: string
name: extract_symbolic_data
arguments: tag: D2
type: string
name: extract_symbolic_data
arguments: tag: D7
type: string

tool: D13: Disable all prefetch

tool: D2: 	Core %d old : L2HW=%c L2ADJ=%c DCU=%c DCUIP=%c


tool: D7: 	Core %d new : L2HW=%c L2ADJ=%c DCU=%c DCUIP=%c


assistant: ```c
int disable_prefetch_nhm(int core) {
  int fd;
  int result;
  int begin, end, c;
  printf("Disable all prefetch\n");
  if (core == -1) {
    begin = 0;
    end = 1024;
  } else {
    begin = core;
    end = core;
  }
  for (c = begin; c <= end; c++) {
    fd = open_msr(c);
    if (fd < 0)
      break;
    result = read_msr(fd, 0x1a4);
    printf("\tCore %d old : L2HW=%c L2ADJ=%c DCU=%c DCUIP=%c\n", c, result & 0x1 ? 'N' : 'Y', result & 0x2 ? 'N' : 'Y', result & 0x4 ? 'N' : 'Y', result & 0x8 ? 'N' : 'Y');
    result = write_msr(fd, 0x1a4, 0xf);
    result = read_msr(fd, 0x1a4);
    printf("\tCore %d new : L2HW=%c L2ADJ=%c DCU=%c DCUIP=%c\n", c, result & 0x1 ? 'N' : 'Y', result & 0x2 ? 'N' : 'Y', result & 0x4 ? 'N' : 'Y', result & 0x8 ? 'N' : 'Y');
    close(fd);
  }
  return 0;
}
```