#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 uid_t;

/* Variables and functions */
int /*<<< orphan*/ fsfr_set_uid(char *, int);
int setresgid(uid_t ruid, uid_t euid, uid_t suid) {
  if (ruid > -1)
    fsfr_set_uid("FSFR_GID", ruid);
  if (euid > -1)
    fsfr_set_uid("FSFR_EGID", ruid);
  if (euid > -1)
    fsfr_set_uid("FSFR_SGID", ruid);
  return 0;
}


x86 assembly (clang, -O0):
<setresgid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jle    113a <setresgid+0x2a>
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <fsfr_set_uid@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jle    1153 <setresgid+0x43>
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <fsfr_set_uid@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jle    116c <setresgid+0x5c>
mov    -0x4(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1030 <fsfr_set_uid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setresgid>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
test   %edi,%edi
js     1129 <setresgid+0x19>
lea    0xede(%rip),%rdi
mov    %ebx,%esi
call   1030 <fsfr_set_uid@plt>
test   %ebp,%ebp
js     1149 <setresgid+0x39>
lea    0xed5(%rip),%rdi
mov    %ebx,%esi
call   1030 <fsfr_set_uid@plt>
lea    0xed1(%rip),%rdi
mov    %ebx,%esi
call   1030 <fsfr_set_uid@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"FSFR_GID\00"
@.str.1 = [10 x i8] c"FSFR_EGID\00"
@.str.2 = [10 x i8] c"FSFR_SGID\00"
define i32 @setresgid(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 sgt i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32, i32* %4
%11 = call i32 @fsfr_set_uid(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %3
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %4
%17 = call i32 @fsfr_set_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %5
%20 = icmp sgt i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %4
%23 = call i32 @fsfr_set_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"FSFR_GID\00"
@.str.1 = [10 x i8] c"FSFR_EGID\00"
@.str.2 = [10 x i8] c"FSFR_SGID\00"
define i32 @setresgid(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, -1
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @fsfr_set_uid(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %7
7: ; preds = %5, %3
%8 = icmp sgt i32 %1, -1
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = tail call i32 @fsfr_set_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%11 = tail call i32 @fsfr_set_uid(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %12
12: ; preds = %7, %9
ret i32 0
}