#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 *machine;
};

/* Variables and functions */
int _error(char const *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ uname(struct utsname *);
int _uname(char const *progname) {
  struct utsname name;
  if (uname(&name))
    return -_error(progname, "utsname", 1);
  printf("%s\n", name.machine);
  return 0;
}


x86 assembly (clang, -O0):
<_uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0x0,%rax
je     1172 <_uname+0x42>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x1,%edx
call   1050 <_error@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <_uname+0x59>
mov    -0x18(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_uname>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
call   1040 <uname@plt>
test   %rax,%rax
je     115f <_uname+0x2f>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1050 <_error@plt>
neg    %eax
jmp    1172 <_uname+0x42>
mov    0x8(%rsp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.utsname = type { i8* }
@.str = [8 x i8] c"utsname\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @_uname(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.utsname
store i8* %0, i8** %3
%5 = call i64 @uname(%struct.utsname* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @_error(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = sub nsw i32 0, %9
store i32 %10, i32* %2
br label %15
11: ; preds = %1
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %4, i32 0, i32 0
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %13)
store i32 0, i32* %2
br label %15
15: ; preds = %11, %7
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.utsname = type { i8* }
@.str = [8 x i8] c"utsname\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @_uname(i8* %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 %9, label %6
6: ; preds = %1
%7 = tail call i32 @_error(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = sub nsw i32 0, %7
br label %13
9: ; preds = %1
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i64 0, i32 0
%11 = load i8*, i8** %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %9, %6
%14 = phi i32 [ %8, %6 ], [ 0, %9 ]
ret i32 %14
}