// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movl %edx, 0x4(%rsp)
movq %rcx, -0x8(%rsp)
movl %r8d, -0xc(%rsp)
movq 0x10(%rsp), %rax
movq %rax, -0x20(%rsp)
movq 0x8(%rsp), %rcx
xorl %eax, %eax
cmpq -0x8(%rsp), %rcx
movb %al, -0x65(%rsp)
jne 0x8d77
movl 0x4(%rsp), %eax
cmpl -0xc(%rsp), %eax
sete %al
movb %al, -0x65(%rsp)
movb -0x65(%rsp), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x8f0e
movl $0x0, -0x44(%rsp)
movl -0x44(%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x8f09
movq 0x8(%rsp), %rax
movslq -0x44(%rsp), %rsi
movq (%rax,%rsi,8), %rcx
movq %rcx, %rax
mulq %rcx
movq -0x20(%rsp), %rcx
movq (%rcx,%rsi,8), %rcx
addq %rcx, %rax
adcq $0x0, %rdx
movq %rax, -0x30(%rsp)
movq %rdx, -0x28(%rsp)
movq -0x30(%rsp), %rdx
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
andq %rax, %rdx
movq -0x20(%rsp), %rax
movslq -0x44(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rsp), %rcx
movq -0x28(%rsp), %rax
shldq $0x1, %rcx, %rax
movq %rax, -0x18(%rsp)
movq 0x8(%rsp), %rax
movslq -0x44(%rsp), %rcx
movq (%rax,%rcx,8), %rax
addq %rax, %rax
movq %rax, -0x40(%rsp)
movq $0x0, -0x38(%rsp)
movl -0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rsp)
movl -0x48(%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x8ed8
movq -0x40(%rsp), %rax
movq -0x38(%rsp), %rdx
movq 0x8(%rsp), %rcx
movslq -0x48(%rsp), %rdi
movq (%rcx,%rdi,8), %rcx
imulq %rcx, %rdx
movq %rdx, -0x70(%rsp)
mulq %rcx
movq %rax, %rcx
movq %rdx, %rax
movq -0x70(%rsp), %rdx
movq -0x20(%rsp), %rsi
movq (%rsi,%rdi,8), %rsi
addq %rsi, %rcx
adcq %rdx, %rax
movq -0x18(%rsp), %rdx
addq %rdx, %rcx
adcq $0x0, %rax
movq %rcx, -0x30(%rsp)
movq %rax, -0x28(%rsp)
movq -0x30(%rsp), %rcx
movq -0x28(%rsp), %rax
shldq $0x1, %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x30(%rsp), %rdx
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
andq %rax, %rdx
movq -0x20(%rsp), %rax
movslq -0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rsp)
jmp 0x8e32
movq -0x18(%rsp), %rdx
movq -0x20(%rsp), %rax
movslq 0x4(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rsp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rsp)
movl -0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rsp)
jmp 0x8d98
jmp 0x907e
movl 0x4(%rsp), %eax
cmpl -0xc(%rsp), %eax
setl %al
andb $0x1, %al
movb %al, -0x49(%rsp)
testb $0x1, -0x49(%rsp)
je 0x8f62
jmp 0x8f28
movl 0x4(%rsp), %eax
movl %eax, -0x50(%rsp)
movl -0xc(%rsp), %eax
movl %eax, 0x4(%rsp)
movl -0x50(%rsp), %eax
movl %eax, -0xc(%rsp)
jmp 0x8f42
movq 0x8(%rsp), %rax
movq %rax, -0x58(%rsp)
movq -0x8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq -0x58(%rsp), %rax
movq %rax, -0x8(%rsp)
jmp 0x8f62
movl $0x0, -0x5c(%rsp)
movl -0x5c(%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x907c
movq $0x0, -0x18(%rsp)
movq 0x8(%rsp), %rax
movslq -0x5c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rsp)
movq $0x0, -0x38(%rsp)
movl $0x0, -0x60(%rsp)
movl -0x60(%rsp), %eax
cmpl -0xc(%rsp), %eax
jge 0x904b
movq -0x40(%rsp), %rax
movq -0x38(%rsp), %rdx
movq -0x8(%rsp), %rcx
movslq -0x60(%rsp), %rdi
movq (%rcx,%rdi,8), %rcx
imulq %rcx, %rdx
movq %rdx, -0x78(%rsp)
mulq %rcx
movq %rax, %rcx
movq %rdx, %rax
movq -0x78(%rsp), %rdx
movq -0x20(%rsp), %rsi
movq (%rsi,%rdi,8), %rsi
addq %rsi, %rcx
adcq %rdx, %rax
movq -0x18(%rsp), %rdx
addq %rdx, %rcx
adcq $0x0, %rax
movq %rcx, -0x30(%rsp)
movq %rax, -0x28(%rsp)
movq -0x30(%rsp), %rcx
movq -0x28(%rsp), %rax
shldq $0x1, %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x30(%rsp), %rdx
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
andq %rax, %rdx
movq -0x20(%rsp), %rax
movslq -0x60(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x60(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rsp)
jmp 0x8fa5
movq -0x18(%rsp), %rdx
movq -0x20(%rsp), %rax
movslq -0xc(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rsp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rsp)
movl -0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rsp)
jmp 0x8f6a
jmp 0x907e
movl 0x4(%rsp), %eax
addl -0xc(%rsp), %eax
movl %eax, -0x64(%rsp)
movq 0x10(%rsp), %rax
movl -0x64(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x90ab
movl -0x64(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rsp)
movl -0x64(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)