#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 */
typedef int uint32_t;
struct sysinfo {
  scalar_t__ uptime;
  scalar_t__ bufferram;
  scalar_t__ sharedram;
};
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ getpid();
int hashint(int);
int /*<<< orphan*/ sysinfo(struct sysinfo *);
scalar_t__ time(int /*<<< orphan*/ *);
uint32_t genSeed(void) {
  uint32_t res;
  struct sysinfo sy;
  pid_t pid = getpid();
  sysinfo(&sy);
  res = hashint((uint32_t)pid) ^ hashint((uint32_t)time(NULL)) ^
        hashint((uint32_t)sy.sharedram) ^ hashint((uint32_t)sy.bufferram) ^
        hashint((uint32_t)sy.uptime);
  return hashint(res);
}


x86 assembly (clang, -O0):
<genSeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <sysinfo@plt>
mov    -0x28(%rbp),%rax
mov    %eax,%edi
call   1030 <hashint@plt>
mov    %eax,-0x38(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <hashint@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1030 <hashint@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1030 <hashint@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,%edi
call   1030 <hashint@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <hashint@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genSeed>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
call   1060 <sysinfo@plt>
mov    %ebx,%edi
call   1030 <hashint@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <hashint@plt>
xor    %eax,%ebx
mov    0x10(%rsp),%edi
call   1030 <hashint@plt>
xor    %eax,%ebx
mov    0x8(%rsp),%edi
call   1030 <hashint@plt>
mov    %eax,%ebp
mov    (%rsp),%edi
call   1030 <hashint@plt>
xor    %eax,%ebp
xor    %ebx,%ebp
mov    %ebp,%edi
call   1030 <hashint@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sysinfo = type { i64, i64, i64 }
define i32 @genSeed() {
%1 = alloca i32
%2 = alloca %struct.sysinfo
%3 = alloca i64
%4 = call i64 (...) @getpid()
store i64 %4, i64* %3
%5 = call i32 @sysinfo(%struct.sysinfo* %2)
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
%8 = call i32 @hashint(i32 %7)
%9 = call i64 @time(i32* null)
%10 = trunc i64 %9 to i32
%11 = call i32 @hashint(i32 %10)
%12 = xor i32 %8, %11
%13 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 2
%14 = load i64, i64* %13
%15 = trunc i64 %14 to i32
%16 = call i32 @hashint(i32 %15)
%17 = xor i32 %12, %16
%18 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 1
%19 = load i64, i64* %18
%20 = trunc i64 %19 to i32
%21 = call i32 @hashint(i32 %20)
%22 = xor i32 %17, %21
%23 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %2, i32 0, i32 0
%24 = load i64, i64* %23
%25 = trunc i64 %24 to i32
%26 = call i32 @hashint(i32 %25)
%27 = xor i32 %22, %26
store i32 %27, i32* %1
%28 = load i32, i32* %1
%29 = call i32 @hashint(i32 %28)
ret i32 %29
}

LLVM IR (-O2):
%struct.sysinfo = type { i64, i64, i64 }
define i32 @genSeed() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = tail call i64 (...) @getpid()
%4 = call i32 @sysinfo(%struct.sysinfo* %1)
%5 = trunc i64 %3 to i32
%6 = call i32 @hashint(i32 %5)
%7 = call i64 @time(i32* null)
%8 = trunc i64 %7 to i32
%9 = call i32 @hashint(i32 %8)
%10 = xor i32 %9, %6
%11 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 2
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = call i32 @hashint(i32 %13)
%15 = xor i32 %10, %14
%16 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 1
%17 = load i64, i64* %16
%18 = trunc i64 %17 to i32
%19 = call i32 @hashint(i32 %18)
%20 = xor i32 %15, %19
%21 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = call i32 @hashint(i32 %23)
%25 = xor i32 %20, %24
%26 = call i32 @hashint(i32 %25)
ret i32 %26
}