// File: /workspace/github_cpp_makefile_star2_O3/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 0x1cd5
movq 0x4558(%rip), %r15      # 0x5fd8
leaq 0x177e(%rip), %rsi      # 0x3205
movl $0x1a, %edx
movq %r15, %rdi
callq 0x1100
movq %r15, %rdi
movl %r14d, %esi
callq 0x1140
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x1750(%rip), %rsi      # 0x3220
movl $0x1a, %edx
movq %r15, %rdi
callq 0x1100
movq %r15, %rdi
movl %r12d, %esi
callq 0x1140
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x1722(%rip), %rsi      # 0x323b
movl $0x1c, %edx
movq %r15, %rdi
callq 0x1100
movslq %r12d, %r13
movl 0xd4(%rbx,%r13,4), %esi
movq %r15, %rdi
callq 0x1140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x16ee(%rip), %rsi      # 0x3258
movl $0x28, %edx
movq %r15, %rdi
callq 0x1100
movl 0x94(%rbx,%r13,4), %esi
movq %r15, %rdi
callq 0x1140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x16c9(%rip), %rsi      # 0x3281
movl $0x29, %edx
movq %r15, %rdi
callq 0x1100
movl 0x9c(%rbx,%r13,4), %esi
movq %r15, %rdi
callq 0x1140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x16a5(%rip), %rsi      # 0x32ab
movl $0x29, %edx
movq %r15, %rdi
callq 0x1100
movl 0x8c(%rbx,%r13,4), %edx
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x206a
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r15, %rdi
callq 0x1100
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c7e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10e0
movq 0x4353(%rip), %r15      # 0x5fd8
leaq 0x1649(%rip), %rsi      # 0x32d5
movl $0x26, %edx
movq %r15, %rdi
callq 0x1100
movl 0xa4(%rbx,%r13,4), %esi
movq %r15, %rdi
callq 0x1140
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
jmp 0x1cd8
movslq %r12d, %r13
movl 0x94(%rbx,%r13,4), %edx
movl 0x9c(%rbx,%r13,4), %ecx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x268e
cmpl $0x1, 0x8c(%rbx,%r13,4)
jne 0x1d95
movl %eax, %r15d
movl 0xd4(%rbx,%r13,4), %r14d
addl %eax, %r14d
subl 0xa4(%rbx,%r13,4), %r14d
cmpl $0x0, (%rbx)
je 0x1dda
movq 0x42b0(%rip), %rbx      # 0x5fd8
leaq 0x1605(%rip), %rsi      # 0x3334
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1140
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x15d8(%rip), %rsi      # 0x3350
movl $0x26, %edx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1140
movq %rax, %rbx
jmp 0x1db3
movq 0x423c(%rip), %rbx      # 0x5fd8
leaq 0x1559(%rip), %rsi      # 0x32fc
movl $0x37, %edx
movq %rbx, %rdi
callq 0x1100
xorl %r14d, %r14d
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e08
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1150