// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_expression.c
// Function: prv_left_right
static subtilis_arm_exp_val_t *prv_left_right(subtilis_arm_ass_context_t *c,
					      int32_t *len,
					      subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_arm_exp_val_t *val = NULL;
	subtilis_arm_exp_val_t *val2 = NULL;
	int32_t length = 1;

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

	tbuf = subtilis_token_get_text(c->t);
	if (strcmp(tbuf, "(")) {
		subtilis_error_set_expected(err, "( ", tbuf, c->l->stream->name,
					    c->l->line);
		return NULL;
	}

	val = subtilis_arm_exp_val_get(c, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return NULL;

	if (val->type != SUBTILIS_ARM_EXP_TYPE_STRING) {
		subtilis_error_set_const_string_expected(
		    err, 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, ",") && strcmp(tbuf, ")"))) {
		subtilis_error_set_expected(err, ", or ) ", tbuf,
					    c->l->stream->name, c->l->line);
		goto cleanup;
	}

	if (!strcmp(tbuf, ",")) {
		val2 = subtilis_arm_exp_val_get(c, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		length = prv_exp_to_int(c, val2, 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, ")")) {
			subtilis_error_set_right_bkt_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;

	subtilis_arm_exp_val_free(val2);

	*len = length;
	return val;

cleanup:

	subtilis_arm_exp_val_free(val2);
	subtilis_arm_exp_val_free(val);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x133f0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9e6ea
movq $0x0, -0x8(%rbp)
jmp 0x9e988
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xcb96(%rip), %rsi      # 0xab29c
callq 0x12140
cmpl $0x0, %eax
je 0x9e761
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0xc1c6(%rip), %rdx      # 0xaa902
leaq 0xfcbd(%rip), %rax      # 0xae400
movq %rax, (%rsp)
movl $0x42f, 0x8(%rsp)       # imm = 0x42F
callq 0x156d0
movq $0x0, -0x8(%rbp)
jmp 0x9e988
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x9b4f0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9e788
movq $0x0, -0x8(%rbp)
jmp 0x9e988
movq -0x30(%rbp), %rax
cmpl $0x8, (%rax)
je 0x9e7c8
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %ecx
movl $0x4a, %esi
leaq 0xfc48(%rip), %r8       # 0xae400
movl $0x439, %r9d            # imm = 0x439
callq 0x15930
jmp 0x9e96e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2, (%rax)
jne 0x9e810
movq -0x28(%rbp), %rdi
leaq 0xbdb8(%rip), %rsi      # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
je 0x9e859
movq -0x28(%rbp), %rdi
leaq 0xc34b(%rip), %rsi      # 0xaab51
callq 0x12140
cmpl $0x0, %eax
je 0x9e859
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0xfc1d(%rip), %rdx      # 0xae459
leaq 0xfbbd(%rip), %rax      # 0xae400
movq %rax, (%rsp)
movl $0x441, 0x8(%rsp)       # imm = 0x441
callq 0x156d0
jmp 0x9e96e
movq -0x28(%rbp), %rdi
leaq 0xbd45(%rip), %rsi      # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
jne 0x9e92e
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x9b4f0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9e891
jmp 0x9e96e
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x9e330
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9e8b3
jmp 0x9e96e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2, (%rax)
jne 0x9e8e6
movq -0x28(%rbp), %rdi
leaq 0xc275(%rip), %rsi      # 0xaab51
callq 0x12140
cmpl $0x0, %eax
je 0x9e92c
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x16, %esi
leaq 0xc964(%rip), %rcx      # 0xab276
leaq 0xfae7(%rip), %rax      # 0xae400
movq %rax, (%rsp)
movl $0x452, 0x8(%rsp)       # imm = 0x452
callq 0x156d0
jmp 0x9e96e
jmp 0x9e92e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x133f0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9e952
jmp 0x9e96e
movq -0x38(%rbp), %rdi
callq 0x9a4c0
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x9e988
movq -0x38(%rbp), %rdi
callq 0x9a4c0
movq -0x30(%rbp), %rdi
callq 0x9a4c0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)