#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 */

/* Variables and functions */
int /*<<< orphan*/ enact_scenarios();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int setugid(int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int error;
  fprintf(stderr, "test capabilities: ");
  fprintf(stderr, "\n");
  error = setugid(1);
  if (error) {
    perror("setugid");
    fprintf(stderr, "This test suite requires options REGRESSION\n");
    return (-1);
  }
  enact_scenarios();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <setugid@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c4 <main+0x84>
lea    0xe76(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d2 <main+0x92>
mov    $0x0,%al
call   1030 <enact_scenarios@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e98(%rip),%rbx
mov    (%rbx),%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <setugid@plt>
test   %eax,%eax
jne    117f <main+0x3f>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <enact_scenarios@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe8e(%rip),%rdi
call   1060 <perror@plt>
mov    (%rbx),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    117b <main+0x3b>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"test capabilities: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [8 x i8] c"setugid\00"
@.str.3 = [45 x i8] c"This test suite requires options REGRESSION\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @setugid(i32 1)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %20
18: ; preds = %2
%19 = call i32 (...) @enact_scenarios()
store i32 0, i32* %3
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"test capabilities: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [8 x i8] c"setugid\00"
@.str.3 = [45 x i8] c"This test suite requires options REGRESSION\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @setugid(i32 1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %15
13: ; preds = %2
%14 = tail call i32 (...) @enact_scenarios()
br label %15
15: ; preds = %13, %9
%16 = phi i32 [ -1, %9 ], [ 0, %13 ]
ret i32 %16
}