// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/value.c
// Function: janet_putindex
void janet_putindex(Janet ds, int32_t index, Janet value) {
    switch (janet_type(ds)) {
        default:
            janet_panicf("expected %T, got %v",
                         JANET_TFLAG_ARRAY | JANET_TFLAG_BUFFER | JANET_TFLAG_TABLE, ds);
        case JANET_ARRAY: {
            JanetArray *array = janet_unwrap_array(ds);
            if (index >= array->count) {
                janet_array_ensure(array, index + 1, 2);
                array->count = index + 1;
            }
            array->data[index] = value;
            break;
        }
        case JANET_BUFFER: {
            JanetBuffer *buffer = janet_unwrap_buffer(ds);
            if (!janet_checkint(value))
                janet_panicf("can only put integers in buffers, got %v", value);
            if (index >= buffer->count) {
                janet_buffer_ensure(buffer, index + 1, 2);
                buffer->count = index + 1;
            }
            buffer->data[index] = (uint8_t)(janet_unwrap_integer(value) & 0xFF);
            break;
        }
        case JANET_TABLE: {
            JanetTable *table = janet_unwrap_table(ds);
            janet_table_put(table, janet_wrap_integer(index), value);
            break;
        }
        case JANET_ABSTRACT: {
            JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
            if (type->put) {
                (type->put)(janet_unwrap_abstract(ds), janet_wrap_integer(index), value);
            } else {
                janet_panicf("no setter for %v ", ds);
            }
            break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movsd -0x8(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x703c5
jmp 0x703d6
movq -0x8(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x4c(%rbp)
jmp 0x703dd
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x703dd
movl -0x4c(%rbp), %eax
addl $-0x7, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x7, %eax
ja 0x70402
movq -0x58(%rbp), %rax
leaq 0x28863(%rip), %rcx     # 0x98c5c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdx
leaq 0x10cda(%rip), %rdi     # 0x810e7
movl $0xa80, %esi            # imm = 0xA80
movb $0x0, %al
callq 0x1ac40
movq -0x8(%rbp), %rdi
callq 0x7b260
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x70453
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
addl $0x1, %esi
movl $0x2, %edx
callq 0x13370
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
movq -0x10(%rbp), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x7058a
movq -0x8(%rbp), %rdi
callq 0x7b260
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6d480
cmpl $0x0, %eax
jne 0x70499
movq -0x10(%rbp), %rsi
leaq 0x288d6(%rip), %rdi     # 0x98d68
movb $0x0, %al
callq 0x1ac40
movl -0x14(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jl 0x704c6
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
addl $0x1, %esi
movl $0x2, %edx
callq 0x184c0
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
cvttsd2si -0x10(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x7058a
movq -0x8(%rbp), %rdi
callq 0x7b260
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
callq 0x7b820
movq -0x60(%rbp), %rdi
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x697e0
jmp 0x7058a
movq -0x8(%rbp), %rdi
callq 0x7b260
movq -0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x70576
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7b260
movq %rax, -0x70(%rbp)
cvtsi2sdl -0x14(%rbp), %xmm0
callq 0x7b820
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq *%rax
jmp 0x70588
movq -0x8(%rbp), %rsi
leaq 0x28810(%rip), %rdi     # 0x98d91
movb $0x0, %al
callq 0x1ac40
jmp 0x7058a
addq $0x70, %rsp
popq %rbp
retq