#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 timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double get_posix_time_secs(void) {
  struct timeval tval = {
      0,
      0,
  };
  if (gettimeofday(&tval, NULL))
    return (0.0 / 0.0);
  return (((double)tval.tv_sec) + (((double)tval.tv_usec) / 1e6));
}


x86 assembly (clang, -O0):
<get_posix_time_secs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
je     1161 <get_posix_time_secs+0x41>
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1182 <get_posix_time_secs+0x62>
cvtsi2sdq -0x18(%rbp),%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
movsd  0xe8b(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_posix_time_secs>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
je     1140 <get_posix_time_secs+0x30>
movsd  0xec5(%rip),%xmm0
add    $0x18,%rsp
ret
cvtsi2sdq 0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdq (%rsp),%xmm0
divsd  0xeb0(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64, i32, i32 }
define double @get_posix_time_secs() {
%1 = alloca double
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store double 0x7FF8000000000000, double* %1
br label %16
7: ; preds = %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%12 = load i64, i64* %11
%13 = sitofp i64 %12 to double
%14 = fdiv double %13, 1.000000e+06
%15 = fadd double %10, %14
store double %15, double* %1
br label %16
16: ; preds = %7, %6
%17 = load double, double* %1
ret double %17
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64, i32, i32 }
define double @get_posix_time_secs() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 1.000000e+06
%13 = fadd double %12, %8
br label %14
14: ; preds = %0, %5
%15 = phi double [ %13, %5 ], [ 0x7FF8000000000000, %0 ]
ret double %15
}