// File: /workspace/github_cpp_makefile_star2_O1/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 0xae7e
leaq 0x1dcc10(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6179b
leaq 0xc9176(%rip), %rsi     # 0x12a905
movl %r14d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x9560
leaq 0x1dcc1e(%rip), %rax    # 0x23e3c0
cmpq $0x0, (%rax)
je 0x617d1
leaq 0x2dd0a1(%rip), %rdi    # 0x33e850
leaq 0xc9173(%rip), %rsi     # 0x12a929
leaq 0x1dbda3(%rip), %rdx    # 0x23d560
xorl %eax, %eax
callq 0x9060
leaq 0x2ddb01(%rip), %rax    # 0x33f2cc
movl $0x2, (%rax)
leaq 0x1b9858(%rip), %rax    # 0x21b030
movl $0x0, (%rax)
callq 0x7f1ea
leaq 0x1dd754(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x61802
callq 0x7ca83
cmpb $0x0, 0x30a623(%rip)    # 0x36be1e
jne 0x61802
callq 0x64349
movl %r14d, %edi
movl %ebx, %esi
callq 0x5fc8f
callq 0xae7e
leaq 0x1b9b5c(%rip), %rax    # 0x21b374
cmpl $0x0, (%rax)
je 0x6182d
leaq 0x1b9b3c(%rip), %rax    # 0x21b360
movsd (%rax), %xmm0
callq 0x6dede
leaq 0x2ac5b8(%rip), %rax    # 0x30ddec
cmpb $0x0, (%rax)
leaq 0x1b987e(%rip), %rbx    # 0x21b0bc
jne 0x61851
leaq 0x2ac4cc(%rip), %rax    # 0x30dd13
cmpb $0x0, (%rax)
jne 0x61851
cmpl $0x0, (%rbx)
je 0x618a2
leaq 0x2ac4c9(%rip), %rax    # 0x30dd21
movzbl (%rax), %edi
leaq 0x2ac4b2(%rip), %rax    # 0x30dd14
movzbl (%rax), %esi
leaq 0x2ac554(%rip), %rax    # 0x30ddc0
movsd (%rax), %xmm0
leaq 0x2ac561(%rip), %rax    # 0x30ddd8
movsd (%rax), %xmm1
leaq 0x2ac49a(%rip), %rax    # 0x30dd1c
movss (%rax), %xmm2
xorl %edx, %edx
callq 0x6ad1d
cmpl $0x0, (%rbx)
je 0x618a2
leaq 0x1b982b(%rip), %rax    # 0x21b0c4
movl (%rax), %edi
xorl %esi, %esi
callq 0x6d4b2
leaq 0x2ac467(%rip), %rax    # 0x30dd10
cmpb $0x0, (%rax)
je 0x618bf
leaq 0x2ac45c(%rip), %rax    # 0x30dd11
movzbl (%rax), %edi
xorl %esi, %esi
callq 0x6d1d6
leaq 0x2ab7ea(%rip), %rax    # 0x30d0b0
cmpl $0x0, (%rax)
je 0x61903
leaq 0x2ab7d8(%rip), %rax    # 0x30d0aa
movzbl (%rax), %edi
leaq 0x2ab7cf(%rip), %rax    # 0x30d0ab
movzbl (%rax), %esi
leaq 0x2ab7c6(%rip), %rax    # 0x30d0ac
movzbl (%rax), %edx
leaq 0x2ab7bd(%rip), %rax    # 0x30d0ad
movzbl (%rax), %ecx
leaq 0x2ab7b4(%rip), %rax    # 0x30d0ae
movzbl (%rax), %r8d
callq 0x69d08
movl $0xc9, %edi
callq 0xc07bd
callq 0x611e9
callq 0x6627a
xorl %edi, %edi
callq 0x69815
leaq 0x1b6fab(%rip), %rax    # 0x2188d0
cmpq $0x1, (%rax)
jne 0x61976
leaq 0x1b96a2(%rip), %rax    # 0x21afd4
movl (%rax), %eax
leal -0x33(%rax), %ecx
cmpl $0x1d, %ecx
ja 0x61976
movl $0x20004009, %edx       # imm = 0x20004009
btl %ecx, %edx
jae 0x61976
movl %eax, %edx
xorl $0x41, %edx
leaq 0x1b6fa6(%rip), %rcx    # 0x2188f8
movl (%rcx), %ecx
movl %ecx, %esi
xorl $0x47, %esi
orl %edx, %esi
je 0x61976
cmpl $0x41, %eax
jne 0x6196c
cmpl $0x33, %ecx
je 0x61976
cmpl $0x47, %ecx
je 0x61976
movl $0x1, %edi
callq 0x6139d
callq 0xae7e
leaq 0x1dca93(%rip), %rax    # 0x23e415
cmpb $0x0, (%rax)
jne 0x6198c
callq 0x66423
leaq 0x2ac4e5(%rip), %rax    # 0x30de78
movq (%rax), %rdx
testq %rdx, %rdx
je 0x619d9
leaq 0x2ac4e6(%rip), %rbx    # 0x30de88
cmpl $0x0, (%rbx)
jle 0x619d9
leaq 0x2ac4eb(%rip), %rax    # 0x30de99
cmpb $0x0, (%rax)
jne 0x619d9
movl $0x1, %edi
movl $0x1, %esi
callq 0x71468
callq 0x712d5
xorl %edi, %edi
movl $0x6, %esi
callq 0x6c67b
movl $0xfffffc19, (%rbx)     # imm = 0xFFFFFC19
leaq 0x2d5754(%rip), %rbx    # 0x337134
cmpl $0x0, (%rbx)
je 0x61a21
cmpl $0x0, (%rbx)
jle 0x61a10
xorl %r14d, %r14d
leaq 0x2d563c(%rip), %r15    # 0x337030
movzbl (%r15,%r14), %esi
movl $0xa, %edi
xorl %edx, %edx
callq 0xbcc0
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x619f4
movl $0xa, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xbcc0
callq 0x71943
callq 0x71a09
callq 0x708b3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xae7e