#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 cos(double);
int rho(int, int /*<<< orphan*/);
int /*<<< orphan*/ theta_prime(double, double);
double Off_Ax(double theta, double n) {
  double c_theta;
  c_theta = cos(theta);
  if (c_theta < -1.)
    c_theta = -1.;
  else if (c_theta > 1.)
    c_theta = 1.;
  return c_theta * ((1. - rho(theta, theta_prime(theta, n))) /
                    (1. - rho(0., theta_prime(theta, n))));
}


x86 assembly (clang, -O0):
<Off_Ax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xea7(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1176 <Off_Ax+0x46>
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    119f <Off_Ax+0x6f>
movsd  -0x18(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    119a <Off_Ax+0x6a>
movsd  0xe73(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    119f <Off_Ax+0x6f>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1050 <theta_prime@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%esi
call   1030 <rho@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe32(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1050 <theta_prime@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1030 <rho@plt>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm3
movsd  0xdfb(%rip),%xmm2
subsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Off_Ax>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
call   1040 <cos@plt>
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1169 <Off_Ax+0x39>
ucomisd 0xead(%rip),%xmm0
movapd %xmm0,%xmm1
jbe    1169 <Off_Ax+0x39>
movsd  0xe9f(%rip),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  (%rsp),%xmm0
cvttsd2si %xmm0,%ebx
movsd  0x8(%rsp),%xmm1
call   1050 <theta_prime@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <rho@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe6d(%rip),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <theta_prime@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1030 <rho@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe3b(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
mulsd  0x18(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @Off_Ax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = call double @cos(double %6)
store double %7, double* %5
%8 = load double, double* %5
%9 = fcmp olt double %8, -1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %2
store double -1.000000e+00, double* %5
br label %16
11: ; preds = %2
%12 = load double, double* %5
%13 = fcmp ogt double %12, 1.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %11
store double 1.000000e+00, double* %5
br label %15
15: ; preds = %14, %11
br label %16
16: ; preds = %15, %10
%17 = load double, double* %5
%18 = load double, double* %3
%19 = fptosi double %18 to i32
%20 = load double, double* %3
%21 = load double, double* %4
%22 = call i32 @theta_prime(double %20, double %21)
%23 = call i32 @rho(i32 %19, i32 %22)
%24 = sitofp i32 %23 to double
%25 = fsub double 1.000000e+00, %24
%26 = load double, double* %3
%27 = load double, double* %4
%28 = call i32 @theta_prime(double %26, double %27)
%29 = call i32 @rho(i32 0, i32 %28)
%30 = sitofp i32 %29 to double
%31 = fsub double 1.000000e+00, %30
%32 = fdiv double %25, %31
%33 = fmul double %17, %32
ret double %33
}

LLVM IR (-O2):
define double @Off_Ax(double %0, double %1) {
%3 = tail call double @cos(double %0)
%4 = fcmp olt double %3, -1.000000e+00
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = fcmp ogt double %3, 1.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %5
br label %8
8: ; preds = %2, %5, %7
%9 = phi double [ 1.000000e+00, %7 ], [ %3, %5 ], [ -1.000000e+00, %2 ]
%10 = fptosi double %0 to i32
%11 = tail call i32 @theta_prime(double %0, double %1)
%12 = tail call i32 @rho(i32 %10, i32 %11)
%13 = sitofp i32 %12 to double
%14 = fsub double 1.000000e+00, %13
%15 = tail call i32 @theta_prime(double %0, double %1)
%16 = tail call i32 @rho(i32 0, i32 %15)
%17 = sitofp i32 %16 to double
%18 = fsub double 1.000000e+00, %17
%19 = fdiv double %14, %18
%20 = fmul double %9, %19
ret double %20
}