#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 */
scalar_t__ _nice(int, char **);
int _usage();
int getopt(int, char **, char *);
char *optarg;
int optind;
int strtol(char *, char **, int);
int main(int argc, char *argv[]) {
  int nice = 0;
  int o;
  char *p;
  while ((o = getopt(argc, argv, "n:")) != -1)
    switch (o) {
    case 'n':
      nice = strtol(optarg, &p, 10);
      if (*optarg == '\0' || *p != '\0')
        return _usage();
      break;
    default:
      return _usage();
    }
  if (argc - optind < 1)
    return _usage();
  return (_nice(nice, &argv[optind]) == 0) ? 0 : 2;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe95(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     11f6 <main+0xb6>
mov    -0x18(%rbp),%eax
sub    $0x6e,%eax
jne    11e2 <main+0xa2>
jmp    118d <main+0x4d>
mov    0x2e64(%rip),%rax
mov    (%rax),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e49(%rip),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ce <main+0x8e>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11dd <main+0x9d>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    124b <main+0x10b>
jmp    11f1 <main+0xb1>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    124b <main+0x10b>
jmp    115d <main+0x1d>
mov    -0x8(%rbp),%eax
mov    0x2de0(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
jge    121a <main+0xda>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    124b <main+0x10b>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2db8(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1040 <_nice@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r13d
xor    %ebx,%ebx
lea    0xea6(%rip),%r15
mov    0x2e97(%rip),%rbp
mov    %rsp,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13d,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0x6e,%eax
jne    11aa <main+0x6a>
mov    0x0(%rbp),%rdi
mov    %r12,%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebx
mov    0x0(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e4 <main+0xa4>
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     1170 <main+0x30>
jmp    11e4 <main+0xa4>
cmp    $0xffffffff,%eax
jne    11e4 <main+0xa4>
mov    0x2e2a(%rip),%rax
movslq (%rax),%rax
cmp    %r13d,%eax
jge    11e4 <main+0xa4>
lea    (%r14,%rax,8),%rsi
mov    %ebx,%edi
call   1040 <_nice@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <_usage@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"n:\00"
@optarg = global i8* null
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %33, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %7
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %34
14: ; preds = %9
%15 = load i32, i32* %7
switch i32 %15, label %31 [
i32 110, label %16
]
16: ; preds = %14
%17 = load i8*, i8** @optarg
%18 = call i32 @strtol(i8* %17, i8** %8, i32 10)
store i32 %18, i32* %6
%19 = load i8*, i8** @optarg
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %16
%24 = load i8*, i8** %8
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23, %16
%29 = call i32 (...) @_usage()
store i32 %29, i32* %3
br label %51
30: ; preds = %23
br label %33
31: ; preds = %14
%32 = call i32 (...) @_usage()
store i32 %32, i32* %3
br label %51
33: ; preds = %30
br label %9
34: ; preds = %9
%35 = load i32, i32* %4
%36 = load i32, i32* @optind
%37 = sub nsw i32 %35, %36
%38 = icmp slt i32 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 (...) @_usage()
store i32 %40, i32* %3
br label %51
41: ; preds = %34
%42 = load i32, i32* %6
%43 = load i8**, i8*** %5
%44 = load i32, i32* @optind
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = call i64 @_nice(i32 %42, i8** %46)
%48 = icmp eq i64 %47, 0
%49 = zext i1 %48 to i64
%50 = select i1 %48, i32 0, i32 2
store i32 %50, i32* %3
br label %51
51: ; preds = %41, %39, %31, %28
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [3 x i8] c"n:\00"
@optarg = global i8* null
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
br label %5
5: ; preds = %14, %2
%6 = phi i32 [ 0, %2 ], [ %10, %14 ]
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %20 [
i32 -1, label %22
i32 110, label %8
]
8: ; preds = %5
%9 = load i8*, i8** @optarg
%10 = call i32 @strtol(i8* %9, i8** %3, i32 10)
%11 = load i8*, i8** @optarg
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %5, label %18
18: ; preds = %14, %8
%19 = tail call i32 (...) @_usage()
br label %33
20: ; preds = %5
%21 = tail call i32 (...) @_usage()
br label %33
22: ; preds = %5
%23 = load i32, i32* @optind
%24 = icmp slt i32 %23, %0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i32 (...) @_usage()
br label %33
27: ; preds = %22
%28 = sext i32 %23 to i64
%29 = getelementptr inbounds i8*, i8** %1, i64 %28
%30 = tail call i64 @_nice(i32 %6, i8** %29)
%31 = icmp eq i64 %30, 0
%32 = select i1 %31, i32 0, i32 2
br label %33
33: ; preds = %27, %25, %20, %18
%34 = phi i32 [ %19, %18 ], [ %21, %20 ], [ %26, %25 ], [ %32, %27 ]
ret i32 %34
}