// File: 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
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
callq 0xb610
leaq 0x2172c6(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0x862ce
leaq 0x2172b9(%rip), %rax    # 0x29d570
movq (%rax), %rdi
movl -0x4(%rbp), %edx
movl -0x8(%rbp), %ecx
leaq 0x107b14(%rip), %rsi    # 0x18dddb
movb $0x0, %al
callq 0x9550
leaq 0x2172cb(%rip), %rax    # 0x29d5a0
cmpq $0x0, (%rax)
je 0x86304
leaq 0x31774e(%rip), %rdi    # 0x39da30
leaq 0x107b16(%rip), %rsi    # 0x18ddff
leaq 0x216450(%rip), %rdx    # 0x29c740
movb $0x0, %al
callq 0x9060
leaq 0x3181ae(%rip), %rax    # 0x39e4ac
movl $0x2, (%rax)
leaq 0x1f3f05(%rip), %rax    # 0x27a210
movl $0x0, (%rax)
callq 0xae180
leaq 0x217e01(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x8633a
callq 0xaae30
movzbl 0x344cd0(%rip), %eax    # 0x3caffe
cmpl $0x0, %eax
jne 0x86338
callq 0x898d0
jmp 0x8633a
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
callq 0x841a0
callq 0xb610
leaq 0x1f4203(%rip), %rax    # 0x27a554
cmpl $0x0, (%rax)
je 0x86366
leaq 0x1f41e3(%rip), %rax    # 0x27a540
movsd (%rax), %xmm0
callq 0x95ce0
leaq 0x2e6c5f(%rip), %rax    # 0x36cfcc
cmpb $0x0, (%rax)
jne 0x8638a
leaq 0x2e6b7a(%rip), %rax    # 0x36cef3
cmpb $0x0, (%rax)
jne 0x8638a
leaq 0x1f3f17(%rip), %rax    # 0x27a29c
cmpl $0x0, (%rax)
je 0x863e8
leaq 0x2e6b70(%rip), %rax    # 0x36cf01
movb (%rax), %cl
leaq 0x2e6b5a(%rip), %rax    # 0x36cef4
movb (%rax), %al
leaq 0x2e6bfd(%rip), %rdx    # 0x36cfa0
movsd (%rdx), %xmm0
leaq 0x2e6c0a(%rip), %rdx    # 0x36cfb8
movsd (%rdx), %xmm1
leaq 0x2e6b43(%rip), %rdx    # 0x36cefc
movss (%rdx), %xmm2
xorl %edx, %edx
movzbl %cl, %edi
movzbl %al, %esi
callq 0x91b20
leaq 0x1f3ecb(%rip), %rax    # 0x27a29c
cmpl $0x0, (%rax)
je 0x863e6
leaq 0x1f3ec7(%rip), %rax    # 0x27a2a4
movl (%rax), %edi
xorl %esi, %esi
callq 0x94ed0
jmp 0x863e8
leaq 0x2e6b01(%rip), %rax    # 0x36cef0
cmpb $0x0, (%rax)
je 0x86405
xorl %esi, %esi
leaq 0x2e6af4(%rip), %rax    # 0x36cef1
movzbl (%rax), %edi
callq 0x94a50
leaq 0x2e5e84(%rip), %rax    # 0x36c290
cmpl $0x0, (%rax)
je 0x86458
leaq 0x2e5e72(%rip), %rax    # 0x36c28a
movb (%rax), %dil
leaq 0x2e5e69(%rip), %rax    # 0x36c28b
movb (%rax), %sil
leaq 0x2e5e60(%rip), %rax    # 0x36c28c
movb (%rax), %dl
leaq 0x2e5e58(%rip), %rax    # 0x36c28d
movb (%rax), %cl
xorl %r9d, %r9d
leaq 0x2e5e4d(%rip), %rax    # 0x36c28e
movzbl %dil, %edi
movzbl %sil, %esi
movzbl %dl, %edx
movzbl %cl, %ecx
movzbl (%rax), %r8d
callq 0x905f0
movl $0xc9, %edi
callq 0x109330
callq 0x85ac0
callq 0x8bdd0
xorl %edi, %edi
callq 0x8ff50
leaq 0x1f1636(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x86514
leaq 0x1f3d29(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0x864b4
leaq 0x1f3d1d(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0x864b4
leaq 0x1f3d11(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0x864b4
leaq 0x1f3d05(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x86514
leaq 0x1f15f5(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x864d9
leaq 0x1f3cec(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x864d9
leaq 0x1f1604(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0x86514
leaq 0x1f15d0(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x8650a
leaq 0x1f3cc7(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x8650a
leaq 0x1f15df(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0x86514
leaq 0x1f15d3(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0x86514
movl $0x1, %edi
callq 0x85d60
callq 0xb610
leaq 0x2170d5(%rip), %rax    # 0x29d5f5
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x8652d
callq 0x8bfa0
leaq 0x2e6b24(%rip), %rax    # 0x36d058
cmpq $0x0, (%rax)
je 0x8658b
leaq 0x2e6b27(%rip), %rax    # 0x36d068
cmpl $0x0, (%rax)
jle 0x8658b
leaq 0x2e6b2c(%rip), %rax    # 0x36d079
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x8658b
leaq 0x2e6afc(%rip), %rax    # 0x36d058
movq (%rax), %rax
movl %eax, %edx
movl $0x1, %esi
movl %esi, %edi
callq 0x9ac40
callq 0x9a9e0
xorl %edi, %edi
movl $0x6, %esi
callq 0x93b60
leaq 0x2e6ae3(%rip), %rax    # 0x36d068
movl $0xfffffc19, (%rax)     # imm = 0xFFFFFC19
leaq 0x30fd82(%rip), %rax    # 0x396314
cmpl $0x0, (%rax)
je 0x865e3
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
leaq 0x30fd6c(%rip), %rcx    # 0x396314
cmpl (%rcx), %eax
jge 0x865d2
movslq -0xc(%rbp), %rcx
movl $0xa, %edi
xorl %edx, %edx
leaq 0x30fc52(%rip), %rax    # 0x396210
movzbl (%rax,%rcx), %esi
callq 0xd160
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x8659e
movl $0xa, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xd160
callq 0x9b310
callq 0x9b450
callq 0x99cb0
callq 0xb610
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)