#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*/ exit(int);
int /*<<< orphan*/ getgid();
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ printf(char *, ...);
int setgid(int /*<<< orphan*/);
int setuid(int /*<<< orphan*/);
void help() {
  if (setgid(getgid()) == -1)
    exit(1);
  if (setuid(getuid()) == -1)
    exit(1);
  printf("chown-xterm makes %s suid root\n", "/x11/programs/xterm/xterm");
  printf("This is necessary on Ultrix for /dev/tty operation.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <getgid@plt>
mov    %eax,%edi
call   1060 <setgid@plt>
cmp    $0xffffffff,%eax
jne    1185 <help+0x25>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,%edi
call   1080 <setuid@plt>
cmp    $0xffffffff,%eax
jne    11a6 <help+0x46>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe53(%rip),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<help>:
push   %rax
xor    %eax,%eax
call   1060 <getgid@plt>
mov    %eax,%edi
call   1070 <setgid@plt>
cmp    $0xffffffff,%eax
je     1197 <help+0x27>
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %eax,%edi
call   1090 <setuid@plt>
cmp    $0xffffffff,%eax
jne    11a1 <help+0x31>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xe58(%rip),%rdi
lea    0xe71(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"chown-xterm makes %s suid root\0A\00"
@.str.1 = [26 x i8] c"/x11/programs/xterm/xterm\00"
@.str.2 = [53 x i8] c"This is necessary on Ultrix for /dev/tty operation.\0A\00"
define void @help() {
%1 = call i32 (...) @getgid()
%2 = call i32 @setgid(i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @exit(i32 1)
unreachable
6: ; preds = %0
%7 = call i32 (...) @getuid()
%8 = call i32 @setuid(i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"chown-xterm makes %s suid root\0A\00"
@.str.1 = [26 x i8] c"/x11/programs/xterm/xterm\00"
@str = [52 x i8] c"This is necessary on Ultrix for /dev/tty operation.\00"
define void @help() {
%1 = tail call i32 (...) @getgid()
%2 = tail call i32 @setgid(i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
%7 = tail call i32 (...) @getuid()
%8 = tail call i32 @setuid(i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
}