#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 */

/* Variables and functions */
double exp(double);
double pow(double, double);
double sfs(double t, double t_on, double t_off, double a, double d, double s,
           double r) {
  const double t_a = 10.0 * pow(a / 80.0, 8.0);
  if (t < t_on)
    return 0.0;
  if (t < t_on + t_a)
    return (t - t_on) / t_a;
  if (t < t_off)
    return exp(-pow(10.0, 3.0 - d / 20.0) * (t - t_on - t_a)) * (1.0 - s) + s;
  return exp(-pow(10.0, 3.0 - r / 20.0) * (t - t_off)) *
         (exp(-pow(10.0, 3.0 - d / 20.0) * t_off) * (1.0 - s) + s);
}


x86 assembly (clang, -O0):
<sfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe8c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    119e <sfs+0x7e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1330 <sfs+0x210>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d0 <sfs+0xb0>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1330 <sfs+0x210>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1261 <sfs+0x141>
movsd  -0x30(%rbp),%xmm0
movsd  0xe37(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe23(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xdf7(%rip),%xmm0
call   1040 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
subsd  -0x48(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0xdd3(%rip),%xmm2
subsd  -0x38(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1330 <sfs+0x210>
movsd  -0x40(%rbp),%xmm0
movsd  0xdba(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xda6(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd7a(%rip),%xmm0
call   1040 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xd61(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd4d(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd21(%rip),%xmm0
call   1040 <pow@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xd03(%rip),%xmm3
subsd  -0x38(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfs>:
sub    $0x38,%rsp
movsd  %xmm6,0x30(%rsp)
movsd  %xmm5,0x20(%rsp)
movsd  %xmm4,0x18(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x10(%rsp)
divsd  0xeb0(%rip),%xmm3
movsd  0xeb0(%rip),%xmm1
movapd %xmm3,%xmm0
call   1040 <pow@plt>
movsd  0x28(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
movapd %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm3
ja     12c5 <sfs+0x1a5>
mulsd  0xe89(%rip),%xmm4
movapd %xmm4,%xmm0
addsd  %xmm3,%xmm0
ucomisd %xmm1,%xmm0
jbe    11a6 <sfs+0x86>
subsd  %xmm3,%xmm1
divsd  %xmm4,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret
movsd  0x8(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jbe    121d <sfs+0xfd>
movsd  0x18(%rsp),%xmm1
divsd  0xe70(%rip),%xmm1
addsd  0xe58(%rip),%xmm1
movsd  0xe40(%rip),%xmm0
movsd  %xmm4,0x8(%rsp)
call   1040 <pow@plt>
xorpd  0xe5d(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  0x28(%rsp),%xmm1
subsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0xe22(%rip),%xmm1
movsd  0x20(%rsp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x38,%rsp
ret
movsd  0x30(%rsp),%xmm0
divsd  0xded(%rip),%xmm0
movsd  0xded(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
call   1040 <pow@plt>
xorpd  0xdf4(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
divsd  0xda3(%rip),%xmm0
movsd  0xda3(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd87(%rip),%xmm0
call   1040 <pow@plt>
xorpd  0xdaa(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
movsd  0xd7b(%rip),%xmm0
movsd  0x20(%rsp),%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
define double @sfs(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fdiv double %3, 8.000000e+01
%9 = tail call double @pow(double %8, double 8.000000e+00)
%10 = fmul double %9, 1.000000e+01
%11 = fcmp olt double %0, %1
br i1 %11, label %48, label %12
12: ; preds = %7
%13 = fadd double %10, %1
%14 = fcmp ogt double %13, %0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = fsub double %0, %1
%17 = fdiv double %16, %10
br label %48
18: ; preds = %12
%19 = fcmp olt double %0, %2
br i1 %19, label %20, label %31
20: ; preds = %18
%21 = fdiv double %4, 2.000000e+01
%22 = fsub double 3.000000e+00, %21
%23 = tail call double @pow(double 1.000000e+01, double %22)
%24 = fneg double %23
%25 = fsub double %0, %1
%26 = fsub double %25, %10
%27 = fmul double %26, %24
%28 = tail call double @exp(double %27)
%29 = fsub double 1.000000e+00, %5
%30 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %5)
br label %48
31: ; preds = %18
%32 = fdiv double %6, 2.000000e+01
%33 = fsub double 3.000000e+00, %32
%34 = tail call double @pow(double 1.000000e+01, double %33)
%35 = fneg double %34
%36 = fsub double %0, %2
%37 = fmul double %36, %35
%38 = tail call double @exp(double %37)
%39 = fdiv double %4, 2.000000e+01
%40 = fsub double 3.000000e+00, %39
%41 = tail call double @pow(double 1.000000e+01, double %40)
%42 = fneg double %41
%43 = fmul double %42, %2
%44 = tail call double @exp(double %43)
%45 = fsub double 1.000000e+00, %5
%46 = tail call double @llvm.fmuladd.f64(double %44, double %45, double %5)
%47 = fmul double %38, %46
br label %48
48: ; preds = %7, %31, %20, %15
%49 = phi double [ %17, %15 ], [ %30, %20 ], [ %47, %31 ], [ 0.000000e+00, %7 ]
ret double %49
}