#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 int /*<<< orphan*/ time_t;
struct tm {
  long tm_sec;
  int tm_min;
  int tm_hour;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
long timeseed(void) {
  struct tm *local;
  time_t t;
  long seed;
  seed = 1;
  t = time(NULL);
  local = localtime(&t);
  if (local->tm_sec)
    seed = local->tm_sec;
  if (local->tm_min)
    seed *= local->tm_min;
  if (local->tm_hour)
    seed *= local->tm_hour;
  return seed;
}


x86 assembly (clang, -O0):
<timeseed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x1,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1162 <timeseed+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
je     1181 <timeseed+0x61>
mov    -0x8(%rbp),%rax
movslq 0x8(%rax),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0xc(%rax)
je     11a0 <timeseed+0x80>
mov    -0x8(%rbp),%rax
movslq 0xc(%rax),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeseed>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%rcx
test   %rcx,%rcx
mov    $0x1,%edx
cmovne %rcx,%rdx
mov    0x8(%rax),%ecx
test   %ecx,%ecx
mov    $0x1,%esi
cmove  %esi,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
mov    0xc(%rax),%eax
test   %eax,%eax
cmove  %esi,%eax
cltq
imul   %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i32, i32 }
define i64 @timeseed() {
%1 = alloca %struct.tm*
%2 = alloca i32
%3 = alloca i64
store i64 1, i64* %3
%4 = call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %5, %struct.tm** %1
%6 = load %struct.tm*, %struct.tm** %1
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load %struct.tm*, %struct.tm** %1
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i64, i64* %12
store i64 %13, i64* %3
br label %14
14: ; preds = %10, %0
%15 = load %struct.tm*, %struct.tm** %1
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load %struct.tm*, %struct.tm** %1
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = load i64, i64* %3
%25 = mul nsw i64 %24, %23
store i64 %25, i64* %3
br label %26
26: ; preds = %19, %14
%27 = load %struct.tm*, %struct.tm** %1
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 2
%29 = load i32, i32* %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %26
%32 = load %struct.tm*, %struct.tm** %1
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 2
%34 = load i32, i32* %33
%35 = sext i32 %34 to i64
%36 = load i64, i64* %3
%37 = mul nsw i64 %36, %35
store i64 %37, i64* %3
br label %38
38: ; preds = %31, %26
%39 = load i64, i64* %3
ret i64 %39
}

LLVM IR (-O2):
%struct.tm = type { i64, i32, i32 }
define i64 @timeseed() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i64 1, i64 %6
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 1, i32 %10
%13 = sext i32 %12 to i64
%14 = mul nsw i64 %8, %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i32 1, i32 %16
%19 = sext i32 %18 to i64
%20 = mul nsw i64 %14, %19
ret i64 %20
}