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

/* Variables and functions */
int /*<<< orphan*/ QSlog(char *, ...);
scalar_t__ getpid();
int uname(struct utsname *);
void EGlib_info(void) {
  int rval;
  struct utsname uts;
  rval = uname(&uts);
  if (rval) {
    QSlog("Can't get host info");
  } else {
    QSlog("Host: %s, %s %s %s", uts.nodename, uts.sysname, uts.release,
          uts.machine);
    QSlog("Current process id: %d", (int)getpid());
  }
}


x86 assembly (clang, -O0):
<EGlib_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
call   1040 <uname@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1161 <EGlib_info+0x31>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1050 <QSlog@plt>
jmp    1193 <EGlib_info+0x63>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1050 <QSlog@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <QSlog@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EGlib_info>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1040 <uname@plt>
test   %eax,%eax
je     1154 <EGlib_info+0x24>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
jmp    1050 <QSlog@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x8(%rsp),%r8d
mov    0xc(%rsp),%ecx
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <QSlog@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
add    $0x18,%rsp
jmp    1050 <QSlog@plt>

LLVM IR (-O0):
%struct.utsname = type { i32, i32, i32, i32 }
@.str = [20 x i8] c"Can't get host info\00"
@.str.1 = [19 x i8] c"Host: %s, %s %s %s\00"
@.str.2 = [23 x i8] c"Current process id: %d\00"
define void @EGlib_info() {
%1 = alloca i32
%2 = alloca %struct.utsname
%3 = call i32 @uname(%struct.utsname* %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (i8*, ...) @QSlog(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %21
8: ; preds = %0
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 3
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %2, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @QSlog(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12, i32 %14, i32 %16)
%18 = call i64 (...) @getpid()
%19 = trunc i64 %18 to i32
%20 = call i32 (i8*, ...) @QSlog(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32, i32, i32 }
@.str = [20 x i8] c"Can't get host info\00"
@.str.1 = [19 x i8] c"Host: %s, %s %s %s\00"
@.str.2 = [23 x i8] c"Current process id: %d\00"
define void @EGlib_info() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i32 @uname(%struct.utsname* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 (i8*, ...) @QSlog(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %20
7: ; preds = %0
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 3
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @QSlog(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %11, i32 %13, i32 %15)
%17 = tail call i64 (...) @getpid()
%18 = trunc i64 %17 to i32
%19 = tail call i32 (i8*, ...) @QSlog(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %7, %5
ret void
}