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

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

	char cmd[] = "#undef";
	ResizableString key;
	rstr_init(&key);
	int 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.");
	}

	_delete_macro(ctx, &key);

	rstr_free(&key);

	#undef	_GET_CHAR
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3e54c
jmp 0x3e56b
leaq 0xf60e(%rip), %rdi      # 0x4db61
leaq 0x1099b(%rip), %rsi     # 0x4eef5
movl $0x191, %edx            # imm = 0x191
leaq 0x10f0f(%rip), %rcx     # 0x4f475
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x3e574
jmp 0x3e593
leaq 0xcb0c(%rip), %rdi      # 0x4b087
leaq 0x10973(%rip), %rsi     # 0x4eef5
movl $0x192, %edx            # imm = 0x192
leaq 0x10ee7(%rip), %rcx     # 0x4f475
callq 0xa0b0
movq -0x10(%rbp), %rax
cmpl $0x202, (%rax)          # imm = 0x202
jne 0x3e5a1
jmp 0x3e5c0
leaq 0x10f04(%rip), %rdi     # 0x4f4ac
leaq 0x10946(%rip), %rsi     # 0x4eef5
movl $0x193, %edx            # imm = 0x193
leaq 0x10eba(%rip), %rcx     # 0x4f475
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)
movl 0x10eee(%rip), %eax     # 0x4f4d2
movl %eax, -0x23(%rbp)
movw 0x10ee8(%rip), %ax      # 0x4f4d6
movw %ax, -0x1f(%rbp)
movb 0x10ee0(%rip), %al      # 0x4f4d8
movb %al, -0x1d(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xfca0
movl $0x7, -0x3c(%rbp)
callq 0xa1a0
movq (%rax), %rax
movq %rax, -0x448(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3e62f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x44c(%rbp)
jmp 0x3e641
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x44c(%rbp)
movq -0x448(%rbp), %rax
movl -0x44c(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x3e66a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3e60b
jmp 0x3e66c
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3e681
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x450(%rbp)
jmp 0x3e693
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x450(%rbp)
movl -0x450(%rbp), %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, -0x451(%rbp)
je 0x3e703
callq 0xa1a0
movq (%rax), %rax
movq %rax, -0x460(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3e6ca
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x464(%rbp)
jmp 0x3e6dc
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x464(%rbp)
movq -0x460(%rbp), %rax
movl -0x464(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x451(%rbp)
movb -0x451(%rbp), %al
testb $0x1, %al
jne 0x3e70f
jmp 0x3e756
movl -0x3c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x3e724
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x468(%rbp)
jmp 0x3e736
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x468(%rbp)
movl -0x468(%rbp), %eax
leaq -0x38(%rbp), %rdi
movsbl %al, %esi
callq 0xfeb0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3e66c
cmpl $0x0, -0x34(%rbp)
jne 0x3e790
leaq -0x440(%rbp), %rdi
leaq 0x10c8d(%rip), %rsi     # 0x4f3f7
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), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3fc70
leaq -0x38(%rbp), %rdi
callq 0x10320
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
nop