#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 *);
int uname(struct utsname *name) {
  strcpy(name->sysname, "Anvil");
  strcpy(name->nodename, "localhost");
  strcpy(name->release, "0.0.1");
  strcpy(name->version, "r1");
  strcpy(name->machine, "x86_64");
  return 0;
}


x86 assembly (clang, -O0):
<uname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%edi
lea    0xed6(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
lea    0xec0(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uname>:
push   %rbx
mov    %rdi,%rbx
mov    0x10(%rdi),%edi
lea    0xee2(%rip),%rsi
call   1030 <strcpy@plt>
mov    0xc(%rbx),%edi
lea    0xed9(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%edi
lea    0xed4(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x4(%rbx),%edi
lea    0xecb(%rip),%rsi
call   1030 <strcpy@plt>
mov    (%rbx),%edi
lea    0xec0(%rip),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.utsname = type { i32, i32, i32, i32, i32 }
@.str = [6 x i8] c"Anvil\00"
@.str.1 = [10 x i8] c"localhost\00"
@.str.2 = [6 x i8] c"0.0.1\00"
@.str.3 = [3 x i8] c"r1\00"
@.str.4 = [7 x i8] c"x86_64\00"
define i32 @uname(%struct.utsname* nocapture %0) {
%2 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 4
%3 = load i32, i32* %2
%4 = tail call i32 @strcpy(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 3
%6 = load i32, i32* %5
%7 = tail call i32 @strcpy(i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 2
%9 = load i32, i32* %8
%10 = tail call i32 @strcpy(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 1
%12 = load i32, i32* %11
%13 = tail call i32 @strcpy(i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %0, i64 0, i32 0
%15 = load i32, i32* %14
%16 = tail call i32 @strcpy(i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}