// File: /workspace/github_c_makefile_star2_O3/michaelforney[P]cproc/expr.c
// Function: assignexpr
struct expr *
assignexpr(struct scope *s)
{
	struct expr *e, *l, *r, *tmp, *bit;
	enum tokenkind op;

	l = condexpr(s);
	if (l->kind == EXPRBINARY || l->kind == EXPRCOMMA || l->kind == EXPRCAST)
		return l;
	switch (tok.kind) {
	case TASSIGN:     op = TNONE; break;
	case TMULASSIGN:  op = TMUL;  break;
	case TDIVASSIGN:  op = TDIV;  break;
	case TMODASSIGN:  op = TMOD;  break;
	case TADDASSIGN:  op = TADD;  break;
	case TSUBASSIGN:  op = TSUB;  break;
	case TSHLASSIGN:  op = TSHL;  break;
	case TSHRASSIGN:  op = TSHR;  break;
	case TBANDASSIGN: op = TBAND; break;
	case TXORASSIGN:  op = TXOR;  break;
	case TBORASSIGN:  op = TBOR;  break;
	default:
		return l;
	}
	if (!l->lvalue)
		error(&tok.loc, "left side of assignment expression is not an lvalue");
	next();
	r = assignexpr(s);
	if (!op)
		return mkassignexpr(l, r);
	/* rewrite `E1 OP= E2` as `T = &E1, *T = *T OP E2`, where T is a temporary slot */
	if (l->kind == EXPRBITFIELD) {
		bit = l;
		l = l->base;
	} else {
		bit = NULL;
	}
	tmp = mkexpr(EXPRTEMP, mkpointertype(l->type, l->qual), NULL);
	tmp->lvalue = true;
	tmp->u.temp = NULL;
	e = mkassignexpr(tmp, mkunaryexpr(TBAND, l));
	l = mkunaryexpr(TMUL, tmp);
	if (bit) {
		bit->base = l;
		l = bit;
	}
	r = mkbinaryexpr(&tok.loc, op, l, r);
	e->next = mkassignexpr(l, r);
	return mkexpr(EXPRCOMMA, l->type, e);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
callq 0x6f6b
movq %rax, %rbx
movl (%rax), %eax
cmpl $0xc, %eax
ja 0x7409
movl $0x1300, %ecx           # imm = 0x1300
btl %eax, %ecx
jae 0x7409
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14cf8(%rip), %r14     # 0x1c108
movl (%r14), %eax
addl $-0x63, %eax
cmpl $0xa, %eax
ja 0x73f7
leaq 0xbe5a(%rip), %rcx      # 0x1327c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r12d, %r12d
movb $0x1, %bpl
jmp 0x7483
movl $0x4c, %r12d
jmp 0x7481
movl $0x5a, %r12d
jmp 0x7481
movl $0x50, %r12d
jmp 0x7481
movl $0x51, %r12d
jmp 0x7481
movl $0x53, %r12d
jmp 0x7481
movl $0x4b, %r12d
jmp 0x7481
movl $0x4d, %r12d
jmp 0x7481
movl $0x52, %r12d
jmp 0x7481
movl $0x5b, %r12d
jmp 0x7481
movl $0x4a, %r12d
xorl %ebp, %ebp
cmpb $0x0, 0x4(%rbx)
jne 0x749b
leaq 0x8(%r14), %rdi
leaq 0xc267(%rip), %rsi      # 0x136fb
xorl %eax, %eax
callq 0xd55c
callq 0xa920
movq %r15, %rdi
callq 0x73d0
movq %rax, %r15
testb %bpl, %bpl
je 0x74c9
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x75b3
cmpl $0x4, (%rbx)
movl %r12d, 0x4(%rsp)
jne 0x74d9
movq 0x18(%rbx), %r12
jmp 0x74de
movq %rbx, %r12
xorl %ebx, %ebx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
callq 0xd803
movq %rax, %r13
movl $0x40, %edi
callq 0xe142
movq %rax, %rbp
movl $0x0, 0x10(%rax)
movq %r13, 0x8(%rax)
movl $0xe, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x28(%rax)
movw $0x1, 0x4(%rax)
movl $0x4a, %edi
movq %r12, %rsi
callq 0x761b
movq %rbp, %rdi
movq %rax, %rsi
callq 0x75b3
movq %rax, %r12
movl $0x4b, %edi
movq %rbp, %rsi
callq 0x761b
testq %rbx, %rbx
je 0x7552
movq %rax, 0x18(%rbx)
jmp 0x7555
movq %rax, %rbx
movl 0x4(%rsp), %esi
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x7787
movq %rbx, %rdi
movq %rax, %rsi
callq 0x75b3
movq %rax, 0x20(%r12)
movq 0x8(%rbx), %r14
movl $0x40, %edi
callq 0xe142
movq %rax, %rbx
movl $0x0, 0x10(%rax)
movq %r14, 0x8(%rax)
movw $0x0, 0x4(%rax)
movl $0xc, (%rax)
movq %r12, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
jmp 0x73f7