// File: /workspace/github_c_makefile_star2_O3/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_s2dateTime
SOAP_FMAC2
soap_s2dateTime(struct soap *soap, const char *s, time_t *p)
{ if (s)
  { char zone[32];
    struct tm T;
    const char *t;
    *zone = '\0';
    memset((void*)&T, 0, sizeof(T));
    if (strchr(s, '-'))
      t = "%d-%d-%dT%d:%d:%d%31s";
    else if (strchr(s, ':'))
      t = "%4d%2d%2dT%d:%d:%d%31s";
    else /* parse non-XSD-standard alternative ISO 8601 format */
      t = "%4d%2d%2dT%2d%2d%2d%31s";
    if (sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone) < 6)
      return soap->error = SOAP_TYPE;
    if (T.tm_year == 1)
      T.tm_year = 70;
    else
      T.tm_year -= 1900;
    T.tm_mon--;
    if (*zone == '.')
    { for (s = zone + 1; *s; s++)
        if (*s < '0' || *s > '9')
          break;
    }
    else
      s = zone;
    if (*s)
    {
#ifndef WITH_NOZONE
      if (*s == '+' || *s == '-')
      { int h = 0, m = 0;
        if (s[3] == ':')
        { /* +hh:mm */
	  sscanf(s, "%d:%d", &h, &m);
          if (h < 0)
            m = -m;
        }
        else /* +hhmm */
        { m = (int)soap_strtol(s, NULL, 10);
          h = m / 100;
          m = m % 100;
        }
	T.tm_min -= m;
	T.tm_hour -= h;
	/* put hour and min in range */
        T.tm_hour += T.tm_min / 60;
        T.tm_min %= 60;
        if (T.tm_min < 0)
        { T.tm_min += 60;
	  T.tm_hour--;
	}
        T.tm_mday += T.tm_hour / 24;
        T.tm_hour %= 24;
        if (T.tm_hour < 0)
        { T.tm_hour += 24;
          T.tm_mday--;
	}
	/* note: day of the month may be out of range, timegm() handles it */
      }
#endif
      *p = soap_timegm(&T);
    }
    else /* no UTC or timezone, so assume we got a localtime */
    { T.tm_isdst = -1;
      *p = mktime(&T);
    }
  }
  return soap->error;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
je 0x46f3a
movq %rdx, %r14
movq %rsi, %r12
movb $0x0, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq %rsi, %rdi
movl $0x2d, %esi
callq 0x3130
testq %rax, %rax
je 0x46d61
leaq 0xbac3(%rip), %rsi      # 0x52822
jmp 0x46d83
movq %r12, %rdi
movl $0x3a, %esi
callq 0x3130
testq %rax, %rax
leaq 0xbad7(%rip), %rax      # 0x5284f
leaq 0xbab9(%rip), %rsi      # 0x52838
cmoveq %rax, %rsi
leaq 0x24(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
leaq 0x14(%rsp), %r10
subq $0x8, %rsp
leaq 0x58(%rsp), %r15
leaq 0x18(%rsp), %r11
movq %r12, %rdi
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
callq 0x32a0
addq $0x20, %rsp
cmpl $0x5, %eax
jle 0x46e5b
movl 0x24(%rsp), %eax
leal -0x76c(%rax), %ecx
cmpl $0x1, %eax
movl $0x46, %eax
cmovnel %ecx, %eax
movl %eax, 0x24(%rsp)
decl 0x20(%rsp)
movb 0x50(%rsp), %al
cmpb $0x2e, %al
jne 0x46e00
leaq 0x50(%rsp), %r15
movb 0x1(%r15), %al
incq %r15
leal -0x3a(%rax), %ecx
cmpb $-0xb, %cl
ja 0x46df1
testb %al, %al
je 0x46f26
movzbl %al, %eax
cmpl $0x2d, %eax
je 0x46e19
cmpl $0x2b, %eax
jne 0x46f1a
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movl %eax, 0x8(%rsp)
cmpb $0x3a, 0x3(%r15)
jne 0x46e6f
leaq 0xba36(%rip), %rsi      # 0x52867
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x32a0
movl (%r12), %eax
movl (%r13), %ecx
testl %eax, %eax
jns 0x46ea2
negl %ecx
jmp 0x46e9e
movl $0x4, 0x19214(%rbx)
movl $0x4, %eax
jmp 0x46f40
movq %r15, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3230
movslq %eax, %rcx
imulq $0x51eb851f, %rcx, %rax # imm = 0x51EB851F
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rax
addl %edx, %eax
movl %eax, 0xc(%rsp)
imull $0x64, %eax, %edx
subl %edx, %ecx
movl %ecx, 0x8(%rsp)
movl 0x14(%rsp), %edx
subl %ecx, %edx
movl 0x18(%rsp), %ecx
subl %eax, %ecx
movslq %edx, %rax
imulq $-0x77777777, %rax, %rdx # imm = 0x88888889
shrq $0x20, %rdx
addl %eax, %edx
movl %edx, %esi
shrl $0x1f, %esi
sarl $0x5, %edx
addl %esi, %edx
addl %edx, %ecx
imull $0x3c, %edx, %edx
subl %edx, %eax
movl %eax, 0x14(%rsp)
jns 0x46ede
addl $0x3c, %eax
movl %eax, 0x14(%rsp)
decl %ecx
movslq %ecx, %rax
imulq $0x2aaaaaab, %rax, %rdx # imm = 0x2AAAAAAB
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x22, %rdx
addl %ecx, %edx
movl 0x1c(%rsp), %ecx
addl %edx, %ecx
movl %ecx, 0x1c(%rsp)
shll $0x3, %edx
leal (%rdx,%rdx,2), %edx
subl %edx, %eax
movl %eax, 0x18(%rsp)
jns 0x46f1a
addl $0x18, %eax
movl %eax, 0x18(%rsp)
decl %ecx
movl %ecx, 0x1c(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x46bd1
jmp 0x46f37
leaq 0x10(%rsp), %rdi
movl $0xffffffff, 0x20(%rdi) # imm = 0xFFFFFFFF
callq 0x32d0
movq %rax, (%r14)
movl 0x19214(%rbx), %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq