	.file	"extr_websocket.c_ws_set_handshake_headers.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"websocket"
.LC1:
	.string	"Upgrade"
	.text
	.p2align 4
	.type	ws_set_handshake_headers, @function
ws_set_handshake_headers:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 40
	mov	edi, DWORD PTR 28[rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	call	strlen@PLT
	mov	edi, DWORD PTR WS_MAGIC_STR[rip]
	mov	r12, rax
	call	strlen@PLT
	lea	r14, [r12+rax]
	mov	r13, rax
	lea	rdi, 1[r14]
	call	xmalloc@PLT
	mov	rsi, rsp
	mov	r15, rax
	movsx	rax, DWORD PTR SHA_DIGEST_LENGTH[rip]
	mov	rcx, rax
	lea	rax, 15[0+rax*4]
	mov	rdx, rax
	and	rax, -4096
	sub	rsi, rax
	and	rdx, -16
	mov	rax, rsi
	cmp	rsp, rax
	je	.L3
.L13:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L13
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L14
.L4:
	mov	r8, rsp
	xor	esi, esi
	mov	edx, 4
	mov	DWORD PTR -76[rbp], ecx
	mov	rdi, r8
	mov	QWORD PTR -72[rbp], r8
	call	memset@PLT
	mov	esi, DWORD PTR 28[rbx]
	mov	rdx, r12
	mov	rdi, r15
	call	memcpy@PLT
	mov	esi, DWORD PTR WS_MAGIC_STR[rip]
	lea	rdx, 1[r13]
	lea	rdi, [r15+r12]
	call	memcpy@PLT
	mov	r8, QWORD PTR -72[rbp]
	mov	rsi, r14
	mov	rdi, r15
	mov	rdx, r8
	call	ws_sha1_digest@PLT
	mov	ecx, DWORD PTR -76[rbp]
	mov	r8, QWORD PTR -72[rbp]
	lea	esi, 0[0+rcx*4]
	mov	rdi, r8
	call	base64_encode@PLT
	mov	rdi, QWORD PTR WS_SWITCH_PROTO_STR[rip]
	mov	DWORD PTR 24[rbx], eax
	call	xstrdup@PLT
	cmp	QWORD PTR [rbx], 0
	mov	QWORD PTR 16[rbx], rax
	jne	.L5
	lea	rdi, .LC0[rip]
	call	xstrdup@PLT
	mov	QWORD PTR [rbx], rax
.L5:
	mov	eax, DWORD PTR 8[rbx]
	test	eax, eax
	je	.L15
.L6:
	mov	rdi, r15
	call	free@PLT
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L16
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	lea	rdi, .LC1[rip]
	call	xstrdup@PLT
	mov	QWORD PTR [rbx], rax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L14:
	or	QWORD PTR -8[rsp+rdx], 0
	jmp	.L4
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ws_set_handshake_headers, .-ws_set_handshake_headers
	.comm	WS_SWITCH_PROTO_STR,8,8
	.comm	WS_MAGIC_STR,4,4
	.comm	SHA_DIGEST_LENGTH,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_websocket.c_ws_set_handshake_headers.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"websocket\000"
	.align	2
.LC1:
	.ascii	"Upgrade\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ws_set_handshake_headers, %function
ws_set_handshake_headers:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #12
	ldr	r3, .L10
	mov	r4, r0
	ldr	r0, [r0, #16]
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	bl	strlen
	ldr	r3, .L10+4
	mov	r6, r0
	ldr	r0, [r3]
	bl	strlen
	add	r10, r6, r0
	mov	r8, r0
	add	r0, r10, #1
	bl	xmalloc
	ldr	r2, .L10+8
	mov	ip, #0
	ldr	r7, [r2]
	mov	r5, r0
	lsl	r7, r7, #2
	add	r2, r7, #7
	bic	r2, r2, #7
	sub	sp, sp, r2
	mov	r9, sp
	mov	r2, r6
	ldr	r1, [r4, #16]
	str	ip, [r9]
	bl	memcpy
	ldr	r3, .L10+4
	add	r2, r8, #1
	ldr	r1, [r3]
	add	r0, r5, r6
	bl	memcpy
	mov	r2, r9
	mov	r1, r10
	mov	r0, r5
	bl	ws_sha1_digest
	mov	r1, r7
	mov	r0, r9
	bl	base64_encode
	ldr	r3, .L10+12
	str	r0, [r4, #12]
	ldr	r0, [r3]
	bl	xstrdup
	ldr	r3, [r4]
	str	r0, [r4, #8]
	cmp	r3, #0
	beq	.L7
.L2:
	ldr	r3, [r4, #4]
	cmp	r3, #0
	beq	.L8
.L3:
	mov	r0, r5
	bl	free
	ldr	r3, .L10
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L9
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L8:
	ldr	r0, .L10+16
	bl	xstrdup
	str	r0, [r4]
	b	.L3
.L7:
	ldr	r0, .L10+20
	bl	xstrdup
	str	r0, [r4]
	b	.L2
.L9:
	bl	__stack_chk_fail
.L11:
	.align	2
.L10:
	.word	.LC2
	.word	WS_MAGIC_STR
	.word	SHA_DIGEST_LENGTH
	.word	WS_SWITCH_PROTO_STR
	.word	.LC1
	.word	.LC0
	.size	ws_set_handshake_headers, .-ws_set_handshake_headers
	.comm	WS_SWITCH_PROTO_STR,4,4
	.comm	WS_MAGIC_STR,4,4
	.comm	SHA_DIGEST_LENGTH,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
