// File: /workspace/github_c_makefile_star2_O0/martincameron[P]towntalk/ttasm.c
// Function: parse_letv_opr
static struct element* parse_letv_opr( struct element *elem, struct function *func, struct instruction *output, char *message ) {
	/*
		opcode      x y z imm : mnemonic
		letv_opr_vi x y 0 imm : let x = opr( y imm );
		letv_opr_vv x y z   0 : let x = opr( y z );
		letv_opr_vp x y z   0 : let x = opr( y z++ );
	*/
	char *str;
	struct asm_operator *oper;
	struct element *child, *next = elem->next;
	int idx = get_local_variable( func, next, "", message );
	if( idx >= 0 ) {
		output->x = idx;
		next = next->next->next;
		if( next->next && next->next->child && next->next->child->next && next->next->child->next->next == NULL ) {
			child = next->next->child;
			idx = get_local_variable( func, child, "", message );
			if( idx >= 0 ) {
				output->y = idx;
				str = child->next->str.string;
				if( str[ 0 ] == '-' || ( str[ 0 ] >= '0' && str[ 0 ] <= '9' ) ) {
					/* letv_opr_vi */
					oper = get_asm_operator( let_vi_operators, next->str.string );
					if( oper ) {
						output->opcode = oper->opcode;
						if( parse_number( str, &output->imm ) ) {
							next = next->next;
						} else {
							sprintf( message, "Invalid immediate '%.64s' at line %d.", child->next->str.string, child->next->line );
							next = NULL;
						}
					} else {
						sprintf( message, "Invalid operator '%.64s' at line %d.", next->str.string, next->line );
						next = NULL;
					}
				} else {
					idx = get_local_variable( func, child->next, "", NULL );
					if( idx >= 0 ) {
						/* letv_opr_vv */
						oper = get_asm_operator( let_vv_operators, next->str.string );
						if( oper ) {
							output->opcode = oper->opcode;
							output->z = idx;
							next = next->next;
						} else {
							sprintf( message, "Invalid operator '%.64s' at line %d.", next->str.string, next->line );
							next = NULL;
						}
					} else {
						idx = get_local_variable( func, child->next, "++", message );
						if( idx >= 0 ) {
							/* letv_opr_vp */
							oper = get_asm_operator( let_vp_operators, next->str.string );
							if( oper ) {
								output->opcode = oper->opcode;
								output->z = idx;
								next = next->next;
							} else {
								sprintf( message, "Invalid operator '%.64s' at line %d.", next->str.string, next->line );
								next = NULL;
							}
						} else {
							next = NULL;
						}
					}
				}
			} else {
				next = NULL;
			}
		} else {
			sprintf( message, "Invalid operands for '%.64s' on line %d.", next->str.string, next->line );
			next = NULL;
		}
	} else {
		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 -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rcx
leaq 0xbbf(%rip), %rdx       # 0x1b056
callq 0x1a960
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x1a7b9
movl -0x44(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1a78e
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x1a78e
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x20(%rax)
je 0x1a78e
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
cmpq $0x0, 0x20(%rax)
jne 0x1a78e
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x20(%rbp), %rcx
leaq 0xb1a(%rip), %rdx       # 0x1b056
callq 0x1a960
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x1a784
movl -0x44(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x1a596
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x1a647
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x1a647
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x7afb(%rip), %rdi      # 0x220a0
callq 0x1aa80
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1a619
movq -0x30(%rbp), %rax
movb 0x8(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x5d90
cmpl $0x0, %eax
je 0x1a5e6
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x1a617
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rdx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x28(%rax), %ecx
leaq 0x237f(%rip), %rsi      # 0x1c987
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
jmp 0x1a642
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x23a5(%rip), %rsi      # 0x1c9d8
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
jmp 0x1a782
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x9fc(%rip), %rdx       # 0x1b056
xorl %eax, %eax
movl %eax, %ecx
callq 0x1a960
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x1a6e0
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x7b45(%rip), %rdi      # 0x221c0
callq 0x1aa80
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1a6b2
movq -0x30(%rbp), %rax
movb 0x8(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movl -0x44(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x1a6db
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x230c(%rip), %rsi      # 0x1c9d8
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
jmp 0x1a780
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x20(%rbp), %rcx
leaq 0x1537(%rip), %rdx      # 0x1bc2e
callq 0x1a960
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x1a776
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x7bcc(%rip), %rdi      # 0x222e0
callq 0x1aa80
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1a74b
movq -0x30(%rbp), %rax
movb 0x8(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movl -0x44(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x1a774
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x2273(%rip), %rsi      # 0x1c9d8
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
jmp 0x1a77e
movq $0x0, -0x40(%rbp)
jmp 0x1a780
jmp 0x1a782
jmp 0x1a78c
movq $0x0, -0x40(%rbp)
jmp 0x1a7b7
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0x2255(%rip), %rsi      # 0x1c9fd
movb $0x0, %al
callq 0x31f0
movq $0x0, -0x40(%rbp)
jmp 0x1a7c1
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)