// File: /workspace/github_cpp_makefile_star2_O1/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 %esi, %r15d
movq %rdi, %rbx
cmpl $0x0, (%rdi)
movslq %edx, %r14
je 0x1cdb
movq 0x454c(%rip), %r12      # 0x5fd8
leaq 0x1772(%rip), %rsi      # 0x3205
movl $0x1a, %edx
movq %r12, %rdi
callq 0x1100
movq %r12, %rdi
movl %r15d, %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 0x1744(%rip), %rsi      # 0x3220
movl $0x1a, %edx
movq %r12, %rdi
callq 0x1100
movq %r12, %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 0x1716(%rip), %rsi      # 0x323b
movl $0x1c, %edx
movq %r12, %rdi
callq 0x1100
movl 0xd4(%rbx,%r14,4), %esi
movq %r12, %rdi
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 0x16e5(%rip), %rsi      # 0x3258
movl $0x28, %edx
movq %r12, %rdi
callq 0x1100
movl 0x94(%rbx,%r14,4), %esi
movq %r12, %rdi
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 0x16c0(%rip), %rsi      # 0x3281
movl $0x29, %edx
movq %r12, %rdi
callq 0x1100
movl 0x9c(%rbx,%r14,4), %esi
movq %r12, %rdi
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 0x169c(%rip), %rsi      # 0x32ab
movl $0x29, %edx
movq %r12, %rdi
callq 0x1100
movl 0x8c(%rbx,%r14,4), %edx
leaq -0x48(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2074
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %r12, %rdi
callq 0x1100
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 -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1c86
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10e0
movq 0x434b(%rip), %r12      # 0x5fd8
leaq 0x1641(%rip), %rsi      # 0x32d5
movl $0x26, %edx
movq %r12, %rdi
callq 0x1100
movl 0xa4(%rbx,%r14,4), %esi
movq %r12, %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
movl 0x94(%rbx,%r14,4), %edx
movl 0x9c(%rbx,%r14,4), %ecx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2686
cmpl $0x1, 0x8c(%rbx,%r14,4)
jne 0x1d98
movl %eax, %r12d
movl 0xd4(%rbx,%r14,4), %r15d
addl %eax, %r15d
subl 0xa4(%rbx,%r14,4), %r15d
cmpl $0x0, (%rbx)
je 0x1ddd
movq 0x42ad(%rip), %rbx      # 0x5fd8
leaq 0x1602(%rip), %rsi      # 0x3334
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
movl %r12d, %esi
callq 0x1140
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1080
leaq 0x15d5(%rip), %rsi      # 0x3350
movl $0x26, %edx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1140
movq %rax, %rbx
jmp 0x1db6
movq 0x4239(%rip), %rbx      # 0x5fd8
leaq 0x1556(%rip), %rsi      # 0x32fc
movl $0x37, %edx
movq %rbx, %rdi
callq 0x1100
xorl %r15d, %r15d
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 %r15d, %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 0x1e0b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1150