#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 getresuid(int *, int *, int *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  uid_t r, e, s;
  int ret = 0;
  ret = getresuid(&r, &e, &s);
  if (ret == -1) {
    perror("getresuid:");
    return -1;
  }
  printf("r %d, e %d, s %d\n", r, e, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <getresuid@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    117c <main+0x4c>
lea    0xe95(%rip),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <main+0x68>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <getresuid@plt>
cmp    $0xffffffff,%eax
je     116c <main+0x3c>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe8d(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"getresuid:\00"
@.str.1 = [18 x i8] c"r %d, e %d, s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 @getresuid(i32* %2, i32* %3, i32* %4)
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %16
11: ; preds = %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
store i32 0, i32* %1
br label %16
16: ; preds = %11, %9
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [11 x i8] c"getresuid:\00"
@.str.1 = [18 x i8] c"r %d, e %d, s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @getresuid(i32* %1, i32* %2, i32* %3)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %16
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
br label %16
16: ; preds = %11, %9
%17 = phi i32 [ -1, %9 ], [ 0, %11 ]
ret i32 %17
}