	.file	"extr_statem_srvr.c_tls_construct_server_hello.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	tls_construct_server_hello
	.type	tls_construct_server_hello, @function
tls_construct_server_hello:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12, rsi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 24
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	SSL_IS_TLS13@PLT
	test	rax, rax
	jne	.L2
	mov	rax, QWORD PTR SSL_HRR_PENDING[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L2
	mov	esi, DWORD PTR 8[rbp]
	mov	rdi, r12
	xor	ebx, ebx
	call	WPACKET_put_bytes_u16@PLT
	test	eax, eax
	jne	.L4
	.p2align 4,,10
	.p2align 3
.L17:
	mov	ecx, DWORD PTR ERR_R_INTERNAL_ERROR[rip]
	mov	edx, DWORD PTR SSL_F_TLS_CONSTRUCT_SERVER_HELLO[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR SSL_AD_INTERNAL_ERROR[rip]
	call	SSLfatal@PLT
	xor	eax, eax
.L1:
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L42
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.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
.L2:
	.cfi_restore_state
	mov	esi, DWORD PTR TLS1_2_VERSION[rip]
	mov	rdi, r12
	mov	ebx, 1
	call	WPACKET_put_bytes_u16@PLT
	test	eax, eax
	je	.L17
.L4:
	mov	edx, DWORD PTR SSL3_RANDOM_SIZE[rip]
	mov	esi, DWORD PTR hrrrandom[rip]
	mov	rax, QWORD PTR SSL_HRR_PENDING[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L7
	mov	esi, DWORD PTR 72[rbp]
.L7:
	mov	rdi, r12
	call	WPACKET_memcpy@PLT
	test	eax, eax
	je	.L17
	mov	rax, QWORD PTR 48[rbp]
	cmp	QWORD PTR 16[rax], 0
	je	.L43
.L9:
	mov	QWORD PTR [rax], 0
	test	ebx, ebx
	je	.L11
.L14:
	mov	rdx, QWORD PTR 16[rbp]
	cmp	rdx, 8
	ja	.L17
	mov	rsi, QWORD PTR 24[rbp]
	xor	r13d, r13d
.L13:
	mov	rdi, r12
	call	WPACKET_sub_memcpy_u8@PLT
	test	eax, eax
	je	.L17
	mov	rax, QWORD PTR 80[rbp]
	mov	edi, DWORD PTR 56[rbp]
	mov	rdx, rsp
	mov	rsi, r12
	call	[QWORD PTR [rax]]
	test	eax, eax
	je	.L17
	mov	esi, r13d
	mov	rdi, r12
	call	WPACKET_put_bytes_u8@PLT
	test	eax, eax
	je	.L17
	mov	edx, DWORD PTR SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST[rip]
	mov	rax, QWORD PTR SSL_HRR_PENDING[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L20
	mov	rdi, rbp
	call	SSL_IS_TLS13@PLT
	mov	edx, DWORD PTR SSL_EXT_TLS1_3_SERVER_HELLO[rip]
	test	rax, rax
	cmove	edx, DWORD PTR SSL_EXT_TLS1_2_SERVER_HELLO[rip]
.L20:
	xor	r8d, r8d
	xor	ecx, ecx
	mov	rsi, r12
	mov	rdi, rbp
	call	tls_construct_extensions@PLT
	test	eax, eax
	je	.L1
	mov	rax, QWORD PTR SSL_HRR_PENDING[rip]
	cmp	QWORD PTR 0[rbp], rax
	je	.L44
	mov	edx, DWORD PTR 32[rbp]
	mov	eax, 1
	test	DWORD PTR SSL_VERIFY_PEER[rip], edx
	jne	.L1
	xor	esi, esi
	mov	rdi, rbp
	call	ssl3_digest_cached_records@PLT
	test	eax, eax
	setne	al
	movzx	eax, al
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L43:
	mov	rdx, QWORD PTR 88[rbp]
	mov	edx, DWORD PTR [rdx]
	test	DWORD PTR SSL_SESS_CACHE_SERVER[rip], edx
	je	.L45
.L10:
	test	ebx, ebx
	jne	.L14
	mov	rdx, QWORD PTR [rax]
	cmp	rdx, 8
	ja	.L17
	mov	rsi, QWORD PTR 8[rax]
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L11:
	mov	rsi, QWORD PTR 8[rax]
	xor	edx, edx
.L22:
	mov	rax, QWORD PTR 64[rbp]
	xor	r13d, r13d
	test	rax, rax
	je	.L13
	mov	r13d, DWORD PTR [rax]
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L45:
	cmp	QWORD PTR 40[rbp], 0
	jne	.L10
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L44:
	mov	rdi, QWORD PTR 48[rbp]
	call	SSL_SESSION_free@PLT
	xor	r8d, r8d
	xor	ecx, ecx
	xor	edx, edx
	mov	QWORD PTR 48[rbp], 0
	xor	esi, esi
	mov	rdi, rbp
	mov	QWORD PTR 40[rbp], 0
	call	create_synthetic_message_hash@PLT
	test	eax, eax
	setne	al
	movzx	eax, al
	jmp	.L1
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	tls_construct_server_hello, .-tls_construct_server_hello
	.comm	hrrrandom,4,4
	.comm	TLS1_2_VERSION,4,4
	.comm	SSL_VERIFY_PEER,4,4
	.comm	SSL_SESS_CACHE_SERVER,4,4
	.comm	SSL_HRR_PENDING,8,8
	.comm	SSL_F_TLS_CONSTRUCT_SERVER_HELLO,4,4
	.comm	SSL_EXT_TLS1_3_SERVER_HELLO,4,4
	.comm	SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST,4,4
	.comm	SSL_EXT_TLS1_2_SERVER_HELLO,4,4
	.comm	SSL_AD_INTERNAL_ERROR,4,4
	.comm	SSL3_RANDOM_SIZE,4,4
	.comm	ERR_R_INTERNAL_ERROR,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_statem_srvr.c_tls_construct_server_hello.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	tls_construct_server_hello
	.syntax unified
	.arm
	.fpu softvfp
	.type	tls_construct_server_hello, %function
tls_construct_server_hello:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, lr}
	ldr	r3, .L45
	sub	sp, sp, #20
	mov	r6, r1
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	mov	r4, r0
	bl	SSL_IS_TLS13
	subs	r5, r0, #0
	bne	.L2
	ldr	r3, .L45+4
	ldr	r2, [r4]
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L2
	mov	r0, r6
	ldr	r1, [r4, #4]
	bl	WPACKET_put_bytes_u16
	cmp	r0, #0
	bne	.L4
.L17:
	ldr	r3, .L45+8
	ldr	r2, .L45+12
	ldr	r1, .L45+16
	mov	r0, r4
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	bl	SSLfatal
	mov	r0, #0
.L1:
	ldr	r3, .L45
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L41
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, pc}
.L2:
	ldr	r3, .L45+20
	mov	r0, r6
	ldr	r1, [r3]
	bl	WPACKET_put_bytes_u16
	cmp	r0, #0
	mov	r5, #1
	beq	.L17
.L4:
	ldr	r7, .L45+4
	ldr	r2, [r4]
	ldr	r3, [r7]
	mov	r0, r6
	cmp	r2, r3
	ldreq	r3, .L45+24
	ldrne	r1, [r4, #36]
	ldreq	r1, [r3]
	ldr	r3, .L45+28
	ldr	r2, [r3]
	bl	WPACKET_memcpy
	cmp	r0, #0
	beq	.L17
	ldr	r3, [r4, #24]
	ldr	r2, [r3, #8]
	cmp	r2, #0
	beq	.L42
.L9:
	mov	r2, #0
	cmp	r5, r2
	str	r2, [r3]
	beq	.L11
.L14:
	ldr	r2, [r4, #8]
	cmp	r2, #4
	bhi	.L17
	mov	r5, #0
	ldr	r1, [r4, #12]
.L13:
	mov	r0, r6
	bl	WPACKET_sub_memcpy_u8
	cmp	r0, #0
	beq	.L17
	ldr	r3, [r4, #40]
	mov	r1, r6
	ldr	r3, [r3]
	ldr	r0, [r4, #28]
	add	r2, sp, #8
	blx	r3
	cmp	r0, #0
	beq	.L17
	mov	r1, r5
	mov	r0, r6
	bl	WPACKET_put_bytes_u8
	cmp	r0, #0
	beq	.L17
	ldr	r2, [r4]
	ldr	r3, [r7]
	cmp	r2, r3
	beq	.L18
	mov	r0, r4
	bl	SSL_IS_TLS13
	cmp	r0, #0
	ldrne	r3, .L45+32
	ldreq	r3, .L45+36
	ldr	r2, [r3]
.L20:
	mov	r5, #0
	mov	r1, r6
	mov	r3, r5
	mov	r0, r4
	str	r5, [sp]
	bl	tls_construct_extensions
	cmp	r0, #0
	beq	.L1
	ldr	r3, [r7]
	ldr	r2, [r4]
	cmp	r2, r3
	beq	.L43
	ldr	r3, .L45+40
	ldr	r1, [r4, #16]
	ldr	r3, [r3]
	ands	r1, r1, r3
	movne	r0, #1
	bne	.L1
	mov	r0, r4
	bl	ssl3_digest_cached_records
	subs	r0, r0, #0
	movne	r0, #1
	b	.L1
.L42:
	ldr	r1, [r4, #44]
	ldr	r2, .L45+44
	ldr	r1, [r1]
	ldr	r2, [r2]
	tst	r1, r2
	beq	.L44
.L10:
	cmp	r5, #0
	bne	.L14
	ldr	r2, [r3]
	cmp	r2, #4
	bhi	.L17
	ldr	r1, [r3, #4]
	b	.L22
.L11:
	mov	r2, r5
	ldr	r1, [r3, #4]
.L22:
	ldr	r5, [r4, #32]
	cmp	r5, #0
	ldrne	r5, [r5]
	b	.L13
.L44:
	ldr	r2, [r4, #20]
	cmp	r2, #0
	bne	.L10
	b	.L9
.L18:
	ldr	r3, .L45+48
	ldr	r2, [r3]
	b	.L20
.L43:
	ldr	r0, [r4, #24]
	bl	SSL_SESSION_free
	str	r5, [r4, #24]
	str	r5, [r4, #20]
	mov	r0, r4
	mov	r3, r5
	mov	r2, r5
	mov	r1, r5
	str	r5, [sp]
	bl	create_synthetic_message_hash
	subs	r0, r0, r5
	movne	r0, #1
	b	.L1
.L41:
	bl	__stack_chk_fail
.L46:
	.align	2
.L45:
	.word	.LC0
	.word	SSL_HRR_PENDING
	.word	ERR_R_INTERNAL_ERROR
	.word	SSL_F_TLS_CONSTRUCT_SERVER_HELLO
	.word	SSL_AD_INTERNAL_ERROR
	.word	TLS1_2_VERSION
	.word	hrrrandom
	.word	SSL3_RANDOM_SIZE
	.word	SSL_EXT_TLS1_3_SERVER_HELLO
	.word	SSL_EXT_TLS1_2_SERVER_HELLO
	.word	SSL_VERIFY_PEER
	.word	SSL_SESS_CACHE_SERVER
	.word	SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST
	.size	tls_construct_server_hello, .-tls_construct_server_hello
	.comm	hrrrandom,4,4
	.comm	TLS1_2_VERSION,4,4
	.comm	SSL_VERIFY_PEER,4,4
	.comm	SSL_SESS_CACHE_SERVER,4,4
	.comm	SSL_HRR_PENDING,4,4
	.comm	SSL_F_TLS_CONSTRUCT_SERVER_HELLO,4,4
	.comm	SSL_EXT_TLS1_3_SERVER_HELLO,4,4
	.comm	SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST,4,4
	.comm	SSL_EXT_TLS1_2_SERVER_HELLO,4,4
	.comm	SSL_AD_INTERNAL_ERROR,4,4
	.comm	SSL3_RANDOM_SIZE,4,4
	.comm	ERR_R_INTERNAL_ERROR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
