#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 */
struct tms {
  int tms_cutime;
  int tms_stime;
  int tms_utime;
  int tms_cstime;
};
typedef int clock_t;

/* Variables and functions */
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, unsigned int, int);
int time(int /*<<< orphan*/ *);
int times(struct tms *);
int main() {
  int i, j;
  unsigned int seed;
  struct tms tms;
  clock_t num_ticks = 0;
  num_ticks = times(&tms);
  num_ticks = tms.tms_cutime + tms.tms_stime + tms.tms_utime + tms.tms_cstime +
              num_ticks;
  num_ticks += clock();
  num_ticks += time(NULL);
  num_ticks =
      128 -
      ((unsigned char)(((unsigned int)(num_ticks >> 31) >> 24) + num_ticks) -
       ((unsigned int)(num_ticks >> 31) >> 24));
  seed = num_ticks + time(0);
  printf("seed=%#x\nticks=%#x\n", seed, num_ticks & 0x7fffffff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <times@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x1f,%eax
shr    $0x18,%eax
add    -0x24(%rbp),%eax
movzbl %al,%ecx
mov    -0x24(%rbp),%eax
sar    $0x1f,%eax
shr    $0x18,%eax
sub    %eax,%ecx
mov    $0x80,%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x24(%rbp),%edx
and    $0x7fffffff,%edx
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0x10(%rsp),%rdi
call   1060 <times@plt>
mov    %eax,%ebp
movaps 0x10(%rsp),%xmm0
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1050 <time@plt>
movdqa (%rsp),%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%ecx
add    %ebp,%ecx
add    %ebx,%ecx
add    %eax,%ecx
mov    %ecx,%eax
sar    $0x1f,%eax
shr    $0x18,%eax
add    %eax,%ecx
movzbl %cl,%ecx
mov    %eax,%ebp
sub    %ecx,%ebp
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x80,%ebx
xor    %edi,%edi
call   1050 <time@plt>
lea    (%rax,%rbp,1),%esi
add    $0x80,%esi
and    $0x7fffffff,%ebx
lea    0xe3a(%rip),%rdi
mov    %ebx,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tms = type { i32, i32, i32, i32 }
@.str = [20 x i8] c"seed=%#x\0Aticks=%#x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.tms
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 @times(%struct.tms* %5)
store i32 %7, i32* %6
%8 = getelementptr inbounds %struct.tms, %struct.tms* %5, i32 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.tms, %struct.tms* %5, i32 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %9, %11
%13 = getelementptr inbounds %struct.tms, %struct.tms* %5, i32 0, i32 2
%14 = load i32, i32* %13
%15 = add nsw i32 %12, %14
%16 = getelementptr inbounds %struct.tms, %struct.tms* %5, i32 0, i32 3
%17 = load i32, i32* %16
%18 = add nsw i32 %15, %17
%19 = load i32, i32* %6
%20 = add nsw i32 %18, %19
store i32 %20, i32* %6
%21 = call i64 (...) @clock()
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = add nsw i64 %23, %21
%25 = trunc i64 %24 to i32
store i32 %25, i32* %6
%26 = call i32 @time(i32* null)
%27 = load i32, i32* %6
%28 = add nsw i32 %27, %26
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = ashr i32 %29, 31
%31 = lshr i32 %30, 24
%32 = load i32, i32* %6
%33 = add i32 %31, %32
%34 = trunc i32 %33 to i8
%35 = zext i8 %34 to i32
%36 = load i32, i32* %6
%37 = ashr i32 %36, 31
%38 = lshr i32 %37, 24
%39 = sub i32 %35, %38
%40 = sub i32 128, %39
store i32 %40, i32* %6
%41 = load i32, i32* %6
%42 = call i32 @time(i32* null)
%43 = add nsw i32 %41, %42
store i32 %43, i32* %4
%44 = load i32, i32* %4
%45 = load i32, i32* %6
%46 = and i32 %45, 2147483647
%47 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %44, i32 %46)
ret i32 0
}

LLVM IR (-O2):
%struct.tms = type { i32, i32, i32, i32 }
@.str = [20 x i8] c"seed=%#x\0Aticks=%#x\0A\00"
define i32 @main() {
%1 = alloca <4 x i32>
%2 = bitcast <4 x i32>* %1 to %struct.tms*
%3 = bitcast <4 x i32>* %1 to i8*
%4 = call i32 @times(%struct.tms* %2)
%5 = load <4 x i32>, <4 x i32>* %1
%6 = tail call i64 (...) @clock()
%7 = trunc i64 %6 to i32
%8 = tail call i32 @time(i32* null)
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %5)
%10 = add i32 %9, %4
%11 = add i32 %10, %7
%12 = add i32 %11, %8
%13 = ashr i32 %12, 31
%14 = lshr i32 %13, 24
%15 = add i32 %14, %12
%16 = and i32 %15, 255
%17 = sub nsw i32 %14, %16
%18 = add nsw i32 %17, 128
%19 = tail call i32 @time(i32* null)
%20 = add nsw i32 %18, %19
%21 = and i32 %18, 2147483647
%22 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
ret i32 0
}