	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __rap_write
___rap_write:                           ## @__rap_write
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movq	%rdx, %r12
	movq	%rsi, %rdi
	callq	_RIORAP_FD
	testl	%ebx, %ebx
	jle	LBB0_7
## %bb.1:
	movq	%rax, %r15
	movq	_RMT_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%ebx, %eax
	cmovll	%eax, %ebx
	leal	5(%rbx), %r13d
	movl	%r13d, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	%rax, %r14
	movq	_RMT_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
	leaq	4(%r14), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movl	%ebx, %esi
	callq	_r_write_be32
	movq	%r14, %rdi
	addq	$20, %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	%r13d, %edx
	callq	_r_socket_write
	movq	%r15, %rdi
	callq	_r_socket_flush
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$5, %edx
	callq	_r_socket_read
	cmpl	$5, %eax
	jne	LBB0_4
## %bb.5:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_r_read_be32
	xorl	%ebx, %ebx
	cmpl	$1, %eax
	sbbl	%ebx, %ebx
	orl	%eax, %ebx
	jmp	LBB0_6
LBB0_2:
	leaq	L_.str(%rip), %rdi
	callq	_eprintf
	movl	$-1, %ebx
	jmp	LBB0_7
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
	callq	_eprintf
	movl	$-1, %ebx
LBB0_6:
	movq	%r14, %rdi
	callq	_free
LBB0_7:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RMT_MAX,4,2                    ## @RMT_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"__rap_write: malloc failed\n"

	.comm	_RMT_WRITE,4,2                  ## @RMT_WRITE
L_.str.1:                               ## @.str.1
	.asciz	"__rap_write: error\n"

	.no_dead_strip	___rap_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __rap_write
___rap_write:                           ; @__rap_write
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x3
	mov	x21, x2
	mov	x0, x1
	bl	_RIORAP_FD
	cmp	w22, #1
	b.lt	LBB0_7
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x8, _RMT_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RMT_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w22
	csel	w24, w8, w22, lt
	add	w23, w24, #5
	mov	x0, x23
	bl	_malloc
	cbz	x0, LBB0_4
; %bb.2:
	mov	x19, x0
Lloh3:
	adrp	x8, _RMT_WRITE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RMT_WRITE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	mov	x25, x0
	str	w8, [x25], #20
	add	x22, x0, #4
	mov	x0, x22
	mov	x1, x24
	bl	_r_write_be32
	mov	x0, x25
	mov	x1, x21
	mov	x2, x24
	bl	_memcpy
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	_r_socket_write
	mov	x0, x20
	bl	_r_socket_flush
	mov	x0, x20
	mov	x1, x19
	mov	w2, #5
	bl	_r_socket_read
	cmp	w0, #5
	b.ne	LBB0_5
; %bb.3:
	mov	x0, x22
	bl	_r_read_be32
	cmp	w0, #0
	csinv	w22, w0, wzr, ne
	b	LBB0_6
LBB0_4:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_eprintf
	mov	w22, #-1
	b	LBB0_7
LBB0_5:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_eprintf
	mov	w22, #-1
LBB0_6:
	mov	x0, x19
	bl	_free
LBB0_7:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_RMT_MAX,4,2                    ; @RMT_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"__rap_write: malloc failed\n"

	.comm	_RMT_WRITE,4,2                  ; @RMT_WRITE
l_.str.1:                               ; @.str.1
	.asciz	"__rap_write: error\n"

	.no_dead_strip	___rap_write
.subsections_via_symbols
