// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
movl %esi, %ebx
movl %edi, %r14d
callq 0xad24
leaq 0x1ce876(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x59b35
leaq 0xbadec(%rip), %rsi     # 0x114915
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
leaq 0x1ce884(%rip), %rax    # 0x2283c0
cmpq $0x0, (%rax)
je 0x59b6b
leaq 0x2ced07(%rip), %rdi    # 0x328850
leaq 0xbade9(%rip), %rsi     # 0x114939
leaq 0x1cda09(%rip), %rdx    # 0x227560
xorl %eax, %eax
callq 0x9060
leaq 0x2cf767(%rip), %rax    # 0x3292cc
movl $0x2, (%rax)
leaq 0x1ab4be(%rip), %rax    # 0x205030
andl $0x0, (%rax)
callq 0x73b4a
leaq 0x1cf3bd(%rip), %rax    # 0x228f3e
cmpb $0x0, (%rax)
je 0x59b99
callq 0x716db
cmpb $0x0, 0x2fc28c(%rip)    # 0x355e1e
jne 0x59b99
callq 0x5c3ab
movl %r14d, %edi
movl %ebx, %esi
callq 0x5839e
callq 0xad24
leaq 0x1ab7c5(%rip), %rax    # 0x205374
cmpl $0x0, (%rax)
je 0x59bc4
leaq 0x1ab7a5(%rip), %rax    # 0x205360
movsd (%rax), %xmm0
callq 0x64a55
leaq 0x29e221(%rip), %rax    # 0x2f7dec
cmpb $0x0, (%rax)
leaq 0x1ab4e7(%rip), %rbx    # 0x2050bc
jne 0x59be8
leaq 0x29e135(%rip), %rax    # 0x2f7d13
cmpb $0x0, (%rax)
jne 0x59be8
cmpl $0x0, (%rbx)
je 0x59c39
leaq 0x29e132(%rip), %rax    # 0x2f7d21
movzbl (%rax), %edi
leaq 0x29e11b(%rip), %rax    # 0x2f7d14
movzbl (%rax), %esi
leaq 0x29e1bd(%rip), %rax    # 0x2f7dc0
movsd (%rax), %xmm0
leaq 0x29e1ca(%rip), %rax    # 0x2f7dd8
movsd (%rax), %xmm1
leaq 0x29e103(%rip), %rax    # 0x2f7d1c
movss (%rax), %xmm2
xorl %edx, %edx
callq 0x61e97
cmpl $0x0, (%rbx)
je 0x59c39
leaq 0x1ab494(%rip), %rax    # 0x2050c4
movl (%rax), %edi
xorl %esi, %esi
callq 0x6413c
leaq 0x29e0d0(%rip), %rax    # 0x2f7d10
cmpb $0x0, (%rax)
je 0x59c56
leaq 0x29e0c5(%rip), %rax    # 0x2f7d11
movzbl (%rax), %edi
xorl %esi, %esi
callq 0x63ed6
leaq 0x29d453(%rip), %rax    # 0x2f70b0
cmpl $0x0, (%rax)
je 0x59c9a
leaq 0x29d441(%rip), %rax    # 0x2f70aa
movzbl (%rax), %edi
leaq 0x29d438(%rip), %rax    # 0x2f70ab
movzbl (%rax), %esi
leaq 0x29d42f(%rip), %rax    # 0x2f70ac
movzbl (%rax), %edx
leaq 0x29d426(%rip), %rax    # 0x2f70ad
movzbl (%rax), %ecx
leaq 0x29d41d(%rip), %rax    # 0x2f70ae
movzbl (%rax), %r8d
callq 0x61102
movl $0xc9, %edi
callq 0xafef3
callq 0x595d4
callq 0x5de9d
xorl %edi, %edi
callq 0x60ca1
leaq 0x1a8c14(%rip), %rax    # 0x2028d0
cmpq $0x1, (%rax)
jne 0x59d0b
leaq 0x1ab30b(%rip), %rax    # 0x204fd4
movl (%rax), %eax
leal -0x33(%rax), %ecx
cmpl $0x1d, %ecx
ja 0x59d0b
movl $0x20004009, %edx       # imm = 0x20004009
btl %ecx, %edx
jae 0x59d0b
movl %eax, %edx
xorl $0x41, %edx
leaq 0x1a8c0f(%rip), %rcx    # 0x2028f8
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x47, %esi
orl %edx, %esi
je 0x59d0b
cmpl $0x41, %eax
jne 0x59d03
cmpl $0x33, %ecx
je 0x59d0b
cmpl $0x47, %ecx
je 0x59d0b
pushq $0x1
popq %rdi
callq 0x59771
callq 0xad24
leaq 0x1ce6fe(%rip), %rax    # 0x228415
cmpb $0x0, (%rax)
jne 0x59d21
callq 0x5dffd
leaq 0x29e150(%rip), %rax    # 0x2f7e78
movq (%rax), %rdx
testq %rdx, %rdx
je 0x59d67
leaq 0x29e151(%rip), %rbx    # 0x2f7e88
cmpl $0x0, (%rbx)
jle 0x59d67
leaq 0x29e156(%rip), %rax    # 0x2f7e99
cmpb $0x0, (%rax)
jne 0x59d67
pushq $0x1
popq %rdi
movl %edi, %esi
callq 0x67c78
callq 0x67b43
pushq $0x6
popq %rsi
xorl %edi, %edi
callq 0x6355d
movl $0xfffffc19, (%rbx)     # imm = 0xFFFFFC19
leaq 0x2c73c6(%rip), %r14    # 0x321134
movl (%r14), %eax
testl %eax, %eax
je 0x59dac
xorl %r15d, %r15d
leaq 0x2c72b1(%rip), %r12    # 0x321030
pushq $0xa
popq %rbx
cltq
cmpq %rax, %r15
jge 0x59d9f
movzbl (%r12,%r15), %esi
movl %ebx, %edi
xorl %edx, %edx
callq 0xba3b
incq %r15
movl (%r14), %eax
jmp 0x59d82
pushq $0xa
popq %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0xba3b
callq 0x6808a
callq 0x680f1
callq 0x671af
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xad24