// File: /workspace/github_cpp_makefile_star2_O3/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 0x2c65d5(%rip), %rax    # 0x33701a
leaq 0x1ce4f2(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
je 0x70a57
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1a7e72(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0xffffff, %rax         # imm = 0xFFFFFF
jg 0x70acf
cmpq $0x1, %rax
je 0x70b5a
cmpq $0x8, %rax
je 0x70d6d
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x70a52
leaq 0x29d370(%rip), %rax    # 0x30ddfc
testb $0x1, (%rax)
je 0x70a52
leaq 0x29c6e0(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edx
leaq 0x2cb77d(%rip), %rbx    # 0x33c220
leaq 0xb0eab(%rip), %rsi     # 0x121955
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x5edda
movl $0x11d5, %edi           # imm = 0x11D5
popq %rbx
popq %r14
popq %rbp
jmp 0x667f2
cmpq $0x8000000, %rax        # imm = 0x8000000
je 0x70d49
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0x70d90
cmpq $0x1000000, %rax        # imm = 0x1000000
jne 0x70a52
leaq 0x29d302(%rip), %rbx    # 0x30ddfc
movl (%rbx), %eax
testb $0x1, %al
je 0x70b12
leaq 0x29c671(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edi
callq 0x70e11
movl (%rbx), %eax
testb $0x2, %al
je 0x70b28
leaq 0x29c663(%rip), %rax    # 0x30d180
cvttsd2si (%rax), %edi
callq 0x70e62
movl (%rbx), %eax
testb $0x4, %al
je 0x70b3e
leaq 0x29c64d(%rip), %rax    # 0x30d180
cvttsd2si (%rax), %edi
callq 0x70eb3
movl (%rbx), %eax
testb $0x8, %al
je 0x70a52
leaq 0x29c673(%rip), %rax    # 0x30d1c0
cvttsd2si (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x70f04
movl %edi, %ebx
leaq 0x1aa471(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x70b7b
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jb 0x70a52
leaq 0x29d27a(%rip), %r14    # 0x30ddfc
movl (%r14), %eax
testb $0x3, %al
je 0x70bcf
movl $0x8e, %edi
callq 0x5e6be
movl $0xa8, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
leaq 0x29c5cd(%rip), %rax    # 0x30d178
cvtsd2ss (%rax), %xmm0
callq 0x59376
leaq 0x29c5c5(%rip), %rax    # 0x30d180
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
callq 0x5e73c
movl (%r14), %eax
testb $0x34, %al
je 0x70c32
movl $0x8e, %edi
callq 0x5e6be
movl $0xa8, %edi
callq 0x590f7
movl $0x1, %edi
callq 0x590f7
leaq 0x29c590(%rip), %rax    # 0x30d188
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
leaq 0x29c585(%rip), %rax    # 0x30d190
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
leaq 0x29c57a(%rip), %rax    # 0x30d198
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
callq 0x5e73c
movl (%r14), %eax
testl $0x600, %eax            # imm = 0x600
je 0x70c85
movl $0x8e, %edi
callq 0x5e6be
movl $0xa8, %edi
callq 0x590f7
movl $0x2, %edi
callq 0x590f7
leaq 0x29c552(%rip), %rax    # 0x30d1b0
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
leaq 0x29c547(%rip), %rax    # 0x30d1b8
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
callq 0x5e73c
movl (%r14), %eax
testb $0x8, %al
je 0x70cc2
movl $0x8e, %edi
callq 0x5e6be
movl $0xa8, %edi
callq 0x590f7
movl $0x3, %edi
callq 0x590f7
leaq 0x29c512(%rip), %rax    # 0x30d1c0
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
callq 0x5e73c
movl (%r14), %eax
testl $0x1800, %eax           # imm = 0x1800
je 0x70d12
movl $0x8e, %edi
callq 0x5e6be
movl $0xa8, %edi
callq 0x590f7
movl $0x4, %edi
callq 0x590f7
leaq 0x29c4b2(%rip), %rax    # 0x30d1a0
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
leaq 0x29c4a7(%rip), %rax    # 0x30d1a8
xorps %xmm0, %xmm0
cvtsd2ss (%rax), %xmm0
callq 0x59376
callq 0x5e73c
testl %ebx, %ebx
je 0x70a52
movl (%r14), %eax
notl %eax
testb $0x3f, %al
je 0x70d3b
testb $0x37, %al
jne 0x70a52
leaq 0x1ce20a(%rip), %rax    # 0x23ef3c
cmpb $0x0, (%rax)
je 0x70a52
movl $0x9, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x6a4ce
leaq 0x29d0ac(%rip), %rax    # 0x30ddfc
testb $0x1, (%rax)
je 0x70a52
leaq 0x29c418(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x70f55
leaq 0x29d088(%rip), %rax    # 0x30ddfc
testb $0x1, 0x1(%rax)
je 0x70a52
leaq 0x29c447(%rip), %rax    # 0x30d1cc
movl (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x709c4
leaq 0x29d065(%rip), %rbx    # 0x30ddfc
movl (%rbx), %eax
btl $0xa, %eax
jae 0x70db1
leaq 0x29c412(%rip), %rax    # 0x30d1b8
movsd (%rax), %xmm0
callq 0x70fb0
movl (%rbx), %eax
btl $0x9, %eax
jae 0x70dc9
leaq 0x29c3f2(%rip), %rax    # 0x30d1b0
movsd (%rax), %xmm0
callq 0x710f3
movl (%rbx), %eax
testb $0x1, %al
je 0x70ddf
leaq 0x29c3a4(%rip), %rax    # 0x30d178
cvttsd2si (%rax), %edi
callq 0x7117e
movl (%rbx), %eax
testb $0x2, %al
je 0x70df5
leaq 0x29c396(%rip), %rax    # 0x30d180
movsd (%rax), %xmm0
callq 0x71261
movl (%rbx), %eax
btl $0xd, %eax
jae 0x70a52
leaq 0x29c3c2(%rip), %rax    # 0x30d1c8
movl (%rax), %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x712ff