// File: jkingan[P]ladyheather/heather.cpp
// Function: config_lla()
void config_lla()
{
int lla_margin;
int adev_flag;

   // how and where to draw the lat/lon/altitude map

   adev_flag = 1;
   if     (pps_adev_period > 0.0) ;        // aaaapppp
   else if(osc_adev_period > 0.0) ;
   else if(chc_adev_period > 0.0) ;
   else if(chd_adev_period > 0.0) ;
   else if(adev_period <= 0.0) adev_flag = 0;

   LLA_ROW  = (ADEV_ROW*TEXT_HEIGHT);  // on small screens the lla map takes the place of the adev tables
   LLA_COL  = (ADEV_COL*TEXT_WIDTH);
   lla_margin = 1;
   if(zoom_screen == 'L') {
      if(reading_lla) lla_margin = 20;
      LLA_ROW = lla_margin;
      LLA_COL = lla_margin;
   }
   else if(WIDE_SCREEN) {
      if(all_adevs) {
         if(plot_lla) LLA_COL = WATCH_COL + WATCH_SIZE;
         else         LLA_COL = SCREEN_WIDTH - AZEL_SIZE - (TEXT_WIDTH*2);
      }
      else if(shared_plot) {
         if(plot_watch && (plot_azel || plot_signals)) LLA_COL = WATCH_COL + WATCH_SIZE + (TEXT_WIDTH*2);
         else                                          LLA_COL = SCREEN_WIDTH - AZEL_SIZE - (TEXT_WIDTH*2);
      }
      else {
         LLA_COL = AZEL_COL + AZEL_SIZE + (TEXT_WIDTH*2);
      }
   }
   else if(all_adevs) {
      LLA_ROW = AZEL_ROW;
      LLA_COL = AZEL_COL;
   }
   else if(SCREEN_WIDTH > BIG_WIDTH) {  // both lla map and azel map will fit on big screens
      if(shared_plot) LLA_COL = SCREEN_WIDTH - AZEL_SIZE - (TEXT_WIDTH*2);
      else            LLA_COL = AZEL_COL + AZEL_SIZE + (TEXT_WIDTH*2);
   }
// else if(SCREEN_WIDTH >= WIDE_WIDTH) {
   else if((SCREEN_WIDTH >= WIDE_WIDTH) && adev_flag) {
      if(adevs_active(1)) LLA_COL += (TEXT_WIDTH*44); // adevs and lla will fit
      else                LLA_COL += (TEXT_WIDTH*12);
   }
   else if(SCREEN_WIDTH >= MEDIUM_WIDTH) {
      LLA_COL += (4*TEXT_WIDTH);
   }
   else if(SCREEN_WIDTH >= NARROW_SCREEN) {
      LLA_COL += (2*TEXT_WIDTH);
   }
   else if(0 && all_adevs) {
      LLA_COL = AZEL_COL + AZEL_SIZE + (TEXT_WIDTH*2);
   }
   else {  // undersized screens
      LLA_ROW = AZEL_ROW;
      LLA_COL = AZEL_COL;
   }

   if(zoom_screen == 'L') {
      if((SCREEN_WIDTH < TINY_TINY_WIDTH) || (SCREEN_WIDTH < SCREEN_HEIGHT)) {  //piss
         LLA_SIZE = (SCREEN_WIDTH-LLA_ROW-TEXT_HEIGHT*4-lla_margin);
      }
      else {
         LLA_SIZE = (SCREEN_HEIGHT-LLA_ROW-TEXT_HEIGHT*4-lla_margin);
      }
   }
   else {
      LLA_SIZE = (SCREEN_WIDTH-LLA_COL);
      if(SCREEN_WIDTH >= NARROW_SCREEN) { // lla map maight be in the plot area
         if(all_adevs) ;
         else if((LLA_ROW+LLA_SIZE) >= (PLOT_ROW-128)) LLA_SIZE = (PLOT_ROW-LLA_ROW-128);
      }
   }
//sprintf(debug_text3, "share:%d  LLA: %d,%d,%d  XY=%d,%d  AZEL:%d,%d %d  WSIZE:%d  ADEV:%d,%d  SCRW:%d",
//shared_plot, LLA_COL,LLA_ROW,LLA_SIZE,  LLA_X,LLA_Y, AZEL_COL,AZEL_ROW,AZEL_SIZE, WATCH_SIZE, ADEV_COL,ADEV_ROW, SCREEN_WIDTH);

   if(LLA_SIZE > MAX_LLA_SIZE) LLA_SIZE = MAX_LLA_SIZE;
   LLA_MARGIN = 10;              // border width in pixels
   LLA_SIZE -= (LLA_MARGIN*2);   // tweek size so it matches the grid
   LLA_SIZE /= LLA_DIVISIONS;    // round size to a multiple of the grid size
   LLA_SIZE *= LLA_DIVISIONS;
   lla_step = LLA_SIZE / LLA_DIVISIONS;  // pixels per grid division
   lla_width = lla_step * LLA_DIVISIONS;
   if(lla_width > MAX_LLA_SIZE) lla_width = MAX_LLA_SIZE;
   LLA_SIZE += (LLA_MARGIN*2);   // add a margin around the lla circles
   if(LLA_SIZE > MAX_LLA_SIZE) LLA_SIZE = MAX_LLA_SIZE;
   if(zoom_screen == 'L') {
      LLA_COL = (SCREEN_WIDTH - LLA_SIZE) / 2;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x1, -0x8(%rbp)
movsd 0x284d19(%rip), %xmm0   # 0x29bee0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x171d2
jmp 0x17227
movsd 0x284d0e(%rip), %xmm0   # 0x29bee8
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x171e5
jmp 0x17225
movsd 0x284d03(%rip), %xmm0   # 0x29bef0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x171f8
jmp 0x17223
movsd 0x284cf8(%rip), %xmm0   # 0x29bef8
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1720b
jmp 0x17221
xorps %xmm0, %xmm0
ucomisd 0x284cc2(%rip), %xmm0   # 0x29bed8
jb 0x1721f
movl $0x0, -0x8(%rbp)
jmp 0x17221
jmp 0x17223
jmp 0x17225
jmp 0x17227
imull $0x0, 0x2607c6(%rip), %eax # 0x2779f4
movl %eax, 0x383254(%rip)    # 0x39a488
imull $0x4f, 0x2607b5(%rip), %eax # 0x2779f0
movl %eax, 0x38324b(%rip)    # 0x39a48c
movl $0x1, -0x4(%rbp)
movzbl 0x354739(%rip), %eax    # 0x36b988
cmpl $0x4c, %eax
jne 0x1727b
cmpb $0x0, 0x38325c(%rip)    # 0x39a4b7
je 0x17264
movl $0x14, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, 0x38321b(%rip)    # 0x39a488
movl -0x4(%rbp), %eax
movl %eax, 0x383216(%rip)    # 0x39a48c
jmp 0x17498
cmpl $0x690, 0x26075b(%rip)  # imm = 0x690
jl 0x17352
cmpb $0x0, 0x284c8c(%rip)    # 0x29bf1e
je 0x172cf
cmpb $0x0, 0x3831f5(%rip)    # 0x39a490
je 0x172b1
movl 0x3832a5(%rip), %eax    # 0x39a548
addl 0x3832a3(%rip), %eax    # 0x39a54c
movl %eax, 0x3831dd(%rip)    # 0x39a48c
jmp 0x172cd
movl 0x260729(%rip), %eax    # 0x2779e0
subl 0x3832af(%rip), %eax    # 0x39a56c
movl 0x26072d(%rip), %ecx    # 0x2779f0
shll %ecx
subl %ecx, %eax
movl %eax, 0x3831bf(%rip)    # 0x39a48c
jmp 0x1734d
cmpb $0x0, 0x3832f2(%rip)    # 0x39a5c8
je 0x1732f
cmpb $0x0, 0x263309(%rip)    # 0x27a5e8
je 0x17311
cmpb $0x0, 0x26330b(%rip)    # 0x27a5f3
jne 0x172f3
cmpb $0x0, 0x263304(%rip)    # 0x27a5f5
je 0x17311
movl 0x38324f(%rip), %eax    # 0x39a548
addl 0x38324d(%rip), %eax    # 0x39a54c
movl 0x2606eb(%rip), %ecx    # 0x2779f0
shll %ecx
addl %ecx, %eax
movl %eax, 0x38317d(%rip)    # 0x39a48c
jmp 0x1732d
movl 0x2606c9(%rip), %eax    # 0x2779e0
subl 0x38324f(%rip), %eax    # 0x39a56c
movl 0x2606cd(%rip), %ecx    # 0x2779f0
shll %ecx
subl %ecx, %eax
movl %eax, 0x38315f(%rip)    # 0x39a48c
jmp 0x1734b
movl 0x38323f(%rip), %eax    # 0x39a574
addl 0x383231(%rip), %eax    # 0x39a56c
movl 0x2606af(%rip), %ecx    # 0x2779f0
shll %ecx
addl %ecx, %eax
movl %eax, 0x383141(%rip)    # 0x39a48c
jmp 0x1734d
jmp 0x17496
cmpb $0x0, 0x284bc5(%rip)    # 0x29bf1e
je 0x17378
movl 0x38320f(%rip), %eax    # 0x39a570
movl %eax, 0x383121(%rip)    # 0x39a488
movl 0x383207(%rip), %eax    # 0x39a574
movl %eax, 0x383119(%rip)    # 0x39a48c
jmp 0x17494
cmpl $0x59a, 0x26065e(%rip)  # imm = 0x59A
jle 0x173cc
cmpb $0x0, 0x38323d(%rip)    # 0x39a5c8
je 0x173ab
movl 0x26064d(%rip), %eax    # 0x2779e0
subl 0x3831d3(%rip), %eax    # 0x39a56c
movl 0x260651(%rip), %ecx    # 0x2779f0
shll %ecx
subl %ecx, %eax
movl %eax, 0x3830e3(%rip)    # 0x39a48c
jmp 0x173c7
movl 0x3831c3(%rip), %eax    # 0x39a574
addl 0x3831b5(%rip), %eax    # 0x39a56c
movl 0x260633(%rip), %ecx    # 0x2779f0
shll %ecx
addl %ecx, %eax
movl %eax, 0x3830c5(%rip)    # 0x39a48c
jmp 0x17492
cmpl $0x4fa, 0x26060a(%rip)  # imm = 0x4FA
jl 0x17417
cmpl $0x0, -0x8(%rbp)
je 0x17417
movl $0x1, %edi
callq 0x127d80
cmpl $0x0, %eax
je 0x17402
imull $0x2c, 0x2605fc(%rip), %eax # 0x2779f0
addl 0x383092(%rip), %eax    # 0x39a48c
movl %eax, 0x38308c(%rip)    # 0x39a48c
jmp 0x17415
imull $0xc, 0x2605e7(%rip), %eax # 0x2779f0
addl 0x38307d(%rip), %eax    # 0x39a48c
movl %eax, 0x383077(%rip)    # 0x39a48c
jmp 0x17490
cmpl $0x3e2, 0x2605bf(%rip)  # imm = 0x3E2
jl 0x1743a
movl 0x2605c7(%rip), %eax    # 0x2779f0
shll $0x2, %eax
addl 0x38305a(%rip), %eax    # 0x39a48c
movl %eax, 0x383054(%rip)    # 0x39a48c
jmp 0x1748e
movl 0x2605a0(%rip), %eax    # 0x2779e0
movl %eax, -0xc(%rbp)
imull $0x31a, 0x26b2d7(%rip), %eax # imm = 0x31A
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xc(%rbp), %eax
cmpl %ecx, %eax
jl 0x17474
movl 0x26058c(%rip), %eax    # 0x2779f0
shll %eax
addl 0x383020(%rip), %eax    # 0x39a48c
movl %eax, 0x38301a(%rip)    # 0x39a48c
jmp 0x1748c
movl 0x3830f6(%rip), %eax    # 0x39a570
movl %eax, 0x383008(%rip)    # 0x39a488
movl 0x3830ee(%rip), %eax    # 0x39a574
movl %eax, 0x383000(%rip)    # 0x39a48c
jmp 0x1748e
jmp 0x17490
jmp 0x17492
jmp 0x17494
jmp 0x17496
jmp 0x17498
movzbl 0x3544e9(%rip), %eax    # 0x36b988
cmpl $0x4c, %eax
jne 0x17502
cmpl $0x1c2, 0x260532(%rip)  # imm = 0x1C2
jl 0x174be
movl 0x26052a(%rip), %eax    # 0x2779e0
cmpl 0x260528(%rip), %eax    # 0x2779e4
jge 0x174e0
movl 0x26051c(%rip), %eax    # 0x2779e0
subl 0x382fbe(%rip), %eax    # 0x39a488
movl 0x260524(%rip), %ecx    # 0x2779f4
shll $0x2, %ecx
subl %ecx, %eax
subl -0x4(%rbp), %eax
movl %eax, 0x382f9a(%rip)    # 0x39a478
jmp 0x17500
movl 0x2604fe(%rip), %eax    # 0x2779e4
subl 0x382f9c(%rip), %eax    # 0x39a488
movl 0x260502(%rip), %ecx    # 0x2779f4
shll $0x2, %ecx
subl %ecx, %eax
subl -0x4(%rbp), %eax
movl %eax, 0x382f78(%rip)    # 0x39a478
jmp 0x1757c
movl 0x2604d8(%rip), %eax    # 0x2779e0
subl 0x382f7e(%rip), %eax    # 0x39a48c
movl %eax, 0x382f64(%rip)    # 0x39a478
movl 0x2604c6(%rip), %eax    # 0x2779e0
movl %eax, -0x10(%rbp)
imull $0x31a, 0x26b1fd(%rip), %eax # imm = 0x31A
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x10(%rbp), %eax
cmpl %ecx, %eax
jl 0x1757a
cmpb $0x0, 0x2849df(%rip)    # 0x29bf1e
je 0x17543
jmp 0x17578
movl 0x382f3f(%rip), %eax    # 0x39a488
addl 0x382f29(%rip), %eax    # 0x39a478
movl 0x260507(%rip), %ecx    # 0x277a5c
subl $0x80, %ecx
cmpl %ecx, %eax
jl 0x17576
movl 0x2604f7(%rip), %eax    # 0x277a5c
subl 0x382f1d(%rip), %eax    # 0x39a488
subl $0x80, %eax
movl %eax, 0x382f02(%rip)    # 0x39a478
jmp 0x17578
jmp 0x1757a
jmp 0x1757c
cmpl $0x280, 0x382ef2(%rip)  # imm = 0x280
jle 0x17592
movl $0x280, 0x382ee6(%rip)  # imm = 0x280
movl $0xa, 0x382ee0(%rip)    # 0x39a47c
movl 0x382eda(%rip), %ecx    # 0x39a47c
shll %ecx
movl 0x382ece(%rip), %eax    # 0x39a478
subl %ecx, %eax
movl %eax, 0x382ec6(%rip)    # 0x39a478
movl 0x382ec0(%rip), %eax    # 0x39a478
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, 0x382eb2(%rip)    # 0x39a478
imull $0xa, 0x382eab(%rip), %eax # 0x39a478
movl %eax, 0x382ea5(%rip)    # 0x39a478
movl 0x382e9f(%rip), %eax    # 0x39a478
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, 0x382e99(%rip)    # 0x39a480
imull $0xa, 0x382e92(%rip), %eax # 0x39a480
movl %eax, 0x382e90(%rip)    # 0x39a484
cmpl $0x280, 0x382e86(%rip)  # imm = 0x280
jle 0x1760a
movl $0x280, 0x382e7a(%rip)  # imm = 0x280
movl 0x382e6c(%rip), %eax    # 0x39a47c
shll %eax
addl 0x382e60(%rip), %eax    # 0x39a478
movl %eax, 0x382e5a(%rip)    # 0x39a478
cmpl $0x280, 0x382e50(%rip)  # imm = 0x280
jle 0x17634
movl $0x280, 0x382e44(%rip)  # imm = 0x280
movzbl 0x35434d(%rip), %eax    # 0x36b988
cmpl $0x4c, %eax
jne 0x1765a
movl 0x26039a(%rip), %eax    # 0x2779e0
subl 0x382e2c(%rip), %eax    # 0x39a478
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x382e32(%rip)    # 0x39a48c
addq $0x10, %rsp
popq %rbp
retq