// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: calc_moon_posn(int)
void calc_moon_posn(int watch)
{
double maz,mel;
int r;

   if(map_and_watch && (watch == 0)) {
      r = AZEL_RADIUS;
      moon_size = (AZEL_RADIUS/4);
   }
   else {
      r = ACLOCK_R;
      moon_size = (ACLOCK_R/4);
   }

   mel = moon_el;
   if(mel < 0.0) {
      mel = 0.0 - mel;
      moon_color = GREY;
   }
   mel = (mel - 90.0F) / 90.0F;

   maz = moon_az;
   maz += 90.0F;
   if(maz >= 360.0) maz -= 360.0;
   if(maz <= 360.0) maz += 360.0;
   moon_x = (int) (mel * cos360((int)maz) * r);
   moon_y = (int) (mel * sin360((int)maz) * r);
//sprintf(plot_title, "ACLOCK:%d  AZEL:%d  maw:%d", ACLOCK_R,AZEL_RADIUS, map_and_watch);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
leaq 0x12ed2e(%rip), %rax    # 0x27a5f0
cmpb $0x0, (%rax)
je 0x14b914
cmpl $0x0, -0x4(%rbp)
jne 0x14b914
leaq 0x24ec98(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x24ec93(%rip), %rcx    # 0x39a578
subl (%rcx), %eax
movl %eax, -0x1c(%rbp)
leaq 0x24ec7b(%rip), %rax    # 0x39a56c
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x24ec76(%rip), %rcx    # 0x39a578
subl (%rcx), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, 0x28d686(%rip)    # 0x3d8f98
jmp 0x14b959
leaq 0x24ec35(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12c0c4(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
movl %eax, -0x1c(%rbp)
leaq 0x24ec18(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12c0a7(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, 0x28d63f(%rip)    # 0x3d8f98
leaq 0x221070(%rip), %rax    # 0x36c9d0
movsd (%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x14b98a
xorps %xmm0, %xmm0
subsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movl $0x8, 0x7dcb6(%rip)     # 0x1c9640
movsd -0x18(%rbp), %xmm0
movsd 0x236f1(%rip), %xmm1    # 0x16f088
subsd %xmm1, %xmm0
movsd 0x236e5(%rip), %xmm1    # 0x16f088
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x221015(%rip), %rax    # 0x36c9c8
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x236c4(%rip), %xmm0    # 0x16f088
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x37155(%rip), %xmm1    # 0x182b30
ucomisd %xmm1, %xmm0
jb 0x14b9f7
movsd -0x10(%rbp), %xmm0
movsd 0x37142(%rip), %xmm1    # 0x182b30
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0x37131(%rip), %xmm0    # 0x182b30
ucomisd -0x10(%rbp), %xmm0
jb 0x14ba18
movsd 0x37122(%rip), %xmm0    # 0x182b30
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x370fd(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x23740(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x28d520(%rip)    # 0x3d8f90
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
cvttsd2si -0x10(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd 0x370a5(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x236e8(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x28d4cc(%rip)    # 0x3d8f94
addq $0x30, %rsp
popq %rbp
retq
nop