#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*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *, char *);
scalar_t__ uname(struct utsname *);
int main(void) {
  struct utsname ptr;
  if (uname(&ptr) < 0) {
    perror("uname");
  }
  if (&ptr != NULL) {
    printf("%s %s %s %s %s\n", ptr.sysname, ptr.nodename, ptr.release,
           ptr.version, ptr.machine);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0x0,%rax
jge    115e <main+0x2e>
lea    0xea7(%rip),%rdi
call   1050 <perror@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1040 <uname@plt>
test   %rax,%rax
js     116c <main+0x3c>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret
lea    0xe8d(%rip),%rdi
call   1050 <perror@plt>
jmp    1141 <main+0x11>

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [6 x i8] c"uname\00"
@.str.1 = [16 x i8] c"%s %s %s %s %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.utsname
store i32 0, i32* %1
%3 = call i64 @uname(%struct.utsname* %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 0
%9 = load i8*, i8** %8
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 4
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %11, i8* %13, i8* %15, i8* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [6 x i8] c"uname\00"
@.str.1 = [16 x i8] c"%s %s %s %s %s\0A\00"
define i32 @main() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i64 @uname(%struct.utsname* %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%9 = load i8*, i8** %8
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 4
%17 = load i8*, i8** %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %11, i8* %13, i8* %15, i8* %17)
ret i32 0
}