void wp_time_window(double gcarc, double *wp_win4, double *twp_beg,
                    double *twp_end) {
  double feakdist;
  if (wp_win4[2] > gcarc)
    feakdist = wp_win4[2];
  else
    feakdist = gcarc;
  if (wp_win4[3] < feakdist)
    feakdist = wp_win4[3];
  *twp_beg = wp_win4[0] * feakdist;
  *twp_end = wp_win4[1] * feakdist;
}


x86 assembly (clang, -O0):
<wp_time_window>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    113c <wp_time_window+0x3c>
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1146 <wp_time_window+0x46>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    116c <wp_time_window+0x6c>
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<wp_time_window>:
movsd  0x10(%rdi),%xmm1
movsd  0x18(%rdi),%xmm2
maxsd  %xmm0,%xmm1
minsd  %xmm1,%xmm2
movsd  (%rdi),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rsi)
mulsd  0x8(%rdi),%xmm2
movsd  %xmm2,(%rdx)
ret

LLVM IR (-O0):
define void @wp_time_window(double %0, double* %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
store double %0, double* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 2
%12 = load double, double* %11
%13 = load double, double* %5
%14 = fcmp ogt double %12, %13
br i1 %14, label %15, label %19
15: ; preds = %4
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 2
%18 = load double, double* %17
store double %18, double* %9
br label %21
19: ; preds = %4
%20 = load double, double* %5
store double %20, double* %9
br label %21
21: ; preds = %19, %15
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 3
%24 = load double, double* %23
%25 = load double, double* %9
%26 = fcmp olt double %24, %25
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 3
%30 = load double, double* %29
store double %30, double* %9
br label %31
31: ; preds = %27, %21
%32 = load double*, double** %6
%33 = getelementptr inbounds double, double* %32, i64 0
%34 = load double, double* %33
%35 = load double, double* %9
%36 = fmul double %34, %35
%37 = load double*, double** %7
store double %36, double* %37
%38 = load double*, double** %6
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
%41 = load double, double* %9
%42 = fmul double %40, %41
%43 = load double*, double** %8
store double %42, double* %43
ret void
}

LLVM IR (-O2):
define void @wp_time_window(double %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = getelementptr inbounds double, double* %1, i64 2
%6 = load double, double* %5
%7 = fcmp ogt double %6, %0
%8 = select i1 %7, double %6, double %0
%9 = getelementptr inbounds double, double* %1, i64 3
%10 = load double, double* %9
%11 = fcmp olt double %10, %8
%12 = select i1 %11, double %10, double %8
%13 = load double, double* %1
%14 = fmul double %13, %12
store double %14, double* %2
%15 = getelementptr inbounds double, double* %1, i64 1
%16 = load double, double* %15
%17 = fmul double %16, %12
store double %17, double* %3
ret void
}