// File: /workspace/github_c_makefile_star2_O1/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 $0xf8, %rsp
movq %rdi, %r13
cmpl $0x1, %esi
jne 0x837e
movq (%r13), %rcx
cmpq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
ja 0x837e
movl %ecx, %eax
andl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
movb $0x1, %r8b
cmpl $0x2, %eax
je 0x8483
imull $0xaaaaaaab, %ecx, %eax # imm = 0xAAAAAAAB
xorl %r8d, %r8d
cmpl $0x55555556, %eax       # imm = 0x55555556
jb 0x8483
cmpq $0x2, %rcx
jb 0x8483
movl %ecx, %eax
andl $0x1, %eax
je 0x8483
cmpq $0x19, %rcx
setb %r8b
jb 0x8483
movl $0xb, %esi
leal -0x6(%rsi), %edi
xorl %r8d, %r8d
movl %ecx, %eax
xorl %edx, %edx
divl %edi
testl %edx, %edx
je 0x8483
leal -0x4(%rsi), %edi
xorl %r8d, %r8d
movl %ecx, %eax
xorl %edx, %edx
divl %edi
testl %edx, %edx
je 0x8483
movl %esi, %eax
imull %esi, %eax
addl $0x6, %esi
cmpl %ecx, %eax
seta %r8b
jbe 0x8341
jmp 0x8483
testb $0x1, (%r13)
je 0x8480
testl %esi, %esi
jle 0x8480
movq %rsi, 0x30(%rsp)
movl %esi, %ebp
movl $0x1, %esi
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
xorl %edi, %edi
leaq 0xb7d0(%rip), %r8       # 0x13b80
leaq 0xa8e9(%rip), %r9       # 0x12ca0
movq (%r8,%rsi,8), %r10
movzwl (%r9,%rsi,2), %r11d
xorl %ebx, %ebx
xorl %eax, %eax
movl %eax, %r14d
movq (%r13,%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
leal (%rax,%rdx,2), %eax
adcl $0x0, %eax
incq %rbx
cmpq %rbx, %rbp
jne 0x83c4
testl %eax, %eax
je 0x8426
cmpq $0x76b, %rsi            # imm = 0x76B
leaq 0x1(%rsi), %rax
setae %dil
movq %rax, %rsi
cmpq $0x76c, %rax            # imm = 0x76C
jne 0x83b7
testb $0x1, %dil
je 0x8480
movq 0x30(%rsp), %r12
movl %r12d, %ebx
shll $0x6, %ebx
subl %r12d, %ebx
movslq %r12d, %rax
leaq -0x1(%rax), %rcx
movq %rcx, 0xa8(%rsp)
movq %rax, %r14
movq -0x8(%r13,%rax,8), %rdi
callq 0x4a69
leal (%rbx,%rax), %ecx
addl $-0x3f, %ecx
xorl %eax, %eax
leaq 0xf27b(%rip), %rdx      # 0x176e0
movq %rbp, 0x50(%rsp)
cmpl %ecx, (%rdx,%rax,8)
jle 0x849c
incq %rax
cmpq $0xc, %rax
jne 0x846a
movl $0x2, %r15d
jmp 0x84a1
xorl %r8d, %r8d
andb $0x1, %r8b
movl %r8d, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rdx,%rax,8), %r15d
addq $0x2, %r14
imull $0x38, %r14d, %eax
movslq %eax, %rdi
callq 0x1140
movq %rax, 0x10(%rsp)
movq %r14, 0xc0(%rsp)
movl %r14d, %eax
movq %rax, 0x58(%rsp)
leaq 0xe0(%rsp), %r14
movl $0x0, (%r14)
movl %r12d, 0x4(%r14)
movl %r12d, 0x8(%r14)
movq %r13, 0x10(%r14)
callq 0x48dc
movq %rax, %rbx
leal 0x1(%r12), %ebp
movq %rax, %rdi
movl %ebp, %esi
callq 0x4952
movq 0x10(%rbx), %rax
movq 0x50(%rsp), %rcx
movq $0x1, (%rax,%rcx,8)
movl %ebp, 0x8(%rbx)
callq 0x48dc
movq %rax, %rbp
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x8118
movq %rbp, 0x48(%rsp)
cmpl $0x0, (%rbp)
jne 0x853d
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
movq %rdi, %rdx
callq 0x7004
movq 0x10(%rsp), %r14
movq 0x58(%rsp), %rax
leaq (%r14,%rax,8), %rbp
callq 0x48dc
leaq 0xe0(%rsp), %rcx
xorl %edi, %edi
movq %rax, 0x80(%rsp)
movq %rax, %rsi
movq %rbx, 0x40(%rsp)
movq %rbx, %rdx
callq 0x711c
leal (,%r12,8), %edx
movq %r14, %rdi
movq %r13, %rsi
movq %rdx, 0xa0(%rsp)
callq 0x1120
xorl %ecx, %ecx
movq (%r14), %rdi
movl %r12d, %ebx
decq %rdi
movq %rdi, (%r14)
jne 0x85df
movq %r14, %rcx
addq $0x8, %rcx
movq %rcx, 0x8(%rsp)
xorl %ecx, %ecx
movl %r12d, %ebx
cmpl $0x2, %ebx
jl 0x85d2
leal -0x1(%rbx), %edx
shlq $0x3, %rdx
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %rcx, %r14
callq 0x1160
movq %r14, %rcx
movq 0x10(%rsp), %r14
addl $0x3f, %ecx
movq (%r14), %rdi
decl %ebx
testq %rdi, %rdi
je 0x85ae
movq %r13, 0x8(%rsp)
movq %rcx, %r13
callq 0x4a7d
movl %eax, %r14d
movl %eax, %edx
negl %edx
movq 0x10(%rsp), %rdi
movl %ebx, %esi
callq 0x4b6a
movq %rax, 0x78(%rsp)
addl %r14d, %r13d
movq %r13, 0x98(%rsp)
callq 0x48dc
movq %rax, 0x20(%rsp)
movq %rax, %rdi
movq 0x58(%rsp), %rbx
movl %ebx, %esi
callq 0x4952
movl %ebx, %eax
shll $0x4, %eax
movq %rax, 0x38(%rsp)
leal (%rbx,%rbx), %eax
leaq (,%rax,8), %r13
addq %rbp, %r13
leaq (%r13,%rbx,8), %rax
movq %rax, 0x60(%rsp)
movq 0x78(%rsp), %rax
decl %eax
movq %rax, 0x90(%rsp)
movb $0x1, %al
movl %eax, 0x18(%rsp)
subl $0x1, %r15d
jb 0x8afc
movl %r15d, 0x74(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rbx
testl %r12d, %r12d
movq 0x50(%rsp), %r15
jle 0x86a9
xorl %r14d, %r14d
callq 0x90d2
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shlq $0x20, %rax
movq %rax, (%rbx,%r14,8)
callq 0x90d2
movl %eax, %eax
orq %rax, (%rbx,%r14,8)
incq %r14
cmpq %r14, %r15
jne 0x8684
movq 0x8(%rsp), %r15
movq 0xa8(%rsp), %r14
movq (%r15,%r14,8), %rdi
callq 0x4a69
movq $-0x1, %rdx
movl %eax, %ecx
shlq %cl, %rdx
notq %rdx
andq %rdx, (%rbx,%r14,8)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x59ea
movl %eax, %r14d
movq %rbx, %rdi
movl %eax, %esi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x59b9
testl %eax, %eax
js 0x8708
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x593d
movl %eax, %r14d
movq 0x40(%rsp), %r15
cmpl $0x1, %r14d
jne 0x8728
cmpq $0x2, (%rbx)
ja 0x8728
callq 0x90d2
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, (%rbx)
jmp 0x870d
movq $0x1, 0xc8(%rsp)
movq %rbx, %rdi
movl %r14d, %esi
leaq 0xc8(%rsp), %r14
movq %r14, %rdx
movl $0x1, %ecx
callq 0x593d
movq 0x20(%rsp), %rbx
movl %eax, 0x8(%rbx)
movq %rbp, %rdi
xorl %esi, %esi
movq 0x38(%rsp), %rdx
callq 0x10e0
movq 0x10(%rbx), %rsi
movl 0x8(%rbx), %edx
movq 0x10(%r15), %rcx
movl 0x8(%r15), %r8d
movq %rbp, %rdi
callq 0x5a07
movl $0x0, 0xc8(%rsp)
movl %eax, 0xcc(%rsp)
movl %eax, 0xd0(%rsp)
movq %rbp, 0xd8(%rsp)
xorl %edi, %edi
movq %rbx, %rsi
movq %r14, %rdx
leaq 0xe0(%rsp), %rcx
callq 0x711c
movq 0x10(%rbx), %rsi
movslq 0x8(%rbx), %rdx
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x68(%rsp)
movl 0x8(%rax), %ebx
movq 0x80(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x88(%rsp)
movl 0x8(%rax), %eax
movl %eax, 0x1c(%rsp)
movl %edx, 0x4(%rsp)
movq %rdx, 0xb8(%rsp)
shlq $0x3, %rdx
movq %r13, %rdi
movq %rsi, 0x28(%rsp)
callq 0x1120
movq 0x90(%rsp), %rcx
cmpl $0x0, 0x78(%rsp)
jle 0x8981
movq 0x10(%rsp), %rax
movq (%rax,%rcx,8), %r14
movl $0x3f, %r15d
movq %rcx, 0xb0(%rsp)
cmpq 0x90(%rsp), %rcx
jne 0x884b
movq %r14, %rdi
callq 0x4a69
leal -0x1(%rax), %r15d
negb %al
movl %eax, %ecx
shlq %cl, %r14
testl %r15d, %r15d
je 0x8969
movq %rbp, %rdi
xorl %esi, %esi
movq 0x38(%rsp), %rdx
callq 0x10e0
movl 0x4(%rsp), %edx
movq %rbp, %rdi
movq %r13, %rsi
movq %r13, %rcx
movl %edx, %r8d
callq 0x5a07
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
movq %rbp, %rdx
movl %eax, %ecx
movq 0x70(%rsp), %r8
movl %ebx, %r9d
pushq 0x68(%rsp)
pushq %r12
pushq 0x20(%rsp)
callq 0x815c
addq $0x20, %rsp
movslq 0x4(%rsp), %r12
leaq (,%r12,8), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1120
btq $0x3e, %r14
jae 0x892f
movq %rbp, %rdi
xorl %esi, %esi
movq 0x38(%rsp), %rdx
callq 0x10e0
movq %rbp, %rdi
movq %r13, %rsi
movl %r12d, %edx
movq 0x28(%rsp), %rcx
movq 0xb8(%rsp), %r8
callq 0x5a07
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
movq %rbp, %rdx
movl %eax, %ecx
movq 0x70(%rsp), %r8
movl %ebx, %r9d
pushq 0x68(%rsp)
pushq 0x40(%rsp)
pushq 0x20(%rsp)
callq 0x815c
addq $0x20, %rsp
movslq 0x4(%rsp), %rdx
shlq $0x3, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1120
decl %r15d
movslq 0x4(%rsp), %rax
leaq (,%rax,8), %rdi
addq %r13, %rdi
movq 0xc0(%rsp), %rdx
subq %rax, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x10e0
addq %r14, %r14
testl %r15d, %r15d
movq 0x30(%rsp), %r12
jne 0x8854
movq 0xb0(%rsp), %rcx
leaq -0x1(%rcx), %rax
testq %rcx, %rcx
movq %rax, %rcx
jg 0x8817
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq 0xa0(%rsp), %rdx
callq 0x1120
movq 0x50(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%r14,%rax,8)
movq %r14, %rdi
movl %r12d, %esi
movq 0x88(%rsp), %r15
movq %r15, %rdx
movl 0x1c(%rsp), %r14d
movl %r14d, %ecx
callq 0x593d
movl 0x4(%rsp), %esi
movq %r13, %rdi
movq %r15, %rdx
movl %r14d, %ecx
movl %eax, %r14d
callq 0x59b9
testl %eax, %eax
je 0x8ad7
movl 0x4(%rsp), %esi
movq %r13, %rdi
movq 0x28(%rsp), %rdx
movl %r14d, %ecx
callq 0x59b9
testl %eax, %eax
je 0x8ad7
movq 0x98(%rsp), %rax
movl %eax, %r15d
decl %r15d
je 0x8ae5
movq %rbp, %rdi
xorl %esi, %esi
movq 0x38(%rsp), %rdx
callq 0x10e0
movl 0x4(%rsp), %edx
movq %rbp, %rdi
movq %r13, %rsi
movq %r13, %rcx
movl %edx, %r8d
callq 0x5a07
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
movq %rbp, %rdx
movl %eax, %ecx
movq 0x70(%rsp), %r8
movl %ebx, %r9d
pushq 0x68(%rsp)
pushq %r12
pushq 0x20(%rsp)
callq 0x815c
addq $0x20, %rsp
movslq 0x4(%rsp), %r12
leaq (,%r12,8), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1120
leaq (,%r12,8), %rdi
addq %r13, %rdi
movq 0x58(%rsp), %rax
subl %r12d, %eax
shll $0x3, %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x10e0
movq %r13, %rdi
movl %r12d, %esi
movq 0x30(%rsp), %r12
movq 0x88(%rsp), %rdx
movl 0x1c(%rsp), %ecx
callq 0x59b9
testl %eax, %eax
je 0x8ae5
movl 0x4(%rsp), %esi
movq %r13, %rdi
movq 0x28(%rsp), %rdx
movl %r14d, %ecx
callq 0x59b9
testl %eax, %eax
jne 0x8a0a
movq 0x20(%rsp), %rdi
callq 0x4a46
movb $0x1, %al
jmp 0x8aef
movl $0x0, 0x18(%rsp)
xorl %eax, %eax
testb %al, %al
movl 0x74(%rsp), %r15d
jne 0x865f
movq 0x10(%rsp), %rdi
callq 0x1030
movq 0x40(%rsp), %rdi
callq 0x493c
movq 0x48(%rsp), %rdi
callq 0x493c
movq 0x80(%rsp), %rdi
callq 0x493c
movq 0x20(%rsp), %rdi
callq 0x493c
movl 0x18(%rsp), %r8d
jmp 0x8483