// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: draw_watch(int)
int draw_watch(int why)
{
   if(text_mode) return 1;
   if(measure_jitter) return 1;
//sprintf(plot_title, "draw watch:%d", why);

   if((zoom_screen == 'W') || (zoom_screen == 'B') || (zoom_screen == 'X')) ;
   else if(zoom_screen == 'Y') ;
   else if(zoom_screen == 'V') ;
   else if(plot_watch == 0) return 2;
   else if(first_key && shared_plot && (shared_item & SHARE_WATCH)) return 66;
   else if(all_adevs && plot_lla && (WIDE_SCREEN == 0)) return 3;
   else if(plot_lla && lla_showing) {
//.     if(SMALL_SCREEN) return 15;
////  if((shared_item & SHARE_WATCH) == 0) return 15;
if(SMALL_SCREEN && ((shared_item & SHARE_WATCH) == 0)) {
////return 15;
}
   }

if(zoom_screen == 'B') {
   ACLOCK_SIZE = AZEL_SIZE;
   aclock_x = AZEL_X;        //SCREEN_WIDTH/2 - TEXT_WIDTH*2;
   aclock_y = AZEL_Y;        //TEXT_HEIGHT*2 + ACLOCK_SIZE/2;
}

   if((zoom_screen == 'W') || (zoom_screen == 'B') || (zoom_screen == 'X')) ;
   else if(zoom_screen == 'Y') ;
   else if(zoom_screen == 'V') ;
   else if(map_and_watch) ;
   else if(shared_plot) {
      if(plot_signals && zoom_screen) return 4; 
      if(plot_lla && (SCREEN_WIDTH < NARROW_SCREEN)) return 5;
   }
   else {  // see if no room for both watch and lla
      if(plot_signals) return 6;
      if(plot_lla && (WIDE_SCREEN == 0)) return 7;
      if(SCREEN_WIDTH < NARROW_SCREEN) return 8; 
   }

   if(first_key && (aclock_y > PLOT_ROW)) return 9;  // watch would be in active help screen
   if(aclock_y > PLOT_ROW) shared_item = SHARE_WATCH;


   if(MESS && map_and_watch && map_and_sigs && (plot_areas == 1)) ;
   else if(zoom_screen == 'X') ;
   else if(zoom_screen == 'Y') ;
   else erase_watch();

   draw_watch_face();
   draw_watch_outline();
   draw_watch_alarms();

   if(zoom_screen == 'X') ;
   else if((lat != 0.0) || (lon != 0.0)) {
      moon_color = YELLOW;
      #ifdef TRUE_MOON
         calc_moon_posn(1);
      #endif

      // don't draw moon twice in the watch/map areas because
      // they have slighly different sizes and locations.
      if(zoom_screen) goto watch_moon;
      if(map_and_watch && map_and_sigs && (plot_areas == 1)) ;
      else if(map_and_watch && (map_and_sigs == 0) && (plot_areas == 2)) ;
      else if(map_and_watch && (map_and_sigs == 0) && (plot_areas == 1)) ;
      else {  // watch and map do not overlap, ok to draw watch's moon
         watch_moon:
         draw_moon(jd_utc, aclock_x,aclock_y, ACLOCK_SIZE/2, 1);
         draw_watch_sun();
      }

      if(0 && ((zoom_screen == 'W') || ((zoom_screen == 'B') && (SCREEN_WIDTH >= MEDIUM_WIDTH)))) {
         show_sun_moon(TIME_ROW-1, TIME_COL);
      }
   }

   draw_watch_hands();
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x124b66(%rip), %rcx    # 0x2187d8
leaq 0x14904f(%rip), %rax    # 0x23ccc8
movl (%rax), %edx
movl $0x1, %eax
orl (%rcx), %edx
jne 0xf3f35
leaq 0x218b19(%rip), %rbx    # 0x30c7a8
movzbl (%rbx), %ecx
leal -0x56(%rcx), %edx
cmpl $0x4, %edx
jb 0xf3cd9
cmpl $0x42, %ecx
jne 0xf3de7
leaq 0x2476e2(%rip), %rax    # 0x33b38c
movl (%rax), %eax
leaq 0x2476bd(%rip), %rsi    # 0x33b370
movl %eax, (%rsi)
leaq 0x2476e4(%rip), %rax    # 0x33b3a0
movl (%rax), %eax
leaq 0x2476af(%rip), %rsi    # 0x33b374
movl %eax, (%rsi)
leaq 0x2476d6(%rip), %rax    # 0x33b3a4
movl (%rax), %eax
leaq 0x2476a1(%rip), %rsi    # 0x33b378
movl %eax, (%rsi)
leaq 0x127730(%rip), %r14    # 0x21b410
cmpb $0x0, (%r14)
jne 0xf3cf4
cmpl $0x4, %edx
jb 0xf3cf4
cmpl $0x42, %ecx
jne 0xf3e68
leaq 0x14b25d(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
setne %dil
leaq 0x24766f(%rip), %r15    # 0x33b378
movl (%r15), %edx
leaq 0x124b69(%rip), %rax    # 0x21887c
movl (%rax), %esi
cmpl %esi, %edx
setg %r8b
movl $0x9, %eax
testb %r8b, %dil
jne 0xf3f35
cmpl %esi, %edx
jle 0xf3d3a
leaq 0x2476b8(%rip), %rax    # 0x33b3ec
movl $0x1, (%rax)
andb $-0x2, %cl
cmpb $0x58, %cl
je 0xf3d47
callq 0xed70
callq 0xf1948
callq 0xf2251
callq 0xf37b0
cmpb $0x58, (%rbx)
je 0xf3f2e
leaq 0x21926a(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xf3d8d
jp 0xf3d8d
leaq 0x21925b(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0xf3d8d
jnp 0xf3f2e
movl $0xe, 0x768a9(%rip)     # 0x16a640
movl $0x1, %edi
callq 0xf17ce
cmpb $0x0, (%rbx)
je 0xf3ee3
leaq 0x21977f(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
leaq 0x2475b8(%rip), %rax    # 0x33b374
movl (%rax), %edi
movl (%r15), %esi
leaq 0x2475a8(%rip), %rax    # 0x33b370
movl (%rax), %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
movl $0x1, %ecx
callq 0xf2eb2
callq 0xf358e
jmp 0xf3f2e
leaq 0x12761a(%rip), %rax    # 0x21b408
cmpb $0x0, (%rax)
je 0xf3e5e
leaq 0x14b15e(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
je 0xf3e20
leaq 0x2475e2(%rip), %rax    # 0x33b3e8
cmpb $0x0, (%rax)
je 0xf3e20
leaq 0x2475da(%rip), %rsi    # 0x33b3ec
movl $0x42, %eax
testb $0x1, (%rsi)
jne 0xf3f35
leaq 0x148f17(%rip), %rax    # 0x23cd3e
cmpb $0x0, (%rax)
je 0xf3e50
leaq 0x24747d(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
je 0xf3e50
leaq 0x1249c1(%rip), %rsi    # 0x218800
movl $0x3, %eax
cmpl $0x690, (%rsi)          # imm = 0x690
jl 0xf3f35
cmpl $0x42, %ecx
je 0xf3ca3
jmp 0xf3cd9
movl $0x2, %eax
jmp 0xf3f35
leaq 0x247579(%rip), %rax    # 0x33b3e8
cmpb $0x0, (%rax)
leaq 0x12759c(%rip), %rax    # 0x21b415
movb (%rax), %dl
je 0xf3f40
testb %dl, %dl
setne %dl
testl %ecx, %ecx
setne %sil
movl $0x4, %eax
testb %dl, %sil
jne 0xf3f35
leaq 0x24740f(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
je 0xf3cf4
leaq 0x12494f(%rip), %rdx    # 0x218800
leaq 0x12f68c(%rip), %rax    # 0x223544
imull $0x31a, (%rax), %eax    # imm = 0x31A
cltq
imulq $0x51eb851f, %rax, %rsi # imm = 0x51EB851F
movq %rsi, %rax
shrq $0x3f, %rax
sarq $0x25, %rsi
addl %eax, %esi
movl $0x5, %eax
cmpl %esi, (%rdx)
jge 0xf3cf4
jmp 0xf3f35
movb (%r14), %al
testb %al, %al
setne %dl
leaq 0x12751f(%rip), %rcx    # 0x21b411
movb (%rcx), %cl
testb %cl, %cl
setne %sil
andb %dl, %sil
leaq 0x127500(%rip), %rdx    # 0x21b404
movl (%rdx), %edx
cmpl $0x1, %edx
sete %dil
testb %dil, %sil
jne 0xf3f2e
testb %al, %al
setne %al
testb %cl, %cl
sete %cl
andb %al, %cl
decl %edx
cmpl $0x2, %edx
setb %al
testb %al, %cl
je 0xf3daa
callq 0xf252f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x6, %eax
testb %dl, %dl
jne 0xf3f35
leaq 0x247360(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
setne %sil
leaq 0x1248a2(%rip), %rax    # 0x218800
movl (%rax), %edx
cmpl $0x690, %edx            # imm = 0x690
setl %dil
movl $0x7, %eax
testb %dil, %sil
jne 0xf3f35
leaq 0x12f5c9(%rip), %rax    # 0x223544
imull $0x31a, (%rax), %eax    # imm = 0x31A
cltq
imulq $0x51eb851f, %rax, %rsi # imm = 0x51EB851F
movq %rsi, %rax
shrq $0x3f, %rax
sarq $0x25, %rsi
addl %eax, %esi
movl $0x8, %eax
cmpl %esi, %edx
jge 0xf3cf4
jmp 0xf3f35