// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]gh_cpp/Src/gh_cpp1.c
// Function: check_body_type
static void
check_body_type(TS *b)
{	TS *w, *w_lst = (TS *) 0;
	int r_cnt = 0, c_cnt = 0, s_cnt = 0;

	/* misra 19.4 restricts macros to:
	 *	braced initializer
	 *	constant
	 *	parenthesized expression
	 *	type qualifier	
	 *	storage class specifier	such as extern, static, const, ...
	 *	do-while(0)
	 * furthermore:
	 *	(), {}, [] braces must balance
	 *	no use of ';' at end of macro
	 */

	if (!b) return;

	for (w = b; w; w_lst = w, w = w->nxt)
		if (w->tok == CHAR)
			switch(w->val) {
			case '(': r_cnt++; break;
			case ')': r_cnt--; break;
			case '{': c_cnt++; break;
			case '}': c_cnt--; break;
			case '[': s_cnt++; break;
			case ']': s_cnt--; break;
			}

	if (r_cnt != 0 || s_cnt != 0 || c_cnt != 0)
		m_rule(19, 40, "unbalanced use of braces in macro body");

	/* Note: list is in reversed order...! */

	if (b && b->tok == CHAR && b->val == ';')
		m_rule(19, 4, "semi-colon at end of macro body");

	if (!b->nxt		/* single token */
	&&  (b->tok == VAL	/* constant */
	 ||  b->tok == NAME))	/* name, string, char constant */
		return;

	if (b->tok == CHAR	/* parenthesized expression.. sort of */
	&&  b->val == ')'
	&&  w_lst
	&&  w_lst->tok == CHAR
	&&  w_lst->val == '(')
		return;

	if (b->tok == CHAR	/* braced initializer.. sort of */
	&&  b->val == '}'
	&&  w_lst
	&&  w_lst->tok == CHAR
	&&  w_lst->val == '{')
		return;

	if (w_lst
	&&  w_lst->tok == NAME	/* do-while(0) construct */
	&&  strcmp(w_lst->name, "do") == 0
	&&  b
	&&  b->tok == ')'
	&&  b->nxt
	&&  b->nxt->tok == VAL
	&&  b->nxt->val == 0
	&&  b->nxt->nxt
	&&  b->nxt->nxt->tok == CHAR
	&&  b->nxt->nxt->val == '('
	&&  b->nxt->nxt->nxt
	&&  b->nxt->nxt->nxt->tok == NAME
	&&  strcmp(b->nxt->nxt->nxt->name, "while") == 0)
		return;

	if (strcmp(filename, "<predef>") != 0)
		m_rule(19, 4, "possibly non-compliant macro type");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x7b35
jmp 0x7e01
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7bf5
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7bda
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
subl $0x28, %eax
je 0x7b98
jmp 0x7b66
movl -0x28(%rbp), %eax
subl $0x29, %eax
je 0x7ba3
jmp 0x7b70
movl -0x28(%rbp), %eax
subl $0x5b, %eax
je 0x7bc4
jmp 0x7b7a
movl -0x28(%rbp), %eax
subl $0x5d, %eax
je 0x7bcf
jmp 0x7b84
movl -0x28(%rbp), %eax
subl $0x7b, %eax
je 0x7bae
jmp 0x7b8e
movl -0x28(%rbp), %eax
subl $0x7d, %eax
je 0x7bb9
jmp 0x7bd8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7bd8
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7bd8
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7bd8
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7bd8
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7bd8
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7bda
jmp 0x7bdc
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x7b3d
cmpl $0x0, -0x1c(%rbp)
jne 0x7c07
cmpl $0x0, -0x24(%rbp)
jne 0x7c07
cmpl $0x0, -0x20(%rbp)
je 0x7c1d
movl $0x13, %edi
movl $0x28, %esi
leaq 0x921a(%rip), %rdx      # 0x10e32
callq 0xca50
cmpq $0x0, -0x8(%rbp)
je 0x7c4d
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7c4d
movq -0x8(%rbp), %rax
cmpl $0x3b, 0x4(%rax)
jne 0x7c4d
movl $0x13, %edi
movl $0x4, %esi
leaq 0x9211(%rip), %rdx      # 0x10e59
callq 0xca50
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x7c6f
movq -0x8(%rbp), %rax
cmpl $0x4, (%rax)
je 0x7c6a
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x7c6f
jmp 0x7e01
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7ca1
movq -0x8(%rbp), %rax
cmpl $0x29, 0x4(%rax)
jne 0x7ca1
cmpq $0x0, -0x18(%rbp)
je 0x7ca1
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7ca1
movq -0x18(%rbp), %rax
cmpl $0x28, 0x4(%rax)
jne 0x7ca1
jmp 0x7e01
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7cd3
movq -0x8(%rbp), %rax
cmpl $0x7d, 0x4(%rax)
jne 0x7cd3
cmpq $0x0, -0x18(%rbp)
je 0x7cd3
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7cd3
movq -0x18(%rbp), %rax
cmpl $0x7b, 0x4(%rax)
jne 0x7cd3
jmp 0x7e01
cmpq $0x0, -0x18(%rbp)
je 0x7dd3
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x7dd3
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x917f(%rip), %rsi      # 0x10e79
callq 0x4100
cmpl $0x0, %eax
jne 0x7dd3
cmpq $0x0, -0x8(%rbp)
je 0x7dd3
movq -0x8(%rbp), %rax
cmpl $0x29, (%rax)
jne 0x7dd3
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x4, (%rax)
jne 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x0, 0x4(%rax)
jne 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x28(%rax)
je 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
cmpl $0x2, (%rax)
jne 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
cmpl $0x28, 0x4(%rax)
jne 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x28(%rax)
je 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
cmpl $0x1, (%rax)
jne 0x7dd3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x90b5(%rip), %rsi      # 0x10e7c
callq 0x4100
cmpl $0x0, %eax
jne 0x7dd3
jmp 0x7e01
movq 0xc316(%rip), %rdi      # 0x140f0
leaq 0x5637(%rip), %rsi      # 0xd418
callq 0x4100
cmpl $0x0, %eax
je 0x7e01
movl $0x13, %edi
movl $0x4, %esi
leaq 0x9086(%rip), %rdx      # 0x10e82
callq 0xca50
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)