	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fifolog_create                 ## -- Begin function fifolog_create
	.p2align	4, 0x90
_fifolog_create:                        ## @fifolog_create
	.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	_O_WRONLY@GOTPCREL(%rip), %r13
	movq	_O_TRUNC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%r13), %eax
	movq	_O_EXCL@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	%rdx, %r12
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	_O_CREAT@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, %esi
	movl	$420, %edx                      ## imm = 0x1A4
	xorl	%eax, %eax
	callq	_open
	movl	%eax, %r15d
	movl	%eax, %r14d
	testl	%eax, %eax
	jns	LBB0_3
## %bb.1:
	movl	(%r13), %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_open
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_2
LBB0_3:
	testq	%r12, %r12
	movl	$512, %r13d                     ## imm = 0x200
	cmovneq	%r12, %r13
	leaq	-80(%rbp), %rsi
	movl	%r14d, %edi
	callq	_fstat
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_assert
	movl	-72(%rbp), %r12d
	movl	%r12d, %edi
	callq	_S_ISBLK
	testl	%eax, %eax
	jne	LBB0_7
## %bb.4:
	movl	%r12d, %edi
	callq	_S_ISCHR
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:
	movl	%r12d, %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_6
LBB0_7:
	testl	%r15d, %r15d
	js	LBB0_8
LBB0_9:
	movq	_DIOCGSECTORSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r14d, %edi
	callq	_ioctl
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_17
LBB0_8:
	movl	%r12d, %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_9
LBB0_6:
	movl	%r14d, %edi
	callq	_close
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_assert
	leaq	L_.str.1(%rip), %rax
	jmp	LBB0_31
LBB0_11:
	movq	-64(%rbp), %rcx
	cmpq	%r13, %rcx
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jg	LBB0_16
## %bb.12:
	movq	%r13, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_13
## %bb.14:
	movq	%r13, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	je	LBB0_17
LBB0_16:
	movq	%rcx, %r13
LBB0_17:
	movq	_DIOCGMEDIASIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	movl	%r14d, %edi
	callq	_ioctl
	testl	%eax, %eax
	je	LBB0_18
## %bb.19:
	testq	%rbx, %rbx
	je	LBB0_20
LBB0_21:
	movl	%r12d, %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_24
## %bb.22:
	movl	%r14d, %edi
	movq	%rbx, %rsi
	callq	_ftruncate
	testq	%rax, %rax
	js	LBB0_23
LBB0_24:
	movl	$1, %edi
	movq	%r13, %rsi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_25
## %bb.26:
	movq	%rax, %rbx
	movq	_FIFOLOG_FMT_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_strcpy
	movq	_FIFOLOG_OFF_BS@GOTPCREL(%rip), %rax
	movslq	(%rax), %rdi
	addq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_be32enc
	movl	%r14d, %edi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	xorl	%ecx, %ecx
	callq	_pwrite
	cltq
	cmpq	%rax, %r13
	jne	LBB0_27
## %bb.28:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movq	%r13, %rdx
	callq	_memset
	movl	%r14d, %edi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	movq	%r13, %rcx
	callq	_pwrite
	cmpl	%r13d, %eax
	jne	LBB0_29
## %bb.30:
	movq	%rbx, %rdi
	callq	_free
	movl	%r14d, %edi
	callq	_close
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_assert
	xorl	%eax, %eax
	jmp	LBB0_31
LBB0_18:
	movq	-56(%rbp), %rax
	cmpq	%rbx, %rax
	movq	%rbx, %rcx
	cmovlq	%rax, %rcx
	testq	%rbx, %rbx
	cmoveq	%rax, %rcx
	movq	%rcx, %rbx
	testq	%rbx, %rbx
	jne	LBB0_21
LBB0_20:
	movl	%r12d, %edi
	callq	_S_ISREG
	movq	-80(%rbp), %rbx
	imulq	$86400, %r13, %rcx              ## imm = 0x15180
	testq	%rbx, %rbx
	cmoveq	%rcx, %rbx
	testq	%rax, %rax
	cmoveq	%rcx, %rbx
	jmp	LBB0_21
LBB0_25:
	leaq	L_.str.3(%rip), %rax
	jmp	LBB0_31
LBB0_27:
	movq	_errno@GOTPCREL(%rip), %r14
	movl	(%r14), %r15d
	movq	%rbx, %rdi
	callq	_free
	movl	%r15d, (%r14)
	leaq	L_.str.4(%rip), %rax
	jmp	LBB0_31
LBB0_23:
	leaq	L_.str.2(%rip), %rax
	jmp	LBB0_31
LBB0_2:
	leaq	L_.str(%rip), %rax
	jmp	LBB0_31
LBB0_29:
	movq	_errno@GOTPCREL(%rip), %r14
	movl	(%r14), %r15d
	movq	%rbx, %rdi
	callq	_free
	movl	%r15d, (%r14)
	leaq	L_.str.5(%rip), %rax
LBB0_31:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	testq	%rdx, %rdx
	jne	LBB0_16
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_TRUNC,4,2                    ## @O_TRUNC
	.comm	_O_EXCL,4,2                     ## @O_EXCL
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not open"

L_.str.1:                               ## @.str.1
	.asciz	"Wrong file type"

	.comm	_DIOCGSECTORSIZE,4,2            ## @DIOCGSECTORSIZE
	.comm	_DIOCGMEDIASIZE,4,2             ## @DIOCGMEDIASIZE
L_.str.2:                               ## @.str.2
	.asciz	"Could not ftrunc"

L_.str.3:                               ## @.str.3
	.asciz	"Could not malloc"

	.comm	_FIFOLOG_FMT_MAGIC,4,2          ## @FIFOLOG_FMT_MAGIC
	.comm	_FIFOLOG_OFF_BS,4,2             ## @FIFOLOG_OFF_BS
	.comm	_errno,4,2                      ## @errno
L_.str.4:                               ## @.str.4
	.asciz	"Could not write first sector"

L_.str.5:                               ## @.str.5
	.asciz	"Could not write second sector"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fifolog_create                 ; -- Begin function fifolog_create
	.p2align	2
_fifolog_create:                        ; @fifolog_create
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
Lloh0:
	adrp	x24, _O_WRONLY@GOTPAGE
Lloh1:
	ldr	x24, [x24, _O_WRONLY@GOTPAGEOFF]
	ldr	w8, [x24]
Lloh2:
	adrp	x9, _O_TRUNC@GOTPAGE
Lloh3:
	ldr	x9, [x9, _O_TRUNC@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh5:
	adrp	x9, _O_EXCL@GOTPAGE
Lloh6:
	ldr	x9, [x9, _O_EXCL@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh8:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	w8, #420
	str	x8, [sp]
	bl	_open
	mov	x23, x0
	mov	x19, x0
	tbz	w0, #31, LBB0_2
; %bb.1:
	ldr	w1, [x24]
	mov	x0, x22
	bl	_open
	mov	x19, x0
	tbnz	w0, #31, LBB0_23
LBB0_2:
	mov	w8, #512
	cmp	x20, #0
	csel	x20, x8, x20, eq
	add	x1, sp, #16
	mov	x0, x19
	bl	_fstat
	cmp	w0, #0
	cset	w0, eq
	bl	_assert
	ldr	w22, [sp, #24]
	mov	x0, x22
	bl	_S_ISBLK
	cbnz	w0, LBB0_5
; %bb.3:
	mov	x0, x22
	bl	_S_ISCHR
	cbnz	w0, LBB0_5
; %bb.4:
	mov	x0, x22
	bl	_S_ISREG
	cbz	x0, LBB0_19
LBB0_5:
	tbnz	w23, #31, LBB0_18
LBB0_6:
Lloh11:
	adrp	x8, _DIOCGSECTORSIZE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DIOCGSECTORSIZE@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	add	x2, sp, #40
	mov	x0, x19
	bl	_ioctl
	cbnz	w0, LBB0_10
; %bb.7:
	ldr	x8, [sp, #40]
	cmp	x8, x20
	b.gt	LBB0_9
; %bb.8:
	sdiv	x9, x20, x8
	msub	x9, x9, x8, x20
	cbz	x9, LBB0_10
LBB0_9:
	mov	x20, x8
LBB0_10:
Lloh14:
	adrp	x8, _DIOCGMEDIASIZE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _DIOCGMEDIASIZE@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	add	x2, sp, #32
	mov	x0, x19
	bl	_ioctl
	cbz	w0, LBB0_20
; %bb.11:
	cbz	x21, LBB0_21
LBB0_12:
	mov	x0, x22
	bl	_S_ISREG
	cbz	x0, LBB0_14
; %bb.13:
	mov	x0, x19
	mov	x1, x21
	bl	_ftruncate
	tbnz	x0, #63, LBB0_24
LBB0_14:
	mov	w0, #1
	mov	x1, x20
	bl	_calloc
	cbz	x0, LBB0_22
; %bb.15:
	mov	x21, x0
Lloh17:
	adrp	x8, _FIFOLOG_FMT_MAGIC@GOTPAGE
Lloh18:
	ldr	x8, [x8, _FIFOLOG_FMT_MAGIC@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	bl	_strcpy
Lloh20:
	adrp	x8, _FIFOLOG_OFF_BS@GOTPAGE
Lloh21:
	ldr	x8, [x8, _FIFOLOG_OFF_BS@GOTPAGEOFF]
Lloh22:
	ldrsw	x8, [x8]
	add	x0, x21, x8
	mov	x1, x20
	bl	_be32enc
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	mov	x3, #0
	bl	_pwrite
	cmp	x20, w0, sxtw
	b.ne	LBB0_25
; %bb.16:
	mov	x0, x21
	mov	w1, #0
	mov	x2, x20
	bl	_memset
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	mov	x3, x20
	bl	_pwrite
	cmp	w0, w20
	b.ne	LBB0_26
; %bb.17:
	mov	x0, x21
	bl	_free
	mov	x0, x19
	bl	_close
	cmp	x0, #0
	cset	w0, eq
	bl	_assert
	mov	x0, #0
	b	LBB0_27
LBB0_18:
	mov	x0, x22
	bl	_S_ISREG
	cbz	x0, LBB0_6
LBB0_19:
	mov	x0, x19
	bl	_close
	cmp	x0, #0
	cset	w0, eq
	bl	_assert
Lloh23:
	adrp	x0, l_.str.1@PAGE
Lloh24:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_27
LBB0_20:
	ldr	x8, [sp, #32]
	cmp	x8, x21
	ccmp	x21, #0, #4, ge
	csel	x21, x8, x21, eq
	cbnz	x21, LBB0_12
LBB0_21:
	mov	x0, x22
	bl	_S_ISREG
	ldr	x8, [sp, #16]
	cmp	x8, #0
	ccmp	x0, #0, #4, ne
	mov	w9, #20864
	movk	w9, #1, lsl #16
	mul	x9, x20, x9
	csel	x21, x9, x8, eq
	b	LBB0_12
LBB0_22:
Lloh25:
	adrp	x0, l_.str.3@PAGE
Lloh26:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_27
LBB0_23:
Lloh27:
	adrp	x0, l_.str@PAGE
Lloh28:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_27
LBB0_24:
Lloh29:
	adrp	x0, l_.str.2@PAGE
Lloh30:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_27
LBB0_25:
Lloh31:
	adrp	x19, _errno@GOTPAGE
Lloh32:
	ldr	x19, [x19, _errno@GOTPAGEOFF]
	ldr	w20, [x19]
	mov	x0, x21
	bl	_free
	str	w20, [x19]
Lloh33:
	adrp	x0, l_.str.4@PAGE
Lloh34:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_27
LBB0_26:
Lloh35:
	adrp	x19, _errno@GOTPAGE
Lloh36:
	ldr	x19, [x19, _errno@GOTPAGEOFF]
	ldr	w20, [x19]
	mov	x0, x21
	bl	_free
	str	w20, [x19]
Lloh37:
	adrp	x0, l_.str.5@PAGE
Lloh38:
	add	x0, x0, l_.str.5@PAGEOFF
LBB0_27:
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGot	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_TRUNC,4,2                    ; @O_TRUNC
	.comm	_O_EXCL,4,2                     ; @O_EXCL
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not open"

l_.str.1:                               ; @.str.1
	.asciz	"Wrong file type"

	.comm	_DIOCGSECTORSIZE,4,2            ; @DIOCGSECTORSIZE
	.comm	_DIOCGMEDIASIZE,4,2             ; @DIOCGMEDIASIZE
l_.str.2:                               ; @.str.2
	.asciz	"Could not ftrunc"

l_.str.3:                               ; @.str.3
	.asciz	"Could not malloc"

	.comm	_FIFOLOG_FMT_MAGIC,4,2          ; @FIFOLOG_FMT_MAGIC
	.comm	_FIFOLOG_OFF_BS,4,2             ; @FIFOLOG_OFF_BS
	.comm	_errno,4,2                      ; @errno
l_.str.4:                               ; @.str.4
	.asciz	"Could not write first sector"

l_.str.5:                               ; @.str.5
	.asciz	"Could not write second sector"

.subsections_via_symbols
