// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: init_messages(int, int)
void init_messages(int why, int reset_ok)
{
int i;

   // initialize the receiver to send periodic messages and request some
   // various configuration info.

   reset_kbd_timer();
if(debug_file) fprintf(debug_file, "### init_messages(%d)  reset_ok:%d\n", why, reset_ok);
   if(sim_file) {
      sprintf(plot_title, "Using simulation input file: %s", sim_name);
      title_type = USER;
   }

   need_msg_init = 0;
   wakeup_nortel();
   if(luxor) {
      request_luxor_ver();
      if(luxor_time_set == 0) set_luxor_time();
   }


   init_receiver(why, reset_ok);   // setup the receiver
   reset_kbd_timer();

   if(user_set_nav_rate) {
      set_nav_rate(user_nav_rate);
   }

   if(user_set_delay || set_pps_polarity || user_set_traim) {   // set cable delay and pps values
      set_pps(user_pps_enable, user_pps_polarity,  delay_value, pps1_delay, pps_threshold, 0);
      if(user_set_traim) set_traim_mode(traim_threshold, 0);
   }


   if(set_osc_polarity) {
      set_osc_sense(user_osc_polarity, 0);
   }

   if(user_set_filters) {
      set_filter_config(user_pv, user_static, user_alt, user_kalman, user_marine, 0);
   }

   request_rcvr_info(201);   // get various receiver status messages
   request_rcvr_health();

   request_sat_list();       // get satellite info
   request_sat_status(0x00);
   if(SV6_FAMILY && !ACU_GG && !ACU_360) {
      request_sv6_config(1);
   }
   reset_kbd_timer();

   if(log_db == 0) {
      request_sig_levels();  // get signal quality info
   }

   if(do_survey && (survey_why > 0) && (user_precision_survey == 0)) {
      set_survey_params(1, 1, do_survey);
      request_survey_params();
      start_self_survey(0x00, 6);
      survey_why = (-999);
   }


   if(user_init_len) {  // send string of user specified bytes after the standard init commands
      for(i=0; i<user_init_len; i++) {
         sendout(RCVR_PORT, user_init_cmd[i], ADD_CHAR);
      }  
      sendout(RCVR_PORT, 0, FLUSH_COM);
   }

   request_primary_timing();    // get time of day
   request_secondary_timing();
   request_all_dis_params();
   reset_kbd_timer();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
callq 0xae6f
leaq 0x1dcc97(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x61714
leaq 0xc92c8(%rip), %rsi     # 0x12a9d0
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
leaq 0x1dcca5(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x6174a
leaq 0x2dd128(%rip), %rdi    # 0x33e850
leaq 0xc92c5(%rip), %rsi     # 0x12a9f4
leaq 0x1dbe2a(%rip), %rdx    # 0x23d560
xorl %eax, %eax
callq 0x9060
leaq 0x2ddb88(%rip), %rax    # 0x33f2cc
movl $0x2, (%rax)
leaq 0x1b98df(%rip), %rax    # 0x21b030
movl $0x0, (%rax)
callq 0x7f025
leaq 0x1dd7db(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x6177b
callq 0x7c896
cmpb $0x0, 0x30a6aa(%rip)    # 0x36be1e
jne 0x6177b
callq 0x64443
movl %r14d, %edi
movl %ebx, %esi
callq 0x5fc4c
callq 0xae6f
leaq 0x1b9be3(%rip), %rax    # 0x21b374
cmpl $0x0, (%rax)
je 0x617a6
leaq 0x1b9bc3(%rip), %rax    # 0x21b360
movsd (%rax), %xmm0
callq 0x6dd8e
leaq 0x2ac63f(%rip), %rax    # 0x30ddec
cmpb $0x0, (%rax)
leaq 0x1b9905(%rip), %rbx    # 0x21b0bc
jne 0x617ca
leaq 0x2ac553(%rip), %rax    # 0x30dd13
cmpb $0x0, (%rax)
jne 0x617ca
cmpl $0x0, (%rbx)
je 0x6181b
leaq 0x2ac550(%rip), %rax    # 0x30dd21
movzbl (%rax), %edi
leaq 0x2ac539(%rip), %rax    # 0x30dd14
movzbl (%rax), %esi
leaq 0x2ac5db(%rip), %rax    # 0x30ddc0
movsd (%rax), %xmm0
leaq 0x2ac5e8(%rip), %rax    # 0x30ddd8
movsd (%rax), %xmm1
leaq 0x2ac521(%rip), %rax    # 0x30dd1c
movss (%rax), %xmm2
xorl %edx, %edx
callq 0x6add8
cmpl $0x0, (%rbx)
je 0x6181b
leaq 0x1b98b2(%rip), %rax    # 0x21b0c4
movl (%rax), %edi
xorl %esi, %esi
callq 0x6d374
leaq 0x2ac4ee(%rip), %rax    # 0x30dd10
cmpb $0x0, (%rax)
je 0x61838
leaq 0x2ac4e3(%rip), %rax    # 0x30dd11
movzbl (%rax), %edi
xorl %esi, %esi
callq 0x6d0ca
leaq 0x2ab871(%rip), %rax    # 0x30d0b0
cmpl $0x0, (%rax)
je 0x6187c
leaq 0x2ab85f(%rip), %rax    # 0x30d0aa
movzbl (%rax), %edi
leaq 0x2ab856(%rip), %rax    # 0x30d0ab
movzbl (%rax), %esi
leaq 0x2ab84d(%rip), %rax    # 0x30d0ac
movzbl (%rax), %edx
leaq 0x2ab844(%rip), %rax    # 0x30d0ad
movzbl (%rax), %ecx
leaq 0x2ab83b(%rip), %rax    # 0x30d0ae
movzbl (%rax), %r8d
callq 0x69e74
movl $0xc9, %edi
callq 0xc0d9b
callq 0x61195
callq 0x6649d
xorl %edi, %edi
callq 0x699e2
leaq 0x1b7032(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x618ef
leaq 0x1b9729(%rip), %rax    # 0x21afd4
movl (%rax), %eax
leal -0x33(%rax), %ecx
cmpl $0x1d, %ecx
ja 0x618ef
movl $0x20004009, %edx       # imm = 0x20004009
btl %ecx, %edx
jae 0x618ef
movl %eax, %edx
xorl $0x41, %edx
leaq 0x1b702d(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x47, %esi
orl %edx, %esi
je 0x618ef
cmpl $0x41, %eax
jne 0x618e5
cmpl $0x33, %ecx
je 0x618ef
cmpl $0x47, %ecx
je 0x618ef
movl $0x1, %edi
callq 0x61349
callq 0xae6f
leaq 0x1dcb1a(%rip), %rax    # 0x23e415
cmpb $0x0, (%rax)
jne 0x61905
callq 0x66646
leaq 0x2ac56c(%rip), %rax    # 0x30de78
movq (%rax), %rdx
testq %rdx, %rdx
je 0x61952
leaq 0x2ac56d(%rip), %rbx    # 0x30de88
cmpl $0x0, (%rbx)
jle 0x61952
leaq 0x2ac572(%rip), %rax    # 0x30de99
cmpb $0x0, (%rax)
jne 0x61952
movl $0x1, %edi
movl $0x1, %esi
callq 0x714be
callq 0x7135e
xorl %edi, %edi
movl $0x6, %esi
callq 0x6c6a4
movl $0xfffffc19, (%rbx)     # imm = 0xFFFFFC19
leaq 0x2d57db(%rip), %rbx    # 0x337134
cmpl $0x0, (%rbx)
je 0x61997
jle 0x61986
xorl %r14d, %r14d
leaq 0x2d56c6(%rip), %r15    # 0x337030
movzbl (%r15,%r14), %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcaa
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x6196a
movl $0xa, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xbcaa
callq 0x71957
callq 0x719c0
callq 0x7097b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xae6f