#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 sub_command {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
char *uname();
char *uname_m();
int cmd_uname(int argc, char **argv, struct sub_command *cmd) {
  if (argc == 1) {
    printf("%s\n", uname());
  } else if (argc == 2) {
    if (strcmp(argv[1], "-m") == 0)
      printf("%s\n", uname_m());
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmd_uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1178 <cmd_uname+0x38>
mov    $0x0,%al
call   1040 <uname@plt>
mov    %rax,%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
jmp    11c0 <cmd_uname+0x80>
cmpl   $0x2,-0x4(%rbp)
jne    11bb <cmd_uname+0x7b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe73(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <cmd_uname+0x76>
mov    $0x0,%al
call   1060 <uname_m@plt>
mov    %rax,%rsi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
jmp    11bb <cmd_uname+0x7b>
jmp    11c0 <cmd_uname+0x80>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_uname>:
push   %rax
cmp    $0x2,%edi
je     1154 <cmd_uname+0x14>
cmp    $0x1,%edi
jne    117f <cmd_uname+0x3f>
xor    %eax,%eax
call   1040 <uname@plt>
jmp    1170 <cmd_uname+0x30>
mov    0x8(%rsi),%rdi
lea    0xea5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    117f <cmd_uname+0x3f>
xor    %eax,%eax
call   1060 <uname_m@plt>
lea    0xe89(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sub_command = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c"-m\00"
define i32 @cmd_uname(i32 %0, i8** %1, %struct.sub_command* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sub_command*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.sub_command* %2, %struct.sub_command** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i8* (...) @uname()
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %26
12: ; preds = %3
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = call i8* (...) @uname_m()
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %21, %15
br label %25
25: ; preds = %24, %12
br label %26
26: ; preds = %25, %9
ret i32 0
}

LLVM IR (-O2):
%struct.sub_command = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c"-m\00"
define i32 @cmd_uname(i32 %0, i8** nocapture %1, %struct.sub_command* nocapture readnone %2) {
switch i32 %0, label %16 [
i32 1, label %4
i32 2, label %6
]
4: ; preds = %3
%5 = tail call i8* (...) @uname()
br label %13
6: ; preds = %3
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = tail call i8* (...) @uname_m()
br label %13
13: ; preds = %4, %11
%14 = phi i8* [ %12, %11 ], [ %5, %4 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %13, %3, %6
ret i32 0
}