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

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ uname(struct utsname *);
char *svz_sys_version(void) {
  static char os[256] = "";
  struct utsname buf;
  if (os[0])
    return os;
  uname(&buf);
  sprintf(os, "%s %s on %s", buf.sysname, buf.release, buf.machine);
  return os;
}


x86 assembly (clang, -O0):
<svz_sys_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpb   $0x0,0x2f11(%rip)
je     1145 <svz_sys_version+0x25>
lea    0x2f04(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <svz_sys_version+0x58>
lea    -0x20(%rbp),%rdi
call   1030 <uname@plt>
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0x2edf(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2ecc(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svz_sys_version>:
sub    $0x18,%rsp
cmpb   $0x0,0x2f15(%rip)
jne    1156 <svz_sys_version+0x36>
mov    %rsp,%rdi
call   1030 <uname@plt>
mov    (%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%r8
lea    0x2ef6(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2ee3(%rip),%rax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
%struct.utsname = type { i8*, i8*, i8* }
@svz_sys_version.os = internal global [256 x i8] zeroinitializer
@.str = [12 x i8] c"%s %s on %s\00"
define i8* @svz_sys_version() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @svz_sys_version.os, i64 0, i64 0)
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %0
%6 = call i32 @uname(%struct.utsname* %1)
%7 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%8 = load i8*, i8** %7
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 2
%12 = load i8*, i8** %11
%13 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @svz_sys_version.os, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %10, i8* %12)
br label %14
14: ; preds = %0, %5
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @svz_sys_version.os, i64 0, i64 0)
}