// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: find_mouse_lla()
int find_mouse_lla()
{
int map_r;
int x,y;

   // set mouse_lat and mouse_lon variables to the lat/lon in the scattergram
   // where the mouse cursor is located.  Returns true is mouse values are
   // valid.

   mouse_lat = mouse_lon = 0.0;
   if(autoscale_lla == 0) return 0;
   if(have_valid_lla == 0) return 0;
   
   map_r = LLA_SIZE / 2;
   if(mouse_x < LLA_X-map_r) return 0;
   if(mouse_x > LLA_X+map_r) return 0;
   if(mouse_y < LLA_Y-map_r) return 0;
   if(mouse_y > LLA_Y+map_r) return 0;

   x = mouse_x - LLA_X;
   y = LLA_Y - mouse_y;

   if(cos_factor == 0.0) cos_factor = 0.001;
   mouse_lat = (ref_lat*RAD_TO_DEG) + ( (((double) y) / (double) LLA_SIZE) * ref_lat_span ); 
   mouse_lon = (ref_lon*RAD_TO_DEG) + ( (((double) x) / (double) LLA_SIZE) * (ref_lon_span / cos_factor));
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorps %xmm0, %xmm0
movsd %xmm0, 0x358979(%rip)   # 0x4b3488
xorps %xmm0, %xmm0
movsd %xmm0, 0x358966(%rip)   # 0x4b3480
leaq 0x23f973(%rip), %rax    # 0x39a494
cmpl $0x0, (%rax)
jne 0x15ab32
movl $0x0, -0x4(%rbp)
jmp 0x15ad8f
leaq 0x21196b(%rip), %rax    # 0x36c4a4
cmpl $0x0, (%rax)
jne 0x15ab4a
movl $0x0, -0x4(%rbp)
jmp 0x15ad8f
leaq 0x23f927(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x8(%rbp)
leaq 0x11f8bb(%rip), %rax    # 0x27a420
movl (%rax), %eax
movl %eax, -0x14(%rbp)
leaq 0x23f91b(%rip), %rax    # 0x39a48c
movl (%rax), %ecx
leaq 0x23f8fe(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x14(%rbp), %eax
addl %edx, %ecx
subl $0x1, %ecx
subl -0x8(%rbp), %ecx
cmpl %ecx, %eax
jge 0x15aba1
movl $0x0, -0x4(%rbp)
jmp 0x15ad8f
leaq 0x11f878(%rip), %rax    # 0x27a420
movl (%rax), %eax
movl %eax, -0x18(%rbp)
leaq 0x23f8d8(%rip), %rax    # 0x39a48c
movl (%rax), %ecx
leaq 0x23f8bb(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x18(%rbp), %eax
addl %edx, %ecx
subl $0x1, %ecx
addl -0x8(%rbp), %ecx
cmpl %ecx, %eax
jle 0x15abe4
movl $0x0, -0x4(%rbp)
jmp 0x15ad8f
leaq 0x11f839(%rip), %rax    # 0x27a424
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
leaq 0x23f891(%rip), %rax    # 0x39a488
movl (%rax), %ecx
leaq 0x23f878(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x1c(%rbp), %eax
addl %edx, %ecx
subl $0x1, %ecx
subl -0x8(%rbp), %ecx
cmpl %ecx, %eax
jge 0x15ac27
movl $0x0, -0x4(%rbp)
jmp 0x15ad8f
leaq 0x11f7f6(%rip), %rax    # 0x27a424
movl (%rax), %eax
movl %eax, -0x20(%rbp)
leaq 0x23f84e(%rip), %rax    # 0x39a488
movl (%rax), %ecx
leaq 0x23f835(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x20(%rbp), %eax
addl %edx, %ecx
subl $0x1, %ecx
addl -0x8(%rbp), %ecx
cmpl %ecx, %eax
jle 0x15ac6a
movl $0x0, -0x4(%rbp)
jmp 0x15ad8f
leaq 0x11f7af(%rip), %rax    # 0x27a420
movl (%rax), %eax
movl %eax, -0x28(%rbp)
leaq 0x23f80f(%rip), %rax    # 0x39a48c
movl (%rax), %ecx
leaq 0x23f7f2(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x28(%rbp), %eax
addl %edx, %ecx
subl $0x1, %ecx
subl %ecx, %eax
movl %eax, -0xc(%rbp)
leaq 0x23f7e2(%rip), %rax    # 0x39a488
movl (%rax), %eax
movl %eax, -0x24(%rbp)
leaq 0x23f7c6(%rip), %rax    # 0x39a478
movl (%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x24(%rbp), %eax
addl %ecx, %eax
subl $0x1, %eax
leaq 0x11f757(%rip), %rcx    # 0x27a424
subl (%rcx), %eax
movl %eax, -0x10(%rbp)
leaq 0x2114cf(%rip), %rax    # 0x36c1a8
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x15acfb
jp 0x15acfb
leaq 0x2114b9(%rip), %rax    # 0x36c1a8
movsd 0x14499(%rip), %xmm0    # 0x16f190
movsd %xmm0, (%rax)
leaq 0x23f7ee(%rip), %rax    # 0x39a4f0
movsd (%rax), %xmm0
cvtsi2sdl -0x10(%rbp), %xmm1
leaq 0x23f766(%rip), %rax    # 0x39a478
cvtsi2sdl (%rax), %xmm2
divsd %xmm2, %xmm1
mulsd 0x35876e(%rip), %xmm1   # 0x4b3490
movsd 0x14456(%rip), %xmm2    # 0x16f180
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x358746(%rip)   # 0x4b3480
leaq 0x23f7b7(%rip), %rax    # 0x39a4f8
movsd (%rax), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
leaq 0x23f727(%rip), %rax    # 0x39a478
cvtsi2sdl (%rax), %xmm2
divsd %xmm2, %xmm1
movsd 0x358737(%rip), %xmm2   # 0x4b3498
leaq 0x211440(%rip), %rax    # 0x36c1a8
divsd (%rax), %xmm2
mulsd %xmm2, %xmm1
movsd 0x14408(%rip), %xmm2    # 0x16f180
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x358700(%rip)   # 0x4b3488
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)