#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 */
struct syscall_desc {
  int dummy;
};

/* Variables and functions */
unsigned int call_syscall(struct syscall_desc *, char **);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
struct syscall_desc *find_syscall(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ isspace(unsigned char);
char *optarg;
scalar_t__ optind;
int /*<<< orphan*/ set_gids(char *);
scalar_t__ setuid(int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
scalar_t__ strtol(char *, char **, int /*<<< orphan*/);
int /*<<< orphan*/ umask(int);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  struct syscall_desc *scall;
  unsigned int n;
  char *gids, *endp;
  int uid, umsk, ch;
  uid = -1;
  gids = NULL;
  umsk = 0;
  while ((ch = getopt(argc, argv, "g:u:U:")) != -1) {
    switch (ch) {
    case 'g':
      gids = optarg;
      break;
    case 'u':
      uid = (int)strtol(optarg, &endp, 0);
      if (*endp != '\0' && !isspace((unsigned char)*endp)) {
        fprintf(stderr,
                "invalid uid '%s' - number "
                "expected\n",
                optarg);
        exit(1);
      }
      break;
    case 'U':
      umsk = (int)strtol(optarg, &endp, 0);
      if (*endp != '\0' && !isspace((unsigned char)*endp)) {
        fprintf(stderr,
                "invalid umask '%s' - number "
                "expected\n",
                optarg);
        exit(1);
      }
      break;
    default:
      usage();
    }
  }
  argc -= optind;
  argv += optind;
  if (argc < 1) {
    fprintf(stderr, "too few arguments\n");
    usage();
  }
  if (gids != NULL) {
    fprintf(stderr, "changing groups to %s\n", gids);
    set_gids(gids);
  }
  if (uid != -1) {
    fprintf(stderr, "changing uid to %d\n", uid);
    if (setuid(uid) < 0) {
      fprintf(stderr, "cannot change uid: %s\n", strerror(errno));
      exit(1);
    }
  }
  umask(umsk);
  for (;;) {
    scall = find_syscall(argv[0]);
    if (scall == NULL) {
      fprintf(stderr, "syscall '%s' not supported\n", argv[0]);
      exit(1);
    }
    argc++;
    argv++;
    n = call_syscall(scall, argv);
    argc += n;
    argv += n;
    if (argv[0] == NULL)
      break;
    argc++;
    argv++;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x34(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe06(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0xffffffff,%eax
je     133a <main+0x17a>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0x55,%eax
je     12c1 <main+0x101>
jmp    121f <main+0x5f>
mov    -0x40(%rbp),%eax
sub    $0x67,%eax
je     1241 <main+0x81>
jmp    1230 <main+0x70>
mov    -0x40(%rbp),%eax
sub    $0x75,%eax
je     1254 <main+0x94>
jmp    132e <main+0x16e>
mov    0x2db0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1335 <main+0x175>
mov    0x2d9d(%rip),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12bc <main+0xfc>
mov    -0x30(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    12bc <main+0xfc>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%rdx
lea    0xd5c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1335 <main+0x175>
mov    0x2d30(%rip),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1329 <main+0x169>
mov    -0x30(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1329 <main+0x169>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
mov    0x2cea(%rip),%rax
mov    (%rax),%rdx
lea    0xd13(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1335 <main+0x175>
mov    $0x0,%al
call   10a0 <usage@plt>
jmp    11ec <main+0x2c>
mov    0x2c9f(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2c8b(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    138c <main+0x1cc>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
lea    0xcd3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   10a0 <usage@plt>
cmpq   $0x0,-0x28(%rbp)
je     13bb <main+0x1fb>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xcb9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <set_gids@plt>
cmpl   $0xffffffff,-0x34(%rbp)
je     142e <main+0x26e>
mov    0x2c04(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
lea    0xca3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   10d0 <setuid@plt>
cmp    $0x0,%rax
jge    1429 <main+0x269>
mov    0x2bd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xc77(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    142e <main+0x26e>
mov    -0x38(%rbp),%edi
call   1070 <umask@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <find_syscall@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1479 <main+0x2b9>
mov    0x2b78(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc3e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <call_syscall@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,%ecx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    14ce <main+0x30e>
jmp    14e8 <main+0x328>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1436 <main+0x276>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0xffffffff,%r12d
lea    0xe20(%rip),%r13
mov    0x2e11(%rip),%r15
lea    0x10(%rsp),%r14
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
mov    %rax,(%rsp)
jmp    1215 <main+0x55>
nopl   0x0(%rax,%rax,1)
cmp    $0x55,%eax
je     123b <main+0x7b>
cmp    $0xffffffff,%eax
je     12a9 <main+0xe9>
xor    %eax,%eax
call   10a0 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10b0 <getopt@plt>
cmp    $0x66,%eax
jle    1200 <main+0x40>
cmp    $0x75,%eax
je     1269 <main+0xa9>
cmp    $0x67,%eax
jne    120e <main+0x4e>
mov    (%r15),%rax
mov    %rax,0x8(%rsp)
jmp    1215 <main+0x55>
mov    (%r15),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %rax,(%rsp)
mov    0x10(%rsp),%rax
movzbl (%rax),%eax
test   %al,%al
je     1215 <main+0x55>
movzbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1215 <main+0x55>
jmp    13cd <main+0x20d>
mov    (%r15),%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %rax,%r12
mov    0x10(%rsp),%rax
movzbl (%rax),%eax
test   %al,%al
je     1215 <main+0x55>
movzbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1215 <main+0x55>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd63(%rip),%rsi
jmp    13b5 <main+0x1f5>
mov    0x2d30(%rip),%rax
mov    (%rax),%r14
sub    %r14d,%ebp
test   %ebp,%ebp
jg     12d8 <main+0x118>
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
lea    0xd87(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   10a0 <usage@plt>
mov    0x8(%rsp),%rbp
test   %rbp,%rbp
je     1304 <main+0x144>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
lea    0xd72(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %rbp,%rdi
call   1050 <set_gids@plt>
cmp    $0xffffffff,%r12d
je     1351 <main+0x191>
mov    0x2cbf(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xd60(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r12d,%edi
call   10d0 <setuid@plt>
test   %rax,%rax
jns    1351 <main+0x191>
mov    0x0(%rbp),%ebx
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd45(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
jmp    13b5 <main+0x1f5>
lea    (%rbx,%r14,8),%rbx
mov    (%rsp),%rdi
call   1070 <umask@plt>
mov    (%rbx),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <find_syscall@plt>
test   %rax,%rax
je     13a2 <main+0x1e2>
lea    0x8(%rbx),%rsi
mov    %rax,%rdi
call   1090 <call_syscall@plt>
mov    %eax,%eax
cmpq   $0x0,0x8(%rbx,%rax,8)
je     13c6 <main+0x206>
lea    (%rbx,%rax,8),%rbx
add    $0x8,%rbx
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
jmp    1370 <main+0x1b0>
mov    0x2c27(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xcf1(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x2bfc(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xc4b(%rip),%rsi
jmp    13b5 <main+0x1f5>

LLVM IR (-O0):
%struct.syscall_desc = type { i32 }
@.str = [7 x i8] c"g:u:U:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [36 x i8] c"invalid uid '%s' - number expected\0A\00"
@.str.2 = [38 x i8] c"invalid umask '%s' - number expected\0A\00"
@optind = global i64 0
@.str.3 = [19 x i8] c"too few arguments\0A\00"
@.str.4 = [23 x i8] c"changing groups to %s\0A\00"
@.str.5 = [20 x i8] c"changing uid to %d\0A\00"
@.str.6 = [23 x i8] c"cannot change uid: %s\0A\00"
@errno = global i32 0
@.str.7 = [28 x i8] c"syscall '%s' not supported\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.syscall_desc*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %10
store i8* null, i8** %8
store i32 0, i32* %11
br label %13
13: ; preds = %62, %2
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt(i32 %14, i8** %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %12
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %63
18: ; preds = %13
%19 = load i32, i32* %12
switch i32 %19, label %60 [
i32 103, label %20
i32 117, label %22
i32 85, label %41
]
20: ; preds = %18
%21 = load i8*, i8** @optarg
store i8* %21, i8** %8
br label %62
22: ; preds = %18
%23 = load i8*, i8** @optarg
%24 = call i64 @strtol(i8* %23, i8** %9, i32 0)
%25 = trunc i64 %24 to i32
store i32 %25, i32* %10
%26 = load i8*, i8** %9
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %22
%31 = load i8*, i8** %9
%32 = load i8, i8* %31
%33 = call i32 @isspace(i8 zeroext %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = load i8*, i8** @optarg
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %30, %22
br label %62
41: ; preds = %18
%42 = load i8*, i8** @optarg
%43 = call i64 @strtol(i8* %42, i8** %9, i32 0)
%44 = trunc i64 %43 to i32
store i32 %44, i32* %11
%45 = load i8*, i8** %9
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %59
49: ; preds = %41
%50 = load i8*, i8** %9
%51 = load i8, i8* %50
%52 = call i32 @isspace(i8 zeroext %51)
%53 = icmp ne i32 %52, 0
br i1 %53, label %59, label %54
54: ; preds = %49
%55 = load i32, i32* @stderr
%56 = load i8*, i8** @optarg
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %49, %41
br label %62
60: ; preds = %18
%61 = call i32 (...) @usage()
br label %62
62: ; preds = %60, %59, %40, %20
br label %13
63: ; preds = %13
%64 = load i64, i64* @optind
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = sub nsw i64 %66, %64
%68 = trunc i64 %67 to i32
store i32 %68, i32* %4
%69 = load i64, i64* @optind
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 %69
store i8** %71, i8*** %5
%72 = load i32, i32* %4
%73 = icmp slt i32 %72, 1
br i1 %73, label %74, label %78
74: ; preds = %63
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%77 = call i32 (...) @usage()
br label %78
78: ; preds = %74, %63
%79 = load i8*, i8** %8
%80 = icmp ne i8* %79, null
br i1 %80, label %81, label %87
81: ; preds = %78
%82 = load i32, i32* @stderr
%83 = load i8*, i8** %8
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %83)
%85 = load i8*, i8** %8
%86 = call i32 @set_gids(i8* %85)
br label %87
87: ; preds = %81, %78
%88 = load i32, i32* %10
%89 = icmp ne i32 %88, -1
br i1 %89, label %90, label %104
90: ; preds = %87
%91 = load i32, i32* @stderr
%92 = load i32, i32* %10
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %10
%95 = call i64 @setuid(i32 %94)
%96 = icmp slt i64 %95, 0
br i1 %96, label %97, label %103
97: ; preds = %90
%98 = load i32, i32* @stderr
%99 = load i32, i32* @errno
%100 = call i8* @strerror(i32 %99)
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %100)
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %90
br label %104
104: ; preds = %103, %87
%105 = load i32, i32* %11
%106 = call i32 @umask(i32 %105)
br label %107
107: ; preds = %141, %104
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 0
%110 = load i8*, i8** %109
%111 = call %struct.syscall_desc* @find_syscall(i8* %110)
store %struct.syscall_desc* %111, %struct.syscall_desc** %6
%112 = load %struct.syscall_desc*, %struct.syscall_desc** %6
%113 = icmp eq %struct.syscall_desc* %112, null
br i1 %113, label %114, label %121
114: ; preds = %107
%115 = load i32, i32* @stderr
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 0
%118 = load i8*, i8** %117
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %118)
%120 = call i32 @exit(i32 1)
unreachable
121: ; preds = %107
%122 = load i32, i32* %4
%123 = add nsw i32 %122, 1
store i32 %123, i32* %4
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i32 1
store i8** %125, i8*** %5
%126 = load %struct.syscall_desc*, %struct.syscall_desc** %6
%127 = load i8**, i8*** %5
%128 = call i32 @call_syscall(%struct.syscall_desc* %126, i8** %127)
store i32 %128, i32* %7
%129 = load i32, i32* %7
%130 = load i32, i32* %4
%131 = add i32 %130, %129
store i32 %131, i32* %4
%132 = load i32, i32* %7
%133 = load i8**, i8*** %5
%134 = zext i32 %132 to i64
%135 = getelementptr inbounds i8*, i8** %133, i64 %134
store i8** %135, i8*** %5
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 0
%138 = load i8*, i8** %137
%139 = icmp eq i8* %138, null
br i1 %139, label %140, label %141
140: ; preds = %121
br label %146
141: ; preds = %121
%142 = load i32, i32* %4
%143 = add nsw i32 %142, 1
store i32 %143, i32* %4
%144 = load i8**, i8*** %5
%145 = getelementptr inbounds i8*, i8** %144, i32 1
store i8** %145, i8*** %5
br label %107
146: ; preds = %140
%147 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.syscall_desc = type { i32 }
@.str = [7 x i8] c"g:u:U:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [36 x i8] c"invalid uid '%s' - number expected\0A\00"
@.str.2 = [38 x i8] c"invalid umask '%s' - number expected\0A\00"
@optind = global i64 0
@.str.3 = [19 x i8] c"too few arguments\0A\00"
@.str.4 = [23 x i8] c"changing groups to %s\0A\00"
@.str.5 = [20 x i8] c"changing uid to %d\0A\00"
@.str.6 = [23 x i8] c"cannot change uid: %s\0A\00"
@errno = global i32 0
@.str.7 = [28 x i8] c"syscall '%s' not supported\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
br label %5
5: ; preds = %16, %2
%6 = phi i8* [ %17, %16 ], [ null, %2 ]
%7 = phi i32 [ %10, %16 ], [ -1, %2 ]
%8 = phi i32 [ %13, %16 ], [ 0, %2 ]
br label %9
9: ; preds = %28, %5
%10 = phi i32 [ %7, %5 ], [ %21, %28 ]
%11 = phi i32 [ %8, %5 ], [ %13, %28 ]
br label %12
12: ; preds = %44, %9
%13 = phi i32 [ %11, %9 ], [ %37, %44 ]
br label %14
14: ; preds = %12, %50
%15 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %15, label %50 [
i32 -1, label %52
i32 103, label %16
i32 117, label %18
i32 85, label %34
]
16: ; preds = %14
%17 = load i8*, i8** @optarg
br label %5
18: ; preds = %14
%19 = load i8*, i8** @optarg
%20 = call i64 @strtol(i8* %19, i8** %3, i32 0)
%21 = trunc i64 %20 to i32
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %18
%26 = tail call i32 @isspace(i8 zeroext %23)
%27 = icmp eq i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %25, %18
br label %9
29: ; preds = %25
%30 = load i32, i32* @stderr
%31 = load i8*, i8** @optarg
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %14
%35 = load i8*, i8** @optarg
%36 = call i64 @strtol(i8* %35, i8** %3, i32 0)
%37 = trunc i64 %36 to i32
%38 = load i8*, i8** %3
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %34
%42 = tail call i32 @isspace(i8 zeroext %39)
%43 = icmp eq i32 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %41, %34
br label %12
45: ; preds = %41
%46 = load i32, i32* @stderr
%47 = load i8*, i8** @optarg
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = tail call i32 @exit(i32 1)
unreachable
50: ; preds = %14
%51 = tail call i32 (...) @usage()
br label %14
52: ; preds = %14
%53 = load i64, i64* @optind
%54 = trunc i64 %53 to i32
%55 = sub i32 %0, %54
%56 = getelementptr inbounds i8*, i8** %1, i64 %53
%57 = icmp slt i32 %55, 1
br i1 %57, label %58, label %62
58: ; preds = %52
%59 = load i32, i32* @stderr
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%61 = tail call i32 (...) @usage()
br label %62
62: ; preds = %58, %52
%63 = icmp eq i8* %6, null
br i1 %63, label %68, label %64
64: ; preds = %62
%65 = load i32, i32* @stderr
%66 = tail call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%67 = tail call i32 @set_gids(i8* %6)
br label %68
68: ; preds = %64, %62
%69 = icmp eq i32 %10, -1
br i1 %69, label %81, label %70
70: ; preds = %68
%71 = load i32, i32* @stderr
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%73 = tail call i64 @setuid(i32 %10)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %81
75: ; preds = %70
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = tail call i8* @strerror(i32 %77)
%79 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %78)
%80 = tail call i32 @exit(i32 1)
unreachable
81: ; preds = %70, %68
%82 = tail call i32 @umask(i32 %13)
%83 = load i8*, i8** %56
%84 = tail call %struct.syscall_desc* @find_syscall(i8* %83)
%85 = icmp eq %struct.syscall_desc* %84, null
br i1 %85, label %86, label %92
86: ; preds = %101, %81
%87 = phi i8** [ %56, %81 ], [ %102, %101 ]
%88 = load i32, i32* @stderr
%89 = load i8*, i8** %87
%90 = tail call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %89)
%91 = tail call i32 @exit(i32 1)
unreachable
92: ; preds = %81, %101
%93 = phi %struct.syscall_desc* [ %104, %101 ], [ %84, %81 ]
%94 = phi i8** [ %102, %101 ], [ %56, %81 ]
%95 = getelementptr inbounds i8*, i8** %94, i64 1
%96 = tail call i32 @call_syscall(%struct.syscall_desc* %93, i8** %95)
%97 = zext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
%99 = load i8*, i8** %98
%100 = icmp eq i8* %99, null
br i1 %100, label %106, label %101
101: ; preds = %92
%102 = getelementptr inbounds i8*, i8** %98, i64 1
%103 = load i8*, i8** %102
%104 = tail call %struct.syscall_desc* @find_syscall(i8* %103)
%105 = icmp eq %struct.syscall_desc* %104, null
br i1 %105, label %86, label %92
106: ; preds = %92
%107 = tail call i32 @exit(i32 0)
unreachable
}