// File: /workspace/github_c_makefile_star2_O0/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
subq $0x90, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x4584f
jmp 0x4586e
leaq 0x1218(%rip), %rdi      # 0x46a6e
leaq 0xad31(%rip), %rsi      # 0x5058e
movl $0x17, %edx
leaq 0xad4a(%rip), %rcx      # 0x505b3
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x45877
jmp 0x45896
leaq 0x9773(%rip), %rdi      # 0x4eff1
leaq 0xad09(%rip), %rsi      # 0x5058e
movl $0x18, %edx
leaq 0xad22(%rip), %rcx      # 0x505b3
callq 0xa0b0
cmpq $0x0, -0x18(%rbp)
je 0x4589f
jmp 0x458be
leaq 0xcf5(%rip), %rdi       # 0x4659b
leaq 0xace1(%rip), %rsi      # 0x5058e
movl $0x19, %edx
leaq 0xacfa(%rip), %rcx      # 0x505b3
callq 0xa0b0
cmpq $0x0, -0x28(%rbp)
je 0x458c7
jmp 0x458e6
leaq 0xad46(%rip), %rdi      # 0x50614
leaq 0xacb9(%rip), %rsi      # 0x5058e
movl $0x1a, %edx
leaq 0xacd2(%rip), %rcx      # 0x505b3
callq 0xa0b0
cmpq $0x0, -0x30(%rbp)
jne 0x458f4
cmpq $0x0, 0x10(%rbp)
je 0x458f6
jmp 0x45915
leaq 0x9702(%rip), %rdi      # 0x4efff
leaq 0xac8a(%rip), %rsi      # 0x5058e
movl $0x1b, %edx
leaq 0xaca3(%rip), %rcx      # 0x505b3
callq 0xa0b0
leaq -0x40(%rbp), %rdi
callq 0xfca0
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq -0x40(%rbp), %rdi
callq 0x35ab0
leaq -0x50(%rbp), %rdi
callq 0xfca0
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x45957
leaq 0x1f36(%rip), %rax      # 0x47887
movq %rax, -0x80(%rbp)
jmp 0x4595f
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
movl -0x3c(%rbp), %ecx
leaq -0x50(%rbp), %rdi
callq 0x43550
leaq -0x40(%rbp), %rdi
callq 0x10320
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x4599e
leaq 0x1ef2(%rip), %rax      # 0x47887
movq %rax, -0x90(%rbp)
jmp 0x459a9
movq -0x48(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rsi
movl -0x4c(%rbp), %edx
callq 0x43600
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x43720
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %r8
movq 0x10(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x3ccc0
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xd980
movq $0x0, -0x70(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xda00
movq %rax, -0x70(%rbp)
cmpq $0x0, %rax
je 0x45a33
movq -0x60(%rbp), %rdi
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x3d020
jmp 0x45a01
movq -0x60(%rbp), %rdi
callq 0x3cb30
movq -0x60(%rbp), %rdi
callq 0x3cf70
movq -0x58(%rbp), %rdi
callq 0x436d0
leaq -0x50(%rbp), %rdi
callq 0x10320
addq $0x90, %rsp
popq %rbp
retq