	.file	"extr_netplay_init.c_netplay_new.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Netplay does not support input device %u\n"
	.text
	.p2align 4
	.globl	netplay_new
	.type	netplay_new, @function
netplay_new:
.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
	mov	r14d, ecx
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13d, edx
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rsi
	mov	esi, 112
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	mov	edi, 1
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, r8d
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	QWORD PTR 8[rsp], r9
	call	calloc@PLT
	mov	r15, rax
	test	rax, rax
	je	.L1
	mov	r9, QWORD PTR 8[rsp]
	mov	DWORD PTR [rax], -1
	xor	edx, edx
	mov	DWORD PTR 104[rax], r13d
	mov	eax, DWORD PTR [r9]
	mov	DWORD PTR 8[r15], 0
	mov	DWORD PTR 100[r15], eax
	mov	rax, rbp
	or	rax, r12
	sete	dl
	mov	DWORD PTR 4[r15], edx
	je	.L3
	mov	eax, DWORD PTR 96[rsp]
	mov	DWORD PTR 12[r15], 0
	mov	DWORD PTR 16[r15], r14d
	mov	DWORD PTR 96[r15], eax
	mov	rax, QWORD PTR NETPLAY_CONNECTION_NONE[rip]
	mov	DWORD PTR 20[r15], ebx
	mov	QWORD PTR 64[r15], rax
	lea	rax, 80[r15]
	mov	QWORD PTR 56[r15], rax
	movabs	rax, 4294967296
	mov	QWORD PTR 24[r15], rax
	mov	DWORD PTR 32[r15], 1
	mov	DWORD PTR 80[r15], -1
.L21:
	mov	rax, QWORD PTR 88[rsp]
	cmp	BYTE PTR [rax], 0
	jne	.L5
	mov	rax, QWORD PTR RARCH_DEFAULT_NICK[rip]
	mov	QWORD PTR 88[rsp], rax
.L5:
	mov	edi, DWORD PTR 72[r15]
	mov	rsi, QWORD PTR 88[rsp]
	mov	edx, 4
	call	strlcpy@PLT
	mov	rdi, r15
	mov	ecx, r13d
	mov	rdx, r12
	mov	rsi, rbp
	call	init_socket@PLT
	mov	rdi, r15
	test	eax, eax
	je	.L40
	call	netplay_init_buffers@PLT
	test	eax, eax
	je	.L20
	mov	ecx, DWORD PTR 4[r15]
	test	ecx, ecx
	je	.L8
	mov	edx, DWORD PTR MAX_INPUT_DEVICES[rip]
	xor	r12d, r12d
	mov	ebp, 1
	test	edx, edx
	jne	.L9
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L11:
	cmp	DWORD PTR RETRO_DEVICE_NONE[rip], ebx
	lea	r13d, 1[r12]
	je	.L13
	mov	esi, ebp
	mov	ecx, r12d
	mov	rdi, r15
	sal	esi, cl
	call	netplay_expected_input_size@PLT
	test	eax, eax
	je	.L42
.L13:
	cmp	DWORD PTR MAX_INPUT_DEVICES[rip], r13d
	jbe	.L15
	mov	r12d, r13d
.L9:
	mov	edi, r12d
	call	input_config_get_device@PLT
	mov	rdx, QWORD PTR 40[r15]
	mov	ebx, eax
	mov	eax, r12d
	mov	DWORD PTR [rdx+rax*4], ebx
	mov	eax, DWORD PTR RETRO_DEVICE_MASK[rip]
	and	eax, ebx
	cmp	eax, DWORD PTR RETRO_DEVICE_KEYBOARD[rip]
	jne	.L11
	mov	DWORD PTR 48[r15], 1
	xor	eax, eax
	call	netplay_key_hton_init@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rsi, QWORD PTR 56[r15]
	mov	rdi, r15
	call	netplay_handshake_init_send@PLT
	mov	rax, QWORD PTR NETPLAY_CONNECTION_INIT[rip]
	mov	rdx, QWORD PTR 56[r15]
	mov	QWORD PTR 8[rdx], rax
	mov	QWORD PTR 64[r15], rax
.L15:
	mov	eax, DWORD PTR 4[r15]
	test	eax, eax
	jne	.L16
	mov	rax, QWORD PTR 56[r15]
	mov	edi, DWORD PTR [rax]
	call	socket_nonblock@PLT
	test	eax, eax
	jne	.L1
.L10:
	mov	edi, DWORD PTR [r15]
	test	edi, edi
	js	.L19
	call	socket_close@PLT
.L19:
	mov	rax, QWORD PTR 56[r15]
	test	rax, rax
	je	.L20
	mov	edi, DWORD PTR [rax]
	test	edi, edi
	js	.L20
	call	socket_close@PLT
	.p2align 4,,10
	.p2align 3
.L20:
	mov	rdi, r15
.L40:
	call	free@PLT
	xor	r15d, r15d
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r15
	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
.L3:
	.cfi_restore_state
	mov	eax, DWORD PTR 80[rsp]
	mov	DWORD PTR 16[r15], r14d
	mov	DWORD PTR 20[r15], ebx
	mov	DWORD PTR 12[r15], eax
	mov	eax, DWORD PTR 96[rsp]
	mov	QWORD PTR 56[r15], 0
	mov	DWORD PTR 96[r15], eax
	mov	rax, QWORD PTR NETPLAY_CONNECTION_SPECTATING[rip]
	mov	DWORD PTR 32[r15], 0
	mov	QWORD PTR 64[r15], rax
	movabs	rax, 4294967296
	mov	QWORD PTR 24[r15], rax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L42:
	mov	esi, r13d
	lea	rdi, .LC0[rip]
	call	RARCH_WARN@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L16:
	mov	edi, DWORD PTR [r15]
	call	socket_nonblock@PLT
	test	eax, eax
	jne	.L1
	jmp	.L10
	.cfi_endproc
.LFE0:
	.size	netplay_new, .-netplay_new
	.comm	RETRO_DEVICE_NONE,4,4
	.comm	RETRO_DEVICE_MASK,4,4
	.comm	RETRO_DEVICE_KEYBOARD,4,4
	.comm	RARCH_DEFAULT_NICK,8,8
	.comm	NETPLAY_CONNECTION_SPECTATING,8,8
	.comm	NETPLAY_CONNECTION_NONE,8,8
	.comm	NETPLAY_CONNECTION_INIT,8,8
	.comm	MAX_INPUT_DEVICES,4,4
	.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_netplay_init.c_netplay_new.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Netplay does not support input device %u\012\000"
	.text
	.align	2
	.global	netplay_new
	.syntax unified
	.arm
	.fpu softvfp
	.type	netplay_new, %function
netplay_new:
	@ args = 20, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r6, r0
	sub	sp, sp, #12
	mov	r7, r1
	mov	r0, #1
	mov	r1, #76
	mov	r8, r2
	mov	r9, r3
	ldr	fp, [sp, #52]
	ldr	r10, [sp, #60]
	bl	calloc
	subs	r4, r0, #0
	beq	.L1
	orr	r3, r6, r7
	cmp	r3, #0
	mov	r5, r0
	mvn	r1, #0
	moveq	r0, #1
	movne	r0, #0
	mov	r2, #0
	ldr	ip, [fp]
	str	r8, [r4, #72]
	str	ip, [r4, #68]
	str	r0, [r4, #4]
	str	r1, [r4]
	str	r2, [r4, #8]
	beq	.L3
	mov	r0, #1
	ldr	r3, .L41
	str	r2, [r4, #12]
	ldr	ip, [r3]
	ldr	r3, [sp, #48]
	str	r2, [r4, #24]
	ldr	r2, [sp, #64]
	str	r3, [r4, #20]
	add	r3, r4, #56
	str	r9, [r4, #16]
	str	r2, [r4, #64]
	str	r1, [r4, #56]
	str	ip, [r4, #48]
	str	r0, [r4, #28]
	str	r0, [r4, #32]
	str	r3, [r4, #44]
.L21:
	ldrb	r3, [r10]	@ zero_extendqisi2
	mov	r2, #4
	cmp	r3, #0
	ldreq	r3, .L41+4
	ldr	r0, [r5, #52]
	ldreq	r10, [r3]
	mov	r1, r10
	bl	strlcpy
	mov	r1, r6
	mov	r3, r8
	mov	r2, r7
	mov	r0, r5
	bl	init_socket
	subs	r6, r0, #0
	mov	r0, r5
	beq	.L37
	bl	netplay_init_buffers
	subs	r6, r0, #0
	beq	.L20
	ldr	r3, [r5, #4]
	cmp	r3, #0
	beq	.L8
	ldr	r7, .L41+8
	ldr	r3, [r7]
	cmp	r3, #0
	beq	.L16
	mov	fp, #0
	ldr	r10, .L41+12
	ldr	r9, .L41+16
	ldr	r8, .L41+20
	b	.L9
.L11:
	mov	r2, #1
	ldr	r0, [r8]
	lsl	r1, r2, fp
	cmp	r0, r3
	beq	.L13
	mov	r0, r5
	bl	netplay_expected_input_size
	cmp	r0, #0
	beq	.L40
.L13:
	ldr	r3, [r7]
	cmp	r3, r6
	bls	.L15
	mov	fp, r6
.L9:
	mov	r0, fp
	bl	input_config_get_device
	mov	r3, r0
	ldr	r0, [r5, #36]
	add	r6, fp, #1
	str	r3, [r0, fp, lsl #2]
	ldr	r0, [r10]
	ldr	ip, [r9]
	and	r0, r0, r3
	cmp	r0, ip
	bne	.L11
	str	r3, [sp, #4]
	mov	r3, #1
	str	r3, [r5, #40]
	bl	netplay_key_hton_init
	ldr	r3, [sp, #4]
	b	.L11
.L8:
	mov	r0, r5
	ldr	r1, [r5, #44]
	bl	netplay_handshake_init_send
	ldr	r3, .L41+24
	ldr	r2, [r5, #44]
	ldr	r3, [r3]
	str	r3, [r2, #4]
	str	r3, [r5, #48]
.L15:
	ldr	r3, [r5, #4]
	cmp	r3, #0
	bne	.L16
	ldr	r3, [r5, #44]
	ldr	r0, [r3]
	bl	socket_nonblock
	cmp	r0, #0
	bne	.L1
.L10:
	ldr	r0, [r5]
	cmp	r0, #0
	blt	.L19
	bl	socket_close
.L19:
	ldr	r3, [r5, #44]
	cmp	r3, #0
	beq	.L20
	ldr	r0, [r3]
	cmp	r0, #0
	blt	.L20
	bl	socket_close
.L20:
	mov	r0, r5
.L37:
	bl	free
	mov	r4, #0
.L1:
	mov	r0, r4
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L3:
	mov	r2, #1
	ldr	r0, [sp, #56]
	ldr	r1, .L41+28
	str	r0, [r4, #12]
	ldr	r0, [sp, #48]
	ldr	r1, [r1]
	str	r0, [r4, #20]
	ldr	r0, [sp, #64]
	str	r9, [r4, #16]
	str	r3, [r4, #24]
	str	r0, [r4, #64]
	str	r3, [r4, #44]
	str	r3, [r4, #32]
	str	r1, [r4, #48]
	str	r2, [r4, #28]
	b	.L21
.L40:
	mov	r1, r6
	ldr	r0, .L41+32
	bl	RARCH_WARN
	b	.L13
.L16:
	ldr	r0, [r5]
	bl	socket_nonblock
	cmp	r0, #0
	beq	.L10
	mov	r0, r4
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L42:
	.align	2
.L41:
	.word	NETPLAY_CONNECTION_NONE
	.word	RARCH_DEFAULT_NICK
	.word	MAX_INPUT_DEVICES
	.word	RETRO_DEVICE_MASK
	.word	RETRO_DEVICE_KEYBOARD
	.word	RETRO_DEVICE_NONE
	.word	NETPLAY_CONNECTION_INIT
	.word	NETPLAY_CONNECTION_SPECTATING
	.word	.LC0
	.size	netplay_new, .-netplay_new
	.comm	RETRO_DEVICE_NONE,4,4
	.comm	RETRO_DEVICE_MASK,4,4
	.comm	RETRO_DEVICE_KEYBOARD,4,4
	.comm	RARCH_DEFAULT_NICK,4,4
	.comm	NETPLAY_CONNECTION_SPECTATING,4,4
	.comm	NETPLAY_CONNECTION_NONE,4,4
	.comm	NETPLAY_CONNECTION_INIT,4,4
	.comm	MAX_INPUT_DEVICES,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
