	.file	"extr_af_x25.c_x25_connect.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	x25_connect, @function
x25_connect:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rsi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12d, edx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	rbp, QWORD PTR 8[rdi]
	mov	DWORD PTR 12[rsp], ecx
	mov	rdi, rbp
	call	x25_sk@PLT
	mov	rdi, rbp
	mov	r14, rax
	call	lock_sock@PLT
	mov	rax, QWORD PTR 0[rbp]
	cmp	rax, QWORD PTR TCP_ESTABLISHED[rip]
	je	.L32
	mov	rdx, QWORD PTR TCP_CLOSE[rip]
	cmp	rax, rdx
	je	.L33
.L5:
	mov	rax, QWORD PTR SS_UNCONNECTED[rip]
	mov	r15d, DWORD PTR EINVAL[rip]
	mov	QWORD PTR 0[rbp], rdx
	neg	r15d
	mov	QWORD PTR [rbx], rax
	cmp	r12d, 16
	je	.L34
.L4:
	mov	rdi, rbp
	call	release_sock@PLT
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r15d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	mov	rax, QWORD PTR AF_X25[rip]
	cmp	QWORD PTR 0[r13], rax
	jne	.L4
	mov	r15d, DWORD PTR ENETUNREACH[rip]
	lea	rdi, 8[r13]
	call	x25_get_route@PLT
	neg	r15d
	mov	r12, rax
	test	rax, rax
	je	.L4
	mov	edi, DWORD PTR [rax]
	call	x25_get_neigh@PLT
	mov	DWORD PTR [r14], eax
	mov	esi, eax
	test	eax, eax
	jne	.L35
.L6:
	mov	rdi, r12
	call	x25_route_put@PLT
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L33:
	mov	rax, QWORD PTR SS_CONNECTING[rip]
	cmp	QWORD PTR [rbx], rax
	jne	.L5
	mov	r15d, DWORD PTR ECONNREFUSED[rip]
	mov	rax, QWORD PTR SS_UNCONNECTED[rip]
	neg	r15d
	mov	QWORD PTR [rbx], rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	mov	r15d, DWORD PTR EISCONN[rip]
	mov	rax, QWORD PTR SS_CONNECTING[rip]
	neg	r15d
	cmp	QWORD PTR [rbx], rax
	jne	.L4
	mov	rax, QWORD PTR SS_CONNECTED[rip]
	xor	r15d, r15d
	mov	QWORD PTR [rbx], rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L35:
	lea	rdi, 20[r14]
	call	x25_limit_facilities@PLT
	mov	edi, DWORD PTR [r14]
	call	x25_new_lci@PLT
	mov	DWORD PTR 16[r14], eax
	test	eax, eax
	je	.L7
	mov	esi, DWORD PTR SOCK_ZAPPED[rip]
	mov	rdi, rbp
	mov	r15d, DWORD PTR EINVAL[rip]
	call	sock_flag@PLT
	test	rax, rax
	jne	.L30
	mov	edi, DWORD PTR 12[r14]
	mov	esi, DWORD PTR null_x25_address[rip]
	call	strcmp@PLT
	test	eax, eax
	je	.L36
.L9:
	mov	eax, DWORD PTR 8[r13]
	mov	esi, DWORD PTR X25_CALL_REQUEST[rip]
	mov	rdi, rbp
	mov	DWORD PTR 8[r14], eax
	mov	rax, QWORD PTR SS_CONNECTING[rip]
	mov	QWORD PTR [rbx], rax
	mov	rax, QWORD PTR TCP_SYN_SENT[rip]
	mov	QWORD PTR 0[rbp], rax
	mov	eax, DWORD PTR X25_STATE_1[rip]
	mov	DWORD PTR 4[r14], eax
	call	x25_write_internal@PLT
	mov	rdi, rbp
	call	x25_start_heartbeat@PLT
	mov	rdi, rbp
	call	x25_start_t21timer@PLT
	mov	rax, QWORD PTR TCP_ESTABLISHED[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L10
	mov	eax, DWORD PTR 12[rsp]
	test	DWORD PTR O_NONBLOCK[rip], eax
	jne	.L37
.L10:
	mov	rdi, rbp
	call	x25_wait_for_connection_establishment@PLT
	mov	r15d, eax
	test	eax, eax
	jne	.L11
	mov	rax, QWORD PTR SS_CONNECTED[rip]
	mov	QWORD PTR [rbx], rax
	jmp	.L6
.L37:
	mov	r15d, DWORD PTR EINPROGRESS[rip]
.L30:
	neg	r15d
.L7:
	test	r15d, r15d
	je	.L6
.L11:
	mov	edi, DWORD PTR [r14]
	call	x25_neigh_put@PLT
	jmp	.L6
.L36:
	mov	edx, DWORD PTR X25_ADDR_LEN[rip]
	lea	rdi, 12[r14]
	xor	esi, esi
	call	memset@PLT
	jmp	.L9
	.cfi_endproc
.LFE0:
	.size	x25_connect, .-x25_connect
	.comm	null_x25_address,4,4
	.comm	X25_STATE_1,4,4
	.comm	X25_CALL_REQUEST,4,4
	.comm	X25_ADDR_LEN,4,4
	.comm	TCP_SYN_SENT,8,8
	.comm	TCP_ESTABLISHED,8,8
	.comm	TCP_CLOSE,8,8
	.comm	SS_UNCONNECTED,8,8
	.comm	SS_CONNECTING,8,8
	.comm	SS_CONNECTED,8,8
	.comm	SOCK_ZAPPED,4,4
	.comm	O_NONBLOCK,4,4
	.comm	ENETUNREACH,4,4
	.comm	EISCONN,4,4
	.comm	EINVAL,4,4
	.comm	EINPROGRESS,4,4
	.comm	ECONNREFUSED,4,4
	.comm	AF_X25,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_af_x25.c_x25_connect.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	x25_connect, %function
x25_connect:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r4, [r0, #4]
	sub	sp, sp, #12
	mov	r5, r0
	mov	r0, r4
	mov	r6, r2
	mov	r9, r3
	mov	r7, r1
	bl	x25_sk
	ldr	r10, .L39
	mov	r8, r0
	mov	r0, r4
	bl	lock_sock
	ldr	r3, [r4]
	ldr	r2, [r10]
	cmp	r3, r2
	beq	.L32
	ldr	r2, .L39+4
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L33
.L5:
	ldr	r1, .L39+8
	ldr	fp, .L39+12
	ldr	r1, [r1]
	cmp	r6, #8
	ldr	r6, [fp]
	str	r2, [r4]
	rsb	r6, r6, #0
	str	r1, [r5]
	beq	.L34
.L4:
	mov	r0, r4
	bl	release_sock
	mov	r0, r6
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L34:
	ldr	r2, .L39+16
	ldr	r1, [r7]
	ldr	r2, [r2]
	cmp	r1, r2
	bne	.L4
	ldr	r2, .L39+20
	add	r0, r7, #4
	ldr	r6, [r2]
	bl	x25_get_route
	subs	r3, r0, #0
	rsb	r6, r6, #0
	str	r3, [sp, #4]
	beq	.L4
	ldr	r0, [r3]
	bl	x25_get_neigh
	cmp	r0, #0
	str	r0, [r8]
	bne	.L35
.L6:
	ldr	r0, [sp, #4]
	bl	x25_route_put
	b	.L4
.L33:
	ldr	r3, .L39+24
	ldr	r1, [r5]
	ldr	r3, [r3]
	cmp	r1, r3
	bne	.L5
	ldr	r2, .L39+28
	ldr	r3, .L39+8
	ldr	r6, [r2]
	ldr	r3, [r3]
	rsb	r6, r6, #0
	str	r3, [r5]
	b	.L4
.L32:
	ldr	r3, .L39+24
	ldr	r2, [r5]
	ldr	r3, [r3]
	cmp	r2, r3
	ldrne	r3, .L39+32
	ldrne	r6, [r3]
	rsbne	r6, r6, #0
	bne	.L4
.L36:
	ldr	r3, .L39+36
	mov	r6, #0
	ldr	r3, [r3]
	str	r3, [r5]
	b	.L4
.L35:
	mov	r1, r0
	add	r0, r8, #20
	bl	x25_limit_facilities
	ldr	r0, [r8]
	bl	x25_new_lci
	cmp	r0, #0
	str	r0, [r8, #16]
	beq	.L7
	ldr	r2, .L39+40
	mov	r0, r4
	ldr	r1, [r2]
	ldr	r6, [fp]
	bl	sock_flag
	cmp	r0, #0
	bne	.L30
	ldr	r3, .L39+44
	ldr	r0, [r8, #12]
	ldr	r1, [r3]
	bl	strcmp
	subs	r1, r0, #0
	beq	.L37
.L9:
	ldr	r2, .L39+24
	ldr	r0, [r7, #4]
	ldr	r2, [r2]
	ldr	r1, .L39+48
	ldr	r3, .L39+52
	ldr	r1, [r1]
	ldr	r3, [r3]
	str	r0, [r8, #8]
	str	r2, [r5]
	ldr	r2, .L39+56
	str	r1, [r4]
	mov	r0, r4
	ldr	r1, [r2]
	str	r3, [r8, #4]
	bl	x25_write_internal
	mov	r0, r4
	bl	x25_start_heartbeat
	mov	r0, r4
	bl	x25_start_t21timer
	ldr	r3, [r10]
	ldr	r2, [r4]
	cmp	r2, r3
	beq	.L10
	ldr	r3, .L39+60
	ldr	r3, [r3]
	tst	r9, r3
	bne	.L38
.L10:
	mov	r0, r4
	bl	x25_wait_for_connection_establishment
	subs	r6, r0, #0
	bne	.L11
	ldr	r3, .L39+36
	ldr	r3, [r3]
	str	r3, [r5]
	b	.L6
.L38:
	ldr	r3, .L39+64
	ldr	r6, [r3]
.L30:
	rsb	r6, r6, #0
.L7:
	cmp	r6, #0
	beq	.L6
.L11:
	ldr	r0, [r8]
	bl	x25_neigh_put
	b	.L6
.L37:
	ldr	r3, .L39+68
	add	r0, r8, #12
	ldr	r2, [r3]
	bl	memset
	b	.L9
.L40:
	.align	2
.L39:
	.word	TCP_ESTABLISHED
	.word	TCP_CLOSE
	.word	SS_UNCONNECTED
	.word	EINVAL
	.word	AF_X25
	.word	ENETUNREACH
	.word	SS_CONNECTING
	.word	ECONNREFUSED
	.word	EISCONN
	.word	SS_CONNECTED
	.word	SOCK_ZAPPED
	.word	null_x25_address
	.word	TCP_SYN_SENT
	.word	X25_STATE_1
	.word	X25_CALL_REQUEST
	.word	O_NONBLOCK
	.word	EINPROGRESS
	.word	X25_ADDR_LEN
	.size	x25_connect, .-x25_connect
	.comm	null_x25_address,4,4
	.comm	X25_STATE_1,4,4
	.comm	X25_CALL_REQUEST,4,4
	.comm	X25_ADDR_LEN,4,4
	.comm	TCP_SYN_SENT,4,4
	.comm	TCP_ESTABLISHED,4,4
	.comm	TCP_CLOSE,4,4
	.comm	SS_UNCONNECTED,4,4
	.comm	SS_CONNECTING,4,4
	.comm	SS_CONNECTED,4,4
	.comm	SOCK_ZAPPED,4,4
	.comm	O_NONBLOCK,4,4
	.comm	ENETUNREACH,4,4
	.comm	EISCONN,4,4
	.comm	EINVAL,4,4
	.comm	EINPROGRESS,4,4
	.comm	ECONNREFUSED,4,4
	.comm	AF_X25,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
