// File: DoubleString[P]RtConverter/src/Rnxobs/Com.cpp
// Function: bamboo::time2mjd(long, int*, double*)
void time2mjd(time_t time,int* mjd,double* sod){
	double ep[6];
	const int mday[] = { /* # of days in a month */
	31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31,
			31, 30, 31, 30, 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
			31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int days, sec, mon, day;

	/* leap year if year%4==0 in 1901-2099 */
	days = (int) (time / 86400);
	sec = (int) (time - (time_t) days * 86400);
	for (day = days % 1461, mon = 0; mon < 48; mon++) {
		if (day >= mday[mon])
			day -= mday[mon];
		else
			break;
	}
	ep[0] = 1970 + days / 1461 * 4 + mon / 12;
	ep[1] = mon % 12 + 1;
	ep[2] = day + 1;
	ep[3] = sec / 3600;
	ep[4] = sec % 3600 / 60;
	ep[5] = sec % 60;

	*mjd = md_julday((int)ep[0],(int)ep[1],(int)ep[2]);
	*sod = ep[3] * 3600.0 + ep[4] * 60.0 + ep[5];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x110(%rbp), %rdi
leaq 0x896ab(%rip), %rsi     # 0xbd0e0
movl $0xc0, %edx
callq 0x9610
movq -0x8(%rbp), %rax
movl $0x15180, %ecx          # imm = 0x15180
cqto
idivq %rcx
movl %eax, -0x114(%rbp)
movq -0x8(%rbp), %rax
movslq -0x114(%rbp), %rcx
imulq $0x15180, %rcx, %rcx    # imm = 0x15180
subq %rcx, %rax
movl %eax, -0x118(%rbp)
movl -0x114(%rbp), %eax
movl $0x5b5, %ecx            # imm = 0x5B5
cltd
idivl %ecx
movl %edx, -0x120(%rbp)
movl $0x0, -0x11c(%rbp)
cmpl $0x30, -0x11c(%rbp)
jge 0x33ade
movl -0x120(%rbp), %eax
movslq -0x11c(%rbp), %rcx
cmpl -0x110(%rbp,%rcx,4), %eax
jl 0x33ac9
movslq -0x11c(%rbp), %rax
movl -0x110(%rbp,%rax,4), %ecx
movl -0x120(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x120(%rbp)
jmp 0x33acb
jmp 0x33ade
jmp 0x33acd
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x33a8c
movl -0x114(%rbp), %eax
movl $0x5b5, %ecx            # imm = 0x5B5
cltd
idivl %ecx
shll $0x2, %eax
addl $0x7b2, %eax            # imm = 0x7B2
movl %eax, -0x124(%rbp)
movl -0x11c(%rbp), %eax
movl $0xc, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x124(%rbp), %eax
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x11c(%rbp), %eax
movl $0xc, %ecx
cltd
idivl %ecx
addl $0x1, %edx
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x120(%rbp), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x118(%rbp), %eax
movl $0xe10, %ecx            # imm = 0xE10
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x118(%rbp), %eax
movl $0xe10, %ecx            # imm = 0xE10
cltd
idivl %ecx
movl %edx, %eax
movl $0x3c, %ecx
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x118(%rbp), %eax
movl $0x3c, %ecx
cltd
idivl %ecx
cvtsi2sd %edx, %xmm0
movsd %xmm0, -0x28(%rbp)
cvttsd2si -0x50(%rbp), %edi
cvttsd2si -0x48(%rbp), %esi
cvttsd2si -0x40(%rbp), %edx
callq 0x32fe0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movsd -0x38(%rbp), %xmm0
movsd 0x89259(%rip), %xmm1    # 0xbce18
mulsd -0x30(%rbp), %xmm1
movsd 0x89244(%rip), %xmm2    # 0xbce10
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x28(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)