user: Please show me the C implementation that matches the assembly code listed below:

```asm
<is_vma_lock_on_fault>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x50(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  mov    -0x58(%rbp),%rax
  lea    D53(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <is_vmflag_set@plt>
  mov    %eax,-0x4c(%rbp)
  cmpl   $0x0,-0x4c(%rbp)
  je     L69
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <seek_to_smaps_entry@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L18
  lea    D51(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L94
L87:
  mov    -0x38(%rbp),%rax
  lea    D95(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %eax,%eax
  jne    L14
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L18
L14:
  mov    -0x38(%rbp),%rbx
  lea    D95(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rbx,%rax
  mov    %rax,-0x20(%rbp)
  lea    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  lea    D39(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  test   %eax,%eax
  jg     L17
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L94
L18:
  mov    -0x28(%rbp),%rdx
  lea    -0x30(%rbp),%rcx
  lea    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jg     L87
  jmp    L122
L17:
  nop
  jmp    L122
L192:
  mov    -0x38(%rbp),%rax
  lea    D66(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %eax,%eax
  jne    L124
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  jmp    L122
L124:
  mov    -0x38(%rbp),%rbx
  lea    D66(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rbx,%rax
  mov    %rax,-0x20(%rbp)
  lea    -0x40(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  lea    D39(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  test   %eax,%eax
  jg     L89
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L94
L122:
  mov    -0x28(%rbp),%rdx
  lea    -0x30(%rbp),%rcx
  lea    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jg     L192
  jmp    L63
L89:
  nop
L63:
  cmpl   $0x0,-0x4c(%rbp)
  je     L110
  mov    -0x40(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  cmp    %rax,%rdx
  jae    L110
  mov    $0x1,%eax
  jmp    L41
L110:
  mov    $0x0,%eax
L41:
  mov    %eax,-0x50(%rbp)
  jmp    L94
L69:
  nop
L94:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  cmpq   $0x0,-0x28(%rbp)
  je     L6
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L6:
  mov    -0x50(%rbp),%eax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L121
  call   <__stack_chk_fail@plt>
L121:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D53
type: string
name: disassemble_data
arguments: tag: D51
type: string
name: disassemble_data
arguments: tag: D95
type: string
name: disassemble_data
arguments: tag: D39
type: string
name: disassemble_data
arguments: tag: D20
type: string
name: disassemble_data
arguments: tag: D66
type: string
name: disassemble_data
arguments: tag: D87
type: string

tool: D53: lo

tool: D51: Unable to parse /proc/self/smaps


tool: D95: Size:

tool: D39: %lu kB

tool: D20: Unable to parse smaps entry for Size


tool: D66: Rss:

tool: D87: Unable to parse smaps entry for Rss


assistant: ```c
bool is_vma_lock_on_fault(unsigned long addr) {
  bool ret = false;
  bool locked;
  FILE *smaps = NULL;
  unsigned long vma_size, vma_rss;
  char *line = NULL;
  char *value;
  size_t size = 0;
  locked = is_vmflag_set(addr, "lo");
  if (!locked)
    goto out;
  smaps = seek_to_smaps_entry(addr);
  if (!smaps) {
    printf("Unable to parse /proc/self/smaps\n");
    goto out;
  }
  while (getline(&line, &size, smaps) > 0) {
    if (!strstr(line, "Size:")) {
      free(line);
      line = NULL;
      size = 0;
      continue;
    }
    value = line + strlen("Size:");
    if (sscanf(value, "%lu kB", &vma_size) < 1) {
      printf("Unable to parse smaps entry for Size\n");
      goto out;
    }
    break;
  }
  while (getline(&line, &size, smaps) > 0) {
    if (!strstr(line, "Rss:")) {
      free(line);
      line = NULL;
      size = 0;
      continue;
    }
    value = line + strlen("Rss:");
    if (sscanf(value, "%lu kB", &vma_rss) < 1) {
      printf("Unable to parse smaps entry for Rss\n");
      goto out;
    }
    break;
  }
  ret = locked && (vma_rss < vma_size);
out:
  free(line);
  if (smaps)
    fclose(smaps);
  return ret;
}
```