// File: /workspace/github_c_makefile_star2_O3/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 0xae855
cmpq $0x0, 0x260(%rbx)
jne 0xae855
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
movq 0x268(%rbx), %rax
jbe 0xae8a4
testq %rax, %rax
jne 0xae8ad
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)
testq %rax, %rax
je 0xae99c
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jbe 0xae8fa
movsd 0x63921(%rip), %xmm2    # 0x1121e0
mulsd %xmm1, %xmm2
divsd %xmm0, %xmm2
xorl %eax, %eax
ucomisd %xmm2, %xmm3
leaq 0x60(%rbx), %rdi
seta %al
leaq 0x44f15(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm2
cvttsd2si %xmm2, %rsi
movsd %xmm1, 0x8(%rsp)
callq 0x72a62
xorpd %xmm3, %xmm3
movsd 0x8(%rsp), %xmm1
ucomisd %xmm3, %xmm1
jbe 0xaea96
mulsd 0x6394c(%rip), %xmm1    # 0x112258
movsd %xmm1, 0x8(%rsp)
callq 0x570e0
subq 0x268(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x638c5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x638cd(%rip), %xmm0    # 0x112200
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x63899(%rip), %xmm1    # 0x1121e0
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x44a3f(%rip), %xmm0    # 0xf3398
cvttsd2si %xmm0, %rsi
leaq 0x38(%rsp), %rdi
callq 0x56cf0
leaq 0x638c1(%rip), %rsi     # 0x112230
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 0x76794
jmp 0xaea82
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm2
jbe 0xae9e7
movsd 0x63832(%rip), %xmm0    # 0x1121e0
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
leaq 0x20(%rbx), %rdi
seta %al
leaq 0x44e26(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rsi
movsd %xmm3, (%rsp)
callq 0x72a62
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm3
ucomisd %xmm1, %xmm3
jbe 0xaea96
mulsd 0x6385f(%rip), %xmm3    # 0x112258
movsd %xmm3, (%rsp)
callq 0x570e0
subq 0x260(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x637d9(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x637e1(%rip), %xmm0    # 0x112200
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x637ad(%rip), %xmm1    # 0x1121e0
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x44954(%rip), %xmm0    # 0xf3398
cvttsd2si %xmm0, %rsi
leaq 0x38(%rsp), %rdi
callq 0x56cf0
leaq 0x637d6(%rip), %rsi     # 0x112230
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 0x76794
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
callq 0x59200
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
retq
jmp 0xaeaa2
jmp 0xaeaa7
movq %rax, %rbx
jmp 0xaeab4
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57090