// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
je 0x47588
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 0x473a3
leaq 0xb481(%rip), %rsi      # 0x52822
jmp 0x473c5
movq %r12, %rdi
movl $0x3a, %esi
callq 0x3130
testq %rax, %rax
leaq 0xb495(%rip), %rax      # 0x5284f
leaq 0xb477(%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 0x3290
addq $0x20, %rsp
movl %eax, %ebp
cmpl $0x5, %eax
jle 0x47497
movl 0x24(%rsp), %eax
leal -0x76c(%rax), %ecx
cmpl $0x1, %eax
movl $0x46, %eax
cmovnel %ecx, %eax
movl %eax, 0x24(%rsp)
decl 0x20(%rsp)
cmpb $0x2e, 0x50(%rsp)
jne 0x47441
leaq 0x50(%rsp), %r15
movb 0x1(%r15), %al
incq %r15
addb $-0x3a, %al
cmpb $-0xb, %al
ja 0x47434
movzbl (%r15), %eax
testl %eax, %eax
je 0x4756a
cmpl $0x2d, %eax
je 0x4745b
cmpl $0x2b, %eax
jne 0x4755e
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movl %eax, 0x8(%rsp)
cmpb $0x3a, 0x3(%r15)
jne 0x474a6
leaq 0xb3f4(%rip), %rsi      # 0x52867
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %rcx
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3290
cmpl $0x0, (%r12)
jns 0x474d8
negl 0x8(%rsp)
jmp 0x474d8
movl $0x4, 0x19214(%rbx)
jmp 0x4757e
movq %r15, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3220
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
movl %ecx, 0xc(%rsp)
imull $0x64, %ecx, %ecx
subl %ecx, %eax
movl %eax, 0x8(%rsp)
movl 0x14(%rsp), %ecx
subl 0x8(%rsp), %ecx
movl 0x18(%rsp), %eax
subl 0xc(%rsp), %eax
movslq %ecx, %rcx
imulq $-0x77777777, %rcx, %rdx # imm = 0x88888889
shrq $0x20, %rdx
addl %ecx, %edx
movl %edx, %esi
shrl $0x1f, %esi
sarl $0x5, %edx
addl %esi, %edx
addl %edx, %eax
movl %eax, 0x18(%rsp)
imull $0x3c, %edx, %edx
subl %edx, %ecx
movl %ecx, 0x14(%rsp)
jns 0x47520
addl $0x3c, %ecx
movl %ecx, 0x14(%rsp)
decl %eax
movl %eax, 0x18(%rsp)
movslq 0x18(%rsp), %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 0x4755e
addl $0x18, %eax
movl %eax, 0x18(%rsp)
decl %ecx
movl %ecx, 0x1c(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x47214
jmp 0x4757b
leaq 0x10(%rsp), %rdi
movl $0xffffffff, 0x20(%rdi) # imm = 0xFFFFFFFF
callq 0x32c0
movq %rax, (%r14)
movl $0x4, %eax
cmpl $0x6, %ebp
jl 0x4758e
movl 0x19214(%rbx), %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq