// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x130693(%rip), %r8     # 0x20d5d4
movl (%r8), %eax
movl %eax, -0x3c(%rbp)
leaq 0x21a8c2(%rip), %rax    # 0x2f7810
cmpl $0x0, (%rax)
je 0xdcf5a
movl $0xe, (%r8)
leaq 0x14bfdd(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
je 0xdcfee
leaq 0x21afab(%rip), %rax    # 0x2f7f1c
cmpl $0x0, (%rax)
jne 0xdcf8f
leaq 0x21afaf(%rip), %rax    # 0x2f7f2c
cmpl $0x0, (%rax)
jne 0xdcf8f
leaq 0x21af7f(%rip), %rax    # 0x2f7f08
cmpq $0x0, (%rax)
je 0xdcfee
leaq 0x2483de(%rip), %rsi    # 0x325374
leaq 0x2483d3(%rip), %rax    # 0x325370
movl (%rax), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %ecx
leaq 0x125862(%rip), %rax    # 0x202810
movl (%rax), %edi
subl %edi, %ecx
movl (%rsi), %eax
addl %ecx, %eax
cltd
idivl %edi
leal -0x2(%rax), %esi
leaq 0x2483b5(%rip), %rax    # 0x325378
movl (%rax), %eax
subl %ecx, %eax
leaq 0x125846(%rip), %rcx    # 0x202814
cltd
idivl (%rcx)
leal 0x2(%rax), %edi
leaq 0x249245(%rip), %rcx    # 0x326220
movw $0xf, (%rcx)
pushq $0xf
popq %rdx
movq %r8, %rbx
callq 0xe2d2
movq %rbx, %r8
leaq 0x24837b(%rip), %rax    # 0x325370
movl (%rax), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
leaq 0x12580c(%rip), %rcx    # 0x202810
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
cvttss2si %xmm0, %r12d
xorl %r15d, %r15d
movsd 0x16056(%rip), %xmm0    # 0xf3070
movl $0x168, %r13d           # imm = 0x168
subl $0x1, %r13d
jb 0xdd119
movzbl (%r8), %eax
movl %eax, -0x40(%rbp)
leaq 0x248338(%rip), %rbx    # 0x325370
movl (%rbx), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
leaq 0x1257c9(%rip), %rcx    # 0x202810
subl (%rcx), %eax
cvtsi2ss %eax, %xmm1
movss %xmm1, -0x2c(%rbp)
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd 0x2b14c(%rip), %xmm1    # 0x1081b0
callq 0x94d0
movsd 0x160ef(%rip), %xmm1    # 0xf3160
divsd %xmm1, %xmm0
callq 0x9710
cvtsd2ss %xmm0, %xmm0
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %r14d
movl (%rbx), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
leaq 0x125779(%rip), %rcx    # 0x202810
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x2c(%rbp)
movsd -0x38(%rbp), %xmm0
movsd 0x2b101(%rip), %xmm1    # 0x1081b0
callq 0x94d0
divsd 0x160a4(%rip), %xmm0    # 0xf3160
callq 0x9080
cvtsd2ss %xmm0, %xmm0
mulss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %ebx
leaq 0x24829f(%rip), %rax    # 0x325374
movl (%rax), %edx
addl %edx, %r12d
leaq 0x248297(%rip), %rax    # 0x325378
movl (%rax), %ecx
addl %ecx, %r15d
addl %r14d, %edx
addl %ebx, %ecx
movl %r12d, %edi
movl %r15d, %esi
movl -0x40(%rbp), %r8d
callq 0xdedf
movsd -0x38(%rbp), %xmm0
leaq 0x1304ce(%rip), %r8     # 0x20d5d4
addsd 0x15f62(%rip), %xmm0    # 0xf3070
movl %ebx, %r15d
movl %r14d, %r12d
jmp 0xdd020
leaq 0x248250(%rip), %r12    # 0x325370
movl (%r12), %ecx
pushq $0x32
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
cmpl $0x4, %eax
pushq $0x3
popq %rbx
cmovgel %eax, %ebx
leaq 0x248238(%rip), %r14    # 0x325374
movl (%r14), %r9d
movl %r9d, %edi
subl %ebx, %edi
pushq $-0x2
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
leaq 0x248225(%rip), %r12    # 0x325378
addl (%r12), %eax
subl %ebx, %eax
leaq 0x1256b0(%rip), %r13    # 0x202810
addl (%r13), %eax
addl %ebx, %r9d
movq %r8, %r15
movzbl (%r8), %r8d
movl %eax, %esi
movl %r9d, %edx
movl %eax, %ecx
callq 0xdedf
movl (%r14), %edi
subl %ebx, %edi
leaq 0x2481ea(%rip), %r12    # 0x325370
movl (%r12), %eax
cltd
pushq $-0x2
popq %r14
idivl %r14d
movl (%r13), %ecx
leaq 0x2481db(%rip), %rdx    # 0x325378
addl (%rdx), %ecx
addl %eax, %ecx
movl %ecx, %esi
subl %ebx, %esi
movzbl (%r15), %r8d
movl %edi, %edx
callq 0xdedf
leaq 0x2481bd(%rip), %rax    # 0x325374
movl (%rax), %edi
addl %ebx, %edi
movl (%r12), %eax
cltd
idivl %r14d
movl (%r13), %ecx
leaq 0x2481aa(%rip), %rdx    # 0x325378
addl (%rdx), %ecx
addl %eax, %ecx
movl %ecx, %esi
subl %ebx, %esi
movzbl (%r15), %r8d
movl %edi, %edx
callq 0xdedf
movl -0x3c(%rbp), %eax
movl %eax, (%r15)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq