user: 请从给定的汇编指令推导出C源代码:

```asm
<nvram_probe>:
  endbr64
  push   %r15
  mov    $0xffffffa5,%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  mov    $0x1,%edi
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x18,%rsp
  call   <nvram_open_internal@plt>
  mov    $0x50,%edi
  call   <nvram_read@plt>
  mov    $0x53,%edi
  mov    %al,0xe(%rsp)
  call   <nvram_read@plt>
  mov    %al,0xf(%rsp)
  xor    %eax,%eax
  call   <nvram_close@plt>
  mov    %ebp,%edi
  mov    $0x7,%ebp
  call   <nvram_open_internal@plt>
  mov    $0x7f,%edi
  call   <nvram_read@plt>
  mov    $0xfe,%edi
  mov    %eax,%r14d
  call   <nvram_read@plt>
  mov    $0xff,%edi
  mov    %eax,%r13d
  call   <nvram_read@plt>
  mov    %eax,%r12d
L20:
  movzbl %bl,%esi
  mov    $0xff,%edi
  call   <nvram_write_immediate@plt>
  mov    %r15d,%esi
  mov    $0x7f,%edi
  sub    %ebx,%esi
  movzbl %sil,%esi
  call   <nvram_write_immediate@plt>
  mov    $0x5a,%esi
  mov    $0xfe,%edi
  sub    %ebx,%esi
  movzbl %sil,%esi
  call   <nvram_write_immediate@plt>
  mov    $0xff,%edi
  call   <nvram_read@plt>
  cmp    %bl,%al
  jne    L29
  mov    $0x7f,%edi
  call   <nvram_read@plt>
  cmp    %bl,%al
  je     L29
  mov    $0xfe,%edi
  call   <nvram_read@plt>
  cmp    %bl,%al
  je     L29
  add    %ebx,%ebx
  sub    $0x1,%ebp
  jne    L20
  mov    $0x1,%r15d
L28:
  movzbl %r14b,%esi
  mov    $0x7f,%edi
  call   <nvram_write_immediate@plt>
  movzbl %r13b,%esi
  mov    $0xfe,%edi
  call   <nvram_write_immediate@plt>
  movzbl %r12b,%esi
  mov    $0xff,%edi
  call   <nvram_write_immediate@plt>
  xor    %eax,%eax
  call   <nvram_close@plt>
  mov    $0x1,%edi
  call   <nvram_open_internal@plt>
  movzbl 0xe(%rsp),%esi
  mov    $0x50,%edi
  call   <nvram_write_immediate@plt>
  movzbl 0xf(%rsp),%esi
  mov    $0x53,%edi
  call   <nvram_write_immediate@plt>
  xor    %eax,%eax
  call   <nvram_close@plt>
  add    $0x18,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L29:
  xor    %r15d,%r15d
  jmp    L28
```

assistant: ```c
int nvram_probe(int nvram_type_arg) {
  unsigned char mask;
  unsigned char nvram_cell_0x50, nvram_cell_0x53, nvram_cell_0x7f, nvram_cell_0xfe, nvram_cell_0xff;
  int result = 0;
  nvram_open_internal(1);
  nvram_cell_0x50 = nvram_read(0x50);
  nvram_cell_0x53 = nvram_read(0x53);
  nvram_close();
  nvram_open_internal(nvram_type_arg);
  nvram_cell_0x7f = nvram_read(0x7f);
  nvram_cell_0xfe = nvram_read(0xfe);
  nvram_cell_0xff = nvram_read(0xff);
  for (mask = 0x01; mask != 0x80; mask *= 2) {
    nvram_write_immediate(0xff, mask);
    nvram_write_immediate(0x7f, (0xa5 - mask));
    nvram_write_immediate(0xfe, (0x5a - mask));
    if (nvram_read(0xff) != mask) {
      goto nvram_probe_end;
    }
    if (nvram_read(0x7f) == mask) {
      goto nvram_probe_end;
    }
    if (nvram_read(0xfe) == mask) {
      goto nvram_probe_end;
    }
  }
  result = 1;
nvram_probe_end:
  nvram_write_immediate(0x7f, nvram_cell_0x7f);
  nvram_write_immediate(0xfe, nvram_cell_0xfe);
  nvram_write_immediate(0xff, nvram_cell_0xff);
  nvram_close();
  nvram_open_internal(1);
  nvram_write_immediate(0x50, nvram_cell_0x50);
  nvram_write_immediate(0x53, nvram_cell_0x53);
  nvram_close();
  return result;
}
```