#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 passwd {
  int pw_uid;
};
typedef int id_t;

/* Variables and functions */
int EINVAL;
int PRIO_PGRP;
int PRIO_PROCESS;
int PRIO_USER;
int errno;
int getpriority(int, int);
struct passwd *getpwnam(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int setpriority(int, int, int);
int sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
char *strerror(int);
int main(int argc, char **argv) {
  int with_incr, incr, ind, prior, with_n, which, ret;
  id_t who;
  struct passwd *p;
  if (argc == 1) {
    return -EINVAL;
  }
  ret = 0;
  which = PRIO_PROCESS;
  with_incr = incr = with_n = 0;
  for (ind = 1; ind < argc; ++ind) {
    if (strcmp(argv[ind], "-h") == 0) {
      printf("Usage: %s [-n] priority [[-p] pid ...] [[-g] pgrp ...] [[-u] "
             "user ...]\n",
             argv[0]);
      return 0;
    } else if (strcmp(argv[ind], "-n") == 0) {
      if (with_n) {
        return -EINVAL;
      }
      with_n = 1;
    } else if (strcmp(argv[ind], "-p") == 0) {
      which = PRIO_PROCESS;
    } else if (strcmp(argv[ind], "-g") == 0) {
      which = PRIO_PGRP;
    } else if (strcmp(argv[ind], "-u") == 0) {
      which = PRIO_USER;
    } else {
      if (!with_incr) {
        if (sscanf(argv[ind], "%d", &incr) != 1) {
          return -EINVAL;
        }
        with_incr = 1;
        continue;
      }
      if (which == PRIO_USER) {
        p = getpwnam(argv[ind]);
        if (p == NULL) {
          printf("%s: unknown user '%s`\n", argv[0], argv[ind]);
          ret = -errno;
          continue;
        }
        who = p->pw_uid;
      } else {
        if (sscanf(argv[ind], "%d", &who) != 1) {
          printf("%s: bad value '%s`\n", argv[0], argv[ind]);
          ret = -EINVAL;
          continue;
        }
      }
      if (with_n) {
        errno = 0;
        prior = getpriority(which, who);
        if ((prior == -1) && (errno != 0)) {
          return -errno;
        }
        prior += incr;
      } else {
        prior = incr;
      }
      if (-1 == setpriority(which, who, prior)) {
        printf("%s: failed to set priority for %d (%s): %s\n", argv[0], who,
               which == PRIO_PROCESS ? "process ID"
               : which == PRIO_PGRP  ? "process group ID"
                                     : "user ID",
               strerror(errno));
        ret = -errno;
      }
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11a3 <main+0x33>
xor    %eax,%eax
mov    0x2e2f(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1571 <main+0x401>
movl   $0x0,-0x2c(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    156b <main+0x3fb>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1221 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1571 <main+0x401>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe17(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    126c <main+0xfc>
cmpl   $0x0,-0x24(%rbp)
je     1260 <main+0xf0>
xor    %eax,%eax
mov    0x2d72(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1571 <main+0x401>
movl   $0x1,-0x24(%rbp)
jmp    1553 <main+0x3e3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdcf(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    129f <main+0x12f>
mov    0x2d43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    154e <main+0x3de>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd9f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12d2 <main+0x162>
mov    0x2cf8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    1549 <main+0x3d9>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd6f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1305 <main+0x195>
mov    0x2ced(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    1544 <main+0x3d4>
cmpl   $0x0,-0x14(%rbp)
jne    1353 <main+0x1e3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd35(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
je     1347 <main+0x1d7>
xor    %eax,%eax
mov    0x2c8b(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1571 <main+0x401>
movl   $0x1,-0x14(%rbp)
jmp    155d <main+0x3ed>
mov    -0x28(%rbp),%eax
mov    0x2c8b(%rip),%rcx
cmp    (%rcx),%eax
jne    13c7 <main+0x257>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <getpwnam@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    13b9 <main+0x249>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xcbb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    0x2c21(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x2c(%rbp)
jmp    155d <main+0x3ed>
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
jmp    1425 <main+0x2b5>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc7d(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
je     1420 <main+0x2b0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    0x2bb2(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x2c(%rbp)
jmp    155d <main+0x3ed>
jmp    1425 <main+0x2b5>
cmpl   $0x0,-0x24(%rbp)
je     1485 <main+0x315>
mov    0x2b9a(%rip),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1030 <getpriority@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1477 <main+0x307>
mov    0x2b75(%rip),%rax
cmpl   $0x0,(%rax)
je     1477 <main+0x307>
xor    %eax,%eax
mov    0x2b63(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1571 <main+0x401>
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    148b <main+0x31b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <setpriority@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    153f <main+0x3cf>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2b15(%rip),%rcx
cmp    (%rcx),%eax
jne    14db <main+0x36b>
lea    0xbdf(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    14ff <main+0x38f>
mov    -0x28(%rbp),%edx
mov    0x2adb(%rip),%rax
mov    (%rax),%esi
lea    0xbdf(%rip),%rax
lea    0xbc7(%rip),%rcx
cmp    %esi,%edx
cmove  %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2ac2(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x48(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    %rax,%r8
lea    0xb5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    0x2a96(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x2c(%rbp)
jmp    1544 <main+0x3d4>
jmp    1549 <main+0x3d9>
jmp    154e <main+0x3de>
jmp    1553 <main+0x3e3>
jmp    1558 <main+0x3e8>
jmp    155d <main+0x3ed>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d2 <main+0x62>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x1,%edi
jne    1195 <main+0x25>
mov    0x2e3e(%rip),%rax
xor    %r13d,%r13d
sub    (%rax),%r13d
jmp    1449 <main+0x2d9>
mov    0x2e3c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
movl   $0x0,0x14(%rsp)
xor    %r13d,%r13d
cmp    $0x2,%edi
jl     1449 <main+0x2d9>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x1,%r15d
mov    0x2e07(%rip),%rbp
xor    %r13d,%r13d
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
jmp    11fc <main+0x8c>
nopl   0x0(%rax)
test   %r14d,%r14d
mov    $0x1,%r14d
jne    145b <main+0x2eb>
add    $0x1,%r15
cmp    %r15,%r12
je     1449 <main+0x2d9>
mov    (%rbx,%r15,8),%rdi
lea    0xdf9(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1435 <main+0x2c5>
mov    (%rbx,%r15,8),%rdi
lea    0xe2b(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11e0 <main+0x70>
mov    (%rbx,%r15,8),%rdi
lea    0xe19(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12a0 <main+0x130>
mov    (%rbx,%r15,8),%rdi
lea    0xe07(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12a9 <main+0x139>
mov    (%rbx,%r15,8),%rdi
lea    0xdf5(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12b2 <main+0x142>
cmpl   $0x0,0xc(%rsp)
je     12cb <main+0x15b>
mov    (%rbx,%r15,8),%rdi
mov    0x2d6d(%rip),%rax
mov    0x8(%rsp),%ecx
cmp    (%rax),%ecx
jne    12f6 <main+0x186>
call   1070 <getpwnam@plt>
test   %rax,%rax
je     140c <main+0x29c>
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
jmp    130c <main+0x19c>
nopl   0x0(%rax)
mov    0x2d31(%rip),%rax
jmp    12c0 <main+0x150>
mov    0x2d10(%rip),%rax
jmp    12c0 <main+0x150>
mov    0x2d2f(%rip),%rax
nopl   0x0(%rax)
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
jmp    11ef <main+0x7f>
mov    (%rbx,%r15,8),%rdi
lea    0xd81(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1080 <sscanf@plt>
movl   $0x1,0xc(%rsp)
cmp    $0x1,%eax
je     11ef <main+0x7f>
jmp    145b <main+0x2eb>
lea    0xd5a(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1348 <main+0x1d8>
test   %r14d,%r14d
mov    %r12,0x18(%rsp)
je     1377 <main+0x207>
movl   $0x0,0x0(%rbp)
mov    0x10(%rsp),%esi
mov    0x8(%rsp),%edi
call   1030 <getpriority@plt>
mov    %eax,%edx
cmp    $0xffffffff,%eax
jne    1342 <main+0x1d2>
mov    0x2c98(%rip),%rax
mov    (%rax),%eax
test   %eax,%eax
jne    146a <main+0x2fa>
add    0x14(%rsp),%edx
jmp    137b <main+0x20b>
mov    (%rbx),%rsi
mov    (%rbx,%r15,8),%rdx
lea    0xd1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %r13d,%r13d
mov    0x2c61(%rip),%rax
sub    (%rax),%r13d
movl   $0x1,0xc(%rsp)
jmp    11ef <main+0x7f>
mov    0x14(%rsp),%edx
mov    0x8(%rsp),%r12d
mov    0x10(%rsp),%esi
mov    %r12d,%edi
call   1050 <setpriority@plt>
movl   $0x1,0xc(%rsp)
cmp    $0xffffffff,%eax
jne    1402 <main+0x292>
mov    (%rbx),%rax
mov    %rax,0x20(%rsp)
mov    0x2c18(%rip),%rax
cmp    (%rax),%r12d
lea    0xd1b(%rip),%r13
lea    0xd03(%rip),%rax
cmove  %rax,%r13
mov    0x2c14(%rip),%rax
cmp    (%rax),%r12d
mov    0x10(%rsp),%r12d
lea    0xcde(%rip),%rax
cmove  %rax,%r13
mov    0x0(%rbp),%edi
call   1090 <strerror@plt>
lea    0xc9f(%rip),%rdi
mov    0x20(%rsp),%rsi
mov    %r12d,%edx
mov    %r13,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1040 <printf@plt>
xor    %r13d,%r13d
sub    0x0(%rbp),%r13d
mov    0x18(%rsp),%r12
jmp    11ef <main+0x7f>
mov    (%rbx),%rsi
mov    (%rbx,%r15,8),%rdx
lea    0xc40(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %r13d,%r13d
sub    0x0(%rbp),%r13d
movl   $0x1,0xc(%rsp)
jmp    11ef <main+0x7f>
mov    (%rbx),%rsi
lea    0xbc4(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
mov    0x2b63(%rip),%rax
jmp    118d <main+0x1d>
neg    %eax
mov    %eax,%r13d
jmp    1449 <main+0x2d9>

LLVM IR (-O0):
%struct.passwd = type { i32 }
@EINVAL = global i32 0
@PRIO_PROCESS = global i32 0
@.str = [3 x i8] c"-h\00"
@.str.1 = [72 x i8] c"Usage: %s [-n] priority [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]\0A\00"
@.str.2 = [3 x i8] c"-n\00"
@.str.3 = [3 x i8] c"-p\00"
@.str.4 = [3 x i8] c"-g\00"
@PRIO_PGRP = global i32 0
@.str.5 = [3 x i8] c"-u\00"
@PRIO_USER = global i32 0
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [23 x i8] c"%s: unknown user '%s`\0A\00"
@errno = global i32 0
@.str.8 = [20 x i8] c"%s: bad value '%s`\0A\00"
@.str.9 = [44 x i8] c"%s: failed to set priority for %d (%s): %s\0A\00"
@.str.10 = [11 x i8] c"process ID\00"
@.str.11 = [17 x i8] c"process group ID\00"
@.str.12 = [8 x i8] c"user ID\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.passwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* @EINVAL
%19 = sub nsw i32 0, %18
store i32 %19, i32* %3
br label %209
20: ; preds = %2
store i32 0, i32* %12
%21 = load i32, i32* @PRIO_PROCESS
store i32 %21, i32* %11
store i32 0, i32* %10
store i32 0, i32* %7
store i32 0, i32* %6
store i32 1, i32* %8
br label %22
22: ; preds = %204, %20
%23 = load i32, i32* %8
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %207
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %26
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i8* %37)
store i32 0, i32* %3
br label %209
39: ; preds = %26
%40 = load i8**, i8*** %5
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %54
47: ; preds = %39
%48 = load i32, i32* %10
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* @EINVAL
%52 = sub nsw i32 0, %51
store i32 %52, i32* %3
br label %209
53: ; preds = %47
store i32 1, i32* %10
br label %202
54: ; preds = %39
%55 = load i8**, i8*** %5
%56 = load i32, i32* %8
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %54
%63 = load i32, i32* @PRIO_PROCESS
store i32 %63, i32* %11
br label %201
64: ; preds = %54
%65 = load i8**, i8*** %5
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %64
%73 = load i32, i32* @PRIO_PGRP
store i32 %73, i32* %11
br label %200
74: ; preds = %64
%75 = load i8**, i8*** %5
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8*, i8** %75, i64 %77
%79 = load i8*, i8** %78
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %74
%83 = load i32, i32* @PRIO_USER
store i32 %83, i32* %11
br label %199
84: ; preds = %74
%85 = load i32, i32* %6
%86 = icmp ne i32 %85, 0
br i1 %86, label %99, label %87
87: ; preds = %84
%88 = load i8**, i8*** %5
%89 = load i32, i32* %8
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8*, i8** %88, i64 %90
%92 = load i8*, i8** %91
%93 = call i32 @sscanf(i8* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%94 = icmp ne i32 %93, 1
br i1 %94, label %95, label %98
95: ; preds = %87
%96 = load i32, i32* @EINVAL
%97 = sub nsw i32 0, %96
store i32 %97, i32* %3
br label %209
98: ; preds = %87
store i32 1, i32* %6
br label %204
99: ; preds = %84
%100 = load i32, i32* %11
%101 = load i32, i32* @PRIO_USER
%102 = icmp eq i32 %100, %101
br i1 %102, label %103, label %128
103: ; preds = %99
%104 = load i8**, i8*** %5
%105 = load i32, i32* %8
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8*, i8** %104, i64 %106
%108 = load i8*, i8** %107
%109 = call %struct.passwd* @getpwnam(i8* %108)
store %struct.passwd* %109, %struct.passwd** %14
%110 = load %struct.passwd*, %struct.passwd** %14
%111 = icmp eq %struct.passwd* %110, null
br i1 %111, label %112, label %124
112: ; preds = %103
%113 = load i8**, i8*** %5
%114 = getelementptr inbounds i8*, i8** %113, i64 0
%115 = load i8*, i8** %114
%116 = load i8**, i8*** %5
%117 = load i32, i32* %8
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8*, i8** %116, i64 %118
%120 = load i8*, i8** %119
%121 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %115, i8* %120)
%122 = load i32, i32* @errno
%123 = sub nsw i32 0, %122
store i32 %123, i32* %12
br label %204
124: ; preds = %103
%125 = load %struct.passwd*, %struct.passwd** %14
%126 = getelementptr inbounds %struct.passwd, %struct.passwd* %125, i32 0, i32 0
%127 = load i32, i32* %126
store i32 %127, i32* %13
br label %149
128: ; preds = %99
%129 = load i8**, i8*** %5
%130 = load i32, i32* %8
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8*, i8** %129, i64 %131
%133 = load i8*, i8** %132
%134 = call i32 @sscanf(i8* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %13)
%135 = icmp ne i32 %134, 1
br i1 %135, label %136, label %148
136: ; preds = %128
%137 = load i8**, i8*** %5
%138 = getelementptr inbounds i8*, i8** %137, i64 0
%139 = load i8*, i8** %138
%140 = load i8**, i8*** %5
%141 = load i32, i32* %8
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i8*, i8** %140, i64 %142
%144 = load i8*, i8** %143
%145 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %139, i8* %144)
%146 = load i32, i32* @EINVAL
%147 = sub nsw i32 0, %146
store i32 %147, i32* %12
br label %204
148: ; preds = %128
br label %149
149: ; preds = %148, %124
%150 = load i32, i32* %10
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %168
152: ; preds = %149
store i32 0, i32* @errno
%153 = load i32, i32* %11
%154 = load i32, i32* %13
%155 = call i32 @getpriority(i32 %153, i32 %154)
store i32 %155, i32* %9
%156 = load i32, i32* %9
%157 = icmp eq i32 %156, -1
br i1 %157, label %158, label %164
158: ; preds = %152
%159 = load i32, i32* @errno
%160 = icmp ne i32 %159, 0
br i1 %160, label %161, label %164
161: ; preds = %158
%162 = load i32, i32* @errno
%163 = sub nsw i32 0, %162
store i32 %163, i32* %3
br label %209
164: ; preds = %158, %152
%165 = load i32, i32* %7
%166 = load i32, i32* %9
%167 = add nsw i32 %166, %165
store i32 %167, i32* %9
br label %170
168: ; preds = %149
%169 = load i32, i32* %7
store i32 %169, i32* %9
br label %170
170: ; preds = %168, %164
%171 = load i32, i32* %11
%172 = load i32, i32* %13
%173 = load i32, i32* %9
%174 = call i32 @setpriority(i32 %171, i32 %172, i32 %173)
%175 = icmp eq i32 -1, %174
br i1 %175, label %176, label %198
176: ; preds = %170
%177 = load i8**, i8*** %5
%178 = getelementptr inbounds i8*, i8** %177, i64 0
%179 = load i8*, i8** %178
%180 = load i32, i32* %13
%181 = load i32, i32* %11
%182 = load i32, i32* @PRIO_PROCESS
%183 = icmp eq i32 %181, %182
br i1 %183, label %184, label %185
184: ; preds = %176
br label %191
185: ; preds = %176
%186 = load i32, i32* %11
%187 = load i32, i32* @PRIO_PGRP
%188 = icmp eq i32 %186, %187
%189 = zext i1 %188 to i64
%190 = select i1 %188, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0)
br label %191
191: ; preds = %185, %184
%192 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %184 ], [ %190, %185 ]
%193 = load i32, i32* @errno
%194 = call i8* @strerror(i32 %193)
%195 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0), i8* %179, i32 %180, i8* %192, i8* %194)
%196 = load i32, i32* @errno
%197 = sub nsw i32 0, %196
store i32 %197, i32* %12
br label %198
198: ; preds = %191, %170
br label %199
199: ; preds = %198, %82
br label %200
200: ; preds = %199, %72
br label %201
201: ; preds = %200, %62
br label %202
202: ; preds = %201, %53
br label %203
203: ; preds = %202
br label %204
204: ; preds = %203, %136, %112, %98
%205 = load i32, i32* %8
%206 = add nsw i32 %205, 1
store i32 %206, i32* %8
br label %22
207: ; preds = %22
%208 = load i32, i32* %12
store i32 %208, i32* %3
br label %209
209: ; preds = %207, %161, %95, %50, %34, %17
%210 = load i32, i32* %3
ret i32 %210
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@EINVAL = global i32 0
@PRIO_PROCESS = global i32 0
@.str = [3 x i8] c"-h\00"
@.str.1 = [72 x i8] c"Usage: %s [-n] priority [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]\0A\00"
@.str.2 = [3 x i8] c"-n\00"
@.str.3 = [3 x i8] c"-p\00"
@.str.4 = [3 x i8] c"-g\00"
@PRIO_PGRP = global i32 0
@.str.5 = [3 x i8] c"-u\00"
@PRIO_USER = global i32 0
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [23 x i8] c"%s: unknown user '%s`\0A\00"
@errno = global i32 0
@.str.8 = [20 x i8] c"%s: bad value '%s`\0A\00"
@.str.9 = [44 x i8] c"%s: failed to set priority for %d (%s): %s\0A\00"
@.str.10 = [11 x i8] c"process ID\00"
@.str.11 = [17 x i8] c"process group ID\00"
@.str.12 = [8 x i8] c"user ID\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @EINVAL
%10 = sub nsw i32 0, %9
br label %132
11: ; preds = %2
%12 = load i32, i32* @PRIO_PROCESS
store i32 0, i32* %3
%13 = icmp sgt i32 %0, 1
br i1 %13, label %14, label %132
14: ; preds = %11
%15 = zext i32 %0 to i64
br label %16
16: ; preds = %14, %125
%17 = phi i64 [ 1, %14 ], [ %130, %125 ]
%18 = phi i32 [ 0, %14 ], [ %129, %125 ]
%19 = phi i32 [ %12, %14 ], [ %128, %125 ]
%20 = phi i32 [ 0, %14 ], [ %127, %125 ]
%21 = phi i32 [ 0, %14 ], [ %126, %125 ]
%22 = getelementptr inbounds i8*, i8** %1, i64 %17
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %16
%27 = load i8*, i8** %1
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %132
29: ; preds = %16
%30 = load i8*, i8** %22
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = icmp eq i32 %20, 0
br i1 %34, label %125, label %35
35: ; preds = %33
%36 = load i32, i32* @EINVAL
%37 = sub nsw i32 0, %36
br label %132
38: ; preds = %29
%39 = load i8*, i8** %22
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = load i32, i32* @PRIO_PROCESS
br label %125
44: ; preds = %38
%45 = load i8*, i8** %22
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = load i32, i32* @PRIO_PGRP
br label %125
50: ; preds = %44
%51 = load i8*, i8** %22
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = load i32, i32* @PRIO_USER
br label %125
56: ; preds = %50
%57 = icmp eq i32 %21, 0
br i1 %57, label %58, label %65
58: ; preds = %56
%59 = load i8*, i8** %22
%60 = call i32 @sscanf(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%61 = icmp eq i32 %60, 1
br i1 %61, label %125, label %62
62: ; preds = %58
%63 = load i32, i32* @EINVAL
%64 = sub nsw i32 0, %63
br label %132
65: ; preds = %56
%66 = load i32, i32* @PRIO_USER
%67 = icmp eq i32 %19, %66
%68 = load i8*, i8** %22
br i1 %67, label %69, label %81
69: ; preds = %65
%70 = call %struct.passwd* @getpwnam(i8* %68)
%71 = icmp eq %struct.passwd* %70, null
br i1 %71, label %72, label %78
72: ; preds = %69
%73 = load i8*, i8** %1
%74 = load i8*, i8** %22
%75 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %73, i8* %74)
%76 = load i32, i32* @errno
%77 = sub nsw i32 0, %76
br label %125
78: ; preds = %69
%79 = getelementptr inbounds %struct.passwd, %struct.passwd* %70, i64 0, i32 0
%80 = load i32, i32* %79
store i32 %80, i32* %4
br label %90
81: ; preds = %65
%82 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%83 = icmp eq i32 %82, 1
br i1 %83, label %90, label %84
84: ; preds = %81
%85 = load i8*, i8** %1
%86 = load i8*, i8** %22
%87 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %85, i8* %86)
%88 = load i32, i32* @EINVAL
%89 = sub nsw i32 0, %88
br label %125
90: ; preds = %81, %78
%91 = icmp eq i32 %20, 0
br i1 %91, label %104, label %92
92: ; preds = %90
store i32 0, i32* @errno
%93 = load i32, i32* %4
%94 = call i32 @getpriority(i32 %19, i32 %93)
%95 = icmp eq i32 %94, -1
%96 = load i32, i32* @errno
%97 = icmp ne i32 %96, 0
%98 = select i1 %95, i1 %97, i1 false
br i1 %98, label %99, label %101
99: ; preds = %92
%100 = sub nsw i32 0, %96
br label %132
101: ; preds = %92
%102 = load i32, i32* %3
%103 = add nsw i32 %102, %94
br label %106
104: ; preds = %90
%105 = load i32, i32* %3
br label %106
106: ; preds = %104, %101
%107 = phi i32 [ %103, %101 ], [ %105, %104 ]
%108 = load i32, i32* %4
%109 = call i32 @setpriority(i32 %19, i32 %108, i32 %107)
%110 = icmp eq i32 %109, -1
br i1 %110, label %111, label %125
111: ; preds = %106
%112 = load i8*, i8** %1
%113 = load i32, i32* %4
%114 = load i32, i32* @PRIO_PROCESS
%115 = icmp eq i32 %19, %114
%116 = load i32, i32* @PRIO_PGRP
%117 = icmp eq i32 %19, %116
%118 = select i1 %117, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0)
%119 = select i1 %115, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i8* %118
%120 = load i32, i32* @errno
%121 = call i8* @strerror(i32 %120)
%122 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0), i8* %112, i32 %113, i8* %119, i8* %121)
%123 = load i32, i32* @errno
%124 = sub nsw i32 0, %123
br label %125
125: ; preds = %58, %33, %42, %54, %111, %106, %48, %84, %72
%126 = phi i32 [ %21, %42 ], [ %21, %48 ], [ %21, %54 ], [ 1, %72 ], [ 1, %111 ], [ 1, %106 ], [ 1, %84 ], [ %21, %33 ], [ 1, %58 ]
%127 = phi i32 [ %20, %42 ], [ %20, %48 ], [ %20, %54 ], [ %20, %72 ], [ %20, %111 ], [ %20, %106 ], [ %20, %84 ], [ 1, %33 ], [ %20, %58 ]
%128 = phi i32 [ %43, %42 ], [ %49, %48 ], [ %55, %54 ], [ %19, %72 ], [ %19, %111 ], [ %19, %106 ], [ %19, %84 ], [ %19, %33 ], [ %19, %58 ]
%129 = phi i32 [ %18, %42 ], [ %18, %48 ], [ %18, %54 ], [ %77, %72 ], [ %124, %111 ], [ %18, %106 ], [ %89, %84 ], [ %18, %33 ], [ %18, %58 ]
%130 = add nuw nsw i64 %17, 1
%131 = icmp eq i64 %130, %15
br i1 %131, label %132, label %16
132: ; preds = %125, %11, %99, %62, %35, %26, %8
%133 = phi i32 [ %10, %8 ], [ 0, %26 ], [ %37, %35 ], [ %100, %99 ], [ %64, %62 ], [ 0, %11 ], [ %129, %125 ]
ret i32 %133
}