	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sbs_set_battery_mode
_sbs_set_battery_mode:                  ## @sbs_set_battery_mode
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	_BATTERY_MODE_OFFSET@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	callq	_sbs_read_word_data
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_6
## %bb.1:
	movq	_BATTERY_MODE_MASK@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movl	%edx, %eax
	andl	%ebx, %eax
	cmpl	%r15d, %eax
	jne	LBB0_3
## %bb.2:
	movl	%r15d, %ebx
	jmp	LBB0_6
LBB0_3:
	movq	_BATTERY_MODE_AMPS@GOTPCREL(%rip), %rax
	movl	%edx, %ecx
	notl	%ecx
	andl	%ebx, %ecx
	orl	%ebx, %edx
	cmpl	%r15d, (%rax)
	cmovel	%ecx, %edx
	movl	(%r13), %esi
	movq	%r14, %rdi
	callq	_sbs_write_word_data
	testl	%eax, %eax
	js	LBB0_4
## %bb.5:
	movl	$1000, %edi                     ## imm = 0x3E8
	movl	$2000, %esi                     ## imm = 0x7D0
	callq	_usleep_range
	movl	(%r12), %eax
	andl	%eax, %ebx
	jmp	LBB0_6
LBB0_4:
	movl	%eax, %ebx
LBB0_6:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BATTERY_MODE_OFFSET,4,2        ## @BATTERY_MODE_OFFSET
	.comm	_BATTERY_MODE_MASK,4,2          ## @BATTERY_MODE_MASK
	.comm	_BATTERY_MODE_AMPS,4,2          ## @BATTERY_MODE_AMPS
	.no_dead_strip	_sbs_set_battery_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sbs_set_battery_mode
_sbs_set_battery_mode:                  ; @sbs_set_battery_mode
	.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	x19, x1
	mov	x21, x0
Lloh0:
	adrp	x23, _BATTERY_MODE_OFFSET@GOTPAGE
Lloh1:
	ldr	x23, [x23, _BATTERY_MODE_OFFSET@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_sbs_read_word_data
	mov	x20, x0
	tbnz	w0, #31, LBB0_4
; %bb.1:
Lloh2:
	adrp	x22, _BATTERY_MODE_MASK@GOTPAGE
Lloh3:
	ldr	x22, [x22, _BATTERY_MODE_MASK@GOTPAGEOFF]
	ldr	w8, [x22]
	and	w9, w8, w20
	cmp	w9, w19
	b.eq	LBB0_6
; %bb.2:
Lloh4:
	adrp	x9, _BATTERY_MODE_AMPS@GOTPAGE
Lloh5:
	ldr	x9, [x9, _BATTERY_MODE_AMPS@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	bic	w10, w20, w8
	orr	w8, w8, w20
	cmp	w9, w19
	csel	w2, w10, w8, eq
	ldr	w1, [x23]
	mov	x0, x21
	bl	_sbs_write_word_data
	tbnz	w0, #31, LBB0_5
; %bb.3:
	mov	w0, #1000
	mov	w1, #2000
	bl	_usleep_range
	ldr	w8, [x22]
	and	w19, w8, w20
	b	LBB0_6
LBB0_4:
	mov	x19, x20
	b	LBB0_6
LBB0_5:
	mov	x19, x0
LBB0_6:
	mov	x0, x19
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_BATTERY_MODE_OFFSET,4,2        ; @BATTERY_MODE_OFFSET
	.comm	_BATTERY_MODE_MASK,4,2          ; @BATTERY_MODE_MASK
	.comm	_BATTERY_MODE_AMPS,4,2          ; @BATTERY_MODE_AMPS
	.no_dead_strip	_sbs_set_battery_mode
.subsections_via_symbols
