#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 {
  char *sysname;
  char *nodename;
  char *release;
  char *version;
  char *machine;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
scalar_t__ uname(struct utsname *);
int main(int argc, char *argv[]) {
  struct utsname buffer;
  errno = 0;
  if (uname(&buffer) != 0) {
    perror("uname");
    exit(EXIT_FAILURE);
  }
  if (strcmp(argv[1], "-s") == 0)
    printf("%s\n", buffer.sysname);
  else if (strcmp(argv[1], "-n") == 0)
    printf("%s\n", buffer.nodename);
  else if (strcmp(argv[1], "-r") == 0)
    printf("%s\n", buffer.release);
  else if (strcmp(argv[1], "-v") == 0)
    printf("%s\n", buffer.version);
  else if (strcmp(argv[1], "-m") == 0)
    printf("%s\n", buffer.machine);
  else if (strcmp(argv[1], "-a") == 0) {
    printf("%s ", buffer.sysname);
    printf("%s ", buffer.nodename);
    printf("%s ", buffer.release);
    printf("%s ", buffer.version);
    printf("%s ", buffer.machine);
    printf("\n");
  } else {
    printf("%s\n", buffer.sysname);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e73(%rip),%rax
movq   $0x0,(%rax)
lea    -0x38(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0x0,%rax
je     11a1 <main+0x51>
lea    0xe72(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe56(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11d6 <main+0x86>
mov    -0x38(%rbp),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1360 <main+0x210>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe28(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    120b <main+0xbb>
mov    -0x30(%rbp),%rsi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135b <main+0x20b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1240 <main+0xf0>
mov    -0x28(%rbp),%rsi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1356 <main+0x206>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1275 <main+0x125>
mov    -0x20(%rbp),%rsi
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1351 <main+0x201>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd92(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12aa <main+0x15a>
mov    -0x18(%rbp),%rsi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    134c <main+0x1fc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd60(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1335 <main+0x1e5>
mov    -0x38(%rbp),%rsi
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1347 <main+0x1f7>
mov    -0x38(%rbp),%rsi
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    134c <main+0x1fc>
jmp    1351 <main+0x201>
jmp    1356 <main+0x206>
jmp    135b <main+0x20b>
jmp    1360 <main+0x210>
mov    0x2c69(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    0x2e61(%rip),%rax
movq   $0x0,(%rax)
lea    0x8(%rsp),%rdi
call   1060 <uname@plt>
test   %rax,%rax
jne    12af <main+0x13f>
mov    0x8(%rbx),%rdi
lea    0xe62(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1221 <main+0xb1>
mov    0x8(%rbx),%rdi
lea    0xe50(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1228 <main+0xb8>
mov    0x8(%rbx),%rdi
lea    0xe3e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     122f <main+0xbf>
mov    0x8(%rbx),%rdi
lea    0xe2c(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1236 <main+0xc6>
mov    0x8(%rbx),%rdi
lea    0xe1a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     123d <main+0xcd>
mov    0x8(%rbx),%rdi
lea    0xe08(%rip),%rsi
call   1070 <strcmp@plt>
mov    0x8(%rsp),%rsi
test   %rax,%rax
je     1256 <main+0xe6>
mov    %rsi,%rdi
jmp    1242 <main+0xd2>
mov    0x8(%rsp),%rdi
jmp    1242 <main+0xd2>
mov    0x10(%rsp),%rdi
jmp    1242 <main+0xd2>
mov    0x18(%rsp),%rdi
jmp    1242 <main+0xd2>
mov    0x20(%rsp),%rdi
jmp    1242 <main+0xd2>
mov    0x28(%rsp),%rdi
call   1040 <puts@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbx
ret
lea    0xdbb(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1247 <main+0xd7>
lea    0xd4a(%rip),%rdi
call   1080 <perror@plt>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@errno = global i64 0
@.str = [6 x i8] c"uname\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"-s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [3 x i8] c"-n\00"
@.str.4 = [3 x i8] c"-r\00"
@.str.5 = [3 x i8] c"-v\00"
@.str.6 = [3 x i8] c"-m\00"
@.str.7 = [3 x i8] c"-a\00"
@.str.8 = [4 x i8] c"%s \00"
@.str.9 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.utsname
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* @errno
%7 = call i64 @uname(%struct.utsname* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %95
23: ; preds = %13
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 1
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %94
33: ; preds = %23
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %33
%40 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 2
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %41)
br label %93
43: ; preds = %33
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %43
%50 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 3
%51 = load i8*, i8** %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %51)
br label %92
53: ; preds = %43
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %53
%60 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 4
%61 = load i8*, i8** %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %61)
br label %91
63: ; preds = %53
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %86
69: ; preds = %63
%70 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 0
%71 = load i8*, i8** %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %71)
%73 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 1
%74 = load i8*, i8** %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 2
%77 = load i8*, i8** %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %77)
%79 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 3
%80 = load i8*, i8** %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %80)
%82 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 4
%83 = load i8*, i8** %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %83)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %90
86: ; preds = %63
%87 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 0
%88 = load i8*, i8** %87
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %88)
br label %90
90: ; preds = %86, %69
br label %91
91: ; preds = %90, %59
br label %92
92: ; preds = %91, %49
br label %93
93: ; preds = %92, %39
br label %94
94: ; preds = %93, %29
br label %95
95: ; preds = %94, %19
%96 = load i32, i32* @EXIT_SUCCESS
ret i32 %96
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@errno = global i64 0
@.str = [6 x i8] c"uname\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"-s\00"
@.str.3 = [3 x i8] c"-n\00"
@.str.4 = [3 x i8] c"-r\00"
@.str.5 = [3 x i8] c"-v\00"
@.str.6 = [3 x i8] c"-m\00"
@.str.7 = [3 x i8] c"-a\00"
@.str.8 = [4 x i8] c"%s \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.utsname
%4 = bitcast %struct.utsname* %3 to i8*
store i64 0, i64* @errno
%5 = call i64 @uname(%struct.utsname* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%18 = load i8*, i8** %17
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
br label %75
20: ; preds = %11
%21 = load i8*, i8** %12
%22 = tail call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 1
%26 = load i8*, i8** %25
%27 = tail call i32 @puts(i8* dereferenceable(1) %26)
br label %75
28: ; preds = %20
%29 = load i8*, i8** %12
%30 = tail 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 %36
32: ; preds = %28
%33 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 2
%34 = load i8*, i8** %33
%35 = tail call i32 @puts(i8* dereferenceable(1) %34)
br label %75
36: ; preds = %28
%37 = load i8*, i8** %12
%38 = tail call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 3
%42 = load i8*, i8** %41
%43 = tail call i32 @puts(i8* dereferenceable(1) %42)
br label %75
44: ; preds = %36
%45 = load i8*, i8** %12
%46 = tail call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 4
%50 = load i8*, i8** %49
%51 = tail call i32 @puts(i8* dereferenceable(1) %50)
br label %75
52: ; preds = %44
%53 = load i8*, i8** %12
%54 = tail call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
%56 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%57 = load i8*, i8** %56
br i1 %55, label %58, label %73
58: ; preds = %52
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %57)
%60 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 1
%61 = load i8*, i8** %60
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %61)
%63 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 2
%64 = load i8*, i8** %63
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %64)
%66 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 3
%67 = load i8*, i8** %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %67)
%69 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 4
%70 = load i8*, i8** %69
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %70)
%72 = tail call i32 @putchar(i32 10)
br label %75
73: ; preds = %52
%74 = tail call i32 @puts(i8* dereferenceable(1) %57)
br label %75
75: ; preds = %24, %40, %58, %73, %48, %32, %16
%76 = load i32, i32* @EXIT_SUCCESS
ret i32 %76
}