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

	if (x_bignum_negative_p(a)) {
		if (x_bignum_negative_p(b)) {
			/* -A--B --> -A+|B| --> |B|-|A| */
			a = bignum_abs(a);
			save(a);
			a = bignum_subtract(bignum_abs(b), a);
			unsave(1);
			return a;
		}
		else {
			/* -A-B --> -(|A|+B) */
			return bignum_negate(bignum_add(bignum_abs(a), b));
		}
	}
	else if (x_bignum_negative_p(b)) {
		/* A--B --> A+|B| */
		return bignum_add(a, bignum_abs(b));
	}
	/* A-B, A<B --> -(B-A) */
	if (bignum_less_p(a, b))
		return bignum_negate(bignum_subtract(b, a));
	/* A-B, A>=B */
	a = reverse_segments(cdr(a));
	save(a);
	b = reverse_segments(cdr(b));
	save(b);
	borrow = 0;
	result = NIL;
	save(result);
	while (a != NIL || b != NIL || borrow) {
		fa = a == NIL? 0: car(a);
		fb = b == NIL? 0: car(b);
		r = fa - fb - borrow;
		borrow = 0;
		if (r < 0) {
			r += INT_SEG_LIMIT;
			borrow = 1;
		}
		result = new_atom(r, result);
		car(Stack) = result;
		if (a != NIL) a = cdr(a);
		if (b != NIL) b = cdr(b);
	}
	unsave(3);
	while (car(result) == 0 && cdr(result) != NIL)
		result = cdr(result);
	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 0x197b3(%rip), %rax     # 0x1e170
movq 0x19bfc(%rip), %rcx     # 0x1e5c0
movq (%rcx,%rdi,8), %rdx
cmpq $0x0, (%rax,%rdx,8)
movq (%rcx,%rsi,8), %rcx
movq (%rax,%rcx,8), %r14
js 0x49f8
testq %r14, %r14
js 0x4a2d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x480d
testl %eax, %eax
je 0x4a4e
movq %r15, %rdi
movq %rbx, %rsi
callq 0x47a5
jmp 0x4a17
movq %rbx, %rdi
callq 0x43a4
movq %rax, %rbx
testq %r14, %r14
js 0x4c6c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x473d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43eb
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 0x473d
movq 0x19b6b(%rip), %rax     # 0x1e5c0
movq (%rax,%rbx,8), %r12
movq $-0x1, %rbx
movq $-0x1, %r14
cmpq $-0x1, %r12
je 0x4a95
movq 0x196fc(%rip), %rax     # 0x1e170
movq (%rax,%r12,8), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %r14
movq 0x19b31(%rip), %rax     # 0x1e5c0
movq (%rax,%r12,8), %r12
jmp 0x4a67
movq 0x1968c(%rip), %rsi     # 0x1e128
movq %r14, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x1967b(%rip)     # 0x1e128
movq 0x19b0c(%rip), %rax     # 0x1e5c0
movq (%rax,%r15,8), %r15
cmpq $-0x1, %r15
je 0x4af1
movq $-0x1, %rbx
movq 0x196a4(%rip), %rax     # 0x1e170
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %rbx
movq 0x19ad9(%rip), %rax     # 0x1e5c0
movq (%rax,%r15,8), %r15
cmpq $-0x1, %r15
jne 0x4ac5
movq 0x19630(%rip), %rsi     # 0x1e128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x1961f(%rip)     # 0x1e128
movq $-0x1, %r15
movq $-0x1, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x19600(%rip)     # 0x1e128
movq %r14, %rax
andq %rbx, %rax
cmpq $-0x1, %rax
je 0x4c21
cmpq $-0x1, %rbx
setne %sil
cmpq $-0x1, %r14
setne %r12b
xorl %eax, %eax
cmpq $-0x1, %r14
je 0x4b5d
movq 0x19619(%rip), %rcx     # 0x1e170
movq (%rcx,%r14,8), %r13
jmp 0x4b60
xorl %r13d, %r13d
cmpq $-0x1, %rbx
movb %sil, -0x29(%rbp)
je 0x4b77
movq 0x195ff(%rip), %rcx     # 0x1e170
movq (%rcx,%rbx,8), %rcx
jmp 0x4b79
xorl %ecx, %ecx
addq %rax, %r13
subq %rcx, %r13
leaq 0x3b9aca00(%r13), %rdi
testq %r13, %r13
cmovnsq %r13, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x36e8
movq %rax, %r15
movq 0x195cc(%rip), %rax     # 0x1e170
movq 0x1957d(%rip), %rcx     # 0x1e128
movq %r15, (%rax,%rcx,8)
movq $-0x1, %rcx
movq $-0x1, %rdx
testb $0x1, %r12b
je 0x4bce
movq 0x199f6(%rip), %rax     # 0x1e5c0
movq (%rax,%r14,8), %rdx
testb $0x1, -0x29(%rbp)
je 0x4bdf
movq 0x199e5(%rip), %rax     # 0x1e5c0
movq (%rax,%rbx,8), %rcx
movq %r13, %rax
sarq $0x3f, %rax
cmpq $-0x1, %rcx
setne %sil
movq %rdx, %r14
movq %rcx, %rbx
cmpq $-0x1, %rdx
setne %r12b
jne 0x4b4a
movq %rdx, %r14
movq %rcx, %rbx
cmpq $-0x1, %rcx
jne 0x4b4a
movq %rdx, %r14
movq %rcx, %rbx
testq %r13, %r13
js 0x4b4a
movl $0x3, %edi
callq 0x3851
movq 0x1953e(%rip), %rax     # 0x1e170
movq 0x19987(%rip), %rcx     # 0x1e5c0
movq %r15, %rsi
cmpq $0x0, (%rax,%r15,8)
jne 0x4c4d
movq (%rcx,%rsi,8), %r15
cmpq $-0x1, %r15
jne 0x4c39
movq $-0x18, %rdi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x36e8
movq 0x194b5(%rip), %rsi     # 0x1e128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x194a4(%rip)     # 0x1e128
movq %r15, %rdi
callq 0x43a4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x47a5
movq %rax, %rbx
movl $0x1, %edi
callq 0x3851
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq