// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]MQSim/src/utils/CMRRandomGenerator.cpp
// Function: Utils::CMRRandomGenerator::Advance(long, int)
void CMRRandomGenerator::Advance(int64_t n, int32_t e)
	{
		int64_t B[2][3][3];

		int64_t S[2][3];
		int64_t M[2];

		for (int i = 0; i <= 1; i++) {
			m_ftoi(a[i], B[i], m[i]);
			v_ftoi(s[i], S[i], m[i]);
			M[i] = (int64_t)(m[i]);
		}

		while (e-- != 0) {
			for (int i = 0; i <= 1; i++) {
				mm_mul(B[i], B[i], B[i], M[i]);
			}
		}

		while (n != 0) {
			if ((n & 1) != 0) {
				for (int i = 0; i <= 1; i++) {
					mv_mul(B[i], S[i], S[i], M[i]);
				}
			}
			n >>= 1;
			if (n != 0) {
				for (int i = 0; i <= 1; i++) {
					mm_mul(B[i], B[i], B[i], M[i]);
				}
			}
		}

		for (int i = 0; i <= 1; i++) {
			v_itof(S[i], s[i], M[i]);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %edx, %ebp
movq %rsi, 0x10(%rsp)
leaq 0x68(%rsp), %r14
leaq 0x80(%rsp), %r10
leaq 0x50(%rsp), %r8
movq %rsp, %rsi
movb $0x1, %al
xorl %r9d, %r9d
leaq 0x2215d(%rip), %rcx     # 0x73bb0
leaq 0x221e6(%rip), %rdx     # 0x73c40
leaq 0x8(%rsp), %r13
leaq (%r9,%r9,8), %r11
leaq (%rcx,%r11,8), %r11
movsd (%rdx,%r9,8), %xmm0
xorl %ebx, %ebx
xorl %r15d, %r15d
movsd (%r11,%r15,8), %xmm1
movapd %xmm0, %xmm2
addsd %xmm1, %xmm2
xorpd %xmm3, %xmm3
cmpnlesd %xmm1, %xmm3
andpd %xmm3, %xmm2
andnpd %xmm1, %xmm3
orpd %xmm2, %xmm3
cvttsd2si %xmm3, %r12
movq %r12, (%r10,%r15,8)
incq %r15
cmpq $0x3, %r15
jne 0x51a72
incq %rbx
addq $0x18, %r10
addq $0x18, %r11
cmpq $0x3, %rbx
jne 0x51a6f
leaq (%r9,%r9,2), %r9
leaq (%rdi,%r9,8), %r9
xorl %r10d, %r10d
movsd (%r9,%r10,8), %xmm1
movapd %xmm0, %xmm2
addsd %xmm1, %xmm2
xorpd %xmm3, %xmm3
cmpnlesd %xmm1, %xmm3
andpd %xmm3, %xmm2
andnpd %xmm1, %xmm3
orpd %xmm2, %xmm3
cvttsd2si %xmm3, %r11
movq %r11, (%r8,%r10,8)
incq %r10
cmpq $0x3, %r10
jne 0x51ac3
cvttsd2si %xmm0, %r8
movq %r8, (%rsi)
movl $0x1, %r9d
movq %r13, %rsi
movq %r14, %r8
leaq 0xc8(%rsp), %r10
testb $0x1, %al
movl $0x0, %eax
jne 0x51a5f
movq %rdi, 0x18(%rsp)
testl %ebp, %ebp
je 0x51b69
movq (%rsp), %r15
leaq 0xc8(%rsp), %r12
movq 0x8(%rsp), %r13
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x51d9a
movq %r12, %rdi
movq %r12, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x51d9a
decl %ebp
jne 0x51b43
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x51c55
movq %rsp, %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
leaq 0xc8(%rsp), %r12
leaq 0x8(%rsp), %rbx
movq (%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x80(%rsp), %rbp
testb $0x1, %r13b
leaq 0xc8(%rsp), %r11
je 0x51c17
movb $0x1, %cl
movq %rsp, %rax
leaq 0x50(%rsp), %rsi
movq %rbp, %rdi
movq (%rax), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %edx, %edx
movq (%rsi,%r10,8), %rax
imulq (%rdi,%r10,8), %rax
addq %rdx, %rax
cqto
idivq %r8
incq %r10
cmpq $0x3, %r10
jne 0x51bc5
movq %rdx, 0x30(%rsp,%r9,8)
incq %r9
addq $0x18, %rdi
cmpq $0x3, %r9
jne 0x51bc0
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsi)
movapd 0x30(%rsp), %xmm0
movupd %xmm0, (%rsi)
movq %rbx, %rax
movq %r14, %rsi
movq %r11, %rdi
testb $0x1, %cl
movl $0x0, %ecx
jne 0x51bba
cmpq $0x1, %r13
je 0x51c55
movq %r13, %r15
sarq %r15
movq %rbp, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
movq 0x28(%rsp), %rcx
callq 0x51d9a
movq %r12, %rdi
movq %r12, %rsi
movq %r12, %rdx
movq 0x20(%rsp), %rcx
callq 0x51d9a
testq %r13, %r13
movq %r15, %r13
jne 0x51b9f
leaq 0x50(%rsp), %rcx
movb $0x1, %al
xorl %edx, %edx
movq 0x18(%rsp), %rdi
leaq (%rdx,%rdx,2), %rdx
leaq (%rdi,%rdx,8), %rdx
xorl %esi, %esi
xorps %xmm0, %xmm0
cvtsi2sdq (%rcx,%rsi,8), %xmm0
movsd %xmm0, (%rdx,%rsi,8)
incq %rsi
cmpq $0x3, %rsi
jne 0x51c6d
movl $0x1, %edx
movq %r14, %rcx
testb $0x1, %al
movl $0x0, %eax
jne 0x51c63
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop