// File: /workspace/github_cpp_makefile_star2_O2/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 0x123f79(%rip), %rax    # 0x2027d8
leaq 0x148462(%rip), %rcx    # 0x226cc8
movl (%rcx), %ecx
orl (%rax), %ecx
jne 0xde918
leaq 0x217f31(%rip), %rbx    # 0x2f67a8
movzbl (%rbx), %ecx
leal -0x56(%rcx), %eax
cmpl $0x4, %eax
jb 0xde8c1
cmpl $0x42, %ecx
jne 0xde9d9
leaq 0x246afa(%rip), %rax    # 0x32538c
movl (%rax), %eax
leaq 0x246ad5(%rip), %rdx    # 0x325370
movl %eax, (%rdx)
leaq 0x246afc(%rip), %rax    # 0x3253a0
movl (%rax), %eax
leaq 0x246ac7(%rip), %rdx    # 0x325374
movl %eax, (%rdx)
leaq 0x246aee(%rip), %rax    # 0x3253a4
movl (%rax), %eax
leaq 0x246ab9(%rip), %rdx    # 0x325378
movl %eax, (%rdx)
leaq 0x126b48(%rip), %r14    # 0x205410
cmpb $0x0, (%r14)
jne 0xde8e8
leal -0x42(%rcx), %eax
cmpl $0x17, %eax
ja 0xdea42
movl $0xf00001, %edx         # imm = 0xF00001
btl %eax, %edx
jae 0xdea42
leaq 0x14a669(%rip), %rax    # 0x228f58
cmpl $0x0, (%rax)
setne %sil
leaq 0x246a7b(%rip), %r15    # 0x325378
movl (%r15), %eax
leaq 0x123f75(%rip), %rdx    # 0x20287c
movl (%rdx), %edx
cmpl %edx, %eax
setg %dil
testb %dil, %sil
je 0xde920
pushq $0x9
jmp 0xde91a
pushq $0x1
popq %rax
jmp 0xdead4
cmpl %edx, %eax
jle 0xde931
leaq 0x246ac1(%rip), %rax    # 0x3253ec
movl $0x1, (%rax)
andb $-0x2, %cl
cmpb $0x58, %cl
je 0xde93e
callq 0xe850
callq 0xdc785
callq 0xdcf29
callq 0xde403
cmpb $0x58, (%rbx)
je 0xdeacd
leaq 0x218673(%rip), %rax    # 0x2f6fd0
movsd (%rax), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xde984
jp 0xde984
leaq 0x218664(%rip), %rax    # 0x2f6fd8
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0xde984
jnp 0xdeacd
movl $0xe, 0x75cb2(%rip)     # 0x154640
pushq $0x1
popq %rdi
callq 0xdc612
cmpb $0x0, (%rbx)
je 0xdea82
leaq 0x218b8a(%rip), %rax    # 0x2f7530
movsd (%rax), %xmm0
leaq 0x2469c3(%rip), %rax    # 0x325374
movl (%rax), %edi
movl (%r15), %esi
leaq 0x2469b3(%rip), %rax    # 0x325370
movl (%rax), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
pushq $0x1
popq %rcx
movl %eax, %edx
callq 0xddb21
callq 0xde1ef
jmp 0xdeacd
leaq 0x126a28(%rip), %rax    # 0x205408
cmpb $0x0, (%rax)
je 0xdea3b
leaq 0x14a56c(%rip), %rax    # 0x228f58
cmpl $0x0, (%rax)
je 0xdea0d
leaq 0x2469f0(%rip), %rax    # 0x3253e8
cmpb $0x0, (%rax)
je 0xdea0d
leaq 0x2469e8(%rip), %rax    # 0x3253ec
testb $0x1, (%rax)
jne 0xdeadf
leaq 0x14832a(%rip), %rax    # 0x226d3e
cmpb $0x0, (%rax)
je 0xdea74
leaq 0x246890(%rip), %rax    # 0x3252b0
cmpb $0x0, (%rax)
je 0xdea74
leaq 0x123dd4(%rip), %rax    # 0x202800
cmpl $0x690, (%rax)          # imm = 0x690
jge 0xdea74
pushq $0x3
jmp 0xde91a
pushq $0x2
jmp 0xde91a
leaq 0x24699f(%rip), %rax    # 0x3253e8
cmpb $0x0, (%rax)
leaq 0x1269c2(%rip), %rax    # 0x205415
movb (%rax), %al
je 0xdeae6
testb %al, %al
setne %al
testl %ecx, %ecx
setne %dl
testb %al, %dl
je 0xdeaf1
pushq $0x4
jmp 0xde91a
cmpl $0x42, %ecx
je 0xde88b
jmp 0xde8c1
movb (%r14), %al
testb %al, %al
setne %dl
leaq 0x126980(%rip), %rcx    # 0x205411
movb (%rcx), %cl
testb %cl, %cl
setne %sil
andb %dl, %sil
leaq 0x126961(%rip), %rdx    # 0x205404
movl (%rdx), %edx
cmpl $0x1, %edx
sete %dil
testb %dil, %sil
jne 0xdeacd
testb %al, %al
setne %al
testb %cl, %cl
sete %cl
andb %al, %cl
decl %edx
cmpl $0x2, %edx
setb %al
testb %al, %cl
je 0xde99f
callq 0xdd1f6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x42
jmp 0xde91a
testb %al, %al
je 0xdeb2c
pushq $0x6
jmp 0xde91a
leaq 0x2467b8(%rip), %rax    # 0x3252b0
cmpb $0x0, (%rax)
je 0xde8e8
leaq 0x123cf8(%rip), %rax    # 0x202800
movl (%rax), %esi
leaq 0x12ea33(%rip), %rax    # 0x20d544
imull $0x31a, (%rax), %eax    # imm = 0x31A
pushq $0x64
popq %rdi
cltd
idivl %edi
cmpl %eax, %esi
jge 0xde8e8
pushq $0x5
jmp 0xde91a
leaq 0x24677d(%rip), %rax    # 0x3252b0
cmpb $0x0, (%rax)
setne %al
leaq 0x123cc0(%rip), %rdx    # 0x202800
movl (%rdx), %esi
cmpl $0x690, %esi            # imm = 0x690
setl %dl
testb %dl, %al
je 0xdeb56
pushq $0x7
jmp 0xde91a
leaq 0x12e9e7(%rip), %rax    # 0x20d544
imull $0x31a, (%rax), %eax    # imm = 0x31A
pushq $0x64
popq %rdi
cltd
idivl %edi
cmpl %eax, %esi
jge 0xde8e8
pushq $0x8
jmp 0xde91a