#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 *machine;
  char *nodename;
  char *release;
  char *version;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ gethostname(char *, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ uname(struct utsname *);
int main() {
  char computer[256];
  struct utsname uts;
  if (gethostname(computer, 255) != 0 || uname(&uts) < 0) {
    fprintf(stderr, "Could not get host information\n");
    exit(1);
  }
  printf("Computer host name is %s\n", computer);
  printf("System is %s on %s hardware\n", uts.sysname, uts.machine);
  printf("Nodename is %s\n", uts.nodename);
  printf("Version is %s, %s\n", uts.release, uts.version);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
mov    $0xff,%esi
call   1060 <gethostname@plt>
cmp    $0x0,%rax
jne    1193 <main+0x43>
lea    -0x138(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0x0,%rax
jge    11b2 <main+0x62>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x110(%rbp),%rsi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x138(%rbp),%rsi
mov    -0x130(%rbp),%rdx
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x128(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x120(%rbp),%rsi
mov    -0x118(%rbp),%rdx
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x138,%rsp
lea    0x30(%rsp),%rdi
mov    $0xff,%esi
call   1060 <gethostname@plt>
test   %rax,%rax
jne    117a <main+0x2a>
lea    0x8(%rsp),%rdi
call   1040 <uname@plt>
test   %rax,%rax
jns    1199 <main+0x49>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe80(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
lea    0xe7d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rsi
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%rsi
mov    0x28(%rsp),%rdx
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@stderr = global i32 0
@.str = [32 x i8] c"Could not get host information\0A\00"
@.str.1 = [26 x i8] c"Computer host name is %s\0A\00"
@.str.2 = [29 x i8] c"System is %s on %s hardware\0A\00"
@.str.3 = [16 x i8] c"Nodename is %s\0A\00"
@.str.4 = [19 x i8] c"Version is %s, %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca %struct.utsname
store i32 0, i32* %1
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i64 @gethostname(i8* %4, i32 255)
%6 = icmp ne i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = call i64 @uname(%struct.utsname* %3)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7, %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %7
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 0
%18 = load i8*, i8** %17
%19 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %18, i8* %20)
%22 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 2
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 3
%26 = load i8*, i8** %25
%27 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 4
%28 = load i8*, i8** %27
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %26, i8* %28)
%30 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@stderr = global i32 0
@.str = [32 x i8] c"Could not get host information\0A\00"
@.str.1 = [26 x i8] c"Computer host name is %s\0A\00"
@.str.2 = [29 x i8] c"System is %s on %s hardware\0A\00"
@.str.3 = [16 x i8] c"Nodename is %s\0A\00"
@.str.4 = [19 x i8] c"Version is %s, %s\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca %struct.utsname
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = bitcast %struct.utsname* %2 to i8*
%5 = call i64 @gethostname(i8* %3, i32 255)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i64 @uname(%struct.utsname* %2)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7, %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %7
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 0
%17 = load i8*, i8** %16
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 1
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %19)
%21 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 2
%22 = load i8*, i8** %21
%23 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 3
%25 = load i8*, i8** %24
%26 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 4
%27 = load i8*, i8** %26
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %25, i8* %27)
%29 = call i32 @exit(i32 0)
unreachable
}