// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/towntalk.c
// Function: parse_while_statement
static struct element* parse_while_statement( struct element *elem,
	struct function *func, struct variables *vars, struct statement *prev, char *message ) {
	struct expression expr;
	struct element *next = elem->next;
	struct statement block = { 0 }, *stmt = calloc( 1, sizeof( struct block_statement ) );
	if( stmt ) {
		stmt->dispose = dispose_block_statement;
		prev->next = stmt;
		expr.next = NULL;
		next = parse_expression( next, func, vars, &expr, message );
		if( expr.next ) {
			stmt->source = expr.next;
			if( next->child ) {
				parse_keywords_indexed( func->env->statements_index, next->child, func, vars, &block, message );
				( ( struct block_statement * ) stmt )->if_block = block.next;
			}
			if( message[ 0 ] == 0 ) {
				stmt->execute = execute_while_statement;
				if( expr.next->evaluate == evaluate_arithmetic_expression
				&& strchr( "!<(=)>", expr.next->index ) && expr.next->parameters->evaluate == evaluate_local ) {
					if( expr.next->parameters->next->evaluate == evaluate_local ) {
						stmt->local = expr.next->parameters->index;
						( ( struct block_statement * ) stmt )->rhs = expr.next->parameters->next->index;
						( ( struct block_statement * ) stmt )->oper = expr.next->index;
						stmt->execute = execute_while_local_statement;
					} else if( expr.next->parameters->next->evaluate == evaluate_number_literal_expression ) {
						stmt->local = expr.next->parameters->index;
						( ( struct block_statement * ) stmt )->num = ( ( struct value_expression * ) expr.next->parameters->next )->num;
						( ( struct block_statement * ) stmt )->oper = expr.next->index;
						stmt->execute = execute_while_const_statement;
					}
				} else if( expr.next->evaluate == evaluate_local ) {
					stmt->local = expr.next->index;
					stmt->execute = execute_while_const_statement;
				}
				next = next->next;
			}
		}
	} else {
		strcpy( message, OUT_OF_MEMORY );
	}
	return next;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r15
movq %rcx, %rbp
movq %rdx, %r12
movq %rsi, %r13
movq 0x20(%rdi), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, %edi
movl $0x48, %esi
callq 0x3130
testq %rax, %rax
je 0xaa5e
movq %rax, %r14
leaq -0x6629(%rip), %rax     # 0x4387
movq %rax, 0x18(%r14)
movq %r14, 0x20(%rbp)
leaq 0x28(%rsp), %rbp
movq $0x0, 0x10(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %r15, %r8
callq 0x4f62
movq %rax, %rbx
movq 0x10(%rbp), %rbp
testq %rbp, %rbp
je 0xaaa1
movq %rbp, 0x8(%r14)
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0xaa1e
movq 0x40(%r13), %rdi
subq $-0x80, %rdi
movq %rsp, %rax
movq %r13, %rdx
movq %r12, %rcx
movq %rax, %r12
movq %rax, %r8
movq %r15, %r9
callq 0x6e94
movq 0x20(%r12), %rax
movq %rax, 0x28(%r14)
cmpb $0x0, (%r15)
jne 0xaaa1
leaq 0xc07(%rip), %rax       # 0xb632
movq %rax, 0x10(%r14)
movq 0x18(%rbp), %rax
leaq -0x5ecd(%rip), %rcx     # 0x4b6d
cmpq %rcx, %rax
je 0xaa6f
leaq -0x686a(%rip), %rcx     # 0x41dc
cmpq %rcx, %rax
jne 0xaa9d
movl 0x4(%rbp), %eax
movl %eax, (%r14)
leaq 0xe0f(%rip), %rax       # 0xb867
movq %rax, 0x10(%r14)
jmp 0xaa9d
movq 0xe70b(%rip), %rsi      # 0x19170
movq %r15, %rdi
callq 0x3070
jmp 0xaaa1
movl 0x4(%rbp), %r15d
leaq 0x8378(%rip), %rdi      # 0x12df2
movl $0x7, %edx
movl %r15d, %esi
callq 0x3110
testq %rax, %rax
je 0xaa9d
movq 0x8(%rbp), %rax
leaq -0x68bb(%rip), %rdx     # 0x41dc
cmpq %rdx, 0x18(%rax)
je 0xaab3
movq 0x20(%rbx), %rbx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rax), %rcx
movq 0x18(%rcx), %rsi
cmpq %rdx, %rsi
je 0xaae2
leaq -0x702d(%rip), %rdx     # 0x3a9a
cmpq %rdx, %rsi
jne 0xaa9d
movl 0x4(%rax), %eax
movl %eax, (%r14)
movl 0x28(%rcx), %eax
movl %eax, 0x40(%r14)
movl %r15d, 0x38(%r14)
jmp 0xaa51
movl 0x4(%rax), %eax
movl %eax, (%r14)
movl 0x4(%rcx), %eax
movl %eax, 0x3c(%r14)
movl %r15d, 0x38(%r14)
leaq 0xc10(%rip), %rax       # 0xb70a
jmp 0xaa58