// File: /workspace/github_c_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq %rsi, %rdi
callq 0x7549
movq %rbx, %rdi
callq 0x4ccd
movl %eax, %r13d
cmpl $0x10, %eax
movq %r12, 0x58(%rsp)
je 0x517f
cmpl $0xf, %r13d
je 0x510d
testl %r13d, %r13d
jne 0x5212
movq $0x0, 0x48(%rsp)
movups 0x3064(%rip), %xmm0     # 0x814c
leaq 0x73f1(%rip), %rax      # 0xc4e0
movaps %xmm0, (%rax)
movabsq $0x6e6f6974617265, %rcx # imm = 0x6E6F6974617265
movq %rcx, 0xf(%rax)
pushq $0x1
popq %rdi
callq 0x56c5
jmp 0x52b1
movl 0x715c(%rip), %r15d     # 0xc270
leal 0x1(%r15), %eax
movl %eax, 0x7152(%rip)      # 0xc270
leaq 0x705b(%rip), %rax      # 0xc180
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 0x312b
movl (%r12), %eax
cmpl $0x1, %eax
movq %r15, 0x48(%rsp)
je 0x5220
testl %eax, %eax
jne 0x52b1
movl 0x4(%r12), %edx
leaq 0x3a1b(%rip), %rsi      # 0x8b95
jmp 0x5200
movl 0x70ea(%rip), %r15d     # 0xc270
leal 0x1(%r15), %eax
movl %eax, 0x70e0(%rip)      # 0xc270
leaq 0x6fe9(%rip), %rax      # 0xc180
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 0x312b
movl (%r12), %eax
cmpl $0x1, %eax
movq %r15, 0x48(%rsp)
je 0x524a
testl %eax, %eax
jne 0x52b1
movl 0x4(%r12), %ecx
leaq 0x3952(%rip), %rsi      # 0x8b3a
movq %r14, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x14e8
movl 0x4(%r12), %edx
leaq 0x3951(%rip), %rsi      # 0x8b51
movq %r14, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x14e8
jmp 0x52b1
movq $0x0, 0x48(%rsp)
jmp 0x52b1
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x1393
leaq 0x3411(%rip), %rsi      # 0x8646
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x14e8
leaq 0x3965(%rip), %rsi      # 0x8bad
jmp 0x52a4
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x1393
leaq 0x33e7(%rip), %rsi      # 0x8646
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x14e8
leaq 0x38f7(%rip), %rsi      # 0x8b69
movq %r14, %rdi
xorl %eax, %eax
callq 0x14e8
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x1393
leaq 0x3324(%rip), %rsi      # 0x85b5
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x14e8
leaq 0x38da(%rip), %rsi      # 0x8b7e
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x14e8
movq (%rbx), %rax
leaq 0xb8(%rsp), %r15
movq %rax, (%r15)
leaq 0x733a(%rip), %r12      # 0xc600
movl (%r12), %ebp
movq %r15, %rdi
callq 0x415b
movl %ebp, (%r12)
movq (%r15), %rdi
callq 0x4c19
movl %eax, %r15d
xorl $0x5, %eax
xorl %edx, %edx
orl %r13d, %eax
setne %dl
movl %r13d, %ebp
leaq 0x60(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x481c
movq %rbx, %rdi
callq 0x7549
movl %ebp, 0x54(%rsp)
movl %ebp, %eax
leaq 0x2de7(%rip), %r12      # 0x8100
movl (%r12,%rax,4), %ebp
movl %r15d, %eax
cmpl %ebp, (%r12,%rax,4)
jbe 0x5349
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x508e
movq %rbx, %rdi
callq 0x7549
movq (%rbx), %rdi
callq 0x4c19
movl %eax, %r15d
jmp 0x531d
movl 0x54(%rsp), %edx
cmpl $0x5, %edx
jne 0x53dd
movq 0x58(%rsp), %r12
movups 0x10(%r12), %xmm0
movups 0x20(%r12), %xmm1
movups 0x30(%r12), %xmm2
movups 0x40(%r12), %xmm3
leaq 0xc0(%rsp), %r15
movaps %xmm3, 0x30(%r15)
movaps %xmm2, 0x20(%r15)
movaps %xmm1, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
callq 0x761b
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 0x60(%rsp), %r15
pushq $0x1
popq %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x312b
pushq $0x5
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
jmp 0x548c
movl %edx, %eax
addl $-0xf, %eax
cmpl $0x1, %eax
movq 0x58(%rsp), %r12
ja 0x5484
leaq 0x6d89(%rip), %rax      # 0xc180
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 0x60(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x312b
movl (%r15), %eax
cmpl $0x1, %eax
je 0x5499
testl %eax, %eax
movq 0x48(%rsp), %r15
jne 0x5566
movl 0x64(%rsp), %ecx
leaq 0x36ef(%rip), %rsi      # 0x8b3a
movq %r14, %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x14e8
movl (%r12), %eax
cmpl $0x1, %eax
je 0x54ea
testl %eax, %eax
jne 0x5566
movl 0x4(%r12), %edx
movl 0x64(%rsp), %ecx
leaq 0x3748(%rip), %rsi      # 0x8bc4
movq %r14, %rdi
jmp 0x550a
leaq 0x60(%rsp), %rsi
movq %r12, %rdi
movq %r14, %rcx
callq 0x4dd8
jmp 0x5588
movl (%r12), %eax
cmpl $0x1, %eax
movq 0x48(%rsp), %r15
je 0x5513
testl %eax, %eax
jne 0x5566
movl 0x4(%r12), %ebp
movq 0x60(%rsp), %rdi
movl 0x68(%rsp), %esi
callq 0x1393
leaq 0x2b4d(%rip), %rsi      # 0x8016
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x14e8
movl 0x4(%r12), %ecx
leaq 0x3657(%rip), %rsi      # 0x8b3a
movq %r14, %rdi
movl %ecx, %edx
jmp 0x550a
movl 0x64(%rsp), %ebp
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x1393
leaq 0x2b01(%rip), %rsi      # 0x8004
movq %r14, %rdi
movl %ebp, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x14e8
jmp 0x5566
movq 0x60(%rsp), %rdi
movl 0x68(%rsp), %esi
callq 0x1393
leaq 0x311e(%rip), %rsi      # 0x8646
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x14e8
leaq 0x362e(%rip), %rsi      # 0x8b69
movq %r14, %rdi
xorl %eax, %eax
callq 0x14e8
movq (%r12), %rdi
movl 0x8(%r12), %esi
callq 0x1393
leaq 0x305b(%rip), %rsi      # 0x85b5
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x14e8
movq 0x60(%rsp), %rdi
movl 0x68(%rsp), %esi
callq 0x1343
leaq 0x37f6(%rip), %rsi      # 0x8d71
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x14e8
movq %rbx, %rdi
callq 0x7549
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq