// File: /workspace/github_c_makefile_star2_O0/martincameron[P]towntalk/ttasm.c
// Function: parse_jump
static struct element* parse_jump( struct element *elem, struct function *func, struct label *labels, struct instruction *output, char *message ) {
	/*
		opcode      x y z imm : mnemonic
		jump_lt     0 y z off : jump <( y z ) label;
		jump_le     0 y z off : jump <e( y z ) label;
		jump_eq     0 y z off : jump =( y z ) label;
		jump_ne     0 y z off : jump <>( y z ) label;
		jump_ge     0 y z off : jump >e( y z ) label;
		jump_gt     0 y z off : jump >( y z ) label;
	*/
	int idx;
	struct label *label;
	struct element *next = elem->next;
	struct asm_operator *oper = get_asm_operator( jump_operators, next->str.string );
	if( oper ) {
		output->opcode = oper->opcode;
		next = next->next;
		idx = get_local_variable( func, next->child, "", message );
		if( idx >= 0 ) {
			output->y = idx;
			idx = get_local_variable( func, next->child->next, "", message );
			if( idx >= 0 ) {
				output->z = idx;
				next = next->next;
				label = get_label( labels, next->str.string );
				if( label ) {
					output->imm = label->idx;
				} else {
					sprintf( message, "Undeclared jump label '%.64s' on line %d.", next->str.string, next->line );
					next = NULL;
				}
			} else {
				next = NULL;
			}
		} else {
			next = NULL;
		}
	} else {
		sprintf( message, "Invalid jump condition '%.64s' on line %d.", next->str.string, next->line );
		next = NULL;
	}
	return next;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x8849(%rip), %rdi      # 0x22330
callq 0x1aa80
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x19bf4
movq -0x48(%rbp), %rax
movb 0x8(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x28(%rbp), %rcx
leaq 0x152b(%rip), %rdx      # 0x1b056
callq 0x1a960
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x19bea
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rsi
movq -0x28(%rbp), %rcx
leaq 0x14f2(%rip), %rdx      # 0x1b056
callq 0x1a960
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x19be0
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x1aaf0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x19bb5
movq -0x38(%rbp), %rax
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x19bde
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x2ee7(%rip), %rsi      # 0x1cab6
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
jmp 0x19be8
movq $0x0, -0x40(%rbp)
jmp 0x19bf2
movq $0x0, -0x40(%rbp)
jmp 0x19c1d
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x2ed2(%rip), %rsi      # 0x1cae0
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)