#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 */
typedef int u_int;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
scalar_t__ optind;
int /*<<< orphan*/ print_uname(int);
int /*<<< orphan*/ setup_get();
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  u_int flags;
  int ch;
  setup_get();
  flags = 0;
  while ((ch = getopt(argc, argv, "aimnoprsv")) != -1)
    switch (ch) {
    case 'a':
      flags |= (0x01 | 0x02 | 0x08 | 0x10 | 0x20);
      break;
    case 'i':
      flags |= 0x40;
      break;
    case 'm':
      flags |= 0x01;
      break;
    case 'n':
      flags |= 0x02;
      break;
    case 'p':
      flags |= 0x04;
      break;
    case 'r':
      flags |= 0x08;
      break;
    case 's':
    case 'o':
      flags |= 0x10;
      break;
    case 'v':
      flags |= 0x20;
      break;
    case '?':
    default:
      usage();
    }
  argc -= optind;
  argv += optind;
  if (argc)
    usage();
  if (!flags)
    flags |= 0x10;
  print_uname(flags);
  exit(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    $0x0,%al
call   1030 <setup_get@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf5e(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     123d <main+0xed>
mov    -0x18(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x37,%eax
ja     1231 <main+0xe1>
mov    -0x20(%rbp),%rax
lea    0xe4d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
or     $0x3b,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
mov    -0x14(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x14(%rbp)
jmp    1238 <main+0xe8>
jmp    1231 <main+0xe1>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    1174 <main+0x24>
mov    0x2da4(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2d90(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1278 <main+0x128>
mov    $0x0,%al
call   1050 <usage@plt>
cmpl   $0x0,-0x14(%rbp)
jne    128b <main+0x13b>
mov    -0x14(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <print_uname@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%r15d
xor    %eax,%eax
call   1030 <setup_get@plt>
lea    0xeec(%rip),%r14
lea    0xe8d(%rip),%rbx
xor    %ebp,%ebp
jmp    1180 <main+0x30>
or     $0x20,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
lea    -0x61(%rax),%ecx
cmp    $0x15,%ecx
ja     11c2 <main+0x72>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
or     $0x10,%ebp
jmp    1180 <main+0x30>
or     $0x3b,%ebp
jmp    1180 <main+0x30>
or     $0x40,%ebp
jmp    1180 <main+0x30>
or     $0x1,%ebp
jmp    1180 <main+0x30>
or     $0x2,%ebp
jmp    1180 <main+0x30>
or     $0x4,%ebp
jmp    1180 <main+0x30>
or     $0x8,%ebp
jmp    1180 <main+0x30>
cmp    $0xffffffff,%eax
je     11d0 <main+0x80>
xor    %eax,%eax
call   1050 <usage@plt>
jmp    1180 <main+0x30>
mov    0x2e11(%rip),%rax
cmp    %r15d,(%rax)
je     11e3 <main+0x93>
xor    %eax,%eax
call   1050 <usage@plt>
test   %ebp,%ebp
mov    $0x10,%edi
cmovne %ebp,%edi
call   1040 <print_uname@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"aimnoprsv\00"
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @setup_get()
store i32 0, i32* %6
br label %9
9: ; preds = %43, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %7
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %44
14: ; preds = %9
%15 = load i32, i32* %7
switch i32 %15, label %41 [
i32 97, label %16
i32 105, label %19
i32 109, label %22
i32 110, label %25
i32 112, label %28
i32 114, label %31
i32 115, label %34
i32 111, label %34
i32 118, label %37
i32 63, label %40
]
16: ; preds = %14
%17 = load i32, i32* %6
%18 = or i32 %17, 59
store i32 %18, i32* %6
br label %43
19: ; preds = %14
%20 = load i32, i32* %6
%21 = or i32 %20, 64
store i32 %21, i32* %6
br label %43
22: ; preds = %14
%23 = load i32, i32* %6
%24 = or i32 %23, 1
store i32 %24, i32* %6
br label %43
25: ; preds = %14
%26 = load i32, i32* %6
%27 = or i32 %26, 2
store i32 %27, i32* %6
br label %43
28: ; preds = %14
%29 = load i32, i32* %6
%30 = or i32 %29, 4
store i32 %30, i32* %6
br label %43
31: ; preds = %14
%32 = load i32, i32* %6
%33 = or i32 %32, 8
store i32 %33, i32* %6
br label %43
34: ; preds = %14, %14
%35 = load i32, i32* %6
%36 = or i32 %35, 16
store i32 %36, i32* %6
br label %43
37: ; preds = %14
%38 = load i32, i32* %6
%39 = or i32 %38, 32
store i32 %39, i32* %6
br label %43
40: ; preds = %14
br label %41
41: ; preds = %14, %40
%42 = call i32 (...) @usage()
br label %43
43: ; preds = %41, %37, %34, %31, %28, %25, %22, %19, %16
br label %9
44: ; preds = %9
%45 = load i64, i64* @optind
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = sub nsw i64 %47, %45
%49 = trunc i64 %48 to i32
store i32 %49, i32* %4
%50 = load i64, i64* @optind
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 %50
store i8** %52, i8*** %5
%53 = load i32, i32* %4
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %44
%56 = call i32 (...) @usage()
br label %57
57: ; preds = %55, %44
%58 = load i32, i32* %6
%59 = icmp ne i32 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i32, i32* %6
%62 = or i32 %61, 16
store i32 %62, i32* %6
br label %63
63: ; preds = %60, %57
%64 = load i32, i32* %6
%65 = call i32 @print_uname(i32 %64)
%66 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"aimnoprsv\00"
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @setup_get()
br label %4
4: ; preds = %25, %2
%5 = phi i32 [ 0, %2 ], [ %26, %25 ]
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %23 [
i32 -1, label %27
i32 97, label %7
i32 105, label %9
i32 109, label %11
i32 110, label %13
i32 112, label %15
i32 114, label %17
i32 115, label %19
i32 111, label %19
i32 118, label %21
]
7: ; preds = %4
%8 = or i32 %5, 59
br label %25
9: ; preds = %4
%10 = or i32 %5, 64
br label %25
11: ; preds = %4
%12 = or i32 %5, 1
br label %25
13: ; preds = %4
%14 = or i32 %5, 2
br label %25
15: ; preds = %4
%16 = or i32 %5, 4
br label %25
17: ; preds = %4
%18 = or i32 %5, 8
br label %25
19: ; preds = %4, %4
%20 = or i32 %5, 16
br label %25
21: ; preds = %4
%22 = or i32 %5, 32
br label %25
23: ; preds = %4
%24 = tail call i32 (...) @usage()
br label %25
25: ; preds = %23, %21, %19, %17, %15, %13, %11, %9, %7
%26 = phi i32 [ %5, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ]
br label %4
27: ; preds = %4
%28 = load i64, i64* @optind
%29 = trunc i64 %28 to i32
%30 = icmp eq i32 %29, %0
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = tail call i32 (...) @usage()
br label %33
33: ; preds = %31, %27
%34 = icmp eq i32 %5, 0
%35 = select i1 %34, i32 16, i32 %5
%36 = tail call i32 @print_uname(i32 %35)
%37 = tail call i32 @exit(i32 0)
unreachable
}