// File: 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:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movl %edx, 0xf4(%rsp)
movq 0x100(%rsp), %rax
movq %rax, (%rsp)
movl $0x0, 0x1c(%rsp)
cmpl $0x1, 0x1c(%rsp)
jg 0xa43fa
movslq 0x1c(%rsp), %rax
leaq 0x3a907(%rip), %rdi     # 0xdec70
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq 0x1c(%rsp), %rax
leaq 0x60(%rsp), %rsi
imulq $0x48, %rax, %rax
addq %rax, %rsi
movslq 0x1c(%rsp), %rcx
leaq 0x3a973(%rip), %rax     # 0xded00
movsd (%rax,%rcx,8), %xmm0
callq 0xa46e0
movq (%rsp), %rdi
movslq 0x1c(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq 0x1c(%rsp), %rax
leaq 0x30(%rsp), %rsi
imulq $0x18, %rax, %rax
addq %rax, %rsi
movslq 0x1c(%rsp), %rcx
leaq 0x3a93c(%rip), %rax     # 0xded00
movsd (%rax,%rcx,8), %xmm0
callq 0xa4780
movslq 0x1c(%rsp), %rcx
leaq 0x3a926(%rip), %rax     # 0xded00
cvttsd2si (%rax,%rcx,8), %rcx
movslq 0x1c(%rsp), %rax
movq %rcx, 0x20(%rsp,%rax,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xa4352
jmp 0xa43fc
movl 0xf4(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0xf4(%rsp)
cmpl $0x0, %eax
je 0xa4474
movl $0x0, 0x18(%rsp)
cmpl $0x1, 0x18(%rsp)
jg 0xa4472
movslq 0x18(%rsp), %rax
leaq 0x60(%rsp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq 0x18(%rsp), %rax
leaq 0x60(%rsp), %rsi
imulq $0x48, %rax, %rax
addq %rax, %rsi
movslq 0x18(%rsp), %rax
leaq 0x60(%rsp), %rdx
imulq $0x48, %rax, %rax
addq %rax, %rdx
movslq 0x18(%rsp), %rax
movq 0x20(%rsp,%rax,8), %rcx
callq 0xa47e0
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0xa441c
jmp 0xa43fc
jmp 0xa4476
cmpq $0x0, 0xf8(%rsp)
je 0xa457a
movq 0xf8(%rsp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0xa44f7
movl $0x0, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
jg 0xa44f5
movslq 0x14(%rsp), %rax
leaq 0x60(%rsp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq 0x14(%rsp), %rax
leaq 0x30(%rsp), %rsi
imulq $0x18, %rax, %rax
addq %rax, %rsi
movslq 0x14(%rsp), %rax
leaq 0x30(%rsp), %rdx
imulq $0x18, %rax, %rax
addq %rax, %rdx
movslq 0x14(%rsp), %rax
movq 0x20(%rsp,%rax,8), %rcx
callq 0xa4910
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xa449f
jmp 0xa44f7
movq 0xf8(%rsp), %rax
sarq %rax
movq %rax, 0xf8(%rsp)
cmpq $0x0, 0xf8(%rsp)
je 0xa4575
movl $0x0, 0x10(%rsp)
cmpl $0x1, 0x10(%rsp)
jg 0xa4573
movslq 0x10(%rsp), %rax
leaq 0x60(%rsp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq 0x10(%rsp), %rax
leaq 0x60(%rsp), %rsi
imulq $0x48, %rax, %rax
addq %rax, %rsi
movslq 0x10(%rsp), %rax
leaq 0x60(%rsp), %rdx
imulq $0x48, %rax, %rax
addq %rax, %rdx
movslq 0x10(%rsp), %rax
movq 0x20(%rsp,%rax,8), %rcx
callq 0xa47e0
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0xa451d
jmp 0xa4575
jmp 0xa4476
movl $0x0, 0xc(%rsp)
cmpl $0x1, 0xc(%rsp)
jg 0xa45c6
movq (%rsp), %rsi
movslq 0xc(%rsp), %rax
leaq 0x30(%rsp), %rdi
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq 0xc(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
movslq 0xc(%rsp), %rax
movq 0x20(%rsp,%rax,8), %rdx
callq 0xa49d0
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xa4582
addq $0x108, %rsp            # imm = 0x108
retq
nop