#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 */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
unsigned int getpid();
int /*<<< orphan*/ srandom(unsigned int);
int /*<<< orphan*/ stderr;
unsigned int time(int /*<<< orphan*/ *);
void seed_random(void) {
  unsigned int seed = time(NULL) ^ getpid();
  seed ^= (seed << 19);
  seed ^= (seed >> 11);
  seed ^= (seed << 9);
  fprintf(stderr, "seed = %u\n", seed);
  srandom(seed);
}


x86 assembly (clang, -O0):
<seed_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x13,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xb,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x9,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe64(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1030 <srandom@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seed_random>:
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
xor    %eax,%ebx
mov    %ebx,%eax
shl    $0x13,%eax
xor    %ebx,%eax
mov    %eax,%ecx
shr    $0xb,%ecx
xor    %eax,%ecx
mov    %ecx,%ebx
shl    $0x9,%ebx
xor    %ecx,%ebx
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
mov    %ebx,%edx
call   1050 <fprintf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <srandom@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"seed = %u\0A\00"
define void @seed_random() {
%1 = alloca i32
%2 = call i32 @time(i32* null)
%3 = call i32 (...) @getpid()
%4 = xor i32 %2, %3
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = shl i32 %5, 19
%7 = load i32, i32* %1
%8 = xor i32 %7, %6
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = lshr i32 %9, 11
%11 = load i32, i32* %1
%12 = xor i32 %11, %10
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = shl i32 %13, 9
%15 = load i32, i32* %1
%16 = xor i32 %15, %14
store i32 %16, i32* %1
%17 = load i32, i32* @stderr
%18 = load i32, i32* %1
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %1
%21 = call i32 @srandom(i32 %20)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"seed = %u\0A\00"
define void @seed_random() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 (...) @getpid()
%3 = xor i32 %2, %1
%4 = shl i32 %3, 19
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 11
%7 = xor i32 %6, %5
%8 = shl i32 %7, 9
%9 = xor i32 %8, %7
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9)
%12 = tail call i32 @srandom(i32 %9)
ret void
}