// File: sus304[P]ForRocket/src/environment/datetime.cpp
// Function: forrocket::DateTime::operator+(double)
forrocket::DateTime forrocket::DateTime::operator+(const double sec_double) {
    DateTime new_datetime = *this;
    unsigned int sec_int = static_cast<unsigned int>(sec_double);

    unsigned int ms = static_cast<unsigned int>((sec_double - sec_int) * 1000.0);
    new_datetime.msec += ms;
    if (new_datetime.msec >= 1000) {
        new_datetime.sec += 1;
        new_datetime.msec -= 1000;
    }

    new_datetime.sec += sec_int;
    if (new_datetime.sec >= 60) {
        unsigned int m = static_cast<unsigned int>(new_datetime.sec / 60);
        new_datetime.min += m;
        new_datetime.sec -= m * 60;
    }

    if (new_datetime.min >= 60) {
        unsigned int h = static_cast<unsigned int>(new_datetime.min / 60);
        new_datetime.hour += h;
        new_datetime.min -= h * 60;
    }

    if (new_datetime.hour >= 24) {
        unsigned int d = static_cast<unsigned int>(new_datetime.hour / 24);
        new_datetime.day += d;
        new_datetime.hour -= d * 24;
    }

    // TODO:Month update
    return new_datetime;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rsi
callq 0x33f00
movq -0x38(%rbp), %rdi
cvttsd2si -0x18(%rbp), %rax
movl %eax, -0x1c(%rbp)
movsd -0x18(%rbp), %xmm0
movl -0x1c(%rbp), %eax
cvtsi2sd %rax, %xmm1
subsd %xmm1, %xmm0
movsd 0x62ff9(%rip), %xmm1    # 0x97018
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl 0x18(%rdi), %eax
movl %eax, 0x18(%rdi)
cmpl $0x3e8, 0x18(%rdi)      # imm = 0x3E8
jb 0x34056
movq -0x38(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movl 0x18(%rax), %ecx
subl $0x3e8, %ecx            # imm = 0x3E8
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl 0x14(%rax), %ecx
movl %ecx, 0x14(%rax)
cmpl $0x3c, 0x14(%rax)
jb 0x34097
movq -0x38(%rbp), %rax
movl 0x14(%rax), %eax
movl $0x3c, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, -0x24(%rbp)
movl -0x24(%rbp), %ecx
addl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
imull $0x3c, -0x24(%rbp), %edx
movl 0x14(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0x38(%rbp), %rax
cmpl $0x3c, 0x10(%rax)
jb 0x340cf
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
movl $0x3c, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, -0x28(%rbp)
movl -0x28(%rbp), %ecx
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
imull $0x3c, -0x28(%rbp), %edx
movl 0x10(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rax
cmpl $0x18, 0xc(%rax)
jb 0x34107
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movl $0x18, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
imull $0x18, -0x2c(%rbp), %edx
movl 0xc(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)