// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/tre/lib/tre-compile.c
// Function: tre_match_empty
static reg_errcode_t
tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node, int *tags,
		int *assertions, int *params, int *num_tags_seen,
		int *params_seen)
{
  tre_literal_t *lit;
  tre_union_t *uni;
  tre_catenation_t *cat;
  tre_iteration_t *iter;
  int i;
  int bottom = tre_stack_num_objects(stack);
  reg_errcode_t status = REG_OK;
  if (num_tags_seen)
    *num_tags_seen = 0;
  if (params_seen)
    *params_seen = 0;

  status = tre_stack_push_voidptr(stack, node);

  /* Walk through the tree recursively. */
  while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
    {
      node = tre_stack_pop_voidptr(stack);

      switch (node->type)
	{
	case LITERAL:
	  lit = (tre_literal_t *)node->obj;
	  switch (lit->code_min)
	    {
	    case TAG:
	      if (lit->code_max >= 0)
		{
		  if (tags != NULL)
		    {
		      /* Add the tag to `tags'. */
		      for (i = 0; tags[i] >= 0; i++)
			if (tags[i] == lit->code_max)
			  break;
		      if (tags[i] < 0)
			{
			  tags[i] = lit->code_max;
			  tags[i + 1] = -1;
			}
		    }
		  if (num_tags_seen)
		    (*num_tags_seen)++;
		}
	      break;
	    case ASSERTION:
	      assert(lit->code_max >= 1
		     || lit->code_max <= ASSERT_LAST);
	      if (assertions != NULL)
		*assertions |= lit->code_max;
	      break;
	    case PARAMETER:
	      if (params != NULL)
		for (i = 0; i < TRE_PARAM_LAST; i++)
		  params[i] = lit->u.params[i];
	      if (params_seen != NULL)
		*params_seen = 1;
	      break;
	    case EMPTY:
	      break;
	    default:
	      assert(0);
	      break;
	    }
	  break;

	case UNION:
	  /* Subexpressions starting earlier take priority over ones
	     starting later, so we prefer the left subexpression over the
	     right subexpression. */
	  uni = (tre_union_t *)node->obj;
	  if (uni->left->nullable)
	    STACK_PUSHX(stack, voidptr, uni->left)
	  else if (uni->right->nullable)
	    STACK_PUSHX(stack, voidptr, uni->right)
	  else
	    assert(0);
	  break;

	case CATENATION:
	  /* The path must go through both children. */
	  cat = (tre_catenation_t *)node->obj;
	  assert(cat->left->nullable);
	  assert(cat->right->nullable);
	  STACK_PUSHX(stack, voidptr, cat->left);
	  STACK_PUSHX(stack, voidptr, cat->right);
	  break;

	case ITERATION:
	  /* A match with an empty string is preferred over no match at
	     all, so we go through the argument if possible. */
	  iter = (tre_iteration_t *)node->obj;
	  if (iter->arg->nullable)
	    STACK_PUSHX(stack, voidptr, iter->arg);
	  break;

	default:
	  assert(0);
	  break;
	}
    }

  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, 0x10(%rsp)
movq %rdx, (%rsp)
movq %rsi, %r12
movq %rdi, %r13
movq 0x50(%rsp), %r15
callq 0x77b02
movl %eax, %ebp
testq %rbx, %rbx
je 0x7375d
andl $0x0, (%rbx)
movq %rbx, 0x8(%rsp)
testq %r15, %r15
je 0x7376b
andl $0x0, (%r15)
movq %r13, %rdi
movq %r12, %rsi
callq 0x77b9f
movl %eax, %r12d
leaq 0x6cc04(%rip), %r15     # 0xe0384
testl %r12d, %r12d
jne 0x738fc
movq %r13, %rdi
callq 0x77b02
cmpl %ebp, %eax
jle 0x738fc
movq %r13, %rdi
callq 0x77bb8
movl (%rax), %ecx
cmpq $0x3, %rcx
ja 0x7392d
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
movq 0x8(%rax), %rax
movq (%rax), %rcx
addq $0x5, %rcx
cmpq $0x4, %rcx
ja 0x7398a
xorl %r12d, %r12d
leaq 0x6cbbf(%rip), %rdx     # 0xe0394
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
testq %r14, %r14
je 0x738c5
xorl %ecx, %ecx
cmpq $0x9, %rcx
je 0x738c5
movq 0x18(%rax), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%r14,%rcx,4)
incq %rcx
jmp 0x737e9
movq 0x8(%rax), %rax
movq (%rax), %rsi
xorl %r12d, %r12d
cmpl $0x0, 0x10(%rsi)
jne 0x7386a
jmp 0x73780
movq 0x8(%rax), %rax
movq (%rax), %rsi
cmpl $0x0, 0x10(%rsi)
jne 0x7386a
movq 0x8(%rax), %rsi
cmpl $0x0, 0x10(%rsi)
jne 0x7386a
jmp 0x7396b
movq 0x8(%rax), %rbx
movq (%rbx), %rsi
cmpl $0x0, 0x10(%rsi)
je 0x7390e
movq 0x8(%rbx), %rax
cmpl $0x0, 0x10(%rax)
je 0x7394c
movq %r13, %rdi
callq 0x77b9f
movl %eax, %r12d
testl %eax, %eax
jne 0x73780
movq 0x8(%rbx), %rsi
movq %r13, %rdi
callq 0x77b9f
movl %eax, %r12d
jmp 0x73780
cmpq $0x0, 0x10(%rsp)
je 0x73780
movl 0x8(%rax), %eax
movq 0x10(%rsp), %rcx
orl %eax, (%rcx)
jmp 0x73780
movq 0x8(%rax), %rax
testq %rax, %rax
js 0x73780
cmpq $0x0, (%rsp)
movq 0x8(%rsp), %rsi
je 0x738e7
movq (%rsp), %rcx
movslq (%rcx), %rdx
testq %rdx, %rdx
js 0x738e1
addq $0x4, %rcx
cmpq %rdx, %rax
jne 0x738b2
jmp 0x738e7
cmpq $0x0, 0x50(%rsp)
je 0x73780
movq 0x50(%rsp), %rax
movl $0x1, (%rax)
jmp 0x73780
movl %eax, (%rcx)
orl $-0x1, 0x4(%rcx)
testq %rsi, %rsi
je 0x73780
movq 0x8(%rsp), %rax
incl (%rax)
jmp 0x73780
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6ccfe(%rip), %rdi     # 0xe0613
leaq 0x6cab7(%rip), %rsi     # 0xe03d3
leaq 0x6cc8e(%rip), %rcx     # 0xe05b1
movl $0x504, %edx            # imm = 0x504
callq 0xb400
leaq 0x67d0d(%rip), %rdi     # 0xdb641
leaq 0x6ca98(%rip), %rsi     # 0xe03d3
leaq 0x6cc6f(%rip), %rcx     # 0xe05b1
movl $0x513, %edx            # imm = 0x513
callq 0xb400
leaq 0x6ccd4(%rip), %rdi     # 0xe0627
leaq 0x6ca79(%rip), %rsi     # 0xe03d3
leaq 0x6cc50(%rip), %rcx     # 0xe05b1
movl $0x505, %edx            # imm = 0x505
callq 0xb400
leaq 0x67ccf(%rip), %rdi     # 0xdb641
leaq 0x6ca5a(%rip), %rsi     # 0xe03d3
leaq 0x6cc31(%rip), %rcx     # 0xe05b1
movl $0x4fe, %edx            # imm = 0x4FE
callq 0xb400
leaq 0x67cb0(%rip), %rdi     # 0xdb641
leaq 0x6ca3b(%rip), %rsi     # 0xe03d3
leaq 0x6cc12(%rip), %rcx     # 0xe05b1
movl $0x4ef, %edx            # imm = 0x4EF
callq 0xb400