// File: /workspace/github_c_makefile_star2_O2/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 0x42991
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)
andq $0x0, 0x40(%rsp)
pushq $0x2d
popq %rsi
movq %r12, %rdi
callq 0x3130
testq %rax, %rax
je 0x42807
leaq 0xb01d(%rip), %rsi      # 0x4d822
jmp 0x42827
pushq $0x3a
popq %rsi
movq %r12, %rdi
callq 0x3130
testq %rax, %rax
leaq 0xb033(%rip), %rax      # 0x4d84f
leaq 0xb015(%rip), %rsi      # 0x4d838
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 0x428fd
movl 0x24(%rsp), %eax
leal -0x76c(%rax), %ecx
cmpl $0x1, %eax
pushq $0x46
popq %rax
cmovnel %ecx, %eax
movl %eax, 0x24(%rsp)
decl 0x20(%rsp)
movb 0x50(%rsp), %al
cmpb $0x2e, %al
jne 0x428a2
leaq 0x50(%rsp), %r15
movb 0x1(%r15), %al
incq %r15
leal -0x3a(%rax), %ecx
cmpb $-0xb, %cl
ja 0x42893
testb %al, %al
je 0x42980
movzbl %al, %eax
cmpl $0x2d, %eax
je 0x428bb
cmpl $0x2b, %eax
jne 0x42974
andl $0x0, 0xc(%rsp)
andl $0x0, 0x8(%rsp)
cmpb $0x3a, 0x3(%r15)
jne 0x4290f
leaq 0xaf94(%rip), %rsi      # 0x4d867
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x32a0
movl (%r12), %ecx
movl (%r13), %edx
testl %ecx, %ecx
jns 0x4292c
negl %edx
jmp 0x42928
movl $0x4, 0x19214(%rbx)
pushq $0x4
popq %rax
jmp 0x42997
pushq $0xa
popq %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3230
pushq $0x64
popq %rcx
cltd
idivl %ecx
movl %eax, %ecx
movl %eax, 0xc(%rsp)
movl %edx, 0x8(%rsp)
movl 0x14(%rsp), %eax
subl %edx, %eax
movl 0x18(%rsp), %esi
pushq $0x3c
popq %rdi
cltd
idivl %edi
subl %ecx, %esi
addl %esi, %eax
movl %edx, 0x14(%rsp)
testl %edx, %edx
jns 0x42951
addl $0x3c, %edx
movl %edx, 0x14(%rsp)
decl %eax
pushq $0x18
popq %rcx
cltd
idivl %ecx
addl 0x1c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
testl %edx, %edx
jns 0x42974
addl $0x18, %edx
movl %edx, 0x18(%rsp)
decl %eax
movl %eax, 0x1c(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x42683
jmp 0x4298e
leaq 0x10(%rsp), %rdi
orl $-0x1, 0x20(%rdi)
callq 0x32e0
movq %rax, (%r14)
movl 0x19214(%rbx), %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq