// File: jkingan[P]ladyheather/heathui.cpp
// Function: edit_user_view(char*)
int edit_user_view(char *s)
{
DATA_SIZE val;

   // process the new plot view time setting
   val = 0.0;
   strcpy(out, s);
   strupr(out);
   if(strstr(out, "A")) {   // view ALL data
      view_all_data = 1;
      need_view_auto = 0;
   }
   else if(strstr(out, "T")) {   // view ALL data, auto scroll
      view_all_data = 2;
//    need_view_auto = 0;
   }
   else {                   // view a subset of the data
      view_all_data = 0;
      need_view_auto = 0;
      val = (DATA_SIZE) atof(out);
      if(val < 0.0) {
         val = (DATA_SIZE) 0.0 - val;
      }
      else if(val == 0.0) {
         user_view = 0L;
         view_interval = 1L;
         return 0;
      }
   }
   val *= nav_rate;

   if(queue_interval == 0) ;
   else if(strstr(out, "W")) {
      view_interval = (long) ((((val * (DATA_SIZE) (24.0*60.0*60.0)*7.0) / (DATA_SIZE) queue_interval) / PLOT_WIDTH) + (DATA_SIZE) 0.5);
   }
   else if(strstr(out, "D")) {
      view_interval = (long) ((((val * (DATA_SIZE) (24.0*60.0*60.0)) / (DATA_SIZE) queue_interval) / PLOT_WIDTH) + (DATA_SIZE) 0.5);
   }
   else if(strstr(out, "H")) {
      view_interval = (long) ((((val * (DATA_SIZE) (60.0*60.0)) / (DATA_SIZE) queue_interval) / PLOT_WIDTH) + (DATA_SIZE) 0.5);
   }
   else if(strstr(out, "M")) {
      view_interval = (long) ((((val * (DATA_SIZE) 60.0) / (DATA_SIZE) queue_interval) / PLOT_WIDTH) + (DATA_SIZE) 0.5);
   }
   else if(strstr(out, "S")) {
      view_interval = (long) (((val / (DATA_SIZE) queue_interval) / PLOT_WIDTH) + (DATA_SIZE) 0.5);
   }
   else if(strstr(out, "T")) {
      view_all(1);
      return 0;
   }
   else if(strstr(out, "A")) {
      view_all(1);
      return 0;
   }
   else if(queue_interval) {  // interval set in minutes per division
      val /= (DATA_SIZE) queue_interval;
      val *= (DATA_SIZE) 60.0;                   // seconds/division
      val /= (DATA_SIZE) HORIZ_MAJOR;
      view_interval = (long) val;
   }

   if(view_interval <= 1L) view_interval = 1L;
   user_view = view_interval;
   new_user_view = 1;

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x358cf1(%rip), %rdi    # 0x39b400
callq 0x9350
leaq 0x358ce5(%rip), %rdi    # 0x39b400
callq 0x9890
leaq 0x358cd9(%rip), %rdi    # 0x39b400
leaq 0x142f17(%rip), %rsi    # 0x185645
callq 0x9090
cmpq $0x0, %rax
je 0x42755
leaq 0x237e65(%rip), %rax    # 0x27a5a5
movb $0x1, (%rax)
leaq 0x237e56(%rip), %rax    # 0x27a5a0
movl $0x0, (%rax)
jmp 0x427f9
leaq 0x358ca4(%rip), %rdi    # 0x39b400
leaq 0x12f8eb(%rip), %rsi    # 0x17204e
callq 0x9090
cmpq $0x0, %rax
je 0x4277a
leaq 0x237e30(%rip), %rax    # 0x27a5a5
movb $0x2, (%rax)
jmp 0x427f7
leaq 0x237e24(%rip), %rax    # 0x27a5a5
movb $0x0, (%rax)
leaq 0x237e15(%rip), %rax    # 0x27a5a0
movl $0x0, (%rax)
leaq 0x358c68(%rip), %rdi    # 0x39b400
callq 0x9480
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x427bb
xorps %xmm0, %xmm0
subsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x427f5
movsd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x427f3
jp 0x427f3
leaq 0x237dc6(%rip), %rax    # 0x27a598
movq $0x0, (%rax)
leaq 0x237da0(%rip), %rax    # 0x27a580
movq $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x42b2d
jmp 0x427f5
jmp 0x427f7
jmp 0x427f9
leaq 0x237d38(%rip), %rax    # 0x27a538
movsd (%rax), %xmm0
mulsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x237d63(%rip), %rax    # 0x27a578
cmpq $0x0, (%rax)
jne 0x42820
jmp 0x42aed
leaq 0x358bd9(%rip), %rdi    # 0x39b400
leaq 0x14346e(%rip), %rsi    # 0x185c9c
callq 0x9090
cmpq $0x0, %rax
je 0x42891
movsd 0x12c7c7(%rip), %xmm0   # 0x16f008
mulsd -0x18(%rbp), %xmm0
movsd 0x12ee3a(%rip), %xmm1   # 0x171688
mulsd %xmm1, %xmm0
leaq 0x237d1f(%rip), %rax    # 0x27a578
cvtsi2sdq (%rax), %xmm1
divsd %xmm1, %xmm0
leaq 0x2351fb(%rip), %rax    # 0x277a64
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x12c817(%rip), %xmm1   # 0x16f090
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
leaq 0x237cf7(%rip), %rax    # 0x27a580
movq %rcx, (%rax)
jmp 0x42aeb
leaq 0x358b68(%rip), %rdi    # 0x39b400
leaq 0x136bba(%rip), %rsi    # 0x179459
callq 0x9090
cmpq $0x0, %rax
je 0x428f6
movsd 0x12c756(%rip), %xmm0   # 0x16f008
mulsd -0x18(%rbp), %xmm0
leaq 0x237cba(%rip), %rax    # 0x27a578
cvtsi2sdq (%rax), %xmm1
divsd %xmm1, %xmm0
leaq 0x235196(%rip), %rax    # 0x277a64
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x12c7b2(%rip), %xmm1   # 0x16f090
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
leaq 0x237c92(%rip), %rax    # 0x27a580
movq %rcx, (%rax)
jmp 0x42ae9
leaq 0x358b03(%rip), %rdi    # 0x39b400
leaq 0x12ca45(%rip), %rsi    # 0x16f349
callq 0x9090
cmpq $0x0, %rax
je 0x4295b
movsd 0x12c6f9(%rip), %xmm0   # 0x16f010
mulsd -0x18(%rbp), %xmm0
leaq 0x237c55(%rip), %rax    # 0x27a578
cvtsi2sdq (%rax), %xmm1
divsd %xmm1, %xmm0
leaq 0x235131(%rip), %rax    # 0x277a64
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x12c74d(%rip), %xmm1   # 0x16f090
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
leaq 0x237c2d(%rip), %rax    # 0x27a580
movq %rcx, (%rax)
jmp 0x42ae7
leaq 0x358a9e(%rip), %rdi    # 0x39b400
leaq 0x13f27c(%rip), %rsi    # 0x181be5
callq 0x9090
cmpq $0x0, %rax
je 0x429c0
movsd 0x12c69c(%rip), %xmm0   # 0x16f018
mulsd -0x18(%rbp), %xmm0
leaq 0x237bf0(%rip), %rax    # 0x27a578
cvtsi2sdq (%rax), %xmm1
divsd %xmm1, %xmm0
leaq 0x2350cc(%rip), %rax    # 0x277a64
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x12c6e8(%rip), %xmm1   # 0x16f090
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
leaq 0x237bc8(%rip), %rax    # 0x27a580
movq %rcx, (%rax)
jmp 0x42ae5
leaq 0x358a39(%rip), %rdi    # 0x39b400
leaq 0x142ce7(%rip), %rsi    # 0x1856b5
callq 0x9090
cmpq $0x0, %rax
je 0x42a1d
movsd -0x18(%rbp), %xmm0
leaq 0x237b93(%rip), %rax    # 0x27a578
cvtsi2sdq (%rax), %xmm1
divsd %xmm1, %xmm0
leaq 0x23506f(%rip), %rax    # 0x277a64
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x12c68b(%rip), %xmm1   # 0x16f090
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
leaq 0x237b6b(%rip), %rax    # 0x27a580
movq %rcx, (%rax)
jmp 0x42ae3
leaq 0x3589dc(%rip), %rdi    # 0x39b400
leaq 0x12f623(%rip), %rsi    # 0x17204e
callq 0x9090
cmpq $0x0, %rax
je 0x42a4c
movl $0x1, %edi
callq 0x42620
movl $0x0, -0x4(%rbp)
jmp 0x42b2d
leaq 0x3589ad(%rip), %rdi    # 0x39b400
leaq 0x142beb(%rip), %rsi    # 0x185645
callq 0x9090
cmpq $0x0, %rax
je 0x42a7b
movl $0x1, %edi
callq 0x42620
movl $0x0, -0x4(%rbp)
jmp 0x42b2d
leaq 0x237af6(%rip), %rax    # 0x27a578
cmpq $0x0, (%rax)
je 0x42add
leaq 0x237ae9(%rip), %rax    # 0x27a578
cvtsi2sdq (%rax), %xmm1
movsd -0x18(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd 0x12c56e(%rip), %xmm0   # 0x16f018
mulsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
leaq 0x234f99(%rip), %rax    # 0x277a54
cvtsi2sdl (%rax), %xmm1
movsd -0x18(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
cvttsd2si -0x18(%rbp), %rcx
leaq 0x237aa6(%rip), %rax    # 0x27a580
movq %rcx, (%rax)
jmp 0x42adf
jmp 0x42ae1
jmp 0x42ae3
jmp 0x42ae5
jmp 0x42ae7
jmp 0x42ae9
jmp 0x42aeb
jmp 0x42aed
leaq 0x237a8c(%rip), %rax    # 0x27a580
cmpq $0x1, (%rax)
jg 0x42b08
leaq 0x237a7f(%rip), %rax    # 0x27a580
movq $0x1, (%rax)
leaq 0x237a71(%rip), %rax    # 0x27a580
movq (%rax), %rcx
leaq 0x237a7f(%rip), %rax    # 0x27a598
movq %rcx, (%rax)
leaq 0x237a81(%rip), %rax    # 0x27a5a4
movb $0x1, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)