#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;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, char *,
                           char *, char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ uname(struct utsname *);
void pr_uname(FILE *fp) {
  struct utsname buf;
  if (uname(&buf) == 0) {
    fprintf(fp,
            "sysname = %s\nnodename = %s\nrelease = %s\nversion = %s\nmachine "
            "= %s\n",
            buf.sysname, buf.nodename, buf.release, buf.version, buf.machine);
  } else
    perror("uname error");
}


x86 assembly (clang, -O0):
<pr_uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <uname@plt>
cmp    $0x0,%rax
jne    117c <pr_uname+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    -0x10(%rbp),%rax
lea    0xe92(%rip),%rsi
mov    %rax,(%rsp)
call   1040 <fprintf@plt>
jmp    1188 <pr_uname+0x58>
lea    0xec0(%rip),%rdi
call   1050 <perror@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_uname>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
call   1030 <uname@plt>
test   %rax,%rax
jne    1179 <pr_uname+0x49>
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
mov    0x28(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbx
ret
lea    0xec3(%rip),%rdi
add    $0x30,%rsp
pop    %rbx
jmp    1050 <perror@plt>

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [67 x i8] c"sysname = %s\0Anodename = %s\0Arelease = %s\0Aversion = %s\0Amachine = %s\0A\00"
@.str.1 = [12 x i8] c"uname error\00"
define void @pr_uname(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.utsname
store i32* %0, i32** %2
%4 = call i64 @uname(%struct.utsname* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 0
%9 = load i8*, i8** %8
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i32 0, i32 4
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %11, i8* %13, i8* %15, i8* %17)
br label %21
19: ; preds = %1
%20 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19, %6
ret void
}

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