// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: set_discipline_params(int)
void set_discipline_params(int save)
{
   if(read_only) return;
   if(luxor) return;

   if(rcvr_type == PRS_RCVR) {
      // !!!!!!! do something
      if(have_osc_params & PARAM_TC) {  // set time constant
         set_prs_pt((int) user_time_constant);
      }

      if(have_osc_params & PARAM_DAMP) {  // set damping factor
         set_prs_pf((int) user_damping_factor);
      }

      if(have_osc_params & PARAM_GAIN) {  // set gain factor
         set_prs_ga((int) user_damping_factor);
      }

      if(have_osc_params & PARAM_INITV) {  // set integrator factor
         set_prs_pi((int) user_initial_voltage);
      }
   }
   else if(rcvr_type == SRO_RCVR) {
      if(have_osc_params & PARAM_TC) {  // set time constant
         set_sro_tc((int) user_time_constant);
      }
   }
   else if(rcvr_type == STAR_RCVR) {
      if(have_osc_params & PARAM_TC) {
         sprintf(out, "TAU=%d;", (int) user_time_constant);
         queue_star_cmd(out, STAR_TAU_MSG);
         request_rcvr_config(4565);
      }
   }
   else if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) return;
      if(ACU_360) return;
      if(ACUTIME) return;
      if(PALISADE) return;
      if(SV6_FAMILY) return;

      if(have_osc_params & (PARAM_TC | PARAM_DAMP)) { 
         send_tsip_start(0x8E);
         send_byte(0xA8);
         send_byte(0x00);
         send_single((float) user_time_constant);
         send_single((float) user_damping_factor);
         send_tsip_end();
      }

      if(have_osc_params & (PARAM_GAIN | PARAM_MINV | PARAM_MAXV)) { 
         send_tsip_start(0x8E);
         send_byte(0xA8);
         send_byte(0x01);
         send_single((float) user_osc_gain);
         send_single((float) user_min_volts);
         send_single((float) user_max_volts);
         send_tsip_end();
      }

      if(have_osc_params & (PARAM_JAMSYNC | PARAM_MAXFREQ)) { 
         send_tsip_start(0x8E);
         send_byte(0xA8);
         send_byte(0x02);
         send_single((float) user_jam_sync);
         send_single((float) user_max_freq_offset);
         send_tsip_end();
      }

      if(have_osc_params & PARAM_INITV) { 
         send_tsip_start(0x8E);
         send_byte(0xA8);
         send_byte(0x03);
         send_single((float) user_initial_voltage);
         send_tsip_end();
      }

      if(have_osc_params & (PARAM_MINRANGE | PARAM_MAXRANGE)) { // !!!! undocumented - allowable dac range
         send_tsip_start(0x8E);
         send_byte(0xA8);
         send_byte(0x04);
         send_single((float) user_min_range);
         send_single((float) user_max_range);
         send_tsip_end();
      }

      if(save) {
         if((have_osc_params & PARAM_TBOLT) == PARAM_TBOLT) {  // !!!!! 0x0F: we have all osc params available
            save_segment(9, 25);
         }
         else if(saw_ntpx && ((have_osc_params & PARAM_NTPX) == PARAM_NTPX)) {
            save_segment(9, 26);
         }
      }
   }
   else if(rcvr_type == UCCM_RCVR) {
      if(have_osc_params & PARAM_PULLIN) {
         set_pullin_range(user_pullin);
      }
   }
   else if(rcvr_type == X72_RCVR) {
      if(have_osc_params & PARAM_MAXFREQ) {  // used to set DDS tuning word
         set_x72_dds(user_max_freq_offset);
      }

      if(have_osc_params & PARAM_JAMSYNC) {  // set time constant
         set_x72_jamthresh(user_jam_sync);
      }

      if(have_osc_params & PARAM_TC) {  // set time constant
         set_x72_tc((int) user_time_constant);
      }

      if(have_osc_params & PARAM_DAMP) {  // set damping factor
         set_x72_damping(user_damping_factor);
      }

      if(have_osc_params & PARAM_HOLDOVER) {  // set holdover analysis time
         set_x72_holdover(user_holdover_time);
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2c669d(%rip), %rax    # 0x33701a
leaq 0x1ce5ba(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
je 0x7098f
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1a7f3a(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0xffffff, %rax         # imm = 0xFFFFFF
jg 0x70a07
cmpq $0x1, %rax
je 0x70a8e
cmpq $0x8, %rax
je 0x70cec
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x7098a
leaq 0x29d438(%rip), %rax    # 0x30ddfc
testb $0x1, (%rax)
je 0x7098a
leaq 0x29c7a8(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edx
leaq 0x2cb845(%rip), %rbx    # 0x33c220
leaq 0xb0e93(%rip), %rsi     # 0x121875
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x5ee52
movl $0x11d5, %edi           # imm = 0x11D5
popq %rbx
popq %r14
popq %rbp
jmp 0x66617
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x70cc8
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0x70d0f
cmpq $0x1000000, %rax        # imm = 0x1000000
jne 0x7098a
leaq 0x29d3ca(%rip), %rbx    # 0x30ddfc
testb $0x1, (%rbx)
je 0x70a47
leaq 0x29c73a(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edi
callq 0x70d88
testb $0x2, (%rbx)
je 0x70a5c
leaq 0x29c72d(%rip), %rax    # 0x30d180
cvttsd2si (%rax), %edi
callq 0x70dd9
testb $0x4, (%rbx)
je 0x70a71
leaq 0x29c718(%rip), %rax    # 0x30d180
cvttsd2si (%rax), %edi
callq 0x70e2a
testb $0x8, (%rbx)
je 0x7098a
leaq 0x29c73f(%rip), %rax    # 0x30d1c0
cvttsd2si (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x70e7b
movl %edi, %ebx
leaq 0x1aa53d(%rip), %rcx    # 0x21afd4
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x41, %esi
leaq 0x1a7e53(%rip), %rdx    # 0x2188f8
movl (%rdx), %edx
movl %edx, %edi
xorl $0x47, %edi
orl %esi, %edi
je 0x7098a
cmpl $0x41, %ecx
jne 0x70acb
cmpl $0x33, %edx
je 0x7098a
cmpl $0x47, %edx
je 0x7098a
cmpl $0x41, %ecx
sete %dl
cmpl $0x50, %ecx
sete %sil
cmpq $0x1, %rax
jne 0x70ae7
orb %sil, %dl
jne 0x7098a
cmpq $0x1, %rax
jne 0x70b03
addl $-0x33, %ecx
cmpl $0x1d, %ecx
ja 0x70b03
movl $0x20004009, %eax       # imm = 0x20004009
btl %ecx, %eax
jb 0x7098a
leaq 0x29d2f2(%rip), %r14    # 0x30ddfc
testb $0x3, (%r14)
je 0x70b53
movl $0x8e, %edi
callq 0x5e740
movl $0xa8, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
leaq 0x29c646(%rip), %rax    # 0x30d178
cvtsd2ss (%rax), %xmm0
callq 0x59440
leaq 0x29c63e(%rip), %rax    # 0x30d180
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
callq 0x5e7c0
testb $0x34, (%r14)
je 0x70bb5
movl $0x8e, %edi
callq 0x5e740
movl $0xa8, %edi
callq 0x591af
movl $0x1, %edi
callq 0x591af
leaq 0x29c60a(%rip), %rax    # 0x30d188
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
leaq 0x29c5ff(%rip), %rax    # 0x30d190
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
leaq 0x29c5f4(%rip), %rax    # 0x30d198
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
callq 0x5e7c0
testb $0x6, 0x1(%r14)
je 0x70c05
movl $0x8e, %edi
callq 0x5e740
movl $0xa8, %edi
callq 0x591af
movl $0x2, %edi
callq 0x591af
leaq 0x29c5cf(%rip), %rax    # 0x30d1b0
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
leaq 0x29c5c4(%rip), %rax    # 0x30d1b8
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
callq 0x5e7c0
testb $0x8, (%r14)
je 0x70c41
movl $0x8e, %edi
callq 0x5e740
movl $0xa8, %edi
callq 0x591af
movl $0x3, %edi
callq 0x591af
leaq 0x29c590(%rip), %rax    # 0x30d1c0
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
callq 0x5e7c0
testb $0x18, 0x1(%r14)
je 0x70c91
movl $0x8e, %edi
callq 0x5e740
movl $0xa8, %edi
callq 0x591af
movl $0x4, %edi
callq 0x591af
leaq 0x29c533(%rip), %rax    # 0x30d1a0
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
leaq 0x29c528(%rip), %rax    # 0x30d1a8
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59440
callq 0x5e7c0
testl %ebx, %ebx
je 0x7098a
movl (%r14), %eax
notl %eax
testb $0x3f, %al
je 0x70cba
testb $0x37, %al
jne 0x7098a
leaq 0x1ce28b(%rip), %rax    # 0x23ef3c
cmpb $0x0, (%rax)
je 0x7098a
movl $0x9, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x6a306
leaq 0x29d12d(%rip), %rax    # 0x30ddfc
testb $0x1, (%rax)
je 0x7098a
leaq 0x29c499(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x70ecc
leaq 0x29d109(%rip), %rax    # 0x30ddfc
testb $0x1, 0x1(%rax)
je 0x7098a
leaq 0x29c4c8(%rip), %rax    # 0x30d1cc
movl (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x708fc
leaq 0x29d0e6(%rip), %rbx    # 0x30ddfc
testb $0x4, 0x1(%rbx)
je 0x70d2c
leaq 0x29c495(%rip), %rax    # 0x30d1b8
movsd (%rax), %xmm0
callq 0x70f27
testb $0x2, 0x1(%rbx)
je 0x70d42
leaq 0x29c477(%rip), %rax    # 0x30d1b0
movsd (%rax), %xmm0
callq 0x7106a
testb $0x1, (%rbx)
je 0x70d57
leaq 0x29c42a(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edi
callq 0x710f5
testb $0x2, (%rbx)
je 0x70d6c
leaq 0x29c41d(%rip), %rax    # 0x30d180
movsd (%rax), %xmm0
callq 0x711d8
testb $0x20, 0x1(%rbx)
je 0x7098a
leaq 0x29c44b(%rip), %rax    # 0x30d1c8
movl (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x71276