// File: /workspace/github_c_makefile_star2_O3/mahrr[P]raven/src/compiler.c
// Function: array
static void array(Parser *parser) {
    Debug_Log(parser);

    if (consume_if(parser, TOKEN_RIGHT_BRACKET)) {
        emit_bytes(parser, OP_ARRAY_8, 0);
        Debug_Exit(parser);
        return;
    }

    size_t count = 0;
    do {
        expression(parser);

        if (count == ARRAY_LIMIT) {
            error_limit(parser, "array literal elements", ARRAY_LIMIT);
            break;
        }

        count++;
    } while (consume_if(parser, TOKEN_COMMA));

    if (count > UINT8_MAX) {
        emit_byte(parser, OP_ARRAY_16);
        emit_bytes(parser, (count >> 8) & 0xff, count & 0xff);
    } else {
        emit_bytes(parser, OP_ARRAY_8, (uint8_t)count);
    }

    consume(parser, TOKEN_RIGHT_BRACKET, "expect ']' after array elements");

    Debug_Exit(parser);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
cmpl $0x2d, 0x18(%rdi)
jne 0x7e5d
movq 0x10(%r14), %rax
movq %rax, 0x40(%rbx)
movups (%r14), %xmm0
movups %xmm0, 0x30(%rbx)
movq %rsp, %r15
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x941f
movq 0x10(%rsp), %rax
movq %rax, 0x10(%r14)
movups (%rsp), %xmm0
movups %xmm0, (%r14)
cmpl $0x35, 0x18(%rbx)
je 0x7e07
movq 0x8(%rbx), %rax
movl 0x44(%rbx), %edx
movq 0x8(%rax), %rdi
addq $0x20, %rdi
movl $0x26, %esi
callq 0x4af1
movq 0x8(%rbx), %rax
movl 0x44(%rbx), %edx
movq 0x8(%rax), %rdi
addq $0x20, %rdi
xorl %esi, %esi
callq 0x4af1
jmp 0x7f9f
movq %rbx, %rdi
movl $0x1, %esi
callq 0x679e
leaq 0x30(%rbx), %r12
xorl %eax, %eax
movq %rsp, %r15
leaq 0x1(%rax), %r13
cmpl $0x25, (%r14)
jne 0x7ee6
movq 0x10(%r14), %rax
movq %rax, 0x10(%r12)
movups (%r14), %xmm0
movups %xmm0, (%r12)
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x941f
movq 0x10(%rsp), %rax
movq %rax, 0x10(%r14)
movups (%rsp), %xmm0
movups %xmm0, (%r14)
cmpl $0x35, 0x18(%rbx)
je 0x7e8f
movq %rbx, %rdi
movl $0x1, %esi
callq 0x679e
movq %r13, %rax
cmpq $0x10000, %r13          # imm = 0x10000
jne 0x7e73
leaq 0x3e28(%rip), %rsi      # 0xbcf9
movq %rbx, %rdi
movl $0x10000, %edx          # imm = 0x10000
callq 0x621b
movl $0x10000, %r13d         # imm = 0x10000
jmp 0x7eee
cmpq $0xff, %rax
jb 0x7f17
leaq 0x8(%rbx), %r15
movq 0x8(%rbx), %rax
leaq 0x44(%rbx), %rbp
movl 0x44(%rbx), %edx
movq 0x8(%rax), %rdi
addq $0x20, %rdi
movl $0x27, %esi
callq 0x4af1
movl %r13d, %eax
shrl $0x8, %eax
jmp 0x7f21
leaq 0x8(%rbx), %r15
leaq 0x44(%rbx), %rbp
movb $0x26, %al
movq (%r15), %rcx
movl (%rbp), %edx
movq 0x8(%rcx), %rdi
addq $0x20, %rdi
movzbl %al, %esi
callq 0x4af1
movq (%r15), %rax
movl (%rbp), %edx
movq 0x8(%rax), %rdi
addq $0x20, %rdi
movzbl %r13b, %esi
callq 0x4af1
cmpl $0x2d, (%r14)
jne 0x7f8d
movq 0x10(%r14), %rax
movq %rax, 0x10(%r12)
movups (%r14), %xmm0
movups %xmm0, (%r12)
movq %rsp, %r15
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x941f
movq 0x10(%rsp), %rax
movq %rax, 0x10(%r14)
movups (%rsp), %xmm0
movups %xmm0, (%r14)
cmpl $0x35, 0x18(%rbx)
je 0x7f69
jmp 0x7f9f
leaq 0x3d7c(%rip), %rdx      # 0xbd10
movq %rbx, %rdi
movq %r14, %rsi
callq 0x61ef
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq