#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 */
int GetSlewStatus();
int /*<<< orphan*/ GetTel(double *, double *, int);
int /*<<< orphan*/ PointingToTel(double *, double *, double, double, int);
double fabs(double);
int CheckGoTo(double desRA, double desDec, int pmodel) {
  double telra0, telra1, teldec0, teldec1;
  double errorRA, errorDec, nowRA, nowDec;
  telra1 = desRA;
  teldec1 = desDec;
  PointingToTel(&telra0, &teldec0, telra1, teldec1, pmodel);
  desRA = telra0;
  desDec = teldec0;
  if (GetSlewStatus() == 1) {
    return (0);
  }
  GetTel(&nowRA, &nowDec, pmodel);
  errorRA = nowRA - desRA;
  errorDec = nowDec - desDec;
  if (fabs(errorRA) > (0.1 / 15.) || fabs(errorDec) > 0.1) {
    return (2);
  } else {
    return (1);
  }
}


x86 assembly (clang, -O0):
<CheckGoTo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mov    -0x1c(%rbp),%edx
lea    -0x28(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1030 <PointingToTel@plt>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <GetSlewStatus@plt>
cmp    $0x1,%eax
jne    11a3 <CheckGoTo+0x73>
movl   $0x0,-0x4(%rbp)
jmp    1228 <CheckGoTo+0xf8>
mov    -0x1c(%rbp),%edx
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1050 <GetTel@plt>
movsd  -0x58(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movaps 0xe33(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe17(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1215 <CheckGoTo+0xe5>
movsd  -0x50(%rbp),%xmm0
movaps 0xe11(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xdfd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1221 <CheckGoTo+0xf1>
movl   $0x2,-0x4(%rbp)
jmp    1228 <CheckGoTo+0xf8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckGoTo>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %edi,%ebx
lea    0x30(%rsp),%rdi
lea    0x28(%rsp),%rsi
mov    %ebx,%edx
call   1030 <PointingToTel@plt>
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <GetSlewStatus@plt>
cmp    $0x1,%eax
je     11c6 <CheckGoTo+0x96>
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    %ebx,%edx
call   1050 <GetTel@plt>
movsd  0x20(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
andpd  0xe6c(%rip),%xmm0
mov    $0x2,%ebp
ucomisd 0xe6f(%rip),%xmm0
ja     11c6 <CheckGoTo+0x96>
movsd  0x18(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
andpd  0xe49(%rip),%xmm0
ucomisd 0xe59(%rip),%xmm0
ja     11c6 <CheckGoTo+0x96>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @CheckGoTo(double %0, double %1, i32 %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
%16 = load double, double* %5
store double %16, double* %9
%17 = load double, double* %6
store double %17, double* %11
%18 = load double, double* %9
%19 = load double, double* %11
%20 = load i32, i32* %7
%21 = call i32 @PointingToTel(double* %8, double* %10, double %18, double %19, i32 %20)
%22 = load double, double* %8
store double %22, double* %5
%23 = load double, double* %10
store double %23, double* %6
%24 = call i32 (...) @GetSlewStatus()
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %3
store i32 0, i32* %4
br label %45
27: ; preds = %3
%28 = load i32, i32* %7
%29 = call i32 @GetTel(double* %14, double* %15, i32 %28)
%30 = load double, double* %14
%31 = load double, double* %5
%32 = fsub double %30, %31
store double %32, double* %12
%33 = load double, double* %15
%34 = load double, double* %6
%35 = fsub double %33, %34
store double %35, double* %13
%36 = load double, double* %12
%37 = call double @llvm.fabs.f64(double %36)
%38 = fcmp ogt double %37, 0x3F7B4E81B4E81B4F
br i1 %38, label %43, label %39
39: ; preds = %27
%40 = load double, double* %13
%41 = call double @llvm.fabs.f64(double %40)
%42 = fcmp ogt double %41, 1.000000e-01
br i1 %42, label %43, label %44
43: ; preds = %39, %27
store i32 2, i32* %4
br label %45
44: ; preds = %39
store i32 1, i32* %4
br label %45
45: ; preds = %44, %43, %26
%46 = load i32, i32* %4
ret i32 %46
}

LLVM IR (-O2):
define i32 @CheckGoTo(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
%11 = bitcast double* %7 to i8*
%12 = call i32 @PointingToTel(double* %4, double* %5, double %0, double %1, i32 %2)
%13 = load double, double* %4
%14 = load double, double* %5
%15 = call i32 (...) @GetSlewStatus()
%16 = icmp eq i32 %15, 1
br i1 %16, label %29, label %17
17: ; preds = %3
%18 = call i32 @GetTel(double* %6, double* %7, i32 %2)
%19 = load double, double* %6
%20 = fsub double %19, %13
%21 = call double @llvm.fabs.f64(double %20)
%22 = fcmp ogt double %21, 0x3F7B4E81B4E81B4F
br i1 %22, label %29, label %23
23: ; preds = %17
%24 = load double, double* %7
%25 = fsub double %24, %14
%26 = call double @llvm.fabs.f64(double %25)
%27 = fcmp ogt double %26, 1.000000e-01
br i1 %27, label %29, label %28
28: ; preds = %23
br label %29
29: ; preds = %17, %23, %3, %28
%30 = phi i32 [ 1, %28 ], [ 0, %3 ], [ 2, %23 ], [ 2, %17 ]
ret i32 %30
}