// File: /workspace/github_c_makefile_star2_O1/pedro-onate[P]eva/eva.c
// Function: env_reserve_loc
static int env_reserve_loc(es_ctx_t* ctx, es_val_t env, es_val_t sym, es_val_t init)
{
  int loc = es_env_loc(env, sym);
  if (loc > -1) {
    if (es_is_unbound(es_env_val_of(env, loc))) {
      env_set_val(env, loc, init);
    }
    return loc;
  }

  int size  = es_env_size(env);
  size_t count = es_env_count(env);

  if (count >= size) {
    int new_size = (size << 1) + size;
    gc_root3(ctx, env, sym, init);

    es_val_t new_env = es_make_env(ctx, new_size);

    for(int i = 0; i < count; i++) {
      es_env_val(new_env)->slots[i].sym = es_env_val(env)->slots[i].sym;
      es_env_val(new_env)->slots[i].val = es_env_val(env)->slots[i].val;
      es_env_val(new_env)->count++;
    }

    gc_unroot(ctx, 3);

    ctx->env = new_env;
    env = new_env;
  }

  es_env_val(env)->slots[es_env_val(env)->count].sym = sym;
  es_env_val(env)->slots[es_env_val(env)->count].val = init;
  return es_env_val(env)->count++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq %rsi, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movslq 0x10(%rsi), %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r14, %r14
jle 0x30ce
leaq 0x20(%rsi), %r8
xorl %edi, %edi
cmpq %rdx, (%r8)
je 0x30cc
incq %rdi
addq $0x10, %r8
cmpq %rdi, %r14
jne 0x30b9
jmp 0x30ce
movl %edi, %eax
testl %eax, %eax
js 0x3109
addq $0x18, %rsi
movl %eax, %edx
shlq $0x4, %rdx
movq (%rsi,%rdx), %rdi
movl %edi, %r8d
andl $0x7, %r8d
cmpq $0x5, %r8
ja 0x3231
leaq 0x4188(%rip), %r9       # 0x7280
movslq (%r9,%r8,4), %r8
addq %r9, %r8
jmpq *%r8
movl (%rdi), %edi
jmp 0x3236
movl 0x14(%rsi), %eax
cmpl %eax, %r14d
jb 0x31d2
leal (%rax,%rax,2), %eax
movslq 0x2040(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movl %edx, 0x2040(%rbx)
leaq 0x8(%rsp), %rdx
movq %rdx, 0x40(%rbx,%rcx,8)
leaq 0x2(%rcx), %rdx
movl %edx, 0x2040(%rbx)
leaq 0x18(%rsp), %rdx
movq %rdx, 0x48(%rbx,%rcx,8)
leal 0x3(%rcx), %edx
movl %edx, 0x2040(%rbx)
leaq 0x10(%rsp), %rdx
movq %rdx, 0x50(%rbx,%rcx,8)
movslq %eax, %r15
movq %r15, %rdx
shlq $0x4, %rdx
addq $0x18, %rdx
movq %rbx, %rdi
movl $0xf, %esi
callq 0x2177
movl $0x0, 0x10(%rax)
movl %r15d, 0x14(%rax)
testl %r14d, %r14d
je 0x31bf
movl 0x10(%rax), %ecx
movl %r14d, %edx
shlq $0x4, %rdx
xorl %esi, %esi
movq 0x8(%rsp), %rdi
movq 0x20(%rdi,%rsi), %rdi
movq %rdi, 0x20(%rax,%rsi)
movq 0x8(%rsp), %rdi
movq 0x18(%rdi,%rsi), %rdi
movq %rdi, 0x18(%rax,%rsi)
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x3191
addl %ecx, %r14d
movl %r14d, 0x10(%rax)
addl $-0x3, 0x2040(%rbx)
movq %rax, 0x42080(%rbx)
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rsp), %rcx
movslq 0x10(%rcx), %rdx
shlq $0x4, %rdx
movq %rax, 0x20(%rcx,%rdx)
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movslq 0x10(%rcx), %rdx
shlq $0x4, %rdx
movq %rax, 0x18(%rcx,%rdx)
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %eax
leal 0x1(%rax), %edx
movl %edx, 0x10(%rcx)
jmp 0x3241
movl $0x1, %edi
jmp 0x3236
movl $0x3, %edi
jmp 0x3236
sarl $0x3, %edi
jmp 0x3236
movl $0x2, %edi
jmp 0x3236
movl $0x4, %edi
jmp 0x3236
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl $0x9, %edi
jne 0x3241
addq %rdx, %rsi
movq %rcx, (%rsi)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq