#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 timespec {
  double tv_sec;
  double tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ normalize(struct timespec *);
struct timespec timeFactor(struct timespec a, double f) {
  struct timespec r;
  r.tv_sec = a.tv_sec;
  r.tv_nsec = f * a.tv_nsec + (f - 1.) * a.tv_sec * 1000000000;
  normalize(&r);
  return r;
}


x86 assembly (clang, -O0):
<timeFactor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm2
movsd  0xeb8(%rip),%xmm4
movaps %xmm0,%xmm1
addsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm1
movsd  0xead(%rip),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <normalize@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeFactor>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
mulsd  0xedc(%rip),%xmm3
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <normalize@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { double, double }
define { double, double } @timeFactor(double %0, double %1, double %2) {
%4 = alloca %struct.timespec
%5 = alloca %struct.timespec
%6 = alloca double
%7 = bitcast %struct.timespec* %5 to { double, double }*
%8 = getelementptr inbounds { double, double }, { double, double }* %7, i32 0, i32 0
store double %0, double* %8
%9 = getelementptr inbounds { double, double }, { double, double }* %7, i32 0, i32 1
store double %1, double* %9
store double %2, double* %6
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%11 = load double, double* %10
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
store double %11, double* %12
%13 = load double, double* %6
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%15 = load double, double* %14
%16 = load double, double* %6
%17 = fsub double %16, 1.000000e+00
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%19 = load double, double* %18
%20 = fmul double %17, %19
%21 = fmul double %20, 1.000000e+09
%22 = call double @llvm.fmuladd.f64(double %13, double %15, double %21)
%23 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 1
store double %22, double* %23
%24 = call i32 @normalize(%struct.timespec* %4)
%25 = bitcast %struct.timespec* %4 to { double, double }*
%26 = load { double, double }, { double, double }* %25
ret { double, double } %26
}

LLVM IR (-O2):
%struct.timespec = type { double, double }
define { double, double } @timeFactor(double %0, double %1, double %2) {
%4 = alloca %struct.timespec
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
store double %0, double* %5
%6 = fadd double %2, -1.000000e+00
%7 = fmul double %6, %0
%8 = fmul double %7, 1.000000e+09
%9 = tail call double @llvm.fmuladd.f64(double %2, double %1, double %8)
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
store double %9, double* %10
%11 = call i32 @normalize(%struct.timespec* %4)
%12 = load double, double* %5
%13 = insertvalue { double, double } poison, double %12, 0
%14 = load double, double* %10
%15 = insertvalue { double, double } %13, double %14, 1
ret { double, double } %15
}