// File: /workspace/github_c_makefile_star2_O0/Mithreindeir[P]ewcc/src/tac.c
// Function: cond_emit
void cond_emit(struct generator *context, struct cond *c)
{
	/*Emit comparison, if false jump to block end, at end of block jump after else block*/
	int start = REQ_LABEL(context), otherwise = REQ_LABEL(context), end = REQ_LABEL(context);
	generate_from_node(c->condition, context, IGNORE);
	/*True is patched to the start of the block, false is patched to where the else block would be*/
	backpatch(TLIST_REF(c->condition), start);
	backpatch(FLIST_REF(c->condition), otherwise);

	emit_label(context, start);
	generate_from_node(c->body, context, IGNORE);
	/*If there is a else block, then emit an unconditional jump to the end of that*/
	if (c->otherwise)
		emit_jump(context, end, UNCONDITIONAL);
	emit_label(context, otherwise);
	/*If else statement exists, then traverse that too*/
	generate_from_node(c->otherwise, context, IGNORE);
	emit_label(context, end);
	/*The body's patched to the parents*/
	if (c->body) {
		TLIST(context->parent) = merge(TLIST(context->parent), TLIST(c->body));
		FLIST(context->parent) = merge(FLIST(context->parent), FLIST(c->body));
	}
	if (c->otherwise) {
		TLIST(context->parent) = merge(TLIST(context->parent), TLIST(c->otherwise));
		FLIST(context->parent) = merge(FLIST(context->parent), FLIST(c->otherwise));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x4(%rcx)
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x4(%rcx)
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x4(%rcx)
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
movl $0x3, %edx
callq 0x5920
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
addq $0x8, %rdi
movl -0x14(%rbp), %esi
callq 0x6bc0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
addq $0x10, %rdi
movl -0x18(%rbp), %esi
callq 0x6bc0
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x6b70
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movl $0x3, %edx
callq 0x5920
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x5e87
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x2, %edx
callq 0x6d10
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x6b70
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rsi
movl $0x3, %edx
callq 0x5920
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x6b70
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5f30
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x6d70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x6d70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x5fab
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x6d70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x6d70
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x10(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)