// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heather.cpp
// Function: config_screen(int)
void config_screen(int why)
{
int i;

   // setup variables related to the video screen size
   no_x_margin = no_y_margin = 0;

   VERT_MAJOR = 30;    // the graph axes tick mark spacing (in pixels)
   VERT_MINOR  = 6;    // VERT_MAJOR/VERT_MINOR should be 5

   HORIZ_MAJOR = 60;
   HORIZ_MINOR = 10;

   INFO_COL = 65;
   if(text_mode) INFO_COL -= 1;
   else if(SCREEN_WIDTH <= 480) {
      INFO_COL -= 3;  // piss
   }
   else if(SCREEN_WIDTH <= 640) INFO_COL -= 2;
   else if(1 && (SCREEN_HEIGHT <= TINY_HEIGHT) && (SCREEN_WIDTH > NARROW_SCREEN-20) && (SCREEN_WIDTH <= NARROW_SCREEN+X11_MARGIN)) {
      INFO_COL -= 2;  // kludge for small touch screens (800x480)
   }
   else if(SCREEN_WIDTH <= NARROW_SCREEN) INFO_COL -= 1;
   else if(small_font == 1) INFO_COL -= 1;

   FILTER_ROW = 18;
   FILTER_COL = INFO_COL;

   AZEL_SIZE = LLA_SIZE = (MAX_AZEL); // size of the az/el map area
   eofs = 1;

   PLOT_COL = 0;

   config_res();   // set the height/width, etc.
   SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);

//sprintf(plot_title, "PLOT_ROW:%d  VM:%d  texth:%d", PLOT_ROW, VERT_MAJOR, TEXT_HEIGHT);
   if(zoom_screen == 'P') {
      if(user_set_plot_row == 0) {
         if((SCREEN_WIDTH < TINY_TINY_WIDTH) || (SCREEN_WIDTH < SCREEN_HEIGHT)) {  //piss
            PLOT_ROW = TEXT_HEIGHT*12;
         }
         else {
            PLOT_ROW = TEXT_HEIGHT*8;
         }
         scale_plot_row();
      }
   }
   else if(1 && luxor) {
//      PLOT_ROW = SCREEN_HEIGHT / 2;
//      scale_plot_row();
//if(PLOT_ROW > TEXT_HEIGHT*26) PLOT_ROW = TEXT_HEIGHT*26;
//      PLOT_ROW /= TEXT_HEIGHT;
//      PLOT_ROW *= TEXT_HEIGHT;
      if(user_set_plot_row == 0) {
         if(plot_digital_clock == 0) {
            PLOT_ROW -= VERT_MAJOR*2;
            scale_plot_row();
         }
      }
   }
   else if((all_adevs == SINGLE_ADEVS) && (SCREEN_HEIGHT > SHORT_SCREEN) && (max_sats > 8) && plot_digital_clock) {
      i = (max_sats-8) * TEXT_HEIGHT;
      if(sat_cols > 1) i = (sat_rows-8) * TEXT_HEIGHT;
      i += ((VERT_MAJOR*2) - 1);
      i /= (VERT_MAJOR*2);  // makes graph prettier to have things a multiple of VERT_MAJOR*2
      i *= (VERT_MAJOR*2);

      if(user_set_plot_row == 0) {
         PLOT_ROW = PLOT_ROW + i;
         scale_plot_row();
      }
   }

   if(small_sat_count) {  // compress sat count to VERT_MINOR ticks per sat
      COUNT_SCALE = VERT_MINOR;
   }
   else {                 // expand sat count to VERT_MAJOR ticks per sat
      COUNT_SCALE = VERT_MAJOR;
   }

   if(no_plots) {
      if(user_set_plot_row == 0) {
         PLOT_ROW = SCREEN_HEIGHT;
      }
//    scale_plot_row();
   }

   // graphs look best if PLOT_HEIGHT is a multiple of (2*VERT_MAJOR)
   // but small screens don't have room to waste
   PLOT_HEIGHT = (SCREEN_HEIGHT-PLOT_ROW);
   PLOT_HEIGHT /= (VERT_MAJOR*2);  // makes graph prettier to have things a multiple of VERT_MAJOR*2
   PLOT_HEIGHT *= (VERT_MAJOR*2);

   PLOT_CENTER = (PLOT_HEIGHT/2-1);

if(1 && ((PLOT_ROW+PLOT_HEIGHT) < SCREEN_HEIGHT)) {  // shift plot down to bottom of the screen
   PLOT_ROW += (SCREEN_HEIGHT - (PLOT_ROW + PLOT_HEIGHT) - 0);
}

   PLOT_WIDTH = (SCREEN_WIDTH/HORIZ_MAJOR) * HORIZ_MAJOR;
   if(day_plot) {
      PLOT_WIDTH = HORIZ_MAJOR * day_plot;
      if(interval_set) {
         queue_interval = (60L*60L) / HORIZ_MAJOR;
         interval_set = 0;
      }
   }

   // when graph fills, scroll it left this many pixels
   if(continuous_scroll) PLOT_SCROLL = 1;  // live update mode for fast processors
   else                  PLOT_SCROLL = (HORIZ_MAJOR*2);

   if(rcvr_type == NO_RCVR) ;
   else if(no_plots) ;
   else if(0 && SMALL_SCREEN) {  // undersized screen
      if     (plot_azel)     shared_plot = 1;
      else if(plot_signals)  shared_plot = 1;
      else if(plot_watch)    shared_plot = 1;
      else if(plot_lla)      shared_plot = 1;
      else                   shared_plot = 0;
   }

   if(fix_mode && plot_lla && (plot_azel || plot_signals) && (WIDE_SCREEN == 0)) {
      shared_plot = 1;
   }
   if(all_adevs && plot_lla) {
      shared_plot = 1;
   }

   config_zoom();  // see if Z zoom command can be used
   config_azel();  // setup for drawing azel map (and analog watch)
   config_lla();   // setup for drawing lat/lon/alt plot
   config_text();  // setup for drawing text
   config_watch(); // setup for drawing the analog watch

// sprintf(plot_title, "share:%d azel:%d,%d  lla:%d,%d  watch:%d,%d  adev:%d,%d", share_active, AZEL_ROW,AZEL_COL, LLA_ROW,LLA_COL, WATCH_ROW,WATCH_COL, ADEV_ROW,ADEV_COL);

   if(PLOT_ROW >= (PLOT_TOP+2*VERT_MAJOR)) big_plot = 1;
   else                                    big_plot = 0;

   if(SCREEN_HEIGHT <= TINY_HEIGHT) {
      if((rcvr_type == SCPI_RCVR) || (rcvr_type == UCCM_RCVR) || (rcvr_type == TRUE_RCVR) || (rcvr_type == ZYFER_RCVR)) ;
      else if(have_ffom || have_tfom) ;
      else if(!user_set_dops) plot_dops = 0;
   }

   screen_configed = 1;

   if(no_redraw == 0) need_redraw = why;
   force_adev_redraw(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %eax, %eax
movb %al, 0x20b8c2(%rip)     # 0x21885b
movb %al, 0x20b8bb(%rip)     # 0x21885a
movl $0x1e, 0x20b8c3(%rip)   # 0x21886c
movl $0x6, 0x20b8bd(%rip)    # 0x218870
movl $0x3c, 0x20b8b7(%rip)   # 0x218874
movl $0xa, 0x20b8b1(%rip)    # 0x218878
movl $0x41, 0x20b7cb(%rip)   # 0x21879c
cmpl $0x0, 0x20b800(%rip)    # 0x2187d8
je 0xcfe1
movl $0x40, %eax
jmp 0xd005
movl 0x20b819(%rip), %ecx    # 0x218800
movl $0x3e, %eax
cmpl $0x1e1, %ecx            # imm = 0x1E1
jl 0xd005
movl $0x3f, %eax
cmpl $0x281, %ecx            # imm = 0x281
jae 0xd34b
movl %eax, 0x20b791(%rip)    # 0x21879c
movl %eax, %ecx
movl $0x12, 0x20b789(%rip)   # 0x2187a0
movl %ecx, 0x20b787(%rip)    # 0x2187a4
movl $0x140, %eax            # imm = 0x140
movl %eax, 0x32e270(%rip)    # 0x33b298
movl %eax, 0x32e35e(%rip)    # 0x33b38c
movl $0x1, 0x231f08(%rip)    # 0x23ef40
movl $0x0, 0x20b83e(%rip)    # 0x218880
callq 0x129fe
cmpl $0x0, 0x20b7da(%rip)    # 0x218828
je 0xd06e
movl 0x20b7ae(%rip), %eax    # 0x218804
movl %eax, 0x20b7d0(%rip)    # 0x21882c
movl 0x20b79e(%rip), %ecx    # 0x218800
movl %ecx, 0x20b79c(%rip)    # 0x218804
movl %eax, 0x20b792(%rip)    # 0x218800
cmpb $0x50, 0x2ff733(%rip)   # 0x30c7a8
jne 0xd0b4
cmpl $0x0, 0x2164ce(%rip)    # 0x22354c
jne 0xd15c
movl 0x20b776(%rip), %ecx    # 0x218800
movl 0x20b784(%rip), %edx    # 0x218814
leal (,%rdx,8), %eax
shll $0x2, %edx
cmpl 0x20b764(%rip), %ecx    # 0x218804
leal (%rdx,%rdx,2), %edx
cmovll %edx, %eax
cmpl $0x1c2, %ecx            # imm = 0x1C2
cmovll %edx, %eax
jmp 0xd151
cmpb $0x0, 0x231e83(%rip)    # 0x23ef3e
je 0xd0e9
cmpl $0x0, 0x216488(%rip)    # 0x22354c
jne 0xd15c
cmpb $0x0, 0x20e314(%rip)    # 0x21b3e5
jne 0xd15c
movl 0x20b78f(%rip), %ecx    # 0x21886c
addl %ecx, %ecx
movl 0x20b797(%rip), %eax    # 0x21887c
subl %ecx, %eax
jmp 0xd151
cmpb $0x0, 0x22fc4e(%rip)    # 0x23cd3e
jne 0xd15c
cmpl $0x259, 0x20b708(%rip)  # imm = 0x259
jl 0xd15c
movl 0x231e14(%rip), %eax    # 0x23ef18
cmpl $0x9, %eax
jl 0xd15c
cmpb $0x0, 0x20e2d5(%rip)    # 0x21b3e5
je 0xd15c
cmpl $0x0, 0x216433(%rip)    # 0x22354c
jne 0xd15c
cmpl $0x2, 0x2ff662(%rip)    # 0x30c784
jl 0xd12a
movl 0x2ff65e(%rip), %eax    # 0x30c788
addl $-0x8, %eax
imull 0x20b6e0(%rip), %eax    # 0x218814
movl 0x20b732(%rip), %ecx    # 0x21886c
leal (%rax,%rcx,2), %esi
addl %ecx, %ecx
leal -0x1(%rsi), %eax
cltd
idivl %ecx
movl 0x20b731(%rip), %eax    # 0x21887c
subl %edx, %eax
addl %esi, %eax
decl %eax
movl %eax, 0x20b725(%rip)    # 0x21887c
callq 0x11dc3
cmpb $0x0, 0x20e279(%rip)    # 0x21b3dc
movl 0x20b702(%rip), %r8d    # 0x21886c
movl %r8d, %eax
je 0xd175
movl 0x20b6fb(%rip), %eax    # 0x218870
movl %eax, 0x20b72d(%rip)    # 0x2188a8
cmpl $0x0, 0x332be6(%rip)    # 0x33fd68
movl 0x20b67c(%rip), %esi    # 0x218804
je 0xd19d
cmpl $0x0, 0x2163bb(%rip)    # 0x22354c
jne 0xd19d
movl %esi, 0x20b6e3(%rip)    # 0x21887c
movl %esi, %edi
jmp 0xd1a3
movl 0x20b6d9(%rip), %edi    # 0x21887c
movl %esi, %ecx
subl %edi, %ecx
addl %r8d, %r8d
movl %ecx, %eax
cltd
idivl %r8d
subl %edx, %ecx
movl %ecx, 0x20b6d0(%rip)    # 0x218888
movl %ecx, %eax
sarl %eax
decl %eax
movl %eax, 0x20b6d0(%rip)    # 0x218894
addl %edi, %ecx
cmpl %esi, %ecx
jge 0xd1d4
addl %esi, %edi
subl %ecx, %edi
movl %edi, 0x20b6a8(%rip)    # 0x21887c
movl 0x20b626(%rip), %ecx    # 0x218800
movl 0x20b694(%rip), %esi    # 0x218874
movl %ecx, %eax
cltd
idivl %esi
movl %ecx, %eax
subl %edx, %eax
movl %eax, 0x20b695(%rip)    # 0x218884
movl 0x20b6a7(%rip), %eax    # 0x21889c
testl %eax, %eax
je 0xd224
imull %esi, %eax
movl %eax, 0x20b682(%rip)    # 0x218884
cmpb $0x0, 0x20e18b(%rip)    # 0x21b394
je 0xd224
movl $0xe10, %eax            # imm = 0xE10
xorl %edx, %edx
idivl %esi
cltq
movq %rax, 0x20e17b(%rip)    # 0x21b398
movb $0x0, 0x20e170(%rip)    # 0x21b394
addl %esi, %esi
cmpb $0x0, 0x20e19b(%rip)    # 0x21b3c8
movl $0x1, %eax
cmovel %esi, %eax
movl %eax, 0x20b65d(%rip)    # 0x218898
cmpb $0x0, 0x32e094(%rip)    # 0x33b2d6
setne %dl
movb 0x32e065(%rip), %al     # 0x33b2b0
testb %al, %al
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0xd27c
movb 0x20e1b5(%rip), %dl     # 0x21b415
orb 0x20e1ad(%rip), %dl     # 0x21b413
setne %dl
cmpl $0x68f, %ecx            # imm = 0x68F
jg 0xd27c
testb %dl, %dl
je 0xd27c
movb $0x1, 0x32e16c(%rip)    # 0x33b3e8
testb %al, %al
setne %al
cmpb $0x0, 0x22fab6(%rip)    # 0x23cd3e
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd299
movb $0x1, 0x32e14f(%rip)    # 0x33b3e8
callq 0x12996
callq 0x11f3f
callq 0x12697
callq 0x11c83
callq 0x124df
movl 0x20b5b4(%rip), %eax    # 0x21886c
addl %eax, %eax
movl $0x1e0, %ecx            # imm = 0x1E0
addl %ecx, %eax
cmpl %eax, 0x20b5b5(%rip)    # 0x21887c
setge 0x20b562(%rip)          # 0x218830
cmpl %ecx, 0x20b530(%rip)    # 0x218804
jg 0xd325
movq 0x20b5f3(%rip), %rax    # 0x2188d0
cmpq $0xfffff, %rax          # imm = 0xFFFFF
jg 0xd2f3
cmpq $0x8, %rax
je 0xd325
cmpq $0x10, %rax
je 0xd325
jmp 0xd303
cmpq $0x100000, %rax         # imm = 0x100000
je 0xd325
cmpq $0x200000, %rax         # imm = 0x200000
je 0xd325
cmpl $0x0, 0x2ff952(%rip)    # 0x30cc5c
jne 0xd325
cmpl $0x0, 0x2ff941(%rip)    # 0x30cc54
jne 0xd325
cmpb $0x0, 0x20e104(%rip)    # 0x21b420
jne 0xd325
movb $0x0, 0x216213(%rip)    # 0x223538
movb $0x1, 0x20e0ac(%rip)    # 0x21b3d8
cmpl $0x0, 0x20b515(%rip)    # 0x218848
jne 0xd33b
movl %ebx, 0x20b509(%rip)    # 0x218844
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xd8ba5
imull $0x31a, 0x2161ef(%rip), %edx # imm = 0x31A
movslq %edx, %rdx
imulq $0x51eb851f, %rdx, %rdx # imm = 0x51EB851F
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x25, %rdx
addl %esi, %edx
cmpl $0x1e0, 0x20b48e(%rip)  # imm = 0x1E0
jg 0xd397
leal -0x14(%rdx), %esi
cmpl %esi, %ecx
setle %sil
leal 0x6(%rdx), %edi
cmpl %edi, %ecx
setg %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0xd005
cmpl %edx, %ecx
jle 0xcfda
movl $0x41, %ecx
cmpb $0x1, 0x20b4ae(%rip)    # 0x218859
movl $0x40, %eax
jne 0xd00d
jmp 0xd005