#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*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int uname(struct utsname *);
void check_system_version() {
  struct utsname utsname;
  if (uname(&utsname) == -1) {
    fprintf(stderr, "uname failed: %s\n", strerror(errno));
    return;
  }
  fprintf(stdout, "OS\t\t: %s\n", utsname.sysname);
  fprintf(stdout, "Node\t\t: %s\n", utsname.nodename);
  fprintf(stdout, "Release\t\t: %s\n", utsname.release);
  fprintf(stdout, "Version\t\t: %s\n", utsname.version);
  fprintf(stdout, "Machine\t\t: %s\n", utsname.machine);
}


x86 assembly (clang, -O0):
<check_system_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x28(%rbp),%rdi
call   1030 <uname@plt>
cmp    $0xffffffff,%eax
jne    117b <check_system_version+0x4b>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11f8 <check_system_version+0xc8>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe83(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe74(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe67(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe5d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe53(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_system_version>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rdi
call   1030 <uname@plt>
cmp    $0xffffffff,%eax
je     11a7 <check_system_version+0x77>
mov    0x2e85(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rsp),%rdx
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    0x10(%rsp),%rdx
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    0x18(%rsp),%rdx
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    0x20(%rsp),%rdx
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    0x28(%rsp),%rdx
lea    0xea1(%rip),%rsi
jmp    11ca <check_system_version+0x9a>
mov    0x2e32(%rip),%rax
mov    (%rax),%ebx
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe3b(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
add    $0x30,%rsp
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@stderr = global i32 0
@.str = [18 x i8] c"uname failed: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
@.str.1 = [10 x i8] c"OS\09\09: %s\0A\00"
@.str.2 = [12 x i8] c"Node\09\09: %s\0A\00"
@.str.3 = [15 x i8] c"Release\09\09: %s\0A\00"
@.str.4 = [15 x i8] c"Version\09\09: %s\0A\00"
@.str.5 = [15 x i8] c"Machine\09\09: %s\0A\00"
define void @check_system_version() {
%1 = alloca %struct.utsname
%2 = call i32 @uname(%struct.utsname* %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %30
9: ; preds = %0
%10 = load i32, i32* @stdout
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i32 0, i32 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @stdout
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i32 0, i32 1
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stdout
%19 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i32 0, i32 2
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @stdout
%23 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i32 0, i32 3
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @stdout
%27 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i32 0, i32 4
%28 = load i8*, i8** %27
%29 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %9, %4
ret void
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@stderr = global i32 0
@.str = [18 x i8] c"uname failed: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
@.str.1 = [10 x i8] c"OS\09\09: %s\0A\00"
@.str.2 = [12 x i8] c"Node\09\09: %s\0A\00"
@.str.3 = [15 x i8] c"Release\09\09: %s\0A\00"
@.str.4 = [15 x i8] c"Version\09\09: %s\0A\00"
@.str.5 = [15 x i8] c"Machine\09\09: %s\0A\00"
define void @check_system_version() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i32 @uname(%struct.utsname* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %31
10: ; preds = %0
%11 = load i32, i32* @stdout
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%13 = load i8*, i8** %12
%14 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @stdout
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 1
%17 = load i8*, i8** %16
%18 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @stdout
%20 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 2
%21 = load i8*, i8** %20
%22 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @stdout
%24 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 3
%25 = load i8*, i8** %24
%26 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stdout
%28 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 4
%29 = load i8*, i8** %28
%30 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %10, %5
ret void
}