// File: /workspace/github_c_makefile_star2_O3/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 0x79e2
movq %rbx, %rdi
callq 0x50c7
movl %eax, %r13d
cmpl $0x10, %eax
movq %r12, 0x48(%rsp)
je 0x55bc
cmpl $0xf, %r13d
je 0x554a
testl %r13d, %r13d
jne 0x564f
movq $0x0, 0x40(%rsp)
movups 0x3c49(%rip), %xmm0     # 0x916c
leaq 0x7fb6(%rip), %rax      # 0xd4e0
movaps %xmm0, (%rax)
movabsq $0x6e6f6974617265, %rcx # imm = 0x6E6F6974617265
movq %rcx, 0xf(%rax)
movl $0x1, %edi
callq 0x5b10
jmp 0x56ee
movl 0x7d1f(%rip), %r15d     # 0xd270
leal 0x1(%r15), %eax
movl %eax, 0x7d15(%rip)      # 0xd270
leaq 0x7c1e(%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 0x340d
movl (%r12), %eax
cmpl $0x1, %eax
movq %r15, 0x40(%rsp)
je 0x565d
testl %eax, %eax
jne 0x56ee
movl 0x4(%r12), %edx
leaq 0x45fe(%rip), %rsi      # 0x9bb5
jmp 0x563d
movl 0x7cad(%rip), %r15d     # 0xd270
leal 0x1(%r15), %eax
movl %eax, 0x7ca3(%rip)      # 0xd270
leaq 0x7bac(%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 0x340d
movl (%r12), %eax
cmpl $0x1, %eax
movq %r15, 0x40(%rsp)
je 0x5687
testl %eax, %eax
jne 0x56ee
movl 0x4(%r12), %ecx
leaq 0x4535(%rip), %rsi      # 0x9b5a
movq %r14, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x171c
movl 0x4(%r12), %edx
leaq 0x4534(%rip), %rsi      # 0x9b71
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x171c
jmp 0x56ee
movq $0x0, 0x40(%rsp)
jmp 0x56ee
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3ff4(%rip), %rsi      # 0x9666
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x171c
leaq 0x4548(%rip), %rsi      # 0x9bcd
jmp 0x56e1
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3fca(%rip), %rsi      # 0x9666
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x171c
leaq 0x44da(%rip), %rsi      # 0x9b89
movq %r14, %rdi
xorl %eax, %eax
callq 0x171c
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3f07(%rip), %rsi      # 0x95d5
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x171c
leaq 0x44bd(%rip), %rsi      # 0x9b9e
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x171c
movq (%rbx), %rax
leaq 0xa8(%rsp), %rbp
movq %rax, (%rbp)
leaq 0x7efc(%rip), %r15      # 0xd600
movl (%r15), %r12d
movq %rbp, %rdi
callq 0x449e
movl %r12d, (%r15)
movq (%rbp), %rdi
callq 0x4fef
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 0x4bd3
movq %rbx, %rdi
callq 0x79e2
movl %r13d, %eax
leaq 0x39d4(%rip), %r15      # 0x9120
movl (%r15,%rax,4), %r12d
movl %ebp, %eax
cmpl %r12d, (%r15,%rax,4)
jbe 0x5783
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x54c9
movq %rbx, %rdi
callq 0x79e2
movq (%rbx), %rdi
callq 0x4fef
movl %eax, %eax
cmpl %r12d, (%r15,%rax,4)
ja 0x575d
cmpl $0x5, %r13d
jne 0x5818
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 0x7ab4
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 0x340d
movq %r12, %rdi
movq %r15, %rsi
movl $0x5, %edx
jmp 0x58ca
leal -0xf(%r13), %eax
cmpl $0x1, %eax
movq 0x48(%rsp), %r12
ja 0x58bf
leaq 0x794f(%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 0x340d
movl (%r13), %eax
cmpl $0x1, %eax
je 0x58d7
testl %eax, %eax
movq 0x40(%rsp), %r15
jne 0x59a4
movl 0x54(%rsp), %ecx
leaq 0x42d4(%rip), %rsi      # 0x9b5a
movq %r14, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x171c
movl (%r12), %eax
cmpl $0x1, %eax
je 0x5928
testl %eax, %eax
jne 0x59a4
movl 0x4(%r12), %edx
movl 0x54(%rsp), %ecx
leaq 0x432d(%rip), %rsi      # 0x9be4
movq %r14, %rdi
jmp 0x5948
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
movl %r13d, %edx
movq %r14, %rcx
callq 0x5209
jmp 0x59c6
movl (%r12), %eax
cmpl $0x1, %eax
movq 0x40(%rsp), %r15
je 0x5951
testl %eax, %eax
jne 0x59a4
movl 0x4(%r12), %ebp
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x15ba
leaq 0x372b(%rip), %rsi      # 0x9032
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x171c
movl 0x4(%r12), %ecx
leaq 0x4239(%rip), %rsi      # 0x9b5a
movq %r14, %rdi
movl %ecx, %edx
jmp 0x5948
movl 0x54(%rsp), %ebp
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x36df(%rip), %rsi      # 0x9020
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x171c
jmp 0x59a4
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x15ba
leaq 0x3d00(%rip), %rsi      # 0x9666
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x171c
leaq 0x4210(%rip), %rsi      # 0x9b89
movq %r14, %rdi
xorl %eax, %eax
callq 0x171c
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x15ba
leaq 0x3c3d(%rip), %rsi      # 0x95d5
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x171c
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %esi
callq 0x156a
leaq 0x43d8(%rip), %rsi      # 0x9d91
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x171c
movq %rbx, %rdi
callq 0x79e2
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq