#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 {
  int /*<<< orphan*/ release;
  int /*<<< orphan*/ sysname;
  int /*<<< orphan*/ nodename;
};

/* Variables and functions */
int /*<<< orphan*/ die_errno(char *);
scalar_t__ uname(struct utsname *);
int /*<<< orphan*/ xasprintf(char **, char *, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/);
char *calculate_trust_label(void) {
  char *trusted_label;
  struct utsname utsname;
  if (uname(&utsname) < 0)
    die_errno("Failed to determine uname.");
  xasprintf(&trusted_label, "%s - %s %s", utsname.nodename, utsname.sysname,
            utsname.release);
  return trusted_label;
}


x86 assembly (clang, -O0):
<calculate_trust_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
call   1030 <uname@plt>
cmp    $0x0,%rax
jge    1157 <calculate_trust_label+0x27>
lea    0xeae(%rip),%rdi
call   1050 <die_errno@plt>
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <xasprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_trust_label>:
sub    $0x18,%rsp
mov    %rsp,%rdi
call   1030 <uname@plt>
test   %rax,%rax
jns    114d <calculate_trust_label+0x1d>
lea    0xeb8(%rip),%rdi
call   1050 <die_errno@plt>
mov    0x8(%rsp),%edx
mov    (%rsp),%r8d
mov    0x4(%rsp),%ecx
lea    0xebb(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1040 <xasprintf@plt>
mov    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.utsname = type { i32, i32, i32 }
@.str = [27 x i8] c"Failed to determine uname.\00"
@.str.1 = [11 x i8] c"%s - %s %s\00"
define i8* @calculate_trust_label() {
%1 = alloca i8*
%2 = alloca %struct.utsname
%3 = call i64 @uname(%struct.utsname* %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @die_errno(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 2
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 1
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @xasprintf(i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %11, i32 %13)
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32, i32 }
@.str = [27 x i8] c"Failed to determine uname.\00"
@.str.1 = [11 x i8] c"%s - %s %s\00"
define i8* @calculate_trust_label() {
%1 = alloca i8*
%2 = alloca %struct.utsname
%3 = bitcast i8** %1 to i8*
%4 = bitcast %struct.utsname* %2 to i8*
%5 = call i64 @uname(%struct.utsname* %2)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @die_errno(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @xasprintf(i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %13, i32 %15)
%17 = load i8*, i8** %1
ret i8* %17
}