// File: ChnMasterOG[P]KmerGO2/kmergo/kmer_union.cpp
// Function: distribute_kmer_nonuniformly(unsigned char, unsigned int, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void distribute_kmer_nonuniformly(uint8_t step, uint32_t num, uint32_t maxnum, std::string& out_kmer)
{
	if (step == 4) return;
	if (num < 4 * maxnum / 10) {
		out_kmer += "A"; distribute_kmer_nonuniformly(step + 1, num, 4 * maxnum / 10, out_kmer);
	}
	else if (num < 7 * maxnum / 10) {
		out_kmer += "C"; distribute_kmer_nonuniformly(step + 1, num - 4 * maxnum / 10, 3 * maxnum / 10, out_kmer);
	}
	else if (num < 9 * maxnum / 10) {
		out_kmer += "G"; distribute_kmer_nonuniformly(step + 1, num - 7 * maxnum / 10, 2 * maxnum / 10, out_kmer);
	}
	else {
		out_kmer += "T"; distribute_kmer_nonuniformly(step + 1, num - 9 * maxnum / 10, maxnum / 10, out_kmer);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
movzbl -0x1(%rbp), %eax
cmpl $0x4, %eax
jne 0x40a346
jmp 0x40a4c9
movl -0x8(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
shll $0x2, %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movl -0x1c(%rbp), %eax
cmpl %ecx, %eax
jae 0x40a3a6
movq -0x18(%rbp), %rdi
leaq 0x1c1b1e(%rip), %rsi    # 0x5cbe8d
callq 0x4a07d0
movzbl -0x1(%rbp), %eax
addl $0x1, %eax
movb %al, -0x1d(%rbp)
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %eax
shll $0x2, %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edx
movb -0x1d(%rbp), %al
movq -0x18(%rbp), %rcx
movzbl %al, %edi
callq 0x40a320
jmp 0x40a4c9
movl -0x8(%rbp), %eax
movl %eax, -0x24(%rbp)
imull $0x7, -0xc(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movl -0x24(%rbp), %eax
cmpl %ecx, %eax
jae 0x40a413
movq -0x18(%rbp), %rdi
leaq 0x1c1b21(%rip), %rsi    # 0x5cbeee
callq 0x4a07d0
movzbl -0x1(%rbp), %eax
addl $0x1, %eax
movb %al, -0x25(%rbp)
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %eax
shll $0x2, %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
subl %eax, %esi
imull $0x3, -0xc(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edx
movb -0x25(%rbp), %al
movq -0x18(%rbp), %rcx
movzbl %al, %edi
callq 0x40a320
jmp 0x40a4c7
movl -0x8(%rbp), %eax
movl %eax, -0x2c(%rbp)
imull $0x9, -0xc(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movl -0x2c(%rbp), %eax
cmpl %ecx, %eax
jae 0x40a47c
movq -0x18(%rbp), %rdi
leaq 0x1c0110(%rip), %rsi    # 0x5ca54a
callq 0x4a07d0
movzbl -0x1(%rbp), %eax
addl $0x1, %eax
movb %al, -0x2d(%rbp)
movl -0x8(%rbp), %esi
imull $0x7, -0xc(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
subl %eax, %esi
movl -0xc(%rbp), %eax
shll %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edx
movb -0x2d(%rbp), %al
movq -0x18(%rbp), %rcx
movzbl %al, %edi
callq 0x40a320
jmp 0x40a4c5
movq -0x18(%rbp), %rdi
leaq 0x1c1a0e(%rip), %rsi    # 0x5cbe95
callq 0x4a07d0
movzbl -0x1(%rbp), %eax
addl $0x1, %eax
movb %al, -0x2e(%rbp)
movl -0x8(%rbp), %esi
imull $0x9, -0xc(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
subl %eax, %esi
movl -0xc(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edx
movb -0x2e(%rbp), %al
movq -0x18(%rbp), %rcx
movzbl %al, %edi
callq 0x40a320
jmp 0x40a4c7
jmp 0x40a4c9
addq $0x30, %rsp
popq %rbp
retq
nop