	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mode_select                    ## -- Begin function mode_select
	.p2align	4, 0x90
_mode_select:                           ## @mode_select
	.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
	movl	%r9d, %r14d
	movl	%r8d, %r15d
	movl	%ecx, %r13d
	movl	%edx, %r12d
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movl	24(%rbp), %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	16(%rbp), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_cam_getccb
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_errx
LBB0_2:
	movq	%rbx, %rdi
	callq	_CCB_CLEAR_ALL_EXCEPT_HDR
	movq	_SSD_FULL_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r10d
	testl	%r14d, %r14d
	movl	$5000, %eax                     ## imm = 0x1388
	cmovnel	%r14d, %eax
	subq	$8, %rsp
	movq	%rbx, %rdi
	movl	%r15d, %esi
	xorl	%edx, %edx
	movl	%r13d, %ecx
	movl	$1, %r8d
	movl	%r12d, %r9d
	pushq	%rax
	pushq	%r10
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	pushq	-56(%rbp)                       ## 8-byte Folded Reload
	pushq	-72(%rbp)                       ## 8-byte Folded Reload
	callq	_scsi_mode_select_len
	addq	$48, %rsp
	movq	_arglist@GOTPCREL(%rip), %r14
	movq	_CAM_ARG_ERR_RECOVER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_3
## %bb.4:
	movq	_CAM_PASS_ERR_RECOVER@GOTPCREL(%rip), %rcx
	movl	4(%rbx), %eax
	orl	(%rcx), %eax
	jmp	LBB0_5
LBB0_3:
	movl	4(%rbx), %eax
LBB0_5:
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movq	_CAM_DEV_QFRZDIS@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, 4(%rbx)
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_cam_send_ccb
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_7
## %bb.6:
	movq	_CAM_STATUS_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rbx), %eax
	movq	_CAM_REQ_CMP@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_12
LBB0_7:
	movq	_CAM_ARG_VERBOSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_9
## %bb.8:
	movq	_CAM_ESF_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_CAM_EPF_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_cam_error_print
LBB0_9:
	movq	%rbx, %rdi
	callq	_cam_freeccb
	movq	%r12, %rdi
	callq	_cam_close_device
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	testl	%r15d, %r15d
	js	LBB0_10
## %bb.11:
	callq	_errx
	jmp	LBB0_12
LBB0_10:
	callq	_err
LBB0_12:
	movq	%rbx, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_cam_freeccb                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mode_select: couldn't allocate CCB"

	.comm	_SSD_FULL_SIZE,4,2              ## @SSD_FULL_SIZE
	.comm	_arglist,4,2                    ## @arglist
	.comm	_CAM_ARG_ERR_RECOVER,4,2        ## @CAM_ARG_ERR_RECOVER
	.comm	_CAM_PASS_ERR_RECOVER,4,2       ## @CAM_PASS_ERR_RECOVER
	.comm	_CAM_DEV_QFRZDIS,4,2            ## @CAM_DEV_QFRZDIS
	.comm	_CAM_STATUS_MASK,4,2            ## @CAM_STATUS_MASK
	.comm	_CAM_REQ_CMP,4,2                ## @CAM_REQ_CMP
	.comm	_CAM_ARG_VERBOSE,4,2            ## @CAM_ARG_VERBOSE
	.comm	_CAM_ESF_ALL,4,2                ## @CAM_ESF_ALL
	.comm	_CAM_EPF_ALL,4,2                ## @CAM_EPF_ALL
	.comm	_stderr,4,2                     ## @stderr
L_.str.1:                               ## @.str.1
	.asciz	"error sending mode select command"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mode_select                    ; -- Begin function mode_select
	.p2align	2
_mode_select:                           ; @mode_select
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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, x7
	mov	x22, x6
	mov	x27, x5
	mov	x25, x4
	mov	x24, x3
	mov	x23, x2
	mov	x26, x1
	mov	x20, x0
	bl	_cam_getccb
	mov	x19, x0
	cbnz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_2:
	mov	x0, x19
	bl	_CCB_CLEAR_ALL_EXCEPT_HDR
Lloh2:
	adrp	x8, _SSD_FULL_SIZE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SSD_FULL_SIZE@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	mov	w9, #5000
	cmp	w27, #0
	csel	w9, w9, w27, eq
	stp	w8, w9, [sp, #4]
	str	w26, [sp]
	mov	x0, x19
	mov	x1, x25
	mov	x2, #0
	mov	x3, x24
	mov	w4, #1
	mov	x5, x23
	mov	x6, x22
	mov	x7, x21
	bl	_scsi_mode_select_len
Lloh5:
	adrp	x22, _arglist@GOTPAGE
Lloh6:
	ldr	x22, [x22, _arglist@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh7:
	adrp	x9, _CAM_ARG_ERR_RECOVER@GOTPAGE
Lloh8:
	ldr	x9, [x9, _CAM_ARG_ERR_RECOVER@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
Lloh10:
	adrp	x8, _CAM_PASS_ERR_RECOVER@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CAM_PASS_ERR_RECOVER@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	ldr	w9, [x19, #4]
	orr	w8, w9, w8
	b	LBB0_5
LBB0_4:
	ldr	w8, [x19, #4]
LBB0_5:
Lloh13:
	adrp	x9, _CAM_DEV_QFRZDIS@GOTPAGE
Lloh14:
	ldr	x9, [x9, _CAM_DEV_QFRZDIS@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x19, #4]
	mov	x0, x20
	mov	x1, x19
	bl	_cam_send_ccb
	mov	x21, x0
	tbnz	w0, #31, LBB0_7
; %bb.6:
	ldr	w8, [x19]
Lloh16:
	adrp	x9, _CAM_STATUS_MASK@GOTPAGE
Lloh17:
	ldr	x9, [x9, _CAM_STATUS_MASK@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	and	w8, w9, w8
Lloh19:
	adrp	x9, _CAM_REQ_CMP@GOTPAGE
Lloh20:
	ldr	x9, [x9, _CAM_REQ_CMP@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	cmp	w8, w9
	b.eq	LBB0_12
LBB0_7:
	ldr	w8, [x22]
Lloh22:
	adrp	x9, _CAM_ARG_VERBOSE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _CAM_ARG_VERBOSE@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:
Lloh25:
	adrp	x8, _CAM_ESF_ALL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _CAM_ESF_ALL@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
Lloh28:
	adrp	x8, _CAM_EPF_ALL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _CAM_EPF_ALL@GOTPAGEOFF]
Lloh30:
	ldr	w3, [x8]
Lloh31:
	adrp	x8, _stderr@GOTPAGE
Lloh32:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh33:
	ldr	w4, [x8]
	mov	x0, x20
	mov	x1, x19
	bl	_cam_error_print
LBB0_9:
	mov	x0, x19
	bl	_cam_freeccb
	mov	x0, x20
	bl	_cam_close_device
Lloh34:
	adrp	x1, l_.str.1@PAGE
Lloh35:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	tbnz	w21, #31, LBB0_11
; %bb.10:
	bl	_errx
	b	LBB0_12
LBB0_11:
	bl	_err
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_cam_freeccb
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mode_select: couldn't allocate CCB"

	.comm	_SSD_FULL_SIZE,4,2              ; @SSD_FULL_SIZE
	.comm	_arglist,4,2                    ; @arglist
	.comm	_CAM_ARG_ERR_RECOVER,4,2        ; @CAM_ARG_ERR_RECOVER
	.comm	_CAM_PASS_ERR_RECOVER,4,2       ; @CAM_PASS_ERR_RECOVER
	.comm	_CAM_DEV_QFRZDIS,4,2            ; @CAM_DEV_QFRZDIS
	.comm	_CAM_STATUS_MASK,4,2            ; @CAM_STATUS_MASK
	.comm	_CAM_REQ_CMP,4,2                ; @CAM_REQ_CMP
	.comm	_CAM_ARG_VERBOSE,4,2            ; @CAM_ARG_VERBOSE
	.comm	_CAM_ESF_ALL,4,2                ; @CAM_ESF_ALL
	.comm	_CAM_EPF_ALL,4,2                ; @CAM_EPF_ALL
	.comm	_stderr,4,2                     ; @stderr
l_.str.1:                               ; @.str.1
	.asciz	"error sending mode select command"

.subsections_via_symbols
