// File: /workspace/github_cpp_makefile_star2_O3/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 0x2ca1aa(%rip), %rax    # 0x33701a
leaq 0x1d20c7(%rip), %rcx    # 0x23ef3e
movb (%rcx), %cl
orb (%rax), %cl
jne 0x6cfaf
leaq 0x1aba48(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpq $0x1ffff, %rax          # imm = 0x1FFFF
jg 0x6cf26
cmpq $0x1, %rax
je 0x6cf94
cmpq $0x8, %rax
jne 0x6cfaf
movl %edi, %ebx
cvttsd2si %xmm0, %edx
leaq 0x2cf368(%rip), %r14    # 0x33c220
leaq 0xb44a7(%rip), %rsi     # 0x121366
movq %r14, %rdi
xorl %eax, %eax
movsd %xmm0, -0x18(%rbp)
callq 0x9060
movq %r14, %rdi
movl $0x68, %esi
callq 0x5edda
leaq 0xb449a(%rip), %rdi     # 0x12137c
movl $0x67, %esi
callq 0x5edda
movsd -0x18(%rbp), %xmm0
leaq 0x2a059f(%rip), %rax    # 0x30d497
movb $0x3, (%rax)
leaq 0x1d148e(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6cfaf
leaq 0xb447b(%rip), %rsi     # 0x121390
movl %ebx, %edx
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x9560
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x6cfb8
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x6cfaf
movl $0x1, %edi
movsd %xmm0, -0x18(%rbp)
callq 0x63e3b
leaq 0x2cf2d0(%rip), %rbx    # 0x33c220
leaq 0xb43ed(%rip), %rsi     # 0x121344
movq %rbx, %rdi
movsd -0x18(%rbp), %xmm0
movb $0x1, %al
callq 0x9060
movq %rbx, %rdi
movl $0xb, %esi
callq 0x5edda
leaq 0x1ada72(%rip), %rax    # 0x21a9ec
cmpl $0x0, (%rax)
jne 0x6cf86
xorl %edi, %edi
callq 0x63e3b
leaq 0xb43c5(%rip), %rdi     # 0x121352
movl $0xb, %esi
jmp 0x6d004
leaq 0x1ae039(%rip), %rax    # 0x21afd4
movl (%rax), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x6d011
movl $0x20004009, %ecx       # imm = 0x20004009
btl %eax, %ecx
jae 0x6d011
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 0x2cf246(%rip), %rbx    # 0x33c220
leaq 0xb437d(%rip), %rsi     # 0x12135e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x1fc, %esi            # imm = 0x1FC
callq 0x5edda
leaq 0xb83d5(%rip), %rdi     # 0x1253d4
movl $0x1fc, %esi            # imm = 0x1FC
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5edda
movl $0x8e, %edi
movsd %xmm0, -0x18(%rbp)
callq 0x5e6be
movl $0xa0, %edi
callq 0x590f7
xorl %edi, %edi
callq 0x590f7
xorps %xmm0, %xmm0
cvtsd2ss -0x18(%rbp), %xmm0
callq 0x59376
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5e73c