// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/preprocessor/preprocessor.c
// Function: pp_process
void pp_process(
	const char *file,
	const char *include_paths,
	const char *source,
	int len,
	Map *defs,
	FILE *out,
	ResizableString *result
) {
	assert(file);
	assert(include_paths);
	assert(source);
	assert(defs);
	assert(out != NULL || result != NULL);

	ResizableString rstr_comment_removed;
	rstr_init(&rstr_comment_removed);
	pp_comment_process(
		&rstr_comment_removed,
		file,
		source,
		len
	);

	ResizableString rstr_line_concated;
	rstr_init(&rstr_line_concated);
	pp_line_concat_process(
		&rstr_line_concated,
		file,
		RSTR_CSTR(&rstr_comment_removed),
		RSTR_LEN(&rstr_comment_removed)
	);

	rstr_free(&rstr_comment_removed);
	
	ParserContext *psrctx = pp_parser_new_context(
		file,
		RSTR_CSTR(&rstr_line_concated),
		RSTR_LEN(&rstr_line_concated)
	);
	pp_parser_parse(psrctx);

	PPGeneratorContext *genctx = pp_gen_new_context(
		psrctx, include_paths, NULL, NULL, out, result
	);

	MapEntryIterator iter;
	map_iter_init(defs, &iter);
	MapEntry *entry = NULL;
	while ((entry = map_iter_next(defs, &iter)) != NULL) {
		pp_gen_define(genctx, entry->key, entry->value);
	}

	pp_gen_generate(genctx);
	pp_gen_free_context(genctx);

	pp_parser_free_context(psrctx);

	rstr_free(&rstr_line_concated);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
je 0x2d5a2
testq %rsi, %rsi
je 0x2d5c1
movq %rdx, %r14
testq %rdx, %rdx
je 0x2d5e0
movq %r8, %rbx
testq %r8, %r8
je 0x2d5ff
movq %rsi, -0x38(%rbp)
movq %r9, %rax
orq 0x10(%rbp), %rax
movq %r9, -0x30(%rbp)
je 0x2d61e
movl %ecx, %r13d
movq %rdi, %r12
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0xe468
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %r13d, %ecx
callq 0x24b28
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0xe468
movq 0x8(%r15), %rdx
testq %rdx, %rdx
leaq 0x22cd(%rip), %r13      # 0x2f7b6
cmoveq %r13, %rdx
movl 0x4(%r15), %ecx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2c277
movq %r15, %rdi
callq 0xe958
movq 0x8(%r14), %rsi
testq %rsi, %rsi
cmoveq %r13, %rsi
movl 0x4(%r14), %edx
movq %r12, %rdi
callq 0x2c2f0
movq %rax, %r12
movq %rax, %rdi
callq 0x2c3ca
movq %r12, %rdi
movq -0x38(%rbp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq -0x30(%rbp), %r8
movq 0x10(%rbp), %r9
callq 0x289e7
movq %rax, %r14
leaq -0x40(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc988
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc9dc
testq %rax, %rax
je 0x2d572
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r14, %rdi
callq 0x28cc3
jmp 0x2d550
movq %r14, %rdi
callq 0x2893c
movq %r14, %rdi
callq 0x28c38
movq %r12, %rdi
callq 0x2c387
leaq -0x50(%rbp), %rdi
callq 0xe958
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1470(%rip), %rdi      # 0x2ea19
leaq 0xa6d6(%rip), %rsi      # 0x37c86
leaq 0xa6f4(%rip), %rcx      # 0x37cab
movl $0x17, %edx
callq 0xa0b0
leaq 0x94b8(%rip), %rdi      # 0x36a80
leaq 0xa6b7(%rip), %rsi      # 0x37c86
leaq 0xa6d5(%rip), %rcx      # 0x37cab
movl $0x18, %edx
callq 0xa0b0
leaq 0xf5f(%rip), %rdi       # 0x2e546
leaq 0xa698(%rip), %rsi      # 0x37c86
leaq 0xa6b6(%rip), %rcx      # 0x37cab
movl $0x19, %edx
callq 0xa0b0
leaq 0xa706(%rip), %rdi      # 0x37d0c
leaq 0xa679(%rip), %rsi      # 0x37c86
leaq 0xa697(%rip), %rcx      # 0x37cab
movl $0x1a, %edx
callq 0xa0b0
leaq 0x9469(%rip), %rdi      # 0x36a8e
leaq 0xa65a(%rip), %rsi      # 0x37c86
leaq 0xa678(%rip), %rcx      # 0x37cab
movl $0x1b, %edx
callq 0xa0b0