// File: /workspace/github_c_makefile_star2_O3/qpfiffer[P]38-Moths/src/greshunkel.c
// Function: include_line
static line
_include_line(const greshunkel_ctext *ctext, const line *current_line, const struct compiled_regex *all_regex) {
	line interpolated_line = {0};
	const line *operating_line = current_line;
	assert(operating_line->data != NULL);

	match_t match[2] = {0};
	while (regexec_2_0_beta(&all_regex->c_include_regex, operating_line->data, 2, match) == 0) {
		const match_t inner_match = match[1];
		assert(inner_match.rm_so != -1 && inner_match.rm_eo != -1);

		/* Copy the string here so we only get the match, not everything after it. */
		char just_match_str[inner_match.len + 1];
		just_match_str[inner_match.len] = '\0';
		strncpy(just_match_str, inner_match.start, inner_match.len);


		/* Open the file here. */
		/* TODO: Make this actually the whole size of the file, not just a random buffer. */
		char template_file[2048] = {0};
		size_t template_file_siz = 0;
		FILE *include_file = fopen(just_match_str, "r");
		if (!include_file) {
			/* If we couldn't open the file, blow up with an assertion. */
			printf("Could not open SCREAM file for reading.\n");
			printf("Line: %s\n", operating_line->data);
			assert(1 == 0);
		}

		template_file_siz = fread(template_file, 1, sizeof(template_file), include_file);
		fclose(include_file);
		template_file[template_file_siz] = '\0';

		line rendered_piece = {0};
		rendered_piece.data = gshkl_render(ctext, template_file, template_file_siz, &rendered_piece.size);

		free(interpolated_line.data);
		interpolated_line.size = rendered_piece.size;
		interpolated_line.data = rendered_piece.data;
		operating_line = &interpolated_line;

		/* Set the next regex check after this one. */
		memset(match, 0, sizeof(match));
	}

	return *operating_line;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x868, %rsp            # imm = 0x868
movq %rsi, %r14
movq %rdi, -0x50(%rbp)
movq 0x8(%rsi), %rsi
testq %rsi, %rsi
je 0x41e8
movq %rdx, %rbx
leaq 0x8(%r14), %r15
xorps %xmm0, %xmm0
leaq -0x90(%rbp), %rcx
movaps %xmm0, 0x20(%rcx)
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, (%rcx)
addq $0x140, %rbx            # imm = 0x140
movl $0x2, %edx
movq %rbx, %rdi
callq 0x3a75
testl %eax, %eax
je 0x4068
movq (%r15), %r12
xorl %ebx, %ebx
jmp 0x4170
movq %rbx, -0x48(%rbp)
xorl %r12d, %r12d
leaq -0x890(%rbp), %r13
cmpl $-0x1, -0x78(%rbp)
je 0x41c9
cmpl $-0x1, -0x74(%rbp)
je 0x41c9
movq %rsp, %r14
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rsi
movq %rsp, %rbx
leaq 0x10(%rdx), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
movb $0x0, (%rdx,%rbx)
movq %rbx, %rdi
callq 0x1050
movl $0x800, %edx            # imm = 0x800
movq %r13, %rdi
xorl %esi, %esi
callq 0x1120
movq %rbx, %rdi
leaq 0xfb6(%rip), %rsi       # 0x5081
callq 0x11f0
testq %rax, %rax
je 0x4189
movq %rax, %rbx
movl $0x1, %esi
movl $0x800, %edx            # imm = 0x800
movq %r13, %rdi
movq %rax, %rcx
callq 0x1080
movq %rax, %r15
movq %rbx, %rdi
callq 0x10a0
movb $0x0, -0x890(%rbp,%r15)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq -0x50(%rbp), %rdi
movq %r13, %rsi
movq %r15, %rdx
leaq -0x40(%rbp), %rcx
callq 0x24bc
movq %rax, -0x38(%rbp)
movq %r12, %rdi
callq 0x1030
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x70(%rbp)
movq %r14, %rsp
movl $0x2, %edx
movq -0x48(%rbp), %rdi
movq %r12, %rsi
leaq -0x90(%rbp), %rcx
callq 0x3a75
leaq -0x58(%rbp), %r15
testl %eax, %eax
je 0x4076
leaq -0x60(%rbp), %r14
movq %rbx, -0x60(%rbp)
movq (%r14), %rax
movq %r12, %rdx
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, -0x58(%rbp)
leaq 0x2b5f(%rip), %rdi      # 0x6cf3
callq 0x1070
movq (%r15), %rsi
leaq 0x2546(%rip), %rdi      # 0x66e9
xorl %eax, %eax
callq 0x10e0
leaq 0x2595(%rip), %rdi      # 0x6746
leaq 0x2086(%rip), %rsi      # 0x623e
leaq 0x298b(%rip), %rcx      # 0x6b4a
movl $0x209, %edx            # imm = 0x209
callq 0x1110
leaq 0x286e(%rip), %rdi      # 0x6a3e
leaq 0x2067(%rip), %rsi      # 0x623e
leaq 0x296c(%rip), %rcx      # 0x6b4a
movl $0x1f8, %edx            # imm = 0x1F8
callq 0x1110
leaq 0x27d6(%rip), %rdi      # 0x69c5
leaq 0x2048(%rip), %rsi      # 0x623e
leaq 0x294d(%rip), %rcx      # 0x6b4a
movl $0x1f3, %edx            # imm = 0x1F3
callq 0x1110