// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/arch/arm32/arm_expression.c
// Function: prv_string_str
static subtilis_arm_exp_val_t *prv_string_str(subtilis_arm_ass_context_t *c,
					      subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_buffer_t buf;
	size_t i;
	size_t string_len;
	int32_t repeat;
	const char *seed_string;
	subtilis_arm_exp_val_t *retval = NULL;
	subtilis_arm_exp_val_t *count = NULL;
	subtilis_arm_exp_val_t *string = NULL;

	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;
	}

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

	repeat = prv_exp_to_int(c, count, 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_expected(err, ",", tbuf, c->l->stream->name,
					    c->l->line);
		goto cleanup;
	}

	string = subtilis_arm_exp_val_get(c, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (string->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, ")")) {
		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;

	string_len = subtilis_buffer_get_size(&string->val.buf) - 1;
	seed_string = subtilis_buffer_get_string(&string->val.buf);
	subtilis_buffer_init(&buf, (count->val.integer * string_len) + 1);

	for (i = 0; i < repeat; i++) {
		subtilis_buffer_append(&buf, seed_string, string_len, err);
		if (err->type != SUBTILIS_ERROR_OK) {
			subtilis_buffer_free(&buf);
			goto cleanup;
		}
	}
	subtilis_buffer_zero_terminate(&buf, err);
	if (err->type != SUBTILIS_ERROR_OK) {
		subtilis_buffer_free(&buf);
		goto cleanup;
	}

	retval = subtilis_arm_exp_new_str(&buf, err);
	subtilis_buffer_free(&buf);

cleanup:

	subtilis_arm_exp_val_free(count);
	subtilis_arm_exp_val_free(string);

	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %r12
movq 0x8(%rdi), %rdi
movq 0x10(%r12), %rsi
movq %r14, %rdx
callq 0x12eda
cmpl $0x0, (%r14)
jne 0x6b484
movq 0x10(%r12), %rdi
callq 0x12ad0
movq %rax, %rbx
leaq 0x8de2(%rip), %rsi      # 0x74212
movq %rax, %rdi
callq 0x12160
testl %eax, %eax
je 0x6b473
movq 0x8(%r12), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xbb40(%rip), %rax      # 0x76f90
leaq 0x846b(%rip), %rdx      # 0x738c2
movq %r14, %rdi
movl $0x1d, %esi
movq %rbx, %rcx
pushq $0x528                  # imm = 0x528
pushq %rax
callq 0x1442a
addq $0x10, %rsp
jmp 0x6b484
movq %r12, %rdi
movq %r14, %rsi
callq 0x69a84
cmpl $0x0, (%r14)
je 0x6b499
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x6b731
cmpl $0x0, (%r14)
jne 0x6b511
movl %eax, %ebp
movq 0x10(%r12), %rdi
callq 0x12ad0
movq %rax, %r15
movq 0x10(%r12), %rax
cmpl $0x2, (%rax)
jne 0x6b4dc
leaq 0x80c8(%rip), %rsi      # 0x73598
movq %r15, %rdi
callq 0x12160
testl %eax, %eax
je 0x6b52c
movq 0x8(%r12), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xbaa0(%rip), %rax      # 0x76f90
leaq 0x80a1(%rip), %rdx      # 0x73598
movq %r14, %rdi
movl $0x1d, %esi
movq %r15, %rcx
pushq $0x537                  # imm = 0x537
pushq %rax
callq 0x1442a
addq $0x10, %rsp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x69167
movq %r15, %rdi
callq 0x69167
jmp 0x6b487
movq %r12, %rdi
movq %r14, %rsi
callq 0x69a84
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x6b5da
cmpl $0x8, (%r15)
jne 0x6b5b4
movq 0x10(%r12), %rdi
callq 0x12ad0
movq %rax, %rdx
movq 0x10(%r12), %r13
cmpl $0x2, (%r13)
jne 0x6b580
leaq 0x8583(%rip), %rsi      # 0x73aed
movq %rdx, %rdi
movq %rdx, 0x10(%rsp)
callq 0x12160
movq 0x10(%rsp), %rdx
testl %eax, %eax
je 0x6b5e2
movq 0x8(%r12), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xb9fc(%rip), %rax      # 0x76f90
leaq 0x885a(%rip), %rcx      # 0x73df5
movq %r14, %rdi
movl $0x16, %esi
pushq $0x548                  # imm = 0x548
pushq %rax
callq 0x1442a
addq $0x10, %rsp
jmp 0x6b5da
movq 0x8(%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0xb9c9(%rip), %r8       # 0x76f90
movq %r14, %rdi
movl $0x4a, %esi
movl $0x541, %r9d            # imm = 0x541
callq 0x14618
xorl %r14d, %r14d
jmp 0x6b517
movq 0x8(%r12), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12eda
cmpl $0x0, (%r14)
jne 0x6b5da
movq %r15, %r13
addq $0x8, %r13
movq %r13, %rdi
callq 0x14ba1
movq %rax, %r12
decq %r12
movq %r13, %rdi
callq 0x14dfb
movq %rax, %r13
movslq 0x8(%rbx), %rsi
imulq %r12, %rsi
incq %rsi
movq %rsp, %rdi
callq 0x14a40
testl %ebp, %ebp
je 0x6b64e
movslq %ebp, %rbp
movq %rsp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x14b32
cmpl $0x0, (%r14)
jne 0x6b65f
decq %rbp
jne 0x6b632
movq %rsp, %rdi
movq %r14, %rsi
callq 0x14d4b
cmpl $0x0, (%r14)
je 0x6b66c
movq %rsp, %rdi
callq 0x14da6
jmp 0x6b5da
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x6918d
movq %rax, %r14
movq %r12, %rdi
callq 0x14da6
jmp 0x6b517