#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 M_PI;
double Rij(int, int);
double Sij(int, int);
int cos(double);
double t2_f_cutoff(int i, int j, double rij) {
  if (rij < Rij(i, j)) {
    return 1;
  } else if ((rij > Rij(i, j)) && (rij < Sij(i, j))) {
    return 1 / 2 +
           1 / 2 * cos(M_PI * (rij - Rij(i, j)) / (Sij(i, j) - Rij(i, j)));
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<t2_f_cutoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <Rij@plt>
movsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1179 <t2_f_cutoff+0x49>
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1254 <t2_f_cutoff+0x124>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <Rij@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    124c <t2_f_cutoff+0x11c>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <Sij@plt>
movsd  -0x30(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    124c <t2_f_cutoff+0x11c>
mov    0x2e1d(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <Rij@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <Sij@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <Rij@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
imul   $0x0,%eax,%eax
add    $0x0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1254 <t2_f_cutoff+0x124>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2_f_cutoff>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <Rij@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    115a <t2_f_cutoff+0x2a>
movsd  0xeab(%rip),%xmm2
jmp    11e7 <t2_f_cutoff+0xb7>
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <Rij@plt>
xorps  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    11e7 <t2_f_cutoff+0xb7>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <Sij@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    11e4 <t2_f_cutoff+0xb4>
mov    0x2e5e(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <Rij@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <Sij@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <Rij@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @t2_f_cutoff(i32 %0, i32 %1, double %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
%8 = load double, double* %7
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call double @Rij(i32 %9, i32 %10)
%12 = fcmp olt double %8, %11
br i1 %12, label %13, label %14
13: ; preds = %3
store double 1.000000e+00, double* %4
br label %47
14: ; preds = %3
%15 = load double, double* %7
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call double @Rij(i32 %16, i32 %17)
%19 = fcmp ogt double %15, %18
br i1 %19, label %20, label %46
20: ; preds = %14
%21 = load double, double* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = call double @Sij(i32 %22, i32 %23)
%25 = fcmp olt double %21, %24
br i1 %25, label %26, label %46
26: ; preds = %20
%27 = load double, double* @M_PI
%28 = load double, double* %7
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = call double @Rij(i32 %29, i32 %30)
%32 = fsub double %28, %31
%33 = fmul double %27, %32
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = call double @Sij(i32 %34, i32 %35)
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = call double @Rij(i32 %37, i32 %38)
%40 = fsub double %36, %39
%41 = fdiv double %33, %40
%42 = call i32 @cos(double %41)
%43 = mul nsw i32 0, %42
%44 = add nsw i32 0, %43
%45 = sitofp i32 %44 to double
store double %45, double* %4
br label %47
46: ; preds = %20, %14
store double 0.000000e+00, double* %4
br label %47
47: ; preds = %46, %26, %13
%48 = load double, double* %4
ret double %48
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @t2_f_cutoff(i32 %0, i32 %1, double %2) {
%4 = tail call double @Rij(i32 %0, i32 %1)
%5 = fcmp ogt double %4, %2
br i1 %5, label %22, label %6
6: ; preds = %3
%7 = tail call double @Rij(i32 %0, i32 %1)
%8 = fcmp olt double %7, %2
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = tail call double @Sij(i32 %0, i32 %1)
%11 = fcmp ogt double %10, %2
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load double, double* @M_PI
%14 = tail call double @Rij(i32 %0, i32 %1)
%15 = fsub double %2, %14
%16 = fmul double %13, %15
%17 = tail call double @Sij(i32 %0, i32 %1)
%18 = tail call double @Rij(i32 %0, i32 %1)
%19 = fsub double %17, %18
%20 = fdiv double %16, %19
%21 = tail call i32 @cos(double %20)
br label %22
22: ; preds = %6, %9, %3, %12
%23 = phi double [ 0.000000e+00, %12 ], [ 1.000000e+00, %3 ], [ 0.000000e+00, %9 ], [ 0.000000e+00, %6 ]
ret double %23
}