#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 {
  int tm_year;
  int tm_yday;
  int tm_hour;
  int tm_min;
  unsigned long long tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
unsigned long long int seconds(void) {
  time_t t;
  struct tm stm;
  t = time(NULL);
  localtime_r(&t, &stm);
  return ((stm.tm_year * 365 + stm.tm_yday) * 86400 + stm.tm_hour * 3600 +
          stm.tm_min * 60 + stm.tm_sec);
}


x86 assembly (clang, -O0):
<seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <localtime_r@plt>
imul   $0x16d,-0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
imul   $0x15180,%eax,%eax
imul   $0xe10,-0x18(%rbp),%ecx
add    %ecx,%eax
imul   $0x3c,-0x14(%rbp),%ecx
add    %ecx,%eax
cltq
add    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seconds>:
sub    $0x28,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <localtime_r@plt>
movslq 0x10(%rsp),%rax
imul   $0x16d,%rax,%rax
movslq 0x14(%rsp),%rcx
add    %rax,%rcx
imul   $0x15180,%rcx,%rax
movslq 0x18(%rsp),%rcx
imul   $0xe10,%rcx,%rcx
add    %rax,%rcx
movslq 0x1c(%rsp),%rax
imul   $0x3c,%rax,%rax
add    %rcx,%rax
add    0x20(%rsp),%rax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64 }
define i64 @seconds() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i32 @localtime_r(i32* %1, %struct.tm* %2)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 365
%8 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
%11 = mul nsw i32 %10, 86400
%12 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 2
%13 = load i32, i32* %12
%14 = mul nsw i32 %13, 3600
%15 = add nsw i32 %11, %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 3
%17 = load i32, i32* %16
%18 = mul nsw i32 %17, 60
%19 = add nsw i32 %15, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 4
%22 = load i64, i64* %21
%23 = add i64 %20, %22
ret i64 %23
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64 }
define i64 @seconds() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = call i32 @localtime_r(i32* %1, %struct.tm* %2)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 365
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %9, %11
%13 = mul nsw i32 %12, 86400
%14 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
%15 = load i32, i32* %14
%16 = mul nsw i32 %15, 3600
%17 = add nsw i32 %13, %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
%19 = load i32, i32* %18
%20 = mul nsw i32 %19, 60
%21 = add nsw i32 %17, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
%24 = load i64, i64* %23
%25 = add i64 %24, %22
ret i64 %25
}