// File: /workspace/github_c_makefile_star2_O0/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: mul_digs
static int mul_digs(uint *digr, const uint *dig1, const int msb1,
		const uint *dig2, const int msb2)
{
	int msb = 1;
	const int uints1 = (msb1 + 8) / 9;
	const int uints2 = (msb2 + 8) / 9;

	for (int i = 0; i < uints1 + uints2; i++) {
		int jmax = i;
		if (jmax >= uints1)
			jmax = uints1 - 1;
		int jmin = i - uints2 + 1;
		if (jmin < 0)
			jmin = 0;

#ifdef __SIZEOF_INT128__
		/* XXX: int128 may overflow if both operands >= 10^(9*10^20) */
		__uint128_t tmp128 = 0;
		for (int j = jmax, k = i - jmax; j >= jmin; j--, k++)
			tmp128 += (uint64_t)dig1[j] * dig2[k];
		if (tmp128)
			msb = shift_add_u128(digr, msb, tmp128, i);
#else
		uint64_t tmp64 = 0;
		int cnt = 0;
		for (int j = jmax, k = i - jmax; j >= jmin; j--, k++) {
			tmp64 += (uint64_t)dig1[j] * dig2[k];
			cnt++;
			if (cnt == 10) {
				/* Consume before tmp64 overflow */
				msb = shift_add_u64(digr, msb, tmp64, i);
				tmp64 = 0;
				cnt = 0;
			}
		}
		if (cnt)
			msb = shift_add_u64(digr, msb, tmp64, i);
#endif
	}

	tt_assert_fa(msb >= msb1 && msb <= (msb1 + msb2));

	return msb;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl %edx, 0x74(%rsp)
movq %rcx, 0x68(%rsp)
movl %r8d, 0x64(%rsp)
movl $0x1, 0x60(%rsp)
movl 0x74(%rsp), %eax
addl $0x8, %eax
movl $0x9, %ecx
cltd
idivl %ecx
movl %eax, 0x5c(%rsp)
movl 0x64(%rsp), %eax
addl $0x8, %eax
movl $0x9, %ecx
cltd
idivl %ecx
movl %eax, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
movl 0x5c(%rsp), %ecx
addl 0x58(%rsp), %ecx
cmpl %ecx, %eax
jge 0x4a75
movl 0x54(%rsp), %eax
movl %eax, 0x50(%rsp)
movl 0x50(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jl 0x4979
movl 0x5c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x50(%rsp)
movl 0x54(%rsp), %eax
subl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
cmpl $0x0, 0x4c(%rsp)
jge 0x4997
movl $0x0, 0x4c(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movl 0x50(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x54(%rsp), %eax
subl 0x50(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x4c(%rsp), %eax
jl 0x4a1a
movq 0x78(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %edx
movq 0x68(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %eax
imulq %rax, %rdx
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
addq %rdx, %rcx
adcq $0x0, %rax
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movl 0x2c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x2c(%rsp)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x49bd
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
orq %rcx, %rax
je 0x4a63
jmp 0x4a2b
movq 0x80(%rsp), %rdi
movl 0x60(%rsp), %esi
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movl 0x54(%rsp), %r8d
movq %rcx, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x65d0
movl %eax, 0x60(%rsp)
jmp 0x4a65
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x4948
jmp 0x4a77
movl 0x60(%rsp), %ecx
xorl %eax, %eax
cmpl 0x74(%rsp), %ecx
movb %al, 0xf(%rsp)
jl 0x4a9c
movl 0x60(%rsp), %eax
movl 0x74(%rsp), %ecx
addl 0x64(%rsp), %ecx
cmpl %ecx, %eax
setle %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x4adc
xorl %edi, %edi
leaq 0x19cfe(%rip), %rsi     # 0x1e7ba
leaq 0xd61b(%rip), %rdx      # 0x120de
leaq 0x19cb2(%rip), %rcx     # 0x1e77c
movl $0xea, %r8d
movb $0x0, %al
callq 0xe010
callq 0x1060
jmp 0x4ade
movl 0x60(%rsp), %eax
addq $0x88, %rsp
retq
nopw (%rax,%rax)