// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq (%rsi), %rsi
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x5fc6
movq (%r14), %rdi
callq 0x4a9e
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x3e82
testb %r14b, %r14b
je 0xa267
movq (%rbx), %rsi
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x5fc6
movq (%r14), %rax
movq (%rax), %rdi
callq 0x900a
movapd %xmm0, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3e82
movq (%rbx), %rdi
callq 0x4b80
cmpq $0x1, %rax
jne 0xa290
movapd -0x60(%rbp), %xmm0
xorpd 0x63f6(%rip), %xmm0     # 0x10650
movq %r15, %rdi
callq 0x4d67
jmp 0xa37e
movq 0xdd7a(%rip), %rdi      # 0x17fe8
leaq 0x6414(%rip), %rsi      # 0x10689
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorpd %xmm0, %xmm0
movupd %xmm0, (%r15)
jmp 0xa37e
movq %r15, -0x50(%rbp)
movq (%rbx), %rsi
leaq -0x38(%rbp), %r15
movq %r15, %rdi
callq 0x5f48
leaq -0x40(%rbp), %r14
leaq -0x40(%rbp), %r13
leaq -0x48(%rbp), %rbx
movq -0x38(%rbp), %rdi
callq 0x49a8
testb %al, %al
jne 0xa33a
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x5fc6
movq -0x48(%rbp), %rdi
callq 0x4a9e
movl %eax, %r12d
movq %r14, %rdi
callq 0x3e82
testb %r12b, %r12b
je 0xa34d
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x5fc6
movq -0x48(%rbp), %rax
movq (%rax), %rdi
callq 0x900a
movsd %xmm0, -0x68(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3e82
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x5f48
movapd -0x60(%rbp), %xmm0
subsd -0x68(%rbp), %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4354
movq %r13, %rdi
callq 0x3e82
jmp 0xa2af
movq -0x50(%rbp), %r15
movq %r15, %rdi
movapd -0x60(%rbp), %xmm0
callq 0x4d67
jmp 0xa375
movq 0xdc94(%rip), %rdi      # 0x17fe8
leaq 0x630d(%rip), %rsi      # 0x10668
callq 0x31f0
movq -0x50(%rbp), %r15
movq %rax, %rdi
callq 0x3100
xorpd %xmm0, %xmm0
movupd %xmm0, (%r15)
leaq -0x30(%rbp), %rdi
callq 0x3e82
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa3b2
jmp 0xa3b2
jmp 0xa3b2
jmp 0xa3b2
jmp 0xa3b2
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
jmp 0xa3a9
movq %rax, %rbx
movq %r14, %rdi
callq 0x3e82
jmp 0xa3b5
jmp 0xa3b2
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x3e82
movq %rbx, %rdi
callq 0x3330