#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 tm {
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
};
struct timeval {
  scalar_t__ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
double now_time(void) {
  struct tm *now;
  struct timeval t;
  gettimeofday(&t, NULL);
  now = localtime(&t.tv_sec);
  return (double)(now->tm_hour) * 3600.0e+6 + (double)(now->tm_min) * 60.0e+6 +
         (double)(now->tm_sec) * 1.0e+6 + (double)(t.tv_usec);
}


x86 assembly (clang, -O0):
<now_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x18(%rbp),%rdi
add    $0x8,%rdi
call   1030 <localtime@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2sdq 0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
cvtsi2sdq 0x8(%rax),%xmm0
movsd  0xeae(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xe9a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
cvtsi2sdq (%rax),%xmm0
movsd  0xe79(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdq -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
lea    0x10(%rsp),%rdi
call   1030 <localtime@plt>
cvtsi2sdq 0x10(%rax),%xmm0
cvtsi2sdq 0x8(%rax),%xmm1
mulsd  0xeb2(%rip),%xmm1
mulsd  0xeb2(%rip),%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rax),%xmm1
mulsd  0xea6(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdq 0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64 }
%struct.timeval = type { i64, i32 }
define double @now_time() {
%1 = alloca %struct.tm*
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%5 = call %struct.tm* @localtime(i32* %4)
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 2
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = load %struct.tm*, %struct.tm** %1
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 1
%12 = load i64, i64* %11
%13 = sitofp i64 %12 to double
%14 = fmul double %13, 6.000000e+07
%15 = call double @llvm.fmuladd.f64(double %9, double 3.600000e+09, double %14)
%16 = load %struct.tm*, %struct.tm** %1
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = sitofp i64 %18 to double
%20 = call double @llvm.fmuladd.f64(double %19, double 1.000000e+06, double %15)
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%22 = load i64, i64* %21
%23 = sitofp i64 %22 to double
%24 = fadd double %20, %23
ret double %24
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
%struct.tm = type { i64, i64, i64 }
define double @now_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = call %struct.tm* @localtime(i32* %4)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = fmul double %11, 6.000000e+07
%13 = call double @llvm.fmuladd.f64(double %8, double 3.600000e+09, double %12)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%15 = load i64, i64* %14
%16 = sitofp i64 %15 to double
%17 = call double @llvm.fmuladd.f64(double %16, double 1.000000e+06, double %13)
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%19 = load i64, i64* %18
%20 = sitofp i64 %19 to double
%21 = fadd double %17, %20
ret double %21
}