// File: jkingan[P]ladyheather/heathui.cpp
// Function: edit_cable_delay(int)
void edit_cable_delay(int kbd_cmd)
{
double val;
double vf;
char *s, *sf, *squote;

   if(edit_buffer[0] == 0) return;

   vf = VELOCITY_FACTOR;  // 0.66 vp coax
   strupr(edit_buffer);


   s = strchr(edit_buffer, 'V');  // look for velocity factor setting
   if(s) {
      vf = get_cable_val(s);
      if((vf <= 0.0) || (vf > 1.0)) {
         if(kbd_cmd) edit_error("Invalid velocity factor specified.");
         return;
      }
   }

   s = strchr(edit_buffer, 'M');  // look for meters
   sf = strchr(edit_buffer, 'F');
   squote = strchr(edit_buffer, '\'');
   if(s) {
      val = get_cable_val(s);
      val *= FEET_PER_METER;
      val = (val / 983571056.0) / vf;
   }
   else if(sf) {
      val = get_cable_val(sf);
      val = (val / 983571056.0) / vf;
   }
   else if(squote) {
      val = get_cable_val(squote);
      val = (val / 983571056.0) / vf;
   }
   else {
      val = atof(edit_buffer);
      val /= 1.0E9;
   }

   delay_value = val;

   if(kbd_cmd) {
      set_pps(user_pps_enable, pps_polarity,  delay_value,  pps1_delay, pps_threshold, 1);
      request_pps_info();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
leaq 0x355a3e(%rip), %rax    # 0x39e4c0
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x48a8f
jmp 0x48c7b
movsd 0x128c41(%rip), %xmm0   # 0x1716d8
movsd %xmm0, -0x18(%rbp)
leaq 0x355a1d(%rip), %rdi    # 0x39e4c0
callq 0x9890
leaq 0x355a11(%rip), %rdi    # 0x39e4c0
movl $0x56, %esi
callq 0x9100
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x48b08
movq -0x20(%rbp), %rdi
callq 0x489a0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x18(%rbp), %xmm0
jae 0x48aef
movsd -0x18(%rbp), %xmm0
movsd 0x12657f(%rip), %xmm1   # 0x16f068
ucomisd %xmm1, %xmm0
jbe 0x48b06
cmpl $0x0, -0x4(%rbp)
je 0x48b01
leaq 0x131518(%rip), %rdi    # 0x17a014
callq 0x30d60
jmp 0x48c7b
jmp 0x48b08
leaq 0x3559b1(%rip), %rdi    # 0x39e4c0
movl $0x4d, %esi
callq 0x9100
movq %rax, -0x20(%rbp)
leaq 0x35599c(%rip), %rdi    # 0x39e4c0
movl $0x46, %esi
callq 0x9100
movq %rax, -0x28(%rbp)
leaq 0x355987(%rip), %rdi    # 0x39e4c0
movl $0x27, %esi
callq 0x9100
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x48b8e
movq -0x20(%rbp), %rdi
callq 0x489a0
movsd %xmm0, -0x10(%rbp)
movsd 0x128acc(%rip), %xmm0   # 0x171630
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x128b65(%rip), %xmm1   # 0x1716e0
divsd %xmm1, %xmm0
divsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x48c1d
cmpq $0x0, -0x28(%rbp)
je 0x48bc0
movq -0x28(%rbp), %rdi
callq 0x489a0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x128b30(%rip), %xmm1   # 0x1716e0
divsd %xmm1, %xmm0
divsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x48c1b
cmpq $0x0, -0x30(%rbp)
je 0x48bf2
movq -0x30(%rbp), %rdi
callq 0x489a0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x128afe(%rip), %xmm1   # 0x1716e0
divsd %xmm1, %xmm0
divsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x48c19
leaq 0x3558c7(%rip), %rdi    # 0x39e4c0
callq 0x9480
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x126418(%rip), %xmm1   # 0x16f028
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x48c1b
jmp 0x48c1d
movsd -0x10(%rbp), %xmm0
leaq 0x324377(%rip), %rax    # 0x36cfa0
movsd %xmm0, (%rax)
cmpl $0x0, -0x4(%rbp)
je 0x48c7b
leaq 0x3242c7(%rip), %rax    # 0x36cf01
movb (%rax), %cl
leaq 0x3242b5(%rip), %rax    # 0x36cef8
movl (%rax), %eax
leaq 0x324354(%rip), %rdx    # 0x36cfa0
movsd (%rdx), %xmm0
leaq 0x324361(%rip), %rdx    # 0x36cfb8
movsd (%rdx), %xmm1
leaq 0x32429a(%rip), %rdx    # 0x36cefc
movss (%rdx), %xmm2
movl $0x1, %edx
movzbl %cl, %edi
movzbl %al, %esi
callq 0x91b20
callq 0x91720
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)