#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 bgamma(double xx, double t0) {
  double x, y, scale = 120;
  double y1, y2;
  double d1, d2;
  double aa1 = 6;
  double bb1 = 0.9;
  double aa2 = 12;
  double bb2 = 0.9;
  double cx = 0.1;
  x = xx - t0;
  if (x < 0 || x > 50)
    return 0;
  d1 = aa1 * bb1;
  d2 = aa2 * bb2;
  y1 = pow(x / d1, aa1) * exp(-(x - d1) / bb1);
  y2 = pow(x / d2, aa2) * exp(-(x - d2) / bb2);
  y = y1 - cx * y2;
  y /= scale;
  return y;
}


x86 assembly (clang, -O0):
<bgamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  0xee3(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
ja     11b7 <bgamma+0x97>
movsd  -0x20(%rbp),%xmm0
movsd  0xe7b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c4 <bgamma+0xa4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e2 <bgamma+0x1c2>
movsd  -0x58(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x68(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x60(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x70(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bgamma>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
ja     11e8 <bgamma+0xc8>
ucomisd 0xebe(%rip),%xmm2
ja     11e8 <bgamma+0xc8>
movapd %xmm2,%xmm0
divsd  0xeb4(%rip),%xmm0
movsd  0xeb4(%rip),%xmm1
movsd  %xmm2,0x8(%rsp)
call   1040 <pow@plt>
movsd  %xmm0,(%rsp)
movsd  0xea4(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
divsd  0xe9e(%rip),%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0xe89(%rip),%xmm0
movsd  0xe89(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe78(%rip),%xmm0
divsd  0xe58(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
mulsd  0xe65(%rip),%xmm0
addsd  (%rsp),%xmm0
divsd  0xe60(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @bgamma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%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
%17 = alloca double
store double %0, double* %4
store double %1, double* %5
store double 1.200000e+02, double* %8
store double 6.000000e+00, double* %13
store double 9.000000e-01, double* %14
store double 1.200000e+01, double* %15
store double 9.000000e-01, double* %16
store double 1.000000e-01, double* %17
%18 = load double, double* %4
%19 = load double, double* %5
%20 = fsub double %18, %19
store double %20, double* %6
%21 = load double, double* %6
%22 = fcmp olt double %21, 0.000000e+00
br i1 %22, label %26, label %23
23: ; preds = %2
%24 = load double, double* %6
%25 = fcmp ogt double %24, 5.000000e+01
br i1 %25, label %26, label %27
26: ; preds = %23, %2
store double 0.000000e+00, double* %3
br label %69
27: ; preds = %23
%28 = load double, double* %13
%29 = load double, double* %14
%30 = fmul double %28, %29
store double %30, double* %11
%31 = load double, double* %15
%32 = load double, double* %16
%33 = fmul double %31, %32
store double %33, double* %12
%34 = load double, double* %6
%35 = load double, double* %11
%36 = fdiv double %34, %35
%37 = load double, double* %13
%38 = call double @pow(double %36, double %37)
%39 = load double, double* %6
%40 = load double, double* %11
%41 = fsub double %39, %40
%42 = fneg double %41
%43 = load double, double* %14
%44 = fdiv double %42, %43
%45 = call double @exp(double %44)
%46 = fmul double %38, %45
store double %46, double* %9
%47 = load double, double* %6
%48 = load double, double* %12
%49 = fdiv double %47, %48
%50 = load double, double* %15
%51 = call double @pow(double %49, double %50)
%52 = load double, double* %6
%53 = load double, double* %12
%54 = fsub double %52, %53
%55 = fneg double %54
%56 = load double, double* %16
%57 = fdiv double %55, %56
%58 = call double @exp(double %57)
%59 = fmul double %51, %58
store double %59, double* %10
%60 = load double, double* %9
%61 = load double, double* %17
%62 = load double, double* %10
%63 = fneg double %61
%64 = call double @llvm.fmuladd.f64(double %63, double %62, double %60)
store double %64, double* %7
%65 = load double, double* %8
%66 = load double, double* %7
%67 = fdiv double %66, %65
store double %67, double* %7
%68 = load double, double* %7
store double %68, double* %3
br label %69
69: ; preds = %27, %26
%70 = load double, double* %3
ret double %70
}

LLVM IR (-O2):
define double @bgamma(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fcmp olt double %3, 0.000000e+00
%5 = fcmp ogt double %3, 5.000000e+01
%6 = or i1 %4, %5
br i1 %6, label %22, label %7
7: ; preds = %2
%8 = fdiv double %3, 5.400000e+00
%9 = tail call double @pow(double %8, double 6.000000e+00)
%10 = fadd double %3, -5.400000e+00
%11 = fdiv double %10, -9.000000e-01
%12 = tail call double @exp(double %11)
%13 = fmul double %9, %12
%14 = fdiv double %3, 1.080000e+01
%15 = tail call double @pow(double %14, double 1.200000e+01)
%16 = fadd double %3, -1.080000e+01
%17 = fdiv double %16, -9.000000e-01
%18 = tail call double @exp(double %17)
%19 = fmul double %15, %18
%20 = tail call double @llvm.fmuladd.f64(double %19, double -1.000000e-01, double %13)
%21 = fdiv double %20, 1.200000e+02
br label %22
22: ; preds = %2, %7
%23 = phi double [ %21, %7 ], [ 0.000000e+00, %2 ]
ret double %23
}