#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 /*<<< orphan*/ EXIT_SUCCESS;
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
char *strerror(int);
int uname(struct utsname *);
int main(int args, char *argv[]) {
  struct utsname buf;
  int stat = uname(&buf);
  if (stat == -1) {
    int errn = errno;
    printf("uname: %s\n", strerror(errn));
    exit(EXIT_FAILURE);
  }
  printf("Sys name: %s\tnode name: %s\trelease: %s\tversion: %s\tmachine:%s",
         buf.sysname, buf.nodename, buf.release, buf.version, buf.machine);
  exit(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)
lea    -0x38(%rbp),%rdi
call   1040 <uname@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    119f <main+0x5f>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%edi
call   1060 <strerror@plt>
mov    %rax,%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1040 <uname@plt>
cmp    $0xffffffff,%eax
jne    117e <main+0x3e>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe9a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@errno = global i32 0
@.str = [11 x i8] c"uname: %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [62 x i8] c"Sys name: %s\09node name: %s\09release: %s\09version: %s\09machine:%s\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
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @uname(%struct.utsname* %6)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i32, i32* @errno
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = call i8* @strerror(i32 %14)
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 0
%21 = load i8*, i8** %20
%22 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 1
%23 = load i8*, i8** %22
%24 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 2
%25 = load i8*, i8** %24
%26 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 3
%27 = load i8*, i8** %26
%28 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i32 0, i32 4
%29 = load i8*, i8** %28
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %23, i8* %25, i8* %27, i8* %29)
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@errno = global i32 0
@.str = [11 x i8] c"uname: %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [62 x i8] c"Sys name: %s\09node name: %s\09release: %s\09version: %s\09machine:%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.utsname
%4 = bitcast %struct.utsname* %3 to i8*
%5 = call i32 @uname(%struct.utsname* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 1
%17 = load i8*, i8** %16
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 3
%21 = load i8*, i8** %20
%22 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 4
%23 = load i8*, i8** %22
%24 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %17, i8* %19, i8* %21, i8* %23)
%25 = load i32, i32* @EXIT_SUCCESS
%26 = tail call i32 @exit(i32 %25)
unreachable
}