// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: set_dac_voltage(double, int)
void set_dac_voltage(DATA_SIZE volts, int why)
{
int val;
int i,j;

   if(read_only) return;
   if(luxor) return;

   if(rcvr_type == CS_RCVR) {
      set_cs_remote(1);
      sprintf(out, ":ROSC:CONT %f", volts);
      queue_cs_cmd(out, SCPI_EFC_MSG);
      restore_cs_remote();
      queue_cs_cmd(":ROSC:CONT?", SCPI_EFC_MSG);
   }
   else if(rcvr_type == PRS_RCVR) {
      val = (int) volts;
      i = val / 4096;
      j = val % 4096;
      sprintf(out, "FC%d,%d", i,j);
      queue_prs_cmd(out, PRS_FC_MSG);
      queue_prs_cmd("FC?", PRS_FC_MSG);
   }
   else if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) return;
      if(ACU_360) return;
      if(ACUTIME) return;
      if(PALISADE) return;
      if(SV6_FAMILY) return;
      send_tsip_start(0x8E);
      send_byte(0xA0);
      send_byte(0x00);
      send_single((float) volts);
      send_tsip_end();
   }
   else if(rcvr_type == UCCM_RCVR) {
      val = (int) volts;  // this is DAC setting, not volts
      sprintf(out, "DIAG:ROSC:EFC:DATA %x", val);
      queue_uccm_cmd(out, UCCM_SETDAC_MSG);
      queue_uccm_cmd("DIAG:ROSC:EFC:DATA?", UCCM_EFC_MSG);
      discipline_mode = DIS_MODE_MANUAL_HOLD;  // manual control
//sprintf(plot_title, "Set dac to %f   why:%d", volts,why);
if(debug_file) fprintf(debug_file, "Set dac to %f   why:%d\n", volts,why);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x2ca132(%rip), %rax    # 0x33701a
leaq 0x1d204f(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
jne 0x6d072
leaq 0x1ab9d0(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x1ffff, %rax          # imm = 0x1FFFF
jg 0x6cf9e
cmpq $0x1, %rax
je 0x6d013
cmpq $0x8, %rax
jne 0x6d072
movl %edi, %ebx
cvttsd2si %xmm0, %edx
leaq 0x2cf2f0(%rip), %r14    # 0x33c220
leaq 0xb434f(%rip), %rsi     # 0x121286
movq %r14, %rdi
xorl %eax, %eax
movsd %xmm0, -0x18(%rbp)
callq 0x9060
movq %r14, %rdi
movl $0x68, %esi
callq 0x5ee52
leaq 0xb4342(%rip), %rdi     # 0x12129c
movl $0x67, %esi
callq 0x5ee52
movsd -0x18(%rbp), %xmm0
leaq 0x2a0527(%rip), %rax    # 0x30d497
movb $0x3, (%rax)
leaq 0x1d1416(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6d072
leaq 0xb4323(%rip), %rsi     # 0x1212b0
movl %ebx, %edx
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x9560
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x6d07b
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x6d072
movl $0x1, %edi
movsd %xmm0, -0x18(%rbp)
callq 0x63db5
leaq 0x2cf254(%rip), %rbx    # 0x33c220
leaq 0xb4291(%rip), %rsi     # 0x121264
movq %rbx, %rdi
movsd -0x18(%rbp), %xmm0
movb $0x1, %al
callq 0x9060
movq %rbx, %rdi
movl $0xb, %esi
callq 0x5ee52
leaq 0x1ad9f6(%rip), %rax    # 0x21a9ec
cmpl $0x0, (%rax)
jne 0x6d002
xorl %edi, %edi
callq 0x63db5
leaq 0xb4269(%rip), %rdi     # 0x121272
movl $0xb, %esi
jmp 0x6d0c7
leaq 0x1adfba(%rip), %rcx    # 0x21afd4
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x41, %esi
leaq 0x1ab8d0(%rip), %rdx    # 0x2188f8
movl (%rdx), %edx
movl %edx, %edi
xorl $0x47, %edi
orl %esi, %edi
je 0x6d072
cmpl $0x41, %ecx
jne 0x6d042
cmpl $0x33, %edx
je 0x6d072
cmpl $0x47, %edx
je 0x6d072
cmpl $0x41, %ecx
sete %dl
cmpl $0x50, %ecx
sete %sil
cmpq $0x1, %rax
jne 0x6d05a
orb %sil, %dl
jne 0x6d072
cmpq $0x1, %rax
jne 0x6d0d4
addl $-0x33, %ecx
cmpl $0x1d, %ecx
ja 0x6d0d4
movl $0x20004009, %eax       # imm = 0x20004009
btl %ecx, %eax
jae 0x6d0d4
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
cvttsd2si %xmm0, %ecx
leal 0xfff(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
movl %edx, %eax
andl $0xfffff000, %eax       # imm = 0xFFFFF000
subl %eax, %ecx
sarl $0xc, %edx
leaq 0x2cf183(%rip), %rbx    # 0x33c220
leaq 0xb41da(%rip), %rsi     # 0x12127e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1fc, %esi            # imm = 0x1FC
callq 0x5ee52
leaq 0xb8232(%rip), %rdi     # 0x1252f4
movl $0x1fc, %esi            # imm = 0x1FC
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5ee52
movl $0x8e, %edi
movsd %xmm0, -0x18(%rbp)
callq 0x5e740
movl $0xa0, %edi
callq 0x591af
xorl %edi, %edi
callq 0x591af
xorps %xmm0, %xmm0
cvtsd2ss -0x18(%rbp), %xmm0
callq 0x59440
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5e7c0