// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/optimizer.c
// Function: optimize_statements
struct statement* optimize_statements( struct function *func, struct statement *prev, char *message ) {
	struct statement *stmt = prev, *next = stmt->next;
	while( next ) {
		if( next->execute == execute_local_assignment ) {
			next = optimize_local_assignment( next, prev, message );
		} else if( next->execute == execute_array_assignment ) {
			next = optimize_array_assignment( next, prev, message );
		} else if( next->execute == execute_increment_statement ) {
			next = optimize_increment( next, prev, INC_LOCAL, message );
		} else if( next->execute == execute_decrement_statement ) {
			next = optimize_increment( next, prev, DEC_LOCAL, message );
		} else if( next->execute == execute_return_statement ) {
			next = optimize_return( next, prev, message );
		}
		if( message[ 0 ] ) {
			return prev;
		}
		prev = next;
		next = next->next;
	}
#if defined( PRINT_INSNS )
	while( stmt ) {
		if( stmt->execute == execute_arithmetic_statement ) {
			print_insns( func, ( struct arithmetic_statement * ) stmt, stmt->source->line );
		}
		stmt = stmt->next;
	}
#endif
	return prev;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %r15, %r14
movq 0x20(%r15), %r15
testq %r15, %r15
je 0xedd4
movq 0x10(%r15), %rax
cmpq 0xa430(%rip), %rax      # 0x18fb0
je 0xec20
cmpq 0xa413(%rip), %rax      # 0x18fa0
je 0xec94
cmpq 0xa3ce(%rip), %rax      # 0x18f68
je 0xed6c
cmpq 0xa411(%rip), %rax      # 0x18fb8
je 0xed79
cmpq 0xa42c(%rip), %rax      # 0x18fe0
jne 0xedcb
movq 0x8(%r15), %r12
leaq -0xa058(%rip), %rax     # 0x4b6d
cmpq %rax, 0x18(%r12)
jne 0xedcb
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xee49
testq %rax, %rax
je 0xedcb
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xef13
testq %rax, %rax
je 0xec18
movq %r13, %rdi
addq $0x28, %rdi
movl $0x16, %esi
xorl %edx, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0xf1f5
movq %r13, %r15
jmp 0xedcb
movq 0x8(%r15), %r12
movl (%r15), %ebp
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xee49
testq %rax, %rax
je 0xedcb
movq %rax, %r13
movq %rax, %r15
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xef13
testq %rax, %rax
je 0xedcb
addq $0x28, %r13
movq 0x28(%r15), %rax
movslq 0x34(%r15), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
movl -0x18(%rax), %ecx
cmpl $0xa, %ecx
jg 0xed91
cmpl $0x2, %ecx
je 0xeda7
cmpl $0x4, %ecx
je 0xeda7
jmp 0xedb6
movq 0x8(%r15), %rbp
movq 0x10(%rbp), %r12
leaq -0xaac7(%rip), %rax     # 0x41dc
cmpq %rax, 0x18(%r12)
jne 0xedcb
movq 0x10(%r12), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xee49
testq %rax, %rax
je 0xedcb
movq %rax, %r13
movq %rax, %r15
movq %r13, %rdi
movq (%rsp), %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xef13
testq %rax, %rax
je 0xedcb
addq $0x28, %r13
movl 0x4(%r12), %edx
movq %r13, %rdi
movl $0x13, %esi
movq (%rsp), %rcx
movq %rbx, %r8
callq 0xf1f5
testq %rax, %rax
je 0xedcb
movq %r15, %rdi
movq %rbp, %rsi
movl $0x1, %edx
movq %rbx, %rcx
callq 0xef13
testq %rax, %rax
je 0xedcb
movq 0x28(%r15), %rax
movslq 0x34(%r15), %rcx
leaq (%rcx,%rcx,2), %rdx
movl -0x18(%rax,%rdx,8), %ecx
movl $0x14, %esi
cmpl $0xd, %ecx
ja 0xed62
movl $0x2814, %edi           # imm = 0x2814
btl %ecx, %edi
jae 0xed62
leaq (%rax,%rdx,8), %rax
incl %ecx
movl %ecx, -0x18(%rax)
movl $0x15, %esi
movl 0x4(%r12), %edx
movq %r13, %rdi
jmp 0xedc0
movq %r15, %rdi
movq %r14, %rsi
movl $0x6, %edx
jmp 0xed84
movq %r15, %rdi
movq %r14, %rsi
movl $0x8, %edx
movq %rbx, %rcx
callq 0xede6
movq %rax, %r15
jmp 0xedcb
cmpl $0xd, %ecx
je 0xeda7
cmpl $0xb, %ecx
jne 0xedb6
movl $0xa, -0x18(%rax)
movl %ebp, -0x14(%rax)
jmp 0xedcb
incl %ecx
movl %ecx, -0x18(%rax)
movq %r13, %rdi
movl $0x12, %esi
jmp 0xedbe
movq %r13, %rdi
movl $0x11, %esi
movl %ebp, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0xf1f5
cmpb $0x0, (%rbx)
je 0xeb65
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq