// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/channel_tcp.c
// Function: channel_tcp_create
int channel_tcp_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_tcp_t* ctx;

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

	memset(ctx, 0, sizeof(channel_tcp_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->timeout = conf->timeout;

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

	if (ctx->timeout <= 0) {
		loge("invalid \"timeout\"\n");
		free(ctx);
		return CHANNEL_WRONG_ARG;
	}

	dllist_init(&ctx->reqs);

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

	*pctx = (channel_t*)ctx;

	return CHANNEL_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl $0x4c0, %edi            # imm = 0x4C0
callq 0x34d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x15d43
jmp 0x15d03
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x15d35
movl $0x3, %edi
leaq 0x20b15(%rip), %rsi     # 0x36830
leaq 0x20b5a(%rip), %rdx     # 0x3687c
movl $0x400, %ecx            # imm = 0x400
leaq 0x21169(%rip), %r8      # 0x36e97
movb $0x0, %al
callq 0x243b0
jmp 0x15d37
movl $0x3, -0x4(%rbp)
jmp 0x15eda
movq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x4c0, %edx            # imm = 0x4C0
callq 0x3200
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x18(%rax)
movq 0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq 0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rax
movl 0x88(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x4b8(%rax)
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15ef0
cmpl $0x0, %eax
je 0x15e15
jmp 0x15dcc
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x15dfe
movl $0x3, %edi
leaq 0x20a4c(%rip), %rsi     # 0x36830
leaq 0x20a91(%rip), %rdx     # 0x3687c
movl $0x410, %ecx            # imm = 0x410
leaq 0x201b2(%rip), %r8      # 0x35fa9
movb $0x0, %al
callq 0x243b0
jmp 0x15e00
movq -0x40(%rbp), %rdi
callq 0x3460
movl $0x2, -0x4(%rbp)
jmp 0x15eda
movq -0x40(%rbp), %rax
cmpl $0x0, 0x4b8(%rax)
jg 0x15e6a
jmp 0x15e24
movb $0x0, %al
callq 0x242d0
cmpl $0x3, (%rax)
jl 0x15e56
movl $0x3, %edi
leaq 0x209f4(%rip), %rsi     # 0x36830
leaq 0x20a39(%rip), %rdx     # 0x3687c
movl $0x416, %ecx            # imm = 0x416
leaq 0x203d9(%rip), %r8      # 0x36228
movb $0x0, %al
callq 0x243b0
jmp 0x15e58
movq -0x40(%rbp), %rdi
callq 0x3460
movl $0x2, -0x4(%rbp)
jmp 0x15eda
jmp 0x15e6c
movq -0x40(%rbp), %rcx
addq $0x58, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x40(%rbp), %rcx
addq $0x58, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x40(%rbp), %rax
leaq 0x2d9(%rip), %rcx       # 0x16170
movq %rcx, 0x30(%rax)
movq -0x40(%rbp), %rax
leaq 0x3ba(%rip), %rcx       # 0x16260
movq %rcx, 0x38(%rax)
movq -0x40(%rbp), %rax
leaq 0x61b(%rip), %rcx       # 0x164d0
movq %rcx, 0x40(%rax)
movq -0x40(%rbp), %rax
leaq 0x65c(%rip), %rcx       # 0x16520
movq %rcx, 0x48(%rax)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)