	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cmd_write
_cmd_write:                             ## @cmd_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
	subq	$120, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movl	%ecx, %r13d
	movl	%edx, -132(%rbp)                ## 4-byte Spill
	movq	%rsi, -152(%rbp)                ## 8-byte Spill
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	(%rdi), %edi
	callq	_malloc
	movq	%rax, -144(%rbp)                ## 8-byte Spill
	leaq	-56(%rbp), %r12
	movq	_G_BDE_LOCKSIZE@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movl	$8, %esi
	callq	_random_bits
	movl	(%r14), %eax
	leal	-1(%rax), %ecx
	andl	-56(%rbp), %ecx
	movl	%ecx, -56(%rbp)
	movl	(%rbx), %edx
	addl	%ecx, %edx
	cmpl	%eax, %edx
	jg	LBB0_1
## %bb.2:
	movq	8(%r14), %rdx
	movslq	%r13d, %rsi
	negl	%eax
	andl	(%rdx,%rsi,4), %eax
	addl	%ecx, %eax
	movl	%eax, -56(%rbp)
	movq	%rsi, -160(%rbp)                ## 8-byte Spill
	movl	%eax, (%rdx,%rsi,4)
	movq	-152(%rbp), %rax                ## 8-byte Reload
	movq	(%rax), %rdi
	movl	-56(%rbp), %esi
	movl	-52(%rbp), %edx
	leaq	-128(%rbp), %rcx
	callq	_g_bde_keyloc_encrypt
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_errx
LBB0_4:
	testq	%r15, %r15
	je	LBB0_8
## %bb.5:
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
	movq	_O_CREAT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_O_TRUNC@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	%r15, %rdi
	movl	$384, %edx                      ## imm = 0x180
	callq	_open
	movl	%eax, %r13d
	testl	%eax, %eax
	jns	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_7:
	leaq	-128(%rbp), %rsi
	movl	%r13d, %edi
	movl	$64, %edx
	callq	_write
	movl	%r13d, %edi
	callq	_close
LBB0_18:
	movq	-144(%rbp), %r13                ## 8-byte Reload
LBB0_19:
	testq	%r13, %r13
	jne	LBB0_21
## %bb.20:
	leaq	L_.str.6(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_21:
	movl	(%r14), %esi
	movq	%r13, %rdi
	callq	_random_bits
	movq	24(%r14), %rdi
	movl	$8, %esi
	callq	_random_bits
	movl	-56(%rbp), %eax
	cltd
	idivl	(%r14)
	movslq	%edx, %rax
	leaq	(,%rax,4), %r15
	addq	%r13, %r15
	movq	-152(%rbp), %r12                ## 8-byte Reload
	movq	(%r12), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	callq	_g_bde_encode_lock
	testl	%eax, %eax
	jns	LBB0_23
## %bb.22:
	leaq	L_.str.7(%rip), %rsi
	movl	$1, %edi
	callq	_errx
LBB0_23:
	movl	(%rbx), %esi
	movq	(%r12), %rcx
	addq	$16, %rcx
	movq	%r15, %rdi
	movl	$256, %edx                      ## imm = 0x100
	callq	_encrypt_sector
	movq	8(%r14), %rax
	xorl	%ebx, %ebx
	subl	(%r14), %ebx
	movq	-160(%rbp), %rcx                ## 8-byte Reload
	andl	(%rax,%rcx,4), %ebx
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	-132(%rbp), %r15d               ## 4-byte Reload
	movl	%r15d, %edi
	movl	%ebx, %esi
	callq	_lseek
	cmpl	%ebx, %eax
	je	LBB0_25
## %bb.24:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_25:
	movl	(%r14), %edx
	movl	%r15d, %edi
	movq	%r13, %rsi
	callq	_write
	cmpl	(%r14), %eax
	je	LBB0_27
## %bb.26:
	leaq	L_.str.4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_27:
	movq	%r13, %rdi
	callq	_free
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_29
## %bb.28:
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_GBDE_F_SECT0@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 16(%r14)
	je	LBB0_17
## %bb.9:
	movq	_SEEK_SET@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movl	-132(%rbp), %edi                ## 4-byte Reload
	xorl	%esi, %esi
	callq	_lseek
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_11:
	movl	(%r14), %edx
	movl	-132(%rbp), %edi                ## 4-byte Reload
	movq	-144(%rbp), %rsi                ## 8-byte Reload
	callq	_read
	cmpl	(%r14), %eax
	je	LBB0_13
## %bb.12:
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_13:
	shll	$4, %r13d
	movslq	%r13d, %rax
	movq	-144(%rbp), %r13                ## 8-byte Reload
	leaq	(,%rax,4), %rdi
	addq	%r13, %rdi
	leaq	-128(%rbp), %rsi
	movl	$64, %edx
	callq	_memcpy
	movl	(%r15), %edx
	movl	-132(%rbp), %r15d               ## 4-byte Reload
	movl	%r15d, %edi
	xorl	%esi, %esi
	callq	_lseek
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_15:
	movl	(%r14), %edx
	movl	%r15d, %edi
	movq	%r13, %rsi
	callq	_write
	cmpl	(%r14), %eax
	je	LBB0_19
## %bb.16:
	leaq	L_.str.4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
	jmp	LBB0_19
LBB0_17:
	leaq	L_.str.5(%rip), %rsi
	movl	$1, %edi
	callq	_errx
	jmp	LBB0_18
LBB0_29:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_G_BDE_LOCKSIZE,4,2             ## @G_BDE_LOCKSIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"g_bde_keyloc_encrypt()"

	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_TRUNC,4,2                    ## @O_TRUNC
L_.str.1:                               ## @.str.1
	.asciz	"%s"

	.comm	_GBDE_F_SECT0,4,2               ## @GBDE_F_SECT0
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
L_.str.2:                               ## @.str.2
	.asciz	"lseek"

L_.str.3:                               ## @.str.3
	.asciz	"read"

L_.str.4:                               ## @.str.4
	.asciz	"write"

L_.str.5:                               ## @.str.5
	.asciz	"No -L option and no space in sector 0 for lockfile"

L_.str.6:                               ## @.str.6
	.asciz	"malloc"

L_.str.7:                               ## @.str.7
	.asciz	"programming error encoding lock"

	.no_dead_strip	_cmd_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cmd_write
_cmd_write:                             ; @cmd_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #192
	.cfi_def_cfa_offset 192
	stp	x28, x27, [sp, #96]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #112]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #128]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #144]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #160]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #176]            ; 16-byte Folded Spill
	add	x29, sp, #176
	.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	x23, x4
	mov	x24, 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]
	str	x8, [sp, #88]
	ldr	w0, [x0]
	bl	_malloc
	mov	x19, x0
Lloh3:
	adrp	x25, _G_BDE_LOCKSIZE@GOTPAGE
Lloh4:
	ldr	x25, [x25, _G_BDE_LOCKSIZE@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #80
	mov	w1, #8
	bl	_random_bits
	ldr	w8, [x20]
	sub	w9, w8, #1
	ldr	w10, [sp, #80]
	and	w9, w10, w9
	str	w9, [sp, #80]
	ldr	w10, [x25]
	add	w10, w10, w9
	cmp	w10, w8
	b.gt	LBB0_1
; %bb.2:
	ldr	x10, [x20, #8]
	sbfiz	x11, x24, #2, #32
	ldr	w12, [x10, x11]
	neg	w8, w8
	and	w8, w12, w8
	add	w8, w8, w9
	str	w8, [sp, #80]
	str	w8, [x10, x11]
	ldr	x0, [x22]
	ldp	w1, w2, [sp, #80]
	add	x3, sp, #16
	bl	_g_bde_keyloc_encrypt
	cbz	w0, LBB0_4
; %bb.3:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_4:
	sxtw	x27, w24
Lloh7:
	adrp	x26, _SEEK_SET@GOTPAGE
Lloh8:
	ldr	x26, [x26, _SEEK_SET@GOTPAGEOFF]
	cbz	x23, LBB0_18
; %bb.5:
Lloh9:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh13:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh15:
	adrp	x9, _O_TRUNC@GOTPAGE
Lloh16:
	ldr	x9, [x9, _O_TRUNC@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	x0, x23
	mov	w2, #384
	bl	_open
	mov	x24, x0
	tbz	w0, #31, LBB0_7
; %bb.6:
	str	x23, [sp]
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_7:
	add	x1, sp, #16
	mov	x0, x24
	mov	w2, #64
	bl	_write
	mov	x0, x24
	bl	_close
LBB0_8:
	cbnz	x19, LBB0_10
; %bb.9:
Lloh20:
	adrp	x1, l_.str.6@PAGE
Lloh21:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_10:
	ldr	w1, [x20]
	mov	x0, x19
	bl	_random_bits
	ldr	x0, [x20, #24]
	mov	w1, #8
	bl	_random_bits
	ldr	w8, [sp, #80]
	ldr	w9, [x20]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	add	x23, x19, w8, sxtw #2
	ldr	x0, [x22]
	mov	x1, x20
	mov	x2, x23
	bl	_g_bde_encode_lock
	tbz	w0, #31, LBB0_12
; %bb.11:
Lloh22:
	adrp	x1, l_.str.7@PAGE
Lloh23:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_12:
	ldr	w1, [x25]
	ldr	x8, [x22]
	add	x3, x8, #16
	mov	x0, x23
	mov	w2, #256
	bl	_encrypt_sector
	ldr	x8, [x20, #8]
	ldr	w8, [x8, x27, lsl #2]
	ldr	w9, [x20]
	neg	w9, w9
	and	w22, w8, w9
	ldr	w2, [x26]
	mov	x0, x21
	mov	x1, x22
	bl	_lseek
	cmp	w0, w22
	b.eq	LBB0_14
; %bb.13:
Lloh24:
	adrp	x1, l_.str.2@PAGE
Lloh25:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_14:
	ldr	w2, [x20]
	mov	x0, x21
	mov	x1, x19
	bl	_write
	ldr	w8, [x20]
	cmp	w0, w8
	b.eq	LBB0_16
; %bb.15:
Lloh26:
	adrp	x1, l_.str.4@PAGE
Lloh27:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_16:
	mov	x0, x19
	bl	_free
	ldr	x8, [sp, #88]
Lloh28:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh29:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_28
; %bb.17:
	ldp	x29, x30, [sp, #176]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #160]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #144]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #128]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #112]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #192
	ret
LBB0_18:
	ldr	w8, [x20, #16]
Lloh31:
	adrp	x9, _GBDE_F_SECT0@GOTPAGE
Lloh32:
	ldr	x9, [x9, _GBDE_F_SECT0@GOTPAGEOFF]
Lloh33:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_27
; %bb.19:
	ldr	w2, [x26]
	mov	x0, x21
	mov	w1, #0
	bl	_lseek
	cbz	w0, LBB0_21
; %bb.20:
Lloh34:
	adrp	x1, l_.str.2@PAGE
Lloh35:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_21:
	ldr	w2, [x20]
	mov	x0, x21
	mov	x1, x19
	bl	_read
	ldr	w8, [x20]
	cmp	w0, w8
	b.eq	LBB0_23
; %bb.22:
Lloh36:
	adrp	x1, l_.str.3@PAGE
Lloh37:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_23:
	add	x0, x19, x27, lsl #6
	add	x1, sp, #16
	mov	w2, #64
	bl	_memcpy
	ldr	w2, [x26]
	mov	x0, x21
	mov	w1, #0
	bl	_lseek
	cbz	w0, LBB0_25
; %bb.24:
Lloh38:
	adrp	x1, l_.str.2@PAGE
Lloh39:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_25:
	ldr	w2, [x20]
	mov	x0, x21
	mov	x1, x19
	bl	_write
	ldr	w8, [x20]
	cmp	w0, w8
	b.eq	LBB0_8
; %bb.26:
Lloh40:
	adrp	x1, l_.str.4@PAGE
Lloh41:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #1
	bl	_err
	b	LBB0_8
LBB0_27:
Lloh42:
	adrp	x1, l_.str.5@PAGE
Lloh43:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #1
	bl	_errx
	b	LBB0_8
LBB0_28:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_G_BDE_LOCKSIZE,4,2             ; @G_BDE_LOCKSIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"g_bde_keyloc_encrypt()"

	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_TRUNC,4,2                    ; @O_TRUNC
l_.str.1:                               ; @.str.1
	.asciz	"%s"

	.comm	_GBDE_F_SECT0,4,2               ; @GBDE_F_SECT0
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
l_.str.2:                               ; @.str.2
	.asciz	"lseek"

l_.str.3:                               ; @.str.3
	.asciz	"read"

l_.str.4:                               ; @.str.4
	.asciz	"write"

l_.str.5:                               ; @.str.5
	.asciz	"No -L option and no space in sector 0 for lockfile"

l_.str.6:                               ; @.str.6
	.asciz	"malloc"

l_.str.7:                               ; @.str.7
	.asciz	"programming error encoding lock"

	.no_dead_strip	_cmd_write
.subsections_via_symbols
