#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 scalar_t__ ushort;
struct timezone {
  int dummy;
};
struct timeval {
  int tv_usec;
};

/* Variables and functions */
scalar_t__ getpid();
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
void create_seed(ushort xsub1[3]) {
  struct timeval randtime;
  gettimeofday(&randtime, (struct timezone *)0);
  xsub1[0] = (ushort)(randtime.tv_usec);
  xsub1[1] = (ushort)(randtime.tv_usec >> 16);
  xsub1[2] = (ushort)(getpid());
}


x86 assembly (clang, -O0):
<create_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
movslq -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%eax
sar    $0x10,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_seed>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
mov    %rax,(%rbx)
sar    $0x10,%eax
cltq
mov    %rax,0x8(%rbx)
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %rax,0x10(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define void @create_seed(i64* %0) {
%2 = alloca i64*
%3 = alloca %struct.timeval
store i64* %0, i64** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, %struct.timezone* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = load i64*, i64** %2
%9 = getelementptr inbounds i64, i64* %8, i64 0
store i64 %7, i64* %9
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%11 = load i32, i32* %10
%12 = ashr i32 %11, 16
%13 = sext i32 %12 to i64
%14 = load i64*, i64** %2
%15 = getelementptr inbounds i64, i64* %14, i64 1
store i64 %13, i64* %15
%16 = call i64 (...) @getpid()
%17 = load i64*, i64** %2
%18 = getelementptr inbounds i64, i64* %17, i64 2
store i64 %16, i64* %18
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define void @create_seed(i64* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, %struct.timezone* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
store i64 %7, i64* %0
%8 = ashr i32 %6, 16
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %9, i64* %10
%11 = tail call i64 (...) @getpid()
%12 = getelementptr inbounds i64, i64* %0, i64 2
store i64 %11, i64* %12
ret void
}