// File: /workspace/github_c_makefile_star2_O1/azhai[P]mlite/mlite.c
// Function: x_bignum_add
cell x_bignum_add(cell a, cell b) {
	cell	fa, fb, result, r;
	int	carry;

	if (x_bignum_negative_p(a)) {
		if (x_bignum_negative_p(b)) {
			/* -A+-B --> -(|A|+|B|) */
			a = bignum_abs(a);
			save(a);
			a = bignum_add(a, bignum_abs(b));
			unsave(1);
			return bignum_negate(a);
		}
		else {
			/* -A+B --> B-|A| */
			return bignum_subtract(b, bignum_abs(a));
		}
	}
	else if (x_bignum_negative_p(b)) {
		/* A+-B --> A-|B| */
		return bignum_subtract(a, bignum_abs(b));
	}
	/* A+B */
	a = reverse_segments(cdr(a));
	save(a);
	b = reverse_segments(cdr(b));
	save(b);
	carry = 0;
	result = NIL;
	save(result);
	while (a != NIL || b != NIL || carry) {
		fa = a == NIL? 0: car(a);
		fb = b == NIL? 0: car(b);
		r = fa + fb + carry;
		carry = 0;
		if (r >= INT_SEG_LIMIT) {
			r -= INT_SEG_LIMIT;
			carry = 1;
		}
		result = new_atom(r, result);
		car(Stack) = result;
		if (a != NIL) a = cdr(a);
		if (b != NIL) b = cdr(b);
	}
	unsave(3);
	return new_atom(T_INTEGER, result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq 0x19cdd(%rip), %rax     # 0x1e170
movq 0x1a126(%rip), %rcx     # 0x1e5c0
movq (%rcx,%rdi,8), %r12
cmpq $0x0, (%rax,%r12,8)
movq (%rcx,%rsi,8), %rcx
movq (%rax,%rcx,8), %r14
js 0x46b6
testq %r14, %r14
js 0x46ce
movq $-0x1, %rbx
movq $-0x1, %r14
cmpq $-0x1, %r12
je 0x44f6
movq 0x19c9b(%rip), %rax     # 0x1e170
movq (%rax,%r12,8), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %r14
movq 0x1a0d0(%rip), %rax     # 0x1e5c0
movq (%rax,%r12,8), %r12
jmp 0x44c8
movq 0x19c2b(%rip), %rsi     # 0x1e128
movq %r14, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x19c1a(%rip)     # 0x1e128
movq 0x1a0ab(%rip), %rax     # 0x1e5c0
movq (%rax,%r15,8), %r15
cmpq $-0x1, %r15
je 0x4552
movq $-0x1, %rbx
movq 0x19c43(%rip), %rax     # 0x1e170
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %rbx
movq 0x1a078(%rip), %rax     # 0x1e5c0
movq (%rax,%r15,8), %r15
cmpq $-0x1, %r15
jne 0x4526
movq 0x19bcf(%rip), %rsi     # 0x1e128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x19bbe(%rip)     # 0x1e128
movq $-0x1, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq $-0x1, %rsi
movq %rax, 0x19b9f(%rip)     # 0x1e128
movq %r14, %rax
andq %rbx, %rax
cmpq $-0x1, %rax
je 0x4687
cmpq $-0x1, %rbx
setne %dl
cmpq $-0x1, %r14
setne %r12b
xorl %edi, %edi
cmpq $-0x1, %r14
je 0x45bd
movq 0x19bb9(%rip), %rax     # 0x1e170
movq (%rax,%r14,8), %rax
jmp 0x45bf
xorl %eax, %eax
cmpq $-0x1, %rbx
movb %dl, -0x29(%rbp)
je 0x45d5
movq 0x19ba1(%rip), %rcx     # 0x1e170
movq (%rcx,%rbx,8), %rcx
jmp 0x45d7
xorl %ecx, %ecx
addq %rdi, %rax
leaq (%rax,%rcx), %r13
cmpq $0x3b9aca00, %r13       # imm = 0x3B9ACA00
setge %r15b
leaq -0x3b9aca00(%rcx,%rax), %rdi
cmovlq %r13, %rdi
movl $0x1, %edx
callq 0x36e8
movq %rax, %rsi
movq 0x19b67(%rip), %rax     # 0x1e170
movq 0x19b18(%rip), %rcx     # 0x1e128
movq %rsi, (%rax,%rcx,8)
movq $-0x1, %rax
movq $-0x1, %rcx
testb $0x1, %r12b
je 0x4633
movq 0x19f91(%rip), %rcx     # 0x1e5c0
movq (%rcx,%r14,8), %rcx
testb $0x1, -0x29(%rbp)
je 0x4644
movq 0x19f80(%rip), %rax     # 0x1e5c0
movq (%rax,%rbx,8), %rax
xorl %edi, %edi
movb %r15b, %dil
cmpq $-0x1, %rax
setne %dl
movq %rcx, %r14
movq %rax, %rbx
cmpq $-0x1, %rcx
setne %r12b
jne 0x45aa
movq %rcx, %r14
movq %rax, %rbx
cmpq $-0x1, %rax
jne 0x45aa
movq %rcx, %r14
movq %rax, %rbx
cmpq $0x3b9ac9ff, %r13       # imm = 0x3B9AC9FF
jg 0x45aa
movl $0x3, %edi
movq %rsi, %rbx
callq 0x3851
movq $-0x18, %rdi
movq %rbx, %rsi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36e8
movq %rbx, %rdi
callq 0x43a4
movq %rax, %rbx
testq %r14, %r14
js 0x46ef
movq %r15, %rdi
movq %rbx, %rsi
jmp 0x46dc
movq %r15, %rdi
callq 0x43a4
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x47a5
movq 0x19a32(%rip), %rsi     # 0x1e128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x19a21(%rip)     # 0x1e128
movq %r15, %rdi
callq 0x43a4
movq %rbx, %rdi
movq %rax, %rsi
callq 0x473d
movq %rax, %rbx
movl $0x1, %edi
callq 0x3851
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43eb