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

/* Variables and functions */
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
scalar_t__ uname(struct utsname *);
int myuname(struct utsname *buf) {
  if (uname(buf) >= 0) {
    strcpy(buf->sysname, "sandnet_module");
    strcpy(buf->nodename, "sandnet_module");
    strcpy(buf->release, "sandnet_module");
    strcpy(buf->version, "sandnet_module");
    strcpy(buf->machine, "sandnet_module");
    return 0;
  } else
    return -1;
}


x86 assembly (clang, -O0):
<myuname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <uname@plt>
cmp    $0x0,%rax
jl     11a9 <myuname+0x89>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edi
lea    0xea0(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
lea    0xe8d(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
lea    0xe7a(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <myuname+0x90>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myuname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <uname@plt>
test   %rax,%rax
js     1172 <myuname+0x52>
mov    0x10(%rbx),%edi
lea    0xec5(%rip),%r14
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    0xc(%rbx),%edi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%edi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    0x4(%rbx),%edi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    (%rbx),%edi
mov    %r14,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
jmp    1177 <myuname+0x57>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.utsname = type { i32, i32, i32, i32, i32 }
@.str = [15 x i8] c"sandnet_module\00"
define i32 @myuname(%struct.utsname* %0) {
%2 = alloca i32
%3 = alloca %struct.utsname*
store %struct.utsname* %0, %struct.utsname** %3
%4 = load %struct.utsname*, %struct.utsname** %3
%5 = call i64 @uname(%struct.utsname* %4)
%6 = icmp sge i64 %5, 0
br i1 %6, label %7, label %28
7: ; preds = %1
%8 = load %struct.utsname*, %struct.utsname** %3
%9 = getelementptr inbounds %struct.utsname, %struct.utsname* %8, i32 0, i32 4
%10 = load i32, i32* %9
%11 = call i32 @strcpy(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = load %struct.utsname*, %struct.utsname** %3
%13 = getelementptr inbounds %struct.utsname, %struct.utsname* %12, i32 0, i32 3
%14 = load i32, i32* %13
%15 = call i32 @strcpy(i32 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%16 = load %struct.utsname*, %struct.utsname** %3
%17 = getelementptr inbounds %struct.utsname, %struct.utsname* %16, i32 0, i32 2
%18 = load i32, i32* %17
%19 = call i32 @strcpy(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%20 = load %struct.utsname*, %struct.utsname** %3
%21 = getelementptr inbounds %struct.utsname, %struct.utsname* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = call i32 @strcpy(i32 %22, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%24 = load %struct.utsname*, %struct.utsname** %3
%25 = getelementptr inbounds %struct.utsname, %struct.utsname* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @strcpy(i32 %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %29
28: ; preds = %1
store i32 -1, i32* %2
br label %29
29: ; preds = %28, %7
%30 = load i32, i32* %2
ret i32 %30
}

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