#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ fsfr_fetch_uid(char *);
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) {
  if (ruid)
    *ruid = fsfr_fetch_uid("FSFR_UID");
  if (euid)
    *euid = fsfr_fetch_uid("FSFR_EUID");
  if (suid)
    *suid = fsfr_fetch_uid("FSFR_SUID");
  return 0;
}


x86 assembly (clang, -O0):
<getresuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1143 <getresuid+0x33>
lea    0xeca(%rip),%rdi
call   1030 <fsfr_fetch_uid@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     1162 <getresuid+0x52>
lea    0xeb4(%rip),%rdi
call   1030 <fsfr_fetch_uid@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1181 <getresuid+0x71>
lea    0xe9f(%rip),%rdi
call   1030 <fsfr_fetch_uid@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getresuid>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
test   %rdi,%rdi
je     1131 <getresuid+0x21>
mov    %rdi,%rbx
lea    0xed6(%rip),%rdi
call   1030 <fsfr_fetch_uid@plt>
mov    %eax,(%rbx)
test   %r15,%r15
je     1145 <getresuid+0x35>
lea    0xecc(%rip),%rdi
call   1030 <fsfr_fetch_uid@plt>
mov    %eax,(%r15)
test   %r14,%r14
je     1159 <getresuid+0x49>
lea    0xec2(%rip),%rdi
call   1030 <fsfr_fetch_uid@plt>
mov    %eax,(%r14)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"FSFR_UID\00"
@.str.1 = [10 x i8] c"FSFR_EUID\00"
@.str.2 = [10 x i8] c"FSFR_SUID\00"
define i32 @getresuid(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i32 @fsfr_fetch_uid(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = load i32*, i32** %4
store i32 %10, i32* %11
br label %12
12: ; preds = %9, %3
%13 = load i32*, i32** %5
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @fsfr_fetch_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32*, i32** %5
store i32 %16, i32* %17
br label %18
18: ; preds = %15, %12
%19 = load i32*, i32** %6
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @fsfr_fetch_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32*, i32** %6
store i32 %22, i32* %23
br label %24
24: ; preds = %21, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"FSFR_UID\00"
@.str.1 = [10 x i8] c"FSFR_EUID\00"
@.str.2 = [10 x i8] c"FSFR_SUID\00"
define i32 @getresuid(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @fsfr_fetch_uid(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %0
br label %7
7: ; preds = %5, %3
%8 = icmp eq i32* %1, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @fsfr_fetch_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 %10, i32* %1
br label %11
11: ; preds = %9, %7
%12 = icmp eq i32* %2, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @fsfr_fetch_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %11
ret i32 0
}