	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function handle_presence_change
_handle_presence_change:                ## @handle_presence_change
	.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
	testl	%edi, %edi
	je	LBB0_1
## %bb.2:
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	callq	_dbg
	leaq	L_.str.1(%rip), %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	xorl	%eax, %eax
	callq	_dbg
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_INT_PRESENCE_ON@GOTPCREL(%rip), %rax
LBB0_21:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	(%rax), %eax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, 4(%rdx,%rcx,8)
LBB0_22:                                ##   in Loop: Header=BB0_3 Depth=1
	incq	%r12
	movl	%ebx, %r13d
	cmpq	$6, %r12
	je	LBB0_23
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	%edi, %eax
	movl	%r12d, %ecx
	shrl	%cl, %eax
	testl	$257, %eax                      ## imm = 0x101
	je	LBB0_22
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	40(%r8), %edi
	movq	32(%r8), %rsi
	addq	%r12, %rsi
	xorl	%r13d, %r13d
	xorl	%edx, %edx
	callq	_cpqhp_slot_find
	movq	%rax, %r15
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rsi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	24(%rax), %rdi
	leaq	1(%rsi), %rax
	movabsq	$-3689348814741910323, %rcx     ## imm = 0xCCCCCCCCCCCCCCCD
	mulq	%rcx
	shrq	$2, %rdx
	andq	$-2, %rdx
	leaq	(%rdx,%rdx,4), %rax
	negq	%rax
	addq	%rsi, %rax
	incq	%rax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movl	%r12d, (%rdi,%rsi,8)
	movq	_SLOT_MASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	addq	16(%rax), %rdi
	callq	_readb
                                        ## kill: def $eax killed $eax def $rax
	sarl	$4, %eax
	leal	(%rax,%r12), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_cpqhp_find_slot
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	testq	%rax, %rax
	je	LBB0_23
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	incl	%ebx
	cmpq	$0, 8(%r15)
	je	LBB0_17
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpl	$1, 8(%r8)
	jne	LBB0_17
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %r14
	movswl	14(%r8), %eax
	xorl	%edx, %edx
	btl	%r12d, %eax
	setb	%dl
	leal	7(%r12), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	sarl	%cl, %eax
	andl	$2, %eax
	orl	%edx, %eax
	cmpl	(%r15), %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	leaq	L_.str.3(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_dbg
	movq	_INT_BUTTON_RELEASE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	%eax, 4(%rsi,%rdx,8)
	movq	(%r14), %rax
	movq	_BLINKINGON_STATE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_BLINKINGOFF_STATE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_POWERON_STATE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_POWEROFF_STATE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_15
LBB0_16:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_INT_BUTTON_IGNORE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rsi,%rdx,8)
	leaq	L_.str.5(%rip), %rdi
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	12(%r8), %eax
	movl	%eax, %edx
	sarl	$16, %edx
	xorl	%esi, %esi
	btl	%r12d, %edx
	setb	%sil
	leal	7(%r12), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	sarl	%cl, %edx
	andl	$2, %edx
	orl	%esi, %edx
	movl	%edx, (%r15)
	movl	%eax, %edx
	movl	%r12d, %ecx
	shrl	%cl, %edx
	testl	$65536, %edx                    ## imm = 0x10000
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	%r12d, %ecx
	shrl	%cl, %eax
	testl	$16777216, %eax                 ## imm = 0x1000000
	je	LBB0_19
## %bb.20:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_INT_PRESENCE_OFF@GOTPCREL(%rip), %rax
	jmp	LBB0_21
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	leaq	L_.str.2(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_dbg
	movq	_INT_BUTTON_PRESS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	%eax, 4(%rdx,%rcx,8)
	jmp	LBB0_15
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_INT_BUTTON_CANCEL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rsi,%rdx,8)
	leaq	L_.str.4(%rip), %rdi
LBB0_12:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_dbg
LBB0_15:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	jmp	LBB0_22
LBB0_1:
	xorl	%r13d, %r13d
LBB0_23:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cpqsbd:  Presence/Notify input change.\n"

L_.str.1:                               ## @.str.1
	.asciz	"         Changed bits are 0x%4.4x\n"

	.comm	_SLOT_MASK,8,3                  ## @SLOT_MASK
L_.str.2:                               ## @.str.2
	.asciz	"hp_slot %d button pressed\n"

	.comm	_INT_BUTTON_PRESS,4,2           ## @INT_BUTTON_PRESS
L_.str.3:                               ## @.str.3
	.asciz	"hp_slot %d button released\n"

	.comm	_INT_BUTTON_RELEASE,4,2         ## @INT_BUTTON_RELEASE
	.comm	_BLINKINGON_STATE,8,3           ## @BLINKINGON_STATE
	.comm	_BLINKINGOFF_STATE,8,3          ## @BLINKINGOFF_STATE
	.comm	_INT_BUTTON_CANCEL,4,2          ## @INT_BUTTON_CANCEL
L_.str.4:                               ## @.str.4
	.asciz	"hp_slot %d button cancel\n"

	.comm	_POWERON_STATE,8,3              ## @POWERON_STATE
	.comm	_POWEROFF_STATE,8,3             ## @POWEROFF_STATE
	.comm	_INT_BUTTON_IGNORE,4,2          ## @INT_BUTTON_IGNORE
L_.str.5:                               ## @.str.5
	.asciz	"hp_slot %d button ignore\n"

	.comm	_INT_PRESENCE_ON,4,2            ## @INT_PRESENCE_ON
	.comm	_INT_PRESENCE_OFF,4,2           ## @INT_PRESENCE_OFF
	.no_dead_strip	_handle_presence_change
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function handle_presence_change
_handle_presence_change:                ; @handle_presence_change
	.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
	cbz	w0, LBB0_18
; %bb.1:
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dbg
	str	x20, [sp]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_dbg
	mov	x28, #0
	mov	w21, #0
	mov	w24, #257
	mov	w25, #10
	b	LBB0_5
LBB0_2:                                 ;   in Loop: Header=BB0_5 Depth=1
Lloh4:
	adrp	x8, _INT_PRESENCE_ON@GOTPAGE
Lloh5:
	ldr	x8, [x8, _INT_PRESENCE_ON@GOTPAGEOFF]
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x8]
	add	x9, x22, x23, lsl #3
	str	w8, [x9, #4]
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x28, x28, #1
	cmp	x28, #6
	b.eq	LBB0_19
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	lsr	w8, w20, w28
	tst	w8, w24
	b.eq	LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x19, #40]
	ldr	x8, [x19, #32]
	add	x1, x28, x8
	mov	w2, #0
	bl	_cpqhp_slot_find
	mov	x26, x0
	ldr	x23, [x19]
	add	x8, x23, #1
	mov	x9, #-3689348814741910324
	movk	x9, #52429
	umulh	x9, x8, x9
	lsr	x9, x9, #3
	msub	x8, x9, x25, x8
	str	x8, [x19]
	lsl	x8, x23, #3
	ldp	x9, x22, [x19, #16]
	str	w28, [x22, x8]
Lloh6:
	adrp	x8, _SLOT_MASK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SLOT_MASK@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	add	x0, x8, x9
	bl	_readb
	add	w1, w28, w0, asr #4
	mov	x0, x19
	bl	_cpqhp_find_slot
	cbz	x0, LBB0_18
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w21, w21, #1
	ldr	x8, [x26, #8]
	cbz	x8, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x19, #8]
	cmp	w8, #1
	b.ne	LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	ldrsh	w8, [x19, #14]
	lsr	w9, w8, w28
	add	w10, w28, #7
	asr	w8, w8, w10
	and	w8, w8, #0x2
	bfxil	w8, w9, #0, #1
	ldr	w9, [x26]
	cmp	w8, w9
	b.ne	LBB0_15
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x27, x0
	str	x28, [sp]
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_dbg
Lloh11:
	adrp	x8, _INT_BUTTON_RELEASE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _INT_BUTTON_RELEASE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x8]
	add	x8, x22, x23, lsl #3
	str	w9, [x8, #4]!
	ldr	x9, [x27]
Lloh14:
	adrp	x10, _BLINKINGON_STATE@GOTPAGE
Lloh15:
	ldr	x10, [x10, _BLINKINGON_STATE@GOTPAGEOFF]
Lloh16:
	ldr	x10, [x10]
Lloh17:
	adrp	x11, _BLINKINGOFF_STATE@GOTPAGE
Lloh18:
	ldr	x11, [x11, _BLINKINGOFF_STATE@GOTPAGEOFF]
Lloh19:
	ldr	x11, [x11]
	cmp	x9, x10
	ccmp	x9, x11, #4, ne
	b.ne	LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh20:
	adrp	x9, _INT_BUTTON_CANCEL@GOTPAGE
Lloh21:
	ldr	x9, [x9, _INT_BUTTON_CANCEL@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	str	w9, [x8]
	str	x28, [sp]
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_dbg
	b	LBB0_4
LBB0_12:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x19, #12]
	asr	w9, w8, #16
	lsr	w10, w9, w28
	add	w11, w28, #7
	asr	w9, w9, w11
	and	w9, w9, #0x2
	bfxil	w9, w10, #0, #1
	str	w9, [x26]
	lsr	w9, w8, w28
	tbz	w9, #16, LBB0_2
; %bb.13:                               ;   in Loop: Header=BB0_5 Depth=1
	lsr	w8, w8, w28
	tbz	w8, #24, LBB0_2
; %bb.14:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh25:
	adrp	x8, _INT_PRESENCE_OFF@GOTPAGE
Lloh26:
	ldr	x8, [x8, _INT_PRESENCE_OFF@GOTPAGEOFF]
	b	LBB0_3
LBB0_15:                                ;   in Loop: Header=BB0_5 Depth=1
	str	x28, [sp]
Lloh27:
	adrp	x0, l_.str.2@PAGE
Lloh28:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_dbg
Lloh29:
	adrp	x8, _INT_BUTTON_PRESS@GOTPAGE
Lloh30:
	ldr	x8, [x8, _INT_BUTTON_PRESS@GOTPAGEOFF]
	b	LBB0_3
LBB0_16:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh31:
	adrp	x10, _POWERON_STATE@GOTPAGE
Lloh32:
	ldr	x10, [x10, _POWERON_STATE@GOTPAGEOFF]
Lloh33:
	ldr	x10, [x10]
Lloh34:
	adrp	x11, _POWEROFF_STATE@GOTPAGE
Lloh35:
	ldr	x11, [x11, _POWEROFF_STATE@GOTPAGEOFF]
Lloh36:
	ldr	x11, [x11]
	cmp	x9, x10
	ccmp	x9, x11, #4, ne
	b.ne	LBB0_4
; %bb.17:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh37:
	adrp	x9, _INT_BUTTON_IGNORE@GOTPAGE
Lloh38:
	ldr	x9, [x9, _INT_BUTTON_IGNORE@GOTPAGEOFF]
Lloh39:
	ldr	w9, [x9]
	str	w9, [x8]
	str	x28, [sp]
Lloh40:
	adrp	x0, l_.str.5@PAGE
Lloh41:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_dbg
	b	LBB0_4
LBB0_18:
	mov	w21, #0
LBB0_19:
	mov	x0, x21
	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
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cpqsbd:  Presence/Notify input change.\n"

l_.str.1:                               ; @.str.1
	.asciz	"         Changed bits are 0x%4.4x\n"

	.comm	_SLOT_MASK,8,3                  ; @SLOT_MASK
l_.str.2:                               ; @.str.2
	.asciz	"hp_slot %d button pressed\n"

	.comm	_INT_BUTTON_PRESS,4,2           ; @INT_BUTTON_PRESS
l_.str.3:                               ; @.str.3
	.asciz	"hp_slot %d button released\n"

	.comm	_INT_BUTTON_RELEASE,4,2         ; @INT_BUTTON_RELEASE
	.comm	_BLINKINGON_STATE,8,3           ; @BLINKINGON_STATE
	.comm	_BLINKINGOFF_STATE,8,3          ; @BLINKINGOFF_STATE
	.comm	_INT_BUTTON_CANCEL,4,2          ; @INT_BUTTON_CANCEL
l_.str.4:                               ; @.str.4
	.asciz	"hp_slot %d button cancel\n"

	.comm	_POWERON_STATE,8,3              ; @POWERON_STATE
	.comm	_POWEROFF_STATE,8,3             ; @POWEROFF_STATE
	.comm	_INT_BUTTON_IGNORE,4,2          ; @INT_BUTTON_IGNORE
l_.str.5:                               ; @.str.5
	.asciz	"hp_slot %d button ignore\n"

	.comm	_INT_PRESENCE_ON,4,2            ; @INT_PRESENCE_ON
	.comm	_INT_PRESENCE_OFF,4,2           ; @INT_PRESENCE_OFF
	.no_dead_strip	_handle_presence_change
.subsections_via_symbols
