// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/client/tcp.c
// Function: teavpn_tcp_client_init
static bool teavpn_tcp_client_init(char *config_buffer, client_config *config)
{
	if (config->config_file != NULL) {
		if (!teavpn_client_config_parser(config_buffer, config)) {
			debug_log(0, "Config error!");
			return 1;
		}
	}

	if (config->username == NULL) {
		debug_log(0, "username cannot be empty");
		return 1;
	}

	if (config->username_len >= 64) {
		debug_log(0, "Invalid username length");
		return 1;
	}

	if (config->password == NULL) {
		debug_log(0, "password cannot be empty");
		return 1;
	}

	if (config->server_ip == NULL) {
		debug_log(0, "server_ip cannot be empty");
		return 1;
	}

	if (config->server_port == 0) {
		debug_log(0, "server_port cannot be zero");
		return 1;
	}

	verbose_level = config->verbose_level;


	/**
	 * Create TUN/TAP interface.
	 */
	debug_log(2, "Allocating TUN/TAP interface...");
	if ((tap_fd = tun_alloc(config->dev, IFF_TUN)) < 0) {
		debug_log(0, "Error connecting to TUN/TAP interface %s!", config->dev);
		return 1;
	}
	debug_log(0, "Successfully created a new interface \"%s\".", config->dev);


	/**
	 * Create TCP socket.
	 */
	debug_log(1, "Creating TCP socket...");
	if ((net_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
		close(tap_fd);
		perror("Socket creation failed");
		return 1;
	}
	debug_log(1, "TCP socket created successfully");


	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x4e15
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3090
testb $0x1, %al
jne 0x4e13
leaq 0x9631(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4e0a
leaq 0x594b(%rip), %rdi      # 0xa74e
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
jmp 0x4e15
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x4e47
leaq 0x95fd(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4e3e
leaq 0x5925(%rip), %rdi      # 0xa75c
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
movq -0x18(%rbp), %rax
movzbl 0x38(%rax), %eax
cmpl $0x40, %eax
jl 0x4e7b
leaq 0x95c9(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4e72
leaq 0x590a(%rip), %rdi      # 0xa775
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x4ead
leaq 0x9597(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4ea4
leaq 0x58f0(%rip), %rdi      # 0xa78d
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x4ede
leaq 0x9566(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4ed5
leaq 0x58d8(%rip), %rdi      # 0xa7a6
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
movq -0x18(%rbp), %rax
movzwl 0x3a(%rax), %eax
cmpl $0x0, %eax
jne 0x4f12
leaq 0x9532(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4f09
leaq 0x58be(%rip), %rdi      # 0xa7c0
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
movq -0x18(%rbp), %rax
movb 0x3c(%rax), %cl
leaq 0x9504(%rip), %rax      # 0xe424
movb %cl, (%rax)
leaq 0x94fb(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x2, %eax
cmpl %ecx, %eax
jg 0x4f43
leaq 0x589f(%rip), %rdi      # 0xa7db
movb $0x0, %al
callq 0x84c0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x1, %esi
callq 0x8640
movl %eax, 0x9409(%rip)      # 0xe364
cmpl $0x0, %eax
jge 0x4f8f
leaq 0x94bd(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4f86
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x587c(%rip), %rdi      # 0xa7fb
movb $0x0, %al
callq 0x84c0
movb $0x1, -0x1(%rbp)
jmp 0x5034
leaq 0x948e(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x4fb5
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x5877(%rip), %rdi      # 0xa825
movb $0x0, %al
callq 0x84c0
leaq 0x9468(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x4fd6
leaq 0x5881(%rip), %rdi      # 0xa850
movb $0x0, %al
callq 0x84c0
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2420
movl %eax, 0x9373(%rip)      # 0xe360
cmpl $0x0, %eax
jge 0x500f
movl 0x936c(%rip), %edi      # 0xe364
callq 0x21b0
leaq 0x5863(%rip), %rdi      # 0xa867
callq 0x2360
movb $0x1, -0x1(%rbp)
jmp 0x5034
leaq 0x940e(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x5030
leaq 0x5855(%rip), %rdi      # 0xa87e
movb $0x0, %al
callq 0x84c0
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nop