// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
callq 0x35f9
movq %rax, %rbx
movq %rax, %rdi
callq 0x36a9
pushq $-0x1
popq %rsi
movl $0x400, %edi            # imm = 0x400
callq 0x2875
movq %rax, 0x8(%rbx)
pushq $0x1
popq %r14
movq %rsp, %r15
movq %r12, %r13
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 (%r13), %eax
cmpl $0xa, %eax
je 0x37fd
cmpl $0x2a, %eax
je 0x37c5
cmpl $0x2f, %eax
je 0x37e0
cmpl $0x5c, %eax
je 0x37d0
testl %eax, %eax
jne 0x37e7
jmp 0x3814
cmpb $0x2f, 0x1(%r13)
jne 0x37e7
xorl %ebp, %ebp
jmp 0x380e
cmpb $0xa, 0x1(%r13)
jne 0x37e7
addq $0x2, %r13
incl 0x10(%rbx)
jmp 0x37a6
cmpb $0x2a, 0x1(%r13)
je 0x380b
testb $0x1, %bpl
jne 0x3806
movq %r15, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x2950
jmp 0x3806
testb $0x1, %bpl
je 0x3814
incl 0x10(%rbx)
incq %r13
jmp 0x37a6
movb $0x1, %bpl
addq $0x2, %r13
jmp 0x37a6
cmpq %r12, %r13
jbe 0x3847
movq (%rsp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x38b5
testq %rax, %rax
je 0x3847
movq %rax, %r12
movq 0x8(%rbx), %rdi
movq %rax, %rsi
pushq $-0x1
popq %rdx
callq 0x2950
movq %r12, %rdi
callq 0x21a0
movq %r15, %rdi
callq 0x2904
cmpb $0x0, (%r13)
je 0x3877
movq 0x8(%rbx), %rdi
leaq 0x78ae(%rip), %rsi      # 0xb10f
pushq $-0x1
popq %rdx
callq 0x2950
incq %r13
incl 0x10(%rbx)
movq %r13, %r12
jmp 0x3782
cmpl $0x0, 0x18(%rbx)
jg 0x38a2
movq 0x8(%rbx), %rax
movq (%rax), %r14
andq $0x0, (%rax)
movq %rbx, %rdi
callq 0x3637
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 0x84a1(%rip), %rdi      # 0xbd4f
xorl %eax, %eax
callq 0x326e