// File: /workspace/github_c_makefile_star2_O1/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, 0x40(%rsp)
movl $0xc20, %edi            # imm = 0xC20
callq 0x34b0
testq %rax, %rax
je 0xa4bd
movq %rax, %rbx
movl $0xc20, %edx            # imm = 0xC20
movq %rax, %rdi
xorl %esi, %esi
callq 0x31e0
movq %r13, (%rbx)
movq %r15, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movl %ebp, 0x18(%rbx)
movq 0x80(%rsp), %rax
movq %rax, 0x20(%rbx)
movq 0x88(%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x50(%rbx)
movl 0x88(%r15), %eax
movl %eax, 0x4fc(%rbx)
movl %eax, 0xacc(%rbx)
movl $0x1, %eax
movl %eax, 0x4f0(%rbx)
movl %eax, 0xac0(%rbx)
movl %eax, 0x648(%rbx)
movl %eax, 0xc18(%rbx)
movq $0x0, 0x28(%rsp)
testq %r14, %r14
je 0xa6b3
leaq 0x80(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x650(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x3610
leaq 0x18b9f(%rip), %rsi     # 0x22a31
leaq 0x28(%rsp), %rdx
movq %rax, 0x20(%rsp)
movq %rax, %rdi
callq 0x3600
testq %rax, %rax
je 0xa4fd
movq %rax, %r14
leaq 0x518(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x480(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0x18b62(%rip), %rbp     # 0x22a31
leaq 0x28(%rsp), %r12
cmpb $0x0, (%r14)
je 0xa4fd
movq %r14, %rdi
movl $0x3d, %esi
callq 0x3150
testq %rax, %rax
je 0xa2b9
movq %rax, %r13
movb $0x0, (%rax)
incq %r13
movq %r14, %rdi
leaq 0x18b2c(%rip), %rsi     # 0x22a33
callq 0x34e0
testl %eax, %eax
je 0xa19f
movq %r14, %rdi
leaq 0x18b21(%rip), %rsi     # 0x22a3f
callq 0x34e0
testl %eax, %eax
je 0xa1a6
movq %r14, %rdi
leaq 0x18b45(%rip), %rsi     # 0x22a7a
callq 0x34e0
testl %eax, %eax
je 0xa275
movq %r14, %rdi
leaq 0x18b3a(%rip), %rsi     # 0x22a86
callq 0x34e0
testl %eax, %eax
je 0xa2a3
movq %r14, %rdi
leaq 0x18b2f(%rip), %rsi     # 0x22a92
callq 0x34e0
movl %eax, %r15d
testl %eax, %eax
je 0xa27d
movq %r14, %rdi
leaq 0x18b21(%rip), %rsi     # 0x22a9e
callq 0x34e0
testl %eax, %eax
je 0xa27d
movq %r14, %rdi
leaq 0x18b16(%rip), %rsi     # 0x22aaa
callq 0x34e0
testl %eax, %eax
je 0xa2d7
movq %r14, %rdi
leaq 0x18b0b(%rip), %rsi     # 0x22ab6
callq 0x34e0
testl %eax, %eax
je 0xa2df
movq %r14, %rdi
leaq 0x18b00(%rip), %rsi     # 0x22ac2
callq 0x34e0
testl %eax, %eax
je 0xa2f7
movq %r14, %rdi
leaq 0x18afb(%rip), %rsi     # 0x22ad4
callq 0x34e0
testl %eax, %eax
je 0xa2ff
movq %r14, %rdi
leaq 0x18af6(%rip), %rsi     # 0x22ae6
callq 0x34e0
testl %eax, %eax
je 0xa317
movq %r14, %rdi
leaq 0x18aeb(%rip), %rsi     # 0x22af2
callq 0x34e0
testl %eax, %eax
je 0xa31f
movq %r14, %rdi
leaq 0x18ae0(%rip), %rsi     # 0x22afe
callq 0x34e0
testl %eax, %eax
je 0xa341
movq %r14, %rdi
leaq 0x18ad6(%rip), %rsi     # 0x22b0b
callq 0x34e0
testl %eax, %eax
je 0xa349
movq %r14, %rdi
leaq 0x18acc(%rip), %rsi     # 0x22b18
callq 0x34e0
testl %eax, %eax
je 0xa36b
movq %r14, %rdi
leaq 0x18ac0(%rip), %rsi     # 0x22b23
callq 0x34e0
testl %eax, %eax
je 0xa373
movq %r14, %rdi
leaq 0x18ab4(%rip), %rsi     # 0x22b2e
callq 0x34e0
testl %eax, %eax
je 0xa395
movq %r14, %rdi
leaq 0x18aa8(%rip), %rsi     # 0x22b39
callq 0x34e0
testl %eax, %eax
je 0xa39c
movq %r14, %rdi
leaq 0x18ab3(%rip), %rsi     # 0x22b5b
callq 0x34e0
testl %eax, %eax
je 0xa3c6
movq %r14, %rdi
leaq 0x18aa8(%rip), %rsi     # 0x22b67
callq 0x34e0
testl %eax, %eax
je 0xa3cd
movq %r14, %rdi
leaq 0x18a9d(%rip), %rsi     # 0x22b73
callq 0x34e0
testl %eax, %eax
je 0xa3f7
movq %r14, %rdi
leaq 0x18a95(%rip), %rsi     # 0x22b82
callq 0x34e0
testl %eax, %eax
je 0xa3ff
movq %r14, %rdi
leaq 0x18ab4(%rip), %rsi     # 0x22bb8
callq 0x34e0
testl %eax, %eax
je 0xa45e
movq %r14, %rdi
leaq 0x18aac(%rip), %rsi     # 0x22bc7
callq 0x34e0
testl %eax, %eax
je 0xa474
movq %r14, %rdi
leaq 0x18aa4(%rip), %rsi     # 0x22bd6
callq 0x34e0
testl %eax, %eax
je 0xa493
movq %r14, %rdi
leaq 0x18a9c(%rip), %rsi     # 0x22be5
callq 0x34e0
testl %eax, %eax
je 0xa49b
xorl %eax, %eax
callq 0x17d59
cmpl $0x4, (%rax)
leaq 0x188ca(%rip), %rbp     # 0x22a31
jl 0xa2b9
movq %r13, (%rsp)
movl $0x4, %edi
leaq 0x1882b(%rip), %rsi     # 0x229a8
leaq 0x188ce(%rip), %rdx     # 0x22a52
movl $0x490, %ecx            # imm = 0x490
leaq 0x18a64(%rip), %r8      # 0x22bf4
movq %r14, %r9
xorl %eax, %eax
callq 0x17d92
jmp 0xa2b9
movl $0x80, %ebp
jmp 0xa1ab
movl $0x650, %ebp            # imm = 0x650
leaq (%rbx,%rbp), %r15
movq %r13, %rdi
callq 0x3610
movq %rax, 0x458(%rbx,%rbp)
cmpl $0x1, 0x5b0(%rbx,%rbp)
leaq 0x8(%rbx,%rbp), %rsi
leaq 0x1887c(%rip), %r8      # 0x22a4f
leaq 0x18871(%rip), %rax     # 0x22a4b
cmoveq %rax, %r8
movq %r13, %rdi
movl $0x8, %edx
movl $0x88, %ecx
callq 0x18825
movl %eax, %r13d
testl %eax, %eax
jle 0xa207
movl %r13d, 0x448(%r15)
leaq 0x1882c(%rip), %rbp     # 0x22a31
jmp 0xa26b
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
leaq 0x18819(%rip), %rbp     # 0x22a31
jl 0xa261
cmpl $0x1, 0x5b0(%r15)
leaq 0x18826(%rip), %rax     # 0x22a4f
leaq 0x1881b(%rip), %rcx     # 0x22a4b
cmoveq %rcx, %rax
movq %rax, (%rsp)
movl $0x3, %edi
leaq 0x18764(%rip), %rsi     # 0x229a8
leaq 0x18807(%rip), %rdx     # 0x22a52
movl $0x448, %ecx            # imm = 0x448
leaq 0x18806(%rip), %r8      # 0x22a5d
movq %r14, %r9
xorl %eax, %eax
callq 0x17d92
movq 0x20(%rsp), %rdi
callq 0x3450
testl %r13d, %r13d
jg 0xa2b9
jmp 0xa6b3
movl $0x80, %r14d
jmp 0xa2a9
cmpb $0x0, (%r13)
je 0xa2b9
movq %r13, %rdi
callq 0x3610
testl %r15d, %r15d
movq 0x10(%rsp), %rcx
cmoveq 0x18(%rsp), %rcx
movq %rax, 0x460(%rcx)
jmp 0xa2b9
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
callq 0x3610
movq %rax, 0x450(%rbx,%r14)
xorl %edi, %edi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x3600
movq %rax, %r14
testq %rax, %rax
jne 0x9ed4
jmp 0xa4fd
movl $0x80, %r14d
jmp 0xa2e5
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
callq 0x3610
movq %rax, 0x468(%rbx,%r14)
jmp 0xa2b9
movl $0x80, %r14d
jmp 0xa305
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
callq 0x3570
movl %eax, 0x470(%rbx,%r14)
jmp 0xa2b9
movl $0x80, %r14d
jmp 0xa325
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
leaq 0x174b3(%rip), %rsi     # 0x217e2
callq 0x34e0
movl %eax, 0x44c(%rbx,%r14)
jmp 0xa2b9
movl $0x80, %r14d
jmp 0xa34f
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
leaq 0x17489(%rip), %rsi     # 0x217e2
callq 0x34e0
movl %eax, 0x474(%rbx,%r14)
jmp 0xa2b9
movl $0x80, %r14d
jmp 0xa379
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
leaq 0x1745f(%rip), %rsi     # 0x217e2
callq 0x34e0
movl %eax, 0x478(%rbx,%r14)
jmp 0xa2b9
movl $0x80, %edi
jmp 0xa3a1
movl $0x650, %edi            # imm = 0x650
cmpb $0x0, (%r13)
je 0xa2b9
addq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0xad19
testl %eax, %eax
je 0xa2b9
jmp 0xa63f
movl $0x80, %edi
jmp 0xa3d2
movl $0x650, %edi            # imm = 0x650
cmpb $0x0, (%r13)
je 0xa2b9
addq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0xad19
testl %eax, %eax
je 0xa2b9
jmp 0xa670
movl $0x80, %r15d
jmp 0xa405
movl $0x650, %r15d           # imm = 0x650
movq %r13, %rdi
leaq 0x181f8(%rip), %rsi     # 0x22607
callq 0x34e0
testl %eax, %eax
je 0xa450
movq %r13, %rdi
leaq 0x181e9(%rip), %rsi     # 0x2260b
callq 0x34e0
testl %eax, %eax
je 0xa466
movq %r13, %rdi
leaq 0x181da(%rip), %rsi     # 0x2260f
callq 0x34e0
testl %eax, %eax
jne 0xa703
movl $0x1, 0x5b0(%rbx,%r15)
jmp 0xa4b1
movl $0x2, 0x5b0(%rbx,%r15)
jmp 0xa4b1
movl $0x80, %r14d
jmp 0xa47a
movl $0x3, 0x5b0(%rbx,%r15)
jmp 0xa4b1
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
leaq 0x1735e(%rip), %rsi     # 0x217e2
callq 0x34e0
movl %eax, 0x5c8(%rbx,%r14)
jmp 0xa4b1
movl $0x80, %r14d
jmp 0xa4a1
movl $0x650, %r14d           # imm = 0x650
movq %r13, %rdi
callq 0x3570
movl %eax, 0x47c(%rbx,%r14)
leaq 0x18579(%rip), %rbp     # 0x22a31
jmp 0xa2b9
xorl %eax, %eax
callq 0x17d59
movl $0x3, %ebx
cmpl $0x3, (%rax)
jl 0xa6f2
leaq 0x184cf(%rip), %rsi     # 0x229a8
leaq 0x184dd(%rip), %rdx     # 0x229bd
leaq 0x193bc(%rip), %r8      # 0x238a3
movl $0x3, %edi
movl $0x50a, %ecx            # imm = 0x50A
xorl %eax, %eax
callq 0x17d92
jmp 0xa6f2
movq 0x20(%rsp), %rdi
callq 0x3450
cmpl $0x0, 0x630(%rbx)
je 0xa522
movq 0x18(%rsp), %rdi
callq 0xad9b
testl %eax, %eax
jne 0xa6e5
cmpl $0x0, 0xc00(%rbx)
je 0xa53d
movq 0x10(%rsp), %rdi
callq 0xad9b
testl %eax, %eax
jne 0xa6e5
movq $0x0, 0x68(%rbx)
leaq 0x1eb(%rip), %rax       # 0xa737
movq %rax, 0x70(%rbx)
movq %rbx, %rax
addq $0x58, %rax
movq %rax, 0x58(%rbx)
movq %rax, 0x60(%rbx)
leaq 0x1da(%rip), %rax       # 0xa740
movq %rax, 0x30(%rbx)
leaq 0x277(%rip), %rax       # 0xa7e8
movq %rax, 0x38(%rbx)
leaq 0x38c(%rip), %rax       # 0xa908
movq %rax, 0x40(%rbx)
leaq 0x499(%rip), %rax       # 0xaa20
movq %rax, 0x48(%rbx)
cmpl $0x0, 0x630(%rbx)
je 0xa5d2
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0xab9e
testl %eax, %eax
je 0xa5d2
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xa61e
leaq 0x183f0(%rip), %rsi     # 0x229a8
leaq 0x183fe(%rip), %rdx     # 0x229bd
leaq 0x18421(%rip), %r8      # 0x229e7
movl $0x3, %edi
movl $0x533, %ecx            # imm = 0x533
jmp 0xa617
cmpl $0x0, 0xc00(%rbx)
je 0xa630
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0xab9e
testl %eax, %eax
je 0xa630
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xa61e
leaq 0x183a9(%rip), %rsi     # 0x229a8
leaq 0x183b7(%rip), %rdx     # 0x229bd
leaq 0x183ff(%rip), %r8      # 0x22a0c
movl $0x3, %edi
movl $0x539, %ecx            # imm = 0x539
xorl %eax, %eax
callq 0x17d92
movq %rbx, %rdi
callq 0xaa20
movl $0x5, %ebx
jmp 0xa6f2
movq 0x40(%rsp), %rax
movq %rbx, (%rax)
xorl %ebx, %ebx
jmp 0xa6f2
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xa6a9
movq %r13, (%rsp)
leaq 0x18352(%rip), %rsi     # 0x229a8
leaq 0x183f5(%rip), %rdx     # 0x22a52
leaq 0x184e0(%rip), %r8      # 0x22b44
movl $0x3, %edi
movl $0x46f, %ecx            # imm = 0x46F
jmp 0xa69f
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xa6a9
movq %r13, (%rsp)
leaq 0x18321(%rip), %rsi     # 0x229a8
leaq 0x183c4(%rip), %rdx     # 0x22a52
leaq 0x184af(%rip), %r8      # 0x22b44
movl $0x3, %edi
movl $0x477, %ecx            # imm = 0x477
movq %r14, %r9
xorl %eax, %eax
callq 0x17d92
movq 0x20(%rsp), %rdi
callq 0x3450
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xa6e5
leaq 0x182e2(%rip), %rsi     # 0x229a8
leaq 0x182f0(%rip), %rdx     # 0x229bd
leaq 0x182ff(%rip), %r8      # 0x229d3
movl $0x3, %edi
movl $0x520, %ecx            # imm = 0x520
xorl %eax, %eax
callq 0x17d92
movq %rbx, %rdi
callq 0x3450
movl $0x2, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0x17d59
cmpl $0x3, (%rax)
jl 0xa6a9
movq %r13, (%rsp)
leaq 0x1828e(%rip), %rsi     # 0x229a8
leaq 0x18331(%rip), %rdx     # 0x22a52
leaq 0x18469(%rip), %r8      # 0x22b91
movl $0x3, %edi
movl $0x482, %ecx            # imm = 0x482
jmp 0xa69f