	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cmd_open
_cmd_open:                              ## @cmd_open
	.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	%r12
	pushq	%rbx
	subq	$96, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movq	%rdx, %r12
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	_DIOCGSECTORSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-120(%rbp), %rdx
	movl	%ebx, %edi
	callq	_ioctl
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	$512, -120(%rbp)                ## imm = 0x200
LBB0_2:
	movq	_DIOCGMEDIASIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-116(%rbp), %rdx
	movl	%ebx, %edi
	callq	_ioctl
	testl	%eax, %eax
	je	LBB0_8
## %bb.3:
	leaq	-128(%rbp), %rsi
	movl	%ebx, %edi
	callq	_fstat
	testl	%eax, %eax
	je	LBB0_4
LBB0_6:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_8
## %bb.7:
	movl	$-1, -116(%rbp)
LBB0_8:
	testq	%r12, %r12
	je	LBB0_12
LBB0_9:
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_open
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_11
## %bb.10:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	movq	%r12, %rdx
	callq	_err
LBB0_11:
	leaq	-112(%rbp), %rsi
	movl	%ebx, %edi
	movl	$64, %edx
	callq	_read
	movl	%ebx, %edi
	callq	_close
	jmp	LBB0_13
LBB0_4:
	movl	-124(%rbp), %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movl	-128(%rbp), %eax
	movl	%eax, -116(%rbp)
	testq	%r12, %r12
	jne	LBB0_9
LBB0_12:
	leaq	-112(%rbp), %rdi
	xorl	%esi, %esi
	movl	$64, %edx
	callq	_memset
LBB0_13:
	movl	(%r15), %esi
	movl	-116(%rbp), %ecx
	movl	-120(%rbp), %r8d
	leaq	-112(%rbp), %rdx
	movq	%r15, %rdi
	movq	%r14, %r9
	callq	_g_bde_decrypt_lock
	movl	%eax, %ebx
	movq	_ENOENT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_15
## %bb.14:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_15:
	movq	_ESRCH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_17
## %bb.16:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_17:
	movq	_ENOTDIR@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_19
## %bb.18:
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_19:
	testl	%ebx, %ebx
	je	LBB0_21
## %bb.20:
	leaq	L_.str.4(%rip), %rsi
	movl	$1, %edi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_errx
LBB0_21:
	testq	%r14, %r14
	je	LBB0_23
## %bb.22:
	movl	(%r14), %esi
	incl	%esi
	leaq	L_.str.5(%rip), %rdi
	callq	_printf
LBB0_23:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_25
## %bb.24:
	addq	$96, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_DIOCGSECTORSIZE,4,2            ## @DIOCGSECTORSIZE
	.comm	_DIOCGMEDIASIZE,4,2             ## @DIOCGMEDIASIZE
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s"

L_.str.1:                               ## @.str.1
	.asciz	"Lock was destroyed."

	.comm	_ESRCH,4,2                      ## @ESRCH
L_.str.2:                               ## @.str.2
	.asciz	"Lock was nuked."

	.comm	_ENOTDIR,4,2                    ## @ENOTDIR
L_.str.3:                               ## @.str.3
	.asciz	"Lock not found"

L_.str.4:                               ## @.str.4
	.asciz	"Error %d decrypting lock"

L_.str.5:                               ## @.str.5
	.asciz	"Opened with key %u\n"

	.no_dead_strip	_cmd_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cmd_open
_cmd_open:                              ; @cmd_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	mov	x19, x3
	mov	x21, x2
	mov	x22, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x8, _DIOCGSECTORSIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _DIOCGSECTORSIZE@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #20
	mov	x0, x22
	bl	_ioctl
	cbz	w0, LBB0_2
; %bb.1:
	mov	w8, #512
	str	w8, [sp, #20]
LBB0_2:
Lloh6:
	adrp	x8, _DIOCGMEDIASIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _DIOCGMEDIASIZE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	add	x2, sp, #16
	mov	x0, x22
	bl	_ioctl
Lloh9:
	adrp	x23, _ENOENT@GOTPAGE
Lloh10:
	ldr	x23, [x23, _ENOENT@GOTPAGEOFF]
	cbz	w0, LBB0_9
; %bb.3:
	add	x1, sp, #8
	mov	x0, x22
	bl	_fstat
	cbz	w0, LBB0_6
LBB0_4:
	ldr	w8, [x23]
	cbz	w8, LBB0_9
; %bb.5:
	mov	w8, #-1
	b	LBB0_8
LBB0_6:
	ldr	w0, [sp, #12]
	bl	_S_ISREG
	cbz	x0, LBB0_4
; %bb.7:
	ldr	w8, [sp, #8]
LBB0_8:
	str	w8, [sp, #16]
LBB0_9:
	cbz	x21, LBB0_13
; %bb.10:
Lloh11:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh12:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #0
	bl	_open
	mov	x22, x0
	tbz	w0, #31, LBB0_12
; %bb.11:
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	mov	x2, x21
	bl	_err
LBB0_12:
	add	x1, sp, #24
	mov	x0, x22
	mov	w2, #64
	bl	_read
	mov	x0, x22
	bl	_close
	b	LBB0_14
LBB0_13:
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #64
	bl	_memset
LBB0_14:
	ldr	w1, [x20]
	ldp	w3, w4, [sp, #16]
	add	x2, sp, #24
	mov	x0, x20
	mov	x5, x19
	bl	_g_bde_decrypt_lock
	mov	x20, x0
	ldr	w8, [x23]
	cmp	w0, w8
	b.ne	LBB0_16
; %bb.15:
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_16:
Lloh18:
	adrp	x8, _ESRCH@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ESRCH@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ne	LBB0_18
; %bb.17:
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_18:
Lloh23:
	adrp	x8, _ENOTDIR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOTDIR@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ne	LBB0_20
; %bb.19:
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_20:
	cbz	w20, LBB0_22
; %bb.21:
	str	x20, [sp]
Lloh28:
	adrp	x1, l_.str.4@PAGE
Lloh29:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_22:
	cbz	x19, LBB0_24
; %bb.23:
	ldr	w8, [x19]
	add	w1, w8, #1
Lloh30:
	adrp	x0, l_.str.5@PAGE
Lloh31:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_printf
LBB0_24:
	ldur	x8, [x29, #-56]
Lloh32:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh33:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh34:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_26
; %bb.25:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_26:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_DIOCGSECTORSIZE,4,2            ; @DIOCGSECTORSIZE
	.comm	_DIOCGMEDIASIZE,4,2             ; @DIOCGMEDIASIZE
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s"

l_.str.1:                               ; @.str.1
	.asciz	"Lock was destroyed."

	.comm	_ESRCH,4,2                      ; @ESRCH
l_.str.2:                               ; @.str.2
	.asciz	"Lock was nuked."

	.comm	_ENOTDIR,4,2                    ; @ENOTDIR
l_.str.3:                               ; @.str.3
	.asciz	"Lock not found"

l_.str.4:                               ; @.str.4
	.asciz	"Error %d decrypting lock"

l_.str.5:                               ; @.str.5
	.asciz	"Opened with key %u\n"

	.no_dead_strip	_cmd_open
.subsections_via_symbols
