// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rsi, %r13
movq %rdi, %r15
xorl %ebp, %ebp
movl (%rdi), %edi
movl 0x4(%r15), %esi
movslq %esi, %r12
movl %edi, %ecx
movl %edx, %r8d
movq %r13, %r14
shrq $0x20, %r14
cmpl %r14d, %esi
sete %dl
cmpl %r13d, %edi
setl %r9b
xorl %eax, %eax
cmpl %r14d, %esi
jl 0x5b1e
andb %r9b, %dl
je 0x5ccf
movl 0x8(%r15), %edx
cmpl %r8d, %edx
jl 0x5b4d
cmpl %r14d, %esi
jl 0x5bba
cmpl %r14d, %esi
jle 0x5cb0
movl 0x4(%r15), %eax
movl 0x8(%r15), %r8d
shlq $0x20, %rax
movl %r13d, %r13d
orq %rax, %r13
jmp 0x5afa
xorl %eax, %eax
movl %edx, %r9d
testb $0x3, %r9b
jne 0x5b82
movslq %r9d, %r10
imulq $0x51eb851f, %r10, %r10 # imm = 0x51EB851F
movq %r10, %r11
shrq $0x3f, %r11
sarq $0x25, %r10
addl %r11d, %r10d
imull $0x64, %r10d, %r11d
movl %r9d, %ebx
movl $0x16e, %r10d           # imm = 0x16E
subl %r11d, %ebx
jne 0x5ba8
imull $0xc28f5c29, %r9d, %r10d # imm = 0xC28F5C29
addl $0x51eb850, %r10d       # imm = 0x51EB850
rorl $0x4, %r10d
cmpl $0xa3d70b, %r10d        # imm = 0xA3D70B
movl $0x0, %r10d
adcl $0x16d, %r10d           # imm = 0x16D
addl %r10d, %eax
incl %r9d
cmpl %r9d, %r8d
jne 0x5b52
addl %eax, %ebp
jmp 0x5af7
movl %ebp, 0x4(%rsp)
testb $0x3, %r8b
sete %al
imull $0xc28f5c29, %r8d, %ecx # imm = 0xC28F5C29
addl $0x51eb850, %ecx        # imm = 0x51EB850
rorl $0x2, %ecx
cmpl $0x28f5c29, %ecx        # imm = 0x28F5C29
setae %cl
andb %al, %cl
movslq %r8d, %rax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rax
sarl $0x7, %eax
addl %edx, %eax
imull $0x190, %eax, %eax      # imm = 0x190
cmpl %eax, %r8d
sete %bl
orb %cl, %bl
decq %r12
subl %esi, %r14d
xorl %ebp, %ebp
movups 0x47e9(%rip), %xmm0     # 0xa400
movaps %xmm0, 0x40(%rsp)
movups 0x47cd(%rip), %xmm0     # 0xa3f0
movaps %xmm0, 0x30(%rsp)
movups 0x47b1(%rip), %xmm0     # 0xa3e0
movaps %xmm0, 0x20(%rsp)
movl $0xc, %edx
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x3(%rsp), %rcx
callq 0x6244
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %r12, %rdx
jbe 0x5ce2
addl (%rdi,%r12,4), %ebp
testq %rdi, %rdi
je 0x5c79
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
testq %r12, %r12
sete %al
andb %bl, %al
movzbl %al, %eax
addl %eax, %ebp
incq %r12
decl %r14d
jne 0x5c10
movl 0x4(%r15), %eax
movl 0x8(%r15), %edx
shlq $0x20, %rax
movl %r13d, %esi
orq %rax, %rsi
movq %r15, %rdi
callq 0x5ad6
addl %ebp, %eax
movl 0x4(%rsp), %ebp
jmp 0x5ccf
cmpl %ecx, %r13d
jg 0x5cba
cmpl %ecx, %r13d
jge 0x5ccf
subl %ecx, %r13d
shlq $0x20, %rsi
orq %rcx, %rsi
movq %r15, %rdi
callq 0x5ad6
addl %r13d, %ebp
addl %eax, %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x454e(%rip), %rdi      # 0xa237
movq %r12, %rsi
xorl %eax, %eax
callq 0x21c0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5d0d
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x2220
nop