#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*/ snprintf(char *, int, char *, char *, char *, char *, char *,
                            char *);
int /*<<< orphan*/ uname(struct utsname *);
void setup_hostinfo(char *buf, int len) {
  struct utsname host;
  uname(&host);
  snprintf(buf, len, "%s %s %s %s %s", host.sysname, host.nodename,
           host.release, host.version, host.machine);
}


x86 assembly (clang, -O0):
<setup_hostinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x38(%rbp),%rdi
call   1040 <uname@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x18(%rbp),%rax
lea    0xea6(%rip),%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <snprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_hostinfo>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x10(%rsp),%rdi
call   1040 <uname@plt>
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
movups 0x28(%rsp),%xmm0
movups %xmm0,(%rsp)
lea    0xeac(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <snprintf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [15 x i8] c"%s %s %s %s %s\00"
define void @setup_hostinfo(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.utsname
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 @uname(%struct.utsname* %5)
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 0
%10 = load i8*, i8** %9
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 3
%16 = load i8*, i8** %15
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 4
%18 = load i8*, i8** %17
%19 = call i32 @snprintf(i8* %7, i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %12, i8* %14, i8* %16, i8* %18)
ret void
}

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@.str = [15 x i8] c"%s %s %s %s %s\00"
define void @setup_hostinfo(i8* %0, i32 %1) {
%3 = alloca %struct.utsname
%4 = bitcast %struct.utsname* %3 to i8*
%5 = call i32 @uname(%struct.utsname* %3)
%6 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%7 = load i8*, i8** %6
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 3
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 4
%15 = load i8*, i8** %14
%16 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %9, i8* %11, i8* %13, i8* %15)
ret void
}