// File: disjukr[P]Tetris/Randomizer.cc
// Function: TGM2Randomizer::Get()
Tetromino* TGM2Randomizer::Get() {
    int type = random.Get(0, first ? 3 : 6); // exclude O, S, Z
    first = false;
    int i = 0;
    while (this -> CheckHistory(type) && i++ < tryCount)
        type = random.Get(0, 6);
    history[pos] = type;
    pos = (pos + 1) % 4;
    switch (type) {
    case I: return new IMino();
    case O: return new OMino();
    case T: return new TMino();
    case S: return new SMino();
    case Z: return new ZMino();
    case J: return new JMino();
    default: return new LMino();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq %rax, %rdi
addq $0x20, %rdi
movb 0x38(%rax), %cl
movl $0x6, %edx
movl $0x3, %eax
testb $0x1, %cl
cmovnel %eax, %edx
xorl %esi, %esi
callq 0x8f80
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, -0x14(%rbp)
movb $0x0, 0x38(%rax)
movl $0x0, -0x18(%rbp)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x9350
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x31(%rbp)
jne 0x9406
jmp 0x941a
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
cmpl $0x6, %eax
setl %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x9423
jmp 0x943c
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
xorl %esi, %esi
movl $0x6, %edx
callq 0x8f80
movl %eax, -0x14(%rbp)
jmp 0x93ec
movq -0x30(%rbp), %rax
movl -0x14(%rbp), %edx
movslq 0x3c(%rax), %rcx
movl %edx, 0x40(%rax,%rcx,4)
movl 0x3c(%rax), %esi
movl %esi, %ecx
incl %ecx
movl %esi, %edx
addl $0x4, %edx
testl %ecx, %ecx
cmovsl %edx, %ecx
andl $-0x4, %ecx
negl %ecx
movl %ecx, %edx
movl %esi, %ecx
leal 0x1(%rcx,%rdx), %ecx
movl %ecx, 0x3c(%rax)
movl -0x14(%rbp), %eax
movq %rax, -0x40(%rbp)
subq $0x6, %rax
ja 0x9617
movq -0x40(%rbp), %rax
leaq 0x300c(%rip), %rcx      # 0xc494
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
callq 0x9670
jmp 0x94ac
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x50(%rbp)
callq 0x96b0
jmp 0x94ee
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
callq 0x96f0
jmp 0x9530
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
callq 0x9730
jmp 0x9572
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
callq 0x9770
jmp 0x95b4
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
callq 0x97b0
jmp 0x95f6
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movl $0x18, %edi
callq 0x3150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
callq 0x97f0
jmp 0x9632
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9653
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x9660
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x3270
nopl (%rax)