// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/towntalk.c
// Function: evaluate_str_expression
static enum result evaluate_str_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	int str_len = 0, len;
	char num[ 32 ], *val;
	enum result ret = OKAY;
	struct expression *parameter = this->parameters;
	struct variable var = { 0, NULL };
	struct string *str = NULL, *new;
	while( parameter && ret ) {
		ret = parameter->evaluate( parameter, vars, &var );
		if( ret ) {
			if( var.string_value ) {
				if( var.string_value->type == CUSTOM && ( ( struct custom * ) var.string_value )->type->to_str ) {
					ret = ( ( struct custom * ) var.string_value )->type->to_str( &var, &new, vars, parameter );
					dispose_temporary( &var );
					if( ret ) {
						var.string_value = new;
					} else {
						break;
					}
				}
				len = var.string_value->length;
				val = var.string_value->string;
			} else {
#if defined( FLOATING_POINT )
				sprintf( num, "%.16g", var.number_value );
#else
				sprintf( num, "%d", var.number_value );
#endif
				len = strlen( num );
				val = num;
			}
			if( str == NULL && var.string_value && var.string_value->type == STRING ) {
				str = var.string_value;
				var.string_value = NULL;
				var.number_value = 0;
				str_len = len;
			} else {
				if( MAX_INTEGER - len > str_len ) {
					new = new_string( str_len + len );
					if( new ) {
						if( str ) {
							memcpy( new->string, str->string, sizeof( char ) * str_len );
							unref_string( str );
						}
						memcpy( &new->string[ str_len ], val, sizeof( char ) * len );
						str_len += len;
						str = new;
					} else {
						ret = throw_out_of_memory( vars, this );
					}
				} else {
					ret = throw( vars, this, len, "String too large." );
				}
				dispose_variable( &var );
			}
			parameter = parameter->next;
		}
	}
	if( ret ) {
		result->string_value = str;
	} else if( str ) {
		unref_string( str );
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, 0x38(%rsp)
movq 0x8(%rdi), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
testq %r12, %r12
je 0xc9e1
movq %rsi, %r15
movq %rdx, 0x40(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %rsi, 0x30(%rsp)
movq %r12, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq *0x18(%r12)
testl %eax, %eax
je 0xc9ee
movl %eax, %ebx
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xc84c
cmpb $0x9, 0x14(%rax)
jne 0xc842
movq 0x18(%rax), %rcx
movq 0x10(%rcx), %r8
testq %r8, %r8
je 0xc842
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
movq %r12, %rcx
callq *%r8
movl %eax, %ebx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xc830
callq 0x394d
testl %ebx, %ebx
je 0xc9ee
movq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movl 0x10(%rax), %r13d
movq 0x8(%rax), %rbp
jmp 0xc876
movl 0x10(%rsp), %edx
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
leaq 0x6581(%rip), %rsi      # 0x12de0
xorl %eax, %eax
callq 0x3200
movq %rbp, %rdi
callq 0x30c0
movq %rax, %r13
movq 0x18(%rsp), %rax
cmpq $0x0, 0x8(%rsp)
sete %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xc896
cmpb $0x0, 0x14(%rax)
je 0xc958
movl %r13d, %eax
xorl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl %r14d, %eax
jle 0xc93d
movq %rbp, 0x48(%rsp)
leal (%r14,%r13), %ebp
movslq %ebp, %r15
leaq 0x19(%r15), %rdi
callq 0x31b0
testq %rax, %rax
je 0xc973
movq %rax, %rcx
addq $0x18, %rcx
movq $0x0, 0x10(%rax)
movq %rcx, 0x8(%rax)
movb $0x0, 0x18(%rax,%r15)
movq $0x1, (%rax)
movl %r15d, 0x10(%rax)
movq %rax, 0x28(%rsp)
movslq %r14d, %r14
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0xc918
movq 0x8(%rax), %rdi
movq 0x8(%r15), %rsi
movq %r14, %rdx
callq 0x3180
movq %r15, %rdi
callq 0x394d
movq 0x28(%rsp), %rax
addq 0x8(%rax), %r14
movslq %r13d, %rdx
movq %r14, %rdi
movq 0x48(%rsp), %rsi
callq 0x3180
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %r15
jmp 0xc99c
movq %r15, %rdi
movq 0x38(%rsp), %rsi
movl %r13d, %edx
leaq 0x6697(%rip), %rcx      # 0x12fe6
callq 0x3c96
xorl %ebx, %ebx
jmp 0xc999
movq $0x0, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl %r13d, %r14d
movq %rax, 0x8(%rsp)
jmp 0xc9bf
movq $0x0, 0x28(%rsp)
movq 0xc7ed(%rip), %rcx      # 0x19170
xorl %ebx, %ebx
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x3c96
movl %r14d, %ebp
movl $0x0, 0x10(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xc9bc
callq 0x394d
movq $0x0, 0x18(%rsp)
movl %ebp, %r14d
movq 0x10(%r12), %r12
testq %r12, %r12
je 0xc9d1
testl %ebx, %ebx
jne 0xc7d5
testl %ebx, %ebx
movq 0x40(%rsp), %rdx
movq 0x8(%rsp), %rdi
jne 0xc9e8
jmp 0xc9f3
movl $0x1, %ebx
xorl %edi, %edi
movq %rdi, 0x8(%rdx)
jmp 0xc9ff
movq 0x8(%rsp), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0xc9ff
callq 0x394d
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq