// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/lib/common.c
// Function: dateAddTo
char *dateAddTo(char *date,char *format,int addYears,int addMonths,int addDays)
/* Add years,months,days to a formatted date and returns the new date as a cloned string
*  format is a strptime/strftime format: %F = yyyy-mm-dd */
{
char *newDate = needMem(12);
struct tm tp;
if (strptime(date,format, &tp))
    {
    dateAdd(&tp,addYears,addMonths,addDays); // tp.tm_year only contains years since 1900
    strftime(newDate,12,format,&tp);
    }
return cloneString(newDate);  // newDate is never freed!
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %r13
movl $0xc, %edi
callq 0xf07d
movq %rax, %rbx
movq %rsp, %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x3730
testq %rax, %rax
je 0xaafd
addl 0xc(%rsp), %ebp
movl %ebp, 0xc(%rsp)
addl 0x10(%rsp), %r12d
movl %r12d, 0x10(%rsp)
addl 0x14(%rsp), %r15d
movl %r15d, 0x14(%rsp)
movl $0x1c, %edi
movl $0xaaaaaaab, %eax       # imm = 0xAAAAAAAB
movl $0x294, %ecx            # imm = 0x294
movl $0xa50, %edx            # imm = 0xA50
movl $0x528, %esi            # imm = 0x528
movl %r12d, %r8d
cmpl $0xb, %r12d
ja 0xa8b5
cmpl %edi, %ebp
setle %r9b
testl %ebp, %ebp
setg %r10b
testb %r10b, %r9b
jne 0xaaea
cmpl $0xc, %r8d
jl 0xa8e3
movl %r8d, %r9d
imulq %rax, %r9
shrq $0x23, %r9
addl %r9d, %r15d
movl %r15d, 0x14(%rsp)
shll $0x2, %r9d
leal (%r9,%r9,2), %r9d
subl %r9d, %r8d
movl %r8d, 0x10(%rsp)
movl %r8d, %r12d
jmp 0xa897
testl %r8d, %r8d
js 0xa99f
cmpl $0xa, %r8d
ja 0xaa6e
movl $0x1e, %edi
btl %r8d, %esi
jae 0xaa13
movl %ebp, %r9d
subl %edi, %r9d
jle 0xa9df
movl %r9d, 0xc(%rsp)
leal 0x1(%r8), %r12d
movl %r12d, 0x10(%rsp)
cmpl $0x9, %r8d
ja 0xaa78
movl $0x1e, %edi
btl %r8d, %ecx
movl %r9d, %ebp
jb 0xa897
testl %r8d, %r8d
jne 0xaa78
movl %r9d, %ebp
movl $0x1c, %edi
testb $0x3, %r15b
jne 0xa897
imull $0xcccccccd, %r15d, %edi # imm = 0xCCCCCCCD
addl $0x19999998, %edi       # imm = 0x19999998
rorl $0x2, %edi
cmpl $0xccccccd, %edi        # imm = 0xCCCCCCD
setae %dil
imull $0xc28f5c29, %r15d, %r8d # imm = 0xC28F5C29
addl $0x51eb850, %r8d        # imm = 0x51EB850
rorl $0x2, %r8d
cmpl $0x28f5c29, %r8d        # imm = 0x28F5C29
setb %r8b
orb %dil, %r8b
movzbl %r8b, %edi
orl $0x1c, %edi
movl %r9d, %ebp
jmp 0xa897
movslq %r8d, %r9
imulq $0x2aaaaaab, %r9, %r9   # imm = 0x2AAAAAAB
movq %r9, %r10
shrq $0x3f, %r10
sarq $0x21, %r9
addl %r10d, %r9d
addl %r9d, %r15d
decl %r15d
movl %r15d, 0x14(%rsp)
shll $0x2, %r9d
leal (%r9,%r9,2), %r9d
negl %r9d
leal (%r8,%r9), %r12d
addl $0xc, %r12d
movl %r12d, 0x10(%rsp)
jmp 0xa897
movl %r8d, %r12d
testl %ebp, %ebp
jg 0xa897
leal -0x1(%r8), %r12d
movl %r12d, 0x10(%rsp)
cmpl $0xb, %r8d
ja 0xaae0
movl $0x1e, %edi
btl %r8d, %edx
jae 0xaa85
addl %edi, %ebp
movl %ebp, 0xc(%rsp)
jmp 0xa897
cmpl $0x1, %r8d
jne 0xaa6e
movl $0x1c, %edi
testb $0x3, %r15b
jne 0xa905
imull $0xcccccccd, %r15d, %edi # imm = 0xCCCCCCCD
addl $0x19999998, %edi       # imm = 0x19999998
rorl $0x2, %edi
cmpl $0xccccccd, %edi        # imm = 0xCCCCCCD
setae %dil
imull $0xc28f5c29, %r15d, %r9d # imm = 0xC28F5C29
addl $0x51eb850, %r9d        # imm = 0x51EB850
rorl $0x2, %r9d
cmpl $0x28f5c29, %r9d        # imm = 0x28F5C29
setb %r9b
orb %dil, %r9b
movzbl %r9b, %edi
orl $0x1c, %edi
jmp 0xa905
movl $0x1f, %edi
jmp 0xa905
movl $0x1f, %edi
movl %r9d, %ebp
jmp 0xa897
cmpl $0x2, %r8d
jne 0xaae0
movl $0x1c, %edi
testb $0x3, %r15b
jne 0xaa08
imull $0xcccccccd, %r15d, %edi # imm = 0xCCCCCCCD
addl $0x19999998, %edi       # imm = 0x19999998
rorl $0x2, %edi
cmpl $0xccccccd, %edi        # imm = 0xCCCCCCD
setae %dil
imull $0xc28f5c29, %r15d, %r8d # imm = 0xC28F5C29
addl $0x51eb850, %r8d        # imm = 0x51EB850
rorl $0x2, %r8d
cmpl $0x28f5c29, %r8d        # imm = 0x28F5C29
setb %r8b
orb %dil, %r8b
movzbl %r8b, %edi
orl $0x1c, %edi
jmp 0xaa08
movl $0x1f, %edi
jmp 0xaa08
movq %rsp, %rcx
movl $0xc, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x35c0
movq %rbx, %rdi
callq 0x647e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq