// File: /workspace/github_cpp_makefile_star2_O2/superblocks[P]superblocks/next.cpp
// Function: Superblocks::getsecondaryreward(int, int)
int Superblocks::getsecondaryreward( int seed, int step ) 
{
	if( debug ) { 
		cout << "getsecondaryreward: seed: " << seed << endl; 
		cout << "getsecondaryreward: step: " << step << endl; 
		cout << "getsecondaryreward: reward: " << reward[step] << endl;
		cout << "getsecondaryreward: secondary_rand_low: " << secondary_rand_low[step] << endl; 
		cout << "getsecondaryreward: secondary_rand_high: " << secondary_rand_high[step] << endl; 
		cout << "getsecondaryreward: secondary_rand_type: " 
			<< getsecondarylucktype( secondary_rand_type[step] ) << endl; 
		cout << "getsecondaryreward: secondary_rand_x: " << secondary_rand_x[step] << endl; 
	}

	int rand1 = Superblocks::generateMTRandom(seed, secondary_rand_low[step], secondary_rand_high[step]);

	int secondary_reward;

	switch( secondary_rand_type[step] ) {
		case 1: // SECONDARY_REWARD_PLUS_RAND_MINUS_X 
			secondary_reward = ( reward[step] + rand1 - secondary_rand_x[step] );
			break;
		default: 
			cout << "getsecondaryreward: error: unknown secondary_rand_type!" << endl;
			return 0;
	}

	if( debug ) {
		cout << "getsecondaryreward: rand1: " << rand1 << endl; 
		cout << "getsecondaryreward: secondary_reward: " << secondary_reward << endl; 
	}
	return secondary_reward;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r12d
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0x186e
movq 0x4898(%rip), %r15      # 0x5fd8
leaq 0x1abe(%rip), %rsi      # 0x3205
movq %r15, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r14d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1ab7(%rip), %rsi      # 0x3220
movq %r15, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r12d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1ab0(%rip), %rsi      # 0x323b
movq %r15, %rdi
callq 0x10e0
movslq %r12d, %r13
movl 0xd4(%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1aa3(%rip), %rsi      # 0x3258
movq %r15, %rdi
callq 0x10e0
movl 0x94(%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1aa5(%rip), %rsi      # 0x3281
movq %r15, %rdi
callq 0x10e0
movl 0x9c(%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1aa8(%rip), %rsi      # 0x32ab
movq %r15, %rdi
callq 0x10e0
movq %rax, %r15
movl 0x8c(%rbx,%r13,4), %edx
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1ab0
movq %r15, %rdi
movq %r12, %rsi
callq 0x10c0
movq %rax, %rdi
callq 0x1050
leaq -0x48(%rbp), %rdi
callq 0x1040
movq 0x4790(%rip), %rdi      # 0x5fd8
leaq 0x1a86(%rip), %rsi      # 0x32d5
callq 0x10e0
movl 0xa4(%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
jmp 0x1871
movslq %r12d, %r13
movl 0x94(%rbx,%r13,4), %edx
movl 0x9c(%rbx,%r13,4), %ecx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1e9a
cmpl $0x1, 0x8c(%rbx,%r13,4)
jne 0x18f7
movl %eax, %r15d
movl 0xd4(%rbx,%r13,4), %r14d
addl %eax, %r14d
subl 0xa4(%rbx,%r13,4), %r14d
cmpl $0x0, (%rbx)
je 0x1915
movq 0x471f(%rip), %rbx      # 0x5fd8
leaq 0x1a74(%rip), %rsi      # 0x3334
movq %rbx, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r15d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1a6e(%rip), %rsi      # 0x3350
movq %rbx, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r14d, %esi
callq 0x1110
jmp 0x190d
movq 0x46da(%rip), %rdi      # 0x5fd8
leaq 0x19f7(%rip), %rsi      # 0x32fc
callq 0x10e0
xorl %r14d, %r14d
movq %rax, %rdi
callq 0x1050
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x1120