#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 cmd_uname(int argc, char *argv[]) {
  struct utsname info;
  if (uname(&info) == -1)
    perror("uname");
  else
    printf("%s %s %s %s %s\n", info.sysname, info.nodename, info.release,
           info.version, info.machine);
}


x86 assembly (clang, -O0):
<cmd_uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x38(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0xffffffff,%eax
jne    1162 <cmd_uname+0x32>
lea    0xea8(%rip),%rdi
call   1050 <perror@plt>
jmp    1182 <cmd_uname+0x52>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_uname>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1040 <uname@plt>
cmp    $0xffffffff,%eax
je     1169 <cmd_uname+0x39>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
lea    0xea6(%rip),%rdi
add    $0x28,%rsp
jmp    1030 <printf@plt>
lea    0xe90(%rip),%rdi
add    $0x28,%rsp
jmp    1050 <perror@plt>

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 void @cmd_uname(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.utsname
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 @uname(%struct.utsname* %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %22
10: ; preds = %2
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 0
%12 = load i8*, i8** %11
%13 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 3
%18 = load i8*, i8** %17
%19 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 4
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %14, i8* %16, i8* %18, i8* %20)
br label %22
22: ; preds = %10, %8
ret void
}

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 void @cmd_uname(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 %9
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %21
9: ; preds = %2
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%11 = load i8*, i8** %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 2
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 3
%17 = load i8*, i8** %16
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 4
%19 = load i8*, i8** %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %13, i8* %15, i8* %17, i8* %19)
br label %21
21: ; preds = %9, %7
ret void
}