// File: /workspace/github_c_makefile_star2_O2/GangZhuo[P]dohclient/src/channel_chndoh.c
// Function: channel_chndoh_create
int channel_chndoh_create(
	channel_t** pctx,
	const char* name,
	const char* args,
	const config_t* conf,
	const proxy_t* proxies,
	const int proxy_num,
	const chnroute_ctx chnr,
	const chnroute_ctx blacklist,
	void* data)
{
	channel_chndoh_t* ctx;

	ctx = (channel_chndoh_t*)malloc(sizeof(channel_chndoh_t));
	if (!ctx) {
		loge("alloc\n");
		return CHANNEL_ALLOC;
	}

	memset(ctx, 0, sizeof(channel_chndoh_t));

	ctx->name = name;
	ctx->conf = conf;
	ctx->proxies = proxies;
	ctx->proxy_num = proxy_num;
	ctx->chnr = chnr;
	ctx->blacklist = blacklist;
	ctx->data = data;

	ctx->chndoh.timeout = conf->timeout;
	ctx->frndoh.timeout = conf->timeout;
	ctx->chndoh.keep_alive = TRUE;
	ctx->frndoh.keep_alive = TRUE;
	ctx->chndoh.auto_resolve_host = TRUE;
	ctx->frndoh.auto_resolve_host = TRUE;

	if (parse_args(ctx, args)) {
		loge("parse_args() error\n");
		free(ctx);
		return CHANNEL_WRONG_ARG;
	}

	if (check_ctx(ctx)) {
		free(ctx);
		return CHANNEL_WRONG_ARG;
	}

	rbtree_init(&ctx->reqdic, rbcmp);
	dllist_init(&ctx->reqs);

	ctx->fdset = fdset;
	ctx->step = step;
	ctx->query = query;
	ctx->destroy = destroy;

	if (ctx->chndoh.channel != CH_NONE && create_upstream_chctx(&ctx->chndoh, ctx)) {
		loge("create_upstream_chctx(chndoh) error\n");
		destroy((channel_t*)ctx);
		return CHANNEL_ERROR;
	}

	if (ctx->frndoh.channel != CH_NONE && create_upstream_chctx(&ctx->frndoh, ctx)) {
		loge("create_upstream_chctx(frndoh) error\n");
		destroy((channel_t*)ctx);
		return CHANNEL_ERROR;
	}

	*pctx = (channel_t*)ctx;

	return CHANNEL_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebp
movq %r8, %r12
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, 0x38(%rsp)
pushq $0x1
popq %rdi
movl $0xc20, %esi            # imm = 0xC20
callq 0x3250
testq %rax, %rax
je 0x9c31
movq %rax, %rbx
movq 0x90(%rsp), %rax
movq 0x88(%rsp), %rcx
movq 0x80(%rsp), %rdx
movq %r13, (%rbx)
movq %r15, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movl %ebp, 0x18(%rbx)
movq %rdx, 0x20(%rbx)
movq %rcx, 0x28(%rbx)
movq %rax, 0x50(%rbx)
movl 0x88(%r15), %eax
movl %eax, 0x4fc(%rbx)
movl %eax, 0xacc(%rbx)
pushq $0x1
popq %rax
movl %eax, 0x4f0(%rbx)
movl %eax, 0xac0(%rbx)
movl %eax, 0x648(%rbx)
movl %eax, 0xc18(%rbx)
andq $0x0, 0x40(%rsp)
testq %r14, %r14
je 0x9dff
leaq 0x80(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x650(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x3620
leaq 0x173b0(%rip), %rbp     # 0x20a39
leaq 0x40(%rsp), %r12
movq %rax, 0x20(%rsp)
movq %rax, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3610
movq %rax, %r14
leaq 0x518(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0x480(%rbx), %rax
movq %rax, 0x30(%rsp)
testq %r14, %r14
je 0x9c6c
cmpb $0x0, (%r14)
je 0x9c6c
movq %r14, %rdi
pushq $0x3d
popq %rsi
callq 0x3150
testq %rax, %rax
je 0x9a36
movq %rax, %r15
movb $0x0, (%rax)
incq %r15
movq %r14, %rdi
leaq 0x17345(%rip), %rsi     # 0x20a3b
callq 0x34f0
testl %eax, %eax
je 0x998c
movq %r14, %rdi
leaq 0x1733a(%rip), %rsi     # 0x20a47
callq 0x34f0
testl %eax, %eax
je 0x9993
movq %r14, %rdi
leaq 0x1735e(%rip), %rsi     # 0x20a82
callq 0x34f0
testl %eax, %eax
je 0x99f3
movq %r14, %rdi
leaq 0x17353(%rip), %rsi     # 0x20a8e
callq 0x34f0
testl %eax, %eax
je 0x9a20
movq %r14, %rdi
leaq 0x17348(%rip), %rsi     # 0x20a9a
callq 0x34f0
movl %eax, %r13d
testl %eax, %eax
je 0x99fb
movq %r14, %rdi
leaq 0x1733a(%rip), %rsi     # 0x20aa6
callq 0x34f0
testl %eax, %eax
je 0x99fb
movq %r14, %rdi
leaq 0x1732f(%rip), %rsi     # 0x20ab2
callq 0x34f0
testl %eax, %eax
je 0x9a4b
movq %r14, %rdi
leaq 0x17324(%rip), %rsi     # 0x20abe
callq 0x34f0
testl %eax, %eax
je 0x9a53
movq %r14, %rdi
leaq 0x17319(%rip), %rsi     # 0x20aca
callq 0x34f0
testl %eax, %eax
je 0x9a6b
movq %r14, %rdi
leaq 0x17314(%rip), %rsi     # 0x20adc
callq 0x34f0
testl %eax, %eax
je 0x9a73
movq %r14, %rdi
leaq 0x1730f(%rip), %rsi     # 0x20aee
callq 0x34f0
testl %eax, %eax
je 0x9a8b
movq %r14, %rdi
leaq 0x17304(%rip), %rsi     # 0x20afa
callq 0x34f0
testl %eax, %eax
je 0x9a93
movq %r14, %rdi
leaq 0x172f9(%rip), %rsi     # 0x20b06
callq 0x34f0
testl %eax, %eax
je 0x9ab2
movq %r14, %rdi
leaq 0x172ef(%rip), %rsi     # 0x20b13
callq 0x34f0
testl %eax, %eax
je 0x9aba
movq %r14, %rdi
leaq 0x172e5(%rip), %rsi     # 0x20b20
callq 0x34f0
testl %eax, %eax
je 0x9adc
movq %r14, %rdi
leaq 0x172d9(%rip), %rsi     # 0x20b2b
callq 0x34f0
testl %eax, %eax
je 0x9ae4
movq %r14, %rdi
leaq 0x172cd(%rip), %rsi     # 0x20b36
callq 0x34f0
testl %eax, %eax
je 0x9b06
movq %r14, %rdi
leaq 0x172c1(%rip), %rsi     # 0x20b41
callq 0x34f0
testl %eax, %eax
je 0x9b0d
movq %r14, %rdi
leaq 0x172cc(%rip), %rsi     # 0x20b63
callq 0x34f0
testl %eax, %eax
je 0x9b36
movq %r14, %rdi
leaq 0x172c1(%rip), %rsi     # 0x20b6f
callq 0x34f0
testl %eax, %eax
je 0x9b3d
movq %r14, %rdi
leaq 0x172b6(%rip), %rsi     # 0x20b7b
callq 0x34f0
testl %eax, %eax
je 0x9b66
movq %r14, %rdi
leaq 0x172ae(%rip), %rsi     # 0x20b8a
callq 0x34f0
testl %eax, %eax
je 0x9b6e
movq %r14, %rdi
leaq 0x172cd(%rip), %rsi     # 0x20bc0
callq 0x34f0
testl %eax, %eax
je 0x9bd3
movq %r14, %rdi
leaq 0x172c5(%rip), %rsi     # 0x20bcf
callq 0x34f0
testl %eax, %eax
je 0x9bec
movq %r14, %rdi
leaq 0x172bd(%rip), %rsi     # 0x20bde
callq 0x34f0
testl %eax, %eax
je 0x9c0e
movq %r14, %rdi
leaq 0x172b5(%rip), %rsi     # 0x20bed
callq 0x34f0
testl %eax, %eax
je 0x9c16
xorl %eax, %eax
callq 0x165f5
cmpl $0x4, (%rax)
leaq 0x170e3(%rip), %rbp     # 0x20a39
jl 0x9a36
movq %r15, (%rsp)
pushq $0x4
popq %rdi
leaq 0x17046(%rip), %rsi     # 0x209b0
leaq 0x170e9(%rip), %rdx     # 0x20a5a
movl $0x490, %ecx            # imm = 0x490
leaq 0x1727f(%rip), %r8      # 0x20bfc
movq %r14, %r9
xorl %eax, %eax
callq 0x1662e
jmp 0x9a36
movl $0x80, %ebp
jmp 0x9998
movl $0x650, %ebp            # imm = 0x650
leaq (%rbx,%rbp), %r13
movq %r15, %rdi
callq 0x3620
movq %rax, 0x458(%rbx,%rbp)
cmpl $0x1, 0x5b0(%rbx,%rbp)
leaq 0x8(%rbx,%rbp), %rsi
leaq 0x17097(%rip), %r8      # 0x20a57
leaq 0x1708c(%rip), %rax     # 0x20a53
cmoveq %rax, %r8
movq %r15, %rdi
pushq $0x8
popq %rdx
movl $0x88, %ecx
callq 0x170aa
testl %eax, %eax
jle 0x9da4
movl %eax, 0x448(%r13)
leaq 0x17048(%rip), %rbp     # 0x20a39
jmp 0x9a36
movl $0x80, %r14d
jmp 0x9a26
cmpb $0x0, (%r15)
je 0x9a36
movq %r15, %rdi
callq 0x3620
testl %r13d, %r13d
movq 0x10(%rsp), %rcx
cmoveq 0x18(%rsp), %rcx
movq %rax, 0x460(%rcx)
jmp 0x9a36
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
callq 0x3620
movq %rax, 0x450(%rbx,%r14)
xorl %edi, %edi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3610
movq %rax, %r14
jmp 0x96bc
movl $0x80, %r14d
jmp 0x9a59
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
callq 0x3620
movq %rax, 0x468(%rbx,%r14)
jmp 0x9a36
movl $0x80, %r14d
jmp 0x9a79
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
callq 0x3580
movl %eax, 0x470(%rbx,%r14)
jmp 0x9a36
movl $0x80, %r14d
jmp 0x9a99
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
leaq 0x15d1f(%rip), %rsi     # 0x1f7c2
callq 0x34f0
movl %eax, 0x44c(%rbx,%r14)
jmp 0x9a36
movl $0x80, %r14d
jmp 0x9ac0
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
leaq 0x15cf8(%rip), %rsi     # 0x1f7c2
callq 0x34f0
movl %eax, 0x474(%rbx,%r14)
jmp 0x9a36
movl $0x80, %r14d
jmp 0x9aea
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
leaq 0x15cce(%rip), %rsi     # 0x1f7c2
callq 0x34f0
movl %eax, 0x478(%rbx,%r14)
jmp 0x9a36
movl $0x80, %edi
jmp 0x9b12
movl $0x650, %edi            # imm = 0x650
cmpb $0x0, (%r15)
je 0x9a36
addq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0xa484
testl %eax, %eax
je 0x9a36
jmp 0x9e57
movl $0x80, %edi
jmp 0x9b42
movl $0x650, %edi            # imm = 0x650
cmpb $0x0, (%r15)
je 0x9a36
addq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0xa484
testl %eax, %eax
je 0x9a36
jmp 0x9e89
movl $0x80, %r13d
jmp 0x9b74
movl $0x650, %r13d           # imm = 0x650
movq %r15, %rdi
leaq 0x16a69(%rip), %rsi     # 0x205e7
callq 0x34f0
testl %eax, %eax
je 0x9bc2
movq %r15, %rdi
leaq 0x16a5a(%rip), %rsi     # 0x205eb
callq 0x34f0
testl %eax, %eax
je 0x9bdb
movq %r15, %rdi
leaq 0x16a4b(%rip), %rsi     # 0x205ef
callq 0x34f0
testl %eax, %eax
jne 0x9ebf
movl $0x1, 0x5b0(%rbx,%r13)
jmp 0x9a36
movl $0x2, 0x5b0(%rbx,%r13)
jmp 0x9a36
movl $0x80, %r14d
jmp 0x9bf2
movl $0x3, 0x5b0(%rbx,%r13)
jmp 0x9a36
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
leaq 0x15bc6(%rip), %rsi     # 0x1f7c2
callq 0x34f0
movl %eax, 0x5c8(%rbx,%r14)
jmp 0x99ea
movl $0x80, %r14d
jmp 0x9c1c
movl $0x650, %r14d           # imm = 0x650
movq %r15, %rdi
callq 0x3580
movl %eax, 0x47c(%rbx,%r14)
jmp 0x99ea
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9d3c
leaq 0x16d68(%rip), %rsi     # 0x209b0
leaq 0x16d76(%rip), %rdx     # 0x209c5
leaq 0x17c5d(%rip), %r8      # 0x218b3
pushq $0x3
popq %rbx
movl %ebx, %edi
movl $0x50a, %ecx            # imm = 0x50A
xorl %eax, %eax
callq 0x1662e
jmp 0x9e3a
movq 0x20(%rsp), %rdi
callq 0x3460
cmpl $0x0, 0x630(%rbx)
je 0x9c91
movq 0x18(%rsp), %rdi
callq 0xa502
testl %eax, %eax
jne 0x9e2f
cmpl $0x0, 0xc00(%rbx)
je 0x9cac
movq 0x10(%rsp), %rdi
callq 0xa502
testl %eax, %eax
jne 0x9e2f
andq $0x0, 0x68(%rbx)
leaq 0x23d(%rip), %rax       # 0x9ef5
movq %rax, 0x70(%rbx)
movq %rbx, %rax
addq $0x58, %rax
movq %rax, 0x58(%rbx)
movq %rax, 0x60(%rbx)
leaq 0x22c(%rip), %rax       # 0x9efe
movq %rax, 0x30(%rbx)
leaq 0x2d0(%rip), %rax       # 0x9fad
movq %rax, 0x38(%rbx)
leaq 0x3dc(%rip), %rax       # 0xa0c4
movq %rax, 0x40(%rbx)
leaq 0x4dd(%rip), %rax       # 0xa1d0
movq %rax, 0x48(%rbx)
cmpl $0x0, 0x630(%rbx)
je 0x9d43
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0xa31b
testl %eax, %eax
je 0x9d43
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9d95
leaq 0x16c8c(%rip), %rsi     # 0x209b0
leaq 0x16c9a(%rip), %rdx     # 0x209c5
leaq 0x16cbd(%rip), %r8      # 0x209ef
pushq $0x3
popq %rdi
movl $0x533, %ecx            # imm = 0x533
jmp 0x9d8e
pushq $0x3
jmp 0x9e39
cmpl $0x0, 0xc00(%rbx)
je 0x9e4b
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xa31b
testl %eax, %eax
je 0x9e4b
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9d95
leaq 0x16c38(%rip), %rsi     # 0x209b0
leaq 0x16c46(%rip), %rdx     # 0x209c5
leaq 0x16c8e(%rip), %r8      # 0x20a14
pushq $0x3
popq %rdi
movl $0x539, %ecx            # imm = 0x539
xorl %eax, %eax
callq 0x1662e
movq %rbx, %rdi
callq 0xa1d0
pushq $0x5
jmp 0x9e39
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9df5
cmpl $0x1, 0x5b0(%r13)
leaq 0x16c98(%rip), %rax     # 0x20a57
leaq 0x16c8d(%rip), %rcx     # 0x20a53
cmoveq %rcx, %rax
movq %rax, (%rsp)
leaq 0x16bdb(%rip), %rsi     # 0x209b0
leaq 0x16c7e(%rip), %rdx     # 0x20a5a
leaq 0x16c82(%rip), %r8      # 0x20a65
pushq $0x3
popq %rdi
movl $0x448, %ecx            # imm = 0x448
movq %r14, %r9
xorl %eax, %eax
callq 0x1662e
movq 0x20(%rsp), %rdi
callq 0x3460
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9e2f
leaq 0x16b9e(%rip), %rsi     # 0x209b0
leaq 0x16bac(%rip), %rdx     # 0x209c5
leaq 0x16bbb(%rip), %r8      # 0x209db
pushq $0x3
popq %rdi
movl $0x520, %ecx            # imm = 0x520
xorl %eax, %eax
callq 0x1662e
movq %rbx, %rdi
callq 0x3460
pushq $0x2
popq %rbx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rsp), %rax
movq %rbx, (%rax)
xorl %ebx, %ebx
jmp 0x9e3a
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9df5
movq %r15, (%rsp)
leaq 0x16b42(%rip), %rsi     # 0x209b0
leaq 0x16be5(%rip), %rdx     # 0x20a5a
leaq 0x16cd0(%rip), %r8      # 0x20b4c
pushq $0x3
popq %rdi
movl $0x46f, %ecx            # imm = 0x46F
jmp 0x9deb
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9df5
movq %r15, (%rsp)
leaq 0x16b0c(%rip), %rsi     # 0x209b0
leaq 0x16baf(%rip), %rdx     # 0x20a5a
leaq 0x16c9a(%rip), %r8      # 0x20b4c
pushq $0x3
popq %rdi
movl $0x477, %ecx            # imm = 0x477
jmp 0x9deb
xorl %eax, %eax
callq 0x165f5
cmpl $0x3, (%rax)
jl 0x9df5
movq %r15, (%rsp)
leaq 0x16ad6(%rip), %rsi     # 0x209b0
leaq 0x16b79(%rip), %rdx     # 0x20a5a
leaq 0x16cb1(%rip), %r8      # 0x20b99
pushq $0x3
popq %rdi
movl $0x482, %ecx            # imm = 0x482
jmp 0x9deb