// File: 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
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rsi, -0x20(%rbp)
movl %edx, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x8(%rbp)
movq %rdi, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq %rdi, -0x130(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x48(%rbp), %rsi
movl -0x40(%rbp), %edx
callq 0x98c0
testb $0x1, %al
jne 0x9b37
jmp 0x9f45
movq -0x130(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x8(%rbp), %eax
jge 0x9bdd
movq -0x130(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x9b95
movq -0x130(%rbp), %rdi
movl -0x2c(%rbp), %eax
addl $0x16d, %eax            # imm = 0x16D
movl %eax, -0x2c(%rbp)
movl -0x4c(%rbp), %esi
callq 0x9210
testb $0x1, %al
jne 0x9b7f
jmp 0x9b88
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9b8a
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x9b57
movq -0x130(%rbp), %rax
movl -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
movl 0x8(%rax), %ecx
leaq -0x58(%rbp), %rdi
callq 0x9680
movq -0x130(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x68(%rbp), %rsi
movl -0x60(%rbp), %edx
callq 0x9ad0
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x4(%rbp)
jmp 0x9f4b
movq -0x130(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0xc(%rbp), %eax
jge 0x9d11
movq -0x130(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x9cb4
movq -0x130(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x9260
movq -0x140(%rbp), %rdi
movl -0x6c(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0xa2c0
movq %rax, -0x138(%rbp)
jmp 0x9c40
movq -0x138(%rbp), %rax
movl (%rax), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xa300
movq -0x130(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x9210
testb $0x1, %al
jne 0x9c70
jmp 0x9ca4
cmpl $0x1, -0x6c(%rbp)
jne 0x9ca4
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9ca4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xa300
jmp 0x9f57
jmp 0x9ca6
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x9bfd
movq -0x130(%rbp), %rax
movl -0x10(%rbp), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
leaq -0xa0(%rbp), %rdi
callq 0x9680
movq -0x130(%rbp), %rdi
movq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0xa8(%rbp)
movq -0xb0(%rbp), %rsi
movl -0xa8(%rbp), %edx
callq 0x9ad0
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x4(%rbp)
jmp 0x9f4b
movq -0x130(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0xc(%rbp), %eax
jle 0x9e59
movq -0x130(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x9dfc
movq -0x130(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x9260
movq -0x150(%rbp), %rdi
movl -0xb4(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0xa2c0
movq %rax, -0x148(%rbp)
jmp 0x9d7d
movq -0x148(%rbp), %rax
movl (%rax), %ecx
movl -0x2c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xa300
movq -0x130(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x9210
testb $0x1, %al
jne 0x9daf
jmp 0x9de6
cmpl $0x1, -0xb4(%rbp)
jne 0x9de6
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xa300
jmp 0x9f57
jmp 0x9de8
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x9d34
movq -0x130(%rbp), %rax
movl -0x10(%rbp), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
leaq -0xdc(%rbp), %rdi
callq 0x9680
movq -0x130(%rbp), %rdi
movq -0xdc(%rbp), %rax
movq %rax, -0xec(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0xe4(%rbp)
movq -0xec(%rbp), %rsi
movl -0xe4(%rbp), %edx
callq 0x9ad0
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x4(%rbp)
jmp 0x9f4b
jmp 0x9e5b
movq -0x130(%rbp), %rax
movl (%rax), %eax
cmpl -0x10(%rbp), %eax
jge 0x9ecd
movq -0x130(%rbp), %rax
movl -0x10(%rbp), %ecx
subl (%rax), %ecx
addl -0x2c(%rbp), %ecx
movl %ecx, -0x2c(%rbp)
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
leaq -0xf8(%rbp), %rdi
callq 0x9680
movq -0x130(%rbp), %rdi
movq -0xf8(%rbp), %rax
movq %rax, -0x108(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, -0x100(%rbp)
movq -0x108(%rbp), %rsi
movl -0x100(%rbp), %edx
callq 0x9ad0
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x4(%rbp)
jmp 0x9f4b
movq -0x130(%rbp), %rax
movl (%rax), %eax
cmpl -0x10(%rbp), %eax
jle 0x9f41
movq -0x130(%rbp), %rax
movl (%rax), %edx
subl -0x10(%rbp), %edx
movl -0x2c(%rbp), %ecx
subl %edx, %ecx
movl %ecx, -0x2c(%rbp)
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
leaq -0x114(%rbp), %rdi
callq 0x9680
movq -0x130(%rbp), %rdi
movq -0x114(%rbp), %rax
movq %rax, -0x124(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0x11c(%rbp)
movq -0x124(%rbp), %rsi
movl -0x11c(%rbp), %edx
callq 0x9ad0
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x4(%rbp)
jmp 0x9f4b
jmp 0x9f43
jmp 0x9f45
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x3350
nopw %cs:(%rax,%rax)