// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_watch_outline()
void draw_watch_outline()
{
int x, y;
int x0, y0;
int theta;
int alarm_theta;
int alarm_ticks;
int timer_theta;
int timer_ticks;
double jd_timer;
int color;
int stem_size;
#define THETA_STEP 1
int old_time_color;

   // draw the watch outline
   old_time_color = time_color;
   if(eclipsed) time_color = YELLOW;

   alarm_ticks = 0;
   alarm_theta = (999);  // shut up compiler warnings

   if(1) ;  // use edge ticks
   else if(alarm_date || alarm_time) {  // highlight the alarm clock time
      alarm_theta = ((alarm_hh%WATCH_HOURS)*WATCH_STEP*2)+alarm_mm;
      alarm_theta /= 2;
      alarm_theta -= 90;
      alarm_theta -= (ALARM_WIDTH/2);
      while(alarm_theta < 0) alarm_theta += 360;
      alarm_theta %= 360;
      alarm_theta /= THETA_STEP;      // round to clockface drawing increment
      alarm_theta *= THETA_STEP;
      if(alarm_theta < ALARM_WIDTH) { // alarm spans 0/360 degrees
         alarm_ticks = ALARM_WIDTH;
      }
   }    

   timer_ticks = 0;
   timer_theta = (999);  // shut up compiler warnings 

   if(1) ;  // use edge ticks
   else if(egg_timer) {  // highlight the egg time time
      jd_timer = jd_local + jtime(0,0,0, (double) egg_timer);
      jd_timer = jd_timer - (double) (int) jd_timer; 
      jd_timer = (jd_timer * 720.0);
      timer_theta = (int) jd_timer;
      timer_theta -= 90;
      timer_theta -= (ALARM_WIDTH/2);
      while(timer_theta < 0) timer_theta += 360;
      timer_theta %= 360;
      timer_theta /= THETA_STEP;      // round to clockface drawing increment
      timer_theta *= THETA_STEP;
      if(timer_theta < ALARM_WIDTH) { // timer spans 0/360 degrees
         timer_ticks = ALARM_WIDTH;
      }
   }


   if(luxor && (alarm_time || alarm_date || egg_timer)) {
      x = ((aclock_x + ACLOCK_R) / TEXT_WIDTH) - 2;
      y = ((aclock_y - ACLOCK_R) / TEXT_HEIGHT) + 2;
      out[0] = ALARM_CHAR;
      out[1] = 0;
      vidstr(y,x, WHITE, out);
   }

   x0 = (int) (ACLOCK_R * cos360(0));
   y0 = (int) (ACLOCK_R * sin360(0));

   for(theta=THETA_STEP; theta<=360; theta+=THETA_STEP) { 
      if(egg_timer && (theta == timer_theta)) {
         timer_ticks = ALARM_WIDTH*2;
      }
      if((alarm_date || alarm_time) && (theta == alarm_theta)) {
         alarm_ticks = ALARM_WIDTH*2;
      }

      color = time_color;
      if(timer_ticks) {
         color = TIMER_COLOR;
         --timer_ticks;
         if(THETA_STEP > 1) timer_ticks = 0;
      }
      if(alarm_ticks) {
         color = ALARM_COLOR;
         --alarm_ticks;
         if(THETA_STEP > 1) alarm_ticks = 0;
      }
      if(alarm_ticks && timer_ticks) color = BLACK;

      if(alarm_ticks || timer_ticks) {
         x = (int) ((ACLOCK_R+1) * cos360(theta));
         y = (int) ((ACLOCK_R+1) * sin360(theta));
         thick_line(aclock_x+x0,aclock_y+y0, aclock_x+x,aclock_y+y, color, 3);
      }
      else {
         x = (int) (ACLOCK_R * cos360(theta));
         y = (int) (ACLOCK_R * sin360(theta));
         line(aclock_x+x0,aclock_y+y0, aclock_x+x,aclock_y+y, color);
      }

      x0 = x;
      y0 = y;
   }

   stem_size = ACLOCK_SIZE / 50;      // draw watch winding stem
   if(stem_size < 3) stem_size = 3;
   line(aclock_x-stem_size, aclock_y-ACLOCK_R-stem_size, aclock_x+stem_size, aclock_y-ACLOCK_R-stem_size, time_color);
   line(aclock_x-stem_size, aclock_y-ACLOCK_R-stem_size, aclock_x-stem_size, aclock_y-ACLOCK_R, time_color);
   line(aclock_x+stem_size, aclock_y-ACLOCK_R-stem_size, aclock_x+stem_size, aclock_y-ACLOCK_R, time_color);

   time_color = old_time_color;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x135b05(%rip), %rax    # 0x2827b4
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
leaq 0x21fd35(%rip), %rax    # 0x36c9f0
cmpl $0x0, (%rax)
je 0x14cccd
leaq 0x135aed(%rip), %rax    # 0x2827b4
movl $0xe, (%rax)
movl $0x0, -0x1c(%rbp)
movl $0x3e7, -0x18(%rbp)     # imm = 0x3E7
movl $0x0, -0x24(%rbp)
movl $0x3e7, -0x20(%rbp)     # imm = 0x3E7
leaq 0x15142e(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x14cdc8
leaq 0x2203fc(%rip), %rax    # 0x36d0fc
cmpl $0x0, (%rax)
jne 0x14cd22
leaq 0x220400(%rip), %rax    # 0x36d10c
cmpl $0x0, (%rax)
jne 0x14cd22
leaq 0x2203d0(%rip), %rax    # 0x36d0e8
cmpq $0x0, (%rax)
je 0x14cdc8
leaq 0x24d82b(%rip), %rax    # 0x39a554
movl (%rax), %eax
movl %eax, -0x44(%rbp)
leaq 0x24d81b(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x44(%rbp), %eax
leaq 0x12aca5(%rip), %rdx    # 0x2779f0
subl (%rdx), %ecx
addl %ecx, %eax
leaq 0x12ac9a(%rip), %rcx    # 0x2779f0
cltd
idivl (%rcx)
subl $0x2, %eax
movl %eax, -0x4(%rbp)
leaq 0x24d7f2(%rip), %rax    # 0x39a558
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x24d7de(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x40(%rbp), %eax
leaq 0x12ac68(%rip), %rdx    # 0x2779f0
subl (%rdx), %ecx
subl %ecx, %eax
leaq 0x12ac61(%rip), %rcx    # 0x2779f4
cltd
idivl (%rcx)
addl $0x2, %eax
movl %eax, -0x8(%rbp)
leaq 0x24e65d(%rip), %rax    # 0x39b400
movb $0xf, (%rax)
leaq 0x24e653(%rip), %rax    # 0x39b400
movb $0x0, 0x1(%rax)
movl -0x8(%rbp), %edi
movl -0x4(%rbp), %esi
movl $0xf, %edx
leaq 0x24e63d(%rip), %rcx    # 0x39b400
callq 0x10ee0
leaq 0x24d781(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12ac10(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x4c(%rbp)
xorps %xmm0, %xmm0
movsd 0x35d3a(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x2237d(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movss -0x4c(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0xc(%rbp)
leaq 0x24d726(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12abb5(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd 0x35cdf(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x22322(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movss -0x48(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
cmpl $0x168, -0x14(%rbp)     # imm = 0x168
jg 0x14d147
leaq 0x22024f(%rip), %rax    # 0x36d0e8
cmpq $0x0, (%rax)
je 0x14ceae
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x14ceae
movl $0x4, -0x24(%rbp)
leaq 0x220257(%rip), %rax    # 0x36d10c
cmpl $0x0, (%rax)
jne 0x14cec6
leaq 0x22023b(%rip), %rax    # 0x36d0fc
cmpl $0x0, (%rax)
je 0x14ced5
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x14ced5
movl $0x4, -0x1c(%rbp)
leaq 0x1358d8(%rip), %rax    # 0x2827b4
movl (%rax), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x14cef7
movl $0xe, -0x34(%rbp)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14cf0d
movl $0xc, -0x34(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14cf20
cmpl $0x0, -0x24(%rbp)
je 0x14cf20
movl $0x0, -0x34(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x14cf30
cmpl $0x0, -0x24(%rbp)
je 0x14d037
leaq 0x24d619(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12aaa8(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x54(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x35bcd(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x22210(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movss -0x54(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x4(%rbp)
leaq 0x24d5b9(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12aa48(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x50(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x35b6d(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x221b0(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movss -0x50(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x8(%rbp)
leaq 0x24d55d(%rip), %rax    # 0x39a554
movl (%rax), %edi
addl -0xc(%rbp), %edi
leaq 0x24d555(%rip), %rax    # 0x39a558
movl (%rax), %esi
addl -0x10(%rbp), %esi
leaq 0x24d545(%rip), %rax    # 0x39a554
movl (%rax), %edx
addl -0x4(%rbp), %edx
leaq 0x24d53d(%rip), %rax    # 0x39a558
movl (%rax), %ecx
addl -0x8(%rbp), %ecx
movl -0x34(%rbp), %eax
movl $0x3, %r9d
movzbl %al, %r8d
callq 0x11710
jmp 0x14d12d
leaq 0x24d512(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12a9a1(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x5c(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x35ac9(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x2210c(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x96f0
movaps %xmm0, %xmm1
movss -0x5c(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x4(%rbp)
leaq 0x24d4b5(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12a944(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x58(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x35a6c(%rip), %xmm1    # 0x182b30
callq 0x94d0
movsd 0x220af(%rip), %xmm1    # 0x16f180
divsd %xmm1, %xmm0
callq 0x9080
movaps %xmm0, %xmm1
movss -0x58(%rbp), %xmm0
cvtsd2ss %xmm1, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x8(%rbp)
leaq 0x24d45c(%rip), %rax    # 0x39a554
movl (%rax), %edi
addl -0xc(%rbp), %edi
leaq 0x24d454(%rip), %rax    # 0x39a558
movl (%rax), %esi
addl -0x10(%rbp), %esi
leaq 0x24d444(%rip), %rax    # 0x39a554
movl (%rax), %edx
addl -0x4(%rbp), %edx
leaq 0x24d43c(%rip), %rax    # 0x39a558
movl (%rax), %ecx
addl -0x8(%rbp), %ecx
movl -0x34(%rbp), %eax
movzbl %al, %r8d
callq 0x109c0
movl -0x4(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x14ce85
leaq 0x24d402(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x32, %ecx
cltd
idivl %ecx
movl %eax, -0x38(%rbp)
cmpl $0x3, -0x38(%rbp)
jge 0x14d168
movl $0x3, -0x38(%rbp)
leaq 0x24d3e5(%rip), %rax    # 0x39a554
movl (%rax), %edi
subl -0x38(%rbp), %edi
leaq 0x24d3dd(%rip), %rax    # 0x39a558
movl (%rax), %esi
leaq 0x24d3cc(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12a85b(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
subl %eax, %esi
subl -0x38(%rbp), %esi
leaq 0x24d3b1(%rip), %rax    # 0x39a554
movl (%rax), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq 0x24d3a6(%rip), %rax    # 0x39a558
movl (%rax), %ecx
leaq 0x24d395(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %r8d
cltd
idivl %r8d
movl -0x68(%rbp), %edx
leaq 0x12a81f(%rip), %r8     # 0x2779f0
subl (%r8), %eax
subl %eax, %ecx
subl -0x38(%rbp), %ecx
leaq 0x1355d4(%rip), %rax    # 0x2827b4
movl (%rax), %eax
movzbl %al, %r8d
callq 0x109c0
leaq 0x24d362(%rip), %rax    # 0x39a554
movl (%rax), %edi
subl -0x38(%rbp), %edi
leaq 0x24d35a(%rip), %rax    # 0x39a558
movl (%rax), %esi
leaq 0x24d349(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12a7d8(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
subl %eax, %esi
subl -0x38(%rbp), %esi
leaq 0x24d32e(%rip), %rax    # 0x39a554
movl (%rax), %eax
subl -0x38(%rbp), %eax
movl %eax, -0x64(%rbp)
leaq 0x24d323(%rip), %rax    # 0x39a558
movl (%rax), %ecx
leaq 0x24d312(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %r8d
cltd
idivl %r8d
movl -0x64(%rbp), %edx
leaq 0x12a79c(%rip), %r8     # 0x2779f0
subl (%r8), %eax
subl %eax, %ecx
leaq 0x135554(%rip), %rax    # 0x2827b4
movl (%rax), %eax
movzbl %al, %r8d
callq 0x109c0
leaq 0x24d2e2(%rip), %rax    # 0x39a554
movl (%rax), %edi
addl -0x38(%rbp), %edi
leaq 0x24d2da(%rip), %rax    # 0x39a558
movl (%rax), %esi
leaq 0x24d2c9(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq 0x12a758(%rip), %rcx    # 0x2779f0
subl (%rcx), %eax
subl %eax, %esi
subl -0x38(%rbp), %esi
leaq 0x24d2ae(%rip), %rax    # 0x39a554
movl (%rax), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x60(%rbp)
leaq 0x24d2a3(%rip), %rax    # 0x39a558
movl (%rax), %ecx
leaq 0x24d292(%rip), %rax    # 0x39a550
movl (%rax), %eax
movl $0x2, %r8d
cltd
idivl %r8d
movl -0x60(%rbp), %edx
leaq 0x12a71c(%rip), %r8     # 0x2779f0
subl (%r8), %eax
subl %eax, %ecx
leaq 0x1354d4(%rip), %rax    # 0x2827b4
movl (%rax), %eax
movzbl %al, %r8d
callq 0x109c0
movl -0x3c(%rbp), %ecx
leaq 0x1354bf(%rip), %rax    # 0x2827b4
movl %ecx, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)