// File: 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
subq $0x10, %rsp
leaq 0xe47c8(%rip), %rdi     # 0x185217
callq 0x7add0
callq 0x7a560
movw %ax, %cx
leaq 0x2cc0fd(%rip), %rax    # 0x36cb60
movw %cx, (%rax)
callq 0x7a680
movl %eax, %ecx
leaq 0x2cc0f0(%rip), %rax    # 0x36cb64
movl %ecx, (%rax)
callq 0x7a510
movzbl %al, %eax
movl %eax, -0x8(%rbp)
movw %ax, %cx
leaq 0x2cc0dd(%rip), %rax    # 0x36cb68
movw %cx, (%rax)
leaq 0x2cc0d3(%rip), %rax    # 0x36cb68
movzwl (%rax), %eax
cmpl $0x50, %eax
jle 0xa0abb
leaq 0x2cc0c4(%rip), %rax    # 0x36cb68
movzwl (%rax), %eax
addl $0x76c, %eax            # imm = 0x76C
movw %ax, %cx
leaq 0x2cc0b2(%rip), %rax    # 0x36cb68
movw %cx, (%rax)
jmp 0xa0ad7
leaq 0x2cc0a6(%rip), %rax    # 0x36cb68
movzwl (%rax), %eax
addl $0x7d0, %eax            # imm = 0x7D0
movw %ax, %cx
leaq 0x2cc094(%rip), %rax    # 0x36cb68
movw %cx, (%rax)
callq 0x7a510
movb %al, %cl
leaq 0x2cc085(%rip), %rax    # 0x36cb6a
movb %cl, (%rax)
callq 0x7a510
movb %al, %cl
leaq 0x2cc076(%rip), %rax    # 0x36cb6b
movb %cl, (%rax)
callq 0x7a510
movb %al, %cl
leaq 0x2cc067(%rip), %rax    # 0x36cb6c
movb %cl, (%rax)
callq 0x7a860
leaq 0x2cc05d(%rip), %rax    # 0x36cb70
movss %xmm0, (%rax)
callq 0x7a560
movw %ax, -0x2(%rbp)
movl $0x1, %edi
callq 0x7aee0
leaq 0x1fd61f(%rip), %rax    # 0x29e150
cmpl $0x0, (%rax)
je 0xa0b3b
jmp 0xa0cca
leaq 0x2cc028(%rip), %rax    # 0x36cb6a
movzbl (%rax), %eax
cmpl $0xc, %eax
jle 0xa0b54
leaq 0x2cc019(%rip), %rax    # 0x36cb6a
movb $0x0, (%rax)
leaq 0x2cc005(%rip), %rax    # 0x36cb60
movzwl (%rax), %eax
leaq 0x2cbfff(%rip), %rcx    # 0x36cb64
addl (%rcx), %eax
movzwl -0x2(%rbp), %ecx
addl %ecx, %eax
leaq 0x2cbff6(%rip), %rcx    # 0x36cb6a
movzbl (%rcx), %ecx
addl %ecx, %eax
leaq 0x2cbfeb(%rip), %rcx    # 0x36cb6b
movzbl (%rcx), %ecx
addl %ecx, %eax
leaq 0x2cbfe0(%rip), %rcx    # 0x36cb6c
movzbl (%rcx), %ecx
addl %ecx, %eax
addl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
leaq 0x2cbfcc(%rip), %rax    # 0x36cb6a
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc, %ecx
movb %al, -0x9(%rbp)
jg 0xa0c28
leaq 0x2cbfb8(%rip), %rax    # 0x36cb6a
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x9(%rbp)
je 0xa0c28
leaq 0x2cbfa5(%rip), %rax    # 0x36cb6b
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x1f, %ecx
movb %al, -0x9(%rbp)
jg 0xa0c28
leaq 0x2cbf91(%rip), %rax    # 0x36cb6b
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x9(%rbp)
je 0xa0c28
leaq 0x2cbf7a(%rip), %rax    # 0x36cb68
movzwl (%rax), %ecx
xorl %eax, %eax
cmpl $0x7bc, %ecx            # imm = 0x7BC
movb %al, -0x9(%rbp)
jl 0xa0c28
leaq 0x2cbf63(%rip), %rax    # 0x36cb68
movzwl (%rax), %ecx
xorl %eax, %eax
cmpl $0x820, %ecx            # imm = 0x820
movb %al, -0x9(%rbp)
jg 0xa0c28
leaq 0x2cbf50(%rip), %rax    # 0x36cb6c
movzbl (%rax), %eax
cmpl $0x18, %eax
setle %al
movb %al, -0x9(%rbp)
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
leaq 0x2cb99d(%rip), %rax    # 0x36c5d4
movl %ecx, (%rax)
leaq 0x2cb990(%rip), %rax    # 0x36c5d0
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x2cb984(%rip), %rax    # 0x36c5d0
movl %ecx, (%rax)
leaq 0x2cb97f(%rip), %rax    # 0x36c5d4
cmpl $0x0, (%rax)
je 0xa0c6f
leaq 0x2cb96f(%rip), %rax    # 0x36c5d0
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x2cb963(%rip), %rax    # 0x36c5d0
movl %ecx, (%rax)
cmpl $0x0, -0x8(%rbp)
je 0xa0c81
leaq 0x2cb958(%rip), %rax    # 0x36c5d4
cmpl $0x0, (%rax)
je 0xa0c86
callq 0xa0cd0
leaq 0x1d6d2b(%rip), %rax    # 0x2779b8
cmpl $0x0, (%rax)
je 0xa0ca0
leaq 0x1fd49f(%rip), %rax    # 0x29e138
cmpl $0x0, (%rax)
je 0xa0ca0
jmp 0xa0cca
leaq 0x2cace1(%rip), %rax    # 0x36b988
cmpb $0x0, (%rax)
je 0xa0cae
jmp 0xa0cca
leaq 0x1fd469(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0xa0cbc
jmp 0xa0cca
leaq 0x2f5535(%rip), %rax    # 0x3961f8
cmpb $0x0, (%rax)
je 0xa0cca
jmp 0xa0cca
addq $0x10, %rsp
popq %rbp
retq