	.file	"extr_session.c_session_open.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	session_open
	.type	session_open, @function
session_open:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	test	rdi, rdi
	mov	r13, rsi
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	setne	dil
	movzx	edi, dil
	call	assert@PLT
	xor	edi, edi
	test	r13, r13
	setne	dil
	xor	r12d, r12d
	call	assert@PLT
	mov	edi, 80
	call	malloc@PLT
	test	rax, rax
	je	.L1
	mov	QWORD PTR 72[rax], rbp
	lea	rdi, 64[rax]
	mov	edx, 4
	mov	rsi, r13
	mov	r12, rax
	call	memcpy@PLT
	mov	eax, DWORD PTR CLOSED[rip]
	mov	QWORD PTR 56[r12], 0
	mov	QWORD PTR [r12], -1
	mov	DWORD PTR 48[r12], eax
	xor	eax, eax
	mov	QWORD PTR 8[r12], -1
	mov	DWORD PTR 16[r12], -1
	mov	QWORD PTR 40[r12], 0
	call	kbd_maxkey@PLT
	mov	edi, eax
	call	bit_alloc@PLT
	mov	QWORD PTR 24[r12], rax
	test	rax, rax
	je	.L8
	xor	eax, eax
	call	kbd_maxkey@PLT
	mov	edi, eax
	call	bit_alloc@PLT
	mov	QWORD PTR 32[r12], rax
	test	rax, rax
	je	.L10
	mov	edx, DWORD PTR next[rip]
	mov	rsi, r12
	mov	rdi, rbp
	call	LIST_INSERT_HEAD@PLT
.L1:
	mov	rax, r12
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	mov	rdi, QWORD PTR 24[r12]
	call	free@PLT
.L8:
	mov	rdi, r12
	xor	r12d, r12d
	call	free@PLT
	mov	rax, r12
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	session_open, .-session_open
	.comm	next,4,4
	.comm	CLOSED,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_session.c_session_open.c"
	.text
	.align	2
	.global	session_open
	.syntax unified
	.arm
	.fpu softvfp
	.type	session_open, %function
session_open:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r6, r1
	mov	r5, r0
	subs	r0, r0, #0
	movne	r0, #1
	bl	assert
	subs	r0, r6, #0
	movne	r0, #1
	bl	assert
	mov	r0, #48
	bl	malloc
	subs	r4, r0, #0
	beq	.L1
	mov	r1, r6
	mov	r2, #4
	str	r5, [r4, #44]
	add	r0, r4, #40
	bl	memcpy
	mvn	r3, #0
	mov	r2, #0
	ldr	r1, .L10
	str	r3, [r4]
	ldr	r1, [r1]
	str	r3, [r4, #4]
	str	r1, [r4, #32]
	str	r3, [r4, #8]
	str	r3, [r4, #12]
	str	r3, [r4, #16]
	str	r2, [r4, #36]
	str	r2, [r4, #28]
	bl	kbd_maxkey
	bl	bit_alloc
	cmp	r0, #0
	mov	r6, r0
	str	r0, [r4, #20]
	beq	.L7
	bl	kbd_maxkey
	bl	bit_alloc
	cmp	r0, #0
	mov	r6, r0
	str	r0, [r4, #24]
	beq	.L9
	ldr	r3, .L10+4
	mov	r0, r5
	mov	r1, r4
	ldr	r2, [r3]
	bl	LIST_INSERT_HEAD
.L1:
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L9:
	ldr	r0, [r4, #20]
	bl	free
.L7:
	mov	r0, r4
	mov	r4, r6
	bl	free
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L11:
	.align	2
.L10:
	.word	CLOSED
	.word	next
	.size	session_open, .-session_open
	.comm	next,4,4
	.comm	CLOSED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
