// File: /workspace/github_c_makefile_star2_O1/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 0x70c0
movq %rax, %rbx
movl (%rax), %eax
cmpl $0xc, %eax
ja 0x7559
movl $0x1300, %ecx           # imm = 0x1300
btl %eax, %ecx
jae 0x7559
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14ba8(%rip), %r14     # 0x1c108
movl (%r14), %eax
addl $-0x63, %eax
cmpl $0xa, %eax
ja 0x7547
leaq 0xbcaa(%rip), %rcx      # 0x1321c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r12d, %r12d
movb $0x1, %bpl
jmp 0x75d3
movl $0x4c, %r12d
jmp 0x75d1
movl $0x5a, %r12d
jmp 0x75d1
movl $0x50, %r12d
jmp 0x75d1
movl $0x51, %r12d
jmp 0x75d1
movl $0x53, %r12d
jmp 0x75d1
movl $0x4b, %r12d
jmp 0x75d1
movl $0x4d, %r12d
jmp 0x75d1
movl $0x52, %r12d
jmp 0x75d1
movl $0x5b, %r12d
jmp 0x75d1
movl $0x4a, %r12d
xorl %ebp, %ebp
cmpb $0x0, 0x4(%rbx)
jne 0x75eb
leaq 0x8(%r14), %rdi
leaq 0xc0b7(%rip), %rsi      # 0x1369b
xorl %eax, %eax
callq 0xd56a
callq 0xa9d0
movq %r15, %rdi
callq 0x7520
movq %rax, %r15
testb %bpl, %bpl
je 0x7619
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7703
cmpl $0x4, (%rbx)
movl %r12d, 0x4(%rsp)
jne 0x7629
movq 0x18(%rbx), %r12
jmp 0x762e
movq %rbx, %r12
xorl %ebx, %ebx
movq 0x8(%r12), %rdi
movl 0x10(%r12), %esi
callq 0xd80f
movq %rax, %r13
movl $0x40, %edi
callq 0xe13e
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 0x776b
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7703
movq %rax, %r12
movl $0x4b, %edi
movq %rbp, %rsi
callq 0x776b
testq %rbx, %rbx
je 0x76a2
movq %rax, 0x18(%rbx)
jmp 0x76a5
movq %rax, %rbx
movl 0x4(%rsp), %esi
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x78e0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7703
movq %rax, 0x20(%r12)
movq 0x8(%rbx), %r14
movl $0x40, %edi
callq 0xe13e
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 0x7547