// File: /workspace/github_cpp_makefile_star2_O3/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 0x30cc9b(%rip), %rbx    # 0x33c220
movq %rbx, %rdi
callq 0x9340
movq %rbx, %rdi
callq 0x9899
movq %rbx, %rdi
movl $0x41, %esi
callq 0x9100
movq %rax, %rbx
testq %rax, %rax
je 0x2f5c3
leaq 0x1ebe14(%rip), %rax    # 0x21b3c5
movb $0x1, (%rax)
leaq 0x1ebe05(%rip), %rax    # 0x21b3c0
movl $0x0, (%rax)
jmp 0x2f5e7
leaq 0x30cc56(%rip), %rdi    # 0x33c220
movl $0x54, %esi
callq 0x9100
testq %rax, %rax
je 0x2f671
leaq 0x1ebde1(%rip), %rax    # 0x21b3c5
movb $0x2, (%rax)
xorpd %xmm1, %xmm1
leaq 0x1ebda6(%rip), %rax    # 0x21b398
movq (%rax), %r14
testq %r14, %r14
je 0x2f63a
leaq 0x1ebd57(%rip), %rax    # 0x21b358
mulsd (%rax), %xmm1
movsd %xmm1, -0x18(%rbp)
leaq 0x30cc0f(%rip), %rdi    # 0x33c220
movl $0x57, %esi
callq 0x9100
testq %rax, %rax
je 0x2f649
movsd -0x18(%rbp), %xmm2
mulsd 0xd99eb(%rip), %xmm2    # 0x109018
mulsd 0xdc2d3(%rip), %xmm2    # 0x10b908
jmp 0x2f724
leaq 0x1ebd5f(%rip), %rax    # 0x21b3a0
movq (%rax), %rax
jmp 0x2f759
leaq 0x30cbd0(%rip), %rdi    # 0x33c220
movl $0x44, %esi
callq 0x9100
testq %rax, %rax
je 0x2f6a7
movsd -0x18(%rbp), %xmm2
mulsd 0xd99ac(%rip), %xmm2    # 0x109018
jmp 0x2f724
leaq 0x1ebd4d(%rip), %rax    # 0x21b3c5
movb $0x0, (%rax)
leaq 0x1ebd3e(%rip), %rax    # 0x21b3c0
movl $0x0, (%rax)
leaq 0x30cb91(%rip), %rdi    # 0x33c220
callq 0x9470
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2f6cc
subsd %xmm0, %xmm1
jmp 0x2f5eb
leaq 0x30cb72(%rip), %rdi    # 0x33c220
movl $0x48, %esi
callq 0x9100
testq %rax, %rax
je 0x2f6fd
movsd -0x18(%rbp), %xmm2
mulsd 0xd9946(%rip), %xmm2    # 0x109010
jmp 0x2f724
ucomisd %xmm1, %xmm0
jne 0x2f791
jp 0x2f791
leaq 0x1ebcd5(%rip), %rax    # 0x21b3b8
movq $0x0, (%rax)
leaq 0x1ebcaf(%rip), %rax    # 0x21b3a0
movq $0x1, (%rax)
jmp 0x2f786
leaq 0x30cb1c(%rip), %rdi    # 0x33c220
movl $0x4d, %esi
callq 0x9100
testq %rax, %rax
je 0x2f79a
movsd -0x18(%rbp), %xmm2
mulsd 0xd98e4(%rip), %xmm2    # 0x109008
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
leaq 0x1e9151(%rip), %rax    # 0x218884
xorps %xmm1, %xmm1
cvtsi2sdl (%rax), %xmm1
divsd %xmm0, %xmm2
divsd %xmm1, %xmm2
addsd 0xd991e(%rip), %xmm2    # 0x109068
cvttsd2si %xmm2, %rax
leaq 0x1ebc4a(%rip), %rcx    # 0x21b3a0
movq %rax, (%rcx)
cmpq $0x1, %rax
jg 0x2f772
leaq 0x1ebc3a(%rip), %rax    # 0x21b3a0
movq $0x1, (%rax)
movl $0x1, %eax
leaq 0x1ebc3f(%rip), %rcx    # 0x21b3b8
movq %rax, (%rcx)
leaq 0x1ebc41(%rip), %rax    # 0x21b3c4
movb $0x1, (%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movapd %xmm0, %xmm1
jmp 0x2f5eb
leaq 0x30ca7f(%rip), %rdi    # 0x33c220
movl $0x53, %esi
callq 0x9100
testq %rax, %rax
je 0x2f7d0
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
leaq 0x1e90c5(%rip), %rax    # 0x218884
xorps %xmm1, %xmm1
cvtsi2sdl (%rax), %xmm1
movsd -0x18(%rbp), %xmm2
jmp 0x2f73a
leaq 0x30ca49(%rip), %rdi    # 0x33c220
movl $0x54, %esi
callq 0x9100
testq %rax, %rax
jne 0x2f7eb
testq %rbx, %rbx
je 0x2f7f7
movl $0x1, %edi
callq 0x2f4ed
jmp 0x2f786
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
movsd -0x18(%rbp), %xmm1
divsd %xmm0, %xmm1
mulsd 0xd97f8(%rip), %xmm1    # 0x109008
leaq 0x1e905d(%rip), %rax    # 0x218874
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
jmp 0x2f74f