#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 getticks();
scalar_t__ memalign(int, int);
unsigned long *seed_rand() {
  unsigned long *seeds;
  seeds = (unsigned long *)memalign(64, 64);
  seeds[0] = getticks() % 123456789;
  seeds[1] = getticks() % 362436069;
  seeds[2] = getticks() % 521288629;
  return seeds;
}


x86 assembly (clang, -O0):
<seed_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x40,%esi
mov    %esi,%edi
call   1040 <memalign@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getticks@plt>
mov    $0x75bcd15,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <getticks@plt>
mov    $0x159a55e5,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    $0x0,%al
call   1030 <getticks@plt>
mov    $0x1f123bb5,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seed_rand>:
push   %rbx
mov    $0x40,%edi
mov    $0x40,%esi
call   1040 <memalign@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getticks@plt>
cltq
imul   $0xffffffff8b282d55,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x1a,%ecx
add    %edx,%ecx
imul   $0x75bcd15,%ecx,%ecx
sub    %ecx,%eax
cltq
mov    %rax,(%rbx)
xor    %eax,%eax
call   1030 <getticks@plt>
cltq
imul   $0xbd9aba9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x38,%rcx
add    %edx,%ecx
imul   $0x159a55e5,%ecx,%ecx
sub    %ecx,%eax
cltq
mov    %rax,0x8(%rbx)
xor    %eax,%eax
call   1030 <getticks@plt>
cltq
imul   $0x41e9bf85,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x3b,%rcx
add    %edx,%ecx
imul   $0x1f123bb5,%ecx,%ecx
sub    %ecx,%eax
cltq
mov    %rax,0x10(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64* @seed_rand() {
%1 = alloca i64*
%2 = call i64 @memalign(i32 64, i32 64)
%3 = inttoptr i64 %2 to i64*
store i64* %3, i64** %1
%4 = call i32 (...) @getticks()
%5 = srem i32 %4, 123456789
%6 = sext i32 %5 to i64
%7 = load i64*, i64** %1
%8 = getelementptr inbounds i64, i64* %7, i64 0
store i64 %6, i64* %8
%9 = call i32 (...) @getticks()
%10 = srem i32 %9, 362436069
%11 = sext i32 %10 to i64
%12 = load i64*, i64** %1
%13 = getelementptr inbounds i64, i64* %12, i64 1
store i64 %11, i64* %13
%14 = call i32 (...) @getticks()
%15 = srem i32 %14, 521288629
%16 = sext i32 %15 to i64
%17 = load i64*, i64** %1
%18 = getelementptr inbounds i64, i64* %17, i64 2
store i64 %16, i64* %18
%19 = load i64*, i64** %1
ret i64* %19
}

LLVM IR (-O2):
define i64* @seed_rand() {
%1 = tail call i64 @memalign(i32 64, i32 64)
%2 = inttoptr i64 %1 to i64*
%3 = tail call i32 (...) @getticks()
%4 = srem i32 %3, 123456789
%5 = sext i32 %4 to i64
store i64 %5, i64* %2
%6 = tail call i32 (...) @getticks()
%7 = srem i32 %6, 362436069
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i64, i64* %2, i64 1
store i64 %8, i64* %9
%10 = tail call i32 (...) @getticks()
%11 = srem i32 %10, 521288629
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %2, i64 2
store i64 %12, i64* %13
ret i64* %2
}