// File: /workspace/github_c_makefile_star2_O1/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 0x10e00
cmpl $0x6, %edi
je 0x10e82
cmpl $0x5, %edi
jne 0x11364
cmpl $0x2, (%rax)
jne 0x1136e
movq 0x8(%rcx), %rcx
movq (%rcx), %rcx
movq (%rcx), %r15
movq 0x8(%rcx), %rcx
cmpq %rcx, %r15
je 0x10df3
movl 0x8(%rax), %eax
incl %eax
decl %eax
je 0x10f05
movq 0x28(%r15), %r15
cmpq %rcx, %r15
jne 0x10de2
movq %rdx, %rdi
callq 0x2728
jmp 0x11380
movq 0x8(%rcx), %rcx
movq 0x10(%rcx), %rbx
testl %esi, %esi
je 0x10f32
movl $0x0, 0x58(%rsp)
movq (%rbx), %rcx
movq 0x8(%rax), %r14
movq %rcx, 0x40(%rsp)
movl (%rcx), %eax
testl %eax, %eax
je 0x10fef
movq (%r14), %rsi
leal -0x1(%rax), %edi
movsbl (%rsi), %r15d
testl %r15d, %r15d
movq %rdx, 0x38(%rsp)
movq %rbx, 0x30(%rsp)
movq %r14, 0x50(%rsp)
movq %rax, 0x60(%rsp)
je 0x10ffd
movb 0x1(%rsi), %al
testb %al, %al
je 0x11000
leaq 0x2(%rsi), %rcx
movl %r15d, %edx
shll $0x5, %edx
subl %r15d, %edx
movsbl %al, %r15d
addl %edx, %r15d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x10e64
jmp 0x11000
cmpl $0x4, (%rax)
jne 0x11378
movq 0x8(%rcx), %rcx
movq (%rcx), %rdi
testl %esi, %esi
movq %rdi, 0x40(%rsp)
je 0x10f96
movl $0x0, 0x5c(%rsp)
movq 0x8(%rax), %rbx
movl (%rdi), %eax
testl %eax, %eax
je 0x10ff6
movq (%rbx), %r14
leal -0x1(%rax), %esi
movsbl (%r14), %r12d
testl %r12d, %r12d
movq %rdx, 0x38(%rsp)
movq %rbx, 0x30(%rsp)
movq %rax, 0x50(%rsp)
je 0x1110c
movb 0x1(%r14), %al
testb %al, %al
je 0x1110f
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 0x10ee7
jmp 0x1110f
testl %esi, %esi
je 0x11383
movq 0x20(%r15), %rax
movq %rax, 0x20(%rsp)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xc8b7
jmp 0x11383
movq (%rbx), %rcx
movq %rcx, 0x40(%rsp)
movl (%rcx), %ecx
testl %ecx, %ecx
je 0x11105
movq 0x8(%rax), %rax
movq (%rax), %r12
leal -0x1(%rcx), %esi
movsbl (%r12), %r13d
testl %r13d, %r13d
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
je 0x11209
movb 0x1(%r12), %al
testb %al, %al
je 0x1120c
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 0x10f78
jmp 0x1120c
movl (%rdi), %ecx
testl %ecx, %ecx
je 0x11202
movq 0x8(%rax), %rax
movq (%rax), %r14
leal -0x1(%rcx), %esi
movsbl (%r14), %r13d
testl %r13d, %r13d
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
je 0x112bf
movb 0x1(%r14), %al
testb %al, %al
je 0x112c2
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 0x10fd1
jmp 0x112c2
xorl %ecx, %ecx
jmp 0x110ad
xorl %ecx, %ecx
jmp 0x111a8
xorl %r15d, %r15d
andl %edi, %r15d
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rdx
movl $0x1, %ebx
movl %r15d, %r13d
movl %edi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r12d
leal (,%r13,2), %ebp
andl $0x1e, %ebp
movl %r12d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x1108c
testb $0x1, %al
jne 0x11069
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rsi, %r14
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %edi
movq %r14, %rsi
testl %eax, %eax
je 0x1108c
addl %ebx, %r13d
andl %edi, %r13d
incl %ebx
cmpl %r15d, %r13d
jne 0x1101d
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rbx
movq 0x50(%rsp), %r14
movq 0x60(%rsp), %rcx
jmp 0x110ad
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
movq 0x60(%rsp), %rcx
cmovel %r13d, %ecx
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rbx
movq 0x50(%rsp), %r14
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x110df
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 0xc8b7
movq (%rbx), %rdi
movq (%r14), %rsi
leaq 0x58(%rsp), %rdx
callq 0xd3d4
movq (%rbx), %rcx
movl %eax, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
addq 0x20(%rcx), %r15
jmp 0x11383
xorl %ecx, %ecx
jmp 0x1129c
xorl %r12d, %r12d
andl %esi, %r12d
movq 0x10(%rdi), %rdx
movl $0x1, %r15d
movl %r12d, %r13d
movl %esi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %ebx
leal (,%r13,2), %ebp
andl $0x1e, %ebp
movl %ebx, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x1118e
testb $0x1, %al
jne 0x1116f
movq 0x18(%rdi), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %esi
movq 0x40(%rsp), %rdi
testl %eax, %eax
je 0x1118e
addl %r15d, %r13d
andl %esi, %r13d
incl %r15d
cmpl %r12d, %r13d
jne 0x11128
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rbx
movq 0x50(%rsp), %rcx
jmp 0x111a8
movl %ebp, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq 0x50(%rsp), %rcx
cmovel %r13d, %ecx
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rbx
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x111df
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 0xc8b7
movq 0x40(%rsp), %rdi
movq (%rbx), %rsi
leaq 0x5c(%rsp), %rdx
movq %rdi, %rbx
callq 0xd3d4
movl %eax, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
addq 0x20(%rbx), %r15
jmp 0x11383
xorl %ecx, %ecx
jmp 0x1134d
xorl %r13d, %r13d
andl %esi, %r13d
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rdx
movl $0x1, %r14d
movl %r13d, %r15d
movl %esi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %ebx
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %ebx, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x11287
testb $0x1, %al
jne 0x1126d
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r12, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %esi
testl %eax, %eax
je 0x11287
addl %r14d, %r15d
andl %esi, %r15d
incl %r14d
cmpl %r13d, %r15d
jne 0x1122a
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
jmp 0x1129c
movl %ebp, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq 0x30(%rsp), %rcx
cmovel %r15d, %ecx
movq 0x38(%rsp), %rdx
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x11380
movl %ecx, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
movq 0x40(%rsp), %rax
addq 0x20(%rax), %r15
jmp 0x11383
xorl %r13d, %r13d
andl %esi, %r13d
movq 0x10(%rdi), %rdx
movl $0x1, %r15d
movl %r13d, %r12d
movl %esi, 0x2c(%rsp)
movq %rdx, 0x48(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %ebx
leal (%r12,%r12), %ebp
andl $0x1e, %ebp
movl %ebx, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x11338
testb $0x1, %al
jne 0x1131e
movq 0x18(%rdi), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x2150
movq 0x48(%rsp), %rdx
movl 0x2c(%rsp), %esi
movq 0x40(%rsp), %rdi
testl %eax, %eax
je 0x11338
addl %r15d, %r12d
andl %esi, %r12d
incl %r15d
cmpl %r13d, %r12d
jne 0x112db
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
jmp 0x1134d
movl %ebp, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq 0x30(%rsp), %rcx
cmovel %r12d, %ecx
movq 0x38(%rsp), %rdx
movq (%rdx), %rax
cmpl (%rax), %ecx
je 0x11380
movl %ecx, %eax
leaq (%rax,%rax,4), %r15
shlq $0x3, %r15
addq 0x20(%rdi), %r15
jmp 0x11383
movq %rdx, %rsi
callq 0x2751
jmp 0x11380
movq %rdx, %rdi
callq 0x26ff
jmp 0x11380
movq %rdx, %rdi
callq 0x26d6
xorl %r15d, %r15d
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq