user: What is the c source code of the assembly code below?

```asm
<userdefault>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x40(%rsp)
  call   <geteuid@plt>
  test   %rax,%rax
  je     L56
  xor    %eax,%eax
  test   %ebp,%ebp
  je     L113
  call   <getuid@plt>
  mov    %eax,%esi
L1:
  lea    D3(%rip),%rdi
  call   <string@plt>
L70:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L95
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L113:
  call   <getgid@plt>
  mov    %eax,%esi
  jmp    L1
  nopl   0x0(%rax)
L56:
  mov    %ebp,%esi
  mov    $0xffffffff,%edi
  xor    %ebx,%ebx
  call   <getmap@plt>
  mov    %ebp,%edi
  mov    %rax,0x8(%rsp)
  call   <readranges@plt>
  mov    %rax,(%rsp)
  lea    0x34(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    0x3c(%rsp),%rax
  mov    %rax,0x18(%rsp)
  nopw   0x0(%rax,%rax,1)
L72:
  mov    0x10(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    (%rsp),%rdi
  call   <rangeitem@plt>
  mov    %rax,(%rsp)
  test   %rax,%rax
  je     L83
  mov    0x8(%rsp),%r14
  lea    0x2c(%rsp),%r13
  lea    0x38(%rsp),%r12
  lea    0x30(%rsp),%rbp
  lea    0x40(%rsp),%r15
  nopl   0x0(%rax)
L3:
  mov    %r14,%rdi
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <mapitem@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L72
  mov    0x3c(%rsp),%r8d
  mov    0x34(%rsp),%r9d
  mov    0x30(%rsp),%eax
  lea    (%r8,%r9,1),%edx
  cmp    %eax,%edx
  jbe    L3
  mov    0x2c(%rsp),%esi
  lea    (%rax,%rsi,1),%ecx
  cmp    %ecx,%r8d
  jae    L3
  cmp    %ecx,%edx
  jbe    L28
  lea    (%r8,%rsi,1),%r9d
  sub    %eax,%r9d
  mov    %r9d,0x34(%rsp)
L28:
  cmp    %eax,%r8d
  jae    L25
  mov    %eax,%edx
  mov    %eax,0x3c(%rsp)
  sub    %r8d,%edx
  sub    %eax,%r8d
  add    %r8d,%r9d
  add    %edx,%ebx
  mov    %eax,%r8d
  mov    %r9d,0x34(%rsp)
L25:
  cmpq   $0x0,0x40(%rsp)
  lea    D7(%rip),%rax
  mov    %ebx,%ecx
  mov    %r15,%rdi
  lea    D27(%rip),%rdx
  lea    D14(%rip),%rsi
  cmovne %rax,%rdx
  call   <append@plt>
  add    0x34(%rsp),%ebx
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L83:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  xor    %edi,%edi
  call   <free@plt>
  mov    0x40(%rsp),%rax
  jmp    L70
L95:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D3
data_type: string
name: extract_symbolic_data
arguments: data_label: D7
data_type: string
name: extract_symbolic_data
arguments: data_label: D27
data_type: string
name: extract_symbolic_data
arguments: data_label: D14
data_type: string

tool: D3: 0:%u:1

tool: D7: ,

tool: 

tool: D14: %s%u:%u:%u

assistant: ```c
char *userdefault(int type) {
  char *cursor, *map, *range, *result = NULL;
  unsigned count, first, index = 0, length, lower, start;
  if (geteuid() != 0)
    return string("0:%u:1", ((unsigned)((type) == 0 ? getgid() : getuid())));
  map = getmap(-1, type);
  range = readranges(type);
  while ((range = rangeitem(range, &start, &length))) {
    cursor = map;
    while ((cursor = mapitem(cursor, &first, &lower, &count))) {
      if (start + length <= first || first + count <= start)
        continue;
      if (first + count < start + length)
        length = start - first + count;
      if (start < first) {
        index += first - start;
        length -= first - start;
        start = first;
      }
      append(&result, "%s%u:%u:%u", result ? "," : "", index, start, length);
      index += length;
    }
  }
  free(map);
  free(range);
  return result;
}
```