// File: /workspace/github_c_makefile_star2_O1/cyb70289[P]tt/src/apn/integer/basic.c
// Function: mul_buf_classic
static int mul_buf_classic(_tt_word *intr, const _tt_word *int1, int msb1,
		const _tt_word *int2, int msb2)
{
	_tt_word c, *r = intr;
	_tt_word_double t0, m;
#ifndef _TT_LP64_
	_tt_word_double t1, t2, t3;
#endif

	/* Square can be faster */
	if (_tt_unlikely(int1 == int2 && msb1 == msb2)) {
		for (int i = 0; i < msb1; i++) {
			t0 = (_tt_word_double)int1[i]*int1[i] + r[i];
			r[i] = t0 & ~_tt_word_top_bit;
			c = t0 >> _tt_word_bits;
			m = int1[i] << 1;

			int j = i + 1;
#ifndef _TT_LP64_
			for (; j <= msb1-4; j += 4) {
				t0 = m * int1[j] + r[j];
				t1 = m * int1[j+1] + r[j+1];
				t2 = m * int1[j+2] + r[j+2];
				t3 = m * int1[j+3] + r[j+3];

				t0 += c;
				r[j] = t0 & ~_tt_word_top_bit;
				t1 += t0 >> _tt_word_bits;
				r[j+1] = t1 & ~_tt_word_top_bit;
				t2 += t1 >> _tt_word_bits;
				r[j+2] = t2 & ~_tt_word_top_bit;
				t3 += t2 >> _tt_word_bits;
				r[j+3] = t3 & ~_tt_word_top_bit;
				c = t3 >> _tt_word_bits;
			}
#endif
			for (; j < msb1; j++) {
				t0 = m * int1[j] + r[j] + c;
				c = t0 >> _tt_word_bits;
				r[j] = t0 & ~_tt_word_top_bit;
			}
			r[msb1] = c;

			r++;
		}
	} else {
		bool swap = msb1 < msb2;
#ifndef _TT_LP64_
		swap = !swap;
#endif
		if (swap) {
			__tt_swap(msb1, msb2);
			__tt_swap(int1, int2);
		}

		for (int i = 0; i < msb1; i++) {
			c = 0;
			m = int1[i];

			int j = 0;
#ifndef _TT_LP64_
			for (; j <= msb2-4; j += 4) {
				t0 = m * int2[j] + r[j];
				t1 = m * int2[j+1] + r[j+1];
				t2 = m * int2[j+2] + r[j+2];
				t3 = m * int2[j+3] + r[j+3];

				t0 += c;
				r[j] = t0 & ~_tt_word_top_bit;
				t1 += t0 >> _tt_word_bits;
				r[j+1] = t1 & ~_tt_word_top_bit;
				t2 += t1 >> _tt_word_bits;
				r[j+2] = t2 & ~_tt_word_top_bit;
				t3 += t2 >> _tt_word_bits;
				r[j+3] = t3 & ~_tt_word_top_bit;
				c = t3 >> _tt_word_bits;
			}
#endif
			for (; j < msb2; j++) {
				t0 = m * int2[j] + r[j] + c;
				c = t0 >> _tt_word_bits;
				r[j] = t0 & ~_tt_word_top_bit;
			}
			r[msb2] = c;

			r++;
		}
	}

	/* Top int may be 0 */
	int msb = msb1 + msb2;
	if (intr[msb-1] == 0)
		msb--;

	return msb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %r9d
cmpq %rcx, %rsi
setne %al
cmpl %r8d, %edx
setne %dl
orb %al, %dl
je 0x5bc9
movq %rcx, %r10
cmpl %r8d, %r9d
jge 0x5b16
movl %r9d, %ecx
movq %rsi, %r11
jmp 0x5b22
movl %r8d, %ecx
movq %r10, %r11
movl %r9d, %r8d
movq %rsi, %r10
testl %r8d, %r8d
jle 0x5baf
movabsq $0x7fffffffffffffff, %r9 # imm = 0x7FFFFFFFFFFFFFFF
movslq %ecx, %rbx
movl %r8d, -0xc(%rsp)
movl %r8d, %r14d
movl %ebx, %r15d
xorl %r12d, %r12d
movq %rdi, -0x8(%rsp)
movq %rdi, %r13
movq %r10, %rdi
testl %ecx, %ecx
jle 0x5b91
movq (%rdi,%r12,8), %rsi
xorl %ebp, %ebp
xorl %r10d, %r10d
movq %rsi, %rax
mulq (%r11,%rbp,8)
xorl %r8d, %r8d
addq (%r13,%rbp,8), %r10
setb %r8b
addq %rax, %r10
adcq %rdx, %r8
shldq $0x1, %r10, %r8
andq %r9, %r10
movq %r10, (%r13,%rbp,8)
incq %rbp
movq %r8, %r10
cmpq %rbp, %r15
jne 0x5b5e
jmp 0x5b94
xorl %r8d, %r8d
movq %r8, (%r13,%rbx,8)
addq $0x8, %r13
incq %r12
cmpq %r14, %r12
jne 0x5b51
movq -0x8(%rsp), %rdi
movl -0xc(%rsp), %r8d
addl %r8d, %ecx
movslq %ecx, %rax
cmpq $0x1, -0x8(%rdi,%rax,8)
sbbl $0x0, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r9d, %r9d
jle 0x5c8f
movl %r8d, -0xc(%rsp)
movabsq $0x7fffffffffffffff, %r11 # imm = 0x7FFFFFFFFFFFFFFF
movl %r9d, %r8d
xorl %r10d, %r10d
movq %r8, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rdi, %r13
movq %r8, -0x8(%rsp)
movq (%rsi,%r10,8), %rax
mulq %rax
movq %rdx, %rcx
addq (%r13,%r10,8), %rax
adcq $0x0, %rcx
shldq $0x1, %rax, %rcx
andq %r11, %rax
movq %rax, (%r13,%r10,8)
leaq 0x1(%r10), %rbp
cmpq %r8, %rbp
jae 0x5c5e
movq (%rsi,%r10,8), %r10
addq %r10, %r10
movl $0x1, %ebx
movq %r10, %rax
mulq (%r15,%rbx,8)
xorl %r8d, %r8d
addq (%r12,%rbx,8), %rcx
setb %r8b
addq %rax, %rcx
adcq %rdx, %r8
shldq $0x1, %rcx, %r8
andq %r11, %rcx
movq %rcx, (%r12,%rbx,8)
incq %rbx
movq %r8, %rcx
cmpq %rbx, %r14
jne 0x5c2d
jmp 0x5c61
movq %rcx, %r8
movq -0x8(%rsp), %rax
movq %r8, (%r13,%rax,8)
movq %rax, %r8
addq $0x8, %r13
addq $0x10, %r12
addq $0x8, %r15
decq %r14
movq %rbp, %r10
cmpq %rax, %rbp
jne 0x5bf8
movl -0xc(%rsp), %ecx
jmp 0x5c92
movl %r8d, %ecx
movl %r9d, %r8d
jmp 0x5baf