// File: /workspace/github_cpp_makefile_star2_O2/tjohnman[P]sfxr-sdl2/build/../src/main.cpp
// Function: Slider(int, int, float&, bool, char const*)
bool Slider(int x, int y, float& value, bool bipolar, const char* text)
{
	bool result = false;
	if(MouseInBox(x, y, 100, 10))
	{
		if(mouse_rightclick)
		{
			value=0.0f;
			result = true;
		}
		if(mouse_leftclick)
		{
			if(dragOnLeftClick)
				vselected=&value;
			else
			{
				if(bipolar)
					value = (mouse_x - x)/50.0f - 1.0f;
				else
					value = (mouse_x - x)/100.0f;
				result = true;
			}
		}
	}
	float mv=(float)(mouse_x-mouse_px);
	if(vselected!=&value)
		mv=0.0f;
	if(bipolar)
	{
		value+=mv*0.005f;
		if(value<-1.0f) value=-1.0f;
		if(value>1.0f) value=1.0f;
	}
	else
	{
		value+=mv*0.0025f;
		if(value<0.0f) value=0.0f;
		if(value>1.0f) value=1.0f;
	}
	DrawBar(x-1, y, 102, 10, 0x000000);
	int ival=(int)(value*99);
	if(bipolar)
		ival=(int)(value*49.5f+49.5f);
	DrawBar(x, y+1, ival, 8, 0xF0C090);
	DrawBar(x+ival, y+1, 100-ival, 8, 0x807060);
	DrawBar(x+ival, y+1, 1, 8, 0xFFFFFF);
	if(bipolar)
	{
		DrawBar(x+50, y-1, 1, 3, 0x000000);
		DrawBar(x+50, y+8, 1, 3, 0x000000);
	}
	DWORD tcol=0x000000;
	if(wave_type!=0 && (&value==&p_duty || &value==&p_duty_ramp))
		tcol=0x808080;
	DrawText(font, x-4-strlen(text)*8, y+1, tcol, text);
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movl %ecx, %ebx
movq %rdx, %r15
movl %esi, %r12d
movl %edi, %r14d
pushq $0x64
popq %rdx
pushq $0xa
popq %rcx
callq 0x89a9
testb %al, %al
je 0x4a75
leaq 0x9c68(%rip), %rax      # 0xe6b0
movb (%rax), %cl
cmpb $0x1, %cl
jne 0x4a53
andl $0x0, (%r15)
leaq 0x9c55(%rip), %rax      # 0xe6af
cmpb $0x1, (%rax)
jne 0x4a77
cmpb $0x1, 0x9bda(%rip)      # 0xe640
jne 0x4c20
movq %r15, 0x9b95(%rip)      # 0xe608
jmp 0x4a77
xorl %ecx, %ecx
cmpq %r15, 0x9b8a(%rip)      # 0xe608
movl %ecx, 0xc(%rsp)
je 0x4a89
xorps %xmm0, %xmm0
jmp 0x4a9f
leaq 0x9c0c(%rip), %rax      # 0xe69c
movl (%rax), %eax
leaq 0x9c0b(%rip), %rcx      # 0xe6a4
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss (%r15), %xmm1
testb %bl, %bl
je 0x4abe
mulss 0x45c8(%rip), %xmm0     # 0x9078
addss %xmm1, %xmm0
movss 0x458c(%rip), %xmm1     # 0x9048
jmp 0x4acd
mulss 0x45ae(%rip), %xmm0     # 0x9074
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
maxss %xmm0, %xmm1
movss %xmm1, (%r15)
ucomiss 0x4533(%rip), %xmm1     # 0x9010
jbe 0x4ae6
movl $0x3f800000, (%r15)     # imm = 0x3F800000
leal -0x1(%r14), %edi
pushq $0x66
popq %rdx
pushq $0xa
popq %rcx
movl %r12d, %esi
xorl %r8d, %r8d
callq 0x8718
movss (%r15), %xmm0
testb %bl, %bl
movl %ebx, 0x8(%rsp)
jne 0x4b12
mulss 0x456c(%rip), %xmm0     # 0x907c
jmp 0x4b22
movss 0x4566(%rip), %xmm1     # 0x9080
mulss %xmm1, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %r13d
leal 0x1(%r12), %ebp
pushq $0x8
popq %rbx
movl %r14d, %edi
movl %ebp, %esi
movl %r13d, %edx
movl %ebx, %ecx
movl $0xf0c090, %r8d         # imm = 0xF0C090
callq 0x8718
pushq $0x64
popq %rdx
subl %r13d, %edx
addl %r14d, %r13d
movl %r13d, %edi
movl %ebp, %esi
movl %ebx, %ecx
movl $0x807060, %r8d         # imm = 0x807060
callq 0x8718
pushq $0x1
popq %rdx
movl %r13d, %edi
movl %ebp, %esi
movl %ebx, %ecx
movl $0xffffff, %r8d         # imm = 0xFFFFFF
callq 0x8718
cmpb $0x0, 0x8(%rsp)
je 0x4baf
leal 0x32(%r14), %ebx
leal -0x1(%r12), %esi
pushq $0x1
popq %rdx
pushq $0x3
popq %r13
movl %ebx, %edi
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x8718
addl $0x8, %r12d
movl %ebx, %edi
movl %r12d, %esi
pushq $0x1
popq %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
callq 0x8718
leaq 0x88c2(%rip), %rax      # 0xd478
cmpq %rax, %r15
movl $0x808080, %eax         # imm = 0x808080
movl $0x0, %ebx
cmovel %eax, %ebx
leaq 0x88a7(%rip), %rcx      # 0xd474
cmpq %rcx, %r15
cmovel %eax, %ebx
movl 0x8887(%rip), %eax      # 0xd460
testl %eax, %eax
cmovel %eax, %ebx
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x3120
shll $0x3, %eax
subl %eax, %r14d
addl $-0x4, %r14d
leaq 0x86ec(%rip), %rdi      # 0xd2e8
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x88c6
movl 0xc(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9a75(%rip), %rax      # 0xe69c
movl (%rax), %eax
subl %r14d, %eax
cvtsi2ss %eax, %xmm0
testb %bl, %bl
jne 0x4c3e
divss 0x4430(%rip), %xmm0     # 0x906c
jmp 0x4c4e
divss 0x442a(%rip), %xmm0     # 0x9070
addss 0x43fa(%rip), %xmm0     # 0x9048
movss %xmm0, (%r15)
movb $0x1, %cl
jmp 0x4a77