// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: load_china_year(int, int)
int load_china_year(int year, int mm)
{
int i;
int index;
int month, months;
double days;

   index = year - 2009;
   if(china_data[index].leap_month) months = 13;
   else                             months = 12;
   year = year + 4635 - 1998 + 60;  // note +60 years is common in the US

   ctimes[mm] = china_data[index].jd;
   month = 1;
   for(i=mm; i<mm+months; i++) {
      cyear[i]  = year;
      cmonth[i] = month;
      if(china_data[index].leap_month) {  // this year has a leap month
         if((i-mm+1) != china_data[index].leap_month) ++month;
      }
      else {
         ++month;
      }

      if(china_data[index].month_mask & (1 << (i-mm))) days = 30.0;
      else                                             days = 29.0;
      ctimes[i+1] = ctimes[i] + days;
   }
   if(china_data[index].leap_month) {
      cmonth[china_data[index].leap_month] *= (-1);
   }

   return months;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl -0x4(%rbp), %eax
subl $0x7d9, %eax            # imm = 0x7D9
movl %eax, -0x10(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x819e0(%rip), %rax     # 0x1c9b30
cmpb $0x0, 0x2(%rax,%rcx,8)
je 0x148160
movl $0xd, -0x18(%rbp)
jmp 0x148167
movl $0xc, -0x18(%rbp)
movl -0x4(%rbp), %eax
addl $0x121b, %eax           # imm = 0x121B
subl $0x7ce, %eax            # imm = 0x7CE
addl $0x3c, %eax
movl %eax, -0x4(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x819ab(%rip), %rax     # 0x1c9b30
movss 0x4(%rax,%rcx,8), %xmm0
cvtss2sd %xmm0, %xmm0
movslq -0x8(%rbp), %rcx
leaq 0x291b76(%rip), %rax    # 0x3d9d10
movsd %xmm0, (%rax,%rcx,8)
movl $0x1, -0x14(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl -0x8(%rbp), %ecx
addl -0x18(%rbp), %ecx
cmpl %ecx, %eax
jge 0x14829b
movl -0x4(%rbp), %edx
movslq -0xc(%rbp), %rcx
leaq 0x291c85(%rip), %rax    # 0x3d9e50
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %edx
movslq -0xc(%rbp), %rcx
leaq 0x291d14(%rip), %rax    # 0x3d9ef0
movl %edx, (%rax,%rcx,4)
movslq -0x10(%rbp), %rcx
leaq 0x81946(%rip), %rax     # 0x1c9b30
cmpb $0x0, 0x2(%rax,%rcx,8)
je 0x148219
movl -0xc(%rbp), %eax
subl -0x8(%rbp), %eax
addl $0x1, %eax
movslq -0x10(%rbp), %rdx
leaq 0x8192b(%rip), %rcx     # 0x1c9b30
movzbl 0x2(%rcx,%rdx,8), %ecx
cmpl %ecx, %eax
je 0x148217
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x148222
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x81903(%rip), %rax     # 0x1c9b30
movzwl (%rax,%rcx,8), %eax
movl -0xc(%rbp), %ecx
subl -0x8(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x148256
movsd 0x29431(%rip), %xmm0    # 0x171680
movsd %xmm0, -0x20(%rbp)
jmp 0x148263
movsd 0x464ba(%rip), %xmm0    # 0x18e718
movsd %xmm0, -0x20(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x291aa2(%rip), %rax    # 0x3d9d10
movsd (%rax,%rcx,8), %xmm0
addsd -0x20(%rbp), %xmm0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x291a88(%rip), %rax    # 0x3d9d10
movsd %xmm0, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1481ac
movslq -0x10(%rbp), %rcx
leaq 0x8188a(%rip), %rax     # 0x1c9b30
cmpb $0x0, 0x2(%rax,%rcx,8)
je 0x1482d4
movslq -0x10(%rbp), %rcx
leaq 0x81878(%rip), %rax     # 0x1c9b30
movzbl 0x2(%rax,%rcx,8), %eax
movl %eax, %ecx
leaq 0x291c2a(%rip), %rax    # 0x3d9ef0
imull $-0x1, (%rax,%rcx,4), %edx
leaq 0x291c1f(%rip), %rax    # 0x3d9ef0
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
popq %rbp
retq
nopl (%rax)