// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rdi, %rbx
movq 0x17e68(%rip), %rax     # 0x1c170
movq 0x182b1(%rip), %rcx     # 0x1c5c0
movq (%rcx,%rdi,8), %rdi
cmpq $0x0, (%rax,%rdi,8)
movq (%rcx,%rsi,8), %rcx
movq (%rax,%rcx,8), %r15
js 0x4479
testq %r15, %r15
js 0x4491
callq 0x42ae
movq %rax, %rbx
movq 0x17dea(%rip), %rsi     # 0x1c128
xorl %r12d, %r12d
movq %rax, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x17dd6(%rip)     # 0x1c128
movq 0x18267(%rip), %rax     # 0x1c5c0
movq (%rax,%r14,8), %rdi
callq 0x42ae
movq %rax, %r14
movq 0x17dbc(%rip), %rsi     # 0x1c128
movq %rax, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x17dab(%rip)     # 0x1c128
pushq $-0x1
popq %r15
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x17d93(%rip)     # 0x1c128
movq %r14, %r13
cmpq $-0x1, %rbx
jne 0x43ae
cmpq $-0x1, %r13
jne 0x43ae
testb $0x1, %r12b
je 0x4455
cmpq $-0x1, %rbx
je 0x43c1
movq 0x17db5(%rip), %rax     # 0x1c170
movq (%rax,%rbx,8), %rax
jmp 0x43c3
xorl %eax, %eax
cmpq $-0x1, %r13
je 0x43d6
movq 0x17da0(%rip), %rcx     # 0x1c170
movq (%rcx,%r13,8), %rcx
jmp 0x43d8
xorl %ecx, %ecx
movzbl %r12b, %edx
andl $0x1, %edx
addq %rdx, %rax
leaq (%rax,%rcx), %rdx
cmpq $0x3b9aca00, %rdx       # imm = 0x3B9ACA00
setge %r12b
leaq -0x3b9aca00(%rcx,%rax), %rdi
cmovlq %rdx, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0x3613
movq %rax, %r15
movq 0x17d5e(%rip), %rax     # 0x1c170
movq 0x17d0f(%rip), %rcx     # 0x1c128
movq %r15, (%rax,%rcx,8)
pushq $-0x1
popq %r14
movq %r14, %rax
cmpq $-0x1, %rbx
je 0x4435
movq 0x1818f(%rip), %rax     # 0x1c5c0
movq (%rax,%rbx,8), %rax
movq %rax, %rbx
cmpq $-0x1, %r13
je 0x4395
movq 0x18177(%rip), %rcx     # 0x1c5c0
movq (%rcx,%r13,8), %r14
movq %rax, %rbx
jmp 0x4395
pushq $0x3
popq %rdi
callq 0x3775
pushq $-0x18
popq %rdi
pushq $0x1
popq %rdx
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3613
movq %rbx, %rdi
callq 0x4228
movq %rax, %rbx
testq %r15, %r15
js 0x44b2
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x449f
movq %r14, %rdi
callq 0x4228
movq %rbx, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4561
movq 0x17c6f(%rip), %rsi     # 0x1c128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x17c5e(%rip)     # 0x1c128
movq %r14, %rdi
callq 0x4228
movq %rbx, %rdi
movq %rax, %rsi
callq 0x44fe
movq %rax, %rbx
pushq $0x1
popq %rdi
callq 0x3775
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x426f