// File: /workspace/github_cpp_makefile_star2_O1/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 0x9350
testb %al, %al
je 0x3c81
leaq 0xaa0f(%rip), %rax      # 0xe680
cmpb $0x1, (%rax)
jne 0x3c85
movl $0x0, (%r15)
movb $0x1, %cl
jmp 0x3c87
xorl %ecx, %ecx
jmp 0x3cdb
xorl %ecx, %ecx
leaq 0xa9f1(%rip), %rax      # 0xe67f
cmpb $0x1, (%rax)
jne 0x3cdb
cmpb $0x1, 0xa976(%rip)      # 0xe610
jne 0x3ca5
movq %r15, 0xa935(%rip)      # 0xe5d8
jmp 0x3cdb
leaq 0xa9c0(%rip), %rax      # 0xe66c
movl (%rax), %eax
subl %r14d, %eax
cvtsi2ss %eax, %xmm0
testb %r13b, %r13b
jne 0x3cc4
divss 0x63a6(%rip), %xmm0     # 0xa068
jmp 0x3cd4
divss 0x63a0(%rip), %xmm0     # 0xa06c
addss 0x6370(%rip), %xmm0     # 0xa044
movss %xmm0, (%r15)
movb $0x1, %cl
cmpq %r15, 0xa8f6(%rip)      # 0xe5d8
movl %ecx, 0xc(%rsp)
je 0x3ced
xorps %xmm0, %xmm0
jmp 0x3d06
leaq 0xa978(%rip), %rax      # 0xe66c
movl (%rax), %eax
leaq 0xa977(%rip), %rcx      # 0xe674
subl (%rcx), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss (%r15), %xmm1
testb %r13b, %r13b
je 0x3d26
mulss 0x635c(%rip), %xmm0     # 0xa074
addss %xmm1, %xmm0
movss 0x6320(%rip), %xmm1     # 0xa044
jmp 0x3d35
mulss 0x6342(%rip), %xmm0     # 0xa070
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
maxss %xmm0, %xmm1
movss %xmm1, (%r15)
ucomiss 0x62cb(%rip), %xmm1     # 0xa010
jbe 0x3d4e
movl $0x3f800000, (%r15)     # imm = 0x3F800000
leal -0x1(%r14), %edi
movl %r12d, %esi
movl $0x66, %edx
movl $0xa, %ecx
xorl %r8d, %r8d
callq 0x902a
movss (%r15), %xmm0
testb %r13b, %r13b
jne 0x3d7b
mulss 0x62ff(%rip), %xmm0     # 0xa078
jmp 0x3d8b
movss 0x62f9(%rip), %xmm1     # 0xa07c
mulss %xmm1, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %ebx
leal 0x1(%r12), %ebp
movl %r14d, %edi
movl %ebp, %esi
movl %ebx, %edx
movl $0x8, %ecx
movl $0xf0c090, %r8d         # imm = 0xF0C090
callq 0x902a
movl $0x64, %edx
subl %ebx, %edx
addl %r14d, %ebx
movl %ebx, %edi
movl %ebp, %esi
movl $0x8, %ecx
movl $0x807060, %r8d         # imm = 0x807060
callq 0x902a
movl %ebx, %edi
movl %ebp, %esi
movl $0x1, %edx
movl $0x8, %ecx
movl $0xffffff, %r8d         # imm = 0xFFFFFF
callq 0x902a
testb %r13b, %r13b
je 0x3e1f
leal 0x32(%r14), %ebx
leal -0x1(%r12), %esi
movl %ebx, %edi
movl $0x1, %edx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0x902a
addl $0x8, %r12d
movl %ebx, %edi
movl %r12d, %esi
movl $0x1, %edx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0x902a
leaq 0x9632(%rip), %rax      # 0xd458
cmpq %rax, %r15
movl $0x808080, %eax         # imm = 0x808080
movl $0x0, %ebx
cmovel %eax, %ebx
leaq 0x9617(%rip), %rcx      # 0xd454
cmpq %rcx, %r15
cmovel %eax, %ebx
movl 0x95f7(%rip), %eax      # 0xd440
testl %eax, %eax
cmovel %eax, %ebx
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x2120
shll $0x3, %eax
subl %eax, %r14d
addl $-0x4, %r14d
leaq 0x945c(%rip), %rdi      # 0xd2c8
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x926a
movl 0xc(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq