// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: get_manuf_params()
void get_manuf_params()
{
u16 test_code;
int sum;

   log_packet_id("Packet 0x8F.41 (Manufacturing Params)");

   sn_prefix = tsip_word();
   serial_num = tsip_dword();
   build_year = sum = tsip_byte();
   if(build_year > TRUNC_YEAR) build_year += 1900;
   else                        build_year += 2000;
   build_month = tsip_byte();
   build_day = tsip_byte();
   build_hour = tsip_byte();
   build_offset = tsip_single();
   test_code = tsip_word();
   check_tsip_end(1);
   if(tsip_error) return;

   if(build_month > 12) build_month = 0;

   sum += sn_prefix + serial_num + test_code + build_month + build_day + build_hour;  // check for zeroed build params
   build_ok = ((build_month <= 12) && (build_month != 0) && 
               (build_day <= 31) && (build_day != 0) &&
               (build_year >= 1980) && (build_year <= 2080) &&
               (build_hour <= 24));

   have_build |= 0x01;
   if(build_ok) have_build |= 0x02;


   if((sum == 0) || build_ok) {
      show_manuf_params();
   }

   if(text_mode && first_key) return;
   if(zoom_screen) return;
   if(luxor) return;
   if(just_read) return;

////show_serial_info();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xad07e(%rip), %rdi     # 0x121f87
callq 0x58dc2
callq 0x588d2
leaq 0x298a66(%rip), %rcx    # 0x30d980
movw %ax, (%rcx)
callq 0x58964
leaq 0x298a5b(%rip), %rcx    # 0x30d984
movl %eax, (%rcx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x74f41
leaq 0x1ca032(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %r14d
leal 0x7d0(%r14), %eax
leal 0x76c(%r14), %ecx
cmpb $0x51, %r14b
cmovbl %eax, %ecx
leaq 0x298a27(%rip), %rax    # 0x30d988
movw %cx, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x74f7a
leaq 0x1c9ff9(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x298a09(%rip), %r15    # 0x30d98a
movb %al, (%r15)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x74f9a
leaq 0x1c9fd9(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x2989ea(%rip), %r12    # 0x30d98b
movb %al, (%r12)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x74fbb
leaq 0x1c9fb8(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x2989ca(%rip), %r13    # 0x30d98c
movb %al, (%r13)
callq 0x58a30
leaq 0x2989be(%rip), %rax    # 0x30d990
movss %xmm0, (%rax)
callq 0x588d2
movl %eax, %ebx
xorl %edi, %edi
callq 0x58e9b
leaq 0x1c9f85(%rip), %rax    # 0x23ef70
cmpl $0x0, (%rax)
jne 0x7508e
movb (%r15), %al
cmpb $0xd, %al
jb 0x75001
movb $0x0, (%r15)
xorl %eax, %eax
leaq 0x298978(%rip), %rcx    # 0x30d980
movzwl (%rcx), %ecx
movzwl %bx, %esi
movzbl %al, %edx
movzbl (%r12), %edi
movzbl (%r13), %r8d
cmpl $0x19, %r8d
setb %al
addl %ecx, %esi
leaq 0x298959(%rip), %rcx    # 0x30d984
addl (%rcx), %esi
leal -0x1(%rdi), %r9d
movl %edi, %ecx
addl %edx, %ecx
addl %r8d, %ecx
addl %esi, %ecx
decb %dl
cmpb $0xc, %dl
setb %dl
cmpb $0x1f, %r9b
setb %sil
andb %dl, %sil
leaq 0x298934(%rip), %rdx    # 0x30d988
movzwl (%rdx), %edx
addl $0xfffff844, %edx       # imm = 0xFFFFF844
cmpw $0x65, %dx
setb %dl
andb %al, %dl
andb %sil, %dl
movzbl %dl, %eax
leaq 0x298381(%rip), %rsi    # 0x30d3f4
movl %eax, (%rsi)
leaq 0x298374(%rip), %rsi    # 0x30d3f0
addl %eax, %eax
orl (%rsi), %eax
orl $0x1, %eax
movl %eax, (%rsi)
addl %r14d, %ecx
je 0x7509d
testb %dl, %dl
jne 0x7509d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x750b0