// File: /workspace/github_cpp_makefile_star2_O2/superblocks[P]superblocks/utils.cpp
// Function: Superblocks::gethashcutout(int, char const*)
long Superblocks::gethashcutout( int step, const char* hash ) 
{
	if( debug ) { 
		cout << "gethashcutout: step: " << step << endl; 
		cout << "gethashcutout: cutout_start: "  << cutout_start[step] << endl;
		cout << "gethashcutout: cutout_length: " << cutout_length[step] << endl; 
	}

	int hlen = strlen(hash);
	if( debug ) { cout << "gethashcutout: srlen(hash): " << hlen << endl; }
	if( hlen != hash_length ) {
		cout << "gethashcutout: error: hash length not " << hash_length << endl;
		return 0;
	}
	if( debug ) { cout << "gethashcutout: hash: " << hash << endl; }
	string hash_string(hash);
	if( debug ) { cout << "gethashcutout: hash_string: " << hash_string << endl; }
	std::string cseed_str = hash_string.substr( cutout_start[step], cutout_length[step]);
	const char* cseed = cseed_str.c_str();
	if( debug ) { cout << "gethashcutout: cseed: " << cseed << endl; }
	long seed = hex2long(cseed);
	if( debug ) { cout << "gethashcutout: return: seed: " << seed << endl; }
	return seed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rdi, %rbx
cmpl $0x0, (%rdi)
movslq %esi, %r14
je 0x1cc9
movq 0x4382(%rip), %r12      # 0x5fd8
leaq 0x1803(%rip), %rsi      # 0x3460
movq %r12, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r14d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x17f7(%rip), %rsi      # 0x3476
movq %r12, %rdi
callq 0x10e0
movl 0x64(%rbx,%r14,4), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x17f1(%rip), %rsi      # 0x3494
movq %r12, %rdi
callq 0x10e0
movl 0x6c(%rbx,%r14,4), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
cmpl $0x0, (%rbx)
sete %r13b
jmp 0x1ccc
movb $0x1, %r13b
movq %r15, %rdi
callq 0x1030
movq %rax, %r12
testb %r13b, %r13b
jne 0x1d02
movq 0x42f5(%rip), %rdi      # 0x5fd8
leaq 0x17c9(%rip), %rsi      # 0x34b3
callq 0x10e0
movq %rax, %rdi
movl %r12d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
cmpl %r12d, 0x58(%rbx)
jne 0x1dc2
cmpl $0x0, (%rbx)
je 0x1d37
movq 0x42c0(%rip), %rdi      # 0x5fd8
leaq 0x17d8(%rip), %rsi      # 0x34f7
callq 0x10e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x10e0
movq %rax, %rdi
callq 0x1050
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rdx
movq %r15, %rsi
callq 0x1b0c
cmpl $0x0, (%rbx)
je 0x1d73
movq 0x4285(%rip), %rdi      # 0x5fd8
leaq 0x17b3(%rip), %rsi      # 0x350d
callq 0x10e0
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x10c0
movq %rax, %rdi
callq 0x1050
movslq 0x64(%rbx,%r14,4), %rdx
movslq 0x6c(%rbx,%r14,4), %rcx
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x10f0
movq -0x48(%rbp), %r14
cmpl $0x0, (%rbx)
je 0x1dec
movq 0x423e(%rip), %rdi      # 0x5fd8
leaq 0x1789(%rip), %rsi      # 0x352a
callq 0x10e0
movq %rax, %rdi
movq %r14, %rsi
callq 0x10e0
movq %rax, %rdi
callq 0x1050
cmpl $0x0, (%rbx)
sete %r15b
jmp 0x1def
movq 0x420f(%rip), %rdi      # 0x5fd8
leaq 0x1700(%rip), %rsi      # 0x34d0
callq 0x10e0
movl 0x58(%rbx), %esi
movq %rax, %rdi
callq 0x1110
movq %rax, %rdi
callq 0x1050
xorl %ebx, %ebx
jmp 0x1e37
movb $0x1, %r15b
movq %r14, %rsi
callq 0x1e70
movq %rax, %rbx
testb %r15b, %r15b
jne 0x1e25
movq 0x41d2(%rip), %rdi      # 0x5fd8
leaq 0x1734(%rip), %rsi      # 0x3541
callq 0x10e0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x10d0
movq %rax, %rdi
callq 0x1050
leaq -0x48(%rbp), %rdi
callq 0x1040
leaq -0x68(%rbp), %rdi
callq 0x1040
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e5b
jmp 0x1e4d
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x1040
jmp 0x1e5e
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x1120
nop