// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
leaq 0x38(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpl $0x5, (%rax)
jne 0x16049
movq -0xe8(%rbp), %rax
cmpl $0x2, (%rax)
je 0x15f7d
movq 0xb0a4(%rip), %rax      # 0x20ff8
movq (%rax), %rdi
leaq 0x6183(%rip), %rsi      # 0x1c0e1
movb $0x0, %al
callq 0x2140
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x1638b
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0x16019
movq -0xe8(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x8(%rcx), %eax
jne 0x16002
cmpl $0x0, -0x14(%rbp)
je 0x15ff5
movq -0x30(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movl $0x28, %edx
callq 0x2170
movq -0x38(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x58(%rbp), %xmm0
movups -0x48(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xffb0
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1638b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x15fa1
movq 0xafd8(%rip), %rax      # 0x20ff8
movq (%rax), %rdi
leaq 0x60d2(%rip), %rsi      # 0x1c0fc
movb $0x0, %al
callq 0x2140
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x1638b
movq -0xe0(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x161bc
movq -0xe8(%rbp), %rax
cmpl $0x4, (%rax)
je 0x16095
movq 0xaf8c(%rip), %rax      # 0x20ff8
movq (%rax), %rdi
leaq 0x609f(%rip), %rsi      # 0x1c115
movb $0x0, %al
callq 0x2140
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x1638b
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x16161
movq -0xe8(%rbp), %rax
movl $0x0, -0x64(%rbp)
movq -0x60(%rbp), %rdi
movq 0x8(%rax), %rax
movq (%rax), %rsi
callq 0x108e0
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
je 0x16128
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
movl -0x68(%rbp), %eax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0x90(%rbp), %rdi
movl $0x28, %edx
callq 0x2170
movq -0x70(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xffb0
movq -0xe8(%rbp), %rax
movq -0x60(%rbp), %rdi
movq 0x8(%rax), %rax
movq (%rax), %rsi
leaq -0x64(%rbp), %rdx
callq 0x10cd0
movl %eax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x68(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x1638b
movq -0xe8(%rbp), %rax
movq -0x60(%rbp), %rdi
movq 0x8(%rax), %rax
movq (%rax), %rsi
callq 0x108e0
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
je 0x161ad
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x94(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x1638b
jmp 0x161af
movq $0x0, -0x8(%rbp)
jmp 0x1638b
movq -0xe0(%rbp), %rax
cmpl $0xd, (%rax)
jne 0x1632a
movq -0xe0(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa0(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x162c9
movq -0xe8(%rbp), %rax
movl $0x0, -0xa4(%rbp)
movq -0xa0(%rbp), %rcx
movq (%rcx), %rdi
movq 0x8(%rax), %rax
movq (%rax), %rsi
callq 0x108e0
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
je 0x1627b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
movl -0xa8(%rbp), %eax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0xd0(%rbp), %rdi
movl $0x28, %edx
callq 0x2170
movq -0xb0(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0xd0(%rbp), %xmm0
movups -0xc0(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xffb0
movq -0xe8(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq (%rcx), %rdi
movq 0x8(%rax), %rax
movq (%rax), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x10cd0
movl %eax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movl -0xa8(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x1638b
movq -0xe8(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq (%rcx), %rdi
movq 0x8(%rax), %rax
movq (%rax), %rsi
callq 0x108e0
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
je 0x1631e
movq -0xa0(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movl -0xd4(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x1638b
jmp 0x16320
movq $0x0, -0x8(%rbp)
jmp 0x1638b
movq -0xe0(%rbp), %rcx
movq 0xacc0(%rip), %rax      # 0x20ff8
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq 0x20(%rcx), %rdx
movq %rsp, %rax
movq %rdx, 0x20(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x163a0
movq -0xf0(%rbp), %rdi
movq %rax, %rdx
leaq 0x5d21(%rip), %rsi      # 0x1c092
movb $0x0, %al
callq 0x2140
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)