// File: /workspace/github_c_makefile_star2_O0/hsjoihs[P]c-compiler/cpp.c
// Function: skip_till_corresponding_endif
static void skip_till_corresponding_endif(const struct Token **ptr_src)
{
	const struct Token *src = *ptr_src;

	int ifdef_depth = 1;
	while (1) {
		for (enum LineState s = LINE_HAS_JUST_STARTED;
		     s != LINE_HAS_JUST_STARTED || src[0].kind != HASH; src++) {
			set_line_state(&s, src[0].kind);

			if (src[0].kind == END) {
				fprintf(stderr, "insufficient number of `#endif`.\n");
				exit(EXIT_FAILURE);
			}
		}

		src++; /* HASH */

		consume_spaces(&src);

		if (src[0].kind == NEWLINE) { /* empty directive */
			src++;
			continue;
		}

		expect_and_consume(&src, IDENT_OR_RESERVED,
		                   "identifier after `#` for preprocessor directive");

		if (strcmp(src[-1].ident_str, "ifdef") == 0 ||
		    strcmp(src[-1].ident_str, "ifndef") == 0) {
			ifdef_depth++;
			consume_the_rest_of_line(&src);
		} else if (strcmp(src[-1].ident_str, "endif") == 0) {

			consume_spaces(&src);

			if (src[0].kind == END) {
				if (ifdef_depth != 1) {
					fprintf(stderr, "insufficient number of `#endif`.\n");
					exit(EXIT_FAILURE);
				}
				*ptr_src = src;
				return;
			}

			if (src[0].kind != NEWLINE) {
				error_unexpected_token(src, "newline after `#endif`");
			}

			if (ifdef_depth == 1) {
				*ptr_src = src;
				return;
			}
			ifdef_depth--;
		} else {
			consume_the_rest_of_line(&src);
		}
		src++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movb $0x1, %al
cmpl $0x0, -0x18(%rbp)
movb %al, -0x19(%rbp)
jne 0x1202d
movq -0x10(%rbp), %rax
cmpl $0x4b, (%rax)
setne %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x12036
jmp 0x12080
movq -0x10(%rbp), %rax
movl (%rax), %esi
leaq -0x18(%rbp), %rdi
callq 0x11aa0
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x12070
movq 0x9fa3(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x57e9(%rip), %rsi      # 0x17848
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
jmp 0x12072
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rbp)
jmp 0x12015
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x11bb0
movq -0x10(%rbp), %rax
cmpl $0x4c, (%rax)
jne 0x120af
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rbp)
jmp 0x1200e
leaq -0x10(%rbp), %rdi
movl $0x18, %esi
leaq 0x5577(%rip), %rdx      # 0x17636
callq 0xb190
movq -0x10(%rbp), %rax
movq -0x18(%rax), %rdi
leaq 0x55a2(%rip), %rsi      # 0x17675
callq 0x10c0
cmpl $0x0, %eax
je 0x120f6
movq -0x10(%rbp), %rax
movq -0x18(%rax), %rdi
leaq 0x558f(%rip), %rsi      # 0x1767b
callq 0x10c0
cmpl $0x0, %eax
jne 0x1210d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x121d0
jmp 0x121af
movq -0x10(%rbp), %rax
movq -0x18(%rax), %rdi
leaq 0x5566(%rip), %rsi      # 0x17682
callq 0x10c0
cmpl $0x0, %eax
jne 0x121a4
leaq -0x10(%rbp), %rdi
callq 0x11bb0
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1216d
cmpl $0x1, -0x14(%rbp)
je 0x12160
movq 0x9eb3(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x56f9(%rip), %rsi      # 0x17848
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x121c0
movq -0x10(%rbp), %rax
cmpl $0x4c, (%rax)
je 0x12186
movq -0x10(%rbp), %rdi
leaq 0x5535(%rip), %rsi      # 0x176b6
callq 0xb070
cmpl $0x1, -0x14(%rbp)
jne 0x12199
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x121c0
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x121ad
leaq -0x10(%rbp), %rdi
callq 0x121d0
jmp 0x121af
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rbp)
jmp 0x1200e
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)