// File: /workspace/github_c_makefile_star2_O3/Ihsoh[P]ilang/compiler/preprocessor/gen.c
// Function: gen_ifxdef
static void _gen_ifxdef(
	PPGeneratorContext *ctx,
	ParserASTNode *node,
	bool not
) {
	assert(ctx);
	assert(node);
	if (not) {
		assert(node->type == PP_NODE_DIRECTIVE_IFNDEF);
	} else {
		assert(node->type == PP_NODE_DIRECTIVE_IFDEF);
	}
	assert(node->nchilds >= 1);

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

	ResizableString key;
	rstr_init(&key);
	int idx;
	if (not) {
		char cmd[] = "#ifndef";
		idx = sizeof(cmd);
	} else {
		char cmd[] = "#ifdef";
		idx = sizeof(cmd);
	}

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

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

	while (_GET_CHAR(idx) != -1 && !isspace(_GET_CHAR(idx))) {
		rstr_append_with_char(&key, _GET_CHAR(idx));
		idx++;
	}

	if (RSTR_LEN(&key) == 0) {
		_SYNERR_NODE(ctx, node, "expect key.");
	}

	bool cond;
	if (not) {
		cond = !map_exists_key(ctx->map_kv, &key);
	} else {
		cond = map_exists_key(ctx->map_kv, &key);
	}

	if (cond) {
		ParserASTNode *node_block = node->childs[0];
		assert(node_block->type == PP_NODE_BLOCK);

		_gen_if_block(ctx, node_block);
	} else {
		for (int i = 1; i < node->nchilds; i++) {
			ParserASTNode *child = node->childs[i];
			if (_gen_elifxxx_and_else(ctx, child)) {
				break;
			}
		}
	}

	rstr_free(&key);

	#undef	_GET_CHAR
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movl %edx, %ebx
movq %rsi, %r14
movl (%rsi), %eax
testl %edx, %edx
je 0x29d03
cmpl $0x205, %eax            # imm = 0x205
je 0x29d0e
leaq 0xc2b3(%rip), %rdi      # 0x35f9e
leaq 0xbc3a(%rip), %rsi      # 0x3592c
leaq 0xc266(%rip), %rcx      # 0x35f5f
movl $0x2b0, %edx            # imm = 0x2B0
callq 0xa0b0
cmpl $0x204, %eax            # imm = 0x204
jne 0x29e62
movq %rdi, -0x48(%rbp)
cmpl $0x0, 0x44(%r14)
jle 0x29e43
movq 0x10(%r14), %rax
movq 0x8(%rax), %r13
movslq 0x4(%rax), %r15
leaq -0x40(%rbp), %rdi
callq 0xe274
callq 0xa190
movq %rax, %r12
movq (%rax), %rax
movl %ebx, -0x2c(%rbp)
movzbl %bl, %ebx
addq %rbx, %r13
addq $0x6, %r13
addq $0x7, %rbx
movq $-0x1, %rcx
cmpq %r15, %rbx
jge 0x29d5f
movsbq 0x1(%r13), %rcx
incq %rbx
incq %r13
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x29d4e
leal -0x1(%rbx), %eax
cmpl %eax, %r15d
jle 0x29d9f
decl %ebx
movsbq (%r13), %rsi
cmpq $-0x1, %rsi
je 0x29d9f
movq (%r12), %rax
testb $0x20, 0x1(%rax,%rsi,2)
jne 0x29d9f
leaq -0x40(%rbp), %rdi
callq 0xe3fa
incq %r13
incl %ebx
cmpl %ebx, %r15d
jg 0x29d76
cmpl $0x0, -0x3c(%rbp)
movq -0x48(%rbp), %r15
jne 0x29dcd
movabsq $0x6b20746365707865, %rax # imm = 0x6B20746365707865
leaq -0x450(%rbp), %rdx
movq %rax, (%rdx)
movl $0x2e7965, 0x8(%rdx)    # imm = 0x2E7965
movq (%r15), %rdi
movq %r14, %rsi
callq *0x58(%rdi)
movq 0x18(%r15), %rdi
leaq -0x40(%rbp), %rsi
callq 0xc82a
cmpb -0x2c(%rbp), %al
je 0x29dfc
movq 0x48(%r14), %rax
movq (%rax), %rsi
cmpl $0x300, (%rsi)          # imm = 0x300
jne 0x29e81
movq %r15, %rdi
callq 0x2979d
jmp 0x29e28
cmpl $0x2, 0x44(%r14)
jl 0x29e28
movl $0x1, %ebx
movq 0x48(%r14), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x2987c
testb %al, %al
jne 0x29e28
incq %rbx
movslq 0x44(%r14), %rax
cmpq %rax, %rbx
jl 0x29e08
leaq -0x40(%rbp), %rdi
callq 0xe772
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbede(%rip), %rdi      # 0x35d28
leaq 0xbadb(%rip), %rsi      # 0x3592c
leaq 0xc107(%rip), %rcx      # 0x35f5f
movl $0x2b4, %edx            # imm = 0x2B4
callq 0xa0b0
leaq 0xc0d0(%rip), %rdi      # 0x35f39
leaq 0xbabc(%rip), %rsi      # 0x3592c
leaq 0xc0e8(%rip), %rcx      # 0x35f5f
movl $0x2b2, %edx            # imm = 0x2B2
callq 0xa0b0
leaq 0xbecf(%rip), %rdi      # 0x35d57
leaq 0xba9d(%rip), %rsi      # 0x3592c
leaq 0xc0c9(%rip), %rcx      # 0x35f5f
movl $0x2dc, %edx            # imm = 0x2DC
callq 0xa0b0