#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 */
int /*<<< orphan*/ bake_args(int, char **, int *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printe(int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
scalar_t__ uname(struct utsname *);
int main(int argc, char **argv) {
  int opt = 0;
  bake_args(argc, argv, &opt);
  struct utsname uts;
  if (uname(&uts) < 0) {
    perror("uname");
    return 1;
  }
  if (opt & (1 << 0))
    printe(uts.sysname);
  if (opt & (1 << 1))
    printe(uts.nodename);
  if (opt & (1 << 2))
    printe(uts.release);
  if (opt & (1 << 3))
    printe(uts.version);
  if (opt & (1 << 4))
    printe(uts.machine);
  putc('\n', stdout);
  fflush(stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1080 <bake_args@plt>
lea    -0x28(%rbp),%rdi
call   1030 <uname@plt>
cmp    $0x0,%rax
jge    11b8 <main+0x58>
lea    0xe59(%rip),%rdi
call   1070 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1253 <main+0xf3>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11cf <main+0x6f>
mov    -0x18(%rbp),%edi
call   1060 <printe@plt>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11e6 <main+0x86>
mov    -0x1c(%rbp),%edi
call   1060 <printe@plt>
mov    -0x14(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11fd <main+0x9d>
mov    -0x20(%rbp),%edi
call   1060 <printe@plt>
mov    -0x14(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1214 <main+0xb4>
mov    -0x24(%rbp),%edi
call   1060 <printe@plt>
mov    -0x14(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     122b <main+0xcb>
mov    -0x28(%rbp),%edi
call   1060 <printe@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1080 <bake_args@plt>
lea    0x8(%rsp),%rdi
call   1030 <uname@plt>
test   %rax,%rax
js     1213 <main+0xb3>
mov    0x4(%rsp),%eax
test   $0x1,%al
jne    11cd <main+0x6d>
test   $0x2,%al
jne    11de <main+0x7e>
test   $0x4,%al
jne    11ef <main+0x8f>
test   $0x8,%al
jne    1200 <main+0xa0>
test   $0x10,%al
je     11ab <main+0x4b>
mov    0x8(%rsp),%edi
call   1060 <printe@plt>
mov    0x2e2e(%rip),%rbx
mov    (%rbx),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret
mov    0x18(%rsp),%edi
call   1060 <printe@plt>
mov    0x4(%rsp),%eax
test   $0x2,%al
je     1196 <main+0x36>
mov    0x14(%rsp),%edi
call   1060 <printe@plt>
mov    0x4(%rsp),%eax
test   $0x4,%al
je     119a <main+0x3a>
mov    0x10(%rsp),%edi
call   1060 <printe@plt>
mov    0x4(%rsp),%eax
test   $0x8,%al
je     119e <main+0x3e>
mov    0xc(%rsp),%edi
call   1060 <printe@plt>
mov    0x4(%rsp),%eax
test   $0x10,%al
jne    11a2 <main+0x42>
jmp    11ab <main+0x4b>
lea    0xde6(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%eax
jmp    11c7 <main+0x67>

LLVM IR (-O0):
%struct.utsname = type { i32, i32, i32, i32, i32 }
@.str = [6 x i8] c"uname\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.utsname
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @bake_args(i32 %8, i8** %9, i32* %6)
%11 = call i64 @uname(%struct.utsname* %7)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %60
15: ; preds = %2
%16 = load i32, i32* %6
%17 = and i32 %16, 1
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 4
%21 = load i32, i32* %20
%22 = call i32 @printe(i32 %21)
br label %23
23: ; preds = %19, %15
%24 = load i32, i32* %6
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 3
%29 = load i32, i32* %28
%30 = call i32 @printe(i32 %29)
br label %31
31: ; preds = %27, %23
%32 = load i32, i32* %6
%33 = and i32 %32, 4
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 2
%37 = load i32, i32* %36
%38 = call i32 @printe(i32 %37)
br label %39
39: ; preds = %35, %31
%40 = load i32, i32* %6
%41 = and i32 %40, 8
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 1
%45 = load i32, i32* %44
%46 = call i32 @printe(i32 %45)
br label %47
47: ; preds = %43, %39
%48 = load i32, i32* %6
%49 = and i32 %48, 16
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = getelementptr inbounds %struct.utsname, %struct.utsname* %7, i32 0, i32 0
%53 = load i32, i32* %52
%54 = call i32 @printe(i32 %53)
br label %55
55: ; preds = %51, %47
%56 = load i32, i32* @stdout
%57 = call i32 @putc(i8 signext 10, i32 %56)
%58 = load i32, i32* @stdout
%59 = call i32 @fflush(i32 %58)
store i32 0, i32* %3
br label %60
60: ; preds = %55, %13
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32, i32, i32, i32 }
@.str = [6 x i8] c"uname\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca %struct.utsname
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = call i32 @bake_args(i32 %0, i8** %1, i32* %3)
%7 = bitcast %struct.utsname* %4 to i8*
%8 = call i64 @uname(%struct.utsname* %4)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %61
12: ; preds = %2
%13 = load i32, i32* %3
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %12
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 @printe(i32 %18)
%20 = load i32, i32* %3
br label %21
21: ; preds = %16, %12
%22 = phi i32 [ %20, %16 ], [ %13, %12 ]
%23 = and i32 %22, 2
%24 = icmp eq i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %21
%26 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 3
%27 = load i32, i32* %26
%28 = call i32 @printe(i32 %27)
%29 = load i32, i32* %3
br label %30
30: ; preds = %25, %21
%31 = phi i32 [ %29, %25 ], [ %22, %21 ]
%32 = and i32 %31, 4
%33 = icmp eq i32 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %30
%35 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 2
%36 = load i32, i32* %35
%37 = call i32 @printe(i32 %36)
%38 = load i32, i32* %3
br label %39
39: ; preds = %34, %30
%40 = phi i32 [ %38, %34 ], [ %31, %30 ]
%41 = and i32 %40, 8
%42 = icmp eq i32 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %39
%44 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 1
%45 = load i32, i32* %44
%46 = call i32 @printe(i32 %45)
%47 = load i32, i32* %3
br label %48
48: ; preds = %43, %39
%49 = phi i32 [ %47, %43 ], [ %40, %39 ]
%50 = and i32 %49, 16
%51 = icmp eq i32 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %48
%53 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i64 0, i32 0
%54 = load i32, i32* %53
%55 = call i32 @printe(i32 %54)
br label %56
56: ; preds = %52, %48
%57 = load i32, i32* @stdout
%58 = call i32 @putc(i8 signext 10, i32 %57)
%59 = load i32, i32* @stdout
%60 = call i32 @fflush(i32 %59)
br label %61
61: ; preds = %56, %10
%62 = phi i32 [ 1, %10 ], [ 0, %56 ]
ret i32 %62
}