#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*/ printf(char *, ...);
scalar_t__ uname(struct utsname *);
int main(int argc, char **argv) {
  struct utsname unameData;
  if (uname(&unameData) == 0) {
    printf("uname.sysname = %s\n", unameData.sysname);
    printf("uname.nodename = %s\n", unameData.nodename);
    printf("uname.release = %s\n", unameData.release);
    printf("uname.version = %s\n", unameData.version);
    printf("uname.machine = %s\n", unameData.machine);
  } else {
    printf("FAILED - uname not available\n");
    return -1;
  }
  return 0;
}


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>
cmp    $0x0,%rax
jne    11a8 <main+0x88>
mov    -0x38(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <main+0xa9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rdi
call   1050 <uname@plt>
test   %rax,%rax
je     1157 <main+0x27>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    11b8 <main+0x88>
mov    0x8(%rsp),%rsi
lea    0xe9d(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%rsi
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%rsi
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%rsi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [20 x i8] c"uname.sysname = %s\0A\00"
@.str.1 = [21 x i8] c"uname.nodename = %s\0A\00"
@.str.2 = [20 x i8] c"uname.release = %s\0A\00"
@.str.3 = [20 x i8] c"uname.version = %s\0A\00"
@.str.4 = [20 x i8] c"uname.machine = %s\0A\00"
@str = [29 x i8] c"FAILED - uname not available\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.utsname
%4 = bitcast %struct.utsname* %3 to i8*
%5 = call i64 @uname(%struct.utsname* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %2
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 1
%12 = load i8*, i8** %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 2
%15 = load i8*, i8** %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 3
%18 = load i8*, i8** %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 4
%21 = load i8*, i8** %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %21)
br label %25
23: ; preds = %2
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %7, %23
%26 = phi i32 [ 0, %7 ], [ -1, %23 ]
ret i32 %26
}