// File: /workspace/github_cpp_makefile_star2_O3/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, %r13d
movq %rdx, %r15
movl %esi, %r12d
movl %edi, %r14d
movl $0x64, %edx
movl $0xa, %ecx
callq 0x93d0
testb %al, %al
je 0x3ca4
leaq 0xaa1c(%rip), %rax      # 0xe690
movb (%rax), %cl
cmpb $0x1, %cl
jne 0x3c82
movl $0x0, (%r15)
leaq 0xaa06(%rip), %rax      # 0xe68f
cmpb $0x1, (%rax)
jne 0x3ca6
cmpb $0x1, 0xa98b(%rip)      # 0xe620
jne 0x3e5b
movq %r15, 0xa946(%rip)      # 0xe5e8
jmp 0x3ca6
xorl %ecx, %ecx
cmpq %r15, 0xa93b(%rip)      # 0xe5e8
movl %ecx, 0xc(%rsp)
je 0x3cb8
xorps %xmm0, %xmm0
jmp 0x3cd1
leaq 0xa9bd(%rip), %rax      # 0xe67c
movl (%rax), %eax
leaq 0xa9bc(%rip), %rcx      # 0xe684
subl (%rcx), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss (%r15), %xmm1
testb %r13b, %r13b
je 0x3cf1
mulss 0x6391(%rip), %xmm0     # 0xa074
addss %xmm1, %xmm0
movss 0x6355(%rip), %xmm1     # 0xa044
jmp 0x3d00
mulss 0x6377(%rip), %xmm0     # 0xa070
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
maxss %xmm0, %xmm1
movss %xmm1, (%r15)
ucomiss 0x6300(%rip), %xmm1     # 0xa010
jbe 0x3d19
movl $0x3f800000, (%r15)     # imm = 0x3F800000
leal -0x1(%r14), %edi
movl %r12d, %esi
movl $0x66, %edx
movl $0xa, %ecx
xorl %r8d, %r8d
callq 0x8fd6
movss (%r15), %xmm0
testb %r13b, %r13b
jne 0x3d46
mulss 0x6334(%rip), %xmm0     # 0xa078
jmp 0x3d56
movss 0x632e(%rip), %xmm1     # 0xa07c
mulss %xmm1, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %ebp
leal 0x1(%r12), %ebx
movl %r14d, %edi
movl %ebx, %esi
movl %ebp, %edx
movl $0x8, %ecx
movl $0xf0c090, %r8d         # imm = 0xF0C090
callq 0x8fd6
movl $0x64, %edx
subl %ebp, %edx
addl %r14d, %ebp
movl %ebp, %edi
movl %ebx, %esi
movl $0x8, %ecx
movl $0x807060, %r8d         # imm = 0x807060
callq 0x8fd6
movl %ebp, %edi
movl %ebx, %esi
movl $0x1, %edx
movl $0x8, %ecx
movl $0xffffff, %r8d         # imm = 0xFFFFFF
callq 0x8fd6
testb %r13b, %r13b
je 0x3dea
leal 0x32(%r14), %ebp
leal -0x1(%r12), %esi
movl %ebp, %edi
movl $0x1, %edx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0x8fd6
addl $0x8, %r12d
movl %ebp, %edi
movl %r12d, %esi
movl $0x1, %edx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0x8fd6
leaq 0x9667(%rip), %rax      # 0xd458
cmpq %rax, %r15
movl $0x808080, %eax         # imm = 0x808080
movl $0x0, %ebp
cmovel %eax, %ebp
leaq 0x964c(%rip), %rcx      # 0xd454
cmpq %rcx, %r15
cmovel %eax, %ebp
movl 0x962c(%rip), %eax      # 0xd440
testl %eax, %eax
cmovel %eax, %ebp
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x2120
shll $0x3, %eax
subl %eax, %r14d
addl $-0x4, %r14d
leaq 0x9491(%rip), %rdi      # 0xd2c8
movl %r14d, %esi
movl %ebx, %edx
movl %ebp, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x92ea
movl 0xc(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa81a(%rip), %rax      # 0xe67c
movl (%rax), %eax
subl %r14d, %eax
cvtsi2ss %eax, %xmm0
testb %r13b, %r13b
jne 0x3e7a
divss 0x61f0(%rip), %xmm0     # 0xa068
jmp 0x3e8a
divss 0x61ea(%rip), %xmm0     # 0xa06c
addss 0x61ba(%rip), %xmm0     # 0xa044
movss %xmm0, (%r15)
movb $0x1, %cl
jmp 0x3ca6