// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_watch_sun()
void draw_watch_sun()
{
double az, el;
int x0,y0;
int r;
int x, y;

   if(have_sun_el == 0) return;
   if(zoom_screen == 'B') return;   // use the sun from the sat map
   if(zoom_screen == 'W') ;
   else if(zoom_screen == 'V') ;
   else if(map_and_watch) return;   // sun was part of the satellite map display
   if(SUN_PRN == 0) return;
   if(no_sun_moon & 0x01) return;

   x0 = aclock_x;
   y0 = aclock_y;
   r = ACLOCK_R;

   el = sun_el;
   if(el < 0.0) el = 0.0 - el;
   if((el < 0.0F) || (el > 90.0F)) return;
   el = (el - 90.0F) / 90.0F;

   az = sun_az;
   if((az < 0.0F) || (az >= 360.0F)) return;
   az += 90.0F;
   if(az > 360.0) az -= 360.0;

   x = x0 + (int) (el * cos360(az) * r);
   if(x > x0) x -= 1;   // clipping tweak
   else       x += 1;
   y = y0 + (int) (el * sin360(az) * r);

   if(sun_el >= 0.0) draw_circle(x,y, r/16, YELLOW, 1);
   else              draw_circle(x,y, r/16, YELLOW, 0);

   draw_sun_rays(x,y, r/16, 1);
// draw_sun_rays(x,y, set_marker_size(SUN_PRN), 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq 0x21dc09(%rip), %rax    # 0x36c9a8
cmpl $0x0, (%rax)
jne 0x14eda9
jmp 0x14f061
leaq 0x21cbd8(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x42, %eax
jne 0x14edbd
jmp 0x14f061
leaq 0x21cbc4(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x57, %eax
jne 0x14edce
jmp 0x14edf4
leaq 0x21cbb3(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x56, %eax
jne 0x14eddf
jmp 0x14edf2
leaq 0x12b80a(%rip), %rax    # 0x27a5f0
cmpb $0x0, (%rax)
je 0x14edf0
jmp 0x14f061
jmp 0x14edf2
jmp 0x14edf4
leaq 0x8104d(%rip), %rax     # 0x1cfe48
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x14ee0a
jmp 0x14f061
leaq 0x24b743(%rip), %rax    # 0x39a554
movl (%rax), %eax
movl %eax, -0x14(%rbp)
leaq 0x24b73b(%rip), %rax    # 0x39a558
movl (%rax), %eax
movl %eax, -0x18(%rbp)
leaq 0x24b727(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x128bb6(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
movl %eax, -0x1c(%rbp)
leaq 0x21db52(%rip), %rax    # 0x36c998
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x14ee66
xorps %xmm0, %xmm0
subsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
ja 0x14ee83
movsd -0x10(%rbp), %xmm0
movsd 0x2020b(%rip), %xmm1    # 0x16f088
ucomisd %xmm1, %xmm0
jbe 0x14ee88
jmp 0x14f061
movsd -0x10(%rbp), %xmm0
movsd 0x201f3(%rip), %xmm1    # 0x16f088
subsd %xmm1, %xmm0
movsd 0x201e7(%rip), %xmm1    # 0x16f088
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x21daff(%rip), %rax    # 0x36c9b0
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x8(%rbp), %xmm0
ja 0x14eed7
movsd -0x8(%rbp), %xmm0
movsd 0x33c5f(%rip), %xmm1    # 0x182b30
ucomisd %xmm1, %xmm0
jb 0x14eedc
jmp 0x14f061
movsd 0x201a4(%rip), %xmm0    # 0x16f088
addsd -0x8(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
movsd 0x33c35(%rip), %xmm1    # 0x182b30
ucomisd %xmm1, %xmm0
jbe 0x14ef17
movsd -0x8(%rbp), %xmm0
movsd 0x33c22(%rip), %xmm1    # 0x182b30
subsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x8(%rbp), %xmm0
movsd 0x33bfc(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x2023f(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movl -0x34(%rbp), %eax
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, %ecx
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x14ef86
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x14ef8f
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x8(%rbp), %xmm0
movsd 0x33b84(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x201c7(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movl -0x44(%rbp), %eax
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
leaq 0x21d9a6(%rip), %rax    # 0x36c998
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x14f024
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x1c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, %edx
movl $0xe, %ecx
movl $0x1, %r8d
callq 0x11f00
jmp 0x14f044
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x1c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
callq 0x11f00
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x1c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, %edx
movl $0x1, %ecx
callq 0x14e670
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)