	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sbp2_create_command_orb
_sbp2_create_command_orb:               ## @sbp2_create_command_orb
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movq	(%rdi), %rax
	movq	(%rax), %rax
	movq	(%rax), %r14
	movq	%rdx, %rdi
	callq	_scsi_bufflen
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	(%r15), %r13d
	movl	(%rbx), %esi
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movl	$24, %edx
	callq	_dma_sync_single_for_cpu
	movl	$1, %edi
	callq	_ORB_SET_NULL_PTR
	movl	%eax, 24(%rbx)
	movl	$0, 4(%rbx)
	movl	12(%r12), %edi
	callq	_ORB_SET_MAX_PAYLOAD
	movl	%eax, 20(%rbx)
	movl	8(%r12), %edi
	callq	_ORB_SET_SPEED
	orl	%eax, 20(%rbx)
	movl	$1, %edi
	callq	_ORB_SET_NOTIFY
	orl	%eax, 20(%rbx)
	movq	_DMA_NONE@GOTPCREL(%rip), %rcx
	movq	_ORB_DIRECTION_NO_DATA_TRANSFER@GOTPCREL(%rip), %rsi
	movq	%rsi, %rax
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	cmpl	(%rcx), %r13d
	je	LBB0_8
## %bb.1:
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	(%rax), %ecx
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	jne	LBB0_4
## %bb.2:
	testl	%edx, %edx
	je	LBB0_4
## %bb.3:
	movq	_ORB_DIRECTION_WRITE_TO_MEDIA@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_4:
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	(%rax), %ecx
	jne	LBB0_7
## %bb.5:
	testl	%edx, %edx
	je	LBB0_7
## %bb.6:
	movq	_ORB_DIRECTION_READ_FROM_MEDIA@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_7:
	leaq	L_.str(%rip), %rdi
	movq	%rsi, %r13
	callq	_SBP2_INFO
	movq	%r13, %rsi
	movq	%r13, %rax
LBB0_8:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	leaq	4(%rbx), %r13
	movq	(%rax), %r14
	cmpq	(%rsi), %r14
	jne	LBB0_10
## %bb.9:
	movq	$0, 8(%rbx)
	movl	$1, %edi
	callq	_ORB_SET_DIRECTION
	orl	%eax, 20(%rbx)
	xorl	%r12d, %r12d
	jmp	LBB0_11
LBB0_10:
	movq	(%r12), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_scsi_sg_count
	movl	%eax, %r12d
	movq	%r15, %rdi
	callq	_scsi_sglist
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rsp)
	movq	%r13, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	movl	%r12d, %ecx
	movl	%eax, %r8d
	movq	%r14, %r9
	callq	_sbp2_prep_command_orb_sg
	movl	%eax, %r12d
LBB0_11:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%r13, %rdi
	movl	$24, %esi
	callq	_sbp2util_cpu_to_be32_buffer
	movl	16(%rbx), %edi
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	movl	16(%rbx), %edi
	movl	4(%r15), %edx
	movl	8(%r15), %esi
	callq	_memcpy
	movl	(%rbx), %esi
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movl	$24, %edx
	callq	_dma_sync_single_for_device
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_DMA_NONE,4,2                   ## @DMA_NONE
	.comm	_ORB_DIRECTION_NO_DATA_TRANSFER,8,3 ## @ORB_DIRECTION_NO_DATA_TRANSFER
	.comm	_ORB_DIRECTION_WRITE_TO_MEDIA,8,3 ## @ORB_DIRECTION_WRITE_TO_MEDIA
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.comm	_ORB_DIRECTION_READ_FROM_MEDIA,8,3 ## @ORB_DIRECTION_READ_FROM_MEDIA
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Falling back to DMA_NONE"

	.no_dead_strip	_sbp2_create_command_orb
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sbp2_create_command_orb
_sbp2_create_command_orb:               ; @sbp2_create_command_orb
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x2
	mov	x19, x1
	mov	x24, x0
	ldr	x8, [x0]
	ldr	x8, [x8]
	ldr	x20, [x8]
	mov	x0, x2
	bl	_scsi_bufflen
	mov	x25, x0
	ldr	w23, [x21]
	ldr	w1, [x19]
Lloh0:
	adrp	x27, _DMA_TO_DEVICE@GOTPAGE
Lloh1:
	ldr	x27, [x27, _DMA_TO_DEVICE@GOTPAGEOFF]
	ldr	w3, [x27]
	mov	x0, x20
	mov	w2, #24
	bl	_dma_sync_single_for_cpu
	mov	w0, #1
	bl	_ORB_SET_NULL_PTR
	mov	x22, x19
	str	wzr, [x22, #4]!
	str	w0, [x22, #20]
	ldr	w0, [x24, #12]
	bl	_ORB_SET_MAX_PAYLOAD
	str	w0, [x22, #16]
	ldr	w0, [x24, #8]
	bl	_ORB_SET_SPEED
	ldr	w8, [x22, #16]
	orr	w8, w8, w0
	str	w8, [x22, #16]
	mov	w0, #1
	bl	_ORB_SET_NOTIFY
	ldr	w8, [x22, #16]
	orr	w8, w8, w0
Lloh2:
	adrp	x9, _DMA_NONE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DMA_NONE@GOTPAGEOFF]
	str	w8, [x22, #16]
Lloh4:
	ldr	w9, [x9]
Lloh5:
	adrp	x26, _ORB_DIRECTION_NO_DATA_TRANSFER@GOTPAGE
Lloh6:
	ldr	x26, [x26, _ORB_DIRECTION_NO_DATA_TRANSFER@GOTPAGEOFF]
	mov	x8, x26
	cmp	w23, w9
	b.eq	LBB0_8
; %bb.1:
	ldr	w8, [x27]
	cmp	w23, w8
	b.ne	LBB0_4
; %bb.2:
	cbz	w25, LBB0_4
; %bb.3:
Lloh7:
	adrp	x8, _ORB_DIRECTION_WRITE_TO_MEDIA@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ORB_DIRECTION_WRITE_TO_MEDIA@GOTPAGEOFF]
	b	LBB0_8
LBB0_4:
Lloh9:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w23, w8
	b.ne	LBB0_7
; %bb.5:
	cbz	w25, LBB0_7
; %bb.6:
Lloh12:
	adrp	x8, _ORB_DIRECTION_READ_FROM_MEDIA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ORB_DIRECTION_READ_FROM_MEDIA@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_SBP2_INFO
Lloh16:
	adrp	x8, _ORB_DIRECTION_NO_DATA_TRANSFER@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ORB_DIRECTION_NO_DATA_TRANSFER@GOTPAGEOFF]
LBB0_8:
	ldr	x25, [x8]
	ldr	x8, [x26]
	cmp	x25, x8
	b.ne	LBB0_10
; %bb.9:
	str	xzr, [x19, #8]
	mov	w0, #1
	bl	_ORB_SET_DIRECTION
	mov	w23, #0
	ldr	w8, [x19, #20]
	orr	w8, w8, w0
	str	w8, [x19, #20]
	b	LBB0_11
LBB0_10:
	ldr	x24, [x24]
	mov	x0, x21
	bl	_scsi_sg_count
	mov	x26, x0
	mov	x0, x21
	bl	_scsi_sglist
	mov	x4, x0
	mov	x0, x22
	mov	x1, x24
	mov	x2, x19
	mov	x3, x26
	mov	x5, x25
	mov	x6, x23
	bl	_sbp2_prep_command_orb_sg
	mov	x23, x0
LBB0_11:
	mov	x0, x22
	mov	w1, #24
	bl	_sbp2util_cpu_to_be32_buffer
	ldr	w0, [x19, #16]
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	ldr	w0, [x19, #16]
	ldp	w2, w1, [x21, #4]
	bl	_memcpy
	ldr	w1, [x19]
	ldr	w3, [x27]
	mov	x0, x20
	mov	w2, #24
	bl	_dma_sync_single_for_device
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_DMA_NONE,4,2                   ; @DMA_NONE
	.comm	_ORB_DIRECTION_NO_DATA_TRANSFER,8,3 ; @ORB_DIRECTION_NO_DATA_TRANSFER
	.comm	_ORB_DIRECTION_WRITE_TO_MEDIA,8,3 ; @ORB_DIRECTION_WRITE_TO_MEDIA
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.comm	_ORB_DIRECTION_READ_FROM_MEDIA,8,3 ; @ORB_DIRECTION_READ_FROM_MEDIA
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Falling back to DMA_NONE"

	.no_dead_strip	_sbp2_create_command_orb
.subsections_via_symbols
