#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 M_PI;
double cos(int);
double sin(int);
int rotation_dir(int d1, int d2) {
  double x1, x2, y1, y2;
  double angle;
  x1 = sin((M_PI * d1) / 180);
  y1 = cos((M_PI * d1) / 180);
  x2 = sin((M_PI * d2) / 180);
  y2 = cos((M_PI * d2) / 180);
  angle = x1 * y2 - x2 * y1;
  if (angle > 0)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<rotation_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
imul   -0x8(%rbp),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
imul   -0x8(%rbp),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
imul   -0xc(%rbp),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
imul   -0xc(%rbp),%eax
mov    $0xb4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1208 <rotation_dir+0xe8>
movl   $0x0,-0x4(%rbp)
jmp    120f <rotation_dir+0xef>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotation_dir>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2eb5(%rip),%r14
mov    (%r14),%eax
imul   %edi,%eax
movslq %eax,%rdi
imul   $0xffffffffb60b60b7,%rdi,%rax
shr    $0x20,%rax
add    %eax,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x7,%edi
add    %eax,%edi
call   1030 <sin@plt>
imul   (%r14),%ebp
movsd  %xmm0,0x18(%rsp)
movslq %ebp,%rdi
imul   $0xffffffffb60b60b7,%rdi,%rax
shr    $0x20,%rax
add    %eax,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x7,%edi
add    %eax,%edi
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
mov    (%r14),%eax
imul   %ebx,%eax
movslq %eax,%rdi
imul   $0xffffffffb60b60b7,%rdi,%rax
shr    $0x20,%rax
add    %eax,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x7,%edi
add    %eax,%edi
call   1030 <sin@plt>
imul   (%r14),%ebx
movsd  %xmm0,0x8(%rsp)
movslq %ebx,%rdi
imul   $0xffffffffb60b60b7,%rdi,%rax
shr    $0x20,%rax
add    %eax,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x7,%edi
add    %eax,%edi
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setbe  %al
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define i32 @rotation_dir(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%11 = load i32, i32* @M_PI
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = sdiv i32 %13, 180
%15 = call double @sin(i32 %14)
store double %15, double* %6
%16 = load i32, i32* @M_PI
%17 = load i32, i32* %4
%18 = mul nsw i32 %16, %17
%19 = sdiv i32 %18, 180
%20 = call double @cos(i32 %19)
store double %20, double* %8
%21 = load i32, i32* @M_PI
%22 = load i32, i32* %5
%23 = mul nsw i32 %21, %22
%24 = sdiv i32 %23, 180
%25 = call double @sin(i32 %24)
store double %25, double* %7
%26 = load i32, i32* @M_PI
%27 = load i32, i32* %5
%28 = mul nsw i32 %26, %27
%29 = sdiv i32 %28, 180
%30 = call double @cos(i32 %29)
store double %30, double* %9
%31 = load double, double* %6
%32 = load double, double* %9
%33 = load double, double* %7
%34 = load double, double* %8
%35 = fmul double %33, %34
%36 = fneg double %35
%37 = call double @llvm.fmuladd.f64(double %31, double %32, double %36)
store double %37, double* %10
%38 = load double, double* %10
%39 = fcmp ogt double %38, 0.000000e+00
br i1 %39, label %40, label %41
40: ; preds = %2
store i32 0, i32* %3
br label %42
41: ; preds = %2
store i32 1, i32* %3
br label %42
42: ; preds = %41, %40
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@M_PI = global i32 0
define i32 @rotation_dir(i32 %0, i32 %1) {
%3 = load i32, i32* @M_PI
%4 = mul nsw i32 %3, %0
%5 = sdiv i32 %4, 180
%6 = tail call double @sin(i32 %5)
%7 = load i32, i32* @M_PI
%8 = mul nsw i32 %7, %0
%9 = sdiv i32 %8, 180
%10 = tail call double @cos(i32 %9)
%11 = load i32, i32* @M_PI
%12 = mul nsw i32 %11, %1
%13 = sdiv i32 %12, 180
%14 = tail call double @sin(i32 %13)
%15 = load i32, i32* @M_PI
%16 = mul nsw i32 %15, %1
%17 = sdiv i32 %16, 180
%18 = tail call double @cos(i32 %17)
%19 = fneg double %14
%20 = fmul double %10, %19
%21 = tail call double @llvm.fmuladd.f64(double %6, double %18, double %20)
%22 = fcmp ule double %21, 0.000000e+00
%23 = zext i1 %22 to i32
ret i32 %23
}