#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 */
int /*<<< orphan*/ pios_fbconsole_write(char *);
scalar_t__ strcmp(char *, char *);
int uname(int argc, char **argv) {
  if (argc == 1)
    pios_fbconsole_write("piOS\n");
  else if (argc == 2) {
    if (strcmp(argv[1], "-a") == 0)
      pios_fbconsole_write("PiOS v<M_PI>\n");
    else if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) {
      pios_fbconsole_write("Usage: uname [-a]\n");
    } else {
      pios_fbconsole_write("uname: Invalid Option");
      pios_fbconsole_write(argv[1]);
      pios_fbconsole_write("\n'uname --help' gives more info\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    114a <uname+0x2a>
lea    0xec0(%rip),%rdi
call   1030 <pios_fbconsole_write@plt>
jmp    1204 <uname+0xe4>
cmpl   $0x2,-0x4(%rbp)
jne    11ff <uname+0xdf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1183 <uname+0x63>
lea    0xe90(%rip),%rdi
call   1030 <pios_fbconsole_write@plt>
jmp    11fa <uname+0xda>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bf <uname+0x9f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d0 <uname+0xb0>
lea    0xe5b(%rip),%rdi
call   1030 <pios_fbconsole_write@plt>
jmp    11f5 <uname+0xd5>
lea    0xe5d(%rip),%rdi
call   1030 <pios_fbconsole_write@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <pios_fbconsole_write@plt>
lea    0xe5a(%rip),%rdi
call   1030 <pios_fbconsole_write@plt>
jmp    11fa <uname+0xda>
jmp    11ff <uname+0xdf>
jmp    1204 <uname+0xe4>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uname>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
je     1195 <uname+0x75>
cmp    $0x2,%edi
jne    11ad <uname+0x8d>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xeca(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     119e <uname+0x7e>
mov    0x8(%r14),%rdi
lea    0xec6(%rip),%rsi
call   1040 <strcmp@plt>
lea    0xec4(%rip),%rbx
test   %rax,%rax
je     11a5 <uname+0x85>
mov    0x8(%r14),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a5 <uname+0x85>
lea    0xeb6(%rip),%rdi
call   1030 <pios_fbconsole_write@plt>
mov    0x8(%r14),%rdi
call   1030 <pios_fbconsole_write@plt>
lea    0xeb7(%rip),%rbx
jmp    11a5 <uname+0x85>
lea    0xe64(%rip),%rbx
jmp    11a5 <uname+0x85>
lea    0xe64(%rip),%rbx
mov    %rbx,%rdi
call   1030 <pios_fbconsole_write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"piOS\0A\00"
@.str.1 = [3 x i8] c"-a\00"
@.str.2 = [14 x i8] c"PiOS v<M_PI>\0A\00"
@.str.3 = [7 x i8] c"--help\00"
@.str.4 = [3 x i8] c"-h\00"
@.str.5 = [19 x i8] c"Usage: uname [-a]\0A\00"
@.str.6 = [22 x i8] c"uname: Invalid Option\00"
@.str.7 = [33 x i8] c"\0A'uname --help' gives more info\0A\00"
define i32 @uname(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @pios_fbconsole_write(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %44
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %43
12: ; preds = %9
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @pios_fbconsole_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %42
20: ; preds = %12
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %20
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %26, %20
%33 = call i32 @pios_fbconsole_write(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %41
34: ; preds = %26
%35 = call i32 @pios_fbconsole_write(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @pios_fbconsole_write(i8* %38)
%40 = call i32 @pios_fbconsole_write(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %41
41: ; preds = %34, %32
br label %42
42: ; preds = %41, %18
br label %43
43: ; preds = %42, %9
br label %44
44: ; preds = %43, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"piOS\0A\00"
@.str.1 = [3 x i8] c"-a\00"
@.str.2 = [14 x i8] c"PiOS v<M_PI>\0A\00"
@.str.3 = [7 x i8] c"--help\00"
@.str.4 = [3 x i8] c"-h\00"
@.str.5 = [19 x i8] c"Usage: uname [-a]\0A\00"
@.str.6 = [22 x i8] c"uname: Invalid Option\00"
@.str.7 = [33 x i8] c"\0A'uname --help' gives more info\0A\00"
define i32 @uname(i32 %0, i8** nocapture %1) {
switch i32 %0, label %23 [
i32 1, label %20
i32 2, label %3
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %3
%9 = load i8*, i8** %4
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %20, label %12
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = tail call i32 @pios_fbconsole_write(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%18 = load i8*, i8** %4
%19 = tail call i32 @pios_fbconsole_write(i8* %18)
br label %20
20: ; preds = %8, %12, %3, %2, %16
%21 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), %16 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %12 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %8 ]
%22 = tail call i32 @pios_fbconsole_write(i8* %21)
br label %23
23: ; preds = %20, %2
ret i32 0
}