#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*/ sysname;
};

/* Variables and functions */
int /*<<< orphan*/ memset(struct utsname *, int, int);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
int uname(struct utsname *__name) {
  if (!__name)
    return -1;
  memset(__name, 9, sizeof(struct utsname));
  strcpy(__name->sysname, "siemens");
  strcpy(__name->machine, "armv5");
  return 0;
}


x86 assembly (clang, -O0):
<uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <uname+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    1182 <uname+0x62>
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uname>:
test   %rdi,%rdi
je     1159 <uname+0x39>
push   %rbx
mov    %rdi,%rbx
mov    $0x9,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    0x4(%rbx),%edi
lea    0xebe(%rip),%rsi
call   1030 <strcpy@plt>
mov    (%rbx),%edi
lea    0xeb8(%rip),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.utsname = type { i32, i32 }
@.str = [8 x i8] c"siemens\00"
@.str.1 = [6 x i8] c"armv5\00"
define i32 @uname(%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 = icmp ne %struct.utsname* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 -1, i32* %2
br label %18
7: ; preds = %1
%8 = load %struct.utsname*, %struct.utsname** %3
%9 = call i32 @memset(%struct.utsname* %8, i32 9, i32 8)
%10 = load %struct.utsname*, %struct.utsname** %3
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = call i32 @strcpy(i32 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%14 = load %struct.utsname*, %struct.utsname** %3
%15 = getelementptr inbounds %struct.utsname, %struct.utsname* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 @strcpy(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %18
18: ; preds = %7, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.utsname = type { i32, i32 }
@.str = [8 x i8] c"siemens\00"
@.str.1 = [6 x i8] c"armv5\00"
define i32 @uname(%struct.utsname* %0) {
%2 = icmp eq %struct.utsname* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @memset(%struct.utsname* %0, i32 9, i32 8)
%5 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = tail call i32 @strcpy(i32 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 0
%9 = load i32, i32* %8
%10 = tail call i32 @strcpy(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %1, %3
%12 = phi i32 [ 0, %3 ], [ -1, %1 ]
ret i32 %12
}