// File: /workspace/github_c_makefile_star2_O3/cyb70289[P]tt/src/apn/integer/prime.c
// Function: tt_int_isprime_buf
bool _tt_int_isprime_buf(const _tt_word *ui, int msb)
{
	if (msb == 1 && ui[0] < BIT(31))
		return isprime_naive(ui[0]);

	if ((ui[0] & 0x1) == 0)
		return false;

	if (!maybe_prime(ui, msb))
		return false;

	int bits = (msb - 1) * _tt_word_bits;
	bits += _tt_int_word_bits(ui[msb-1]);
	return isprime_miller_rabin(ui, msb, ml_rounds(bits));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %esi, %r13d
movq %rdi, %rbp
movq (%rdi), %rcx
cmpl $0x1, %esi
jne 0x831c
cmpq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
ja 0x832c
movl %ecx, %eax
andl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
cmpl $0x2, %eax
jne 0x8430
movb $0x1, %r14b
jmp 0x8ba9
setge %al
testb %al, %cl
je 0x8428
movl %r13d, %r14d
jmp 0x833b
movl $0x1, %r14d
testb $0x1, %cl
je 0x8428
movl $0x1, %esi
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
xorl %edi, %edi
leaq 0xb82d(%rip), %r8       # 0x13b80
leaq 0xa946(%rip), %r9       # 0x12ca0
movq %r14, 0x50(%rsp)
movq (%r8,%rsi,8), %r10
movzwl (%r9,%rsi,2), %r11d
xorl %ebx, %ebx
xorl %eax, %eax
movl %eax, %r14d
movq (%rbp,%rbx,8), %r15
movq %r15, %rax
subq %r14, %rax
andq %rcx, %rax
movq %r15, %r12
subq %r14, %r12
cmovbq %rax, %r12
movq %r12, %rax
imulq %r10, %rax
andq %rcx, %rax
mulq %r11
subq %r12, %rax
sbbq $0x0, %rdx
shrq $0x3f, %rax
cmpq %r14, %r15
movq 0x50(%rsp), %r14
leal (%rax,%rdx,2), %eax
adcl $0x0, %eax
incq %rbx
cmpq %rbx, %r14
jne 0x836c
testl %eax, %eax
je 0x83d3
cmpq $0x76b, %rsi            # imm = 0x76B
leaq 0x1(%rsi), %rax
setae %dil
movq %rax, %rsi
cmpq $0x76c, %rax            # imm = 0x76C
jne 0x835f
testb $0x1, %dil
je 0x8428
movl %r13d, %ebx
shll $0x6, %ebx
subl %r13d, %ebx
movslq %r13d, %rax
movq -0x8(%rbp,%rax,8), %rdi
decq %rax
movq %rax, 0xc8(%rsp)
callq 0x4a9a
leal (%rbx,%rax), %ecx
addl $-0x3f, %ecx
xorl %eax, %eax
leaq 0xf2d7(%rip), %rdx      # 0x176e0
cmpl %ecx, (%rdx,%rax,8)
jle 0x84a1
incq %rax
cmpq $0xc, %rax
jne 0x8409
movl $0x2, 0xc(%rsp)
jmp 0x84a9
xorl %r14d, %r14d
jmp 0x8ba9
imull $0xaaaaaaab, %ecx, %eax # imm = 0xAAAAAAAB
xorl %r14d, %r14d
cmpl $0x55555556, %eax       # imm = 0x55555556
jb 0x8ba9
cmpq $0x2, %rcx
jb 0x8ba9
movl %ecx, %eax
andl $0x1, %eax
je 0x8ba9
cmpq $0x19, %rcx
jb 0x8314
movl $0xb, %esi
leal -0x6(%rsi), %edi
xorl %r14d, %r14d
movl %ecx, %eax
xorl %edx, %edx
divl %edi
testl %edx, %edx
je 0x8ba9
leal -0x4(%rsi), %edi
xorl %r14d, %r14d
movl %ecx, %eax
xorl %edx, %edx
divl %edi
testl %edx, %edx
je 0x8ba9
movl %esi, %eax
imull %esi, %eax
addl $0x6, %esi
cmpl %ecx, %eax
jbe 0x8468
jmp 0x8314
movl 0x4(%rdx,%rax,8), %eax
movl %eax, 0xc(%rsp)
movl %r13d, %eax
movq %rax, 0x10(%rsp)
imull $0x38, %r13d, %eax
addl $0x70, %eax
movslq %eax, %rdi
callq 0x1140
movq %rax, %r12
leaq 0xf0(%rsp), %rbx
movl $0x0, (%rbx)
movl %r13d, 0x4(%rbx)
movl %r13d, 0x8(%rbx)
movq %rbp, 0x10(%rbx)
callq 0x4910
movq %rax, %r15
movq %rbp, %r14
leal 0x1(%r13), %ebp
movq %rax, %rdi
movl %ebp, %esi
callq 0x4986
movq 0x10(%r15), %rax
movq 0x50(%rsp), %rcx
movq $0x1, (%rax,%rcx,8)
movl %ebp, 0x8(%r15)
movq %r15, %rbp
callq 0x4910
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x8128
movq %r15, 0x68(%rsp)
cmpl $0x0, (%r15)
movq %r13, %rbx
jne 0x8542
movq 0x68(%rsp), %rdi
movq %rbp, %rsi
movq %rdi, %rdx
callq 0x6fc0
movq 0x10(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x80(%rsp)
callq 0x4910
xorl %r13d, %r13d
leaq 0xf0(%rsp), %rcx
xorl %edi, %edi
movq %rax, 0xa0(%rsp)
movq %rax, %rsi
movq %rbp, 0xa8(%rsp)
movq %rbp, %rdx
callq 0x70d8
leal (,%rbx,8), %edx
movq %r12, %rdi
movq %r14, %rsi
movq %rdx, 0xc0(%rsp)
callq 0x1120
movq (%r12), %rdi
movq %rbx, 0x20(%rsp)
decq %rdi
movq %rdi, (%r12)
movq %r14, %rbp
jne 0x85e6
leaq 0x8(%r12), %r14
xorl %r13d, %r13d
movq 0x20(%rsp), %rbx
cmpl $0x2, %ebx
jl 0x85d9
leal -0x1(%rbx), %edx
shlq $0x3, %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x1160
movq (%r12), %rdi
jmp 0x85db
xorl %edi, %edi
addl $0x3f, %r13d
decl %ebx
testq %rdi, %rdi
je 0x85bc
callq 0x4aae
movl %eax, %r15d
movl %eax, %edx
negl %edx
movq %r12, %rdi
movl %ebx, %esi
callq 0x4b7f
movq %rax, 0x60(%rsp)
callq 0x4910
movq %rax, 0x28(%rsp)
movq %rax, %rdi
movq 0x80(%rsp), %rbx
movl %ebx, %esi
callq 0x4986
movb $0x1, %r14b
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x8b70
movq %r12, 0x78(%rsp)
movq 0x10(%rsp), %rax
leaq (%r12,%rax,8), %rcx
addq $0x10, %rcx
addl %r13d, %r15d
movl %r15d, 0x9c(%rsp)
movl %ebx, %eax
shll $0x4, %eax
movq %rax, 0x30(%rsp)
leal (%rbx,%rbx), %eax
movq %rcx, 0x58(%rsp)
leaq (%rcx,%rax,8), %rax
movq %rax, 0x70(%rsp)
leaq (%rax,%rbx,8), %r14
movq 0x60(%rsp), %rax
decl %eax
movq %rax, 0xb8(%rsp)
movq %rbp, 0x10(%rsp)
movq 0x50(%rsp), %r15
movq 0x28(%rsp), %r13
movq %r14, 0x88(%rsp)
movq 0x10(%r13), %rbx
xorl %r14d, %r14d
callq 0x9156
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shlq $0x20, %rax
movq %rax, (%rbx,%r14,8)
callq 0x9156
movl %eax, %eax
orq %rax, (%rbx,%r14,8)
incq %r14
cmpq %r14, %r15
jne 0x8695
movq 0xc8(%rsp), %r14
movq (%rbp,%r14,8), %rdi
callq 0x4a9a
movq $-0x1, %rdx
movl %eax, %ecx
shlq %cl, %rdx
notq %rdx
andq %rdx, (%rbx,%r14,8)
movq %rbx, %rdi
movq 0x20(%rsp), %r14
movl %r14d, %esi
callq 0x59a5
movq %rbp, %r13
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
movq %r13, %rdx
movl %r14d, %ecx
callq 0x5974
testl %eax, %eax
js 0x871a
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
movl %r14d, %ecx
callq 0x58f2
movl %eax, %ebp
movq 0x60(%rsp), %r15
movq 0x30(%rsp), %r12
movq 0x58(%rsp), %r13
cmpl $0x1, %ebp
movq 0x28(%rsp), %r14
jne 0x874b
cmpq $0x2, (%rbx)
ja 0x874b
callq 0x9156
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, (%rbx)
cmpl $0x3, %eax
jb 0x8739
movq $0x1, 0xd8(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
leaq 0xd8(%rsp), %rbx
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x58f2
movl %eax, 0x8(%r14)
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10e0
movq 0x10(%r14), %rsi
movl 0x8(%r14), %edx
movq 0xa8(%rsp), %rax
movq 0x10(%rax), %rcx
movl 0x8(%rax), %r8d
movq %r13, %rdi
callq 0x59c2
movl $0x0, 0xd8(%rsp)
movl %eax, 0xdc(%rsp)
movl %eax, 0xe0(%rsp)
movq %r13, 0xe8(%rsp)
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
leaq 0xf0(%rsp), %rcx
callq 0x70d8
movq 0x10(%r14), %rsi
movslq 0x8(%r14), %rdx
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x90(%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0xa0(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0xb0(%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rsp)
movl %edx, 0x8(%rsp)
movq %rdx, 0x40(%rsp)
shlq $0x3, %rdx
movq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %rsi, 0x48(%rsp)
callq 0x1120
movq 0xb8(%rsp), %rcx
testl %r15d, %r15d
movq %rbx, %r15
movq 0x80(%rsp), %rbx
leaq 0x8(%rsp), %r12
jle 0x89c7
movq 0x78(%rsp), %rax
movq (%rax,%rcx,8), %r14
movl $0x3f, %ebp
movq %rcx, 0xd0(%rsp)
cmpq 0xb8(%rsp), %rcx
jne 0x888c
movq %r14, %rdi
callq 0x4a9a
movl %eax, %ebp
movl %ebp, %ecx
negb %cl
shlq %cl, %r14
decl %ebp
je 0x89af
movl 0x8(%rsp), %r13d
movq 0x58(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %rdx
callq 0x10e0
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
movq %r15, %rcx
movl %r13d, %r8d
callq 0x59c2
subq $0x8, %rsp
movq %rbx, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %eax, %ecx
movq 0x98(%rsp), %r8
movl 0x24(%rsp), %r9d
movq 0x90(%rsp), %r12
pushq %r12
pushq 0x30(%rsp)
pushq 0x28(%rsp)
callq 0x816c
addq $0x20, %rsp
movslq 0x8(%rsp), %r13
movq %r13, %rdx
shlq $0x3, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1120
btq $0x3e, %r14
jae 0x897d
movq %rbx, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %rdx
callq 0x10e0
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %r8
callq 0x59c2
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
movl %eax, %ecx
movq 0x98(%rsp), %r8
movl 0x24(%rsp), %r9d
pushq %r12
pushq 0x30(%rsp)
pushq 0x28(%rsp)
callq 0x816c
addq $0x20, %rsp
movslq 0x8(%rsp), %r13
movq %r13, %rdx
shlq $0x3, %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1120
decl %ebp
movslq %r13d, %rax
leaq (%r15,%rax,8), %rdi
movq 0x80(%rsp), %rbx
movl %ebx, %ecx
subl %eax, %ecx
shll $0x3, %ecx
movslq %ecx, %rdx
xorl %esi, %esi
callq 0x10e0
addq %r14, %r14
testl %ebp, %ebp
leaq 0x8(%rsp), %r12
jne 0x8891
movq 0xd0(%rsp), %rcx
leaq -0x1(%rcx), %rax
testq %rcx, %rcx
movq %rax, %rcx
jg 0x8853
movq 0x48(%rsp), %r12
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq 0xc0(%rsp), %rdx
callq 0x1120
movq %r15, %r14
movq 0x50(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r12,%r15,8)
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movq 0xb0(%rsp), %r12
movq %r12, %rdx
movl 0x3c(%rsp), %ebp
movl %ebp, %ecx
callq 0x58f2
movl %eax, 0x40(%rsp)
movl 0x8(%rsp), %esi
movq %r14, %rdi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x5974
testl %eax, %eax
movq 0x88(%rsp), %r14
je 0x8b38
movl 0x8(%rsp), %esi
movq 0x70(%rsp), %rdi
movq 0x48(%rsp), %rdx
movl 0x40(%rsp), %ecx
callq 0x5974
testl %eax, %eax
je 0x8b38
movl 0x9c(%rsp), %r13d
decl %r13d
movq 0x70(%rsp), %rbp
je 0x8b66
movq 0x58(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
movq 0x30(%rsp), %rdx
callq 0x10e0
movl 0x8(%rsp), %edx
movq %r12, %rdi
movq %rbp, %rsi
movq %rbp, %rcx
movl %edx, %r8d
callq 0x59c2
subq $0x8, %rsp
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
movl %eax, %ecx
movq 0x98(%rsp), %r8
movl 0x24(%rsp), %r9d
pushq %r14
pushq 0x30(%rsp)
pushq 0x28(%rsp)
callq 0x816c
addq $0x20, %rsp
movslq 0x8(%rsp), %r14
leaq (,%r14,8), %rdx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1120
leaq (,%r14,8), %rdi
addq %rbp, %rdi
movl %ebx, %eax
subl %r14d, %eax
shll $0x3, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x10e0
movq %rbp, %rdi
movl %r14d, %esi
movq 0x88(%rsp), %r14
movq 0xb0(%rsp), %rdx
movl 0x3c(%rsp), %ecx
callq 0x5974
testl %eax, %eax
je 0x8b66
movl 0x8(%rsp), %esi
movq %rbp, %rdi
movq 0x48(%rsp), %rdx
movl 0x40(%rsp), %ecx
callq 0x5974
testl %eax, %eax
jne 0x8a5b
movl 0xc(%rsp), %ebx
decl %ebx
movq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x4a77
movl %ebx, 0xc(%rsp)
testl %ebx, %ebx
movq 0x10(%rsp), %rbp
jne 0x868e
movq 0x78(%rsp), %rdi
movb $0x1, %r14b
jmp 0x8b78
xorl %r14d, %r14d
movq 0x78(%rsp), %rdi
jmp 0x8b73
movq %r12, %rdi
movq 0x28(%rsp), %r13
callq 0x1030
movq 0xa8(%rsp), %rdi
callq 0x4970
movq 0x68(%rsp), %rdi
callq 0x4970
movq 0xa0(%rsp), %rdi
callq 0x4970
movq %r13, %rdi
callq 0x4970
movl %r14d, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq