// File: /workspace/github_cpp_makefile_star2_O1/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 0x12522f(%rip), %rcx    # 0x2187d8
leaq 0x149718(%rip), %rax    # 0x23ccc8
movl (%rax), %edx
movl $0x1, %eax
orl (%rcx), %edx
jne 0xf3871
leaq 0x2191e2(%rip), %rbx    # 0x30c7a8
movzbl (%rbx), %ecx
leal -0x56(%rcx), %edx
cmpl $0x4, %edx
jb 0xf3610
cmpl $0x42, %ecx
jne 0xf3723
leaq 0x247dab(%rip), %rax    # 0x33b38c
movl (%rax), %eax
leaq 0x247d86(%rip), %rsi    # 0x33b370
movl %eax, (%rsi)
leaq 0x247dad(%rip), %rax    # 0x33b3a0
movl (%rax), %eax
leaq 0x247d78(%rip), %rsi    # 0x33b374
movl %eax, (%rsi)
leaq 0x247d9f(%rip), %rax    # 0x33b3a4
movl (%rax), %eax
leaq 0x247d6a(%rip), %rsi    # 0x33b378
movl %eax, (%rsi)
leaq 0x127df9(%rip), %r14    # 0x21b410
cmpb $0x0, (%r14)
jne 0xf362b
cmpl $0x4, %edx
jb 0xf362b
cmpl $0x42, %ecx
jne 0xf37a4
leaq 0x14b926(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
je 0xf3654
leaq 0x247d3a(%rip), %rax    # 0x33b378
movl (%rax), %edx
leaq 0x125235(%rip), %rsi    # 0x21887c
movl $0x9, %eax
cmpl (%rsi), %edx
jg 0xf3871
leaq 0x247d1d(%rip), %r15    # 0x33b378
movl (%r15), %eax
leaq 0x125217(%rip), %rdx    # 0x21887c
cmpl (%rdx), %eax
jle 0xf3676
leaq 0x247d7c(%rip), %rax    # 0x33b3ec
movl $0x1, (%rax)
andb $-0x2, %cl
cmpb $0x58, %cl
je 0xf3683
callq 0xede3
callq 0xf1276
callq 0xf1b95
callq 0xf30eb
cmpb $0x58, (%rbx)
je 0xf386a
leaq 0x21992e(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xf36c9
jp 0xf36c9
leaq 0x21991f(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0xf36c9
jnp 0xf386a
movl $0xe, 0x76f6d(%rip)     # 0x16a640
movl $0x1, %edi
callq 0xf10fc
cmpb $0x0, (%rbx)
je 0xf381f
leaq 0x219e43(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
leaq 0x247c7c(%rip), %rax    # 0x33b374
movl (%rax), %edi
movl (%r15), %esi
leaq 0x247c6c(%rip), %rax    # 0x33b370
movl (%rax), %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
movl $0x1, %ecx
callq 0xf27f5
callq 0xf2ec9
jmp 0xf386a
leaq 0x127cde(%rip), %rax    # 0x21b408
cmpb $0x0, (%rax)
je 0xf379a
leaq 0x14b822(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
je 0xf375c
leaq 0x247ca6(%rip), %rax    # 0x33b3e8
cmpb $0x0, (%rax)
je 0xf375c
leaq 0x247c9e(%rip), %rsi    # 0x33b3ec
movl $0x42, %eax
testb $0x1, (%rsi)
jne 0xf3871
leaq 0x1495db(%rip), %rax    # 0x23cd3e
cmpb $0x0, (%rax)
je 0xf378c
leaq 0x247b41(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
je 0xf378c
leaq 0x125085(%rip), %rsi    # 0x218800
movl $0x3, %eax
cmpl $0x690, (%rsi)          # imm = 0x690
jl 0xf3871
cmpl $0x42, %ecx
je 0xf35da
jmp 0xf3610
movl $0x2, %eax
jmp 0xf3871
leaq 0x247c3d(%rip), %rax    # 0x33b3e8
cmpb $0x0, (%rax)
leaq 0x127c60(%rip), %rax    # 0x21b415
movb (%rax), %dl
je 0xf387c
testb %dl, %dl
setne %dl
testl %ecx, %ecx
setne %sil
movl $0x4, %eax
testb %dl, %sil
jne 0xf3871
leaq 0x247ad3(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
je 0xf362b
leaq 0x125013(%rip), %rdx    # 0x218800
leaq 0x12fd50(%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 0xf362b
jmp 0xf3871
movb (%r14), %al
testb %al, %al
setne %dl
leaq 0x127be3(%rip), %rcx    # 0x21b411
movb (%rcx), %cl
testb %cl, %cl
setne %sil
andb %dl, %sil
leaq 0x127bc4(%rip), %rdx    # 0x21b404
movl (%rdx), %edx
cmpl $0x1, %edx
sete %dil
testb %dil, %sil
jne 0xf386a
testb %al, %al
setne %al
testb %cl, %cl
sete %cl
andb %al, %cl
decl %edx
cmpl $0x2, %edx
setb %al
testb %al, %cl
je 0xf36e6
callq 0xf1e73
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x6, %eax
testb %dl, %dl
jne 0xf3871
leaq 0x247a24(%rip), %rax    # 0x33b2b0
cmpb $0x0, (%rax)
setne %sil
leaq 0x124f66(%rip), %rax    # 0x218800
movl (%rax), %edx
cmpl $0x690, %edx            # imm = 0x690
setl %dil
movl $0x7, %eax
testb %dil, %sil
jne 0xf3871
leaq 0x12fc8d(%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 0xf362b
jmp 0xf3871