// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/common/constant_pool.c
// Function: subtilis_constant_pool_add
size_t subtilis_constant_pool_add(subtilis_constant_pool_t *pool, uint8_t *data,
				  size_t data_size, bool dbl,
				  subtilis_error_t *err)
{
	size_t i;
	size_t new_max_size;
	subtilis_constant_data_t *new_data;

	for (i = 0; i < pool->size; i++) {
		if (dbl != pool->data[i].dbl)
			continue;
		if (data_size != pool->data[i].data_size)
			continue;
		if (!memcmp(data, pool->data[i].data, data_size)) {
			free(data);
			return i;
		}
	}

	if (pool->size == pool->max_size) {
		new_max_size = pool->size + SUBTILIS_CONFIG_CONSTANT_POOL_GRAN;
		new_data =
		    realloc(pool->data, sizeof(*new_data) * new_max_size);
		if (!new_data) {
			subtilis_error_set_oom(err);
			return SIZE_MAX;
		}
		pool->max_size = new_max_size;
		pool->data = new_data;
	}

	pool->data[pool->size].data = data;
	pool->data[pool->size].dbl = dbl;
	pool->data[pool->size++].data_size = data_size;

	return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x3d359
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x18, -0x38(%rbp), %rdx
addq %rdx, %rcx
movb 0x10(%rcx), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x3d2ef
jmp 0x3d348
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x18, -0x38(%rbp), %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
je 0x3d30a
jmp 0x3d348
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x18, -0x38(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x12120
cmpl $0x0, %eax
jne 0x3d346
movq -0x18(%rbp), %rdi
callq 0x12290
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3d438
jmp 0x3d348
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x3d2b7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x3d3d2
movq -0x10(%rbp), %rax
movq (%rax), %rax
addq $0x20, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
imulq $0x18, -0x40(%rbp), %rsi
callq 0x121e0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3d3ba
movq -0x30(%rbp), %rdi
movl $0x1, %esi
leaq 0x6df88(%rip), %rdx     # 0xab32e
movl $0x6d, %ecx
callq 0x158e0
movq $-0x1, -0x8(%rbp)
jmp 0x3d438
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdx
imulq $0x18, (%rdx), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movb -0x21(%rbp), %cl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdx
imulq $0x18, (%rdx), %rdx
addq %rdx, %rax
andb $0x1, %cl
movb %cl, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movq (%rsi), %rdx
movq %rdx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)