// File: /workspace/github_c_makefile_star2_O3/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, %r15d
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r13
movl $0xc, %edi
callq 0xee10
movq %rax, %rbx
movq %rsp, %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x3730
testq %rax, %rax
je 0xa8d8
addl 0xc(%rsp), %r15d
movl %r15d, 0xc(%rsp)
addl 0x10(%rsp), %r12d
movl %r12d, 0x10(%rsp)
addl 0x14(%rsp), %ebp
movl %ebp, 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
jbe 0xa6c5
jle 0xa78b
movl %r8d, %r9d
imulq %rax, %r9
shrq $0x23, %r9
addl %r9d, %ebp
movl %ebp, 0x14(%rsp)
shll $0x2, %r9d
leal (%r9,%r9,2), %r9d
subl %r9d, %r8d
movl %r8d, 0x10(%rsp)
movl %r8d, %r12d
jmp 0xa68f
testl %r15d, %r15d
jle 0xa6d3
cmpl %edi, %r15d
jle 0xa8c5
cmpl $0xa, %r8d
ja 0xa84a
movl $0x1e, %edi
btl %r8d, %esi
jae 0xa7f0
movl %r15d, %r9d
subl %edi, %r9d
jle 0xa7b9
movl %r9d, 0xc(%rsp)
leal 0x1(%r8), %r12d
movl %r12d, 0x10(%rsp)
cmpl $0x9, %r8d
ja 0xa854
movl $0x1e, %edi
btl %r8d, %ecx
movl %r9d, %r15d
jb 0xa68f
testl %r8d, %r8d
jne 0xa854
movl $0x1, %r12d
movl %r9d, %r15d
movl $0x1c, %edi
testb $0x3, %bpl
jne 0xa68f
imull $0xcccccccd, %ebp, %edi # imm = 0xCCCCCCCD
addl $0x19999998, %edi       # imm = 0x19999998
rorl $0x2, %edi
cmpl $0xccccccd, %edi        # imm = 0xCCCCCCD
setae %dil
imull $0xc28f5c29, %ebp, %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, %r15d
jmp 0xa68f
movl %r8d, %r9d
negl %r9d
imulq %rax, %r9
shrq $0x23, %r9
leal (%r9,%r9,2), %r10d
notl %r9d
addl %r9d, %ebp
movl %ebp, 0x14(%rsp)
leal (%r8,%r10,4), %r12d
addl $0xc, %r12d
movl %r12d, 0x10(%rsp)
jmp 0xa68f
movl %r8d, %r12d
testl %r15d, %r15d
jg 0xa68f
leal -0x1(%r8), %r12d
movl %r12d, 0x10(%rsp)
cmpl $0xb, %r8d
ja 0xa8bb
movl $0x1e, %edi
btl %r8d, %edx
jae 0xa861
addl %edi, %r15d
movl %r15d, 0xc(%rsp)
jmp 0xa68f
cmpl $0x1, %r8d
jne 0xa84a
movl $0x1c, %edi
testb $0x3, %bpl
jne 0xa6ec
imull $0xcccccccd, %ebp, %edi # imm = 0xCCCCCCCD
addl $0x19999998, %edi       # imm = 0x19999998
rorl $0x2, %edi
cmpl $0xccccccd, %edi        # imm = 0xCCCCCCD
setae %dil
imull $0xc28f5c29, %ebp, %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 0xa6ec
movl $0x1f, %edi
jmp 0xa6ec
movl $0x1f, %edi
movl %r9d, %r15d
jmp 0xa68f
cmpl $0x2, %r8d
jne 0xa8bb
movl $0x1c, %edi
testb $0x3, %bpl
jne 0xa7e3
imull $0xcccccccd, %ebp, %edi # imm = 0xCCCCCCCD
addl $0x19999998, %edi       # imm = 0x19999998
rorl $0x2, %edi
cmpl $0xccccccd, %edi        # imm = 0xCCCCCCD
setae %dil
imull $0xc28f5c29, %ebp, %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 0xa7e3
movl $0x1f, %edi
jmp 0xa7e3
movq %rsp, %rcx
movl $0xc, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x35c0
movq %rbx, %rdi
callq 0x6402
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop