	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_br_ssl_engine_set_buffer       ## -- Begin function br_ssl_engine_set_buffer
	.p2align	4, 0x90
_br_ssl_engine_set_buffer:              ## @br_ssl_engine_set_buffer
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.3:
	testl	%ecx, %ecx
	je	LBB0_2
## %bb.4:
	movq	_MAX_IN_OVERHEAD@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movq	_MAX_OUT_OVERHEAD@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %r8
	leal	(%r8,%rax), %ecx
	addl	$1024, %ecx                     ## imm = 0x400
	movslq	%ecx, %rcx
	cmpq	%rdx, %rcx
	jbe	LBB0_5
## %bb.9:
	movq	_BR_IO_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rdi)
	movq	_BR_ERR_BAD_PARAM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rdi)
	popq	%rbp
	retq
LBB0_1:
	xorl	%esi, %esi
	xorl	%edx, %edx
LBB0_2:
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	popq	%rbp
	jmp	_br_ssl_engine_set_buffers_bidi ## TAILCALL
LBB0_5:
	leal	(%r8,%rax), %ecx
	addl	$16896, %ecx                    ## imm = 0x4200
	movslq	%ecx, %rcx
	cmpq	%rdx, %rcx
	jbe	LBB0_7
## %bb.6:
	addq	$512, %r8                       ## imm = 0x200
	jmp	LBB0_8
LBB0_7:
	movq	%rdx, %r8
	subq	%rax, %r8
	addq	$-16384, %r8                    ## imm = 0xC000
LBB0_8:
	subq	%r8, %rdx
	leaq	(%rsi,%r8), %rcx
	popq	%rbp
	jmp	_br_ssl_engine_set_buffers_bidi ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_IN_OVERHEAD,4,2            ## @MAX_IN_OVERHEAD
	.comm	_MAX_OUT_OVERHEAD,4,2           ## @MAX_OUT_OVERHEAD
	.comm	_BR_IO_FAILED,4,2               ## @BR_IO_FAILED
	.comm	_BR_ERR_BAD_PARAM,4,2           ## @BR_ERR_BAD_PARAM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_br_ssl_engine_set_buffer       ; -- Begin function br_ssl_engine_set_buffer
	.p2align	2
_br_ssl_engine_set_buffer:              ; @br_ssl_engine_set_buffer
	.cfi_startproc
; %bb.0:
	cbz	x1, LBB0_4
; %bb.1:
	cbz	w3, LBB0_5
; %bb.2:
Lloh0:
	adrp	x8, _MAX_IN_OVERHEAD@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_IN_OVERHEAD@GOTPAGEOFF]
Lloh2:
	adrp	x10, _MAX_OUT_OVERHEAD@GOTPAGE
Lloh3:
	ldr	x10, [x10, _MAX_OUT_OVERHEAD@GOTPAGEOFF]
Lloh4:
	ldrsw	x9, [x8]
Lloh5:
	ldrsw	x8, [x10]
	add	w10, w8, w9
	add	w11, w10, #1024
	sxtw	x11, w11
	cmp	x11, x2
	b.ls	LBB0_6
; %bb.3:
Lloh6:
	adrp	x8, _BR_IO_FAILED@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BR_IO_FAILED@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _BR_ERR_BAD_PARAM@GOTPAGE
Lloh10:
	ldr	x9, [x9, _BR_ERR_BAD_PARAM@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	stp	w9, w8, [x0]
	ret
LBB0_4:
	mov	x2, #0
LBB0_5:
	mov	x3, #0
	mov	x4, #0
	b	_br_ssl_engine_set_buffers_bidi
LBB0_6:
	mov	w11, #16896
	add	w10, w10, w11
	sxtw	x10, w10
	sub	x9, x2, x9
	sub	x9, x9, #4, lsl #12             ; =16384
	add	x8, x8, #512
	cmp	x10, x2
	csel	x4, x9, x8, ls
	sub	x2, x2, x4
	add	x3, x1, x4
	b	_br_ssl_engine_set_buffers_bidi
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_IN_OVERHEAD,4,2            ; @MAX_IN_OVERHEAD
	.comm	_MAX_OUT_OVERHEAD,4,2           ; @MAX_OUT_OVERHEAD
	.comm	_BR_IO_FAILED,4,2               ; @BR_IO_FAILED
	.comm	_BR_ERR_BAD_PARAM,4,2           ; @BR_ERR_BAD_PARAM
.subsections_via_symbols
