	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ber_write_elements             ## -- Begin function ber_write_elements
	.p2align	4, 0x90
_ber_write_elements:                    ## @ber_write_elements
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	callq	_ber_calc_len
	movq	%rax, %r14
	leaq	L_.str(%rip), %rdi
	movq	%rax, %rsi
	callq	_DPRINTF
	movq	8(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	leaq	(%rax,%r14,4), %rcx
	movslq	24(%rbx), %rdx
	cmpq	%rdx, %rcx
	jbe	LBB0_5
## %bb.2:
	movq	%rax, %rdi
	callq	_free
LBB0_3:
	movq	%r14, %rdi
	callq	_malloc
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	je	LBB0_9
## %bb.4:
	leal	(%rax,%r14,4), %ecx
	movl	%ecx, 24(%rbx)
LBB0_5:
	movq	%rax, 16(%rbx)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_ber_dump_element
	cmpl	$-1, %eax
	je	LBB0_9
## %bb.6:
	movl	(%rbx), %edi
	cmpl	$-1, %edi
	je	LBB0_10
## %bb.7:
	movq	8(%rbx), %rsi
	movq	%r14, %rdx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_write                          ## TAILCALL
LBB0_9:
	movl	$-1, %r14d
LBB0_10:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write ber element of %zd bytes length\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ber_write_elements             ; -- Begin function ber_write_elements
	.p2align	2
_ber_write_elements:                    ; @ber_write_elements
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x21, x1
	mov	x20, x0
	mov	x0, x1
	bl	_ber_calc_len
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_DPRINTF
	ldr	x0, [x20, #8]
	cbz	x0, LBB0_3
; %bb.1:
	add	x8, x0, x19, lsl #2
	ldrsw	x9, [x20, #24]
	cmp	x8, x9
	b.ls	LBB0_5
; %bb.2:
	bl	_free
LBB0_3:
	mov	x0, x19
	bl	_malloc
	str	x0, [x20, #8]
	cbz	x0, LBB0_8
; %bb.4:
	add	w8, w0, w19, lsl #2
	str	w8, [x20, #24]
LBB0_5:
	str	x0, [x20, #16]
	mov	x0, x20
	mov	x1, x21
	bl	_ber_dump_element
	cmn	w0, #1
	b.eq	LBB0_8
; %bb.6:
	ldr	w0, [x20]
	cmn	w0, #1
	b.eq	LBB0_9
; %bb.7:
	ldr	x1, [x20, #8]
	mov	x2, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_write
LBB0_8:
	mov	w19, #-1
LBB0_9:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write ber element of %zd bytes length\n"

.subsections_via_symbols
