#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*/ printf(char *, ...);
scalar_t__ uname(struct utsname *);
int main() {
  struct utsname buf;
  if (uname(&buf) == 0) {
    printf("%s\n", buf.sysname);
    printf("%s\n", buf.nodename);
    printf("%s\n", buf.release);
    printf("%s\n", buf.version);
    printf("%s\n", buf.machine);
  } else {
    printf("error at uname.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0x0,%rax
jne    11a1 <main+0x81>
mov    -0x30(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11af <main+0x8f>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1040 <uname@plt>
test   %rax,%rax
je     113a <main+0x1a>
lea    0xec8(%rip),%rdi
jmp    1166 <main+0x46>
mov    (%rsp),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rdi
call   1030 <puts@plt>
mov    0x18(%rsp),%rdi
call   1030 <puts@plt>
mov    0x20(%rsp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8*, i8*, i8* }
@str = [16 x i8] c"error at uname.\00"
define i32 @main() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i64 @uname(%struct.utsname* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %20
5: ; preds = %0
%6 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%7 = load i8*, i8** %6
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 1
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 2
%13 = load i8*, i8** %12
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 3
%16 = load i8*, i8** %15
%17 = tail call i32 @puts(i8* dereferenceable(1) %16)
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 4
%19 = load i8*, i8** %18
br label %20
20: ; preds = %0, %5
%21 = phi i8* [ %19, %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), %0 ]
%22 = tail call i32 @puts(i8* dereferenceable(1) %21)
ret i32 0
}