// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::binary_op_bitcast_helper(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, spirv_cross::SPIRType::BaseType&, unsigned int, unsigned int, bool)
SPIRType CompilerGLSL::binary_op_bitcast_helper(string &cast_op0, string &cast_op1, SPIRType::BaseType &input_type,
                                                uint32_t op0, uint32_t op1, bool skip_cast_if_equal_type)
{
	auto &type0 = expression_type(op0);
	auto &type1 = expression_type(op1);

	// We have to bitcast if our inputs are of different type, or if our types are not equal to expected inputs.
	// For some functions like OpIEqual and INotEqual, we don't care if inputs are of different types than expected
	// since equality test is exactly the same.
	bool cast = (type0.basetype != type1.basetype) || (!skip_cast_if_equal_type && type0.basetype != input_type);

	// Create a fake type so we can bitcast to it.
	// We only deal with regular arithmetic types here like int, uints and so on.
	SPIRType expected_type;
	expected_type.basetype = input_type;
	expected_type.vecsize = type0.vecsize;
	expected_type.columns = type0.columns;
	expected_type.width = type0.width;

	if (cast)
	{
		cast_op0 = bitcast_glsl(expected_type, op0);
		cast_op1 = bitcast_glsl(expected_type, op1);
	}
	else
	{
		// If we don't cast, our actual input type is that of the first (or second) argument.
		cast_op0 = to_enclosed_unpacked_expression(op0);
		cast_op1 = to_enclosed_unpacked_expression(op1);
		input_type = type0.basetype;
	}

	return expected_type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0xf8(%rbp)
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
movb 0x18(%rbp), %al
movl 0x10(%rbp), %r10d
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
andb $0x1, %al
movb %al, -0x2d(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
movl -0x2c(%rbp), %esi
callq 0x1f760
movq -0xe8(%rbp), %rdi
movq %rax, -0x38(%rbp)
movl 0x10(%rbp), %esi
callq 0x1f760
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x40(%rbp), %rdx
movb $0x1, %al
cmpl 0xc(%rdx), %ecx
movb %al, -0xd9(%rbp)
jne 0x74852
xorl %eax, %eax
testb $0x1, -0x2d(%rbp)
movb %al, -0xf9(%rbp)
jne 0x74846
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl (%rcx), %eax
setne %al
movb %al, -0xf9(%rbp)
movb -0xf9(%rbp), %al
movb %al, -0xd9(%rbp)
movq -0xf8(%rbp), %rdi
movb -0xd9(%rbp), %al
andb $0x1, %al
movb %al, -0x41(%rbp)
movb $0x0, -0x42(%rbp)
callq 0x31440
movq -0xf8(%rbp), %rax
movq -0x28(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rcx
movl 0x14(%rcx), %ecx
movl %ecx, 0x14(%rax)
movq -0x38(%rbp), %rcx
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl %ecx, 0x10(%rax)
testb $0x1, -0x41(%rbp)
je 0x7493e
movq -0xf8(%rbp), %rdx
movq -0xe8(%rbp), %rsi
movl -0x2c(%rbp), %ecx
leaq -0x68(%rbp), %rdi
callq 0x749f0
jmp 0x748c1
movq -0x18(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movq %rsi, -0x108(%rbp)
callq 0x7430
movq -0x108(%rbp), %rdi
callq 0x7708
movq -0xe8(%rbp), %rsi
movq -0xf8(%rbp), %rdx
movl 0x10(%rbp), %ecx
leaq -0x98(%rbp), %rdi
callq 0x749f0
jmp 0x74900
movq -0x20(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x7430
leaq -0x98(%rbp), %rdi
callq 0x7708
jmp 0x749ba
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
callq 0x314e0
jmp 0x749e0
movq -0xe8(%rbp), %rsi
movl -0x2c(%rbp), %edx
leaq -0xb8(%rbp), %rdi
callq 0x727b0
jmp 0x74956
movq -0x18(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
movq %rsi, -0x110(%rbp)
callq 0x7430
movq -0x110(%rbp), %rdi
callq 0x7708
movq -0xe8(%rbp), %rsi
movl 0x10(%rbp), %edx
leaq -0xd8(%rbp), %rdi
callq 0x727b0
jmp 0x74991
movq -0x20(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x7430
leaq -0xd8(%rbp), %rdi
callq 0x7708
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x42(%rbp)
testb $0x1, -0x42(%rbp)
jne 0x749d0
movq -0xf8(%rbp), %rdi
callq 0x314e0
movq -0xf0(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x7640
nopl (%rax)