// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: calc_greetings()
void calc_greetings()
{
double t;
int gd;
int i;
double rosh, po, purim;
int m_year;

   // calculate a few useful greetings dates 

   // convert Julian times to Gregorian and update the greetings table
   adjust_season(spring);
   sprintf(spring_s, "Spring starts today around %02d:%02d %s", g_hours,g_minutes, out);
   i = set_holiday(SPRING, g_month, g_day);
   if(i >= 0) holiday[i].text = &spring_s[0];

   adjust_season(summer);
   sprintf(summer_s, "Summer starts today around %02d:%02d %s", g_hours,g_minutes, out);
   i = set_holiday(SUMMER, g_month, g_day);
   if(i >= 0) holiday[i].text = &summer_s[0];

   adjust_season(fall);
   sprintf(autumn_s, "Autumn starts today around %02d:%02d %s", g_hours,g_minutes,out);
   i = set_holiday(AUTUMN, g_month, g_day);
   if(i >= 0) holiday[i].text = &autumn_s[0];

   adjust_season(winter);
   sprintf(winter_s, "Winter starts today around %02d:%02d %s", g_hours,g_minutes,out);
   i = set_holiday(WINTER, g_month, g_day);
   if(i >= 0) holiday[i].text = &winter_s[0];

   t = chinese_ny();
   gregorian(0, t);
   sprintf(china_year, "Happy Chinese New Year!  It's the Year of the %s.", zodiac[this_year%12]);
// sprintf(china_year, "Happy Chinese New Year!  It's the Year of the %s.", zodiac[g_year%12]);
   i = set_holiday(CHINA_NY, g_month, g_day);
   if(i >= 0) holiday[i].text = &china_year[0];

   easter(this_year);     // a few easter based holidays

   if(dst_disabled() == 0) {    // daylight savings time days
      t = jdate(this_year, dst_start_month, dst_start_day) - 1.0;
      gregorian(0, t);
      set_holiday(CLOCK_FWD, g_month, g_day);

      t = jdate(this_year, dst_end_month, dst_end_day) - 1.0;
      gregorian(0, t);
      set_holiday(CLOCK_BACK, g_month, g_day);
   }
   else {  // disable DST message
      set_holiday(CLOCK_FWD, 3, 0);
      set_holiday(CLOCK_BACK, 11, 0);
   }

   // grandprents day
   gd = nth_dow_in(1, 1, 9, this_year);  // first Monday in sept = Labor Day
   t = jdate(this_year, 9, gd) + 6.0;    // the next sunday
   gregorian(0, t);
   set_holiday(GRANNY, g_month, g_day);

   // election day
   gd = nth_dow_in(1, 1, 11, this_year) + 1;
   set_holiday(ELECTION, 11, gd);

   // tax days
   gd = tax_day(this_year,   4,  15);
   set_holiday(TAX_DAY,      4,  gd);
   gd = tax_day(this_year,   6,  15);
   set_holiday(Q2_TAXES,     6,  gd);
   gd = tax_day(this_year,   9,  15);
   set_holiday(Q3_TAXES,     9,  gd);
   gd = tax_day(this_year,   1,  15);
   set_holiday(Q4_TAXES,     1,  gd);
   gd = tax_day(this_year,   10, 15);
   set_holiday(FINAL_TAXES,  10, gd);

   // calculate approximate Islamic holidays (approximate since they can only
   // be offically determined by visual observation of the crescent moon)
   if(get_islam_day(this_year, 1, 1)) {    // Al-Hijra - new year
      set_holiday(AL_HIJRA, g_month, g_day);
   }

   if(get_islam_day(this_year, 1, 10)) {   // Asura
      set_holiday(ASURA, g_month, g_day);
   }

   if(get_islam_day(this_year, 9, 1)) {    // Ramadan - new year
      set_holiday(RAMADAN, g_month, g_day);
   }

   if(get_islam_day(this_year, 12, 10)) {  // Eid al Addha
      set_holiday(EID, g_month, g_day);
   }

   // calculate some jewish holidays
   rosh = rosh_jd(this_year);        // our reference is Rosh Hashahna 
                                     // once you know Rosh Hashahna,  all is revealed

   gregorian(0, rosh-1.0);              // Rosh Hashahna (party starts the night before)
   set_holiday(ROSH, g_month, g_day);

   gregorian(0, rosh+9.0-1.0);          // Yom Kipper is nine days after Rosh Hashanah
   set_holiday(YOM, g_month, g_day);

   po = rosh - 29.0 - 30.0 - 29.0 - 30.0 - 29.0 - 30.0;  // Julian date of Nisan 1
   purim = po - 29.0 + 13.0;   // Purim is Adar 14

   purim -= 1.0;               // start observance the night before
   gregorian(0, purim);
   set_holiday(PURIM, g_month, g_day);

   po += 14.0;                 // Passover is Nisan 15
   po -= 1.0;                  // but starts the night before
   gregorian(0, po);              // convert Julian passover to Gregorian terms
   set_holiday(PASSOVER, g_month, g_day);

   rosh += 30.0 + 29.0 + 24.0;   // Hanukkah is Kislev 25
   rosh -= 1.0;                  // start observance the night before
   gregorian(0, rosh);
   set_holiday(HANUKKAH, g_month, g_day);

   t = jtimes[9] + 14.0 - 1.0;   // 15 Tishrei
// rosh -= 1.0;                  // start observance the night before
   gregorian(0, t);
   set_holiday(SUKKOT, g_month, g_day);

   t = jtimes[5] + 5.0 - 1.0;    // 6 Sivan
// rosh -= 1.0;                  // start observance the night before
   gregorian(0, t);
   set_holiday(SHAVUOT, g_month, g_day);

// get_mayan_date();  // Mayan Tzolkin new year
// t = (360 - ((uinal * 20) + kin)) % 360;
// t += jdate(pri_year, pri_month, pri_day);
// gregorian(0, t);
// set_holiday(MAYAN_NY, g_month, g_day);

   t = jdate(2010,5,27);      // t = known Tzolkin new year
   t += (MAYAN_CORR-mayan_correlation);
   gregorian(0, jd_local);
   po = jdate(g_year,g_month,g_day);  // today
   m_year = 2010;
   while(m_year <= (this_year+2)) {  // find Mayan Tzolkin new year that starts on or after today
      if(t >= po) break;
      t += 260.0;
      ++m_year;
   }
   gregorian(0, t);
   set_holiday(MAYAN_NY, g_month, g_day);

   t = jdate(2012, 12, 20);
   t += (MAYAN_CORR-mayan_correlation);
   gregorian(0, t);
   if(g_year == this_year) set_holiday(DOOMSDAY, g_month, g_day);
   else                    set_holiday(DOOMSDAY, 0, 0);

   t = jdate(2009,10,7);      // t = known Aztec new year
   t += (double) aztec_epoch;
   gregorian(0, jd_local);
   po = jdate(g_year,g_month,g_day);  // today
   g_year = 2009;
   while(g_year <= (this_year+2)) {   // find Aztec new year that starts on or after today
      if(t >= po) break;
      t += 365.0;
      ++g_year;
   }
   gregorian(0, t);
   set_holiday(AZTEC_NY, g_month, g_day);

   if(this_year == 2038) set_holiday(UNIX_CLOCK, 1, 18);
   else                  set_holiday(UNIX_CLOCK, 0, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movsd 0x2930b4(%rip), %xmm0   # 0x364a88
callq 0xd223f
leaq 0x225cc8(%rip), %r15    # 0x2f76a8
movl (%r15), %edx
leaq 0x225cc2(%rip), %r12    # 0x2f76ac
movl (%r12), %ecx
leaq 0x29333b(%rip), %rbx    # 0x364d30
leaq 0x4d1f9(%rip), %rsi     # 0x11ebf5
leaq 0x25481d(%rip), %r8     # 0x326220
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x225c88(%rip), %rax    # 0x2f769c
movl (%rax), %esi
leaq 0x225c83(%rip), %rax    # 0x2f76a0
movl (%rax), %edx
pushq $0x64
popq %rdi
callq 0xd1911
leaq 0x83422(%rip), %r14     # 0x154e50
testl %eax, %eax
js 0xd1a3d
movl %eax, %eax
imulq $0x18, %rax, %rax
movq %rbx, 0x10(%rax,%r14)
movsd 0x29304b(%rip), %xmm0   # 0x364a90
callq 0xd223f
movl (%r15), %edx
movl (%r12), %ecx
leaq 0x293328(%rip), %rbx    # 0x364d80
leaq 0x4d1be(%rip), %rsi     # 0x11ec1d
leaq 0x2547ba(%rip), %r8     # 0x326220
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x225c25(%rip), %rax    # 0x2f769c
movl (%rax), %esi
leaq 0x225c20(%rip), %rax    # 0x2f76a0
movl (%rax), %edx
pushq $0x65
popq %rdi
callq 0xd1911
testl %eax, %eax
js 0xd1a99
movl %eax, %eax
imulq $0x18, %rax, %rax
movq %rbx, 0x10(%rax,%r14)
movsd 0x292ff7(%rip), %xmm0   # 0x364a98
callq 0xd223f
movl (%r15), %edx
movl (%r12), %ecx
leaq 0x29331c(%rip), %rbx    # 0x364dd0
leaq 0x4d18a(%rip), %rsi     # 0x11ec45
leaq 0x25475e(%rip), %r8     # 0x326220
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x225bc9(%rip), %rax    # 0x2f769c
movl (%rax), %esi
leaq 0x225bc4(%rip), %rax    # 0x2f76a0
movl (%rax), %edx
pushq $0x66
popq %rdi
callq 0xd1911
testl %eax, %eax
js 0xd1af5
movl %eax, %eax
imulq $0x18, %rax, %rax
movq %rbx, 0x10(%rax,%r14)
movsd 0x292fa3(%rip), %xmm0   # 0x364aa0
callq 0xd223f
movl (%r15), %edx
movl (%r12), %ecx
leaq 0x293310(%rip), %rbx    # 0x364e20
leaq 0x4d156(%rip), %rsi     # 0x11ec6d
leaq 0x254702(%rip), %r8     # 0x326220
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
leaq 0x225b6d(%rip), %r15    # 0x2f769c
movl (%r15), %esi
leaq 0x225b67(%rip), %rax    # 0x2f76a0
movl (%rax), %edx
pushq $0x67
popq %rdi
callq 0xd1911
testl %eax, %eax
js 0xd1b52
movl %eax, %eax
imulq $0x18, %rax, %rax
movq %rbx, 0x10(%rax,%r14)
callq 0xd172e
xorl %edi, %edi
callq 0xbfac2
leaq 0x2259bb(%rip), %rax    # 0x2f7520
movl (%rax), %eax
pushq $0xc
popq %rcx
cltd
idivl %ecx
movslq %edx, %rax
leaq 0x85529(%rip), %rcx     # 0x1570a0
movq (%rcx,%rax,8), %rdx
leaq 0x2932ee(%rip), %rbx    # 0x364e70
leaq 0x4d10c(%rip), %rsi     # 0x11ec95
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movl (%r15), %esi
leaq 0x225b03(%rip), %rax    # 0x2f76a0
movl (%rax), %edx
pushq $0x7b
popq %rdi
callq 0xd1911
testl %eax, %eax
js 0xd1bb6
movl %eax, %eax
imulq $0x18, %rax, %rax
movq %rbx, 0x10(%rax,%r14)
leaq 0x225963(%rip), %rbx    # 0x2f7520
movl (%rbx), %edi
callq 0xd9af0
callq 0xce6a7
testl %eax, %eax
je 0xd1bf0
pushq $0x6a
popq %rdi
pushq $0x3
popq %rsi
xorl %edx, %edx
callq 0xd1911
pushq $0x6b
popq %rdi
pushq $0xb
popq %rsi
xorl %edx, %edx
callq 0xd1911
leaq 0x225ab2(%rip), %r13    # 0x2f76a0
jmp 0xd1c59
movl (%rbx), %edi
movl 0x292e0c(%rip), %esi    # 0x364a04
movl 0x292e02(%rip), %edx    # 0x364a00
callq 0xc2f07
addsd 0x214ed(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r15), %esi
leaq 0x225a84(%rip), %r13    # 0x2f76a0
movl (%r13), %edx
pushq $0x6a
popq %rdi
callq 0xd1911
movl (%rbx), %edi
movl 0x292ddc(%rip), %esi    # 0x364a0c
movl 0x292dd2(%rip), %edx    # 0x364a08
callq 0xc2f07
addsd 0x214b5(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r15), %esi
movl (%r13), %edx
pushq $0x6b
popq %rdi
callq 0xd1911
movl (%rbx), %ecx
pushq $0x1
popq %rbx
pushq $0x9
popq %r14
movl %ebx, %edi
movl %ebx, %esi
movl %r14d, %edx
callq 0xcd819
leaq 0x2258ab(%rip), %rcx    # 0x2f7520
movl (%rcx), %edi
movl %r14d, %esi
movl %eax, %edx
callq 0xc2f07
addsd 0x36a8f(%rip), %xmm0    # 0x108718
xorl %edi, %edi
callq 0xbfac2
movl (%r15), %esi
movl (%r13), %edx
pushq $0x70
popq %rdi
callq 0xd1911
leaq 0x22587a(%rip), %rax    # 0x2f7520
movl (%rax), %ecx
pushq $0xb
popq %r15
movl %ebx, %edi
movl %ebx, %esi
movl %r15d, %edx
callq 0xcd819
leal 0x1(%rax), %edx
pushq $0x69
popq %rdi
movl %r15d, %esi
callq 0xd1911
leaq 0x225853(%rip), %rax    # 0x2f7520
movl (%rax), %edi
pushq $0x4
popq %r12
pushq $0xf
popq %r15
movl %r12d, %esi
movl %r15d, %edx
callq 0xda750
pushq $0x68
popq %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0xd1911
leaq 0x22582a(%rip), %rax    # 0x2f7520
movl (%rax), %edi
pushq $0x6
popq %r12
movl %r12d, %esi
movl %r15d, %edx
callq 0xda750
movl $0x82, %edi
movl %r12d, %esi
leaq 0x225986(%rip), %r12    # 0x2f769c
movl %eax, %edx
callq 0xd1911
leaq 0x2257fc(%rip), %rax    # 0x2f7520
movl (%rax), %edi
movl %r14d, %esi
movl %r15d, %edx
callq 0xda750
movl $0x83, %edi
movl %r14d, %esi
movl %eax, %edx
callq 0xd1911
leaq 0x2257d9(%rip), %rax    # 0x2f7520
movl (%rax), %edi
movl %ebx, %esi
movl %r15d, %edx
callq 0xda750
movl $0x81, %edi
movl %ebx, %esi
movl %eax, %edx
callq 0xd1911
leaq 0x2257b8(%rip), %rax    # 0x2f7520
movl (%rax), %edi
pushq $0xa
popq %r14
movl %r14d, %esi
movl %r15d, %edx
callq 0xda750
movl $0x84, %edi
movl %r14d, %esi
leaq 0x225798(%rip), %r14    # 0x2f7520
movl %eax, %edx
callq 0xd1911
movl (%r14), %edi
movl %ebx, %esi
movl %ebx, %edx
callq 0xda207
testl %eax, %eax
je 0xd1daf
movl (%r12), %esi
movl (%r13), %edx
pushq $0x77
popq %rdi
callq 0xd1911
movl (%r14), %edi
pushq $0x1
popq %rsi
pushq $0xa
popq %rdx
callq 0xda207
testl %eax, %eax
je 0xd1dd1
movl (%r12), %esi
movl (%r13), %edx
pushq $0x78
popq %rdi
callq 0xd1911
movl (%r14), %edi
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0xda207
testl %eax, %eax
je 0xd1df3
movl (%r12), %esi
movl (%r13), %edx
pushq $0x79
popq %rdi
callq 0xd1911
movl (%r14), %edi
pushq $0xc
popq %rsi
pushq $0xa
popq %rdx
callq 0xda207
testl %eax, %eax
je 0xd1e15
movl (%r12), %esi
movl (%r13), %edx
pushq $0x7a
popq %rdi
callq 0xd1911
movl (%r14), %edi
callq 0xd9c6f
movsd %xmm0, -0x30(%rbp)
addsd 0x212ce(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
pushq $0x71
popq %rdi
callq 0xd1911
movsd 0x36937(%rip), %xmm0    # 0x108780
addsd -0x30(%rbp), %xmm0
addsd 0x212a2(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
pushq $0x72
popq %rdi
callq 0xd1911
movsd 0x43ccb(%rip), %xmm0    # 0x115b40
movsd -0x30(%rbp), %xmm2
addsd %xmm0, %xmm2
movsd 0x43cc2(%rip), %xmm1    # 0x115b48
addsd %xmm1, %xmm2
addsd %xmm0, %xmm2
addsd %xmm1, %xmm2
addsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, -0x38(%rbp)
addsd %xmm2, %xmm0
addsd 0x43a05(%rip), %xmm0    # 0x1158b0
addsd 0x21245(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
pushq $0x75
popq %rdi
callq 0xd1911
movsd -0x38(%rbp), %xmm0
addsd 0x43c79(%rip), %xmm0    # 0x115b50
addsd 0x21219(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
pushq $0x73
popq %rdi
callq 0xd1911
movsd -0x30(%rbp), %xmm0
addsd 0x43c55(%rip), %xmm0    # 0x115b58
addsd 0x211ed(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
pushq $0x74
popq %rdi
callq 0xd1911
movsd 0x43c26(%rip), %xmm0    # 0x115b50
addsd 0x292fd6(%rip), %xmm0   # 0x364f08
addsd 0x211be(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
pushq $0x7f
popq %rdi
callq 0xd1911
movsd 0x292f8f(%rip), %xmm0   # 0x364ee8
addsd 0x211df(%rip), %xmm0    # 0xf3140
addsd 0x2118f(%rip), %xmm0    # 0xf30f8
xorl %edi, %edi
callq 0xbfac2
movl (%r12), %esi
movl (%r13), %edx
movl $0x80, %edi
callq 0xd1911
leaq 0x1334af(%rip), %r15    # 0x205438
movl $0x8ea5b, %eax          # imm = 0x8EA5B
subq (%r15), %rax
cvtsi2sd %rax, %xmm0
addsd 0x43bc2(%rip), %xmm0    # 0x115b60
movsd %xmm0, -0x30(%rbp)
leaq 0x22559e(%rip), %rax    # 0x2f7548
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xbfac2
leaq 0x2256e8(%rip), %rbx    # 0x2f76a4
movl (%rbx), %edi
movl (%r12), %esi
movl (%r13), %edx
callq 0xc2f07
movsd -0x30(%rbp), %xmm2
movl (%r14), %eax
addl $0x2, %eax
movl $0x7da, %ecx            # imm = 0x7DA
movsd 0x43b9d(%rip), %xmm1    # 0x115b80
cmpl %eax, %ecx
jg 0xd1ff5
ucomisd %xmm0, %xmm2
jae 0xd1ff5
addsd %xmm1, %xmm2
incl %ecx
jmp 0xd1fe3
xorl %edi, %edi
movapd %xmm2, %xmm0
callq 0xbfac2
movl (%r12), %esi
leaq 0x225695(%rip), %r13    # 0x2f76a0
movl (%r13), %edx
pushq $0x7c
popq %rdi
callq 0xd1911
movl $0x8ea5b, %eax          # imm = 0x8EA5B
subq (%r15), %rax
cvtsi2sd %rax, %xmm0
addsd 0x43b3c(%rip), %xmm0    # 0x115b68
xorl %edi, %edi
callq 0xbfac2
movl (%rbx), %eax
leaq 0x2254e4(%rip), %rcx    # 0x2f7520
cmpl (%rcx), %eax
jne 0xd204d
movl (%r12), %esi
movl (%r13), %edx
pushq $0x7e
popq %rdi
jmp 0xd2054
pushq $0x7e
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xd1911
movq %r13, %r15
leaq 0x1333dd(%rip), %rax    # 0x205440
cvtsi2sdq (%rax), %xmm0
addsd 0x43b00(%rip), %xmm0    # 0x115b70
movsd %xmm0, -0x30(%rbp)
leaq 0x2254cc(%rip), %rax    # 0x2f7548
movsd (%rax), %xmm0
xorl %edi, %edi
callq 0xbfac2
movl (%rbx), %edi
movl (%r12), %esi
movl (%r13), %edx
callq 0xc2f07
movsd -0x30(%rbp), %xmm2
leaq 0x22547e(%rip), %r14    # 0x2f7520
movl (%r14), %eax
addl $0x2, %eax
movl $0x7d9, %ecx            # imm = 0x7D9
movsd 0x43ac3(%rip), %xmm1    # 0x115b78
cmpl %eax, %ecx
jg 0xd20c7
ucomisd %xmm0, %xmm2
jae 0xd20c7
addsd %xmm1, %xmm2
incl %ecx
jmp 0xd20b5
movl %ecx, (%rbx)
xorl %edi, %edi
movapd %xmm2, %xmm0
callq 0xbfac2
movl (%r12), %esi
movl (%r15), %edx
pushq $0x7d
popq %rdi
callq 0xd1911
cmpl $0x7f6, (%r14)          # imm = 0x7F6
jne 0xd20f9
pushq $0x1
popq %rsi
pushq $0x12
popq %rdx
movl $0x85, %edi
jmp 0xd2102
movl $0x85, %edi
xorl %esi, %esi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd1911