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

```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     L1
  xor    %eax,%eax
  test   %ebp,%ebp
  je     L28
  call   <getuid@plt>
  mov    %eax,%esi
L106:
  lea    D36(%rip),%rdi
  call   <string@plt>
L63:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L15
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L28:
  call   <getgid@plt>
  mov    %eax,%esi
  jmp    L106
  nopl   0x0(%rax)
L1:
  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)
L51:
  mov    0x10(%rsp),%rdx
  mov    0x18(%rsp),%rsi
  mov    (%rsp),%rdi
  call   <rangeitem@plt>
  mov    %rax,(%rsp)
  test   %rax,%rax
  je     L7
  mov    0x8(%rsp),%r14
  lea    0x2c(%rsp),%r13
  lea    0x38(%rsp),%r12
  lea    0x30(%rsp),%rbp
  lea    0x40(%rsp),%r15
  nopl   0x0(%rax)
L29:
  mov    %r14,%rdi
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <mapitem@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L51
  mov    0x3c(%rsp),%r8d
  mov    0x34(%rsp),%r9d
  mov    0x30(%rsp),%eax
  lea    (%r8,%r9,1),%edx
  cmp    %eax,%edx
  jbe    L29
  mov    0x2c(%rsp),%esi
  lea    (%rax,%rsi,1),%ecx
  cmp    %ecx,%r8d
  jae    L29
  cmp    %ecx,%edx
  jbe    L103
  lea    (%r8,%rsi,1),%r9d
  sub    %eax,%r9d
  mov    %r9d,0x34(%rsp)
L103:
  cmp    %eax,%r8d
  jae    L6
  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)
L6:
  cmpq   $0x0,0x40(%rsp)
  lea    D8(%rip),%rax
  mov    %ebx,%ecx
  mov    %r15,%rdi
  lea    D24(%rip),%rdx
  lea    D27(%rip),%rsi
  cmovne %rax,%rdx
  call   <append@plt>
  add    0x34(%rsp),%ebx
  jmp    L29
  nopl   0x0(%rax,%rax,1)
L7:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  xor    %edi,%edi
  call   <free@plt>
  mov    0x40(%rsp),%rax
  jmp    L63
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D36
type_guessed: string
name: parse_data
arguments: data_label: D8
type_guessed: string
name: parse_data
arguments: data_label: D24
type_guessed: string
name: parse_data
arguments: data_label: D27
type_guessed: string

tool: D36: 0:%u:1

tool: D8: ,

tool: 

tool: D27: %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;
}
```