// File: /workspace/github_c_makefile_star2_O0/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: tt_dec_cmp_abs
int tt_dec_cmp_abs(const struct tt_dec *src1, const struct tt_dec *src2)
{
	int msb1 = src1->_msb, msb2 = src2->_msb;

	int ret = (msb1 + src1->_exp) - (msb2 + src2->_exp);
	if (ret)
		return ret;

	uint *dig1 = src1->_dig32, *dig2 = src2->_dig32;
	const int uints = (_tt_max(msb1, msb2) + 8) / 9 * 4;

	/* Align exponent */
	int adj = src1->_exp - src2->_exp;
	if (adj < 0) {
		dig2 = calloc(uints, 4);
		msb2 = shift_digs(dig2, 0, src2->_dig32, msb2, -adj);
	} else if (adj > 0) {
		dig1 = calloc(uints, 4);
		msb1 = shift_digs(dig1, 0, src1->_dig32, msb1, adj);
	}
	tt_assert_fa(msb1 == msb2);

	ret = cmp_digs(dig1, msb1, dig2, msb2);

	if (dig1 != src1->_dig32)
		free(dig1);
	if (dig2 != src2->_dig32)
		free(dig2);

	return ret;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x3c(%rsp)
movq 0x40(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x38(%rsp)
movl 0x3c(%rsp), %eax
movq 0x48(%rsp), %rcx
addl 0x4(%rcx), %eax
movl 0x38(%rsp), %ecx
movq 0x40(%rsp), %rdx
addl 0x4(%rdx), %ecx
subl %ecx, %eax
movl %eax, 0x34(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x6348
movl 0x34(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x64e5
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
movl 0x3c(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x38(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x14(%rsp), %eax
jle 0x6388
movl 0x18(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x6390
movl 0x14(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
addl $0x8, %eax
movl $0x9, %ecx
cltd
idivl %ecx
shll $0x2, %eax
movl %eax, 0x1c(%rsp)
movq 0x48(%rsp), %rax
movl 0x4(%rax), %eax
movq 0x40(%rsp), %rcx
subl 0x4(%rcx), %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x6404
movslq 0x1c(%rsp), %rdi
movl $0x4, %esi
callq 0x1110
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rdx
movl 0x38(%rsp), %ecx
xorl %r8d, %r8d
subl 0xc(%rsp), %r8d
xorl %esi, %esi
callq 0x4af0
movl %eax, 0x38(%rsp)
jmp 0x6443
cmpl $0x0, 0xc(%rsp)
jle 0x6441
movslq 0x1c(%rsp), %rdi
movl $0x4, %esi
callq 0x1110
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdx
movl 0x3c(%rsp), %ecx
movl 0xc(%rsp), %r8d
xorl %esi, %esi
callq 0x4af0
movl %eax, 0x3c(%rsp)
jmp 0x6443
jmp 0x6445
movl 0x3c(%rsp), %eax
cmpl 0x38(%rsp), %eax
sete %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x648c
xorl %edi, %edi
leaq 0x18333(%rip), %rsi     # 0x1e79f
leaq 0xbc6b(%rip), %rdx      # 0x120de
leaq 0x18302(%rip), %rcx     # 0x1e77c
movl $0x38e, %r8d            # imm = 0x38E
movb $0x0, %al
callq 0xe010
callq 0x1060
jmp 0x648e
movq 0x28(%rsp), %rdi
movl 0x3c(%rsp), %esi
movq 0x20(%rsp), %rdx
movl 0x38(%rsp), %ecx
callq 0x6010
movl %eax, 0x34(%rsp)
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x18(%rcx), %rax
je 0x64c3
movq 0x28(%rsp), %rdi
callq 0x1030
movq 0x20(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq 0x18(%rcx), %rax
je 0x64dd
movq 0x20(%rsp), %rdi
callq 0x1030
movl 0x34(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nop