// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/preprocessor/gen.c
// Function: gen_include
static void _gen_include(
	PPGeneratorContext *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == PP_NODE_DIRECTIVE_INCLUDE);

	const char *content = node->token->content;
	int len = node->token->len;

	char cmd[] = "#include";
	ResizableString filename;
	rstr_init(&filename);
	int idx = sizeof(cmd);

	#define	_GET_CHAR(i) ((i) >= len ? -1 : content[(i)])

	while (isspace(_GET_CHAR(idx))) {
		idx++;
	}

	if (_GET_CHAR(idx) == '<') {
		idx++;
		while (_GET_CHAR(idx) != '>' && _GET_CHAR(idx) != -1) {
			rstr_append_with_char(&filename, _GET_CHAR(idx));
			idx++;
		}
		if (_GET_CHAR(idx) != '>') {
			_SYNERR_NODE(ctx, node, "expect '>'.");
		}

		_OUT_FMT(ctx, "#line %d \"%s\"\n", 1, RSTR_CSTR(&filename));
		_include_file_from_include_path(ctx, node, &filename);
		_OUT_FMT(ctx, "#line %d \"%s\"", node->line + 1, node->file);
	} else if (_GET_CHAR(idx) == '"') {
		idx++;
		while (_GET_CHAR(idx) != '"' && _GET_CHAR(idx) != -1) {
			rstr_append_with_char(&filename, _GET_CHAR(idx));
			idx++;
		}
		if (_GET_CHAR(idx) != '"') {
			_SYNERR_NODE(ctx, node, "expect '\"'.");
		}

		_OUT_FMT(ctx, "#line %d \"%s\"\n", 1, RSTR_CSTR(&filename));
		if (!_include_file(ctx, RSTR_CSTR(&filename))) {
			_include_file_from_include_path(ctx, node, &filename);
		}
		_OUT_FMT(ctx, "#line %d \"%s\"", node->line + 1, node->file);
	} else {
		_SYNERR_NODE(ctx, node, "expect '<' or '\"'.");
	}

	rstr_free(&filename);

	#undef	_GET_CHAR
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1cd0, %rsp           # imm = 0x1CD0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3d66c
jmp 0x3d68b
leaq 0x104ee(%rip), %rdi     # 0x4db61
leaq 0x1187b(%rip), %rsi     # 0x4eef5
movl $0xcb, %edx
leaq 0x11b98(%rip), %rcx     # 0x4f21e
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x3d694
jmp 0x3d6b3
leaq 0xd9ec(%rip), %rdi      # 0x4b087
leaq 0x11853(%rip), %rsi     # 0x4eef5
movl $0xcc, %edx
leaq 0x11b70(%rip), %rcx     # 0x4f21e
callq 0xa0b0
movq -0x10(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x3d6c1
jmp 0x3d6e0
leaq 0x11b8f(%rip), %rdi     # 0x4f257
leaq 0x11826(%rip), %rsi     # 0x4eef5
movl $0xcd, %edx
leaq 0x11b43(%rip), %rcx     # 0x4f21e
callq 0xa0b0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x1c(%rbp)
movq 0x11b7a(%rip), %rax     # 0x4f27f
movq %rax, -0x25(%rbp)
movb 0x11b78(%rip), %al      # 0x4f287
movb %al, -0x1d(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xfca0
movl $0x9, -0x3c(%rbp)
callq 0xa1a0
movq (%rax), %rax
movq %rax, -0x1c48(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3d746
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c4c(%rbp)
jmp 0x3d758
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c4c(%rbp)
movq -0x1c48(%rbp), %rax
movl -0x1c4c(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x3d781
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3d722
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3d796
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c50(%rbp)
jmp 0x3d7a8
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c50(%rbp)
movl -0x1c50(%rbp), %eax
cmpl $0x3c, %eax
jne 0x3da40
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3d7d5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c54(%rbp)
jmp 0x3d7e7
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c54(%rbp)
movl -0x1c54(%rbp), %ecx
xorl %eax, %eax
cmpl $0x3e, %ecx
movb %al, -0x1c55(%rbp)
je 0x3d833
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3d80f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c5c(%rbp)
jmp 0x3d821
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c5c(%rbp)
movl -0x1c5c(%rbp), %eax
cmpl $-0x1, %eax
setne %al
movb %al, -0x1c55(%rbp)
movb -0x1c55(%rbp), %al
testb $0x1, %al
jne 0x3d83f
jmp 0x3d886
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3d854
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c60(%rbp)
jmp 0x3d866
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c60(%rbp)
movl -0x1c60(%rbp), %eax
leaq -0x38(%rbp), %rdi
movsbl %al, %esi
callq 0xfeb0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3d7c0
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3d89b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c64(%rbp)
jmp 0x3d8ad
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c64(%rbp)
movl -0x1c64(%rbp), %eax
cmpl $0x3e, %eax
je 0x3d8ec
leaq -0x440(%rbp), %rdi
leaq 0x119c2(%rip), %rsi     # 0x4f288
movb $0x0, %al
callq 0xa170
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdi
movq -0x10(%rbp), %rsi
leaq -0x440(%rbp), %rdx
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3d94b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1c70(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3d91d
leaq 0x9f73(%rip), %rax      # 0x47887
movq %rax, -0x1c78(%rbp)
jmp 0x3d928
movq -0x30(%rbp), %rax
movq %rax, -0x1c78(%rbp)
movq -0x1c70(%rbp), %rdi
movq -0x1c78(%rbp), %rcx
leaq 0x11957(%rip), %rsi     # 0x4f294
movl $0x1, %edx
movb $0x0, %al
callq 0xa100
jmp 0x3d9b5
leaq -0x840(%rbp), %rax
movq %rax, -0x1c80(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3d970
leaq 0x9f20(%rip), %rax      # 0x47887
movq %rax, -0x1c88(%rbp)
jmp 0x3d97b
movq -0x30(%rbp), %rax
movq %rax, -0x1c88(%rbp)
movq -0x1c80(%rbp), %rdi
movq -0x1c88(%rbp), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x118ff(%rip), %rdx     # 0x4f294
movl $0x1, %ecx
movb $0x0, %al
callq 0xa0a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x840(%rbp), %rsi
callq 0xfd80
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x3f670
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3d9fb
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x118b1(%rip), %rsi     # 0x4f2a3
movb $0x0, %al
callq 0xa100
jmp 0x3da3b
leaq -0xc40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x11883(%rip), %rdx     # 0x4f2a3
movb $0x0, %al
callq 0xa0a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0xc40(%rbp), %rsi
callq 0xfd80
jmp 0x3dd76
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3da55
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c8c(%rbp)
jmp 0x3da67
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c8c(%rbp)
movl -0x1c8c(%rbp), %eax
cmpl $0x22, %eax
jne 0x3dd40
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3da94
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c90(%rbp)
jmp 0x3daa6
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c90(%rbp)
movl -0x1c90(%rbp), %ecx
xorl %eax, %eax
cmpl $0x22, %ecx
movb %al, -0x1c91(%rbp)
je 0x3daf2
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3dace
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c98(%rbp)
jmp 0x3dae0
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c98(%rbp)
movl -0x1c98(%rbp), %eax
cmpl $-0x1, %eax
setne %al
movb %al, -0x1c91(%rbp)
movb -0x1c91(%rbp), %al
testb $0x1, %al
jne 0x3dafe
jmp 0x3db45
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3db13
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1c9c(%rbp)
jmp 0x3db25
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c9c(%rbp)
movl -0x1c9c(%rbp), %eax
leaq -0x38(%rbp), %rdi
movsbl %al, %esi
callq 0xfeb0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3da7f
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3db5a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x1ca0(%rbp)
jmp 0x3db6c
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1ca0(%rbp)
movl -0x1ca0(%rbp), %eax
cmpl $0x22, %eax
je 0x3dbab
leaq -0x1040(%rbp), %rdi
leaq 0x1172c(%rip), %rsi     # 0x4f2b1
movb $0x0, %al
callq 0xa170
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1040(%rbp), %rdx
callq *%rax
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3dc0a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1ca8(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3dbdc
leaq 0x9cb4(%rip), %rax      # 0x47887
movq %rax, -0x1cb0(%rbp)
jmp 0x3dbe7
movq -0x30(%rbp), %rax
movq %rax, -0x1cb0(%rbp)
movq -0x1ca8(%rbp), %rdi
movq -0x1cb0(%rbp), %rcx
leaq 0x11698(%rip), %rsi     # 0x4f294
movl $0x1, %edx
movb $0x0, %al
callq 0xa100
jmp 0x3dc74
leaq -0x1440(%rbp), %rax
movq %rax, -0x1cb8(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3dc2f
leaq 0x9c61(%rip), %rax      # 0x47887
movq %rax, -0x1cc0(%rbp)
jmp 0x3dc3a
movq -0x30(%rbp), %rax
movq %rax, -0x1cc0(%rbp)
movq -0x1cb8(%rbp), %rdi
movq -0x1cc0(%rbp), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x11640(%rip), %rdx     # 0x4f294
movl $0x1, %ecx
movb $0x0, %al
callq 0xa0a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x1440(%rbp), %rsi
callq 0xfd80
movq -0x8(%rbp), %rax
movq %rax, -0x1cc8(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x3dc96
leaq 0x9bfa(%rip), %rax      # 0x47887
movq %rax, -0x1cd0(%rbp)
jmp 0x3dca1
movq -0x30(%rbp), %rax
movq %rax, -0x1cd0(%rbp)
movq -0x1cc8(%rbp), %rdi
movq -0x1cd0(%rbp), %rsi
callq 0x3f800
testb $0x1, %al
jne 0x3dcc9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x3f670
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3dcfe
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x115ae(%rip), %rsi     # 0x4f2a3
movb $0x0, %al
callq 0xa100
jmp 0x3dd3e
leaq -0x1840(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %r8
movl $0x400, %esi            # imm = 0x400
leaq 0x11580(%rip), %rdx     # 0x4f2a3
movb $0x0, %al
callq 0xa0a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x1840(%rbp), %rsi
callq 0xfd80
jmp 0x3dd74
leaq -0x1c40(%rbp), %rdi
leaq 0x1156f(%rip), %rsi     # 0x4f2bd
movb $0x0, %al
callq 0xa170
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1c40(%rbp), %rdx
callq *%rax
jmp 0x3dd76
leaq -0x38(%rbp), %rdi
callq 0x10320
addq $0x1cd0, %rsp           # imm = 0x1CD0
popq %rbp
retq
nopl (%rax,%rax)