// File: /workspace/github_c_makefile_star2_O1/michaelforney[P]cproc/decl.c
// Function: addmember
static void
addmember(struct structbuilder *b, struct qualtype mt, char *name, int align, unsigned long long width)
{
	struct type *t = b->type;
	struct member *m;
	size_t end;

	if (t->kind == TYPESTRUCT && t->flexible)
		error(&tok.loc, "struct has member '%s' after flexible array member", name);
	if (mt.type->incomplete) {
		if (mt.type->kind != TYPEARRAY)
			error(&tok.loc, "struct member '%s' has incomplete type", name);
		t->flexible = true;
	}
	if (mt.type->flexible) {
		if (t->kind == TYPESTRUCT)
			error(&tok.loc, "struct member '%s' contains flexible array member", name);
		t->flexible = true;
	}
	if (mt.type->kind == TYPEFUNC)
		error(&tok.loc, "struct member '%s' has function type", name);
	if (mt.type->prop & PROPVM)
		error(&tok.loc, "struct member '%s' has variably modified type", name);
	assert(mt.type->align > 0);
	if (name || width == -1) {
		m = xmalloc(sizeof(*m));
		m->type = mt.type;
		m->qual = mt.qual;
		m->name = name;
		m->next = NULL;
		*b->last = m;
		b->last = &m->next;
	} else {
		m = NULL;
	}
	if (width == -1) {
		m->bits.before = 0;
		m->bits.after = 0;
		if (align < mt.type->align) {
			if (align)
				error(&tok.loc, "specified alignment of struct member '%s' is less strict than is required by type", name);
			align = b->pack ? 1 : mt.type->align;
		}
		if (t->kind == TYPESTRUCT) {
			m->offset = ALIGNUP(t->size, align);
			t->size = m->offset + mt.type->size;
		} else {
			m->offset = 0;
			if (t->size < mt.type->size)
				t->size = mt.type->size;
		}
		b->bits = 0;
	} else {  /* bit-field */
		if (!(mt.type->prop & PROPINT))
			error(&tok.loc, "bit-field '%s' has invalid type", name);
		if (align)
			error(&tok.loc, "alignment specified for bit-field '%s'", name);
		if (b->pack)
			error(&tok.loc, "bit-field '%s' in packed struct is not supported", name);
		if (!width && name)
			error(&tok.loc, "bit-field '%s' with zero width must not have declarator", name);
		if (width > mt.type->size * 8)
			error(&tok.loc, "bit-field '%s' exceeds width of underlying type", name);
		align = mt.type->align;
		if (t->kind == TYPESTRUCT) {
			/* calculate end of the storage-unit for this bit-field */
			end = ALIGNUP(t->size, mt.type->size);
			if (!width || width > (end - t->size) * 8 + b->bits) {
				/* no room, allocate a new storage-unit */
				t->size = end;
				b->bits = 0;
			}
			if (m) {
				m->offset = ALIGNDOWN(t->size - !!b->bits, mt.type->size);
				m->bits.before = (t->size - m->offset) * 8 - b->bits;
				m->bits.after = mt.type->size * 8 - width - m->bits.before;
			}
			t->size += (width - b->bits + 7) / 8;
			b->bits = (b->bits - width) % 8;
		} else if (m) {
			m->offset = 0;
			m->bits.before = 0;
			m->bits.after = mt.type->size * 8 - width;
			if (t->size < mt.type->size)
				t->size = mt.type->size;
		}
	}
	if (m && t->align < align)
		t->align = align;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %edx, 0x4(%rsp)
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x40(%rsp), %r15
movq (%rdi), %r13
cmpl $0xf, (%r13)
jne 0x596d
cmpb $0x1, 0x3d(%r13)
jne 0x596d
leaq 0x167b0(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd04b(%rip), %rsi      # 0x129ae
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
movq (%r15), %rbp
cmpb $0x1, 0x3c(%rbp)
jne 0x599d
cmpl $0xd, (%rbp)
je 0x5998
leaq 0x16785(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd053(%rip), %rsi      # 0x129e1
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
movb $0x1, 0x3d(%r13)
cmpb $0x1, 0x3d(%rbp)
jne 0x59cb
cmpl $0xf, (%r13)
jne 0x59c6
leaq 0x16757(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd04c(%rip), %rsi      # 0x12a08
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
movb $0x1, 0x3d(%r13)
cmpl $0xe, (%rbp)
jne 0x59ed
leaq 0x16730(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd057(%rip), %rsi      # 0x12a3a
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
testb $0x40, 0x4(%rbp)
je 0x5a0f
leaq 0x1670e(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd05a(%rip), %rsi      # 0x12a5f
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
cmpl $0x0, 0x8(%rbp)
jle 0x5cb3
testq %r12, %r12
sete %al
cmpq $-0x1, %r14
setne %cl
testb %cl, %al
jne 0x5a61
movl $0x30, %edi
callq 0xe13e
movq %r15, %rcx
movq %rax, %r15
movq %rbp, 0x8(%rax)
movl 0x8(%rcx), %eax
movl %eax, 0x10(%r15)
movq %r12, (%r15)
leaq 0x28(%r15), %rax
movq $0x0, 0x28(%r15)
movq 0x8(%rbx), %rcx
movq %r15, (%rcx)
movq %rax, 0x8(%rbx)
jmp 0x5a64
xorl %r15d, %r15d
cmpq $-0x1, %r14
je 0x5bd7
testb $0x2, 0x4(%rbp)
jne 0x5a90
leaq 0x1668d(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd0c5(%rip), %rsi      # 0x12b4b
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
cmpl $0x0, 0x4(%rsp)
je 0x5ab3
leaq 0x1666a(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd0c2(%rip), %rsi      # 0x12b6b
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
cmpb $0x1, 0x14(%rbx)
jne 0x5ad5
leaq 0x16648(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd0c7(%rip), %rsi      # 0x12b92
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
testq %r12, %r12
sete %al
testq %r14, %r14
setne %cl
orb %al, %cl
jne 0x5b01
leaq 0x1661c(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd0cc(%rip), %rsi      # 0x12bc3
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
movq 0x10(%rbp), %rax
shlq $0x3, %rax
cmpq %r14, %rax
jae 0x5b2a
leaq 0x165f3(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xd0db(%rip), %rsi      # 0x12bfb
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
movl 0x8(%rbp), %r8d
cmpl $0xf, (%r13)
jne 0x5c45
movq 0x10(%r13), %rcx
movq 0x10(%rbp), %rax
leaq (%rcx,%rax), %rdx
decq %rdx
negq %rax
andq %rdx, %rax
testq %r14, %r14
je 0x5b65
movq %rax, %rdx
subq %rcx, %rdx
movl 0x10(%rbx), %ecx
leaq (%rcx,%rdx,8), %rcx
cmpq %r14, %rcx
jae 0x5b70
movq %rax, 0x10(%r13)
movl $0x0, 0x10(%rbx)
testq %r15, %r15
je 0x5bb4
movq 0x10(%r13), %rax
movl 0x10(%rbx), %ecx
cmpq $0x1, %rcx
movq %rax, %rdx
adcq $-0x1, %rdx
movq 0x10(%rbp), %rsi
movq %rsi, %rdi
negq %rdi
andq %rdx, %rdi
movq %rdi, 0x18(%r15)
subq %rdi, %rax
shlq $0x3, %rax
subq %rcx, %rax
movw %ax, 0x20(%r15)
shll $0x3, %esi
addl %r14d, %eax
subl %eax, %esi
movw %si, 0x22(%r15)
movl 0x10(%rbx), %eax
movq %r14, %rcx
subq %rax, %rcx
addq $0x7, %rcx
shrq $0x3, %rcx
addq %rcx, 0x10(%r13)
subl %r14d, %eax
andl $0x7, %eax
movl %eax, 0x10(%rbx)
jmp 0x5c95
movl $0x0, 0x20(%r15)
movl 0x4(%rsp), %r8d
cmpl %r8d, 0x8(%rbp)
jle 0x5c1b
testl %r8d, %r8d
je 0x5c0b
leaq 0x16512(%rip), %rdi     # 0x1c108
addq $0x8, %rdi
leaq 0xcef8(%rip), %rsi      # 0x12af9
movq %r12, %rdx
xorl %eax, %eax
callq 0xd56a
movl $0x1, %r8d
cmpb $0x0, 0x14(%rbx)
jne 0x5c1b
movl 0x8(%rbp), %r8d
cmpl $0xf, (%r13)
jne 0x5c78
movq 0x10(%r13), %rax
movslq %r8d, %rcx
addq %rcx, %rax
decq %rax
negl %ecx
movslq %ecx, %rcx
andq %rax, %rcx
movq %rcx, 0x18(%r15)
addq 0x10(%rbp), %rcx
movq %rcx, 0x10(%r13)
jmp 0x5c8e
testq %r15, %r15
je 0x5c95
movq $0x0, 0x18(%r15)
movw $0x0, 0x20(%r15)
movq 0x10(%rbp), %rax
leal (,%rax,8), %ecx
subl %r14d, %ecx
movw %cx, 0x22(%r15)
cmpq %rax, 0x10(%r13)
jae 0x5c95
movq %rax, 0x10(%r13)
jmp 0x5c95
movq $0x0, 0x18(%r15)
movq 0x10(%rbp), %rax
cmpq %rax, 0x10(%r13)
jae 0x5c8e
movq %rax, 0x10(%r13)
movl $0x0, 0x10(%rbx)
testq %r15, %r15
je 0x5ca4
cmpl %r8d, 0x8(%r13)
jge 0x5ca4
movl %r8d, 0x8(%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcdd3(%rip), %rdi      # 0x12a8d
leaq 0xc80a(%rip), %rsi      # 0x124cb
leaq 0xcdd8(%rip), %rcx      # 0x12aa0
movl $0x2fb, %edx            # imm = 0x2FB
callq 0x30e0