// File: sus304[P]ForRocket/src/environment/sequence_clock.cpp
// Function: forrocket::SequenceClock::ModifiedJulianDate2UTC(double)
forrocket::DateTime forrocket::SequenceClock::ModifiedJulianDate2UTC(const double modified_julian) {
    double a = static_cast<int>(modified_julian) + 2400001.0;
    double q = modified_julian - static_cast<int>(modified_julian);
    double b = static_cast<int>((a - 1867216.25) / 36524.25);
    double c = a + b - static_cast<int>(0.25 * b) + 1525;
    double d = static_cast<int>((c - 121.1) / 365.25);
    double e = static_cast<int>(365.25 * d);
    double f = static_cast<int>((c - e) / 50.6001);

    unsigned int day = c - e - static_cast<unsigned int>(30.6001 * f);
    unsigned int month = f - 1 - 12 * static_cast<unsigned int>(f / 14);
    unsigned int year = d - 4715 - static_cast<unsigned int>((7 + month) / 10);
    unsigned int hour = static_cast<unsigned int>(24 * q);
    unsigned int min = 60 * (24 * q - hour);
    unsigned int sec = 60 * (min) - static_cast<unsigned int>(min);
    return DateTime(year, month, day, hour, min, sec);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, %rax
movq %rax, -0x70(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movsd 0x629a4(%rip), %xmm1    # 0x97088
addsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
movaps %xmm0, %xmm1
cvttpd2dq %xmm1, %xmm1
cvtdq2pd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x20(%rbp), %xmm0
movsd 0x6297d(%rip), %xmm1    # 0x97090
addsd %xmm1, %xmm0
movsd 0x62979(%rip), %xmm1    # 0x97098
divsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, -0x30(%rbp)
movsd -0x20(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd 0x6295a(%rip), %xmm2    # 0x970a0
mulsd %xmm2, %xmm1
cvttpd2dq %xmm1, %xmm1
cvtdq2pd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd 0x6294a(%rip), %xmm1    # 0x970a8
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd 0x6293c(%rip), %xmm1    # 0x970b0
addsd %xmm1, %xmm0
movsd 0x62938(%rip), %xmm1    # 0x970b8
divsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, -0x48(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd 0x62903(%rip), %xmm1    # 0x970c0
divsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movlpd %xmm0, -0x50(%rbp)
movsd -0x38(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd -0x50(%rbp), %xmm1
movsd 0x628df(%rip), %xmm2    # 0x970c8
mulsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
movl %eax, %eax
cvtsi2sd %rax, %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
movsd -0x50(%rbp), %xmm1
movsd 0x628be(%rip), %xmm2    # 0x970d0
movaps %xmm1, %xmm0
addsd %xmm2, %xmm0
movsd 0x628b7(%rip), %xmm2    # 0x970d8
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
movl %eax, %ecx
shll $0x2, %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
cvtsi2sd %rax, %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x58(%rbp)
movsd -0x40(%rbp), %xmm0
movsd 0x6288e(%rip), %xmm1    # 0x970e0
addsd %xmm1, %xmm0
movl -0x58(%rbp), %eax
addl $0x7, %eax
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
imulq %rcx, %rax
shrq $0x23, %rax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x5c(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0x627a2(%rip), %xmm2    # 0x97028
mulsd %xmm2, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x60(%rbp)
movsd -0x28(%rbp), %xmm0
movl -0x60(%rbp), %eax
cvtsi2sd %rax, %xmm1
mulsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movsd 0x62789(%rip), %xmm1    # 0x97038
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x64(%rbp)
imull $0x3c, -0x64(%rbp), %eax
subl -0x64(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x5c(%rbp), %esi
movl -0x58(%rbp), %edx
movl -0x54(%rbp), %ecx
movl -0x60(%rbp), %r8d
movl -0x64(%rbp), %r9d
movl -0x68(%rbp), %eax
movl %eax, (%rsp)
callq 0x33b00
movq -0x70(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nop