// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/utils.c
// Function: urlencode
int urlencode(char *buf, int buflen, const char *s)
{
	unsigned char *src  = (unsigned char *)s,
				  *dest = (unsigned char *)buf,
				  *end  = dest + buflen;
	int n = 0;
	while ((*src) && dest < end) {
		int ch = *src++;
		if (ch <= ' ' || ch > '~' ||
				ch == ':' || ch ==  '/' || ch == '?' || ch == '#' ||
				ch == '[' || ch ==  ']' || ch == '@' || ch == '!' ||
				ch == '$' || ch ==  '&' || ch == '\''|| ch == '(' ||
				ch == ')' || ch ==  '*' || ch == '+' || ch == ',' ||
				ch == ';' || ch ==  '=' || ch ==  '%') {
			if (ch == ' ') {
				*dest++ = '+';
			}
			else {
				int h = dec2ch((ch >> 4) & 0xf);
				int l = dec2ch(ch & 0xf);
				*dest++ = '%';
				if (dest < end) {
					*dest++ = h;
					if (dest < end) {
						*dest++ = l;
					}
				}
			}
		}
		else {
			*dest++ = ch;
		}
	}
	if (dest < end) {
		*dest = '\0';
	}
	return (int)(dest - (unsigned char*)buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
je 0x6e88
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setb %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x6e94
jmp 0x6fd7
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movzbl (%rax), %eax
movl %eax, -0x38(%rbp)
cmpl $0x20, -0x38(%rbp)
jle 0x6f2b
cmpl $0x7e, -0x38(%rbp)
jg 0x6f2b
cmpl $0x3a, -0x38(%rbp)
je 0x6f2b
cmpl $0x2f, -0x38(%rbp)
je 0x6f2b
cmpl $0x3f, -0x38(%rbp)
je 0x6f2b
cmpl $0x23, -0x38(%rbp)
je 0x6f2b
cmpl $0x5b, -0x38(%rbp)
je 0x6f2b
cmpl $0x5d, -0x38(%rbp)
je 0x6f2b
cmpl $0x40, -0x38(%rbp)
je 0x6f2b
cmpl $0x21, -0x38(%rbp)
je 0x6f2b
cmpl $0x24, -0x38(%rbp)
je 0x6f2b
cmpl $0x26, -0x38(%rbp)
je 0x6f2b
cmpl $0x27, -0x38(%rbp)
je 0x6f2b
cmpl $0x28, -0x38(%rbp)
je 0x6f2b
cmpl $0x29, -0x38(%rbp)
je 0x6f2b
cmpl $0x2a, -0x38(%rbp)
je 0x6f2b
cmpl $0x2b, -0x38(%rbp)
je 0x6f2b
cmpl $0x2c, -0x38(%rbp)
je 0x6f2b
cmpl $0x3b, -0x38(%rbp)
je 0x6f2b
cmpl $0x3d, -0x38(%rbp)
je 0x6f2b
cmpl $0x25, -0x38(%rbp)
jne 0x6fbc
cmpl $0x20, -0x38(%rbp)
jne 0x6f45
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x2b, (%rax)
jmp 0x6fba
movl -0x38(%rbp), %edi
sarl $0x4, %edi
andl $0xf, %edi
callq 0x7000
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %edi
andl $0xf, %edi
callq 0x7000
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x25, (%rax)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x6fb8
movl -0x3c(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x6fb6
movl -0x40(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
jmp 0x6fb8
jmp 0x6fba
jmp 0x6fd2
movl -0x38(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
jmp 0x6e69
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x6fe8
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)