// File: /workspace/github_cpp_makefile_star2_O1/exrd[P]neteruhsp/neteruhsp/neteruhsp.cc
// Function: neteruhsp::prepro_do(char const*)
char* prepro_do( const char* src )
{
	auto* pctx = create_prepro_context();
	prepro_register_default_macros( pctx );
	pctx->out_buffer_ = create_string_buffer();

	const char* p = src;
	for ( ; ; )
	{
		const char* const s = p;

		string_buffer_t line;
		initialize_string_buffer( &line );

		{
			bool is_in_multi_line_comment = false;
			for ( ; ; )
			{
				if ( p[0] == '/' && p[1] == '*' )
				{
					is_in_multi_line_comment = true;
					p += 2;
					continue;
				}
				else if ( p[0] == '*' && p[1] == '/' )
				{
					is_in_multi_line_comment = false;
					p += 2;
					continue;
				}
				else if ( p[0] == '\\' && p[1] == '\n' )
				{
					p += 2;
					++pctx->line_;
					continue;
				}
				else if ( p[0] == '\n' )
				{
					if ( !is_in_multi_line_comment )
					{
						break;
					}
					++pctx->line_;
				}
				else if ( p[0] == '\0' )
				{
					break;
				}
				if ( !is_in_multi_line_comment )
				{
					string_buffer_append( &line, p, 1 );
				}
				++p;
			}
		}

		const char* const e = p;

		if ( e > s )
		{
			auto* out_line = prepro_line( pctx, line.buffer_, true );

			if ( out_line != nullptr )
			{
				string_buffer_append( pctx->out_buffer_, out_line );
				destroy_string( out_line );
			}
		}

		uninitialize_string_buffer( &line );

		if ( p[0] == '\0' )
		{
			break;
		}

		string_buffer_append( pctx->out_buffer_, "\n" );

		++p;
		++pctx->line_;
	}

	if ( pctx->pp_region_idx_ > 0 )
	{
		raise_error( "プリプロセス：#if-#endifリージョンが正しく閉じられていません：閉じられていないリージョンの始まり（%d行目）", pctx->pp_region_[0].line_ + 1 );
		return nullptr;
	}

	// 抜き取り
	auto* const res = pctx->out_buffer_->buffer_;
	pctx->out_buffer_->buffer_ = nullptr;
	destroy_prepro_context( pctx );

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r13
callq 0x38e6
movq %rax, %rbx
movq %rax, %rdi
callq 0x39c0
movl $0x18, %edi
callq 0x21d0
movq %rax, %r14
movl $0x401, %edi            # imm = 0x401
callq 0x21d0
movq %rax, (%r14)
movq $0x400, 0x8(%r14)       # imm = 0x400
movl $0xffffffff, 0x10(%r14) # imm = 0xFFFFFFFF
movb $0x0, (%rax)
movq %r14, 0x8(%rbx)
movq %rsp, %r14
leaq 0x9612(%rip), %r15      # 0xd150
movq %r13, %r12
movl $0x401, %edi            # imm = 0x401
callq 0x21d0
movq %rax, (%rsp)
movq $0x400, 0x8(%rsp)       # imm = 0x400
movl $0x400, 0x10(%rsp)      # imm = 0x400
movb $0x0, (%rax)
xorl %ebp, %ebp
movzbl (%r12), %eax
cmpl $0x2e, %eax
jg 0x3b8d
cmpl $0xa, %eax
je 0x3bc6
cmpl $0x2a, %eax
jne 0x3bd1
cmpb $0x2f, 0x1(%r12)
je 0x3bf3
cmpl $0xa, %eax
je 0x3bc6
cmpl $0x5c, %eax
jne 0x3bd1
jmp 0x3bb0
cmpl $0x5c, %eax
je 0x3bb0
cmpl $0x2f, %eax
jne 0x3bd5
cmpb $0x2a, 0x1(%r12)
je 0x3bf7
cmpl $0x29, %eax
jle 0x3bc1
cmpl $0x5c, %eax
je 0x3bb0
cmpl $0x2a, %eax
je 0x3b79
jmp 0x3bd5
cmpb $0xa, 0x1(%r12)
jne 0x3bc1
addq $0x2, %r12
incl 0x10(%rbx)
jmp 0x3b65
cmpl $0xa, %eax
jne 0x3bd1
testb $0x1, %bpl
je 0x3c03
incl 0x10(%rbx)
jmp 0x3bd5
testl %eax, %eax
je 0x3c03
testb $0x1, %bpl
jne 0x3beb
movq %r14, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2a6d
incq %r12
jmp 0x3b65
xorl %ebp, %ebp
jmp 0x3bfa
movb $0x1, %bpl
addq $0x2, %r12
jmp 0x3b65
cmpq %r13, %r12
jbe 0x3c3a
movq (%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x3cce
testq %rax, %rax
je 0x3c3a
movq %rax, %r13
movq 0x8(%rbx), %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2a6d
movq %r13, %rdi
callq 0x21a0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x3c50
callq 0x21a0
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movb (%r12), %bpl
testb %bpl, %bpl
je 0x3c81
movq 0x8(%rbx), %rdi
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2a6d
incq %r12
incl 0x10(%rbx)
movq %r12, %r13
testb %bpl, %bpl
jne 0x3b41
cmpl $0x0, 0x18(%rbx)
jg 0x3cbb
movq 0x8(%rbx), %rax
movq (%rax), %r14
movq $0x0, (%rax)
movq %rbx, %rdi
callq 0x3931
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x20(%rbx), %esi
incl %esi
leaq 0xa0fa(%rip), %rdi      # 0xddc1
xorl %eax, %eax
callq 0x34a8