// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/cfuns.c
// Function: opreduce
static JanetSlot opreduce(
    JanetFopts opts,
    JanetSlot *args,
    int op,
    int opim,
    Janet nullary,
    Janet unary) {
    JanetCompiler *c = opts.compiler;
    int32_t i, len;
    int8_t imm = 0;
    len = janet_v_count(args);
    JanetSlot t;
    if (len == 0) {
        return janetc_cslot(nullary);
    } else if (len == 1) {
        t = janetc_gettarget(opts);
        /* Special case subtract to be times -1 */
        if (op == JOP_SUBTRACT) {
            janetc_emit_ssi(c, JOP_MULTIPLY_IMMEDIATE, t, args[0], -1, 1);
        } else {
            janetc_emit_sss(c, op, t, janetc_cslot(unary), args[0], 1);
        }
        return t;
    }
    t = janetc_gettarget(opts);
    if (opim && can_slot_be_imm(args[1], &imm)) {
        janetc_emit_ssi(c, opim, t, args[0], imm, 1);
    } else {
        janetc_emit_sss(c, op, t, args[0], args[1], 1);
    }
    for (i = 2; i < len; i++) {
        if (opim && can_slot_be_imm(args[i], &imm)) {
            janetc_emit_ssi(c, opim, t, t, imm, 1);
        } else {
            janetc_emit_sss(c, op, t, t, args[i], 1);
        }
    }
    return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %rbx
movl %ecx, -0x30(%rbp)
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
je 0x1b637
movl -0x4(%r15), %r13d
jmp 0x1b63a
xorl %r13d, %r13d
leaq 0x10(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
cmpl $0x1, %r13d
je 0x1b660
testl %r13d, %r13d
jne 0x1b6ce
movq %r14, %rdi
movq %r8, %rsi
callq 0x1bc4e
jmp 0x1b94e
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0x50(%rbp), %rdi
callq 0x1c898
cmpl $0x8, %r12d
jne 0x1b741
movq 0x10(%r15), %rax
movq %rax, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x40(%rbp), %rax
movq %rax, 0x10(%rsp)
movupd -0x50(%rbp), %xmm0
movupd %xmm0, (%rsp)
movq -0x38(%rbp), %rdi
movl $0x9, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
callq 0x22283
jmp 0x1b79e
movq %r14, -0x60(%rbp)
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%rsp)
movupd (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
leaq -0x50(%rbp), %rdi
callq 0x1c898
cmpl $0x0, -0x30(%rbp)
je 0x1b7bf
movl %r12d, %r14d
movb $0x1, %r12b
testb $0x1, 0x2a(%r15)
je 0x1b7a7
movq 0x18(%r15), %rbx
movq %rbx, %rdi
callq 0x4a41f
xorl %edx, %edx
testl %eax, %eax
je 0x1b7a7
movq %rbx, %xmm0
cvttsd2si %xmm0, %eax
movsbl %al, %ecx
cmpl %eax, %ecx
setne %r12b
cmovel %eax, %edx
movl %edx, -0x2c(%rbp)
jmp 0x1b7ae
movl %r12d, %r13d
leaq -0x78(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1bc4e
movq 0x10(%r15), %rax
movq %rax, 0x40(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x30(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x28(%rsp)
movups (%r12), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x40(%rbp), %rax
movq %rax, 0x10(%rsp)
movupd -0x50(%rbp), %xmm0
movupd %xmm0, (%rsp)
movzbl %r13b, %esi
movq -0x38(%rbp), %rdi
movl $0x1, %edx
callq 0x223bf
movq -0x40(%rbp), %rax
jmp 0x1b942
movl $0x0, -0x2c(%rbp)
movq -0x38(%rbp), %rbx
testb %r12b, %r12b
je 0x1b813
movl -0x2c(%rbp), %eax
movl %r14d, %r12d
jmp 0x1b7c5
xorl %eax, %eax
movq -0x38(%rbp), %rbx
movl %eax, -0x2c(%rbp)
movq 0x28(%r15), %rax
movq %rax, 0x40(%rsp)
movups 0x18(%r15), %xmm0
movups %xmm0, 0x30(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x40(%rbp), %rax
movq %rax, 0x10(%rsp)
movupd -0x50(%rbp), %xmm0
movupd %xmm0, (%rsp)
movzbl %r12b, %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x223bf
jmp 0x1b850
movq 0x10(%r15), %rax
movq %rax, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x40(%rbp), %rax
movq %rax, 0x10(%rsp)
movupd -0x50(%rbp), %xmm0
movupd %xmm0, (%rsp)
movsbl -0x2c(%rbp), %edx
movzbl -0x30(%rbp), %esi
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x22283
movl %r14d, %r12d
cmpl $0x3, %r13d
jl 0x1b93a
movl %r12d, %eax
movl %r13d, %r12d
addq $0x30, %r15
addq $-0x2, %r12
movzbl %al, %r13d
movzbl -0x30(%rbp), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x1b8b9
movb $0x1, %r14b
testb $0x1, 0x12(%r15)
je 0x1b8b4
movq (%r15), %rbx
movq %rbx, %rdi
callq 0x4a41f
testl %eax, %eax
je 0x1b8b0
movq %rbx, %xmm0
cvttsd2si %xmm0, %eax
movsbl %al, %ecx
cmpl %eax, %ecx
setne %r14b
movl -0x2c(%rbp), %ecx
movzbl %cl, %ecx
cmovel %eax, %ecx
movl %ecx, -0x2c(%rbp)
movq -0x38(%rbp), %rbx
testb %r14b, %r14b
je 0x1b8fb
movq 0x10(%r15), %rax
movq %rax, 0x40(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x40(%rbp), %rax
movq %rax, 0x28(%rsp)
movupd -0x50(%rbp), %xmm0
movupd %xmm0, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq %rbx, %rdi
movl %r13d, %esi
movl $0x1, %edx
callq 0x223bf
jmp 0x1b92d
movq -0x40(%rbp), %rax
movq %rax, 0x28(%rsp)
movupd -0x50(%rbp), %xmm0
movupd %xmm0, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
movsbl -0x2c(%rbp), %edx
movq %rbx, %rdi
movl -0x54(%rbp), %esi
movl $0x1, %ecx
callq 0x22283
addq $0x18, %r15
decq %r12
jne 0x1b873
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %r14
movq %rax, 0x10(%r14)
movups -0x50(%rbp), %xmm0
movups %xmm0, (%r14)
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq