// File: /workspace/github_cpp_makefile_star2_O1/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 0x634a
movq (%r15), %rdi
callq 0x4dfa
movl %eax, %r15d
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xbffd
callq 0x4114
testb %r15b, %r15b
je 0xc064
movq (%r14), %rsi
leaq -0x28(%rbp), %r15
movq %r15, %rdi
callq 0x634a
movq (%r15), %rax
movq (%rax), %rdi
callq 0xaf0f
testq %rax, %rax
je 0xc204
movsd (%rax), %xmm0
movapd %xmm0, -0x50(%rbp)
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xc03c
callq 0x4114
movq (%r14), %rdi
callq 0x4ff4
cmpq $0x1, %rax
jne 0xc0b3
movapd -0x50(%rbp), %xmm0
xorpd 0x7619(%rip), %xmm0     # 0x13670
movq %rbx, %rdi
callq 0x5244
jmp 0xc1f1
movq 0xdf7d(%rip), %r14      # 0x19fe8
leaq 0x7637(%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 0xc1f1
movq (%r14), %rsi
leaq -0x28(%rbp), %rdi
callq 0x627a
leaq -0x40(%rbp), %r14
movq -0x28(%rbp), %rdi
callq 0x4c7c
testb %al, %al
jne 0xc186
movq -0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x634a
movq -0x40(%rbp), %rdi
callq 0x4dfa
movl %eax, %r15d
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xc0fa
callq 0x4114
testb %r15b, %r15b
je 0xc195
movq -0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x634a
movq -0x40(%rbp), %rax
movq (%rax), %rdi
callq 0xaf0f
testq %rax, %rax
je 0xc1ff
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xc13b
callq 0x4114
movq -0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x627a
movaps -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movups %xmm0, -0x28(%rbp)
testq %rdi, %rdi
je 0xc164
callq 0x4114
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xc172
callq 0x4114
movapd -0x50(%rbp), %xmm0
subsd -0x58(%rbp), %xmm0
movapd %xmm0, -0x50(%rbp)
jmp 0xc0c3
movq %rbx, %rdi
movapd -0x50(%rbp), %xmm0
callq 0x5244
jmp 0xc1e3
movq 0xde4c(%rip), %r14      # 0x19fe8
leaq 0x74e5(%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 0xde1a(%rip), %rdi      # 0x19fe8
callq 0x3030
movq %rax, %rdi
callq 0x3160
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xc1f1
callq 0x4114
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4667
callq 0x4667
jmp 0xc234
jmp 0xc215
jmp 0xc234
jmp 0xc234
jmp 0xc221
jmp 0xc234
movq %rax, %rdi
callq 0x4085
jmp 0xc234
jmp 0xc234
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xc237
callq 0x4114
jmp 0xc237
movq %rax, %rbx
movq -0x20(%rbp), %rdi
testq %rdi, %rdi
je 0xc245
callq 0x4114
movq %rbx, %rdi
callq 0x3310
nop