LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/42Bastian[P]lyxass/jaguar.c
// Function: imm4_reg
int imm4_reg(int op)
{
  int32_t imm;
  int reg;
  int err;

  if ( !TestAtom('#') ) return Error(SYNTAX_ERR,"");

  if ( (err = Expression( &imm )) == EXPR_ERR ) return 1;

  if ( !TestAtom(',') ) return Error(SYNTAX_ERR,"");

  if ( GetRegister( &reg ) ) return 1;

  if ( err == EXPR_UNSOLVED ) saveCurrentLine();

  if ( (last_op == 52 || last_op == 53) && last_pc == (Global.pc-2) ){
    Warning("MOVEI after JR/JUMP is unpredictable!");
  }

  op = ( op << 10 ) | reg;

  writeOp( op );
  writeWordBig( imm & 0xffff);
  writeWordBig( imm >> 16 );

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
movl $0x23, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb306
leaq 0x8(%rsp), %rdi
callq 0x9e70
movl $0x1, %ebp
cmpl $0x11, %eax
je 0xb332
movl %eax, %r14d
movl $0x2c, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb31f
leaq 0xc(%rsp), %rdi
callq 0xac2c
testl %eax, %eax
jne 0xb332
cmpl $0x2, %r14d
jne 0xb294
xorl %eax, %eax
callq 0xa204
movl 0x8e86(%rip), %eax      # 0x14120
andl $-0x2, %eax
cmpl $0x34, %eax
jne 0xb2c2
leaq 0x9107(%rip), %rax      # 0x143b0
movl (%rax), %eax
addl $-0x2, %eax
cmpl %eax, 0x8e70(%rip)      # 0x14124
jne 0xb2c2
leaq 0x28a6(%rip), %rdi      # 0xdb63
callq 0xa900
shll $0xa, %ebx
orl 0xc(%rsp), %ebx
movl %ebx, %eax
shrl $0xa, %eax
andl $0x3f, %eax
movl %eax, 0x8e49(%rip)      # 0x14120
leaq 0x90d2(%rip), %rax      # 0x143b0
movl (%rax), %eax
movl %eax, 0x8e3e(%rip)      # 0x14124
movswl %bx, %edi
callq 0x35ae
movswl 0x8(%rsp), %edi
callq 0x35ae
movswl 0xa(%rsp), %edi
callq 0x35ae
xorl %ebp, %ebp
jmp 0xb332
leaq 0x1c85(%rip), %rsi      # 0xcf92
movl $0x12, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0xa2c8
leaq 0x1c6c(%rip), %rsi      # 0xcf92
movl $0x12, %edi
callq 0xa2c8
movl %eax, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/42Bastian[P]lyxass/jaguar.c
// Function: GetCondition
int GetCondition(int *cond)
{
  label_t condition;
  label_t *l;
  int32_t solved;
  int i;
  char *save_srcLinePtr = srcLinePtr-1;

  *cond = 0;
  if ( GetLabel(&condition) ) return 0;

  if ( condition.type != (UNSURE|NORMAL) ){
    srcLinePtr = save_srcLinePtr;
    atom = *srcLinePtr++;
    return 0;
  }

//->  printf("Cond:%s\n",condition.name);

  if ( atom != ',' || (l = FindLabel(&condition, &solved) ) != NULL ){
    srcLinePtr = save_srcLinePtr;
    atom = *srcLinePtr++;
    return 0;
  }

  if ( condition.len > 5 )  return Error(SYNTAX_ERR,"");

  for( i = 0 ; conditions[i].cond ; ++i ){
    if ( !strcasecmp(conditions[i].ascCond,condition.name) ){
      *cond = conditions[i].cond;
      return 0;
    }
  }

  *cond = 0;
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
leaq 0x11bcb(%rip), %r12     # 0x1cf20
movq (%r12), %r15
movl $0x0, (%rdi)
leaq 0x8(%rsp), %rdi
callq 0x53a9
xorl %ebx, %ebx
testl %eax, %eax
jne 0xb3b9
cmpl $0x21, 0xc(%rsp)
jne 0xb3a7
leaq 0x11bb3(%rip), %r13     # 0x1cf30
cmpl $0x2c, (%r13)
jne 0xb398
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x6140
testq %rax, %rax
je 0xb3ca
movq %r15, (%r12)
movsbl -0x1(%r15), %eax
movl %eax, (%r13)
jmp 0xb3b9
movq %r15, (%r12)
movsbl -0x1(%r15), %eax
leaq 0x11b79(%rip), %rcx     # 0x1cf30
movl %eax, (%rcx)
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x5, 0x8(%rsp)
jle 0xb3e6
leaq 0x1bba(%rip), %rsi      # 0xcf92
movl $0x12, %edi
callq 0xa2c8
movl %eax, %ebx
jmp 0xb3b9
movl 0x8d4c(%rip), %ebp      # 0x14138
testl %ebp, %ebp
je 0xb430
leaq 0x40(%rsp), %r15
leaq 0x8d34(%rip), %rdi      # 0x14130
movq %r15, %rsi
callq 0x3060
testl %eax, %eax
je 0xb42b
leaq 0x8d2d(%rip), %r12      # 0x1413c
movl 0x8(%r12), %ebp
testl %ebp, %ebp
je 0xb430
movq %r12, %rdi
movq %r15, %rsi
callq 0x3060
addq $0xc, %r12
testl %eax, %eax
jne 0xb40f
movl %ebp, (%r14)
jmp 0xb3b9
movl $0x0, (%r14)
movl $0x1, %ebx
jmp 0xb3b9
// File: /workspace/github_c_makefile_star2_O1/42Bastian[P]lyxass/jaguar.c
// Function: cond_rel
int cond_rel(int op )
{
  int cond;
  int32_t dest;
  int err;

  if ( GetCondition( & cond ) ) return 1;

  if ( cond && !TestAtom(',') ) return Error(SYNTAX_ERR,"");

  if ( (err = Expression(&dest)) == EXPR_ERR) return 1;

  op = ( op << 10 ) | cond;

  if ( (Global.pc < 0xf03000) && (Global.pc & 3) ){
    Warning("JR not long-aligned ! NOP inserted !");
    writeOp(0xe400); /* NOP */
  }

  if ( err == EXPR_UNSOLVED ){
    saveCurrentLine();
  } else {
    int32_t dist = (int32_t)dest - (Global.pc + 2);
    if ( dist < -32 || dist > 30 ) {
      return Error(DISTANCE_ERR,"");
    }
    dist >>= 1;
    op  |= (dist & 31) << 5;
  }

  writeOp( op );
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0xc(%rsp), %rdi
callq 0xb33d
movl $0x1, %ebp
testl %eax, %eax
je 0xb471
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0xc(%rsp), %r15d
testl %r15d, %r15d
je 0xb489
movl $0x2c, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb4f6
leaq 0x8(%rsp), %rdi
callq 0x9e70
cmpl $0x11, %eax
je 0xb462
movl %eax, %r14d
shll $0xa, %ebx
leaq 0x8f0b(%rip), %r12      # 0x143b0
movl (%r12), %eax
cmpl $0xf03000, %eax         # imm = 0xF03000
setae %cl
testb $0x3, %al
sete %al
orb %cl, %al
jne 0xb4e4
leaq 0x26c8(%rip), %rdi      # 0xdb89
callq 0xa900
movl $0x39, 0x8c50(%rip)     # 0x14120
movl (%r12), %eax
movl %eax, 0x8c4a(%rip)      # 0x14124
movl $0xffffe400, %edi       # imm = 0xFFFFE400
callq 0x35ae
orl %ebx, %r15d
cmpl $0x2, %r14d
jne 0xb513
xorl %eax, %eax
callq 0xa204
jmp 0xb550
leaq 0x1a95(%rip), %rsi      # 0xcf92
movl $0x12, %edi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa2c8
movl 0x8(%rsp), %eax
subl (%r12), %eax
leal 0x1e(%rax), %ebx
cmpl $0x3f, %ebx
jae 0xb534
addl $-0x2, %eax
andl $0x3e, %eax
shll $0x4, %eax
orl %r15d, %eax
movl %eax, %r15d
jmp 0xb547
leaq 0x1a57(%rip), %rsi      # 0xcf92
movl $0x16, %edi
callq 0xa2c8
movl %eax, %ebp
cmpl $0x3e, %ebx
ja 0xb462
movl %r15d, %eax
shrl $0xa, %eax
andl $0x3f, %eax
movl %eax, 0x8bc1(%rip)      # 0x14120
movl (%r12), %eax
movl %eax, 0x8bbb(%rip)      # 0x14124
movswl %r15w, %edi
callq 0x35ae
xorl %ebp, %ebp
jmp 0xb462
// File: /workspace/github_c_makefile_star2_O1/42Bastian[P]lyxass/jaguar.c
// Function: cond_abs
int cond_abs(int op )
{
  int cond;
  int reg;

  if ( GetCondition( &cond ) ) return 1;

  if ( cond && !TestAtom(',') ) return Error(SYNTAX_ERR,"");

  op = ( op << 10 ) | cond;

  if ( !TestAtom('(') ) return Error(SYNTAX_ERR,"");

  if ( GetRegister( &reg ) ) return 1;

  if ( !TestAtom(')') ) return Error(SYNTAX_ERR,"");

  op |= reg << 5;

  if ( (Global.pc < 0xf03000) && (Global.pc & 3) ){
    Warning("JUMP not long-aligned ! NOP inserted !");
    writeOp((short)0xe400);
  }

  writeOp( op );
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0xc(%rsp), %rdi
callq 0xb33d
movl $0x1, %ebp
testl %eax, %eax
je 0xb5a1
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl 0xc(%rsp), %r14d
testl %r14d, %r14d
je 0xb5bd
movl $0x2c, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb664
movl $0x28, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb664
leaq 0x8(%rsp), %rdi
callq 0xac2c
testl %eax, %eax
jne 0xb596
movl $0x29, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb664
shll $0xa, %ebx
movl 0x8(%rsp), %eax
shll $0x5, %eax
orl %r14d, %ebx
orl %eax, %ebx
leaq 0x8daf(%rip), %r14      # 0x143b0
movl (%r14), %eax
cmpl $0xf03000, %eax         # imm = 0xF03000
setae %cl
testb $0x3, %al
sete %al
orb %cl, %al
jne 0xb63e
leaq 0x2592(%rip), %rdi      # 0xdbae
callq 0xa900
movl $0x39, 0x8af5(%rip)     # 0x14120
movl (%r14), %eax
movl %eax, 0x8af0(%rip)      # 0x14124
movl $0xffffe400, %edi       # imm = 0xFFFFE400
callq 0x35ae
movl %ebx, %eax
shrl $0xa, %eax
andl $0x3f, %eax
movl %eax, 0x8ad4(%rip)      # 0x14120
movl (%r14), %eax
movl %eax, 0x8acf(%rip)      # 0x14124
movswl %bx, %edi
callq 0x35ae
xorl %ebp, %ebp
jmp 0xb596
leaq 0x1927(%rip), %rsi      # 0xcf92
movl $0x12, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0xa2c8
// File: /workspace/github_c_makefile_star2_O1/42Bastian[P]lyxass/jaguar.c
// Function: load2_reg
int load2_reg(int op )
{
  int reg1,reg2;

  if ( !TestAtom('(') ) return Error(SYNTAX_ERR,"");

  if ( GetRegister(&reg1) ) return 1;

  if ( !TestAtom(')') || !TestAtom(',') ) return Error(SYNTAX_ERR,"");

  if ( GetRegister( &reg2 ) ) return 1;

  op = ( op << 10 ) | ( reg1 << 5 ) | reg2;

  writeOp( op );

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x28, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb8f7
leaq 0x4(%rsp), %rdi
callq 0xac2c
movl $0x1, %ebp
testl %eax, %eax
je 0xb899
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0x29, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb8f7
movl $0x2c, %edi
callq 0x4fa3
testl %eax, %eax
je 0xb8f7
movq %rsp, %rdi
callq 0xac2c
testl %eax, %eax
jne 0xb890
shll $0xa, %ebx
movl 0x4(%rsp), %eax
shll $0x5, %eax
orl %ebx, %eax
orl (%rsp), %eax
movswl %ax, %edi
shrl $0xa, %eax
andl $0x3f, %eax
movl %eax, 0x8841(%rip)      # 0x14120
leaq 0x8aca(%rip), %rax      # 0x143b0
movl (%rax), %eax
movl %eax, 0x8836(%rip)      # 0x14124
callq 0x35ae
xorl %ebp, %ebp
jmp 0xb890
leaq 0x1694(%rip), %rsi      # 0xcf92
movl $0x12, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xa2c8
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_04/itoa.c
// Function: int_to_array
void int_to_array(int n, char s[])
{
  int i, sign;

  sign = n;

  i = 0;
  do
  {
    s[i++] = abs(n % 10) + '0';
  } while (n /= 10);

  if (sign < 0)
  {
    s[i++] = '-';
  }

  s[i] = '\0';

  int s_len = strlen(s);
  str_reverse(s, 0, s_len - 1);
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
xorl %eax, %eax
movl %edi, %ecx
movslq %ecx, %rdx
imulq $0x66666667, %rdx, %rcx # imm = 0x66666667
movq %rcx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rcx
addl %esi, %ecx
leal (%rcx,%rcx), %esi
leal (%rsi,%rsi,4), %esi
movl %edx, %r8d
subl %esi, %r8d
movl %r8d, %esi
negl %esi
cmovsl %r8d, %esi
addb $0x30, %sil
movb %sil, (%rbx,%rax)
incq %rax
addl $0x9, %edx
cmpl $0x12, %edx
ja 0x117f
testl %edi, %edi
jns 0x11cb
movl %eax, %ecx
incq %rax
movb $0x2d, (%rbx,%rcx)
cltq
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
callq 0x1040
leal -0x1(%rax), %edx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x11e7
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_aerospike.c
// Function: as_aerospike_new
as_aerospike * as_aerospike_new(void * s, const as_aerospike_hooks * h)
{
	as_aerospike * a = (as_aerospike *) cf_rc_alloc(sizeof(as_aerospike));
	a->is_rcalloc = true;
	a->source = s;
	a->hooks = h;
	return a;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x18, %edi
callq 0x87b0
movb $0x1, 0x10(%rax)
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_init
as_arraylist*
as_arraylist_init(as_arraylist* list, uint32_t capacity, uint32_t block_size)
{
	if (!list) return list;

	as_list_cons((as_list *) list, false, &as_arraylist_list_hooks);
	list->block_size = block_size;
	list->capacity = capacity;
	list->size = 0;
	if (list->capacity > 0) {
		list->free = true;
		list->elements = (as_val**) cf_calloc(capacity, sizeof(as_val*));
	}
	else {
		list->free = false;
		list->elements = NULL;
	}
	return list;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
je 0x8c90
movl %edx, %r14d
movl %esi, %ebp
movq 0x17360(%rip), %rdx     # 0x1ffb8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8aa0
movl %r14d, 0x18(%rbx)
movl %ebp, 0x1c(%rbx)
movl $0x0, 0x20(%rbx)
testl %ebp, %ebp
je 0x8c86
movb $0x1, 0x30(%rbx)
movl %ebp, %edi
movl $0x8, %esi
callq 0x88b0
jmp 0x8c8c
movb $0x0, 0x30(%rbx)
xorl %eax, %eax
movq %rax, 0x28(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_new
as_arraylist*
as_arraylist_new(uint32_t capacity, uint32_t block_size)
{
	as_arraylist* list = (as_arraylist*) cf_malloc(sizeof(as_arraylist));
	if (!list) return list;

	as_list_cons((as_list *) list, true, &as_arraylist_list_hooks);
	list->block_size = block_size;
	list->capacity = capacity;
	list->size = 0;
	if (list->capacity > 0) {
		list->free = true;
		list->elements = (as_val**) cf_calloc(capacity, sizeof(as_val*));
	}
	else {
		list->free = false;
		list->elements = NULL;
	}
	return list;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movl %edi, %ebp
movl $0x38, %edi
callq 0x8080
movq %rax, %rbx
testq %rax, %rax
je 0x8cf5
movq 0x172fe(%rip), %rdx     # 0x1ffb8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x8aa0
movl %r14d, 0x18(%rbx)
movl %ebp, 0x1c(%rbx)
movl $0x0, 0x20(%rbx)
testl %ebp, %ebp
je 0x8ceb
movb $0x1, 0x30(%rbx)
movl %ebp, %edi
movl $0x8, %esi
callq 0x88b0
jmp 0x8cf1
movb $0x0, 0x30(%rbx)
xorl %eax, %eax
movq %rax, 0x28(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_release
bool
as_arraylist_release(as_arraylist* list)
{
	if (list->elements) {
		for (uint32_t i = 0; i < list->size; i++) {
			if (list->elements[i]) {
				as_val_destroy(list->elements[i]);
			}
			list->elements[i] = NULL;
		}

		if (list->free) {
			cf_free(list->elements);
		}
	}
	
	list->elements = NULL;
	list->size = 0;
	list->capacity = 0;

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x28(%rdi)
je 0x8d4c
cmpl $0x0, 0x20(%rbx)
je 0x8d3d
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x8d26
callq 0x84b0
movq 0x28(%rbx), %rax
movq $0x0, (%rax,%r14,8)
incq %r14
movl 0x20(%rbx), %eax
cmpq %rax, %r14
jb 0x8d14
cmpb $0x0, 0x30(%rbx)
je 0x8d4c
movq 0x28(%rbx), %rdi
callq 0x8940
xorl %eax, %eax
movq %rax, 0x28(%rbx)
movq %rax, 0x1c(%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_set
int
as_arraylist_set(as_arraylist* list, uint32_t index, as_val* value)
{
	int rc = AS_ARRAYLIST_OK;

	if (index >= list->capacity) {
		rc = as_arraylist_ensure(list, (index + 1) - list->size);

		if (rc != AS_ARRAYLIST_OK) {
			return rc;
		}
	}

	// Make sure that, before we free (destroy) something, it is within the
	// legal bounds of the object.
	if (index < list->size) {
		as_val_destroy(list->elements[index]);
	}

	list->elements[index] = value ? value : (as_val*)&as_nil;

	if (index == list->size) {
		list->size++;
	}
	else if (index > list->size) {
		for (uint32_t i = list->size; i < index; i++) {
			list->elements[i] = (as_val*)&as_nil;
		}

		list->size = index + 1;
	}

	return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
cmpl %esi, 0x1c(%rdi)
ja 0x8e35
movl %ebp, %esi
subl 0x20(%rbx), %esi
incl %esi
movq %rbx, %rdi
callq 0x8e96
testl %eax, %eax
jne 0x8e8b
cmpl %ebp, 0x20(%rbx)
movl %ebp, %r15d
jbe 0x8e4a
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x84b0
testq %r14, %r14
jne 0x8e56
movq 0x1718a(%rip), %r14     # 0x1ffe0
movq 0x28(%rbx), %rax
movq %r14, (%rax,%r15,8)
movl 0x20(%rbx), %ecx
cmpl %ebp, %ecx
je 0x8e84
xorl %eax, %eax
cmpl %ebp, %ecx
jae 0x8e8b
movq 0x1716e(%rip), %rax     # 0x1ffe0
movq 0x28(%rbx), %rdx
movq %rax, (%rdx,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x8e72
movl %ebp, %ecx
incl %ecx
movl %ecx, 0x20(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_ensure
static int
as_arraylist_ensure(as_arraylist* list, uint32_t delta)
{
	// Check for capacity (in terms of elements, NOT size in bytes), and if we
	// need to allocate more, do a realloc.
	if ((list->size + delta) > list->capacity) {
		// by convention - we allocate more space ONLY when the unit of
		// (new) allocation is > 0.
		if (list->block_size == 0) {
			return AS_ARRAYLIST_ERR_MAX;
		}
		// Compute how much room we're missing for the new stuff
		int new_room = (list->size + delta) - list->capacity;
		// Compute new capacity in terms of multiples of block_size
		// This will get us (conservatively) at least one block
		int new_blocks = (new_room + list->block_size) / list->block_size;
		int new_capacity = list->capacity + (new_blocks * list->block_size);
		size_t new_bytes = sizeof(as_val*) * new_capacity;
		as_val** elements = (as_val**) cf_realloc(list->elements, new_bytes);
		if (! elements) {
			return AS_ARRAYLIST_ERR_ALLOC;
		}
		// Zero everything beyond the old pointers.
		size_t old_bytes = sizeof(as_val*) * list->capacity;
		memset((uint8_t *)elements + old_bytes, 0, new_bytes - old_bytes);
		// Set the new array pointer and capacity.
		list->elements = elements;
		list->capacity = new_capacity;
		list->free = true;
	}

	return AS_ARRAYLIST_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
addl 0x20(%rdi), %ebp
movl 0x1c(%rdi), %ecx
xorl %r14d, %r14d
subl %ecx, %ebp
jbe 0x8f14
movq %rdi, %rbx
movl 0x18(%rdi), %esi
testl %esi, %esi
je 0x8f06
addl %esi, %ebp
xorl %r14d, %r14d
movl %ebp, %eax
xorl %edx, %edx
divl %esi
subl %edx, %ebp
addl %ecx, %ebp
movslq %ebp, %r15
shlq $0x3, %r15
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x8510
testq %rax, %rax
je 0x8f0e
movq %rax, %r12
movl 0x1c(%rbx), %eax
leaq (%r12,%rax,8), %rdi
shlq $0x3, %rax
subq %rax, %r15
xorl %esi, %esi
movq %r15, %rdx
callq 0x8400
movq %r12, 0x28(%rbx)
movl %ebp, 0x1c(%rbx)
movb $0x1, 0x30(%rbx)
jmp 0x8f14
movl $0x2, %r14d
jmp 0x8f14
movl $0x1, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_insert
int
as_arraylist_insert(as_arraylist* list, uint32_t index, as_val* value)
{
	uint32_t delta = 1;

	if (index > list->size) {
		delta = index + 1 - list->size;
	}

	int rc = as_arraylist_ensure(list, delta);

	if (rc != AS_ARRAYLIST_OK) {
		return rc;
	}

	for (uint32_t i = list->size; i > index; i--) {
		list->elements[i] = list->elements[i - 1];
	}

	list->elements[index] = value ? value : (as_val*)&as_nil;

	if (index <= list->size) {
		list->size++;
	}
	else {
		for (uint32_t i = list->size; i < index; i++) {
			list->elements[i] = (as_val*)&as_nil;
		}

		list->size = index + 1;
	}

	return AS_ARRAYLIST_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %eax
subl 0x20(%rdi), %eax
leal 0x1(%rax), %eax
movl $0x1, %esi
cmoval %eax, %esi
callq 0x8e96
testl %eax, %eax
jne 0x900a
movl 0x20(%rbx), %ecx
cmpl %ebp, %ecx
movl %ebp, %eax
jbe 0x8fcf
movq 0x28(%rbx), %rdx
movq -0x8(%rdx,%rcx,8), %rsi
movq %rsi, (%rdx,%rcx,8)
decq %rcx
cmpq %rax, %rcx
ja 0x8fba
testq %r14, %r14
jne 0x8fdb
movq 0x17005(%rip), %r14     # 0x1ffe0
movq 0x28(%rbx), %rcx
movq %r14, (%rcx,%rax,8)
movl 0x20(%rbx), %ecx
cmpl %ebp, %ecx
jae 0x9003
movq 0x16fef(%rip), %rdx     # 0x1ffe0
movq 0x28(%rbx), %rsi
movq %rdx, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x8ff1
movl %ebp, %ecx
incl %ecx
movl %ecx, 0x20(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_remove
int
as_arraylist_remove(as_arraylist* list, uint32_t index)
{
	if (index >= list->size) {
		return AS_ARRAYLIST_ERR_INDEX;
	}

	if (list->elements[index]) {
		as_val_destroy(list->elements[index]);
	}

	for (uint32_t i = index + 1; i < list->size; i++) {
		list->elements[i - 1] = list->elements[i];
	}

	list->size--;
	list->elements[list->size] = NULL; // clean vacated pointer slot

	return AS_ARRAYLIST_OK;
}

// Assembly:
movl $0x3, %eax
cmpl %esi, 0x20(%rdi)
jbe 0x9195
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0x9151
callq 0x84b0
leal 0x1(%r14), %ecx
movl 0x20(%rbx), %eax
cmpl %eax, %ecx
jae 0x917b
movl %ecx, %ecx
movq 0x28(%rbx), %rax
movq (%rax,%rcx,8), %rdx
movl %r14d, %esi
movq %rdx, (%rax,%rsi,8)
incq %rcx
movl 0x20(%rbx), %eax
incl %r14d
cmpq %rax, %rcx
jb 0x915e
decl %eax
movl %eax, 0x20(%rbx)
movq 0x28(%rbx), %rcx
movq $0x0, (%rcx,%rax,8)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_concat
int
as_arraylist_concat(as_arraylist* list, const as_arraylist* list2)
{
	int rc = as_arraylist_ensure(list, list2->size);

	if (rc != AS_ARRAYLIST_OK) {
		return rc;
	}

	for (uint32_t i = 0; i < list2->size; i++) {
		if (list2->elements[i]) {
			as_val_reserve(list2->elements[i]);
		}

		list->elements[list->size++] = list2->elements[i];
	}

	return AS_ARRAYLIST_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x20(%rsi), %esi
callq 0x8e96
testl %eax, %eax
jne 0x91f0
cmpl $0x0, 0x20(%rbx)
je 0x91ee
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x91c8
callq 0x83b0
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x28(%r14), %rcx
movl 0x20(%r14), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x20(%r14)
movq %rax, (%rcx,%rdx,8)
incq %r15
movl 0x20(%rbx), %eax
cmpq %rax, %r15
jb 0x91b6
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_trim
int
as_arraylist_trim(as_arraylist* list, uint32_t index)
{
	if (index >= list->size) {
		return AS_ARRAYLIST_ERR_INDEX;
	}

	for (uint32_t i = index; i < list->size; i++) {
		if (list->elements[i]) {
			as_val_destroy(list->elements[i]);
			list->elements[i] = NULL;
		}
	}

	list->size = index;

	return AS_ARRAYLIST_OK;
}

// Assembly:
movl $0x3, %eax
cmpl %esi, 0x20(%rdi)
jbe 0x9247
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
cmpl %esi, 0x20(%rdi)
jbe 0x923c
movl %ebx, %r15d
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x9230
callq 0x84b0
movq 0x28(%r14), %rax
movq $0x0, (%rax,%r15,8)
incq %r15
movl 0x20(%r14), %eax
cmpq %rax, %r15
jb 0x9212
movl %ebx, 0x20(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_tail
as_arraylist*
as_arraylist_tail(const as_arraylist* list)
{
	if (list->size == 0) return NULL;

	as_arraylist* list2 = as_arraylist_new(list->size-1, list->block_size);

	for(uint32_t i = 1, j = 0; i < list->size; i++, j++) {
		if (list->elements[i]) {
			as_val_reserve(list->elements[i]);
			list2->elements[j] = list2->elements[i];
		}
		else {
			list2->elements[j] = 0;
		}
	}

	return list2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rdi), %edi
testl %edi, %edi
je 0x92ac
decl %edi
movl 0x18(%rbx), %esi
callq 0x8520
movq %rax, %r14
cmpl $0x2, 0x20(%rbx)
jb 0x92af
movl $0x1, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x9294
callq 0x83b0
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rcx
jmp 0x929a
movq 0x28(%r14), %rax
xorl %ecx, %ecx
movq %rcx, -0x8(%rax,%r15,8)
incq %r15
movl 0x20(%rbx), %eax
cmpq %rax, %r15
jb 0x9278
jmp 0x92af
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_drop
as_arraylist*
as_arraylist_drop(const as_arraylist* list, uint32_t n)
{
	uint32_t		sz		= list->size;
	uint32_t		c		= n < sz ? n : sz;
	as_arraylist*	list2	= as_arraylist_new(sz-c, list->block_size);
	
	list2->size = sz-c;
	for(uint32_t i = c, j = 0; j < list2->size; i++, j++) {
		if (list->elements[i]) {
			as_val_reserve(list->elements[i]);
			list2->elements[j] = list->elements[i];
		}
		else {
			list2->elements[j] = 0;
		}
	}

	return list2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl 0x18(%rdi), %esi
movl 0x20(%rdi), %r12d
xorl %eax, %eax
movl %r12d, %r15d
subl %ebp, %r15d
cmovbl %eax, %r15d
movl %r15d, %edi
callq 0x8520
movq %rax, %r14
cmpl %ebp, %r12d
movl %r15d, 0x20(%rax)
jbe 0x9332
movl %ebp, %r15d
cmpq %r15, %r12
cmovbq %r12, %r15
xorl %r12d, %r12d
leal (%r15,%r12), %r13d
movq 0x28(%rbx), %rax
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x931c
callq 0x83b0
movq 0x28(%rbx), %rax
movq (%rax,%r13,8), %rax
jmp 0x931e
xorl %eax, %eax
movq 0x28(%r14), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
movl 0x20(%r14), %eax
cmpq %rax, %r12
jb 0x92fc
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_take
as_arraylist*
as_arraylist_take(const as_arraylist* list, uint32_t n)
{
	uint32_t		sz		= list->size;
	uint32_t		c		= n < sz ? n : sz;
	as_arraylist*	list2	= as_arraylist_new(c, list->block_size);

	list2->size = c;
	for(uint32_t i = 0; i < c; i++) {
		if (list->elements[i]) {
			as_val_reserve(list->elements[i]);
			list2->elements[i] = list->elements[i];
		}
		else {
			list2->elements[i] = 0;
		}
	}

	return list2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl 0x18(%rdi), %esi
movl 0x20(%rdi), %eax
cmpl %ebp, %eax
cmovbl %eax, %ebp
movl %ebp, %edi
callq 0x8520
movq %rax, %r14
movl %ebp, 0x20(%rax)
testl %ebp, %ebp
je 0x93a1
movl %ebp, %r15d
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x938f
callq 0x83b0
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rax
jmp 0x9391
xorl %eax, %eax
movq 0x28(%r14), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x9373
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist.c
// Function: as_arraylist_foreach
bool
as_arraylist_foreach(const as_arraylist* list, as_list_foreach_callback callback, void* udata)
{
	for(uint32_t i = 0; i < list->size; i++) {
		if (! callback(list->elements[i], udata)) {
			return false;
		}
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpl $0x0, 0x20(%rdi)
sete %bpl
je 0x9401
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x28(%rdi), %rax
movq (%rax), %rdi
movq %rdx, %rsi
callq *%r14
testb %al, %al
je 0x9401
movl $0x1, %r12d
movl 0x20(%r15), %eax
cmpq %rax, %r12
setae %bpl
jae 0x9401
movq 0x28(%r15), %rax
movq (%rax,%r12,8), %rdi
movq %rbx, %rsi
callq *%r14
incq %r12
testb %al, %al
jne 0x93df
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist_iterator.c
// Function: as_arraylist_iterator_init
as_arraylist_iterator * as_arraylist_iterator_init(as_arraylist_iterator * iterator, const as_arraylist * list)
{
	if ( !iterator ) return iterator;

	as_iterator_init((as_iterator *) iterator, false, NULL, &as_arraylist_iterator_hooks);
	iterator->list = list;
	iterator->pos = 0;
	return iterator;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x94e9
movq %rsi, %r14
movq 0x16af6(%rip), %rcx     # 0x1ffc8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8950
movq %r14, 0x18(%rbx)
movl $0x0, 0x20(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_arraylist_iterator.c
// Function: as_arraylist_iterator_new
as_arraylist_iterator * as_arraylist_iterator_new(const as_arraylist * list)
{
	as_arraylist_iterator * iterator = (as_arraylist_iterator *) cf_malloc(sizeof(as_arraylist_iterator));
	if ( !iterator ) return iterator;

	as_iterator_init((as_iterator *) iterator, true, NULL, &as_arraylist_iterator_hooks);
	iterator->list = list;
	iterator->pos = 0;
	return iterator;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x28, %edi
callq 0x8080
movq %rax, %r14
testq %rax, %rax
je 0x952f
movq 0x16ab4(%rip), %rcx     # 0x1ffc8
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x8950
movq %rbx, 0x18(%r14)
movl $0x0, 0x20(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_boolean.c
// Function: as_boolean_val_tostring
char * as_boolean_val_tostring(const as_val * v)
{
	if ( as_val_type(v) != AS_BOOLEAN ) return NULL;

	as_boolean * b = (as_boolean *) v;
	char * str = (char *) cf_malloc(sizeof(char) * 6);
    if (!str) return str;
	memset(str, 0, 6);
	if ( b->value ) {
		strcpy(str,"true");
	}
	else {
		strcpy(str,"false");
	}
	return str;

}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x9640
movq %rdi, %rbx
cmpb $0x2, 0x4(%rdi)
jne 0x9640
movl $0x6, %edi
callq 0x8080
testq %rax, %rax
je 0x9642
movw $0x0, 0x4(%rax)
movl $0x0, (%rax)
cmpb $0x1, 0x8(%rbx)
jne 0x9644
movb $0x0, 0x4(%rax)
movl $0x65757274, (%rax)     # imm = 0x65757274
jmp 0x9642
xorl %eax, %eax
popq %rbx
retq
movw $0x65, 0x4(%rax)
movl $0x736c6166, (%rax)     # imm = 0x736C6166
jmp 0x9642
nop
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer.c
// Function: as_buffer_destroy
void as_buffer_destroy(as_buffer * b) {
	if ( b->data ) { 
		cf_free(b->data);
		b->data = 0; 
	}
    return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x967a
callq 0x8940
movq $0x0, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer_pool.c
// Function: as_buffer_pool_init
int
as_buffer_pool_init(as_buffer_pool* pool, uint32_t header_size, uint32_t buffer_size)
{
	// Initialize empty queue.
	pool->queue = cf_queue_create(sizeof(void*), true);
	pool->header_size = header_size;
	pool->buffer_size = buffer_size;
	return (pool->queue)? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl $0x8, %edi
movl $0x1, %esi
callq 0x8780
movq %rax, (%r14)
movl %ebp, 0x8(%r14)
movl %ebx, 0xc(%r14)
xorl %ecx, %ecx
cmpq $0x1, %rax
sbbl %ecx, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer_pool.c
// Function: as_buffer_pool_pop
int
as_buffer_pool_pop(as_buffer_pool* pool, uint32_t size, as_buffer_result* buffer)
{
	size += pool->header_size;
	
	if (size > pool->buffer_size) {
		// Requested size is greater than fixed buffer size.
		// Allocate new buffer, but don't put back into pool.
		buffer->data = cf_malloc(size);
		
		if (! buffer->data) {
			return -1;
		}
		
		buffer->capacity = size - pool->header_size;
		return 2;
	}
	
	// Pop existing buffer from queue.
	int rc = cf_queue_pop(pool->queue, &buffer->data, CF_QUEUE_NOWAIT);
	
	if (rc == CF_QUEUE_OK) {
		buffer->capacity = pool->buffer_size - pool->header_size;
		return 0;
	}
	
	if (rc == CF_QUEUE_EMPTY) {
		// Queue is empty.  Create new buffer.  Queue can grow indefinitely.
		buffer->data = cf_malloc(pool->buffer_size);
		
		if (! buffer->data) {
			return -1;
		}
		
		buffer->capacity = pool->buffer_size - pool->header_size;
		return 1;
	}
	// Queue failure.
	return -2;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
addl 0x8(%rdi), %ebp
cmpl 0xc(%rdi), %ebp
jbe 0x96dd
movl %ebp, %edi
callq 0x8080
movq %rax, %rcx
movq %rax, (%rbx)
movl $0x2, %eax
testq %rcx, %rcx
jne 0x9720
jmp 0x9713
movq (%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x87c0
movl %eax, %ecx
testl %eax, %eax
je 0x971a
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl $-0x2, %ecx
jne 0x9727
movl 0xc(%r14), %edi
callq 0x8080
movq %rax, %rcx
movq %rax, (%rbx)
movl $0x1, %eax
testq %rcx, %rcx
jne 0x971c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x9727
movl %ecx, %eax
movl 0xc(%r14), %ebp
subl 0x8(%r14), %ebp
movl %ebp, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer_pool.c
// Function: as_buffer_pool_push
int
as_buffer_pool_push(as_buffer_pool* pool, void* buffer, uint32_t capacity)
{
	if (capacity + pool->header_size <= pool->buffer_size) {
		// Put buffer back into pool.
		if (cf_queue_push(pool->queue, &buffer) == CF_QUEUE_OK) {
			return 0;
		}
		else {
			cf_free(buffer);
			return -1;
		}
	}
	else {
		// Do not put large buffers back into pool.
		cf_free(buffer);
		return -2;
	}
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, 0x8(%rsp)
addl 0x8(%rdi), %edx
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
cmpl 0xc(%rdi), %edx
ja 0x975e
movq (%rdi), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8270
testl %eax, %eax
je 0x976e
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
callq 0x8940
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
xorl %ebx, %ebx
jmp 0x9766
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer_pool.c
// Function: as_buffer_pool_push_limit
int
as_buffer_pool_push_limit(as_buffer_pool* pool, void* buffer, uint32_t capacity, uint32_t max_buffers)
{
	if (capacity + pool->header_size <= pool->buffer_size) {
		// Put buffer back into pool up to a limit.
		if (cf_queue_push_limit(pool->queue, &buffer, max_buffers)) {
			// Success.
			return 0;
		}
		else {
			cf_free(buffer);
			return -1;
		}
	}
	else {
		// Do not put large buffers back into pool.
		cf_free(buffer);
		return -2;
	}
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, 0x8(%rsp)
addl 0x8(%rdi), %edx
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
cmpl 0xc(%rdi), %edx
ja 0x97a8
movq (%rdi), %rdi
leaq 0x8(%rsp), %rsi
movl %ecx, %edx
callq 0x8980
xorl %ebx, %ebx
testb %al, %al
jne 0x97b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
callq 0x8940
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer_pool.c
// Function: as_buffer_pool_drop_buffers
int
as_buffer_pool_drop_buffers(as_buffer_pool* pool, int buffer_count)
{
	// Number of buffers in pool may grow too large if burst of concurrent buffer usage happens.
	// Delete buffer_count buffers from pool.
	void* buffer;
	int count = 0;
	
	while (count < buffer_count) {
		if (cf_queue_pop(pool->queue, &buffer, CF_QUEUE_NOWAIT) == CF_QUEUE_OK) {
			cf_free(buffer);
			count++;
		}
		else {
			break;
		}
	}
	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testl %esi, %esi
jle 0x97f1
movl %esi, %ebp
movq %rdi, %r14
xorl %ebx, %ebx
movq %rsp, %r15
movq (%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x87c0
testl %eax, %eax
jne 0x97f3
movq (%rsp), %rdi
callq 0x8940
incl %ebx
cmpl %ebx, %ebp
jne 0x97cd
movl %ebp, %ebx
jmp 0x97f3
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_buffer_pool.c
// Function: as_buffer_pool_destroy
void
as_buffer_pool_destroy(as_buffer_pool* pool)
{
	// Empty and destroy queue.
	void* buffer;
	while (cf_queue_pop(pool->queue, &buffer, CF_QUEUE_NOWAIT) == CF_QUEUE_OK) {
		cf_free(buffer);
	}
	cf_queue_destroy(pool->queue);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
movq %rsp, %rsi
xorl %edx, %edx
callq 0x87c0
testl %eax, %eax
jne 0x9835
movq %rsp, %r14
movq (%rsp), %rdi
callq 0x8940
movq (%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x87c0
testl %eax, %eax
je 0x981b
movq (%rbx), %rdi
callq 0x8370
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_get_var_int
uint32_t as_bytes_get_var_int(const as_bytes * bytes, uint32_t index, uint32_t * value)
{
	uint8_t* begin = bytes->value + index;
	uint8_t* p = begin;
	uint32_t val = 0;
	uint32_t shift = 0;
	uint8_t b;
	
	do {
		b = *p++;
		val |= (b & 0x7F) << shift;
		shift += 7;
	} while ((b & 0x80));
	
	*value = val;
	return (uint32_t)(p - begin);
}

// Assembly:
movl %esi, %esi
addq 0x10(%rdi), %rsi
xorl %eax, %eax
xorl %edi, %edi
xorl %ecx, %ecx
movzbl (%rsi,%rax), %r8d
movl %r8d, %r9d
andl $0x7f, %r9d
shll %cl, %r9d
orl %r9d, %edi
addl $0x7, %ecx
incq %rax
testb %r8b, %r8b
js 0x9994
movl %edi, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_set
bool as_bytes_set(as_bytes * bytes, uint32_t index, const uint8_t * value, uint32_t size)
{
    if ( index + size > bytes->capacity ) return false;
    memcpy(&bytes->value[index], value, size);
    if ( index + size > bytes->size ) {
    	bytes->size = index + size;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
leal (%rcx,%rsi), %ebp
movl 0x8(%rdi), %r14d
cmpl %r14d, %ebp
ja 0x99e2
movq %rdi, %rbx
movl %esi, %edi
addq 0x10(%rbx), %rdi
movl %ecx, %eax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x85c0
cmpl 0xc(%rbx), %ebp
jbe 0x99e2
movl %ebp, 0xc(%rbx)
cmpl %r14d, %ebp
setbe %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_set_var_int
uint32_t as_bytes_set_var_int(const as_bytes * bytes, uint32_t index, uint32_t value)
{
	uint8_t* begin = bytes->value + index;
	uint8_t* end = bytes->value + bytes->capacity;
	uint8_t* p = begin;
	
	while (p < end && value >= 0x80) {
		*p++ = (uint8_t)(value | 0x80);
		value >>= 7;
	}
	
	if (p < end) {
		*p++ = (uint8_t)value;
		return (uint32_t)(p - begin);
	}
	return 0;
}

// Assembly:
movq 0x10(%rdi), %rax
movl %esi, %ecx
addq %rax, %rcx
movl 0x8(%rdi), %edi
cmpl %esi, %edi
seta %r8b
setbe %sil
cmpl $0x80, %edx
setb %r9b
orb %sil, %r9b
jne 0x9a3f
addq %rdi, %rax
movq %rcx, %rsi
movl %edx, %edi
movl %edx, %r8d
orb $-0x80, %r8b
movb %r8b, (%rsi)
incq %rsi
shrl $0x7, %edi
cmpq %rax, %rsi
setb %r8b
jae 0x9a44
cmpl $0x3fff, %edx           # imm = 0x3FFF
movl %edi, %edx
ja 0x9a1a
jmp 0x9a44
movl %edx, %edi
movq %rcx, %rsi
xorl %eax, %eax
testb %r8b, %r8b
je 0x9a54
movb %dil, (%rsi)
subl %ecx, %esi
incl %esi
movl %esi, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_ensure
bool as_bytes_ensure(as_bytes * bytes, uint32_t capacity, bool resize)
{
	if ( capacity <= bytes->capacity ) return true;
	if ( !resize ) return false;

	uint8_t * buffer = NULL;

	if ( bytes->free ) {
		// this is a previously cf_malloc'd value
		buffer = cf_realloc(bytes->value, capacity);
		if ( !buffer ) {
			// allocation failed, so return false.
			return false;
		}
	}
	else {
		// this is a previously stack alloc'd value
		buffer = cf_malloc(capacity);
		if ( !buffer ) {
			// allocation failed, so return false.
			return false;
		}
		// copy the bytes
		memcpy(buffer, bytes->value, bytes->size);
	}

	bytes->free = true;
	bytes->value = buffer;
	bytes->capacity = capacity;

	return true;
}

// Assembly:
cmpl %esi, 0x8(%rdi)
setae %al
xorb $0x1, %dl
orb %al, %dl
jne 0x9b06
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
cmpb $0x1, 0x18(%rdi)
jne 0x9acf
movq 0x10(%r14), %rdi
movl %ebx, %esi
callq 0x8510
movq %rax, %r15
testq %rax, %rax
jne 0x9aee
jmp 0x9aff
movl %ebx, %edi
callq 0x8080
testq %rax, %rax
je 0x9aff
movq %rax, %r15
movq 0x10(%r14), %rsi
movl 0xc(%r14), %edx
movq %rax, %rdi
callq 0x85c0
movb $0x1, 0x18(%r14)
movq %r15, 0x10(%r14)
movl %ebx, 0x8(%r14)
movb $0x1, %al
jmp 0x9b01
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_val_hashcode
uint32_t as_bytes_val_hashcode(const as_val * v)
{
    as_bytes * bytes = as_bytes_fromval(v);
    if ( bytes == NULL || bytes->value == NULL ) return 0;
    uint32_t hash = 0;
    uint8_t * buf = bytes->value;
    int len = bytes->size;
    while ( len-- ) {
        int b = *buf++;
        hash = b + (hash << 6) + (hash << 16) - hash;
    }
    return hash;
}

// Assembly:
xorl %eax, %eax
xorl %edx, %edx
testq %rdi, %rdi
je 0x9b40
cmpb $0x9, 0x4(%rdi)
cmoveq %rdi, %rdx
testq %rdx, %rdx
je 0x9b69
movq 0x10(%rdx), %rcx
testq %rcx, %rcx
je 0x9b69
movl 0xc(%rdx), %edx
testl %edx, %edx
je 0x9b69
xorl %eax, %eax
movzbl (%rcx), %esi
incq %rcx
imull $0x1003f, %eax, %eax    # imm = 0x1003F
addl %esi, %eax
decl %edx
jne 0x9b57
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_val_tostring
char * as_bytes_val_tostring(const as_val * v)
{
    as_bytes * bytes = as_bytes_fromval(v);
    if ( !bytes || !bytes->value || !bytes->size ) {
    	return NULL;
    }

    uint8_t * 	s = bytes->value;
    uint32_t 	sl = bytes->size;
    size_t		st = (4 * sl) + 3;
    char * 		str = (char *) cf_malloc(st);

    if ( !str ) {
    	return NULL;
    }
    
    int j=0;
    for ( uint32_t i=0; i < sl; i++ ) {
        str[j] = as_hex_chars[(s[i] >> 4) & 0xf];
        str[j+1] = as_hex_chars[s[i] & 0xf];
        str[j+2] = ' ';
        j += 3;
    }
    j--; // chomp
    
    str[j] = 0;
    
    return str;
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x9b79
cmpb $0x9, 0x4(%rdi)
cmoveq %rdi, %rax
testq %rax, %rax
je 0x9bf4
pushq %r14
pushq %rbx
pushq %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x9bea
movl 0xc(%rax), %r14d
testq %r14, %r14
je 0x9bea
leal 0x3(,%r14,4), %edi
callq 0x8080
testq %rax, %rax
je 0x9bea
leaq (%r14,%r14,2), %rdx
xorl %ecx, %ecx
movq 0x1641d(%rip), %rsi     # 0x1ffd0
movzbl (%rbx), %edi
shrl $0x4, %edi
movb (%rsi,%rdi), %dil
movb %dil, (%rax,%rcx)
movzbl (%rbx), %edi
andl $0xf, %edi
movb (%rsi,%rdi), %dil
movb %dil, 0x1(%rax,%rcx)
movb $0x20, 0x2(%rax,%rcx)
addq $0x3, %rcx
incq %rbx
cmpq %rcx, %rdx
jne 0x9bb3
movl %ecx, %ecx
movb $0x0, -0x1(%rax,%rcx)
jmp 0x9bec
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_to_string
bool
as_bytes_to_string(const uint8_t* bytes, uint32_t bytes_size, char* str, uint32_t str_size)
{
	// Ensure hex string has enough space including null terminator.
	if ((bytes_size * 2 + 1) > str_size) {
		if (str_size > 0) {
			*str = 0;
		}
		return false;
	}

	while (bytes_size > 0) {
		uint8_t b = *bytes++;
		*str++ = as_hex_chars[(b >> 4) & 0xf];
		*str++ = as_hex_chars[b & 0xf];
		bytes_size--;
	}
	*str = 0;
	return true;
}

// Assembly:
leal (%rsi,%rsi), %eax
cmpl %ecx, %eax
jae 0x9c34
testl %esi, %esi
je 0x9c38
movq 0x163c7(%rip), %r8      # 0x1ffd0
movzbl (%rdi), %r9d
incq %rdi
movl %r9d, %r10d
shrl $0x4, %r10d
movb (%r8,%r10), %r10b
movb %r10b, (%rdx)
andl $0xf, %r9d
movb (%r8,%r9), %r9b
movb %r9b, 0x1(%rdx)
addq $0x2, %rdx
decl %esi
jne 0x9c09
jmp 0x9c38
testl %ecx, %ecx
je 0x9c3b
movb $0x0, (%rdx)
cmpl %ecx, %eax
setb %al
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_to_string_with_prefix
bool
as_bytes_to_string_with_prefix(
	const uint8_t* bytes, uint32_t bytes_size, char* str, uint32_t str_size
	)
{
	if (as_bytes_to_string(bytes, bytes_size, str + 2, str_size - 2)) {
		*str++ = '0';
		*str = 'x';
		return true;
	}

	if (str_size > 0) {
		*str = 0;
	}
	return false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdx, %rbx
addq $0x2, %rdx
leal -0x2(%r14), %ecx
callq 0x80d0
testb %al, %al
je 0x9c63
movw $0x7830, (%rbx)         # imm = 0x7830
jmp 0x9c6b
testl %r14d, %r14d
je 0x9c6b
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_bytes.c
// Function: as_bytes_from_string
int
as_bytes_from_string(uint8_t* bytes, uint32_t bytes_size, const char* str)
{
	// Skip prefix if it exists.
	if (*str == '0' && *(str+1) == 'x') {
		str += 2;
	}

	int len = (int)strlen(str);
	int count = len / 2;
	int rem = len - (count * 2);

	// Hex string length must be even (2 chars per byte).
	if (rem != 0) {
		return -1;
	}

	// Byte array must have enough space.
	if ((uint32_t)count > bytes_size) {
		return -1;
	}

	uint8_t hb; // high byte
	uint8_t lb; // low byte

	while (*str) {
		hb = hex_char_to_byte(*str++);

		if (hb == 0xff) {
			return -1;
		}

		lb = hex_char_to_byte(*str++);

		if (lb == 0xff) {
			return -1;
		}
		*bytes++ = (hb << 4) + lb;
	}
	return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
cmpb $0x30, (%rdx)
jne 0x9c91
xorl %eax, %eax
cmpb $0x78, 0x1(%rbx)
sete %al
leaq (%rbx,%rax,2), %rbx
movq %rbx, %rdi
callq 0x8260
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
movl %edx, %ecx
sarl %ecx
andl $-0x2, %edx
cmpl %eax, %edx
setne %al
cmpl %ebp, %ecx
seta %dl
orb %al, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x9d61
movb (%rbx), %r8b
testb %r8b, %r8b
je 0x9d5f
xorl %edx, %edx
movl $0xff, %esi
leal -0x30(%r8), %edi
cmpb $0xa, %dil
jb 0x9d01
leal -0x41(%r8), %edi
cmpb $0x5, %dil
ja 0x9cee
addb $-0x37, %r8b
movl %r8d, %edi
jmp 0x9d01
leal -0x61(%r8), %edi
addb $-0x57, %r8b
cmpb $0x6, %dil
movzbl %r8b, %edi
cmovael %esi, %edi
cmpb $-0x1, %dil
je 0x9d61
movb 0x1(%rbx,%rdx,2), %r8b
leal -0x30(%r8), %r9d
cmpb $0xa, %r9b
jb 0x9d3d
leal -0x41(%r8), %r9d
cmpb $0x5, %r9b
ja 0x9d29
addb $-0x37, %r8b
movl %r8d, %r9d
jmp 0x9d3d
leal -0x61(%r8), %r9d
addb $-0x57, %r8b
cmpb $0x6, %r9b
movzbl %r8b, %r9d
cmovael %esi, %r9d
cmpb $-0x1, %r9b
je 0x9d61
shlb $0x4, %dil
addb %dil, %r9b
movb %r9b, (%r14,%rdx)
movb 0x2(%rbx,%rdx,2), %r8b
incq %rdx
testb %r8b, %r8b
jne 0x9cd1
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_double.c
// Function: as_double_val_hashcode
uint32_t
as_double_val_hashcode(const as_val* val)
{
	as_double* value_ptr = as_double_fromval(val);
	
	if (!value_ptr) {
		return 0;
	}
	
	uint64_t v = *(uint64_t*)&value_ptr->value;
	return (uint32_t)(v ^ (v >> 32));
}

// Assembly:
xorl %eax, %eax
xorl %ecx, %ecx
testq %rdi, %rdi
je 0x9ddd
cmpb $0xa, 0x4(%rdi)
cmoveq %rdi, %rcx
testq %rcx, %rcx
je 0x9def
movq 0x8(%rcx), %rcx
movq %rcx, %rax
shrq $0x20, %rax
xorl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_geojson.c
// Function: as_geojson_len
size_t as_geojson_len(as_geojson * string)
{
	if (string->value == NULL) {
		return 0;
	}
	if (string->len == SIZE_MAX) {
		string->len = strlen(string->value);
	}
	return string->len;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x9f37
cmpq $-0x1, 0x18(%rbx)
jne 0x9f31
callq 0x8260
movq %rax, 0x18(%rbx)
movq 0x18(%rbx), %rax
jmp 0x9f39
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_geojson.c
// Function: as_geojson_val_destroy
void as_geojson_val_destroy(as_val * v)
{
	as_geojson * string = as_geojson_fromval(v);
	if ( !string ) return;

	if ( string->value && string->free ) {
		cf_free(string->value);
	}
	
	string->value = NULL;
	string->free = false;
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x9f4b
cmpb $0xb, 0x4(%rdi)
cmoveq %rdi, %rbx
testq %rbx, %rbx
je 0x9f70
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x9f64
cmpb $0x1, 0x8(%rbx)
jne 0x9f64
callq 0x8940
movq $0x0, 0x10(%rbx)
movb $0x0, 0x8(%rbx)
popq %rbx
retq