// File: /workspace/github_c_makefile_star2_O0/craigbarnes[P]lua-gumbo/lib/parser.c
// Function: maybe_flush_text_node_buffer
static void maybe_flush_text_node_buffer(GumboParser* parser) {
  GumboParserState* state = parser->_parser_state;
  TextNodeBufferState* buffer_state = &state->_text_node;
  if (buffer_state->_buffer.length == 0) {
    return;
  }

  assert (
    buffer_state->_type == GUMBO_NODE_WHITESPACE
    || buffer_state->_type == GUMBO_NODE_TEXT
    || buffer_state->_type == GUMBO_NODE_CDATA
  );
  GumboNode* text_node = create_node(buffer_state->_type);
  GumboText* text_node_data = &text_node->v.text;
  text_node_data->text = gumbo_string_buffer_to_string(&buffer_state->_buffer);
  text_node_data->original_text.data = buffer_state->_start_original_text;
  text_node_data->original_text.length =
      state->_current_token->original_text.data -
      buffer_state->_start_original_text;
  text_node_data->start_pos = buffer_state->_start_position;

  gumbo_debug (
    "Flushing text node buffer of %.*s.\n",
    (int) buffer_state->_buffer.length,
    buffer_state->_buffer.data
  );

  InsertionLocation location = get_appropriate_insertion_location(parser, NULL);
  if (location.target->type == GUMBO_NODE_DOCUMENT) {
    // The DOM does not allow Document nodes to have Text children, so per the
    // spec, they are dropped on the floor.
    destroy_node(text_node);
  } else {
    insert_node(text_node, location);
  }

  gumbo_string_buffer_clear(&buffer_state->_buffer);
  buffer_state->_type = GUMBO_NODE_WHITESPACE;
  assert(buffer_state->_buffer.length == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x58, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x8064
jmp 0x81bb
movq -0x18(%rbp), %rax
cmpl $0x5, 0x38(%rax)
je 0x8082
movq -0x18(%rbp), %rax
cmpl $0x2, 0x38(%rax)
je 0x8082
movq -0x18(%rbp), %rax
cmpl $0x3, 0x38(%rax)
jne 0x8084
jmp 0x80a3
leaq 0x2af83(%rip), %rdi     # 0x3300e
leaq 0x2ade2(%rip), %rsi     # 0x32e74
movl $0x391, %edx            # imm = 0x391
leaq 0x2aff2(%rip), %rcx     # 0x33090
callq 0x4100
movq -0x18(%rbp), %rax
movl 0x38(%rax), %edi
callq 0x7d10
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5ee0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
subq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq 0x28(%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x30(%rcx), %rcx
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %esi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq 0x2af85(%rip), %rdi     # 0x330c1
movb $0x0, %al
callq 0x7540
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x81d0
movq %rax, -0x38(%rbp)
movl %edx, -0x30(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x816b
movq -0x20(%rbp), %rdi
callq 0x7bf0
jmp 0x817b
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x30(%rbp), %edx
callq 0x8420
movq -0x18(%rbp), %rdi
callq 0x5f40
movq -0x18(%rbp), %rax
movl $0x5, 0x38(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x819c
jmp 0x81bb
leaq 0x2af42(%rip), %rdi     # 0x330e5
leaq 0x2acca(%rip), %rsi     # 0x32e74
movl $0x3ac, %edx            # imm = 0x3AC
leaq 0x2aeda(%rip), %rcx     # 0x33090
callq 0x4100
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)