#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 ozday();
long ozhour();
scalar_t__ ozmin();
int ozmonth();
unsigned long ozsec();
unsigned long ozyear();
unsigned long time0(void) {
  static unsigned long scalar;
  static unsigned long yr;
  static int mo;
  yr = ozyear();
  mo = ozmonth();
  scalar = ozday() + ((mo * 3057 - 3007) / 100);
  if (mo > 2)
    scalar -= (yr % 400 == 0 || (yr % 4 == 0 && yr % 100 != 0)) ? 1 : 2;
  yr--;
  scalar += (yr * 365L + yr / 4 - yr / 100 + yr / 400) -
            (1970 * 365L + 1970 / 4 - 1970 / 100 + 1970 / 400);
  return scalar * 86400L + ozhour() * 3600L + (unsigned int)ozmin() * 60 +
         ozsec();
}


x86 assembly (clang, -O0):
<time0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1030 <ozyear@plt>
mov    %rax,0x2eea(%rip)
mov    $0x0,%al
call   1050 <ozmonth@plt>
mov    %eax,0x2ee5(%rip)
mov    $0x0,%al
call   1060 <ozday@plt>
mov    %eax,-0x4(%rbp)
imul   $0xbf1,0x2ed1(%rip),%eax
sub    $0xbbf,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    %ecx,%eax
cltq
mov    %rax,0x2ea4(%rip)
cmpl   $0x2,0x2ead(%rip)
jle    1243 <time0+0xe3>
mov    0x2e98(%rip),%rax
mov    $0x190,%ecx
xor    %edx,%edx
div    %rcx
mov    $0x1,%al
cmp    $0x0,%rdx
mov    %al,-0x5(%rbp)
je     121c <time0+0xbc>
mov    0x2e78(%rip),%rcx
and    $0x3,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x6(%rbp)
jne    1216 <time0+0xb6>
mov    0x2e5e(%rip),%rax
mov    $0x64,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
setne  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
mov    $0x2,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
movslq %eax,%rcx
mov    0x2e1f(%rip),%rax
sub    %rcx,%rax
mov    %rax,0x2e15(%rip)
mov    0x2e16(%rip),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,0x2e0b(%rip)
imul   $0x16d,0x2e00(%rip),%rax
mov    0x2df9(%rip),%rcx
shr    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    0x2de7(%rip),%rax
mov    $0x64,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    0x2dc8(%rip),%rax
mov    $0x190,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
sub    $0xafaa7,%rax
add    0x2d9f(%rip),%rax
mov    %rax,0x2d98(%rip)
imul   $0x15180,0x2d8d(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <ozhour@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
imul   $0xe10,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1070 <ozmin@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   $0x3c,%ecx,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1080 <ozsec@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
add    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time0>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <ozyear@plt>
mov    %rax,0x2ee5(%rip)
xor    %eax,%eax
call   1050 <ozmonth@plt>
mov    %eax,0x2ee0(%rip)
xor    %eax,%eax
call   1060 <ozday@plt>
mov    0x2ed3(%rip),%edx
imul   $0xbf1,%edx,%ecx
add    $0xfffff441,%ecx
movslq %ecx,%rcx
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rcx
add    %esi,%ecx
add    %eax,%ecx
movslq %ecx,%r8
mov    0x2e9c(%rip),%rcx
cmp    $0x3,%edx
jl     1216 <time0+0xb6>
movabs $0x8f5c28f5c28f5c29,%rax
28 5c 8f
imul   %rcx,%rax
mov    %rax,%rdx
ror    $0x4,%rdx
movabs $0xa3d70a3d70a3d8,%rsi
cmp    %rsi,%rdx
jb     120c <time0+0xac>
mov    $0xfffffffffffffffe,%rdx
test   $0x3,%cl
jne    1213 <time0+0xb3>
ror    $0x2,%rax
movabs $0x28f5c28f5c28f5d,%rsi
5c 8f 02
xor    %edx,%edx
cmp    %rsi,%rax
setb   %dl
not    %rdx
jmp    1213 <time0+0xb3>
mov    $0xffffffffffffffff,%rdx
add    %rdx,%r8
add    $0xffffffffffffffff,%rcx
mov    %rcx,0x2e37(%rip)
imul   $0x16d,%rcx,%r9
mov    %rcx,%rsi
shr    $0x2,%rsi
movabs $0x28f5c28f5c28f5c3,%rdx
c2 f5 28
mov    %rsi,%rax
mul    %rdx
mov    %rdx,%rdi
shr    $0x2,%rdi
shr    $0x4,%rcx
movabs $0xa3d70a3d70a3d71,%rdx
70 3d 0a
mov    %rcx,%rax
mul    %rdx
add    %r9,%rsi
sub    %rdi,%rsi
add    %rdx,%rsi
add    %r8,%rsi
imul   $0x15180,%rsi,%r14
xor    %eax,%eax
call   1040 <ozhour@plt>
imul   $0xe10,%rax,%r15
xor    %eax,%eax
call   1070 <ozmin@plt>
imul   $0x3c,%eax,%ebx
xor    %eax,%eax
call   1080 <ozsec@plt>
add    %r15,%rax
add    %rbx,%rax
add    %r14,%rax
movabs $0xfffffff1868cd580,%rcx
ff ff ff
add    %rcx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@time0.scalar = internal global i64 0
@time0.yr = internal global i64 0
@time0.mo = internal global i32 0
define i64 @time0() {
%1 = call i64 (...) @ozyear()
store i64 %1, i64* @time0.yr
%2 = call i32 (...) @ozmonth()
store i32 %2, i32* @time0.mo
%3 = call i32 (...) @ozday()
%4 = load i32, i32* @time0.mo
%5 = mul nsw i32 %4, 3057
%6 = sub nsw i32 %5, 3007
%7 = sdiv i32 %6, 100
%8 = add nsw i32 %3, %7
%9 = sext i32 %8 to i64
store i64 %9, i64* @time0.scalar
%10 = load i32, i32* @time0.mo
%11 = icmp sgt i32 %10, 2
br i1 %11, label %12, label %33
12: ; preds = %0
%13 = load i64, i64* @time0.yr
%14 = urem i64 %13, 400
%15 = icmp eq i64 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %12
%17 = load i64, i64* @time0.yr
%18 = urem i64 %17, 4
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i64, i64* @time0.yr
%22 = urem i64 %21, 100
%23 = icmp ne i64 %22, 0
br label %24
24: ; preds = %20, %16
%25 = phi i1 [ false, %16 ], [ %23, %20 ]
br label %26
26: ; preds = %24, %12
%27 = phi i1 [ true, %12 ], [ %25, %24 ]
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 1, i32 2
%30 = sext i32 %29 to i64
%31 = load i64, i64* @time0.scalar
%32 = sub i64 %31, %30
store i64 %32, i64* @time0.scalar
br label %33
33: ; preds = %26, %0
%34 = load i64, i64* @time0.yr
%35 = add i64 %34, -1
store i64 %35, i64* @time0.yr
%36 = load i64, i64* @time0.yr
%37 = mul i64 %36, 365
%38 = load i64, i64* @time0.yr
%39 = udiv i64 %38, 4
%40 = add i64 %37, %39
%41 = load i64, i64* @time0.yr
%42 = udiv i64 %41, 100
%43 = sub i64 %40, %42
%44 = load i64, i64* @time0.yr
%45 = udiv i64 %44, 400
%46 = add i64 %43, %45
%47 = sub i64 %46, 719527
%48 = load i64, i64* @time0.scalar
%49 = add i64 %48, %47
store i64 %49, i64* @time0.scalar
%50 = load i64, i64* @time0.scalar
%51 = mul i64 %50, 86400
%52 = call i64 (...) @ozhour()
%53 = mul nsw i64 %52, 3600
%54 = add i64 %51, %53
%55 = call i64 (...) @ozmin()
%56 = trunc i64 %55 to i32
%57 = mul i32 %56, 60
%58 = zext i32 %57 to i64
%59 = add i64 %54, %58
%60 = call i64 (...) @ozsec()
%61 = add i64 %59, %60
ret i64 %61
}

LLVM IR (-O2):
@time0.yr = internal unnamed_addr global i64 0
@time0.mo = internal unnamed_addr global i32 0
define i64 @time0() {
%1 = tail call i64 (...) @ozyear()
store i64 %1, i64* @time0.yr
%2 = tail call i32 (...) @ozmonth()
store i32 %2, i32* @time0.mo
%3 = tail call i32 (...) @ozday()
%4 = load i32, i32* @time0.mo
%5 = mul nsw i32 %4, 3057
%6 = add nsw i32 %5, -3007
%7 = sdiv i32 %6, 100
%8 = add nsw i32 %7, %3
%9 = sext i32 %8 to i64
%10 = icmp sgt i32 %4, 2
%11 = load i64, i64* @time0.yr
br i1 %10, label %12, label %25
12: ; preds = %0
%13 = urem i64 %11, 400
%14 = icmp eq i64 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = and i64 %11, 3
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = urem i64 %11, 100
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i64 -2, i64 -1
br label %22
22: ; preds = %15, %18, %12
%23 = phi i64 [ -1, %12 ], [ -2, %15 ], [ %21, %18 ]
%24 = add nsw i64 %23, %9
br label %25
25: ; preds = %0, %22
%26 = phi i64 [ %24, %22 ], [ %9, %0 ]
%27 = add i64 %11, -1
store i64 %27, i64* @time0.yr
%28 = mul i64 %27, 365
%29 = lshr i64 %27, 2
%30 = udiv i64 %27, 100
%31 = udiv i64 %27, 400
%32 = add nsw i64 %29, -719527
%33 = add i64 %32, %28
%34 = sub i64 %33, %30
%35 = add i64 %34, %31
%36 = add i64 %35, %26
%37 = mul i64 %36, 86400
%38 = tail call i64 (...) @ozhour()
%39 = mul nsw i64 %38, 3600
%40 = tail call i64 (...) @ozmin()
%41 = mul i64 %40, 60
%42 = and i64 %41, 4294967292
%43 = tail call i64 (...) @ozsec()
%44 = add i64 %43, %39
%45 = add i64 %44, %42
%46 = add i64 %45, %37
ret i64 %46
}