// File: /workspace/github_c_makefile_star2_O1/been-jamming[P]MinimalCC/expression.c
// Function: compile_expression_recursive
static void compile_expression_recursive(value *first_value, char **c, FILE *output_file){
	operation current_operation;
	operation next_operation;
	unsigned int label_num = 0;
	value next_value;
	char *temp_c;
	type cast_to;
	int current_line_temp;

	skip_whitespace(c);
	current_operation = get_operation(c);
	if(current_operation == operation_none){
		snprintf(error_message, sizeof(error_message), "Unrecognized operation");
		do_error(1);
	} else if(current_operation == operation_logical_or){
		label_num = num_labels;
		num_labels++;
		cast(first_value, INT_TYPE, 0, output_file);
		if(first_value->data.type == data_register){
			fileprint(output_file, "sne $s%d, $s%d, $zero\n", first_value->data.reg, first_value->data.reg);
			fileprint(output_file, "bne $s%d, $zero, __L%d\n", first_value->data.reg, label_num);
		} else if(first_value->data.type == data_stack){
			fileprint(output_file, "lw $t0, %d($sp)\n", get_stack_pos(first_value->data));
			fileprint(output_file, "sne $t0, $t0, $zero\n");
			fileprint(output_file, "sw $t0, %d($sp)\n", get_stack_pos(first_value->data));
			fileprint(output_file, "bne $t0, $zero, __L%d\n", label_num);
		}
	} else if(current_operation == operation_logical_and){
		label_num = num_labels;
		num_labels++;
		cast(first_value, INT_TYPE, 0, output_file);
		if(first_value->data.type == data_register){
			fileprint(output_file, "beq $s%d, $zero, __L%d\n", first_value->data.reg, label_num);
		} else if(first_value->data.type == data_stack){
			fileprint(output_file, "lw $t0, %d($sp)\n", get_stack_pos(first_value->data));
			fileprint(output_file, "beq $t0, $zero, __L%d\n", label_num);
		}
	}

	temp_c = *c;
	current_line_temp = current_line;
	skip_value(&temp_c);
	current_line = current_line_temp;
	next_operation = peek_operation(temp_c);
	if(next_operation == operation_assign && order_of_operations[operation_assign] > order_of_operations[current_operation]){
		compile_value(&next_value, c, 0, 0, output_file);
	} else {
		compile_value(&next_value, c, 1, 0, output_file);
	}
	skip_whitespace(c);
	while(order_of_operations[next_operation] > order_of_operations[current_operation]){
		compile_expression_recursive(&next_value, c, output_file);
		skip_whitespace(c);
		next_operation = peek_operation(*c);
	}
	if(current_operation == operation_assign){
		cast_to = first_value->data_type;
		pop_type(&cast_to);
		cast(&next_value, cast_to, 1, output_file);
		compile_operation(first_value, &next_value, current_operation, output_file);
	} else if(current_operation == operation_logical_or || current_operation == operation_logical_and){
		cast(&next_value, INT_TYPE, 0, output_file);
		if(next_value.data.type == data_register){
			fileprint(output_file, "sne $s%d, $s%d, $zero\n", next_value.data.reg, next_value.data.reg);
			if(first_value->data.type == data_register){
				fileprint(output_file, "move $s%d, $s%d\n", first_value->data.reg, next_value.data.reg);
			} else if(first_value->data.type == data_stack){
				fileprint(output_file, "sw $s%d, %d($sp)\n", next_value.data.reg, get_stack_pos(first_value->data));
			}
		} else if(next_value.data.type == data_stack){
			if(first_value->data.type == data_register){
				fileprint(output_file, "lw $s%d, %d($sp)\n", first_value->data.reg, get_stack_pos(next_value.data));
				fileprint(output_file, "sne $s%d, $s%d, $zero\n", first_value->data.reg, first_value->data.reg);
			} else if(first_value->data.type == data_stack){
				fileprint(output_file, "lw $t0, %d($sp)\n", get_stack_pos(next_value.data));
				fileprint(output_file, "sne $t0, $t0, $zero\n");
				fileprint(output_file, "sw $t0, %d($sp)\n", get_stack_pos(first_value->data));
			}
		}
		deallocate(next_value.data);
		fileprint(output_file, "\n__L%d:\n", label_num);
	} else {
		compile_operation(first_value, &next_value, current_operation, output_file);
	}
	skip_whitespace(c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq %rsi, %rdi
callq 0x799f
movq %rbx, %rdi
callq 0x508a
movl %eax, %r13d
cmpl $0x10, %eax
movq %r12, 0x48(%rsp)
je 0x558c
cmpl $0xf, %r13d
je 0x551a
testl %r13d, %r13d
jne 0x561f
movq $0x0, 0x40(%rsp)
movups 0x3c79(%rip), %xmm0     # 0x916c
leaq 0x7fe6(%rip), %rax      # 0xd4e0
movaps %xmm0, (%rax)
movabsq $0x6e6f6974617265, %rcx # imm = 0x6E6F6974617265
movq %rcx, 0xf(%rax)
movl $0x1, %edi
callq 0x5ae0
jmp 0x56be
movl 0x7d4f(%rip), %r15d     # 0xd270
leal 0x1(%r15), %eax
movl %eax, 0x7d45(%rip)      # 0xd270
leaq 0x7c4e(%rip), %rax      # 0xd180
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x33e8
movl (%r12), %eax
cmpl $0x1, %eax
movq %r15, 0x40(%rsp)
je 0x562d
testl %eax, %eax
jne 0x56be
movl 0x4(%r12), %edx
leaq 0x462e(%rip), %rsi      # 0x9bb5
jmp 0x560d
movl 0x7cdd(%rip), %r15d     # 0xd270
leal 0x1(%r15), %eax
movl %eax, 0x7cd3(%rip)      # 0xd270
leaq 0x7bdc(%rip), %rax      # 0xd180
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x33e8
movl (%r12), %eax
cmpl $0x1, %eax
movq %r15, 0x40(%rsp)
je 0x5657
testl %eax, %eax
jne 0x56be
movl 0x4(%r12), %ecx
leaq 0x4565(%rip), %rsi      # 0x9b5a
movq %r14, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x1710
movl 0x4(%r12), %edx
leaq 0x4564(%rip), %rsi      # 0x9b71
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x1710
jmp 0x56be
movq $0x0, 0x40(%rsp)
jmp 0x56be
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x4024(%rip), %rsi      # 0x9666
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1710
leaq 0x4578(%rip), %rsi      # 0x9bcd
jmp 0x56b1
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3ffa(%rip), %rsi      # 0x9666
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1710
leaq 0x450a(%rip), %rsi      # 0x9b89
movq %r14, %rdi
xorl %eax, %eax
callq 0x1710
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3f37(%rip), %rsi      # 0x95d5
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1710
leaq 0x44ed(%rip), %rsi      # 0x9b9e
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x1710
movq (%rbx), %rax
leaq 0xa8(%rsp), %rbp
movq %rax, (%rbp)
leaq 0x7f2c(%rip), %r15      # 0xd600
movl (%r15), %r12d
movq %rbp, %rdi
callq 0x4474
movl %r12d, (%r15)
movq (%rbp), %rdi
callq 0x4fb2
movl %eax, %ebp
xorl $0x5, %eax
xorl %edx, %edx
orl %r13d, %eax
setne %dl
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x4ba2
movq %rbx, %rdi
callq 0x799f
movl %r13d, %eax
leaq 0x3a04(%rip), %r15      # 0x9120
movl (%r15,%rax,4), %r12d
movl %ebp, %eax
cmpl %r12d, (%r15,%rax,4)
jbe 0x5753
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5499
movq %rbx, %rdi
callq 0x799f
movq (%rbx), %rdi
callq 0x4fb2
movl %eax, %eax
cmpl %r12d, (%r15,%rax,4)
ja 0x572d
cmpl $0x5, %r13d
jne 0x57e8
movq 0x48(%rsp), %r12
movups 0x10(%r12), %xmm0
movups 0x20(%r12), %xmm1
movups 0x30(%r12), %xmm2
movups 0x40(%r12), %xmm3
leaq 0xb0(%rsp), %r15
movaps %xmm3, 0x30(%r15)
movaps %xmm2, 0x20(%r15)
movaps %xmm1, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
callq 0x7a79
movaps (%r15), %xmm0
movaps 0x10(%r15), %xmm1
movaps 0x20(%r15), %xmm2
movaps 0x30(%r15), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x33e8
movq %r12, %rdi
movq %r15, %rsi
movl $0x5, %edx
jmp 0x589a
leal -0xf(%r13), %eax
cmpl $0x1, %eax
movq 0x48(%rsp), %r12
ja 0x588f
leaq 0x797f(%rip), %rax      # 0xd180
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x50(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x33e8
movl (%r13), %eax
cmpl $0x1, %eax
je 0x58a7
testl %eax, %eax
movq 0x40(%rsp), %r15
jne 0x5974
movl 0x54(%rsp), %ecx
leaq 0x4304(%rip), %rsi      # 0x9b5a
movq %r14, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x1710
movl (%r12), %eax
cmpl $0x1, %eax
je 0x58f8
testl %eax, %eax
jne 0x5974
movl 0x4(%r12), %edx
movl 0x54(%rsp), %ecx
leaq 0x435d(%rip), %rsi      # 0x9be4
movq %r14, %rdi
jmp 0x5918
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
movl %r13d, %edx
movq %r14, %rcx
callq 0x51d9
jmp 0x5996
movl (%r12), %eax
cmpl $0x1, %eax
movq 0x40(%rsp), %r15
je 0x5921
testl %eax, %eax
jne 0x5974
movl 0x4(%r12), %ebp
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x15ba
leaq 0x375b(%rip), %rsi      # 0x9032
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x1710
movl 0x4(%r12), %ecx
leaq 0x4269(%rip), %rsi      # 0x9b5a
movq %r14, %rdi
movl %ecx, %edx
jmp 0x5918
movl 0x54(%rsp), %ebp
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x370f(%rip), %rsi      # 0x9020
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x1710
jmp 0x5974
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x15ba
leaq 0x3d30(%rip), %rsi      # 0x9666
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1710
leaq 0x4240(%rip), %rsi      # 0x9b89
movq %r14, %rdi
xorl %eax, %eax
callq 0x1710
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3c6d(%rip), %rsi      # 0x95d5
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1710
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x156a
leaq 0x4414(%rip), %rsi      # 0x9d9d
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x1710
movq %rbx, %rdi
callq 0x799f
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq