// File: /workspace/github_c_makefile_star2_O0/martincameron[P]towntalk/towntalk.c
// Function: execute_array_assignment
enum result execute_array_assignment( struct statement *this,
	struct variables *vars, struct variable *result ) {
	int idx;
	struct array *arr;
	enum result ret = OKAY;
	struct variable dest = { 0, NULL }, src = { 0, NULL };
	struct expression *src_expr = this->source, *dest_expr = src_expr->next, *idx_expr = dest_expr->next;
	if( dest_expr->evaluate == evaluate_local ) {
		arr = ( struct array * ) vars->locals[ dest_expr->index ].string_value;
	} else {
		ret = dest_expr->evaluate( dest_expr, vars, &dest );
		arr = ( struct array * ) dest.string_value;
	}
	if( ret ) {
		if( arr && arr->str.type == ARRAY ) {
			ret = evaluate_integer( idx_expr, vars, &idx );
			if( ret ) {
				if( ( unsigned int ) idx < ( unsigned int ) arr->length ) {
					ret = src_expr->evaluate( src_expr, vars, &src );
					if( ret ) {
						if( arr->string_values ) {
							if( arr->string_values[ idx ] ) {
								unref_string( arr->string_values[ idx ] );
							}
							arr->number_values[ idx ] = src.number_value;
							arr->string_values[ idx ] = src.string_value;
						} else if( src.string_value ) {
							ret = to_num( &src, &arr->number_values[ idx ], vars, src_expr );
							dispose_temporary( &src );
						} else {
							arr->number_values[ idx ] = src.number_value;
						}
					}
				} else {
					ret = throw( vars, idx_expr, idx, "Array index out of bounds." );
				}
			}
		} else {
			ret = throw( vars, dest_expr, 0, "Not an array." );
		}
		dispose_temporary( &dest );
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, -0x2c(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x30f0
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x30f0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
leaq -0xb3a(%rip), %rcx      # 0x4bc0
cmpq %rcx, 0x18(%rax)
jne 0x5721
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movslq 0x4(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x5742
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq *%rax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x58a5
cmpq $0x0, -0x28(%rbp)
je 0x5883
movq -0x28(%rbp), %rax
movsbl 0x14(%rax), %eax
cmpl $0x2, %eax
jne 0x5883
movq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x5460
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5881
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jae 0x5865
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq *%rax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5863
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x5814
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x57ec
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3c20
movl -0x50(%rbp), %edx
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rdx
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x5861
cmpq $0x0, -0x48(%rbp)
je 0x584d
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rdx
movq -0x58(%rbp), %rcx
leaq -0x50(%rbp), %rdi
callq 0x51c0
movl %eax, -0x2c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3ce0
jmp 0x585f
movl -0x50(%rbp), %edx
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x5861
jmp 0x5863
jmp 0x587f
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq 0x15e1c(%rip), %rcx     # 0x1b693
callq 0x4330
movl %eax, -0x2c(%rbp)
jmp 0x5881
jmp 0x589c
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
xorl %edx, %edx
leaq 0x15e1a(%rip), %rcx     # 0x1b6ae
callq 0x4330
movl %eax, -0x2c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3ce0
movl -0x2c(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop