// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_init_encode_ud
static void prv_init_encode_ud(subtilis_arm_encode_ud_t *ud,
			       subtilis_arm_prog_t *arm_p,
			       subtilis_error_t *err)
{
	size_t i;
	subtilis_arm_section_t *arm_s;
	size_t max_label_offsets = 0;
	size_t constants = 0;
	size_t real_constants = 0;

	memset(ud, 0, sizeof(*ud));

	for (i = 0; i < arm_p->num_sections; i++) {
		arm_s = arm_p->sections[i];
		if (arm_s->label_counter > max_label_offsets)
			max_label_offsets = arm_s->label_counter;
		constants += arm_s->constants.ui32_count;
		real_constants += arm_s->constants.real_count;
	}

	/*
	 * This may not be enough memory if we need multiple constant pools.
	 */

	ud->label_offsets = malloc(sizeof(size_t) * max_label_offsets);
	if (!ud->label_offsets) {
		subtilis_error_set_oom(err);
		goto on_error;
	}
	ud->max_label_offsets = max_label_offsets;

	/*
	 * This may not be enough memory if we need multiple constant pools.
	 */

	ud->max_bytes = ((arm_p->op_pool->len + constants) * sizeof(uint32_t)) +
			(real_constants * 8);
	ud->code = malloc(ud->max_bytes);
	if (!ud->code) {
		subtilis_error_set_oom(err);
		goto on_error;
	}

	ud->link = subtilis_arm_link_new(arm_p->num_sections, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	ud->reverse_fpa_consts =
	    arm_p->fp_if && arm_p->fp_if->reverse_fpa_consts;

	return;

on_error:

	prv_free_encode_ud(ud);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x12110
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x7d96d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x30(%rbp), %rax
jbe 0x7d93f
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x60(%rax), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x78(%rax), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x7d904
movq -0x30(%rbp), %rdi
shlq $0x3, %rdi
callq 0x121b0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x7d9af
movq -0x18(%rbp), %rdi
movl $0x1, %esi
leaq 0x2f490(%rip), %rdx     # 0xace30
movl $0x8b, %ecx
callq 0x158e0
jmp 0x7da78
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rcx
addq -0x38(%rbp), %rcx
shlq $0x2, %rcx
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x121b0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x7da21
movq -0x18(%rbp), %rdi
movl $0x1, %esi
leaq 0x2f41b(%rip), %rdx     # 0xace30
movl $0x98, %ecx
callq 0x158e0
jmp 0x7da78
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x82740
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7da4b
jmp 0x7da78
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x40(%rcx)
movb %al, -0x41(%rbp)
je 0x7da69
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movb 0xc(%rax), %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %cl
movq -0x8(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x8(%rax)
jmp 0x7da81
movq -0x8(%rbp), %rdi
callq 0x7dd90
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)