// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: prv_stran_misc_pre
static void prv_stran_misc_pre(subtilis_arm_ass_context_t *c,
			       subtilis_arm_instr_type_t itype,
			       subtilis_arm_ccode_type_t ccode,
			       subtilis_arm_reg_t dest, subtilis_arm_reg_t base,
			       const subtilis_arm_ass_modifiers_t *modifiers,
			       subtilis_arm_exp_val_t *val,
			       subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_arm_instr_t *instr;
	subtilis_arm_stran_misc_instr_t *stran_misc;
	bool reg_offset;
	int8_t int_offset = 0;
	subtilis_arm_reg_t reg = SIZE_MAX;
	bool write_back = false;
	bool subtract = false;

	if (val->type == SUBTILIS_ARM_EXP_TYPE_INT) {
		prv_parse_stran_misc_int_offset(c, val, &int_offset, &subtract,
						err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		reg_offset = false;
	} else if (val->type == SUBTILIS_ARM_EXP_TYPE_REG) {
		reg_offset = true;
		reg = val->val.reg;
	} else {
		subtilis_error_set_expected(err, "integer or register",
					    subtilis_arm_exp_type_name(val),
					    c->l->stream->name, c->l->line);
		goto cleanup;
	}

	tbuf = subtilis_token_get_text(c->t);
	if ((c->t->type != SUBTILIS_TOKEN_OPERATOR) || (strcmp(tbuf, "]"))) {
		subtilis_error_set_expected(err, "]", tbuf, c->l->stream->name,
					    c->l->line);
		goto cleanup;
	}

	subtilis_lexer_get(c->l, c->t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	tbuf = subtilis_token_get_text(c->t);
	if ((c->t->type == SUBTILIS_TOKEN_OPERATOR) && (!strcmp(tbuf, "!"))) {
		write_back = true;

		subtilis_lexer_get(c->l, c->t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	instr = subtilis_arm_section_add_instr(c->arm_s, itype, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	stran_misc = &instr->operands.stran_misc;

	prv_stran_misc_set_type(stran_misc, modifiers, err);
	if (err->type)
		goto cleanup;

	stran_misc->ccode = ccode;
	stran_misc->dest = dest;
	stran_misc->base = base;
	stran_misc->reg_offset = reg_offset;
	if (reg_offset)
		stran_misc->offset.reg = reg;
	else
		stran_misc->offset.imm = int_offset;
	stran_misc->pre_indexed = true;
	stran_misc->write_back = write_back;
	stran_misc->subtract = subtract;

cleanup:

	subtilis_arm_exp_val_free(val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movb $0x0, -0x42(%rbp)
movq $-0x1, -0x50(%rbp)
movb $0x0, -0x51(%rbp)
movb $0x0, -0x52(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x99cb0
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %r8
leaq -0x42(%rbp), %rdx
leaq -0x52(%rbp), %rcx
callq 0x99a30
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x99caa
jmp 0x99ee5
movb $0x0, -0x41(%rbp)
jmp 0x99d26
movq 0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x99ccb
movb $0x1, -0x41(%rbp)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x99d24
movq 0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq 0x10(%rbp), %rdi
callq 0x9b550
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x14510(%rip), %rdx     # 0xae217
leaq 0x14412(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x4e4, 0x8(%rsp)       # imm = 0x4E4
callq 0x156d0
jmp 0x99ee5
jmp 0x99d26
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2, (%rax)
jne 0x99d59
movq -0x30(%rbp), %rdi
leaq 0x144fc(%rip), %rsi     # 0xae24b
callq 0x12140
cmpl $0x0, %eax
je 0x99da2
movq 0x18(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x144c6(%rip), %rdx     # 0xae24b
leaq 0x14394(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x4eb, 0x8(%rsp)       # imm = 0x4EB
callq 0x156d0
jmp 0x99ee5
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rbp), %rdx
callq 0x133f0
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x99dc9
jmp 0x99ee5
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2, (%rax)
jne 0x99e29
movq -0x30(%rbp), %rdi
leaq 0x106f9(%rip), %rsi     # 0xaa4eb
callq 0x12140
cmpl $0x0, %eax
jne 0x99e29
movb $0x1, -0x51(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rbp), %rdx
callq 0x133f0
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x99e27
jmp 0x99ee5
jmp 0x99e29
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movq 0x18(%rbp), %rdx
callq 0x70b50
movq %rax, -0x38(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x99e4e
jmp 0x99ee5
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x99990
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x99e76
jmp 0x99ee5
movl -0x10(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movb -0x41(%rbp), %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x18(%rax)
testb $0x1, -0x41(%rbp)
je 0x99eb9
movq -0x50(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x99ec3
movb -0x42(%rbp), %cl
movq -0x40(%rbp), %rax
movb %cl, 0x20(%rax)
movq -0x40(%rbp), %rax
movb $0x1, 0x28(%rax)
movb -0x51(%rbp), %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x29(%rax)
movb -0x52(%rbp), %cl
movq -0x40(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x2a(%rax)
movq 0x10(%rbp), %rdi
callq 0x9a4c0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)