#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 utsname {
  int /*<<< orphan*/ machine;
  int /*<<< orphan*/ version;
  int /*<<< orphan*/ release;
  int /*<<< orphan*/ nodename;
  int /*<<< orphan*/ sysname;
};

/* Variables and functions */
scalar_t__ bu_handle_version(int, char **);
int /*<<< orphan*/ bu_invalid_argument(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ has_arg(int, char **, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdout;
size_t strlen(char *);
int uname(struct utsname *);
int main(int argc, char **argv) {
  if (has_arg(argc, argv, "-h") || has_arg(argc, argv, "--help")) {
    puts("Usage: uname [-amnrsv]");
    puts("Prints system information.");
    puts("-a   Equivalent to -mnrsv");
    puts("-m   Print hardware type");
    puts("-n   Print network hostname");
    puts("-r   Print operating system release");
    puts("-s   Print the kernel name");
    puts("-v   Print the version of the installed operating system release");
    return 1;
  }
  if (bu_handle_version(argc, argv)) {
    return 0;
  }
  int dash_m = 0;
  int dash_n = 0;
  int dash_r = 0;
  int dash_s = 0;
  int dash_v = 0;
  if (argc == 1) {
    dash_s = 1;
  }
  int i = 1;
  for (; i < argc; i++) {
    if (argv[i][0] != '-') {
      bu_invalid_argument(argv[0], argv[i]);
      return 1;
    }
    for (size_t j = 1; j < strlen(argv[i]); j++) {
      char flag = argv[i][j];
      if (flag == 'a') {
        dash_m = 1;
        dash_n = 1;
        dash_r = 1;
        dash_s = 1;
        dash_v = 1;
      } else if (flag == 'm') {
        dash_m = 1;
      } else if (flag == 'n') {
        dash_n = 1;
      } else if (flag == 'r') {
        dash_r = 1;
      } else if (flag == 's') {
        dash_s = 1;
      } else if (flag == 'v') {
        dash_v = 1;
      } else {
        char bad_flag_msg[17] = "unknown flag: -X";
        bad_flag_msg[15] = flag;
        bu_invalid_argument(argv[0], bad_flag_msg);
        return 1;
      }
    }
  }
  int remaining = dash_m + dash_n + dash_r + dash_s + dash_v;
  struct utsname name;
  if (uname(&name) == -1) {
    perror(argv[0]);
    return 1;
  }
  if (dash_s) {
    fputs(name.sysname, stdout);
    if (remaining > 1) {
      fputc(' ', stdout);
    }
    remaining--;
  }
  if (dash_n) {
    fputs(name.nodename, stdout);
    if (remaining > 1) {
      fputc(' ', stdout);
    }
    remaining--;
  }
  if (dash_r) {
    fputs(name.release, stdout);
    if (remaining > 1) {
      fputc(' ', stdout);
    }
    remaining--;
  }
  if (dash_v) {
    fputs(name.version, stdout);
    if (remaining > 1) {
      fputc(' ', stdout);
    }
    remaining--;
  }
  if (dash_m) {
    fputs(name.machine, stdout);
    if (remaining > 1) {
      fputc(' ', stdout);
    }
    remaining--;
  }
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe4c(%rip),%rdx
call   1040 <has_arg@plt>
cmp    $0x0,%rax
jne    11e0 <main+0x50>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe32(%rip),%rdx
call   1040 <has_arg@plt>
cmp    $0x0,%rax
je     124c <main+0xbc>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1601 <main+0x471>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10b0 <bu_handle_version@plt>
cmp    $0x0,%rax
je     126e <main+0xde>
movl   $0x0,-0x4(%rbp)
jmp    1601 <main+0x471>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    12a2 <main+0x112>
movl   $0x1,-0x20(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    146d <main+0x2dd>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     12f1 <main+0x161>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <bu_invalid_argument@plt>
movl   $0x1,-0x4(%rbp)
jmp    1601 <main+0x471>
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <strlen@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
cmp    %rcx,%rax
jae    145a <main+0x2ca>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x31(%rbp)
movsbl -0x31(%rbp),%eax
cmp    $0x61,%eax
jne    136d <main+0x1dd>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
jmp    1444 <main+0x2b4>
movsbl -0x31(%rbp),%eax
cmp    $0x6d,%eax
jne    1386 <main+0x1f6>
movl   $0x1,-0x14(%rbp)
jmp    143f <main+0x2af>
movsbl -0x31(%rbp),%eax
cmp    $0x6e,%eax
jne    139f <main+0x20f>
movl   $0x1,-0x18(%rbp)
jmp    143a <main+0x2aa>
movsbl -0x31(%rbp),%eax
cmp    $0x72,%eax
jne    13b8 <main+0x228>
movl   $0x1,-0x1c(%rbp)
jmp    1435 <main+0x2a5>
movsbl -0x31(%rbp),%eax
cmp    $0x73,%eax
jne    13d1 <main+0x241>
movl   $0x1,-0x20(%rbp)
jmp    1430 <main+0x2a0>
movsbl -0x31(%rbp),%eax
cmp    $0x76,%eax
jne    13ea <main+0x25a>
movl   $0x1,-0x24(%rbp)
jmp    142b <main+0x29b>
mov    0xd1f(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xd1c(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xd1a(%rip),%al
mov    %al,-0x40(%rbp)
mov    -0x31(%rbp),%al
mov    %al,-0x41(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x50(%rbp),%rsi
call   1050 <bu_invalid_argument@plt>
movl   $0x1,-0x4(%rbp)
jmp    1601 <main+0x471>
jmp    1430 <main+0x2a0>
jmp    1435 <main+0x2a5>
jmp    143a <main+0x2aa>
jmp    143f <main+0x2af>
jmp    1444 <main+0x2b4>
jmp    1449 <main+0x2b9>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12f9 <main+0x169>
jmp    145f <main+0x2cf>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12a9 <main+0x119>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x54(%rbp)
lea    -0x68(%rbp),%rdi
call   1070 <uname@plt>
cmp    $0xffffffff,%eax
jne    14a9 <main+0x319>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1601 <main+0x471>
cmpl   $0x0,-0x20(%rbp)
je     14ea <main+0x35a>
mov    -0x58(%rbp),%edi
mov    0x2b23(%rip),%rax
mov    (%rax),%esi
call   1080 <fputs@plt>
cmpl   $0x1,-0x54(%rbp)
jle    14e1 <main+0x351>
mov    0x2b0b(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     152b <main+0x39b>
mov    -0x5c(%rbp),%edi
mov    0x2ae2(%rip),%rax
mov    (%rax),%esi
call   1080 <fputs@plt>
cmpl   $0x1,-0x54(%rbp)
jle    1522 <main+0x392>
mov    0x2aca(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     156c <main+0x3dc>
mov    -0x60(%rbp),%edi
mov    0x2aa1(%rip),%rax
mov    (%rax),%esi
call   1080 <fputs@plt>
cmpl   $0x1,-0x54(%rbp)
jle    1563 <main+0x3d3>
mov    0x2a89(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     15ad <main+0x41d>
mov    -0x64(%rbp),%edi
mov    0x2a60(%rip),%rax
mov    (%rax),%esi
call   1080 <fputs@plt>
cmpl   $0x1,-0x54(%rbp)
jle    15a4 <main+0x414>
mov    0x2a48(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     15ee <main+0x45e>
mov    -0x68(%rbp),%edi
mov    0x2a1f(%rip),%rax
mov    (%rax),%esi
call   1080 <fputs@plt>
cmpl   $0x1,-0x54(%rbp)
jle    15e5 <main+0x455>
mov    0x2a07(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
lea    0xa46(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe9e(%rip),%rdx
call   1050 <has_arg@plt>
test   %rax,%rax
jne    11da <main+0x3a>
lea    0xe90(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <has_arg@plt>
test   %rax,%rax
je     124e <main+0xae>
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb6(%rip),%rdi
call   1040 <puts@plt>
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
lea    0xede(%rip),%rdi
call   1040 <puts@plt>
lea    0xeed(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
call   10c0 <bu_handle_version@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    123f <main+0x9f>
xor    %r9d,%r9d
xor    %edx,%edx
cmp    $0x1,%ebp
sete   %dl
mov    %rbx,0x18(%rsp)
jle    13a9 <main+0x209>
mov    %ebp,%eax
mov    %rax,0x20(%rsp)
xor    %esi,%esi
mov    $0x1,%ecx
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    12bc <main+0x11c>
mov    %r15d,%r9d
mov    %r12d,%r10d
mov    %r14d,%ebx
mov    0x28(%rsp),%rcx
add    $0x1,%rcx
mov    %ebp,%esi
mov    %r13d,%edx
mov    %ebx,%r14d
mov    %r10d,%r12d
mov    %r9d,%r15d
cmp    0x20(%rsp),%rcx
je     13b3 <main+0x213>
mov    0x18(%rsp),%rax
mov    (%rax,%rcx,8),%rbx
cmpb   $0x2d,(%rbx)
jne    150e <main+0x36e>
mov    %esi,%ebp
mov    %edx,%r13d
mov    %rcx,0x28(%rsp)
mov    %rbx,%rdi
call   1070 <strlen@plt>
cmp    $0x2,%rax
jb     1291 <main+0xf1>
mov    %rbx,0x30(%rsp)
mov    $0x1,%ecx
lea    0xd09(%rip),%r8
mov    %r13d,%edi
mov    %ebp,%r11d
jmp    132d <main+0x18d>
mov    $0x1,%r9d
mov    %r12d,%r10d
mov    %r14d,%ebx
mov    %edi,%r13d
mov    %r11d,%ebp
add    $0x1,%rcx
mov    %ebp,%r11d
mov    %r13d,%edi
mov    %ebx,%r14d
mov    %r10d,%r12d
mov    %r9d,%r15d
cmp    %rcx,%rax
je     129a <main+0xfa>
mov    0x30(%rsp),%rdx
movzbl (%rdx,%rcx,1),%edx
lea    -0x61(%rdx),%esi
cmp    $0x15,%sil
ja     1415 <main+0x275>
mov    $0x1,%ebp
movzbl %sil,%esi
movslq (%r8,%rsi,4),%rsi
add    %r8,%rsi
mov    $0x1,%r9d
mov    $0x1,%r10d
mov    $0x1,%ebx
mov    $0x1,%r13d
jmp    *%rsi
mov    %r15d,%r9d
mov    $0x1,%r10d
jmp    1308 <main+0x168>
mov    %r15d,%r9d
mov    %r12d,%r10d
mov    $0x1,%ebx
jmp    130b <main+0x16b>
mov    %r15d,%r9d
mov    %r12d,%r10d
mov    %r14d,%ebx
mov    $0x1,%r13d
jmp    130e <main+0x16e>
mov    %r15d,%r9d
mov    %r12d,%r10d
mov    %r14d,%ebx
mov    %edi,%r13d
jmp    1311 <main+0x171>
xor    %r10d,%r10d
xor    %ebx,%ebx
mov    %edx,%r13d
xor    %ebp,%ebp
mov    %r10,%r15
mov    %ebp,%r14d
mov    %r9,%r12
mov    %rsp,%rdi
call   1080 <uname@plt>
cmp    $0xffffffff,%eax
je     151e <main+0x37e>
lea    (%r15,%r12,1),%ebp
add    %ebx,%ebp
add    %r13d,%ebp
add    %r14d,%ebp
test   %r13d,%r13d
je     1439 <main+0x299>
mov    0x10(%rsp),%edi
mov    0x2bf7(%rip),%r13
mov    0x0(%r13),%esi
call   1090 <fputs@plt>
cmp    $0x2,%ebp
jl     1405 <main+0x265>
mov    0x0(%r13),%esi
mov    $0x20,%edi
call   10a0 <fputc@plt>
add    $0xffffffff,%ebp
mov    %r12,%rax
mov    %r14d,%ecx
mov    %ebx,%edx
mov    %r15,%rsi
jmp    1444 <main+0x2a4>
movaps 0xd54(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %dl,0xf(%rsp)
mov    0x18(%rsp),%rax
mov    (%rax),%rdi
mov    %rsp,%rsi
jmp    1514 <main+0x374>
mov    %r12,%rax
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
test   %esi,%esi
je     1478 <main+0x2d8>
mov    0xc(%rsp),%edi
mov    0x2b8d(%rip),%r15
mov    (%r15),%esi
call   1090 <fputs@plt>
cmp    $0x2,%ebp
jl     146d <main+0x2cd>
mov    (%r15),%esi
mov    $0x20,%edi
call   10a0 <fputc@plt>
add    $0xffffffff,%ebp
mov    %r12,%rax
mov    %r14d,%ecx
mov    %ebx,%edx
test   %edx,%edx
je     14a8 <main+0x308>
mov    0x8(%rsp),%edi
mov    0x2b59(%rip),%rbx
mov    (%rbx),%esi
call   1090 <fputs@plt>
cmp    $0x2,%ebp
jl     149f <main+0x2ff>
mov    (%rbx),%esi
mov    $0x20,%edi
call   10a0 <fputc@plt>
add    $0xffffffff,%ebp
mov    %r12,%rax
mov    %r14d,%ecx
test   %ecx,%ecx
je     14d7 <main+0x337>
mov    0x4(%rsp),%edi
mov    0x2b29(%rip),%r14
mov    (%r14),%esi
call   1090 <fputs@plt>
cmp    $0x2,%ebp
jl     14d1 <main+0x331>
mov    (%r14),%esi
mov    $0x20,%edi
call   10a0 <fputc@plt>
add    $0xffffffff,%ebp
mov    %r12,%rax
test   %eax,%eax
je     14fd <main+0x35d>
mov    (%rsp),%edi
mov    0x2afb(%rip),%rbx
mov    (%rbx),%esi
call   1090 <fputs@plt>
cmp    $0x2,%ebp
jl     14fd <main+0x35d>
mov    (%rbx),%esi
mov    $0x20,%edi
call   10a0 <fputc@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
jmp    123f <main+0x9f>
mov    (%rax),%rdi
mov    %rbx,%rsi
call   1060 <bu_invalid_argument@plt>
jmp    123a <main+0x9a>
mov    0x18(%rsp),%rax
mov    (%rax),%rdi
call   10b0 <perror@plt>
jmp    123a <main+0x9a>

LLVM IR (-O0):
%struct.utsname = type { i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [23 x i8] c"Usage: uname [-amnrsv]\00"
@.str.3 = [27 x i8] c"Prints system information.\00"
@.str.4 = [26 x i8] c"-a Equivalent to -mnrsv\00"
@.str.5 = [25 x i8] c"-m Print hardware type\00"
@.str.6 = [28 x i8] c"-n Print network hostname\00"
@.str.7 = [36 x i8] c"-r Print operating system release\00"
@.str.8 = [27 x i8] c"-s Print the kernel name\00"
@.str.9 = [65 x i8] c"-v Print the version of the installed operating system release\00"
@__const.main.bad_flag_msg = [17 x i8] c"unknown flag: -X\00"
@stdout = global i32 0
@.str.10 = [1 x i8] zeroinitializer
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 i64
%13 = alloca i8
%14 = alloca [17 x i8]
%15 = alloca i32
%16 = alloca %struct.utsname
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i64 @has_arg(i32 %17, i8** %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %2
%22 = load i32, i32* %4
%23 = load i8**, i8*** %5
%24 = call i64 @has_arg(i32 %22, i8** %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %21, %2
%27 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%33 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%34 = call i32 @puts(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %239
35: ; preds = %21
%36 = load i32, i32* %4
%37 = load i8**, i8*** %5
%38 = call i64 @bu_handle_version(i32 %36, i8** %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %35
store i32 0, i32* %3
br label %239
41: ; preds = %35
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%42 = load i32, i32* %4
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 1, i32* %9
br label %45
45: ; preds = %44, %41
store i32 1, i32* %11
br label %46
46: ; preds = %137, %45
%47 = load i32, i32* %11
%48 = load i32, i32* %4
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %140
50: ; preds = %46
%51 = load i8**, i8*** %5
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 0
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %58, 45
br i1 %59, label %60, label %70
60: ; preds = %50
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 0
%63 = load i8*, i8** %62
%64 = load i8**, i8*** %5
%65 = load i32, i32* %11
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @bu_invalid_argument(i8* %63, i8* %68)
store i32 1, i32* %3
br label %239
70: ; preds = %50
store i64 1, i64* %12
br label %71
71: ; preds = %133, %70
%72 = load i64, i64* %12
%73 = load i8**, i8*** %5
%74 = load i32, i32* %11
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = call i64 @strlen(i8* %77)
%79 = icmp ult i64 %72, %78
br i1 %79, label %80, label %136
80: ; preds = %71
%81 = load i8**, i8*** %5
%82 = load i32, i32* %11
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8*, i8** %81, i64 %83
%85 = load i8*, i8** %84
%86 = load i64, i64* %12
%87 = getelementptr inbounds i8, i8* %85, i64 %86
%88 = load i8, i8* %87
store i8 %88, i8* %13
%89 = load i8, i8* %13
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 97
br i1 %91, label %92, label %93
92: ; preds = %80
store i32 1, i32* %6
store i32 1, i32* %7
store i32 1, i32* %8
store i32 1, i32* %9
store i32 1, i32* %10
br label %132
93: ; preds = %80
%94 = load i8, i8* %13
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 109
br i1 %96, label %97, label %98
97: ; preds = %93
store i32 1, i32* %6
br label %131
98: ; preds = %93
%99 = load i8, i8* %13
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 110
br i1 %101, label %102, label %103
102: ; preds = %98
store i32 1, i32* %7
br label %130
103: ; preds = %98
%104 = load i8, i8* %13
%105 = sext i8 %104 to i32
%106 = icmp eq i32 %105, 114
br i1 %106, label %107, label %108
107: ; preds = %103
store i32 1, i32* %8
br label %129
108: ; preds = %103
%109 = load i8, i8* %13
%110 = sext i8 %109 to i32
%111 = icmp eq i32 %110, 115
br i1 %111, label %112, label %113
112: ; preds = %108
store i32 1, i32* %9
br label %128
113: ; preds = %108
%114 = load i8, i8* %13
%115 = sext i8 %114 to i32
%116 = icmp eq i32 %115, 118
br i1 %116, label %117, label %118
117: ; preds = %113
store i32 1, i32* %10
br label %127
118: ; preds = %113
%119 = bitcast [17 x i8]* %14 to i8*
%120 = load i8, i8* %13
%121 = getelementptr inbounds [17 x i8], [17 x i8]* %14, i64 0, i64 15
store i8 %120, i8* %121
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 0
%124 = load i8*, i8** %123
%125 = getelementptr inbounds [17 x i8], [17 x i8]* %14, i64 0, i64 0
%126 = call i32 @bu_invalid_argument(i8* %124, i8* %125)
store i32 1, i32* %3
br label %239
127: ; preds = %117
br label %128
128: ; preds = %127, %112
br label %129
129: ; preds = %128, %107
br label %130
130: ; preds = %129, %102
br label %131
131: ; preds = %130, %97
br label %132
132: ; preds = %131, %92
br label %133
133: ; preds = %132
%134 = load i64, i64* %12
%135 = add i64 %134, 1
store i64 %135, i64* %12
br label %71
136: ; preds = %71
br label %137
137: ; preds = %136
%138 = load i32, i32* %11
%139 = add nsw i32 %138, 1
store i32 %139, i32* %11
br label %46
140: ; preds = %46
%141 = load i32, i32* %6
%142 = load i32, i32* %7
%143 = add nsw i32 %141, %142
%144 = load i32, i32* %8
%145 = add nsw i32 %143, %144
%146 = load i32, i32* %9
%147 = add nsw i32 %145, %146
%148 = load i32, i32* %10
%149 = add nsw i32 %147, %148
store i32 %149, i32* %15
%150 = call i32 @uname(%struct.utsname* %16)
%151 = icmp eq i32 %150, -1
br i1 %151, label %152, label %157
152: ; preds = %140
%153 = load i8**, i8*** %5
%154 = getelementptr inbounds i8*, i8** %153, i64 0
%155 = load i8*, i8** %154
%156 = call i32 @perror(i8* %155)
store i32 1, i32* %3
br label %239
157: ; preds = %140
%158 = load i32, i32* %9
%159 = icmp ne i32 %158, 0
br i1 %159, label %160, label %173
160: ; preds = %157
%161 = getelementptr inbounds %struct.utsname, %struct.utsname* %16, i32 0, i32 4
%162 = load i32, i32* %161
%163 = load i32, i32* @stdout
%164 = call i32 @fputs(i32 %162, i32 %163)
%165 = load i32, i32* %15
%166 = icmp sgt i32 %165, 1
br i1 %166, label %167, label %170
167: ; preds = %160
%168 = load i32, i32* @stdout
%169 = call i32 @fputc(i8 signext 32, i32 %168)
br label %170
170: ; preds = %167, %160
%171 = load i32, i32* %15
%172 = add nsw i32 %171, -1
store i32 %172, i32* %15
br label %173
173: ; preds = %170, %157
%174 = load i32, i32* %7
%175 = icmp ne i32 %174, 0
br i1 %175, label %176, label %189
176: ; preds = %173
%177 = getelementptr inbounds %struct.utsname, %struct.utsname* %16, i32 0, i32 3
%178 = load i32, i32* %177
%179 = load i32, i32* @stdout
%180 = call i32 @fputs(i32 %178, i32 %179)
%181 = load i32, i32* %15
%182 = icmp sgt i32 %181, 1
br i1 %182, label %183, label %186
183: ; preds = %176
%184 = load i32, i32* @stdout
%185 = call i32 @fputc(i8 signext 32, i32 %184)
br label %186
186: ; preds = %183, %176
%187 = load i32, i32* %15
%188 = add nsw i32 %187, -1
store i32 %188, i32* %15
br label %189
189: ; preds = %186, %173
%190 = load i32, i32* %8
%191 = icmp ne i32 %190, 0
br i1 %191, label %192, label %205
192: ; preds = %189
%193 = getelementptr inbounds %struct.utsname, %struct.utsname* %16, i32 0, i32 2
%194 = load i32, i32* %193
%195 = load i32, i32* @stdout
%196 = call i32 @fputs(i32 %194, i32 %195)
%197 = load i32, i32* %15
%198 = icmp sgt i32 %197, 1
br i1 %198, label %199, label %202
199: ; preds = %192
%200 = load i32, i32* @stdout
%201 = call i32 @fputc(i8 signext 32, i32 %200)
br label %202
202: ; preds = %199, %192
%203 = load i32, i32* %15
%204 = add nsw i32 %203, -1
store i32 %204, i32* %15
br label %205
205: ; preds = %202, %189
%206 = load i32, i32* %10
%207 = icmp ne i32 %206, 0
br i1 %207, label %208, label %221
208: ; preds = %205
%209 = getelementptr inbounds %struct.utsname, %struct.utsname* %16, i32 0, i32 1
%210 = load i32, i32* %209
%211 = load i32, i32* @stdout
%212 = call i32 @fputs(i32 %210, i32 %211)
%213 = load i32, i32* %15
%214 = icmp sgt i32 %213, 1
br i1 %214, label %215, label %218
215: ; preds = %208
%216 = load i32, i32* @stdout
%217 = call i32 @fputc(i8 signext 32, i32 %216)
br label %218
218: ; preds = %215, %208
%219 = load i32, i32* %15
%220 = add nsw i32 %219, -1
store i32 %220, i32* %15
br label %221
221: ; preds = %218, %205
%222 = load i32, i32* %6
%223 = icmp ne i32 %222, 0
br i1 %223, label %224, label %237
224: ; preds = %221
%225 = getelementptr inbounds %struct.utsname, %struct.utsname* %16, i32 0, i32 0
%226 = load i32, i32* %225
%227 = load i32, i32* @stdout
%228 = call i32 @fputs(i32 %226, i32 %227)
%229 = load i32, i32* %15
%230 = icmp sgt i32 %229, 1
br i1 %230, label %231, label %234
231: ; preds = %224
%232 = load i32, i32* @stdout
%233 = call i32 @fputc(i8 signext 32, i32 %232)
br label %234
234: ; preds = %231, %224
%235 = load i32, i32* %15
%236 = add nsw i32 %235, -1
store i32 %236, i32* %15
br label %237
237: ; preds = %234, %221
%238 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %3
br label %239
239: ; preds = %237, %152, %118, %60, %40, %26
%240 = load i32, i32* %3
ret i32 %240
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [23 x i8] c"Usage: uname [-amnrsv]\00"
@.str.3 = [27 x i8] c"Prints system information.\00"
@.str.4 = [26 x i8] c"-a Equivalent to -mnrsv\00"
@.str.5 = [25 x i8] c"-m Print hardware type\00"
@.str.6 = [28 x i8] c"-n Print network hostname\00"
@.str.7 = [36 x i8] c"-r Print operating system release\00"
@.str.8 = [27 x i8] c"-s Print the kernel name\00"
@.str.9 = [65 x i8] c"-v Print the version of the installed operating system release\00"
@__const.main.bad_flag_msg = [17 x i8] c"unknown flag: -X\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [17 x i8]
%4 = alloca %struct.utsname
%5 = tail call i64 @has_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i64 @has_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %7, %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0))
br label %167
19: ; preds = %7
%20 = tail call i64 @bu_handle_version(i32 %0, i8** %1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %167
22: ; preds = %19
%23 = icmp eq i32 %0, 1
%24 = zext i1 %23 to i32
%25 = icmp sgt i32 %0, 1
br i1 %25, label %26, label %80
26: ; preds = %22
%27 = zext i32 %0 to i64
br label %28
28: ; preds = %26, %72
%29 = phi i64 [ 1, %26 ], [ %78, %72 ]
%30 = phi i32 [ 0, %26 ], [ %77, %72 ]
%31 = phi i32 [ %24, %26 ], [ %76, %72 ]
%32 = phi i32 [ 0, %26 ], [ %75, %72 ]
%33 = phi i32 [ 0, %26 ], [ %74, %72 ]
%34 = phi i32 [ 0, %26 ], [ %73, %72 ]
%35 = getelementptr inbounds i8*, i8** %1, i64 %29
%36 = load i8*, i8** %35
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 45
br i1 %38, label %39, label %42
39: ; preds = %28
%40 = tail call i64 @strlen(i8* dereferenceable(1) %36)
%41 = icmp ugt i64 %40, 1
br i1 %41, label %45, label %72
42: ; preds = %28
%43 = load i8*, i8** %1
%44 = tail call i32 @bu_invalid_argument(i8* %43, i8* %36)
br label %167
45: ; preds = %39, %64
%46 = phi i64 [ %70, %64 ], [ 1, %39 ]
%47 = phi i32 [ %69, %64 ], [ %30, %39 ]
%48 = phi i32 [ %68, %64 ], [ %31, %39 ]
%49 = phi i32 [ %67, %64 ], [ %32, %39 ]
%50 = phi i32 [ %66, %64 ], [ %33, %39 ]
%51 = phi i32 [ %65, %64 ], [ %34, %39 ]
%52 = getelementptr inbounds i8, i8* %36, i64 %46
%53 = load i8, i8* %52
switch i8 %53, label %59 [
i8 97, label %64
i8 109, label %54
i8 110, label %55
i8 114, label %56
i8 115, label %57
i8 118, label %58
]
54: ; preds = %45
br label %64
55: ; preds = %45
br label %64
56: ; preds = %45
br label %64
57: ; preds = %45
br label %64
58: ; preds = %45
br label %64
59: ; preds = %45
%60 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%61 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 15
store i8 %53, i8* %61
%62 = load i8*, i8** %1
%63 = call i32 @bu_invalid_argument(i8* %62, i8* %60)
br label %167
64: ; preds = %45, %54, %56, %58, %57, %55
%65 = phi i32 [ 1, %45 ], [ %51, %58 ], [ %51, %57 ], [ %51, %56 ], [ %51, %55 ], [ 1, %54 ]
%66 = phi i32 [ 1, %45 ], [ %50, %58 ], [ %50, %57 ], [ %50, %56 ], [ 1, %55 ], [ %50, %54 ]
%67 = phi i32 [ 1, %45 ], [ %49, %58 ], [ %49, %57 ], [ 1, %56 ], [ %49, %55 ], [ %49, %54 ]
%68 = phi i32 [ 1, %45 ], [ %48, %58 ], [ 1, %57 ], [ %48, %56 ], [ %48, %55 ], [ %48, %54 ]
%69 = phi i32 [ 1, %45 ], [ 1, %58 ], [ %47, %57 ], [ %47, %56 ], [ %47, %55 ], [ %47, %54 ]
%70 = add nuw i64 %46, 1
%71 = icmp eq i64 %70, %40
br i1 %71, label %72, label %45
72: ; preds = %64, %39
%73 = phi i32 [ %34, %39 ], [ %65, %64 ]
%74 = phi i32 [ %33, %39 ], [ %66, %64 ]
%75 = phi i32 [ %32, %39 ], [ %67, %64 ]
%76 = phi i32 [ %31, %39 ], [ %68, %64 ]
%77 = phi i32 [ %30, %39 ], [ %69, %64 ]
%78 = add nuw nsw i64 %29, 1
%79 = icmp eq i64 %78, %27
br i1 %79, label %80, label %28
80: ; preds = %72, %22
%81 = phi i32 [ 0, %22 ], [ %73, %72 ]
%82 = phi i32 [ 0, %22 ], [ %74, %72 ]
%83 = phi i32 [ 0, %22 ], [ %75, %72 ]
%84 = phi i32 [ %24, %22 ], [ %76, %72 ]
%85 = phi i32 [ 0, %22 ], [ %77, %72 ]
%86 = add nsw i32 %82, %81
%87 = add nsw i32 %86, %83
%88 = add nsw i32 %87, %84
%89 = add nsw i32 %88, %85
%90 = bitcast %struct.utsname* %4 to i8*
%91 = call i32 @uname(%struct.utsname* %4)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %96
93: ; preds = %80
%94 = load i8*, i8** %1
%95 = tail call i32 @perror(i8* %94)
br label %165
96: ; preds = %80
%97 = icmp eq i32 %84, 0
br i1 %97, label %109, label %98
98: ; preds = %96
%99 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 4
%100 = load i32, i32* %99
%101 = load i32, i32* @stdout
%102 = tail call i32 @fputs(i32 %100, i32 %101)
%103 = icmp sgt i32 %89, 1
br i1 %103, label %104, label %107
104: ; preds = %98
%105 = load i32, i32* @stdout
%106 = tail call i32 @fputc(i8 signext 32, i32 %105)
br label %107
107: ; preds = %104, %98
%108 = add nsw i32 %89, -1
br label %109
109: ; preds = %107, %96
%110 = phi i32 [ %108, %107 ], [ %89, %96 ]
%111 = icmp eq i32 %82, 0
br i1 %111, label %123, label %112
112: ; preds = %109
%113 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 3
%114 = load i32, i32* %113
%115 = load i32, i32* @stdout
%116 = tail call i32 @fputs(i32 %114, i32 %115)
%117 = icmp sgt i32 %110, 1
br i1 %117, label %118, label %121
118: ; preds = %112
%119 = load i32, i32* @stdout
%120 = tail call i32 @fputc(i8 signext 32, i32 %119)
br label %121
121: ; preds = %118, %112
%122 = add nsw i32 %110, -1
br label %123
123: ; preds = %121, %109
%124 = phi i32 [ %122, %121 ], [ %110, %109 ]
%125 = icmp eq i32 %83, 0
br i1 %125, label %137, label %126
126: ; preds = %123
%127 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 2
%128 = load i32, i32* %127
%129 = load i32, i32* @stdout
%130 = tail call i32 @fputs(i32 %128, i32 %129)
%131 = icmp sgt i32 %124, 1
br i1 %131, label %132, label %135
132: ; preds = %126
%133 = load i32, i32* @stdout
%134 = tail call i32 @fputc(i8 signext 32, i32 %133)
br label %135
135: ; preds = %132, %126
%136 = add nsw i32 %124, -1
br label %137
137: ; preds = %135, %123
%138 = phi i32 [ %136, %135 ], [ %124, %123 ]
%139 = icmp eq i32 %85, 0
br i1 %139, label %151, label %140
140: ; preds = %137
%141 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 1
%142 = load i32, i32* %141
%143 = load i32, i32* @stdout
%144 = tail call i32 @fputs(i32 %142, i32 %143)
%145 = icmp sgt i32 %138, 1
br i1 %145, label %146, label %149
146: ; preds = %140
%147 = load i32, i32* @stdout
%148 = tail call i32 @fputc(i8 signext 32, i32 %147)
br label %149
149: ; preds = %146, %140
%150 = add nsw i32 %138, -1
br label %151
151: ; preds = %149, %137
%152 = phi i32 [ %150, %149 ], [ %138, %137 ]
%153 = icmp eq i32 %81, 0
br i1 %153, label %163, label %154
154: ; preds = %151
%155 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 0
%156 = load i32, i32* %155
%157 = load i32, i32* @stdout
%158 = tail call i32 @fputs(i32 %156, i32 %157)
%159 = icmp sgt i32 %152, 1
br i1 %159, label %160, label %163
160: ; preds = %154
%161 = load i32, i32* @stdout
%162 = tail call i32 @fputc(i8 signext 32, i32 %161)
br label %163
163: ; preds = %154, %160, %151
%164 = tail call i32 @putchar(i32 10)
br label %165
165: ; preds = %163, %93
%166 = phi i32 [ 1, %93 ], [ 0, %163 ]
br label %167
167: ; preds = %59, %42, %165, %19, %10
%168 = phi i32 [ 1, %10 ], [ 0, %19 ], [ 1, %42 ], [ %166, %165 ], [ 1, %59 ]
ret i32 %168
}