// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/net/protocols/http.cpp
// Function: smooth::Net::Protocols::httpProgress(void*, double, double, double, double)
int S::Net::Protocols::httpProgress(void *data, double dlTotal, double dlNow, double ulTotal, double ulNow)
{
	HTTP	*http = (HTTP *) data;

	if (ulNow > 0 && http->ulStart == 0) http->ulStart = System::System::Clock() - 1;
	if (dlNow > 0 && http->dlStart == 0) http->dlStart = System::System::Clock() - 1;

	if (http->dlStart == 0)
	{
		if (ulTotal > 0) http->uploadProgress.Emit(Math::Round(1000.0 * ulNow / ulTotal));
		if (ulNow   > 0) http->uploadSpeed.Emit(String::FromInt(Math::Round((ulNow / 1024) / (Float(System::System::Clock() - http->ulStart) / 1000))).Append(" kB/s"));
	}
	else
	{
		if (dlTotal > 0) http->downloadProgress.Emit(Math::Round(1000.0 * dlNow / dlTotal));
		if (dlNow   > 0) http->downloadSpeed.Emit(String::FromInt(Math::Round((dlNow / 1024) / (Float(System::System::Clock() - http->dlStart) / 1000))).Append(" kB/s"));
	}

	return 0;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm3
jbe 0xaf609
cmpq $0x0, 0x260(%rbx)
jne 0xaf609
movsd %xmm3, (%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
callq 0x570e0
xorpd %xmm4, %xmm4
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm3
decq %rax
movq %rax, 0x260(%rbx)
ucomisd %xmm4, %xmm1
jbe 0xaf656
cmpq $0x0, 0x268(%rbx)
jne 0xaf656
movsd %xmm3, (%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
callq 0x570e0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm3
decq %rax
movq %rax, 0x268(%rbx)
cmpq $0x0, 0x268(%rbx)
je 0xaf753
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jbe 0xaf6b1
movsd 0x639ba(%rip), %xmm2    # 0x113030
mulsd %xmm1, %xmm2
divsd %xmm0, %xmm2
xorl %eax, %eax
ucomisd %xmm2, %xmm3
leaq 0x60(%rbx), %rdi
seta %al
leaq 0x4522e(%rip), %rcx     # 0xf48c0
addsd (%rcx,%rax,8), %xmm2
cvttsd2si %xmm2, %rsi
movsd %xmm1, 0x8(%rsp)
callq 0x72dc0
xorpd %xmm3, %xmm3
movsd 0x8(%rsp), %xmm1
ucomisd %xmm3, %xmm1
jbe 0xaf84d
mulsd 0x639e5(%rip), %xmm1    # 0x1130a8
movsd %xmm1, 0x8(%rsp)
callq 0x570e0
subq 0x268(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x6395e(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x63966(%rip), %xmm0    # 0x113050
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x63932(%rip), %xmm1    # 0x113030
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x44c88(%rip), %xmm0    # 0xf4398
cvttsd2si %xmm0, %rsi
leaq 0x38(%rsp), %rdi
callq 0x56cf0
leaq 0x6395a(%rip), %rsi     # 0x113080
leaq 0x20(%rsp), %rdi
callq 0x579f0
leaq 0x38(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x562f0
subq $-0x80, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x76a7e
jmp 0xaf839
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm2
jbe 0xaf79e
movsd 0x638cb(%rip), %xmm0    # 0x113030
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
leaq 0x20(%rbx), %rdi
seta %al
leaq 0x4513f(%rip), %rcx     # 0xf48c0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rsi
movsd %xmm3, (%rsp)
callq 0x72dc0
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm3
ucomisd %xmm1, %xmm3
jbe 0xaf84d
mulsd 0x638f8(%rip), %xmm3    # 0x1130a8
movsd %xmm3, (%rsp)
callq 0x570e0
subq 0x260(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x63872(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x6387a(%rip), %xmm0    # 0x113050
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x63846(%rip), %xmm1    # 0x113030
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x44b9d(%rip), %xmm0    # 0xf4398
cvttsd2si %xmm0, %rsi
leaq 0x38(%rsp), %rdi
callq 0x56cf0
leaq 0x6386f(%rip), %rsi     # 0x113080
leaq 0x20(%rsp), %rdi
callq 0x579f0
leaq 0x38(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x562f0
addq $0x40, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x76a7e
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
callq 0x59200
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
retq
jmp 0xaf857
movq %rax, %rbx
jmp 0xaf86b
jmp 0xaf85e
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57090
nop