#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 *);
int uname(struct utsname *);
void uname1() {
  struct utsname ubuf;
  int ret = uname(&ubuf);
  if (ret < 0) {
    perror("uname fail:");
    return;
  }
  printf("sysname %s node name %s release %s version %s machine %s\n",
         ubuf.sysname, ubuf.nodename, ubuf.release, ubuf.version, ubuf.machine);
}


x86 assembly (clang, -O0):
<uname1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x28(%rbp),%rdi
call   1040 <uname@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    115f <uname1+0x2f>
lea    0xeab(%rip),%rdi
call   1050 <perror@plt>
jmp    117f <uname1+0x4f>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x8(%rbp),%r9
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uname1>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1040 <uname@plt>
test   %eax,%eax
js     1168 <uname1+0x38>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
lea    0xead(%rip),%rdi
add    $0x28,%rsp
jmp    1030 <printf@plt>
lea    0xe91(%rip),%rdi
add    $0x28,%rsp
jmp    1050 <perror@plt>

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

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [12 x i8] c"uname fail:\00"
@.str.1 = [58 x i8] c"sysname %s node name %s release %s version %s machine %s\0A\00"
define void @uname1() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i32 @uname(%struct.utsname* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %19
7: ; preds = %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 ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %11, i8* %13, i8* %15, i8* %17)
br label %19
19: ; preds = %7, %5
ret void
}