// File: /workspace/github_cpp_makefile_star2_O3/0x0584[P]scmin-plus/src/builtin/arithmetic.cpp
// Function: builtin::_sub(std::shared_ptr<sexpr> const&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<sexpr>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::shared_ptr<sexpr>>>>&)
sexpr_t builtin::_sub(const sexpr_t& args, env_t& bindings) {
    (void)bindings;
    if (not args->car()->isnum()) {
        cerr << "fatal: operand is not a number!" << endl;
        return nullptr;
    }
    double d = any_cast<sexpr_number>(*args->car()->blob).n;

    if (args->length() == 1)
        return num(-d);

    sexpr_t walk = args->cdr();

    while (not walk->isnil()) {
        if (not walk->car()->isnum()) {
            cerr << "fatal: operands are not numbers!" << endl;
            return nullptr;
        }
        d -= any_cast<sexpr_number>(*walk->car()->blob).n;
        walk = walk->cdr();
    }
    return num(d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
leaq -0x28(%rbp), %r15
movq %r15, %rdi
callq 0x628e
movq (%r15), %rdi
callq 0x4df2
movl %eax, %r15d
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xbce9
callq 0x4104
testb %r15b, %r15b
je 0xbd50
movq (%r14), %rsi
leaq -0x28(%rbp), %r15
movq %r15, %rdi
callq 0x628e
movq (%r15), %rax
movq (%rax), %rdi
callq 0xac3b
testq %rax, %rax
je 0xbef0
movsd (%rax), %xmm0
movapd %xmm0, -0x50(%rbp)
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xbd28
callq 0x4104
movq (%r14), %rdi
callq 0x4fb6
cmpq $0x1, %rax
jne 0xbd9f
movapd -0x50(%rbp), %xmm0
xorpd 0x792d(%rip), %xmm0     # 0x13670
movq %rbx, %rdi
callq 0x51d8
jmp 0xbedd
movq 0xe291(%rip), %r14      # 0x19fe8
leaq 0x794b(%rip), %rsi      # 0x136a9
movl $0x1f, %edx
movq %r14, %rdi
callq 0x3210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
jmp 0xbedd
movq (%r14), %rsi
leaq -0x28(%rbp), %rdi
callq 0x61be
leaq -0x40(%rbp), %r14
movq -0x28(%rbp), %rdi
callq 0x4c74
testb %al, %al
jne 0xbe72
movq -0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x628e
movq -0x40(%rbp), %rdi
callq 0x4df2
movl %eax, %r15d
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xbde6
callq 0x4104
testb %r15b, %r15b
je 0xbe81
movq -0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x628e
movq -0x40(%rbp), %rax
movq (%rax), %rdi
callq 0xac3b
testq %rax, %rax
je 0xbeeb
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xbe27
callq 0x4104
movq -0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x61be
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movups %xmm0, -0x28(%rbp)
testq %rdi, %rdi
je 0xbe5e
callq 0x4104
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xbe5e
callq 0x4104
movapd -0x50(%rbp), %xmm0
subsd -0x58(%rbp), %xmm0
movapd %xmm0, -0x50(%rbp)
jmp 0xbdaf
movq %rbx, %rdi
movapd -0x50(%rbp), %xmm0
callq 0x51d8
jmp 0xbecf
movq 0xe160(%rip), %r14      # 0x19fe8
leaq 0x77f9(%rip), %rsi      # 0x13688
movl $0x20, %edx
movq %r14, %rdi
callq 0x3210
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq 0xe12e(%rip), %rdi      # 0x19fe8
callq 0x3030
movq %rax, %rdi
callq 0x3160
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xbedd
callq 0x4104
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4668
callq 0x4668
jmp 0xbf20
jmp 0xbf01
jmp 0xbf20
jmp 0xbf20
jmp 0xbf0d
jmp 0xbf20
movq %rax, %rdi
callq 0x4075
jmp 0xbf20
jmp 0xbf20
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xbf23
callq 0x4104
jmp 0xbf23
movq %rax, %rbx
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xbf31
callq 0x4104
movq %rbx, %rdi
callq 0x3310
nop