// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/cfuns.c
// Function: compreduce
static JanetSlot compreduce(
    JanetFopts opts,
    JanetSlot *args,
    int op,
    int opim,
    int invert) {
    JanetCompiler *c = opts.compiler;
    int32_t i, len;
    int8_t imm = 0;
    len = janet_v_count(args);
    int32_t *labels = NULL;
    JanetSlot t;
    if (len < 2) {
        return invert
               ? janetc_cslot(janet_wrap_false())
               : janetc_cslot(janet_wrap_true());
    }
    t = janetc_gettarget(opts);
    for (i = 1; i < len; i++) {
        if (opim && can_slot_be_imm(args[i], &imm)) {
            janetc_emit_ssi(c, opim, t, args[i - 1], imm, 1);
        } else {
            janetc_emit_sss(c, op, t, args[i - 1], args[i], 1);
        }
        if (i != (len - 1)) {
            int32_t label = janetc_emit_si(c, invert ? JOP_JUMP_IF : JOP_JUMP_IF_NOT, t, 0, 1);
            janet_v_push(labels, label);
        }
    }
    int32_t end = janet_v_count(c->buffer);
    for (i = 0; i < janet_v_count(labels); i++) {
        int32_t label = labels[i];
        c->buffer[label] |= ((end - label) << 16);
    }
    janet_v_free(labels);
    return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %r8d, %r15d
movl %ecx, -0x34(%rbp)
movq %rdi, %rbx
movq 0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movb $0x0, -0x29(%rbp)
testq %rsi, %rsi
je 0x19cfa
movq %rsi, %r12
movslq -0x4(%rsi), %r13
cmpq $0x1, %r13
jg 0x19d21
movabsq $-0x7000000000000, %rdi # imm = 0xFFF9000000000000
testl %r15d, %r15d
jne 0x19d0c
incq %rdi
callq 0x4b313
movq %rbx, %rdi
movq %rax, %rsi
callq 0x19f5c
jmp 0x19eee
movq %rbx, -0x50(%rbp)
leaq 0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0x68(%rbp), %rdi
movl %edx, -0x30(%rbp)
callq 0x1aa9e
xorl %r14d, %r14d
cmpl $0x1, %r15d
movl $0x0, %eax
adcb $0x1d, %al
leal -0x1(%r13), %ecx
movq %rcx, -0x70(%rbp)
pushq $0x1
popq %rbx
movzbl -0x30(%rbp), %ecx
movl %ecx, -0x30(%rbp)
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movzbl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
cmpq %rbx, %r13
je 0x19e98
cmpl $0x0, -0x34(%rbp)
je 0x19de5
movq 0x28(%r12), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%r12), %xmm0
movups %xmm0, (%rsp)
leaq -0x29(%rbp), %rdi
callq 0x19c74
testl %eax, %eax
je 0x19de5
movsbl -0x29(%rbp), %edx
movq 0x10(%r12), %rax
movq %rax, 0x28(%rsp)
movups (%r12), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x58(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x68(%rbp), %xmm0
movups %xmm0, (%rsp)
movq -0x40(%rbp), %rdi
movl -0x44(%rbp), %esi
pushq $0x1
popq %rcx
callq 0x1ffee
jmp 0x19e2e
movq 0x28(%r12), %rax
movq %rax, 0x40(%rsp)
movups 0x18(%r12), %xmm0
movups %xmm0, 0x30(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x28(%rsp)
movups (%r12), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x58(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x68(%rbp), %xmm0
movups %xmm0, (%rsp)
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
pushq $0x1
popq %rdx
callq 0x2010f
cmpq %rbx, -0x70(%rbp)
je 0x19e8c
movq -0x58(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x68(%rbp), %xmm0
movups %xmm0, (%rsp)
movq -0x40(%rbp), %rdi
movl -0x48(%rbp), %esi
xorl %edx, %edx
pushq $0x1
popq %rcx
callq 0x1fe75
movl %eax, %r15d
testq %r14, %r14
je 0x19e6b
movl -0x4(%r14), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%r14), %ecx
jl 0x19e82
movq %r14, %rdi
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
callq 0x4799c
movq %rax, %r14
movl -0x4(%rax), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%r14)
cltq
movl %r15d, (%r14,%rax,4)
incq %rbx
addq $0x18, %r12
jmp 0x19d7b
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x19eaa
movl -0x4(%rax), %ecx
jmp 0x19eac
xorl %ecx, %ecx
movq -0x50(%rbp), %rbx
testq %r14, %r14
je 0x19edf
xorl %edx, %edx
movslq -0x4(%r14), %rsi
cmpq %rsi, %rdx
jge 0x19ed3
movslq (%r14,%rdx,4), %rsi
movl %ecx, %edi
subl %esi, %edi
shll $0x10, %edi
orl %edi, (%rax,%rsi,4)
incq %rdx
jmp 0x19eb7
addq $-0x8, %r14
movq %r14, %rdi
callq 0x298c1
movq -0x58(%rbp), %rax
movq %rax, 0x10(%rbx)
movups -0x68(%rbp), %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop