// File: /workspace/github_cpp_makefile_star2_O2/pc260533[P]ITC313-TP1/date.cpp
// Function: Date::nombreDeJoursAvecCetteDate(Date)
int Date::nombreDeJoursAvecCetteDate(Date date) {
    int res = 0;
    if (this->estAvantDate(date)) {
        if (this->annee < date.annee) {
            for (int i = this->annee; i < date.annee; i++) {
                res += 365;
                if (this->anneeEstBissextile(i)) {
                    res++;
                }
            }
            //std::cout << "annee" << std::to_string(res) << std::endl;
            return res += this->nombreDeJoursAvecCetteDate(Date(date.jour, date.mois, this->annee));
        }
        if (this->mois < date.mois) {
            for (int i = this->mois; i < date.mois; i++) {
                res += this->getListeJourDesMois().at(i - 1);
                if ((this->anneeEstBissextile(date.annee)) && (i == 1)) {
                    res++;
                }
            }
            //std::cout << "mois inf" << std::to_string(res) << std::endl;
            return res += this->nombreDeJoursAvecCetteDate(Date(date.jour, this->mois, this->annee));
        }
        else if (this->mois > date.mois) {
            for (int i = this->mois; i < date.mois; i++) {
                res -= this->getListeJourDesMois().at(i - 1);
                if ((this->anneeEstBissextile(date.annee)) && (i == 1)) {
                    res--;
                }
            }
            //std::cout << "mois sup" << std::to_string(res) << std::endl;
            return res += this->nombreDeJoursAvecCetteDate(Date(date.jour, this->mois, this->annee));
        }
        if (this->jour < date.jour) {
            res += date.jour - this->jour;
            //std::cout << "jour inf" << std::to_string(res) << std::endl;
            return res += this->nombreDeJoursAvecCetteDate(Date(this->jour, this->mois, this->annee));
        }
        else if (this->jour > date.jour) {
            res -= this->jour - date.jour;
            //std::cout << "jour supp" << std::to_string(res) << std::endl;
            return res += this->nombreDeJoursAvecCetteDate(Date(this->jour, this->mois, this->annee));
        }
    }
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ecx
movq %rsi, %rbx
xorl %r12d, %r12d
movl (%rdi), %r10d
movl 0x4(%rdi), %esi
movslq %esi, %r15
movl %r10d, %eax
movq %rax, (%rsp)
movq %rdi, 0x18(%rsp)
movl 0x8(%rdi), %r8d
pushq $0x64
popq %r9
movl $0x190, %r11d           # imm = 0x190
movq %rbx, %rbp
shrq $0x20, %rbp
cmpl %ebp, %esi
setl %al
sete %dl
movq %rbx, 0x10(%rsp)
cmpl %ebx, %r10d
setl %r14b
andb %dl, %r14b
orb %al, %r14b
xorl %ebx, %ebx
xorl %eax, %eax
testb %r14b, %r14b
je 0x46bc
cmpl %ecx, %r8d
jge 0x467f
xorl %r13d, %r13d
movl %r8d, %edi
cmpl %ecx, %edi
jge 0x4677
movl %edi, %eax
cltd
idivl %r9d
testb $0x3, %dil
jne 0x4663
testl %edx, %edx
je 0x4663
addl $0x16e, %r13d           # imm = 0x16E
jmp 0x4673
movl %edi, %eax
cltd
idivl %r11d
cmpl $0x1, %edx
adcl $0x16d, %r13d           # imm = 0x16D
incl %edi
jmp 0x4646
addl %r13d, %ebx
movl %r8d, %ecx
jmp 0x4630
cmpl %ebp, %r15d
jl 0x46d4
cmpl %ebp, %esi
movq 0x10(%rsp), %r14
jg 0x4754
movq (%rsp), %r13
cmpl %r14d, %r13d
jge 0x47f2
addl %r14d, %ebx
movq %rsi, %rax
shlq $0x20, %rax
orq %r13, %rax
subl %r13d, %ebx
addl %ebx, %r12d
movq %rax, %rbx
movl %r8d, %ecx
jmp 0x460d
xorl %ebx, %ebx
addl %eax, %ebx
addl %r12d, %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, 0xc(%rsp)
testb $0x3, %cl
sete %sil
movl %ecx, %eax
cltd
idivl %r9d
testl %edx, %edx
setne %dil
andb %sil, %dil
movl $0x190, %esi            # imm = 0x190
movl %ecx, %eax
cltd
idivl %esi
testl %edx, %edx
sete %al
movq 0x10(%rsp), %r14
sarq $0x20, %r14
orb %dil, %al
movb %al, (%rsp)
decq %r15
xorl %ebp, %ebp
leaq 0x20(%rsp), %r13
leaq 0x1(%r15), %r12
cmpq %r14, %r12
jge 0x47cb
movq %r13, %rdi
callq 0x42e6
movq %r13, %rdi
movq %r15, %rsi
callq 0x49ec
addl (%rax), %ebp
movq %r13, %rdi
callq 0x4c0e
testq %r15, %r15
sete %al
andb (%rsp), %al
movzbl %al, %eax
addl %eax, %ebp
movq %r12, %r15
jmp 0x4717
movl %r12d, 0xc(%rsp)
testb $0x3, %cl
sete %sil
movl %ecx, %eax
cltd
idivl %r9d
testl %edx, %edx
setne %dil
andb %sil, %dil
movl $0x190, %esi            # imm = 0x190
movl %ecx, %eax
cltd
idivl %esi
testl %edx, %edx
sete %al
sarq $0x20, %r14
orb %dil, %al
movb %al, (%rsp)
decq %r15
xorl %ebp, %ebp
leaq 0x20(%rsp), %r13
leaq 0x1(%r15), %r12
cmpq %r14, %r12
jge 0x47cb
movq %r13, %rdi
callq 0x42e6
movq %r13, %rdi
movq %r15, %rsi
callq 0x49ec
subl (%rax), %ebp
movq %r13, %rdi
callq 0x4c0e
testq %r15, %r15
sete %al
andb (%rsp), %al
movzbl %al, %eax
subl %eax, %ebp
movq %r12, %r15
jmp 0x4792
movq 0x18(%rsp), %rdi
movl 0x4(%rdi), %eax
movl 0x8(%rdi), %edx
shlq $0x20, %rax
movl 0x10(%rsp), %esi
orq %rax, %rsi
callq 0x45d4
addl %ebp, %eax
movl 0xc(%rsp), %r12d
jmp 0x46be
cmpl %r14d, %r13d
jle 0x46be
shlq $0x20, %rsi
orq %r13, %rsi
movq 0x18(%rsp), %rdi
movl %r8d, %edx
callq 0x45d4
addl %r14d, %ebx
subl %r13d, %ebx
addl %r12d, %ebx
addl %eax, %ebx
jmp 0x46c3
jmp 0x4821
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4c0e
movq %rbx, %rdi
callq 0x2230