// File: /workspace/github_cpp_makefile_star2_O2/0x0584[P]scmin-plus/src/builtin/arithmetic.cpp
// Function: builtin::_div(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::_div(const sexpr_t& args, env_t& bindings) {
    (void)bindings;

    if (not args->car()->isnum()) {
        cerr << "fatal: operands are not numbers!" << endl;
        return nullptr;
    }
    double d = any_cast<sexpr_number>(*args->car()->blob).n;
    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 $0x38, %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 0xa62f
movq %r15, -0x58(%rbp)
movq (%rbx), %rsi
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x5fc6
movq (%r14), %rax
movq (%rax), %rdi
callq 0x900a
movsd %xmm0, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3e82
movq (%rbx), %rsi
leaq -0x38(%rbp), %r15
movq %r15, %rdi
callq 0x5f48
leaq -0x48(%rbp), %r14
leaq -0x48(%rbp), %r13
leaq -0x50(%rbp), %rbx
movq -0x38(%rbp), %rdi
callq 0x49a8
testb %al, %al
jne 0xa655
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x5fc6
movq -0x50(%rbp), %rdi
callq 0x4a9e
movl %eax, %r12d
movq %r14, %rdi
callq 0x3e82
testb %r12b, %r12b
je 0xa668
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x5fc6
movq -0x50(%rbp), %rax
movq (%rax), %rdi
callq 0x900a
movsd %xmm0, -0x60(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3e82
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x5f48
movsd -0x40(%rbp), %xmm0
divsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4354
movq %r13, %rdi
callq 0x3e82
jmp 0xa59c
movq 0xd9b2(%rip), %rdi      # 0x17fe8
leaq 0x602b(%rip), %rsi      # 0x10668
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorpd %xmm0, %xmm0
movupd %xmm0, (%r15)
jmp 0xa699
movq -0x58(%rbp), %r15
movq %r15, %rdi
movsd -0x40(%rbp), %xmm0
callq 0x4d67
jmp 0xa690
movq 0xd979(%rip), %rdi      # 0x17fe8
leaq 0x5ff2(%rip), %rsi      # 0x10668
callq 0x31f0
movq -0x58(%rbp), %r15
movq %rax, %rdi
callq 0x3100
xorpd %xmm0, %xmm0
movupd %xmm0, (%r15)
leaq -0x30(%rbp), %rdi
callq 0x3e82
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa6cd
jmp 0xa6cd
jmp 0xa6cd
jmp 0xa6cd
jmp 0xa6cd
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0xa6c4
movq %rax, %rbx
movq %r14, %rdi
callq 0x3e82
jmp 0xa6d0
jmp 0xa6cd
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x3e82
movq %rbx, %rdi
callq 0x3330