// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/lib/net.c
// Function: urlFromNetParsedUrl
char *urlFromNetParsedUrl(struct netParsedUrl *npu)
/* Build URL from netParsedUrl structure */
{
struct dyString *dy = newDyString(512);

dyStringAppend(dy, npu->protocol);
dyStringAppend(dy, "://");
if (npu->user[0] != 0)
    {
    char *encUser = cgiEncode(npu->user);
    dyStringAppend(dy, encUser);
    freeMem(encUser);
    if (npu->password[0] != 0)
	{
	dyStringAppend(dy, ":");
	char *encPassword = cgiEncode(npu->password);
	dyStringAppend(dy, encPassword);
	freeMem(encPassword);
	}
    dyStringAppend(dy, "@");
    }
dyStringAppend(dy, npu->host);
/* do not include port if it is the default */
if (!(
 (sameString(npu->protocol, "ftp"  ) && sameString("21", npu->port)) ||
 (sameString(npu->protocol, "http" ) && sameString("80", npu->port)) ||
 (sameString(npu->protocol, "https") && sameString("443",npu->port))
    ))
    {
    dyStringAppend(dy, ":");
    dyStringAppend(dy, npu->port);
    }
dyStringAppend(dy, npu->file);
if (npu->byteRangeStart != -1)
    {
    dyStringPrintf(dy, ";byterange=%lld-", (long long)npu->byteRangeStart);
    if (npu->byteRangeEnd != -1)
	dyStringPrintf(dy, "%lld", (long long)npu->byteRangeEnd);
    }

/* Clean up and return handle. */
return dyStringCannibalize(&dy);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x200, %edi            # imm = 0x200
callq 0x261d0
movq %rax, (%rsp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x26425
movq (%rsp), %rdi
leaq 0x62743(%rip), %rsi     # 0x915cc
callq 0x26425
cmpb $0x0, 0x10(%rbx)
je 0x2ef03
leaq 0x10(%rbx), %rdi
callq 0x44d25
movq %rax, %r14
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x26425
movq %r14, %rdi
callq 0x2dd41
cmpb $0x0, 0x810(%rbx)
je 0x2eef3
leaq 0x810(%rbx), %r14
movq (%rsp), %rdi
leaq 0x6b586(%rip), %rsi     # 0x9a455
callq 0x26425
movq %r14, %rdi
callq 0x44d25
movq %rax, %r14
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x26425
movq %r14, %rdi
callq 0x2dd41
movq (%rsp), %rdi
leaq 0x62ff2(%rip), %rsi     # 0x91ef0
callq 0x26425
movq (%rsp), %rdi
leaq 0x1010(%rbx), %rsi
callq 0x26425
leaq 0x6603b(%rip), %rsi     # 0x94f55
movq %rbx, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x2ef3d
leaq 0x1810(%rbx), %rsi
leaq 0x62fa0(%rip), %rdi     # 0x91ed4
callq 0x6a50
testl %eax, %eax
je 0x2efb1
leaq 0x62f5e(%rip), %rsi     # 0x91ea2
movq %rbx, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x2ef67
leaq 0x1810(%rbx), %rsi
leaq 0x62f6f(%rip), %rdi     # 0x91ecd
callq 0x6a50
testl %eax, %eax
je 0x2efb1
leaq 0x62f39(%rip), %rsi     # 0x91ea7
movq %rbx, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x2ef91
leaq 0x1810(%rbx), %rsi
leaq 0x62f48(%rip), %rdi     # 0x91ed0
callq 0x6a50
testl %eax, %eax
je 0x2efb1
movq (%rsp), %rdi
leaq 0x6b4b9(%rip), %rsi     # 0x9a455
callq 0x26425
movq (%rsp), %rdi
leaq 0x1810(%rbx), %rsi
callq 0x26425
movq (%rsp), %rdi
leaq 0x1820(%rbx), %rsi
callq 0x26425
movq 0x2820(%rbx), %rdx
cmpq $-0x1, %rdx
je 0x2efff
movq (%rsp), %rdi
leaq 0x66094(%rip), %rsi     # 0x9506d
xorl %eax, %eax
callq 0x2656a
movq 0x2828(%rbx), %rdx
cmpq $-0x1, %rdx
je 0x2efff
movq (%rsp), %rdi
leaq 0x6148c(%rip), %rsi     # 0x90484
xorl %eax, %eax
callq 0x2656a
movq %rsp, %rdi
callq 0x2622c
addq $0x8, %rsp
popq %rbx
popq %r14
retq