// File: /workspace/github_c_makefile_star2_O3/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 0x12edc
cmpl $0x0, (%r14)
jne 0x6b019
movq 0x10(%r12), %rdi
callq 0x12ad0
cmpb $0x28, (%rax)
jne 0x6afe3
cmpb $0x0, 0x1(%rax)
je 0x6b02e
movq 0x8(%r12), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xbffd(%rip), %r10      # 0x76ff4
leaq 0x88f8(%rip), %rdx      # 0x738f6
movq %r14, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x528                  # imm = 0x528
pushq %r10
callq 0x143da
addq $0x10, %rsp
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq %r14, %rsi
callq 0x69632
cmpl $0x0, (%r14)
jne 0x6b019
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x6b2c1
cmpl $0x0, (%r14)
jne 0x6b0ad
movl %eax, %ebp
movq 0x10(%r12), %rdi
callq 0x12ad0
movq 0x10(%r12), %rcx
cmpl $0x2, (%rcx)
jne 0x6b077
cmpb $0x2c, (%rax)
jne 0x6b077
cmpb $0x0, 0x1(%rax)
je 0x6b0c8
movq 0x8(%r12), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xbf69(%rip), %r10      # 0x76ff4
leaq 0x8500(%rip), %rdx      # 0x73592
movq %r14, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x537                  # imm = 0x537
pushq %r10
callq 0x143da
addq $0x10, %rsp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x68d41
movq %r15, %rdi
callq 0x68d41
jmp 0x6b01c
movq %r12, %rdi
movq %r14, %rsi
callq 0x69632
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x6b163
cmpl $0x8, (%r15)
jne 0x6b13d
movq 0x10(%r12), %rdi
callq 0x12ad0
movq 0x10(%r12), %rsi
cmpl $0x2, (%rsi)
jne 0x6b105
cmpb $0x29, (%rax)
jne 0x6b105
cmpb $0x0, 0x1(%rax)
je 0x6b16b
movq 0x8(%r12), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xbedb(%rip), %r10      # 0x76ff4
leaq 0x8cf5(%rip), %rcx      # 0x73e15
movq %r14, %rdi
movl $0x16, %esi
movq %rax, %rdx
pushq $0x548                  # imm = 0x548
pushq %r10
callq 0x143da
addq $0x10, %rsp
jmp 0x6b163
movq 0x8(%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0xbea4(%rip), %r8       # 0x76ff4
movq %r14, %rdi
movl $0x4a, %esi
movl $0x541, %r9d            # imm = 0x541
callq 0x145c8
xorl %r14d, %r14d
jmp 0x6b0b3
movq 0x8(%r12), %rdi
movq %r14, %rdx
callq 0x12edc
cmpl $0x0, (%r14)
jne 0x6b163
movq %r15, %r13
addq $0x8, %r13
movq %r13, %rdi
callq 0x14b57
movq %rax, %r12
decq %r12
movq %r13, %rdi
callq 0x14db1
movq %rax, %r13
movslq 0x8(%rbx), %rsi
imulq %r12, %rsi
incq %rsi
leaq 0x8(%rsp), %rdi
callq 0x149f4
testl %ebp, %ebp
je 0x6b1d8
movslq %ebp, %rbp
leaq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x14ae8
cmpl $0x0, (%r14)
jne 0x6b1eb
decq %rbp
jne 0x6b1ba
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x14d01
cmpl $0x0, (%r14)
je 0x6b1fa
leaq 0x8(%rsp), %rdi
callq 0x14d5c
jmp 0x6b163
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x68d67
movq %rax, %r14
movq %r12, %rdi
callq 0x14d5c
jmp 0x6b0b3