	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tomoyo_check_open_permission   ## -- Begin function tomoyo_check_open_permission
	.p2align	4, 0x90
_tomoyo_check_open_permission:          ## @tomoyo_check_open_permission
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movl	%edx, %edi
	callq	_ACC_MODE
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	movq	_TOMOYO_MAC_FOR_FILE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_tomoyo_check_flags
	testl	%eax, %eax
	je	LBB0_16
## %bb.1:
	cmpl	$0, 8(%r14)
	je	LBB0_16
## %bb.2:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_16
## %bb.3:
	movl	%eax, %ebx
	movq	(%r14), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movl	(%rax), %edi
	callq	_S_ISDIR
	testq	%rax, %rax
	jne	LBB0_16
LBB0_5:
	movq	%r14, %rdi
	callq	_tomoyo_get_path
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_15
## %bb.6:
	movq	_MAY_WRITE@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	testl	%ecx, (%rax)
	je	LBB0_11
## %bb.7:
	movq	_O_TRUNC@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_8
LBB0_9:
	movq	%r14, %rdi
	callq	_tomoyo_is_no_rewrite_file
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	movq	_TOMOYO_TYPE_REWRITE_ACL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rdx
	movl	%ebx, %ecx
	callq	_tomoyo_check_single_path_permission2
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_15
	jmp	LBB0_11
LBB0_8:
	movq	_O_APPEND@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_9
LBB0_11:
	leaq	L_.str(%rip), %rcx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movl	%ebx, %r8d
	callq	_tomoyo_check_file_perm2
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_15
## %bb.12:
	movq	_O_TRUNC@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_13
## %bb.14:
	movq	_TOMOYO_TYPE_TRUNCATE_ACL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rdx
	movl	%ebx, %ecx
	callq	_tomoyo_check_single_path_permission2
	movl	%eax, %r13d
	jmp	LBB0_15
LBB0_13:
	xorl	%r13d, %r13d
LBB0_15:
	movq	%r14, %rdi
	callq	_tomoyo_free
	xorl	%r12d, %r12d
	cmpl	$3, %ebx
	cmovel	%r13d, %r12d
LBB0_16:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_TOMOYO_MAC_FOR_FILE,4,2        ## @TOMOYO_MAC_FOR_FILE
	.comm	_MAY_WRITE,4,2                  ## @MAY_WRITE
	.comm	_O_TRUNC,4,2                    ## @O_TRUNC
	.comm	_O_APPEND,4,2                   ## @O_APPEND
	.comm	_TOMOYO_TYPE_REWRITE_ACL,4,2    ## @TOMOYO_TYPE_REWRITE_ACL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"open"

	.comm	_TOMOYO_TYPE_TRUNCATE_ACL,4,2   ## @TOMOYO_TYPE_TRUNCATE_ACL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tomoyo_check_open_permission   ; -- Begin function tomoyo_check_open_permission
	.p2align	2
_tomoyo_check_open_permission:          ; @tomoyo_check_open_permission
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x21, x2
	mov	x22, x1
	mov	x20, x0
	mov	x0, x2
	bl	_ACC_MODE
	mov	x23, x0
Lloh0:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
Lloh3:
	adrp	x8, _TOMOYO_MAC_FOR_FILE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TOMOYO_MAC_FOR_FILE@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_tomoyo_check_flags
	cbz	w0, LBB0_17
; %bb.1:
	ldr	w8, [x22, #8]
	cmp	w8, #0
	ccmp	w23, #0, #4, ne
	b.eq	LBB0_4
; %bb.2:
	mov	x19, x0
	ldr	x8, [x22]
	ldr	x8, [x8]
	cbz	x8, LBB0_5
; %bb.3:
	ldr	w0, [x8]
	bl	_S_ISDIR
	cbz	x0, LBB0_5
LBB0_4:
	mov	w0, #0
	b	LBB0_17
LBB0_5:
	mov	x0, x22
	bl	_tomoyo_get_path
	mov	x22, x0
	cbz	x0, LBB0_10
; %bb.6:
Lloh6:
	adrp	x8, _MAY_WRITE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAY_WRITE@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	tst	w8, w23
	b.eq	LBB0_12
; %bb.7:
Lloh9:
	adrp	x8, _O_TRUNC@GOTPAGE
Lloh10:
	ldr	x8, [x8, _O_TRUNC@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_11
LBB0_8:
	mov	x0, x22
	bl	_tomoyo_is_no_rewrite_file
	cbz	x0, LBB0_12
; %bb.9:
Lloh12:
	adrp	x8, _TOMOYO_TYPE_REWRITE_ACL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _TOMOYO_TYPE_REWRITE_ACL@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x22
	mov	x3, x19
	bl	_tomoyo_check_single_path_permission2
	mov	x24, x0
	cbnz	w0, LBB0_16
	b	LBB0_12
LBB0_10:
	neg	w24, w24
	b	LBB0_16
LBB0_11:
Lloh15:
	adrp	x8, _O_APPEND@GOTPAGE
Lloh16:
	ldr	x8, [x8, _O_APPEND@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_8
LBB0_12:
Lloh18:
	adrp	x3, l_.str@PAGE
Lloh19:
	add	x3, x3, l_.str@PAGEOFF
	mov	x0, x20
	mov	x1, x22
	mov	x2, x23
	mov	x4, x19
	bl	_tomoyo_check_file_perm2
	mov	x24, x0
	cbnz	w0, LBB0_16
; %bb.13:
Lloh20:
	adrp	x8, _O_TRUNC@GOTPAGE
Lloh21:
	ldr	x8, [x8, _O_TRUNC@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_15
; %bb.14:
Lloh23:
	adrp	x8, _TOMOYO_TYPE_TRUNCATE_ACL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _TOMOYO_TYPE_TRUNCATE_ACL@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x22
	mov	x3, x19
	bl	_tomoyo_check_single_path_permission2
	mov	x24, x0
	b	LBB0_16
LBB0_15:
	mov	w24, #0
LBB0_16:
	mov	x0, x22
	bl	_tomoyo_free
	cmp	w19, #3
	csel	w0, w24, wzr, eq
LBB0_17:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_TOMOYO_MAC_FOR_FILE,4,2        ; @TOMOYO_MAC_FOR_FILE
	.comm	_MAY_WRITE,4,2                  ; @MAY_WRITE
	.comm	_O_TRUNC,4,2                    ; @O_TRUNC
	.comm	_O_APPEND,4,2                   ; @O_APPEND
	.comm	_TOMOYO_TYPE_REWRITE_ACL,4,2    ; @TOMOYO_TYPE_REWRITE_ACL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"open"

	.comm	_TOMOYO_TYPE_TRUNCATE_ACL,4,2   ; @TOMOYO_TYPE_TRUNCATE_ACL
.subsections_via_symbols
