// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/expr.c
// Function: postfixexpr
static struct expr *
postfixexpr(struct scope *s, struct expr *r)
{
	struct expr *e, *arr, *idx, *tmp, **end;
	struct type *t;
	struct decl *p;
	struct member *m;
	unsigned long long offset;
	enum typequal tq;
	enum tokenkind op;
	bool lvalue;

	if (!r)
		r = primaryexpr(s);
	for (;;) {
		switch (tok.kind) {
		case TLBRACK:  /* subscript */
			next();
			arr = r;
			idx = expr(s);
			if (arr->type->kind != TYPEPOINTER) {
				if (idx->type->kind != TYPEPOINTER)
					error(&tok.loc, "either array or index must be pointer type");
				tmp = arr;
				arr = idx;
				idx = tmp;
			}
			if (arr->type->base->incomplete)
				error(&tok.loc, "array is pointer to incomplete type");
			if (!(idx->type->prop & PROPINT))
				error(&tok.loc, "index is not an integer type");
			e = mkunaryexpr(TMUL, mkbinaryexpr(&tok.loc, TADD, arr, idx));
			expect(TRBRACK, "after array index");
			break;
		case TLPAREN:  /* function call */
			next();
			if (r->kind == EXPRIDENT && r->u.ident.decl->kind == DECLBUILTIN) {
				e = builtinfunc(s, r->u.ident.decl->u.builtin);
				expect(TRPAREN, "after builtin parameters");
				break;
			}
			if (r->type->kind != TYPEPOINTER || r->type->base->kind != TYPEFUNC)
				error(&tok.loc, "called object is not a function");
			t = r->type->base;
			e = mkexpr(EXPRCALL, t->base, r);
			e->u.call.args = NULL;
			e->u.call.nargs = 0;
			p = t->u.func.params;
			end = &e->u.call.args;
			while (tok.kind != TRPAREN) {
				if (e->u.call.args)
					expect(TCOMMA, "or ')' after function call argument");
				if (!p && !t->u.func.isvararg)
					error(&tok.loc, "too many arguments for function call");
				*end = assignexpr(s);
				if (t->u.func.isvararg && !p)
					*end = exprpromote(*end);
				else
					*end = exprassign(*end, p->type);
				end = &(*end)->next;
				++e->u.call.nargs;
				if (p)
					p = p->next;
			}
			if (p && !t->u.func.isvararg)
				error(&tok.loc, "not enough arguments for function call");
			e = decay(e);
			next();
			break;
		case TPERIOD:
			r = mkunaryexpr(TBAND, r);
			/* fallthrough */
		case TARROW:
			op = tok.kind;
			if (r->type->kind != TYPEPOINTER)
				error(&tok.loc, "'%s' operator must be applied to pointer to struct/union", tokstr[op]);
			t = r->type->base;
			tq = r->type->qual;
			if (t->kind != TYPESTRUCT && t->kind != TYPEUNION)
				error(&tok.loc, "'%s' operator must be applied to pointer to struct/union", tokstr[op]);
			next();
			if (tok.kind != TIDENT)
				error(&tok.loc, "expected identifier after '%s' operator", tokstr[op]);
			lvalue = op == TARROW || r->base->lvalue;
			offset = 0;
			m = typemember(t, tok.lit, &offset);
			if (!m)
				error(&tok.loc, "struct/union has no member named '%s'", tok.lit);
			r = mkbinaryexpr(&tok.loc, TADD, exprconvert(r, &typeulong), mkconstexpr(&typeulong, offset));
			r->type = mkpointertype(m->type, tq | m->qual);
			r = mkunaryexpr(TMUL, r);
			r->lvalue = lvalue;
			if (m->bits.before || m->bits.after) {
				e = mkexpr(EXPRBITFIELD, r->type, r);
				e->lvalue = lvalue;
				e->u.bitfield.bits = m->bits;
			} else {
				e = r;
			}
			next();
			break;
		case TINC:
		case TDEC:
			e = mkincdecexpr(tok.kind, r, true);
			next();
			break;
		default:
			return r;
		}
		r = e;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa0a7
movq -0x8(%rbp), %rdi
callq 0xabf0
movq %rax, -0x10(%rbp)
jmp 0xa0a9
leaq 0x180f8(%rip), %rax     # 0x221a8
movl (%rax), %eax
addl $-0x40, %eax
movl %eax, %ecx
movq %rcx, -0x70(%rbp)
subl $0x9, %eax
ja 0xa639
movq -0x70(%rbp), %rax
leaq 0xf48d(%rip), %rcx      # 0x1955c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0xd540
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8f10
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xc, (%rax)
je 0xa13d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xc, (%rax)
je 0xa125
leaq 0x18095(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xfb3b(%rip), %rsi      # 0x19c59
movb $0x0, %al
callq 0x11190
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
testb $0x1, 0x3c(%rax)
je 0xa168
leaq 0x18052(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xfb23(%rip), %rsi      # 0x19c84
movb $0x0, %al
callq 0x11190
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xa194
leaq 0x18026(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xfb1b(%rip), %rsi      # 0x19ca8
movb $0x0, %al
callq 0x11190
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x18005(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
movl $0x4c, %esi
callq 0x95f0
movq %rax, %rsi
movl $0x4b, %edi
callq 0x9410
movq %rax, -0x18(%rbp)
movl $0x41, %edi
leaq 0xfaf7(%rip), %rsi      # 0x19cc5
callq 0xd8d0
jmp 0xa646
callq 0xd540
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xa222
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0x4, 0x8(%rax)
jne 0xa222
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl 0x40(%rax), %esi
callq 0xb1b0
movq %rax, -0x18(%rbp)
movl $0x43, %edi
leaq 0xfabf(%rip), %rsi      # 0x19cd7
callq 0xd8d0
jmp 0xa646
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xc, (%rax)
jne 0xa240
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
cmpl $0xe, (%rax)
je 0xa259
leaq 0x17f61(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xfa9e(%rip), %rsi      # 0x19cf0
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rdx
movl $0x3, %edi
callq 0x9040
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x38(%rbp)
leaq 0x17eee(%rip), %rax     # 0x221a8
cmpl $0x43, (%rax)
je 0xa39a
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0xa2df
movl $0x6e, %edi
leaq 0xfa36(%rip), %rsi      # 0x19d10
callq 0xd8d0
cmpq $0x0, -0x48(%rbp)
jne 0xa309
movq -0x40(%rbp), %rax
testb $0x1, 0x40(%rax)
jne 0xa309
leaq 0x17eb1(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xfa32(%rip), %rsi      # 0x19d34
movb $0x0, %al
callq 0x11190
movq -0x8(%rbp), %rdi
callq 0x9170
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0xa345
cmpq $0x0, -0x48(%rbp)
jne 0xa345
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x82f0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0xa363
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x7ff0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
addq $0x20, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
cmpq $0x0, -0x48(%rbp)
je 0xa395
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xa2b3
cmpq $0x0, -0x48(%rbp)
je 0xa3c4
movq -0x40(%rbp), %rax
testb $0x1, 0x40(%rax)
jne 0xa3c4
leaq 0x17df6(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xf99c(%rip), %rsi      # 0x19d59
movb $0x0, %al
callq 0x11190
movq -0x18(%rbp), %rdi
callq 0xa660
movq %rax, -0x18(%rbp)
callq 0xd540
jmp 0xa646
movq -0x10(%rbp), %rsi
movl $0x4a, %edi
callq 0x9410
movq %rax, -0x10(%rbp)
leaq 0x17db4(%rip), %rax     # 0x221a8
movl (%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xc, (%rax)
je 0xa42f
movl -0x60(%rbp), %eax
movl %eax, %ecx
leaq 0x1729e(%rip), %rax     # 0x216b0
movq (%rax,%rcx,8), %rdx
leaq 0x17d8b(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xf958(%rip), %rsi      # 0x19d80
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x40(%rbp), %rax
cmpl $0xf, (%rax)
je 0xa488
movq -0x40(%rbp), %rax
cmpl $0x10, (%rax)
je 0xa488
movl -0x60(%rbp), %eax
movl %eax, %ecx
leaq 0x17245(%rip), %rax     # 0x216b0
movq (%rax,%rcx,8), %rdx
leaq 0x17d32(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xf8ff(%rip), %rsi      # 0x19d80
movb $0x0, %al
callq 0x11190
callq 0xd540
leaq 0x17d14(%rip), %rax     # 0x221a8
cmpl $0x4, (%rax)
je 0xa4c2
movl -0x60(%rbp), %eax
movl %eax, %ecx
leaq 0x1720b(%rip), %rax     # 0x216b0
movq (%rax,%rcx,8), %rdx
leaq 0x17cf8(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xf8fe(%rip), %rsi      # 0x19db9
movb $0x0, %al
callq 0x11190
movb $0x1, %al
cmpl $0x47, -0x60(%rbp)
movb %al, -0x71(%rbp)
je 0xa4db
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movb 0x4(%rax), %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
andb $0x1, %al
movb %al, -0x61(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
leaq 0x17cb2(%rip), %rax     # 0x221a8
movq 0x20(%rax), %rsi
leaq -0x58(%rbp), %rdx
callq 0x11f70
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xa532
leaq 0x17c93(%rip), %rax     # 0x221a8
movq 0x20(%rax), %rdx
leaq 0x17c88(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0xf8b6(%rip), %rsi      # 0x19de1
movb $0x0, %al
callq 0x11190
movq -0x10(%rbp), %rdi
leaq 0x1786b(%rip), %rsi     # 0x21da8
callq 0x8290
movq %rax, -0x80(%rbp)
movq -0x58(%rbp), %rsi
leaq 0x17857(%rip), %rdi     # 0x21da8
callq 0xb820
movq -0x80(%rbp), %rdx
movq %rax, %rcx
leaq 0x17c44(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
movl $0x4c, %esi
callq 0x95f0
movq %rax, -0x10(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x5c(%rbp), %esi
movq -0x50(%rbp), %rax
orl 0x10(%rax), %esi
callq 0x11760
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rsi
movl $0x4b, %edi
callq 0x9410
movq %rax, -0x10(%rbp)
movb -0x61(%rbp), %cl
movq -0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x4(%rax)
movq -0x50(%rbp), %rax
movswl 0x20(%rax), %eax
cmpl $0x0, %eax
jne 0xa5d1
movq -0x50(%rbp), %rax
movswl 0x22(%rax), %eax
cmpl $0x0, %eax
je 0xa608
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
movl $0x4, %edi
callq 0x9040
movq %rax, -0x18(%rbp)
movb -0x61(%rbp), %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x4(%rax)
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
movl 0x20(%rcx), %ecx
movl %ecx, 0x30(%rax)
jmp 0xa610
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
callq 0xd540
jmp 0xa646
leaq 0x17b8a(%rip), %rax     # 0x221a8
movl (%rax), %edi
movq -0x10(%rbp), %rsi
movl $0x1, %edx
callq 0xb860
movq %rax, -0x18(%rbp)
callq 0xd540
jmp 0xa646
movq -0x10(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0xa0a9
nopw %cs:(%rax,%rax)