// File: /workspace/github_cpp_makefile_star2_O2/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 0x2b9dba(%rip), %rax    # 0x32101a
leaq 0x1c1cd7(%rip), %rcx    # 0x228f3e
movb (%rcx), %cl
orb (%rax), %cl
je 0x67272
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x19b657(%rip), %rax    # 0x2028d0
movq (%rax), %rax
cmpq $0x1, %rax
je 0x67439
cmpq $0x8, %rax
je 0x67416
cmpq $0x1000, %rax           # imm = 0x1000
je 0x67323
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x673f2
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0x67371
cmpq $0x1000000, %rax        # imm = 0x1000000
jne 0x6726d
leaq 0x290b39(%rip), %rbx    # 0x2f7dfc
movl (%rbx), %eax
testb $0x1, %al
je 0x672db
leaq 0x28fea8(%rip), %rax    # 0x2f7178
cvttsd2si (%rax), %edi
callq 0x67601
movl (%rbx), %eax
testb $0x2, %al
je 0x672f1
leaq 0x28fe9a(%rip), %rax    # 0x2f7180
cvttsd2si (%rax), %edi
callq 0x67652
movl (%rbx), %eax
testb $0x4, %al
je 0x67307
leaq 0x28fe84(%rip), %rax    # 0x2f7180
cvttsd2si (%rax), %edi
callq 0x676a3
movl (%rbx), %eax
testb $0x8, %al
je 0x6726d
leaq 0x28feaa(%rip), %rax    # 0x2f71c0
cvttsd2si (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x676f4
leaq 0x290ad2(%rip), %rax    # 0x2f7dfc
testb $0x1, (%rax)
je 0x6726d
leaq 0x28fe3e(%rip), %rax    # 0x2f7178
cvttsd2si (%rax), %edx
leaq 0x2beedb(%rip), %rbx    # 0x326220
leaq 0xa4551(%rip), %rsi     # 0x10b89d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x576d4
movl $0x11d5, %edi           # imm = 0x11D5
popq %rbx
popq %r14
popq %rbp
jmp 0x5e18e
leaq 0x290a84(%rip), %rbx    # 0x2f7dfc
movl (%rbx), %eax
btl $0xa, %eax
jae 0x67392
leaq 0x28fe31(%rip), %rax    # 0x2f71b8
movsd (%rax), %xmm0
callq 0x6779b
movl (%rbx), %eax
btl $0x9, %eax
jae 0x673aa
leaq 0x28fe11(%rip), %rax    # 0x2f71b0
movsd (%rax), %xmm0
callq 0x678da
movl (%rbx), %eax
testb $0x1, %al
je 0x673c0
leaq 0x28fdc3(%rip), %rax    # 0x2f7178
cvttsd2si (%rax), %edi
callq 0x67965
movl (%rbx), %eax
testb $0x2, %al
je 0x673d6
leaq 0x28fdb5(%rip), %rax    # 0x2f7180
movsd (%rax), %xmm0
callq 0x67a48
movl (%rbx), %eax
btl $0xd, %eax
jae 0x6726d
leaq 0x28fde1(%rip), %rax    # 0x2f71c8
movl (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x67ae4
leaq 0x290a03(%rip), %rax    # 0x2f7dfc
testb $0x1, (%rax)
je 0x6726d
leaq 0x28fd6f(%rip), %rax    # 0x2f7178
cvttsd2si (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x67745
leaq 0x2909df(%rip), %rax    # 0x2f7dfc
testb $0x1, 0x1(%rax)
je 0x6726d
leaq 0x28fd9e(%rip), %rax    # 0x2f71cc
movl (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x671f0
movl %edi, %ebx
leaq 0x19db92(%rip), %rax    # 0x204fd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x6745a
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jb 0x6726d
leaq 0x29099b(%rip), %r14    # 0x2f7dfc
movl (%r14), %eax
testb $0x3, %al
je 0x674ab
movl $0x8e, %edi
callq 0x5707f
movl $0xa8, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
leaq 0x28fcee(%rip), %rax    # 0x2f7178
cvtsd2ss (%rax), %xmm0
callq 0x52673
leaq 0x28fce6(%rip), %rax    # 0x2f7180
cvtsd2ss (%rax), %xmm0
callq 0x52673
callq 0x570f8
movl (%r14), %eax
testb $0x34, %al
je 0x67503
movl $0x8e, %edi
callq 0x5707f
movl $0xa8, %edi
callq 0x523f2
pushq $0x1
popq %rdi
callq 0x523f2
leaq 0x28fcb6(%rip), %rax    # 0x2f7188
cvtsd2ss (%rax), %xmm0
callq 0x52673
leaq 0x28fcae(%rip), %rax    # 0x2f7190
cvtsd2ss (%rax), %xmm0
callq 0x52673
leaq 0x28fca6(%rip), %rax    # 0x2f7198
cvtsd2ss (%rax), %xmm0
callq 0x52673
callq 0x570f8
movl (%r14), %eax
testw $0x600, %ax             # imm = 0x600
je 0x6754d
movl $0x8e, %edi
callq 0x5707f
movl $0xa8, %edi
callq 0x523f2
pushq $0x2
popq %rdi
callq 0x523f2
leaq 0x28fc84(%rip), %rax    # 0x2f71b0
cvtsd2ss (%rax), %xmm0
callq 0x52673
leaq 0x28fc7c(%rip), %rax    # 0x2f71b8
cvtsd2ss (%rax), %xmm0
callq 0x52673
callq 0x570f8
movl (%r14), %eax
testb $0x8, %al
je 0x67585
movl $0x8e, %edi
callq 0x5707f
movl $0xa8, %edi
callq 0x523f2
pushq $0x3
popq %rdi
callq 0x523f2
leaq 0x28fc4c(%rip), %rax    # 0x2f71c0
cvtsd2ss (%rax), %xmm0
callq 0x52673
callq 0x570f8
movl (%r14), %eax
testw $0x1800, %ax            # imm = 0x1800
je 0x675cc
movl $0x8e, %edi
callq 0x5707f
movl $0xa8, %edi
callq 0x523f2
pushq $0x4
popq %rdi
callq 0x523f2
leaq 0x28fbf2(%rip), %rax    # 0x2f71a0
cvtsd2ss (%rax), %xmm0
callq 0x52673
leaq 0x28fbea(%rip), %rax    # 0x2f71a8
cvtsd2ss (%rax), %xmm0
callq 0x52673
callq 0x570f8
testl %ebx, %ebx
je 0x6726d
movl (%r14), %eax
notl %eax
testb $0x3f, %al
je 0x675f5
testb $0x37, %al
jne 0x6726d
leaq 0x1c1950(%rip), %rax    # 0x228f3c
cmpb $0x0, (%rax)
je 0x6726d
pushq $0x9
popq %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6166c