// File: jkingan[P]ladyheather/heathmsc.cpp
// Function: rosh_jd(int)
double rosh_jd(int y)
{
int g;
double r;
double jd;
int i, j;
int day, month;

   // return Julian date of Rosh Hashanha
   g = (y % 19) + 1;
   j = (12 * g) % 19;
   i = (y/100) - (y/400) - 2;
   r = (double) (int) (y%4);
   r = (765433.0/492480.0*(double) j) + (r/4.0) - ((313.0 * ((double) y) + 89081.0)/98496.0);
   r += (double) i;
// r = 6.057778996 + (1.554241797*(double) j) + 0.25*r - 0.003177794*(double)y,

   day = (int) r;
   r -= (double) day;
   month = 9;
   if(day > 30) { day-=30; ++month; }

   i = day_of_week(day, month, y);
   jd = jdate(y, month, day);

   // apply the postponements
   if((i == 0) || (i == 3) || (i == 5)) {
      jd += 1.0;
   }
   else if(i == 1) {
      if((r >= 23269.0/25920.0) && (j > 6)) jd += 1.0;
   }
   else if(i == 2) {
      if((r >= 1367.0/2160.0) && (j > 6)) jd += 2.0;
   }
   return jd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl $0x13, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x8(%rbp)
imull $0xc, -0x8(%rbp), %eax
movl $0x13, %ecx
cltd
idivl %ecx
movl %edx, -0x20(%rbp)
movl -0x4(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, -0x2c(%rbp)
movl -0x4(%rbp), %eax
movl $0x190, %ecx            # imm = 0x190
cltd
idivl %ecx
movl %eax, %ecx
movl -0x2c(%rbp), %eax
subl %ecx, %eax
subl $0x2, %eax
movl %eax, -0x1c(%rbp)
movl -0x4(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x10(%rbp)
cvtsi2sdl -0x20(%rbp), %xmm0
movsd -0x10(%rbp), %xmm1
movsd 0x2a549(%rip), %xmm2    # 0x1716d0
divsd %xmm2, %xmm1
movsd 0x47e85(%rip), %xmm2    # 0x18f018
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl -0x4(%rbp), %xmm1
movsd 0x47e60(%rip), %xmm2    # 0x18f008
mulsd %xmm2, %xmm1
movsd 0x47e5c(%rip), %xmm2    # 0x18f010
addsd %xmm2, %xmm1
movsd 0x47e40(%rip), %xmm2    # 0x18f000
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
cvtsi2sdl -0x1c(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
cvttsd2si -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
cvtsi2sdl -0x24(%rbp), %xmm1
movsd -0x10(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movl $0x9, -0x28(%rbp)
cmpl $0x1e, -0x24(%rbp)
jle 0x147216
movl -0x24(%rbp), %eax
subl $0x1e, %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %edi
movl -0x28(%rbp), %esi
movl -0x4(%rbp), %edx
callq 0x132a50
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movl -0x4(%rbp), %edi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x122140
movsd %xmm0, -0x18(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14724f
cmpl $0x3, -0x1c(%rbp)
je 0x14724f
cmpl $0x5, -0x1c(%rbp)
jne 0x147263
movsd 0x27e11(%rip), %xmm0    # 0x16f068
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x1472cd
cmpl $0x1, -0x1c(%rbp)
jne 0x147296
movsd -0x10(%rbp), %xmm0
movsd 0x47db2(%rip), %xmm1    # 0x18f028
ucomisd %xmm1, %xmm0
jb 0x147294
cmpl $0x6, -0x20(%rbp)
jle 0x147294
movsd 0x27dde(%rip), %xmm0    # 0x16f068
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x1472cb
cmpl $0x2, -0x1c(%rbp)
jne 0x1472c9
movsd -0x10(%rbp), %xmm0
movsd 0x47d77(%rip), %xmm1    # 0x18f020
ucomisd %xmm1, %xmm0
jb 0x1472c7
cmpl $0x6, -0x20(%rbp)
jle 0x1472c7
movsd 0x27e93(%rip), %xmm0    # 0x16f150
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
jmp 0x1472c9
jmp 0x1472cb
jmp 0x1472cd
movsd -0x18(%rbp), %xmm0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)