// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: set_time_zone(char*)
void set_time_zone(char *s)
{
char c;

   time_zone_set = 0;

   use_loran = use_gps = use_utc = 0;
   use_gmst = use_lmst = 0;
   use_tai = use_tt = use_ut1 = use_tcg = use_tdb = use_tcb = use_hjd = use_bessel = 0;
   use_msd = use_ven = use_merc = use_pluto = 0;

   tz_string[0] = dst_string[0] = 0;
   if(s == 0) return;

   if((s[0] == 0) || (s[0] == 0x0A) || (s[0] == 0x0D)) {  // clear time zone
      return;
   }

   if(s[0] == ':') return;  // Linux :... time zone string

   // set time zone
   strcpy(std_string, "LOCAL");
   dst_string[0] = 0;
   strcpy(tz_string, dst_string);

   time_zone_set = 1;
   tz_sign = 1;
   time_zone_hours = 0;
   time_zone_minutes = 0;
   time_zone_seconds = 0;
   tz_adjust = 0.0;

   while(*s) {  // find first char of time zone string
      c = *s;
      if(c == 0)    { break; }
      if(c == '>')  { break; }
      if(c == '<')  { ++s; continue; }
      if(c == ' ')  { ++s; continue; }
      if(c == '\t') { ++s; continue; }
      if(c == '=')  { ++s; continue; }

      if((c == '+') || (c == '-') || isdigit(c)) {  // tz string is -6CST/CDT format
         s = get_tz_value(s);
         if(s) s = get_std_zone(s, 0);
         if(s) {
            if(*s == '/') get_dst_zone(s+1);
         }
      }
      else {   // string is in CST6CDT format
         s = get_std_zone(s, 1);
         if(s) {
            tz_sign = (-1);
            s = get_tz_value(s);
         }
         if(s) get_dst_zone(s);
      }
      break;
   }

   if     (!strcmp(std_string, "SST"))   solar_time = 1;
   else if(!strcmp(dst_string, "SDT"))   solar_time = 1;
   else if(!strcmp(std_string, "SOL"))   solar_time = 1;
   else if(!strcmp(dst_string, "SOL"))   solar_time = 1;
   else if(!strcmp(std_string, "SOLAR")) solar_time = 1;
   else if(!strcmp(dst_string, "SOLAR")) solar_time = 1;
   else                                  solar_time = 0;

   if(user_set_watch_name == 0) {
      if(solar_time) {
         set_watch_name("Solar");
         label_watch_face = 1;
      }
      else {
         watch_name[0] = 0;
         label_watch_face = 1;
      }
   }

   if     (!strcmp(std_string, "LMST"))  use_lmst = 1;   // sidereal times
   else if(!strcmp(std_string, "LAST"))  use_lmst = 2;
   else if(!strcmp(std_string, "GMST"))  use_gmst = 1;
   else if(!strcmp(std_string, "GAST"))  use_gmst = 2;

   else if(!strcmp(std_string, "TAI"))   use_tai = 1;    // astronomical times
   else if(!strcmp(std_string, "TCG"))   use_tcg = 1;
   else if(!strcmp(std_string, "TCB"))   use_tcb = 1;
   else if(!strcmp(std_string, "TDB"))   use_tdb = 1;
   else if(!strcmp(std_string, "TDT"))   use_tt = 1;
   else if(!strcmp(std_string, "TT"))    use_tt = 1;
   else if(!strcmp(std_string, "UT"))    use_ut1 = 1;
   else if(!strcmp(std_string, "UT1"))   use_ut1 = 1;
   else if(!strcmp(std_string, "HJD"))   use_hjd = 1;
   else if(!strcmp(std_string, "BES"))   use_bessel= 1;

   else if(!strcmp(std_string, "UTC"))   use_utc = 1;    // various nav system times
   else if(!strcmp(std_string, "GPS"))   use_gps = 1;
   else if(!strcmp(std_string, "GPST"))  use_gps = 1;
   else if(!strcmp(std_string, "LOR"))   use_loran = 1;
   else if(!strcmp(std_string, "LORAN")) use_loran = 1;

   else if(!strcmp(std_string, "MAR"))   use_msd = 1;    // various names of Mars time
   else if(!strcmp(std_string, "MARS"))  use_msd = 1;  
   else if(!strcmp(std_string, "MARSD")) use_msd = 1;  
   else if(!strcmp(std_string, "MSD"))   use_msd = 1;  
   else if(!strcmp(std_string, "MTC"))   use_msd = 1;  
   else if(!strcmp(std_string, "AMT"))   use_msd = 1;  

   else if(!strcmp(std_string, "MER"))   use_merc = 1;   // planetary times
   else if(!strcmp(std_string, "PLU"))   use_pluto = 1;
   else if(!strcmp(std_string, "VEN"))   use_ven = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x2274a3(%rip), %r13    # 0x2f7894
xorl %eax, %eax
movb %al, (%r13)
leaq 0x22750d(%rip), %rcx    # 0x2f790b
movb %al, (%rcx)
leaq 0x227503(%rip), %rcx    # 0x2f790a
movb %al, (%rcx)
leaq 0x2274f9(%rip), %rcx    # 0x2f7909
movb %al, (%rcx)
leaq 0x2274e8(%rip), %r12    # 0x2f7901
movb %al, (%r12)
leaq 0x2274dc(%rip), %rcx    # 0x2f7900
movb %al, (%rcx)
leaq 0x2274e3(%rip), %rcx    # 0x2f7910
movb %al, (%rcx)
leaq 0x2274d2(%rip), %rcx    # 0x2f7908
movb %al, (%rcx)
leaq 0x2274c8(%rip), %rcx    # 0x2f7907
movb %al, (%rcx)
leaq 0x2274be(%rip), %rcx    # 0x2f7906
movb %al, (%rcx)
leaq 0x2274df(%rip), %rcx    # 0x2f7930
movb %al, (%rcx)
leaq 0x2274ab(%rip), %rcx    # 0x2f7905
movb %al, (%rcx)
leaq 0x22749f(%rip), %rcx    # 0x2f7902
movb %al, (%rcx)
leaq 0x227498(%rip), %rcx    # 0x2f7904
movb %al, (%rcx)
leaq 0x22748e(%rip), %r15    # 0x2f7903
movb %al, (%r15)
leaq 0x227490(%rip), %rcx    # 0x2f790f
movb %al, (%rcx)
leaq 0x227485(%rip), %rcx    # 0x2f790d
movb %al, (%rcx)
leaq 0x22747d(%rip), %rcx    # 0x2f790e
movb %al, (%rcx)
leaq 0x227472(%rip), %rcx    # 0x2f790c
movb %al, (%rcx)
leaq 0x227485(%rip), %rbx    # 0x2f7928
movb %al, (%rbx)
testq %rdi, %rdi
je 0xd04c6
movq %rdi, %r14
movzbl (%rdi), %eax
cmpq $0x3a, %rax
ja 0xd04d5
movabsq $0x400000000002401, %rcx # imm = 0x400000000002401
btq %rax, %rcx
jae 0xd04d5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x227444(%rip), %rax    # 0x2f7920
movw $0x4c, 0x4(%rax)
movl $0x41434f4c, (%rax)     # imm = 0x41434F4C
movb $0x0, (%rbx)
leaq 0x22743e(%rip), %rdi    # 0x2f7930
movq %rbx, %rsi
callq 0x9330
movb $0x1, (%r13)
leaq 0x227392(%rip), %r13    # 0x2f7898
movl $0x1, (%r13)
leaq 0x227373(%rip), %rax    # 0x2f7888
andl $0x0, (%rax)
leaq 0x22736d(%rip), %rax    # 0x2f788c
andl $0x0, (%rax)
leaq 0x227367(%rip), %rax    # 0x2f7890
andl $0x0, (%rax)
leaq 0x22734d(%rip), %rax    # 0x2f7880
andq $0x0, (%rax)
movabsq $0x3000000100000200, %rcx # imm = 0x3000000100000200
movzbl (%r14), %eax
cmpq $0x3e, %rax
ja 0xd0576
btq %rax, %rcx
jae 0xd0556
incq %r14
jmp 0xd0541
movabsq $0x280000000000, %rcx   # imm = 0x280000000000
btq %rax, %rcx
jb 0xd0581
movabsq $0x4000000000000001, %rcx # imm = 0x4000000000000001
btq %rax, %rcx
jb 0xd05d1
movsbl %al, %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0xd05a7
movq %r14, %rdi
callq 0xd00b4
testq %rax, %rax
je 0xd05d1
movq %rax, %rdi
xorl %esi, %esi
callq 0xd01f6
testq %rax, %rax
je 0xd05d1
cmpb $0x2f, (%rax)
jne 0xd05d1
incq %rax
jmp 0xd05c9
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xd01f6
testq %rax, %rax
je 0xd05d1
orl $-0x1, (%r13)
movq %rax, %rdi
callq 0xd00b4
testq %rax, %rax
je 0xd05d1
movq %rax, %rdi
callq 0xd02d2
leaq 0x227348(%rip), %rax    # 0x2f7920
cmpl $0x545353, (%rax)       # imm = 0x545353
je 0xd064e
cmpl $0x544453, (%rbx)       # imm = 0x544453
je 0xd064e
cmpl $0x4c4f53, (%rax)       # imm = 0x4C4F53
je 0xd064e
cmpl $0x4c4f53, (%rbx)       # imm = 0x4C4F53
je 0xd064e
leaq 0x227321(%rip), %rdi    # 0x2f7920
leaq 0x37b31(%rip), %rsi     # 0x108137
pushq $0x6
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd064e
leaq 0x22730f(%rip), %rdi    # 0x2f7928
leaq 0x37b17(%rip), %rsi     # 0x108137
pushq $0x6
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd064e
leaq 0x2272de(%rip), %rax    # 0x2f7911
movb $0x0, (%rax)
leaq 0x2580f3(%rip), %rax    # 0x328730
cmpb $0x0, (%rax)
jne 0xd067a
leaq 0x2580a7(%rip), %rax    # 0x3286f0
movb $0x0, (%rax)
jmp 0xd0670
leaq 0x2272bc(%rip), %rax    # 0x2f7911
movb $0x1, (%rax)
leaq 0x2580d1(%rip), %rax    # 0x328730
cmpb $0x0, (%rax)
jne 0xd067a
leaq 0x37ad2(%rip), %rdi     # 0x10813d
callq 0x436d9
leaq 0x2580b8(%rip), %rax    # 0x32872f
movb $0x1, (%rax)
leaq 0x22729f(%rip), %rdi    # 0x2f7920
leaq 0x4d48b(%rip), %rsi     # 0x11db13
pushq $0x5
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd089d
leaq 0x227281(%rip), %rdi    # 0x2f7920
leaq 0x4d472(%rip), %rsi     # 0x11db18
pushq $0x5
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd08a7
leaq 0x227263(%rip), %rdi    # 0x2f7920
leaq 0x4d459(%rip), %rsi     # 0x11db1d
pushq $0x5
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd08b1
leaq 0x227245(%rip), %rbx    # 0x2f7920
leaq 0x4d440(%rip), %rsi     # 0x11db22
pushq $0x5
popq %rdx
movq %rbx, %rdi
callq 0x9380
testl %eax, %eax
je 0xd08c0
cmpl $0x494154, (%rbx)       # imm = 0x494154
je 0xd08cf
cmpl $0x474354, (%rbx)       # imm = 0x474354
je 0xd08d8
cmpl $0x424354, (%rbx)       # imm = 0x424354
je 0xd08e1
cmpl $0x424454, (%rbx)       # imm = 0x424454
je 0xd08f3
cmpl $0x544454, (%rbx)       # imm = 0x544454
je 0xd08ea
leaq 0x2271e8(%rip), %rdi    # 0x2f7920
leaq 0x3f15a(%rip), %rsi     # 0x10f899
pushq $0x3
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd08ea
leaq 0x2271ca(%rip), %rbx    # 0x2f7920
leaq 0x3fc20(%rip), %rsi     # 0x11037d
pushq $0x3
popq %rdx
movq %rbx, %rdi
callq 0x9380
testl %eax, %eax
je 0xd08fc
cmpl $0x315455, (%rbx)       # imm = 0x315455
leaq 0x227185(%rip), %rax    # 0x2f7902
je 0xd08b8
cmpl $0x444a48, (%rbx)       # imm = 0x444A48
je 0xd0905
cmpl $0x534542, (%rbx)       # imm = 0x534542
je 0xd090e
cmpl $0x435455, (%rbx)       # imm = 0x435455
je 0xd0920
cmpl $0x535047, (%rbx)       # imm = 0x535047
je 0xd0917
leaq 0x227166(%rip), %rbx    # 0x2f7920
leaq 0x4d386(%rip), %rsi     # 0x11db47
pushq $0x5
popq %rdx
movq %rbx, %rdi
callq 0x9380
testl %eax, %eax
je 0xd0917
cmpl $0x524f4c, (%rbx)       # imm = 0x524F4C
je 0xd0929
leaq 0x227139(%rip), %rbx    # 0x2f7920
leaq 0x4d362(%rip), %rsi     # 0x11db50
pushq $0x6
popq %rdx
movq %rbx, %rdi
callq 0x9380
testl %eax, %eax
je 0xd0929
cmpl $0x52414d, (%rbx)       # imm = 0x52414D
je 0xd0932
leaq 0x22710c(%rip), %rdi    # 0x2f7920
leaq 0x4d33f(%rip), %rsi     # 0x11db5a
pushq $0x5
popq %rdx
callq 0x9380
testl %eax, %eax
je 0xd0932
leaq 0x2270ee(%rip), %rbx    # 0x2f7920
leaq 0x4d326(%rip), %rsi     # 0x11db5f
pushq $0x6
popq %rdx
movq %rbx, %rdi
callq 0x9380
testl %eax, %eax
je 0xd0932
cmpl $0x44534d, (%rbx)       # imm = 0x44534D
je 0xd0932
cmpl $0x43544d, (%rbx)       # imm = 0x43544D
je 0xd0932
cmpl $0x544d41, (%rbx)       # imm = 0x544D41
je 0xd0932
cmpl $0x52454d, (%rbx)       # imm = 0x52454D
je 0xd093e
cmpl $0x554c50, (%rbx)       # imm = 0x554C50
je 0xd094a
cmpl $0x4e4556, (%rbx)       # imm = 0x4E4556
leaq 0x227079(%rip), %rax    # 0x2f790e
jne 0xd04c6
jmp 0xd08b8
movb $0x1, (%r12)
jmp 0xd04c6
movb $0x2, (%r12)
jmp 0xd04c6
leaq 0x227048(%rip), %rax    # 0x2f7900
movb $0x1, (%rax)
jmp 0xd04c6
leaq 0x227039(%rip), %rax    # 0x2f7900
movb $0x2, (%rax)
jmp 0xd04c6
movb $0x1, (%r15)
jmp 0xd04c6
leaq 0x227026(%rip), %rax    # 0x2f7905
jmp 0xd08b8
leaq 0x22701f(%rip), %rax    # 0x2f7907
jmp 0xd08b8
leaq 0x227013(%rip), %rax    # 0x2f7904
jmp 0xd08b8
leaq 0x22700c(%rip), %rax    # 0x2f7906
jmp 0xd08b8
leaq 0x226fff(%rip), %rax    # 0x2f7902
jmp 0xd08b8
leaq 0x226ffc(%rip), %rax    # 0x2f7908
jmp 0xd08b8
leaq 0x226ffb(%rip), %rax    # 0x2f7910
jmp 0xd08b8
leaq 0x226fec(%rip), %rax    # 0x2f790a
jmp 0xd08b8
leaq 0x226fe4(%rip), %rax    # 0x2f790b
jmp 0xd08b8
leaq 0x226fd9(%rip), %rax    # 0x2f7909
jmp 0xd08b8
leaq 0x226fd3(%rip), %rax    # 0x2f790c
jmp 0xd08b8
leaq 0x226fc8(%rip), %rax    # 0x2f790d
jmp 0xd08b8
leaq 0x226fbe(%rip), %rax    # 0x2f790f
jmp 0xd08b8