user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<get_fs_ids>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x28(%rsp)
  movq   $0x0,0x30(%rsp)
  movl   $0xffffffff,(%rsi)
  movl   $0xffffffff,(%rdi)
  lea    D33(%rip),%rsi
  lea    D35(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L40
L90:
  mov    $0x0,%ebx
  mov    $0x0,%ebp
  lea    0x30(%rsp),%r14
  lea    0x28(%rsp),%r13
  jmp    L11
L40:
  mov    $0x0,%eax
  call   <abort@plt>
  jmp    L90
L118:
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x24(%rsp),%r9
  lea    0x20(%rsp),%r8
  lea    D7(%rip),%rsi
  mov    0x28(%rsp),%rdi
  call   <sscanf@plt>
  cmp    $0x4,%eax
  je     L106
  test   %ebx,%ebx
  jne    L11
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x24(%rsp),%r9
  lea    0x20(%rsp),%r8
  lea    D10(%rip),%rsi
  mov    0x28(%rsp),%rdi
  call   <sscanf@plt>
  mov    %ebx,%ebp
  cmp    $0x4,%eax
  jne    L11
  mov    0x24(%rsp),%eax
  mov    %eax,(%r15)
  mov    $0x1,%ebx
L11:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <getline@plt>
  cmp    $0xffffffff,%eax
  je     L110
  test   %ebp,%ebp
  je     L118
L59:
  test   %ebx,%ebx
  jne    L24
  lea    0x1c(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x24(%rsp),%r9
  lea    0x20(%rsp),%r8
  lea    D10(%rip),%rsi
  mov    0x28(%rsp),%rdi
  call   <sscanf@plt>
  cmp    $0x4,%eax
  je     L31
  mov    $0x1,%ebp
  jmp    L11
L106:
  mov    0x24(%rsp),%eax
  mov    0x8(%rsp),%rcx
  mov    %eax,(%rcx)
  jmp    L59
L24:
  mov    %ebx,%ebp
L110:
  mov    0x28(%rsp),%rdi
  test   %rdi,%rdi
  je     L105
  call   <free@plt>
L105:
  test   %ebp,%ebp
  setne  %al
  and    %ebx,%eax
  sub    $0x1,%eax
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L23
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  mov    0x24(%rsp),%eax
  mov    %eax,(%r15)
  mov    $0x1,%ebx
  mov    $0x1,%ebp
  jmp    L110
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D33
type_infered: string
name: parse_data
arguments: data_label: D35
type_infered: string
name: parse_data
arguments: data_label: D7
type_infered: string
name: parse_data
arguments: data_label: D10
type_infered: string

tool: D33: r

tool: D35: /proc/self/status

tool: D7: Uid: %u %u %u %u

tool: D10: Gid: %u %u %u %u

assistant: ```c
int get_fs_ids(uid_t *fsuid, gid_t *fsgid) {
  unsigned r, e, s, fs;
  bool got_u = false, got_g = false;
  char *line = NULL;
  size_t len = 0;
  FILE *fp;
  *fsuid = *fsgid = -1;
  if (!((fp = fopen("/proc/self/status", "r")) != NULL))
    abort();
  while (getline(&line, &len, fp) != -1) {
    if (!got_u && sscanf(line, "Uid: %u %u %u %u", &r, &e, &s, &fs) == 4) {
      got_u = true;
      *fsuid = fs;
    }
    if (!got_g && sscanf(line, "Gid: %u %u %u %u", &r, &e, &s, &fs) == 4) {
      got_g = true;
      *fsgid = fs;
    }
    if (got_u && got_g)
      break;
  }
  if (line)
    free(line);
  return (got_u && got_g) ? 0 : -1;
}
```