#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 log(double);
double tsw(double visi, double dem) {
  double br0 = 0.0116;
  double ba0 = (log(50.0) / visi - br0);
  double ba55 = 0.0030765;
  double h1 = 5.5 / log(ba0 / ba55);
  double hba0 = h1 * ba0;
  double hba55 = 0.05 - h1 * ba55;
  double tau = 0.42 * (hba0 / exp(dem / (1000.0 * h1)) + hba55);
  double tau_t = exp(-tau * 2.0);
  return (tau_t);
}


x86 assembly (clang, -O0):
<tsw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xefe(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xee9(%rip),%xmm0
call   1040 <log@plt>
divsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe51(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe29(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x58(%rbp),%xmm1
divsd  %xmm0,%xmm1
addsd  -0x40(%rbp),%xmm1
movsd  0xdfd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdc8(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsw>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  0xece(%rip),%xmm1
divsd  %xmm0,%xmm1
addsd  0xeca(%rip),%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
divsd  0xec1(%rip),%xmm0
call   1040 <log@plt>
movsd  0xebc(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe9a(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe9e(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  0xe94(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
mulsd  0xe76(%rip),%xmm1
addsd  %xmm1,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @tsw(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
store double %0, double* %3
store double %1, double* %4
store double 1.160000e-02, double* %5
%13 = call double @log(double 5.000000e+01)
%14 = load double, double* %3
%15 = fdiv double %13, %14
%16 = load double, double* %5
%17 = fsub double %15, %16
store double %17, double* %6
store double 3.076500e-03, double* %7
%18 = load double, double* %6
%19 = load double, double* %7
%20 = fdiv double %18, %19
%21 = call double @log(double %20)
%22 = fdiv double 5.500000e+00, %21
store double %22, double* %8
%23 = load double, double* %8
%24 = load double, double* %6
%25 = fmul double %23, %24
store double %25, double* %9
%26 = load double, double* %8
%27 = load double, double* %7
%28 = fneg double %26
%29 = call double @llvm.fmuladd.f64(double %28, double %27, double 5.000000e-02)
store double %29, double* %10
%30 = load double, double* %9
%31 = load double, double* %4
%32 = load double, double* %8
%33 = fmul double 1.000000e+03, %32
%34 = fdiv double %31, %33
%35 = call double @exp(double %34)
%36 = fdiv double %30, %35
%37 = load double, double* %10
%38 = fadd double %36, %37
%39 = fmul double 4.200000e-01, %38
store double %39, double* %11
%40 = load double, double* %11
%41 = fneg double %40
%42 = fmul double %41, 2.000000e+00
%43 = call double @exp(double %42)
store double %43, double* %12
%44 = load double, double* %12
ret double %44
}

LLVM IR (-O2):
define double @tsw(double %0, double %1) {
%3 = fdiv double 0x400F4BD2B7AC1BAF, %0
%4 = fadd double %3, -1.160000e-02
%5 = fdiv double %4, 3.076500e-03
%6 = tail call double @log(double %5)
%7 = fdiv double 5.500000e+00, %6
%8 = fmul double %4, %7
%9 = fneg double %7
%10 = tail call double @llvm.fmuladd.f64(double %9, double 3.076500e-03, double 5.000000e-02)
%11 = fmul double %7, 1.000000e+03
%12 = fdiv double %1, %11
%13 = tail call double @exp(double %12)
%14 = fdiv double %8, %13
%15 = fadd double %10, %14
%16 = fmul double %15, -4.200000e-01
%17 = fmul double %16, 2.000000e+00
%18 = tail call double @exp(double %17)
ret double %18
}