// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rsi
leaq 0x2f9787(%rip), %rbx    # 0x326220
movq %rbx, %rdi
callq 0x9330
movq %rbx, %rdi
callq 0x988f
pushq $0x41
popq %rsi
movq %rbx, %rdi
callq 0x9100
movq %rax, %rbx
testq %rax, %rax
je 0x2cad2
leaq 0x1d8902(%rip), %rax    # 0x2053c5
movb $0x1, (%rax)
leaq 0x1d88f3(%rip), %rax    # 0x2053c0
andl $0x0, (%rax)
jmp 0x2caf4
leaq 0x2f9747(%rip), %rdi    # 0x326220
pushq $0x54
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x2cb7a
leaq 0x1d88d4(%rip), %rax    # 0x2053c5
movb $0x2, (%rax)
xorpd %xmm1, %xmm1
leaq 0x1d8899(%rip), %rax    # 0x205398
movq (%rax), %r14
testq %r14, %r14
je 0x2cb45
leaq 0x1d884a(%rip), %rax    # 0x205358
mulsd (%rax), %xmm1
movsd %xmm1, -0x18(%rbp)
leaq 0x2f9702(%rip), %rdi    # 0x326220
pushq $0x57
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x2cb54
movsd -0x18(%rbp), %xmm2
mulsd 0xc64e0(%rip), %xmm2    # 0xf3018
mulsd 0xc8e40(%rip), %xmm2    # 0xf5980
jmp 0x2cc1c
leaq 0x1d8854(%rip), %rax    # 0x2053a0
movq (%rax), %rax
jmp 0x2cc4b
leaq 0x2f96c5(%rip), %rdi    # 0x326220
pushq $0x44
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x2cbad
movsd -0x18(%rbp), %xmm2
mulsd 0xc64a3(%rip), %xmm2    # 0xf3018
jmp 0x2cc1c
leaq 0x1d8844(%rip), %rax    # 0x2053c5
movb $0x0, (%rax)
leaq 0x1d8835(%rip), %rax    # 0x2053c0
andl $0x0, (%rax)
leaq 0x2f968b(%rip), %rdi    # 0x326220
callq 0x9470
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2cbd0
subsd %xmm0, %xmm1
jmp 0x2caf8
leaq 0x2f966c(%rip), %rdi    # 0x326220
pushq $0x48
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x2cbfb
movsd -0x18(%rbp), %xmm2
mulsd 0xc6442(%rip), %xmm2    # 0xf3010
jmp 0x2cc1c
ucomisd %xmm1, %xmm0
jne 0x2cc81
jp 0x2cc81
leaq 0x1d87d1(%rip), %rax    # 0x2053b8
andq $0x0, (%rax)
leaq 0x1d87ae(%rip), %rax    # 0x2053a0
movq $0x1, (%rax)
jmp 0x2cc76
leaq 0x2f961e(%rip), %rdi    # 0x326220
pushq $0x4d
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x2cc8a
movsd -0x18(%rbp), %xmm2
mulsd 0xc63ec(%rip), %xmm2    # 0xf3008
cvtsi2sd %r14, %xmm0
leaq 0x1d5c5c(%rip), %rax    # 0x202884
cvtsi2sdl (%rax), %xmm1
divsd %xmm0, %xmm2
divsd %xmm1, %xmm2
addsd 0xc642c(%rip), %xmm2    # 0xf3068
cvttsd2si %xmm2, %rax
leaq 0x1d8758(%rip), %rcx    # 0x2053a0
movq %rax, (%rcx)
cmpq $0x1, %rax
jg 0x2cc62
leaq 0x1d8748(%rip), %rax    # 0x2053a0
movq $0x1, (%rax)
pushq $0x1
popq %rax
leaq 0x1d874f(%rip), %rcx    # 0x2053b8
movq %rax, (%rcx)
leaq 0x1d8751(%rip), %rax    # 0x2053c4
movb $0x1, (%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movapd %xmm0, %xmm1
jmp 0x2caf8
leaq 0x2f958f(%rip), %rdi    # 0x326220
pushq $0x53
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x2ccb8
cvtsi2sd %r14, %xmm0
leaq 0x1d5bda(%rip), %rax    # 0x202884
cvtsi2sdl (%rax), %xmm1
movsd -0x18(%rbp), %xmm2
jmp 0x2cc2c
leaq 0x2f9561(%rip), %rdi    # 0x326220
pushq $0x54
popq %rsi
callq 0x9100
testq %rax, %rax
jne 0x2ccd1
testq %rbx, %rbx
je 0x2ccdb
pushq $0x1
popq %rdi
callq 0x2ca0e
jmp 0x2cc76
cvtsi2sd %r14, %xmm0
movsd -0x18(%rbp), %xmm1
divsd %xmm0, %xmm1
mulsd 0xc6317(%rip), %xmm1    # 0xf3008
leaq 0x1d5b7c(%rip), %rax    # 0x202874
cvtsi2sdl (%rax), %xmm0
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
jmp 0x2cc41