// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::for_loop_initializers_are_same_type(spirv_cross::SPIRBlock const&)
bool CompilerGLSL::for_loop_initializers_are_same_type(const SPIRBlock &block)
{
	if (block.loop_variables.size() <= 1)
		return true;

	uint32_t expected = 0;
	Bitset expected_flags;
	for (auto &var : block.loop_variables)
	{
		// Don't care about uninitialized variables as they will not be part of the initializers.
		uint32_t expr = get<SPIRVariable>(var).static_expression;
		if (expr == 0 || ir.ids[expr].get_type() == TypeUndef)
			continue;

		if (expected == 0)
		{
			expected = get<SPIRVariable>(var).basetype;
			expected_flags = get_decoration_bitset(var);
		}
		else if (expected != get<SPIRVariable>(var).basetype)
			return false;

		// Precision flags and things like that must also match.
		if (expected_flags != get_decoration_bitset(var))
			return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
addq $0xd0, %rdi
callq 0x8650
cmpq $0x1, %rax
ja 0x9acfd
movb $0x1, -0x1(%rbp)
jmp 0x9aeff
movl $0x0, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x10710
movq -0x18(%rbp), %rax
addq $0xd0, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0xbaf0
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
callq 0xbb20
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2e710
testb $0x1, %al
jne 0x9ad4b
jmp 0x9aee8
leaq -0x70(%rbp), %rdi
callq 0x2e750
movq -0xa0(%rbp), %rdi
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl (%rax), %esi
callq 0xfec0
movq %rax, -0xa8(%rbp)
jmp 0x9ad73
movq -0xa8(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
je 0x9adbf
movq -0xa0(%rbp), %rdi
addq $0x20, %rdi
movl -0x84(%rbp), %eax
movl %eax, %esi
callq 0xbdb0
movq %rax, %rdi
callq 0xfa00
movl %eax, -0xac(%rbp)
jmp 0x9adb4
movl -0xac(%rbp), %eax
cmpl $0xd, %eax
jne 0x9ade4
jmp 0x9aeda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xf250
jmp 0x9af0d
cmpl $0x0, -0x1c(%rbp)
jne 0x9ae41
movq -0xa0(%rbp), %rdi
movq -0x80(%rbp), %rax
movl (%rax), %esi
callq 0xfec0
movq %rax, -0xb8(%rbp)
jmp 0x9ae05
movq -0xa0(%rbp), %rdi
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x80(%rbp), %rax
movl (%rax), %esi
callq 0x23480
movq %rax, -0xc0(%rbp)
jmp 0x9ae2d
movq -0xc0(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x38560
jmp 0x9ae3f
jmp 0x9ae89
movq -0xa0(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0x80(%rbp), %rax
movl (%rax), %esi
callq 0xfec0
movq %rax, -0xc8(%rbp)
jmp 0x9ae65
movl -0xcc(%rbp), %eax
movq -0xc8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
je 0x9ae87
movb $0x0, -0x1(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x9aef6
jmp 0x9ae89
movq -0xa0(%rbp), %rdi
movq -0x80(%rbp), %rax
movl (%rax), %esi
callq 0x23480
movq %rax, -0xd8(%rbp)
jmp 0x9aea4
movq -0xd8(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x325a0
movb %al, -0xd9(%rbp)
jmp 0x9aebc
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x9aec8
jmp 0x9aed8
movb $0x0, -0x1(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x9aef6
jmp 0x9aeda
leaq -0x70(%rbp), %rdi
callq 0x2e770
jmp 0x9ad35
movb $0x1, -0x1(%rbp)
movl $0x1, -0x98(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xf250
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x7640
nopl (%rax)