// File: /workspace/github_c_makefile_star2_O0/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: add_digs
static int add_digs(uint *dig, const int msb, const uint *dig2, const int msb2)
{
	int i;
	char carry = 0;

	/* Add dig2 to dig */
	const int uints2 = (msb2 + 8) / 9;
	for (i = 0; i < uints2; i++)
		dig[i] = add_dig(dig[i], dig2[i], &carry);

	/* Process remaining high digits in dig */
	const int uints = (msb + 8) / 9;
	for (; i < uints; i++) {
		if (carry == 0) {
			i = uints;
			break;
		}
		dig[i] = add_dig(dig[i], 0, &carry);
	}

	/* Check new MSB */
	if (carry) {
		/* Carry at uint boundary */
		dig[i] = 1;
		return _tt_max(msb, msb2) + 1;
	} else {
		/* Get new msb, i => valid uints */
		tt_assert_fa(i > 0);
		uint u = dig[i-1];
		int msbr = (i - 1) * 9;
		do {
			msbr++;
			u /= 10;
		} while (u);

		const int msbs = _tt_max(msb, msb2);
		tt_assert_fa(msbr == msbs || msbr == (msbs+1));
		return msbr;
	}
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movl %esi, 0x54(%rsp)
movq %rdx, 0x48(%rsp)
movl %ecx, 0x44(%rsp)
movb $0x0, 0x3f(%rsp)
movl 0x44(%rsp), %eax
addl $0x8, %eax
movl $0x9, %ecx
cltd
idivl %ecx
movl %eax, 0x38(%rsp)
movl $0x0, 0x40(%rsp)
movl 0x40(%rsp), %eax
cmpl 0x38(%rsp), %eax
jge 0x5000
movq 0x58(%rsp), %rax
movslq 0x40(%rsp), %rcx
movl (%rax,%rcx,4), %edi
movq 0x48(%rsp), %rax
movslq 0x40(%rsp), %rcx
movl (%rax,%rcx,4), %esi
leaq 0x3f(%rsp), %rdx
callq 0x66d0
movl %eax, %edx
movq 0x58(%rsp), %rax
movslq 0x40(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x4fb6
movl 0x54(%rsp), %eax
addl $0x8, %eax
movl $0x9, %ecx
cltd
idivl %ecx
movl %eax, 0x34(%rsp)
movl 0x40(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x5066
movsbl 0x3f(%rsp), %eax
cmpl $0x0, %eax
jne 0x5031
movl 0x34(%rsp), %eax
movl %eax, 0x40(%rsp)
jmp 0x5066
movq 0x58(%rsp), %rax
movslq 0x40(%rsp), %rcx
movl (%rax,%rcx,4), %edi
xorl %esi, %esi
leaq 0x3f(%rsp), %rdx
callq 0x66d0
movl %eax, %edx
movq 0x58(%rsp), %rax
movslq 0x40(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x5013
cmpb $0x0, 0x3f(%rsp)
je 0x50c2
movq 0x58(%rsp), %rax
movslq 0x40(%rsp), %rcx
movl $0x1, (%rax,%rcx,4)
movl 0x54(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x44(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jle 0x50a2
movl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
jmp 0x50aa
movl 0x2c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x51fb
jmp 0x50c4
cmpl $0x0, 0x40(%rsp)
setg %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5108
xorl %edi, %edi
leaq 0x196e6(%rip), %rsi     # 0x1e7ce
leaq 0xcfef(%rip), %rdx      # 0x120de
leaq 0x19686(%rip), %rcx     # 0x1e77c
movl $0x5c, %r8d
movb $0x0, %al
callq 0xe010
callq 0x1060
jmp 0x510a
movq 0x58(%rsp), %rax
movl 0x40(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x24(%rsp)
movl 0x40(%rsp), %eax
subl $0x1, %eax
imull $0x9, %eax, %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
movl 0x24(%rsp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jne 0x512e
movl 0x54(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x44(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x14(%rsp), %eax
jle 0x5175
movl 0x18(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x517d
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x20(%rsp), %ecx
movb $0x1, %al
cmpl 0x1c(%rsp), %ecx
movb %al, 0x7(%rsp)
je 0x51b1
movl 0x20(%rsp), %eax
movl 0x1c(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
sete %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x51f1
xorl %edi, %edi
leaq 0x195fd(%rip), %rsi     # 0x1e7ce
leaq 0xcf06(%rip), %rdx      # 0x120de
leaq 0x1959d(%rip), %rcx     # 0x1e77c
movl $0x65, %r8d
movb $0x0, %al
callq 0xe010
callq 0x1060
jmp 0x51f3
movl 0x20(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)