// File: /workspace/github_c_makefile_star2_O0/mirth-lang[P]mirth/bin/mirth1.c
// Function: arr_reserve
static ARR* arr_reserve(ARR* arr, TAG tag, size_t need_cap) {
    if (!arr) { return arr_new_of(tag, need_cap); }
    if ((arr->refs == 1) && (arr->cap >= need_cap)) return arr;
    ASSERT(arr->tag == tag);
    USIZE size = arr->size;
    USIZE stride = arr->stride;
    if (need_cap < size) need_cap = arr->size;
    USIZE cap = need_cap*2 + 4;
    ARR* arr2 = arr_new_of(tag, cap);
    USIZE mbytes = ((stride == STRIDE_BOOL) ? size/8 : size*stride) + 4;
    arr2->size = size;
    memcpy(arr2->data.u8s, arr->data.u8s, mbytes);
    if (TAG_HAS_REFS(tag)) {
        for (USIZE i = 0; i < size; i++) {
            VAL u = val_peek_(arr2,i);
            incref(u);
        }
    }
    decref(MKARR(arr));
    return arr2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x358c4
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x34180
movq %rax, -0x8(%rbp)
jmp 0x35b5e
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x358e8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x20(%rbp), %rax
jb 0x358e8
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x35b5e
jmp 0x358ea
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
cmpq -0x18(%rbp), %rax
je 0x35922
movl $0x2, %edi
leaq 0x31fab6(%rip), %rsi    # 0x3553ba
movl $0x3d, %edx
callq 0x5060
callq 0x5310
callq 0x53b0
movl $0x1, %edi
callq 0x5130
jmp 0x35924
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x35952
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shlq %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x34180
movq %rax, -0x40(%rbp)
cmpq $-0x1, -0x30(%rbp)
jne 0x3598a
movq -0x28(%rbp), %rax
shrq $0x3, %rax
movq %rax, -0xb8(%rbp)
jmp 0x3599a
movq -0x28(%rbp), %rax
imulq -0x30(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
movq -0x48(%rbp), %rdx
callq 0x50e0
movq -0x18(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x35a60
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x35a5e
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x35630
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x58(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x35a4c
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq -0x60(%rbp), %rax
cmpq $0x0, %rax
je 0x35a4c
movq -0x60(%rbp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
jne 0x35a4c
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq -0x60(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x35a4e
jmp 0x35a50
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x359e8
jmp 0x35a60
jmp 0x35a62
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x35bbf7(%rip), %rax    # 0x391668
orq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x35b54
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq 0x35bbce(%rip), %rax    # 0x391668
orq $0x1, %rax
movq %rax, -0x78(%rbp)
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq -0x80(%rbp), %rax
cmpq $0x0, %rax
je 0x35b54
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x35bb9c(%rip), %rax    # 0x391668
orq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x90(%rbp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
jne 0x35b54
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x35bb6e(%rip), %rax    # 0x391668
orq $0x1, %rax
movq %rax, -0x98(%rbp)
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq -0xa0(%rbp), %rcx
movl (%rcx), %eax
addl $-0x1, %eax
movl %eax, (%rcx)
cmpl $0x0, %eax
jne 0x35b52
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x35bb34(%rip), %rax    # 0x391668
orq $0x1, %rax
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x127c0
jmp 0x35b54
jmp 0x35b56
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)