// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/preprocessor/comment.c
// Function: pp_comment_process
void pp_comment_process(
	ResizableString *dst,
	const char *file,
	const char *src,
	int len
) {
	assert(dst);
	assert(file);
	assert(src);

	LexerContext *ctx = lexer_new_context(file, src, len, _matchers);
	lexer_parse_first(ctx);

	LexerToken *token;
	while ((token = lexer_next_token(ctx)) != NULL) {
		switch (token->type) {
			case _TOKEN_LITERAL_CHAR:
			case _TOKEN_LITERAL_STRING:
			case _TOKEN_TEXT: {
				rstr_append_with_raw(dst, token->content, token->len);
				break;
			}
			case _TOKEN_SINGLE_LINE_COMMENT: {
				for (int i = 0; i < token->len; i++) {
					rstr_append_with_char(dst, ' ');
				}
				break;
			}
			case _TOKEN_MULTILINE_COMMENT: {
				for (int i = 0; i < token->len; i++) {
					if (token->content[i] == '\n') {
						rstr_append_with_char(dst, '\n');
					} else {
						rstr_append_with_char(dst, ' ');
					}
				}
				break;
			}
			default: {
				assert(0);
			}
		}
	}

	lexer_free_context(ctx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x35ad0
jmp 0x35aef
leaq 0x10592(%rip), %rdi     # 0x46069
leaq 0x18d28(%rip), %rsi     # 0x4e806
movl $0xf0, %edx
leaq 0x18d3c(%rip), %rcx     # 0x4e826
callq 0xa0b0
cmpq $0x0, -0x10(%rbp)
je 0x35af8
jmp 0x35b17
leaq 0x10f6f(%rip), %rdi     # 0x46a6e
leaq 0x18d00(%rip), %rsi     # 0x4e806
movl $0xf1, %edx
leaq 0x18d14(%rip), %rcx     # 0x4e826
callq 0xa0b0
cmpq $0x0, -0x18(%rbp)
je 0x35b20
jmp 0x35b3f
leaq 0x12495(%rip), %rdi     # 0x47fbc
leaq 0x18cd8(%rip), %rsi     # 0x4e806
movl $0xf2, %edx
leaq 0x18cec(%rip), %rcx     # 0x4e826
callq 0xa0b0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq 0x295ff(%rip), %rcx     # 0x5f150
callq 0xb170
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xc260
movq -0x28(%rbp), %rdi
callq 0xb950
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x35c6e
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
addl $0xfffff000, %eax       # imm = 0xFFFFF000
subl $0x3, %eax
jb 0x35baa
jmp 0x35b8f
movl -0x3c(%rbp), %eax
subl $0xe000, %eax           # imm = 0xE000
je 0x35bc7
jmp 0x35b9b
movl -0x3c(%rbp), %eax
subl $0xe001, %eax           # imm = 0xE001
je 0x35bf5
jmp 0x35c4a
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edx
callq 0xffa0
jmp 0x35c69
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x35bf3
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0xfeb0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x35bce
jmp 0x35c69
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x35c48
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x35c2d
movq -0x8(%rbp), %rdi
movl $0xa, %esi
callq 0xfeb0
jmp 0x35c3b
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0xfeb0
jmp 0x35c3d
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x35bfc
jmp 0x35c69
leaq 0x11814(%rip), %rdi     # 0x47465
leaq 0x18bae(%rip), %rsi     # 0x4e806
movl $0x111, %edx            # imm = 0x111
leaq 0x18bc2(%rip), %rcx     # 0x4e826
callq 0xa0b0
jmp 0x35b63
movq -0x28(%rbp), %rdi
callq 0xb590
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)