// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_cross.cpp
// Function: spirv_cross::Compiler::AnalyzeVariableScopeAccessHandler::set_current_block(spirv_cross::SPIRBlock const&)
void Compiler::AnalyzeVariableScopeAccessHandler::set_current_block(const SPIRBlock &block)
{
	current_block = &block;

	// If we're branching to a block which uses OpPhi, in GLSL
	// this will be a variable write when we branch,
	// so we need to track access to these variables as well to
	// have a complete picture.
	const auto test_phi = [this, &block](uint32_t to) {
		auto &next = compiler.get<SPIRBlock>(to);
		for (auto &phi : next.phi_variables)
		{
			if (phi.parent == block.self)
			{
				accessed_variables_to_block[phi.function_variable].insert(block.self);
				// Phi variables are also accessed in our target branch block.
				accessed_variables_to_block[phi.function_variable].insert(next.self);

				notify_variable_access(phi.local_variable, block.self);
			}
		}
	};

	switch (block.terminator)
	{
	case SPIRBlock::Direct:
		notify_variable_access(block.condition, block.self);
		test_phi(block.next_block);
		break;

	case SPIRBlock::Select:
		notify_variable_access(block.condition, block.self);
		test_phi(block.true_block);
		test_phi(block.false_block);
		break;

	case SPIRBlock::MultiSelect:
		notify_variable_access(block.condition, block.self);
		for (auto &target : block.cases)
			test_phi(target.block);
		if (block.default_block)
			test_phi(block.default_block);
		break;

	default:
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, 0x8(%rsp)
movq %rsi, 0x130(%rdi)
movq %rsi, 0x20(%rsp)
movl 0xc(%rsi), %eax
cmpl $0x3, %eax
je 0x18c61
cmpl $0x2, %eax
je 0x18b07
cmpl $0x1, %eax
jne 0x18dee
movq 0x20(%rsp), %r14
movl 0x8(%r14), %edx
movl 0x28(%r14), %esi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x18dfe
movl 0x18(%r14), %esi
movq 0x8(%rbx), %rdi
callq 0x78fe
movq 0x50(%rax), %rbx
movq %rax, 0x10(%rsp)
movq 0x58(%rax), %r14
cmpq %r14, %rbx
je 0x18dee
addq $0x8, 0x20(%rsp)
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r12
addq $0x8, 0x10(%rsp)
movq 0x20(%rsp), %r13
movl 0x4(%rbx), %eax
movq 0x20(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x18af9
leaq 0x8(%rbx), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r13, %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdx
callq 0x1fc02
movq %r12, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x1fc02
movl (%rbx), %esi
movl (%r13), %edx
movq 0x8(%rsp), %rdi
callq 0x18dfe
addq $0xc, %rbx
cmpq %r14, %rbx
jne 0x18a96
jmp 0x18dee
movq 0x20(%rsp), %r14
movl 0x8(%r14), %edx
movl 0x28(%r14), %esi
leaq 0x8(%r14), %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x18dfe
movl 0x2c(%r14), %esi
movq 0x8(%rbx), %rdi
callq 0x78fe
movq 0x50(%rax), %rbx
movq %rax, 0x10(%rsp)
movq 0x58(%rax), %r14
cmpq %r14, %rbx
je 0x18bba
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r13
addq $0x8, 0x10(%rsp)
movl 0x4(%rbx), %eax
cmpl (%r15), %eax
jne 0x18bb1
leaq 0x8(%rbx), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdx
callq 0x1fc02
movq %r13, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x1fc02
movl (%rbx), %esi
movl (%r15), %edx
movq 0x8(%rsp), %rdi
callq 0x18dfe
addq $0xc, %rbx
cmpq %r14, %rbx
jne 0x18b53
movq 0x20(%rsp), %rax
movl 0x30(%rax), %esi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x78fe
movq 0x50(%rax), %rbx
movq %rax, 0x10(%rsp)
movq 0x58(%rax), %r13
cmpq %r13, %rbx
je 0x18dee
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r12
addq $0x8, 0x10(%rsp)
movl 0x4(%rbx), %eax
cmpl (%r15), %eax
jne 0x18c53
leaq 0x8(%rbx), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdx
callq 0x1fc02
movq %r12, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x1fc02
movl (%rbx), %esi
movl (%r15), %edx
movq 0x8(%rsp), %rdi
callq 0x18dfe
addq $0xc, %rbx
cmpq %r13, %rbx
jne 0x18bf5
jmp 0x18dee
movq 0x20(%rsp), %rbx
movl 0x8(%rbx), %edx
movl 0x28(%rbx), %esi
leaq 0x8(%rbx), %r15
movq 0x8(%rsp), %rdi
callq 0x18dfe
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rax
movq %rax, 0x28(%rsp)
cmpq %rax, %rcx
je 0x18d48
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r12
movq %rcx, 0x30(%rsp)
movl 0x4(%rcx), %esi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x78fe
movq 0x50(%rax), %rbx
movq %rax, 0x10(%rsp)
movq 0x58(%rax), %r13
cmpq %r13, %rbx
je 0x18d34
addq $0x8, 0x10(%rsp)
movl 0x4(%rbx), %eax
cmpl (%r15), %eax
jne 0x18d2b
leaq 0x8(%rbx), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %rbp
movq %rbp, %rdx
callq 0x1fc02
movq %r12, %rdi
movq %r14, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x1fc02
movl (%rbx), %esi
movl (%r15), %edx
movq 0x8(%rsp), %rdi
callq 0x18dfe
addq $0xc, %rbx
cmpq %r13, %rbx
jne 0x18ccd
movq 0x30(%rsp), %rcx
addq $0x8, %rcx
cmpq 0x28(%rsp), %rcx
jne 0x18c9f
movq 0x20(%rsp), %rax
movl 0x34(%rax), %esi
testl %esi, %esi
je 0x18dee
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x78fe
movq 0x50(%rax), %rbx
movq %rax, 0x10(%rsp)
movq 0x58(%rax), %r13
cmpq %r13, %rbx
je 0x18dee
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r12
addq $0x8, 0x10(%rsp)
movl 0x4(%rbx), %eax
cmpl (%r15), %eax
jne 0x18de5
leaq 0x8(%rbx), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq %r15, %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdx
callq 0x1fc02
movq %r12, %rdi
movq %rbp, %rsi
callq 0x237d8
movq %rax, 0x18(%rsp)
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x1fc02
movl (%rbx), %esi
movl (%r15), %edx
movq 0x8(%rsp), %rdi
callq 0x18dfe
addq $0xc, %rbx
cmpq %r13, %rbx
jne 0x18d87
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop