// File: /workspace/github_c_makefile_star2_O3/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
testq %rsi, %rsi
je 0x1b572
movl %ecx, %r12d
movl %edx, %r13d
movq %rsi, %r15
leaq 0x10(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movl -0x4(%rsi), %r14d
cmpq $0x1, %r14
je 0x1b58b
testl %r14d, %r14d
jne 0x1b5fd
movq %r8, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1baf6
movq %r9, %rbx
movq %rdi, %r14
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0x48(%rbp), %rdi
callq 0x1c64f
cmpl $0x8, %r13d
jne 0x1b77c
movq 0x10(%r15), %rax
movq %rax, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, (%rsp)
movq -0x30(%rbp), %rdi
movl $0x9, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
callq 0x21f27
jmp 0x1b7d4
movq %rdi, -0x58(%rbp)
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%rsp)
movupd (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
leaq -0x48(%rbp), %rdi
callq 0x1c64f
testl %r12d, %r12d
je 0x1b655
testb $0x1, 0x2a(%r15)
je 0x1b655
movq 0x18(%r15), %rbx
movq %rbx, %rdi
callq 0x49912
testl %eax, %eax
je 0x1b655
movq %rbx, %xmm0
cvttsd2si %xmm0, %eax
movsbl %al, %ecx
cmpl %eax, %ecx
je 0x1b7f6
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 -0x38(%rbp), %rax
movq %rax, 0x10(%rsp)
movupd -0x48(%rbp), %xmm0
movupd %xmm0, (%rsp)
movzbl %r13b, %esi
movq -0x30(%rbp), %rdi
movl $0x1, %edx
callq 0x22063
cmpl $0x3, %r14d
jl 0x1b767
addq $0x30, %r15
addq $-0x2, %r14
movzbl %r13b, %r13d
movzbl %r12b, %eax
movl %eax, -0x4c(%rbp)
testl %r12d, %r12d
je 0x1b6e7
testb $0x1, 0x12(%r15)
je 0x1b6e7
movq (%r15), %rbx
movq %rbx, %rdi
callq 0x49912
testl %eax, %eax
je 0x1b6e7
movq %rbx, %xmm0
cvttsd2si %xmm0, %eax
movsbl %al, %ecx
cmpl %eax, %ecx
je 0x1b733
movq 0x10(%r15), %rax
movq %rax, 0x40(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x28(%rsp)
movupd -0x48(%rbp), %xmm0
movupd %xmm0, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq -0x30(%rbp), %rdi
movl %r13d, %esi
movl $0x1, %edx
callq 0x22063
addq $0x18, %r15
decq %r14
jne 0x1b6bc
jmp 0x1b767
movq -0x38(%rbp), %rcx
movq %rcx, 0x28(%rsp)
movupd -0x48(%rbp), %xmm0
movupd %xmm0, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movupd %xmm0, (%rsp)
movsbl %al, %edx
movq -0x30(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl $0x1, %ecx
callq 0x21f27
jmp 0x1b728
movq -0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rax, 0x10(%rcx)
movups -0x48(%rbp), %xmm0
movups %xmm0, (%rcx)
jmp 0x1b7e4
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1baf6
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 -0x38(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, (%rsp)
movzbl %r13b, %esi
movq -0x30(%rbp), %rdi
movl $0x1, %edx
callq 0x22063
movq -0x38(%rbp), %rax
movq %rax, 0x10(%r14)
movups -0x48(%rbp), %xmm0
movups %xmm0, (%r14)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r15), %rcx
movq %rcx, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x38(%rbp), %rcx
movq %rcx, 0x10(%rsp)
movupd -0x48(%rbp), %xmm0
movupd %xmm0, (%rsp)
movzbl %r12b, %esi
movsbl %al, %edx
movq -0x30(%rbp), %rdi
movl $0x1, %ecx
callq 0x21f27
jmp 0x1b69f