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

```asm
<onfault_check>:
  endbr64
  push   %r13
  xor    %eax,%eax
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <getpagesize@plt>
  mov    %r12,%rdi
  mov    %rax,%rbp
  call   <get_pageflags@plt>
  add    %r12,%rbp
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <get_pageflags@plt>
  or     %eax,%ebx
  js     L25
  movb   $0x61,(%r12)
  mov    %r12,%rdi
  call   <get_pageflags@plt>
  mov    %rbp,%rdi
  mov    %eax,%r13d
  call   <get_pageflags@plt>
  test   %r13d,%r13d
  jns    L57
  test   %eax,%eax
  js     L20
  mov    %r13d,%edi
  call   <get_kpageflags@plt>
  test   $0x40000,%eax
  je     L54
  mov    %r12,%rdi
  call   <is_vma_lock_on_fault@plt>
  test   %eax,%eax
  je     L42
  mov    %rbp,%rdi
  call   <is_vma_lock_on_fault@plt>
  test   %eax,%eax
  je     L42
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L25:
  lea    D37(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L57:
  lea    D14(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L42:
  lea    D19(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L20:
  lea    D46(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L54:
  lea    D4(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D37
datatype: string
name: extract_symbolic_data
arguments: data_tag: D14
datatype: string
name: extract_symbolic_data
arguments: data_tag: D19
datatype: string
name: extract_symbolic_data
arguments: data_tag: D46
datatype: string
name: extract_symbolic_data
arguments: data_tag: D4
datatype: string

tool: D37: Pages were made present by MLOCK_ONFAULT


tool: D14: Page 1 is not present after fault


tool: D19: VMA is not marked for lock on fault


tool: D46: Page 2 was made present


tool: D4: Failed to make faulted page unevictable


assistant: ```c
int onfault_check(char *map) {
  unsigned long page_size = getpagesize();
  uint64_t page1_flags, page2_flags;
  page1_flags = get_pageflags((unsigned long)map);
  page2_flags = get_pageflags((unsigned long)map + page_size);
  if ((page1_flags & 0x8000000000000000) || (page2_flags & 0x8000000000000000)) {
    printf("Pages were made present by MLOCK_ONFAULT\n");
    return 1;
  }
  *map = 'a';
  page1_flags = get_pageflags((unsigned long)map);
  page2_flags = get_pageflags((unsigned long)map + page_size);
  if ((page1_flags & 0x8000000000000000) == 0) {
    printf("Page 1 is not present after fault\n");
    return 1;
  } else if (page2_flags & 0x8000000000000000) {
    printf("Page 2 was made present\n");
    return 1;
  }
  page1_flags = get_kpageflags(page1_flags & 0x007FFFFFFFFFFFFF);
  if ((page1_flags & (1UL << 18)) == 0) {
    printf("Failed to make faulted page unevictable\n");
    return 1;
  }
  if (!is_vma_lock_on_fault((unsigned long)map)) {
    printf("VMA is not marked for lock on fault\n");
    return 1;
  }
  if (!is_vma_lock_on_fault((unsigned long)map + page_size)) {
    printf("VMA is not marked for lock on fault\n");
    return 1;
  }
  return 0;
}
```