// File: /workspace/github_cpp_makefile_star2_O3/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 0x3845
movq %rax, %rbx
movq %rax, %rdi
callq 0x3919
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)
leaq 0x869a(%rip), %r14      # 0xc10f
movq %rsp, %r15
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 0x3abf
cmpl $0xa, %eax
je 0x3ada
cmpl $0x2a, %eax
jne 0x3af6
cmpb $0x2f, 0x1(%r12)
jne 0x3afa
xorl %ebp, %ebp
jmp 0x3ad4
cmpl $0x5c, %eax
je 0x3ae5
cmpl $0x2f, %eax
jne 0x3afa
cmpb $0x2a, 0x1(%r12)
jne 0x3afa
movb $0x1, %bpl
addq $0x2, %r12
jmp 0x3a9f
testb $0x1, %bpl
je 0x3b15
incl 0x10(%rbx)
jmp 0x3b10
cmpb $0xa, 0x1(%r12)
jne 0x3afa
addq $0x2, %r12
incl 0x10(%rbx)
jmp 0x3a9f
testl %eax, %eax
je 0x3b15
testb $0x1, %bpl
jne 0x3b10
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2a19
incq %r12
jmp 0x3a9f
movq (%rsp), %rbp
cmpq %r13, %r12
jbe 0x3b4f
movq %rbx, %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq 0x3bdc
testq %rax, %rax
je 0x3b4f
movq %rax, %r13
movq 0x8(%rbx), %rdi
movq %rax, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2a19
movq %r13, %rdi
callq 0x21a0
testq %rbp, %rbp
je 0x3b64
movq %rbp, %rdi
callq 0x21a0
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
cmpb $0x0, (%r12)
je 0x3b9b
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2a19
incq %r12
incl 0x10(%rbx)
movq %r12, %r13
jmp 0x3a7b
cmpl $0x0, 0x18(%rbx)
jg 0x3bc9
movq 0x8(%rbx), %rax
movq (%rax), %r14
movq $0x0, (%rax)
movq %rbx, %rdi
callq 0x388f
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 0x917a(%rip), %rdi      # 0xcd4f
xorl %eax, %eax
callq 0x344d