// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: subtilis_arm_asm_parse
subtilis_arm_section_t *subtilis_arm_asm_parse(
	subtilis_lexer_t *l, subtilis_token_t *t, subtilis_arm_op_pool_t *pool,
	subtilis_type_section_t *stype, const subtilis_settings_t *set,
	subtilis_backend_sys_trans sys_trans, int32_t start_address,
	subtilis_error_t *err)
/* clang-format on */
{
	subtilis_arm_ass_context_t context;
	size_t pending_labels_num;
	const char *label_name;
	size_t *pending_labels = NULL;
	subtilis_arm_section_t *arm_s = NULL;
	subtilis_string_pool_t *label_pool = NULL;

	label_pool = subtilis_string_pool_new(err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	arm_s = subtilis_arm_section_new(pool, stype, 0, 0, 0, 0, set, NULL,
					 start_address, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	context.arm_s = arm_s;
	context.l = l;
	context.t = t;
	context.stype = stype;
	context.set = set;
	context.sys_trans = sys_trans;
	context.label_pool = label_pool;
	context.def_count = 0;
	context.max_defs = 0;
	context.defs = NULL;
	context.blocks = NULL;
	context.num_blocks = 0;
	context.max_blocks = 0;
	subtilis_bitset_init(&context.pending_labels);

	prv_parser_main_loop(&context, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	pending_labels = subtilis_bitset_values(&context.pending_labels,
						&pending_labels_num, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (pending_labels_num > 0) {
		if (pending_labels[0] > label_pool->length) {
			subtilis_error_set_assertion_failed(err);
			goto cleanup;
		}
		label_name = label_pool->strings[pending_labels[0]];
		subtilis_error_set_ass_unknown_label(err, label_name,
						     l->stream->name, l->line);
		goto cleanup;
	}

	prv_context_free(&context);

	return arm_s;

cleanup:
	free(pending_labels);
	prv_context_free(&context);
	subtilis_arm_section_delete(arm_s);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movq 0x18(%rbp), %rdi
callq 0x3d520
movq %rax, -0xe0(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x910a1
movq $0x0, -0x8(%rbp)
jmp 0x912c3
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %r11
movl 0x10(%rbp), %r10d
movq 0x18(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %r9d
movq %r9, %rdx
movq %r9, %rcx
movq %r9, %r8
movq %r11, (%rsp)
movq $0x0, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x6ff60
movq %rax, -0xd8(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x910fc
movq $0x0, -0x8(%rbp)
jmp 0x912c3
movq -0xd8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0xb8(%rbp), %rdi
addq $0x38, %rdi
callq 0x88790
movq 0x18(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x912d0
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x911ad
jmp 0x91297
leaq -0xb8(%rbp), %rdi
addq $0x38, %rdi
movq 0x18(%rbp), %rdx
leaq -0xc0(%rbp), %rsi
callq 0x890c0
movq %rax, -0xd0(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x911dd
jmp 0x91297
cmpq $0x0, -0xc0(%rbp)
jbe 0x9127e
movq -0xd0(%rbp), %rax
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jbe 0x9121e
movq 0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x1cf0e(%rip), %rdx     # 0xae120
movl $0x110a, %ecx           # imm = 0x110A
callq 0x158e0
jmp 0x91297
movq -0xe0(%rbp), %rax
movq (%rax), %rax
movq -0xd0(%rbp), %rcx
movq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc8(%rbp)
movq 0x18(%rbp), %rdi
movq -0xc8(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movl 0x38(%rax), %r9d
movl $0x60, %esi
leaq 0x1a012(%rip), %rcx     # 0xab276
leaq 0x1ceb5(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x110f, 0x8(%rsp)      # imm = 0x110F
callq 0x156d0
jmp 0x91297
leaq -0xb8(%rbp), %rdi
callq 0x914c0
movq -0xd8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x912c3
movq -0xd0(%rbp), %rdi
callq 0x12290
leaq -0xb8(%rbp), %rdi
callq 0x914c0
movq -0xd8(%rbp), %rdi
callq 0x70100
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq