#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 /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
  scalar_t__ tm_mon;
  scalar_t__ tm_year;
};

/* Variables and functions */
double fb_DateSerial(scalar_t__, scalar_t__, int /*<<< orphan*/);
double fb_TimeSerial(int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
double fb_Now(void) {
  double dblTime, dblDate;
  time_t rawtime;
  struct tm *ptm;
  ;
  time(&rawtime);
  ptm = localtime(&rawtime);
  if (ptm == 0)
    return 0.0;
  dblDate = fb_DateSerial(1900 + ptm->tm_year, 1 + ptm->tm_mon, ptm->tm_mday);
  dblTime = fb_TimeSerial(ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
  ;
  return dblDate + dblTime;
}


x86 assembly (clang, -O0):
<fb_Now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x1c(%rbp),%rdi
call   1060 <time@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1176 <fb_Now+0x36>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cf <fb_Now+0x8f>
mov    -0x28(%rbp),%rax
mov    0x18(%rax),%rdi
add    $0x76c,%rdi
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rsi
add    $0x1,%rsi
mov    -0x28(%rbp),%rax
mov    0xc(%rax),%edx
call   1040 <fb_DateSerial@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
call   1050 <fb_TimeSerial@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_Now>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     1194 <fb_Now+0x54>
mov    %rax,%rbx
mov    $0x76c,%edi
add    0x18(%rax),%rdi
mov    0x10(%rax),%rsi
add    $0x1,%rsi
mov    0xc(%rax),%edx
call   1040 <fb_DateSerial@plt>
movsd  %xmm0,(%rsp)
mov    0x8(%rbx),%edi
mov    (%rbx),%edx
mov    0x4(%rbx),%esi
call   1050 <fb_TimeSerial@plt>
addsd  (%rsp),%xmm0
jmp    1198 <fb_Now+0x58>
xorpd  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64 }
define double @fb_Now() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = icmp eq %struct.tm* %4, null
br i1 %5, label %24, label %6
6: ; preds = %0
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%8 = load i64, i64* %7
%9 = add nsw i64 %8, 1900
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%11 = load i64, i64* %10
%12 = add nsw i64 %11, 1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%14 = load i32, i32* %13
%15 = call double @fb_DateSerial(i64 %9, i64 %12, i32 %14)
%16 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%21 = load i32, i32* %20
%22 = call double @fb_TimeSerial(i32 %17, i32 %19, i32 %21)
%23 = fadd double %15, %22
br label %24
24: ; preds = %0, %6
%25 = phi double [ %23, %6 ], [ 0.000000e+00, %0 ]
ret double %25
}