void rlk_f(double *vars, double *ret, double *params, double syn) {
  double y_old;
  ret[1] = vars[1] - params[2] * (vars[0] + 1) + params[2] * params[3];
  y_old = vars[1] - syn * params[0];
  if (vars[0] <= 0) {
    ret[0] = params[1] / (1 - vars[0]) + y_old;
  } else if (vars[0] >= params[1] + y_old) {
    ret[0] = -1;
  } else {
    ret[0] = params[1] + y_old;
  }
  return;
}


x86 assembly (clang, -O0):
<rlk_f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xecd(%rip),%xmm2
addsd  (%rax),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jb     11f3 <rlk_f+0xf3>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xe27(%rip),%xmm1
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1243 <rlk_f+0x143>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
addsd  -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     1228 <rlk_f+0x128>
mov    -0x10(%rbp),%rax
movsd  0xde9(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    123e <rlk_f+0x13e>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1243 <rlk_f+0x143>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rlk_f>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm2
addsd  0xeef(%rip),%xmm1
movsd  0x10(%rdx),%xmm3
mulsd  %xmm3,%xmm1
mulsd  0x18(%rdx),%xmm3
subsd  %xmm1,%xmm2
addsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsi)
movsd  (%rdi),%xmm2
movsd  0x8(%rdi),%xmm1
mulsd  (%rdx),%xmm0
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
movsd  0x8(%rdx),%xmm0
jae    1172 <rlk_f+0x72>
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
cmpnlesd %xmm2,%xmm0
andpd  %xmm0,%xmm1
movsd  0xea3(%rip),%xmm2
andnpd %xmm2,%xmm0
orpd   %xmm0,%xmm1
movsd  %xmm1,(%rsi)
ret
movsd  0xe86(%rip),%xmm3
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
ret

LLVM IR (-O0):
define void @rlk_f(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** %5
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %7
%14 = getelementptr inbounds double, double* %13, i64 2
%15 = load double, double* %14
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = fadd double %18, 1.000000e+00
%20 = fneg double %15
%21 = call double @llvm.fmuladd.f64(double %20, double %19, double %12)
%22 = load double*, double** %7
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = load double*, double** %7
%26 = getelementptr inbounds double, double* %25, i64 3
%27 = load double, double* %26
%28 = call double @llvm.fmuladd.f64(double %24, double %27, double %21)
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 1
store double %28, double* %30
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = load double, double* %8
%35 = load double*, double** %7
%36 = getelementptr inbounds double, double* %35, i64 0
%37 = load double, double* %36
%38 = fneg double %34
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %33)
store double %39, double* %9
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = fcmp ole double %42, 0.000000e+00
br i1 %43, label %44, label %57
44: ; preds = %4
%45 = load double*, double** %7
%46 = getelementptr inbounds double, double* %45, i64 1
%47 = load double, double* %46
%48 = load double*, double** %5
%49 = getelementptr inbounds double, double* %48, i64 0
%50 = load double, double* %49
%51 = fsub double 1.000000e+00, %50
%52 = fdiv double %47, %51
%53 = load double, double* %9
%54 = fadd double %52, %53
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 0
store double %54, double* %56
br label %79
57: ; preds = %4
%58 = load double*, double** %5
%59 = getelementptr inbounds double, double* %58, i64 0
%60 = load double, double* %59
%61 = load double*, double** %7
%62 = getelementptr inbounds double, double* %61, i64 1
%63 = load double, double* %62
%64 = load double, double* %9
%65 = fadd double %63, %64
%66 = fcmp oge double %60, %65
br i1 %66, label %67, label %70
67: ; preds = %57
%68 = load double*, double** %6
%69 = getelementptr inbounds double, double* %68, i64 0
store double -1.000000e+00, double* %69
br label %78
70: ; preds = %57
%71 = load double*, double** %7
%72 = getelementptr inbounds double, double* %71, i64 1
%73 = load double, double* %72
%74 = load double, double* %9
%75 = fadd double %73, %74
%76 = load double*, double** %6
%77 = getelementptr inbounds double, double* %76, i64 0
store double %75, double* %77
br label %78
78: ; preds = %70, %67
br label %79
79: ; preds = %78, %44
ret void
}

LLVM IR (-O2):
define void @rlk_f(double* nocapture %0, double* nocapture writeonly %1, double* nocapture %2, double %3) {
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %2, i64 2
%8 = load double, double* %7
%9 = load double, double* %0
%10 = fadd double %9, 1.000000e+00
%11 = fneg double %8
%12 = tail call double @llvm.fmuladd.f64(double %11, double %10, double %6)
%13 = getelementptr inbounds double, double* %2, i64 3
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %8, double %14, double %12)
%16 = getelementptr inbounds double, double* %1, i64 1
store double %15, double* %16
%17 = load double, double* %5
%18 = load double, double* %2
%19 = fneg double %3
%20 = tail call double @llvm.fmuladd.f64(double %19, double %18, double %17)
%21 = load double, double* %0
%22 = fcmp ugt double %21, 0.000000e+00
%23 = getelementptr inbounds double, double* %2, i64 1
%24 = load double, double* %23
br i1 %22, label %29, label %25
25: ; preds = %4
%26 = fsub double 1.000000e+00, %21
%27 = fdiv double %24, %26
%28 = fadd double %20, %27
br label %33
29: ; preds = %4
%30 = fadd double %20, %24
%31 = fcmp ult double %21, %30
%32 = select i1 %31, double %30, double -1.000000e+00
br label %33
33: ; preds = %29, %25
%34 = phi double [ %28, %25 ], [ %32, %29 ]
store double %34, double* %1
ret void
}