#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 getTime(char *);
int maxrand(int max) {
  unsigned int *seed =
      (unsigned int *)getTime("hour") + getTime("minute") + getTime("second");
  unsigned int next = *seed;
  int result;
  next *= 1103515245;
  next += 12345;
  result = (unsigned int)(next / 65536) % 2048;
  next *= 1103515245;
  next += 12345;
  result <<= 10;
  result ^= (unsigned int)(next / 65536) % 1024;
  next *= 1103515245;
  next += 12345;
  result <<= 10;
  result ^= (unsigned int)(next / 65536) % 1024;
  *seed = next;
  return result % (max + 1);
}


x86 assembly (clang, -O0):
<maxrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <getTime@plt>
cltq
mov    %rax,-0x28(%rbp)
lea    0xed1(%rip),%rdi
call   1030 <getTime@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
lea    0xeb8(%rip),%rdi
call   1030 <getTime@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
imul   $0x41c64e6d,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x3039,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shr    $0x10,%eax
and    $0x7ff,%eax
mov    %eax,-0x18(%rbp)
imul   $0x41c64e6d,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x3039,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shr    $0x10,%eax
and    $0x3ff,%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x41c64e6d,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x3039,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shr    $0x10,%eax
and    $0x3ff,%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxrand>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xee4(%rip),%rdi
call   1030 <getTime@plt>
movslq %eax,%rbx
lea    0xeda(%rip),%rdi
call   1030 <getTime@plt>
cltq
lea    (%rbx,%rax,4),%rbx
lea    0xecf(%rip),%rdi
call   1030 <getTime@plt>
cltq
imul   $0x41c64e6d,(%rbx,%rax,4),%ecx
add    $0x3039,%ecx
imul   $0x41c64e6d,%ecx,%edx
add    $0x3039,%edx
shr    $0x6,%ecx
and    $0x1ffc00,%ecx
imul   $0x41c64e6d,%edx,%esi
shr    $0x10,%edx
and    $0x3ff,%edx
or     %ecx,%edx
add    $0x3039,%esi
shl    $0xa,%edx
mov    %esi,(%rbx,%rax,4)
mov    %esi,%eax
shr    $0x10,%eax
and    $0x3ff,%eax
or     %edx,%eax
add    $0x1,%ebp
xor    %edx,%edx
idiv   %ebp
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"hour\00"
@.str.1 = [7 x i8] c"minute\00"
@.str.2 = [7 x i8] c"second\00"
define i32 @maxrand(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = call i32 @getTime(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = call i32 @getTime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = call i32 @getTime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
store i32* %14, i32** %3
%15 = load i32*, i32** %3
%16 = load i32, i32* %15
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = mul i32 %17, 1103515245
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = add i32 %19, 12345
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = udiv i32 %21, 65536
%23 = urem i32 %22, 2048
store i32 %23, i32* %5
%24 = load i32, i32* %4
%25 = mul i32 %24, 1103515245
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = add i32 %26, 12345
store i32 %27, i32* %4
%28 = load i32, i32* %5
%29 = shl i32 %28, 10
store i32 %29, i32* %5
%30 = load i32, i32* %4
%31 = udiv i32 %30, 65536
%32 = urem i32 %31, 1024
%33 = load i32, i32* %5
%34 = xor i32 %33, %32
store i32 %34, i32* %5
%35 = load i32, i32* %4
%36 = mul i32 %35, 1103515245
store i32 %36, i32* %4
%37 = load i32, i32* %4
%38 = add i32 %37, 12345
store i32 %38, i32* %4
%39 = load i32, i32* %5
%40 = shl i32 %39, 10
store i32 %40, i32* %5
%41 = load i32, i32* %4
%42 = udiv i32 %41, 65536
%43 = urem i32 %42, 1024
%44 = load i32, i32* %5
%45 = xor i32 %44, %43
store i32 %45, i32* %5
%46 = load i32, i32* %4
%47 = load i32*, i32** %3
store i32 %46, i32* %47
%48 = load i32, i32* %5
%49 = load i32, i32* %2
%50 = add nsw i32 %49, 1
%51 = srem i32 %48, %50
ret i32 %51
}

LLVM IR (-O2):
@.str = [5 x i8] c"hour\00"
@.str.1 = [7 x i8] c"minute\00"
@.str.2 = [7 x i8] c"second\00"
define i32 @maxrand(i32 %0) {
%2 = tail call i32 @getTime(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @getTime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %4, i64 %6
%8 = tail call i32 @getTime(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = load i32, i32* %10
%12 = mul i32 %11, 1103515245
%13 = add i32 %12, 12345
%14 = mul i32 %13, 1103515245
%15 = add i32 %14, 12345
%16 = lshr i32 %13, 6
%17 = and i32 %16, 2096128
%18 = lshr i32 %15, 16
%19 = and i32 %18, 1023
%20 = or i32 %19, %17
%21 = mul i32 %15, 1103515245
%22 = add i32 %21, 12345
%23 = shl nuw nsw i32 %20, 10
%24 = lshr i32 %22, 16
%25 = and i32 %24, 1023
%26 = or i32 %23, %25
store i32 %22, i32* %10
%27 = add nsw i32 %0, 1
%28 = srem i32 %26, %27
ret i32 %28
}