// File: /workspace/github_c_makefile_star2_O2/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, %r13
movq %r13, %r14
movq 0x20(%r13), %r13
testq %r13, %r13
je 0xdfa9
movq 0x10(%r13), %rax
cmpq 0xa240(%rip), %rax      # 0x17fb0
je 0xde03
cmpq 0xa223(%rip), %rax      # 0x17fa0
je 0xde8a
cmpq 0xa1de(%rip), %rax      # 0x17f68
je 0xdf61
cmpq 0xa221(%rip), %rax      # 0x17fb8
je 0xdf6b
cmpq 0xa23c(%rip), %rax      # 0x17fe0
jne 0xdfa0
movq 0x8(%r13), %r15
leaq -0x9453(%rip), %rax     # 0x4962
cmpq %rax, 0x18(%r15)
jne 0xdfa0
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe01e
testq %rax, %rax
je 0xdfa0
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xe0db
testq %rax, %rax
je 0xdf9d
movq %r12, %rdi
addq $0x28, %rdi
pushq $0x16
popq %rsi
xorl %edx, %edx
jmp 0xdf92
movq 0x8(%r13), %r15
movl (%r13), %ebp
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe01e
testq %rax, %rax
je 0xdfa0
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xe0db
testq %rax, %rax
je 0xdf9d
movq 0x28(%r12), %rcx
movslq 0x34(%r12), %rax
imulq $0x18, %rax, %rdx
leaq (%rcx,%rdx), %rax
movl -0x18(%rcx,%rdx), %ecx
cmpl $0x2, %ecx
je 0xdf81
cmpl $0x4, %ecx
je 0xdf81
cmpl $0xd, %ecx
je 0xdf81
pushq $0x11
popq %rsi
cmpl $0xb, %ecx
jne 0xdf89
movl $0xa, -0x18(%rax)
movl %ebp, -0x14(%rax)
jmp 0xdf9d
movq 0x8(%r13), %r15
movq 0x10(%r15), %rbp
leaq -0x9e1e(%rip), %rax     # 0x407b
cmpq %rax, 0x18(%rbp)
jne 0xdfa0
movq 0x10(%rbp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe01e
testq %rax, %rax
je 0xdfa0
movq %rax, %r12
movq %rax, %r13
movq %r12, %rdi
movq (%rsp), %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0xe0db
testq %rax, %rax
je 0xdfa0
addq $0x28, %r12
movl 0x4(%rbp), %edx
movq %r12, %rdi
pushq $0x13
popq %rsi
movq (%rsp), %rcx
movq %rbx, %r8
callq 0xe37e
testq %rax, %rax
je 0xdfa0
movq %r13, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0xe0db
testq %rax, %rax
je 0xdfa0
movq 0x28(%r13), %rax
movslq 0x34(%r13), %rcx
imulq $0x18, %rcx, %rdx
movl -0x18(%rax,%rdx), %ecx
pushq $0x14
popq %rsi
cmpl $0xd, %ecx
ja 0xdf4e
movl $0x2814, %esi           # imm = 0x2814
btl %ecx, %esi
pushq $0x14
popq %rsi
jae 0xdf4e
addq %rdx, %rax
incl %ecx
movl %ecx, -0x18(%rax)
pushq $0x15
popq %rsi
movl 0x4(%rbp), %edx
movq %r12, %rdi
movq %rbp, %rcx
movq %rbx, %r8
callq 0xe37e
jmp 0xdfa0
movq %r13, %rdi
movq %r14, %rsi
pushq $0x6
jmp 0xdf73
movq %r13, %rdi
movq %r14, %rsi
pushq $0x8
popq %rdx
movq %rbx, %rcx
callq 0xdfbb
movq %rax, %r13
jmp 0xdfa0
incl %ecx
movl %ecx, -0x18(%rax)
pushq $0x12
popq %rsi
movq %r12, %rdi
addq $0x28, %rdi
movl %ebp, %edx
movq %r15, %rcx
movq %rbx, %r8
callq 0xe37e
movq %r12, %r13
cmpb $0x0, (%rbx)
je 0xdd55
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq