// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/common.c
// Function: cmn_print_code_by_token
void cmn_print_code_by_token(
	FILE *out,
	LexerToken *token,
	int n_prev,
	int n_succ
) {
	assert(out);
	assert(token);

	fputc('\n', out);

	ResizableString rstr_line_code;
	ResizableString rstr_line_wavy_line;

	rstr_init(&rstr_line_code);
	rstr_init(&rstr_line_wavy_line);

	LexerToken *t = NULL;

	t = token->prev;
	for (int i = 0; i < n_prev && t != NULL; i++, t = t->prev) {
		rstr_prepend_with_char(&rstr_line_code, ' ');
		rstr_prepend_with_raw(&rstr_line_code, t->content, t->len);

		for (int j = 0; j < t->len + 1; j++) {
			rstr_append_with_char(&rstr_line_wavy_line, ' ');
		}
	}

	rstr_append_with_raw(&rstr_line_code, token->content, token->len);
	for (int i = 0; i < token->len; i++) {
		rstr_append_with_char(&rstr_line_wavy_line, '~');
	}

	t = token->next;
	for (int i = 0; i < n_succ && t != NULL; i++, t = t->next) {
		rstr_append_with_char(&rstr_line_code, ' ');
		rstr_append_with_raw(&rstr_line_code, t->content, t->len);
	}

	fprintf(out, "\t%s\n", RSTR_CSTR(&rstr_line_code));
	fprintf(out, "\t%s\n", RSTR_CSTR(&rstr_line_wavy_line));

	rstr_free(&rstr_line_code);
	rstr_free(&rstr_line_wavy_line);

	fputc('\n', out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xaf02
jmp 0xaf21
leaq 0x3b5e7(%rip), %rdi     # 0x464f0
leaq 0x3b5e4(%rip), %rsi     # 0x464f4
movl $0x16, %edx
leaq 0x3b5e1(%rip), %rcx     # 0x464fd
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0xaf2a
jmp 0xaf49
leaq 0x3b609(%rip), %rdi     # 0x4653a
leaq 0x3b5bc(%rip), %rsi     # 0x464f4
movl $0x17, %edx
leaq 0x3b5b9(%rip), %rcx     # 0x464fd
callq 0xa0b0
movq -0x8(%rbp), %rsi
movl $0xa, %edi
callq 0xa0e0
leaq -0x28(%rbp), %rdi
callq 0xfca0
leaq -0x38(%rbp), %rdi
callq 0xfca0
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %ecx
xorl %eax, %eax
cmpl -0x14(%rbp), %ecx
movb %al, -0x51(%rbp)
jge 0xaf9c
cmpq $0x0, -0x40(%rbp)
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xafa5
jmp 0xb018
leaq -0x28(%rbp), %rdi
movl $0x20, %esi
callq 0x10ae0
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x28(%rbp), %rdi
callq 0x10b20
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x40(%rbp), %rcx
movl 0x4(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0xaffc
leaq -0x38(%rbp), %rdi
movl $0x20, %esi
callq 0xfeb0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xafd2
jmp 0xaffe
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xaf84
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x28(%rbp), %rdi
callq 0xffa0
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xb05c
leaq -0x38(%rbp), %rdi
movl $0x7e, %esi
callq 0xfeb0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xb037
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %ecx
xorl %eax, %eax
cmpl -0x18(%rbp), %ecx
movb %al, -0x52(%rbp)
jge 0xb087
cmpq $0x0, -0x40(%rbp)
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0xb090
jmp 0xb0cd
leaq -0x28(%rbp), %rdi
movl $0x20, %esi
callq 0xfeb0
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x28(%rbp), %rdi
callq 0xffa0
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xb06f
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xb0e9
leaq 0x3c7a4(%rip), %rax     # 0x47887
movq %rax, -0x68(%rbp)
jmp 0xb0f1
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0x3b440(%rip), %rsi     # 0x46540
movb $0x0, %al
callq 0xa100
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb123
leaq 0x3c76a(%rip), %rax     # 0x47887
movq %rax, -0x78(%rbp)
jmp 0xb12b
movq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq 0x3b406(%rip), %rsi     # 0x46540
movb $0x0, %al
callq 0xa100
leaq -0x28(%rbp), %rdi
callq 0x10320
leaq -0x38(%rbp), %rdi
callq 0x10320
movq -0x8(%rbp), %rsi
movl $0xa, %edi
callq 0xa0e0
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)