// File: /workspace/github_c_makefile_star2_O3/mattn[P]orelang/ore.c
// Function: ore_index_ref
static ore_value*
ore_index_ref(ore_context* ore, ore_value v, ore_value e, int update) {
  if (v.t == ORE_TYPE_ARRAY) {
    if (e.t != ORE_TYPE_INT) {
      fprintf(stderr, "array index should be int\n");
      ore->err = ORE_ERROR_EXCEPTION;
      return NULL;
    }
    ore_array_t* a = (ore_array_t*) v.v.a->p;
    int n = 0;
    ore_array_iter_t* k;
    for (k = kl_begin(a); k != kl_end(a); k = kl_next(k)) {
      if (n == e.v.i) {
        if (update) {
          ore_value old = kl_val(k);
          ore_value_unref(old);
        }
        return &kl_val(k);
      }
      n++;
    }
    fprintf(stderr, "out of bounds for array\n");
    ore->err = ORE_ERROR_EXCEPTION;
    return NULL;
  }
  if (v.t == ORE_TYPE_HASH) {
    if (e.t != ORE_TYPE_STRING) {
      fprintf(stderr, "hash index should be string\n");
      ore->err = ORE_ERROR_EXCEPTION;
      return NULL;
    }
    ore_hash_t* h = (ore_hash_t*) v.v.h->p;
    if (update) {
      int r = 0;
      khint_t k = kh_get(value, h, e.v.s->p);
      if (k != kh_end(ore->env)) {
        ore_value old = kh_value(ore->env, k);
        ore_value_unref(old);
      }
      k = kh_put(value, h, e.v.s->p, &r);
      return &kh_value(h, k);
    } else {
      khint_t k = kh_get(value, h, e.v.s->p);
      if (k != kh_end(ore->env)) {
        return &kh_value(h, k);
      }
    }
    return NULL;
  }
  if (v.t == ORE_TYPE_OBJECT) {
    ore_context* this = (ore_context*) v.v.o->e;
    if (update) {
      int r = 0;
      khint_t k = kh_get(value, this->env, e.v.s->p);
      if (k != kh_end(ore->env)) {
        ore_value old = kh_value(ore->env, k);
        ore_value_unref(old);
      }
      k = kh_put(value, this->env, e.v.s->p, &r);
      return &kh_value(this->env, k);
    } else {
      khint_t k = kh_get(value, this->env, e.v.s->p);
      if (k != kh_end(ore->env)) {
        return &kh_value(this->env, k);
      }
    }
    return NULL;
  }
  fprintf(stderr, "invalid operation for %s\n", ore_kind(v));
  ore->err = ORE_ERROR_EXCEPTION;
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rdx
leaq 0xc8(%rsp), %rax
leaq 0xa0(%rsp), %rcx
movl (%rcx), %edi
cmpl $0xd, %edi
je 0x10afc
cmpl $0x6, %edi
je 0x10b77
cmpl $0x5, %edi
jne 0x11054
cmpl $0x2, (%rax)
jne 0x1105e
movq 0x8(%rcx), %rcx
movq (%rcx), %rcx
movq (%rcx), %r15
movq 0x8(%rcx), %rcx
cmpq %rcx, %r15
je 0x10aef
movl 0x8(%rax), %eax
incl %eax
decl %eax
je 0x10bf3
movq 0x28(%r15), %r15
cmpq %rcx, %r15
jne 0x10ade
movq %rdx, %rdi
callq 0x26e3
jmp 0x11070
movq 0x8(%rcx), %rcx
movq 0x10(%rcx), %rbx
testl %esi, %esi
je 0x10c20
movq (%rbx), %rcx
movq 0x8(%rax), %r14
movq (%r14), %r15
movq %rcx, 0x30(%rsp)
movl (%rcx), %eax
testl %eax, %eax
je 0x10cdd
leal -0x1(%rax), %edi
movsbl (%r15), %r12d
testl %r12d, %r12d
movq %rdx, 0x40(%rsp)
movq %rbx, 0x38(%rsp)
movq %r14, 0x50(%rsp)
movq %rax, 0x58(%rsp)
je 0x10ceb
movb 0x1(%r15), %al
testb %al, %al
je 0x10cee
leaq 0x2(%r15), %rcx
movl %r12d, %edx
shll $0x5, %edx
subl %r12d, %edx
movsbl %al, %r12d
addl %edx, %r12d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x10b59
jmp 0x10cee
cmpl $0x4, (%rax)
jne 0x11068
movq 0x8(%rcx), %rcx
movq (%rcx), %rdi
testl %esi, %esi
movq %rdi, 0x30(%rsp)
je 0x10c84
movq 0x8(%rax), %rbx
movq (%rbx), %r14
movl (%rdi), %eax
testl %eax, %eax
je 0x10ce4
leal -0x1(%rax), %r8d
movsbl (%r14), %r12d
testl %r12d, %r12d
movq %rdx, 0x40(%rsp)
movq %rbx, 0x38(%rsp)
movq %rax, 0x50(%rsp)
je 0x10dfd
movb 0x1(%r14), %al
testb %al, %al
je 0x10e00
leaq 0x2(%r14), %rcx
movl %r12d, %edx
shll $0x5, %edx
subl %r12d, %edx
movsbl %al, %r12d
addl %edx, %r12d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x10bd5
jmp 0x10e00
testl %esi, %esi
je 0x11073
movq 0x20(%r15), %rax
movq %rax, 0x20(%rsp)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xc6e3
jmp 0x11073
movq (%rbx), %rcx
movq %rcx, 0x30(%rsp)
movl (%rcx), %ecx
testl %ecx, %ecx
je 0x10df6
movq 0x8(%rax), %rax
movq (%rax), %r12
leal -0x1(%rcx), %esi
movsbl (%r12), %r13d
testl %r13d, %r13d
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
je 0x10efb
movb 0x1(%r12), %al
testb %al, %al
je 0x10efe
leaq 0x2(%r12), %rcx
movl %r13d, %edx
shll $0x5, %edx
subl %r13d, %edx
movsbl %al, %r13d
addl %edx, %r13d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x10c66
jmp 0x10efe
movl (%rdi), %ecx
testl %ecx, %ecx
je 0x10ef4
movq 0x8(%rax), %rax
movq (%rax), %r14
leal -0x1(%rcx), %esi
movsbl (%r14), %r13d
testl %r13d, %r13d
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
je 0x10fb0
movb 0x1(%r14), %al
testb %al, %al
je 0x10fb3
leaq 0x2(%r14), %rcx
movl %r13d, %edx
shll $0x5, %edx
subl %r13d, %edx
movsbl %al, %r13d
addl %edx, %r13d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x10cbf
jmp 0x10fb3
xorl %ecx, %ecx
jmp 0x10d91
xorl %ecx, %ecx
jmp 0x10e97
xorl %r12d, %r12d
andl %edi, %r12d
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdx
movl $0x1, %r14d
movl %r12d, %ebx
movl %edi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x10d71
testb $0x1, %al
jne 0x10d4e
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r15, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %edi
testl %eax, %eax
je 0x10d71
addl %r14d, %ebx
andl %edi, %ebx
incl %r14d
cmpl %r12d, %ebx
jne 0x10d0c
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rbx
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %rcx
jmp 0x10d91
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x58(%rsp), %rcx
cmovel %ebx, %ecx
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rbx
movq 0x50(%rsp), %r14
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x10dce
movq 0x20(%rax), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq %rdx, 0x20(%rsp)
movups (%rax,%rcx,8), %xmm0
movups 0x10(%rax,%rcx,8), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xc6e3
movq (%rbx), %rax
movq %rax, 0x30(%rsp)
movq (%r14), %r15
leaq 0x60(%rsp), %rdx
movq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0xd1b4
movq (%rbx), %rcx
movl %eax, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
addq 0x20(%rcx), %r15
jmp 0x11073
xorl %ecx, %ecx
jmp 0x10f8d
xorl %r12d, %r12d
andl %r8d, %r12d
movq 0x10(%rdi), %rdx
movl $0x1, %r15d
movl %r12d, %ebx
movl %r8d, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x10e7c
testb $0x1, %al
jne 0x10e5d
movq 0x18(%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %r8d
movq 0x30(%rsp), %rdi
testl %eax, %eax
je 0x10e7c
addl %r15d, %ebx
andl %r8d, %ebx
incl %r15d
cmpl %r12d, %ebx
jne 0x10e1a
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rbx
movq 0x50(%rsp), %rcx
jmp 0x10e97
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x50(%rsp), %rcx
cmovel %ebx, %ecx
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rbx
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x10ed1
movq 0x20(%rax), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq %rdx, 0x20(%rsp)
movups (%rax,%rcx,8), %xmm0
movups 0x10(%rax,%rcx,8), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xc6e3
movq 0x30(%rsp), %rdi
movq (%rbx), %r14
leaq 0x64(%rsp), %rdx
movq %rdi, %rbx
movq %r14, %rsi
callq 0xd1b4
movl %eax, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
addq 0x20(%rbx), %r15
jmp 0x11073
xorl %ecx, %ecx
jmp 0x1103d
xorl %r13d, %r13d
andl %esi, %r13d
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdx
movl $0x1, %r14d
movl %r13d, %ebx
movl %esi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r15d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r15d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x10f77
testb $0x1, %al
jne 0x10f5e
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r12, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %esi
testl %eax, %eax
je 0x10f77
addl %r14d, %ebx
andl %esi, %ebx
incl %r14d
cmpl %r13d, %ebx
jne 0x10f1c
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
jmp 0x10f8d
movl %ebp, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x38(%rsp), %rcx
cmovel %ebx, %ecx
movq 0x40(%rsp), %rdx
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x11070
movl %ecx, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
movq 0x30(%rsp), %rax
addq 0x20(%rax), %r15
jmp 0x11073
xorl %r13d, %r13d
andl %esi, %r13d
movq 0x10(%rdi), %rdx
movl $0x1, %r15d
movl %r13d, %ebx
movl %esi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r12d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r12d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x11027
testb $0x1, %al
jne 0x1100e
movq 0x18(%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %esi
movq 0x30(%rsp), %rdi
testl %eax, %eax
je 0x11027
addl %r15d, %ebx
andl %esi, %ebx
incl %r15d
cmpl %r13d, %ebx
jne 0x10fcc
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
jmp 0x1103d
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
movq 0x38(%rsp), %rcx
cmovel %ebx, %ecx
movq 0x40(%rsp), %rdx
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x11070
movl %ecx, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
addq 0x20(%rdi), %r15
jmp 0x11073
movq %rdx, %rsi
callq 0x270c
jmp 0x11070
movq %rdx, %rdi
callq 0x26ba
jmp 0x11070
movq %rdx, %rdi
callq 0x2691
xorl %r15d, %r15d
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq