	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pmbus_data2reg_linear
_pmbus_data2reg_linear:                 ## @pmbus_data2reg_linear
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	testq	%rdx, %rdx
	je	LBB0_16
## %bb.1:
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	(%rsi), %rcx
	movq	_PSC_VOLTAGE_OUT@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	jne	LBB0_5
## %bb.2:
	testq	%r14, %r14
	js	LBB0_16
## %bb.3:
	movq	(%rdi), %rax
	movq	8(%rbx), %rcx
	movq	(%rax,%rcx,8), %rax
	movl	%eax, %ecx
	negb	%cl
	movq	%r14, %rdx
	shlq	%cl, %rdx
	movl	%eax, %ecx
	shrq	%cl, %r14
	testq	%rax, %rax
	cmovsq	%rdx, %r14
	movq	%r14, %rdi
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_DIV_ROUND_CLOSEST
	movzwl	%ax, %eax
	jmp	LBB0_17
LBB0_16:
	xorl	%eax, %eax
	jmp	LBB0_17
LBB0_5:
	movq	%r14, %rax
	negq	%rax
	cmovsq	%r14, %rax
	movq	_PSC_POWER@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_7
## %bb.6:
	movq	%rax, %rdi
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_DIV_ROUND_CLOSEST
	movq	(%rbx), %rcx
LBB0_7:
	movq	_PSC_FAN@GOTPCREL(%rip), %rdx
	imulq	$1000, %rax, %rdi               ## imm = 0x3E8
	cmpq	(%rdx), %rcx
	cmovneq	%rax, %rdi
	movq	_MAX_MANTISSA@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	xorl	%eax, %eax
	cmpq	%rcx, %rdi
	jl	LBB0_11
## %bb.8:
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	leal	1(%rdx), %eax
	sarq	%rdi
	cmpq	%rcx, %rdi
	jl	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpl	$14, %edx
	movl	%eax, %edx
	jb	LBB0_9
LBB0_11:
	movq	_MIN_MANTISSA@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%rcx, %rdi
	jge	LBB0_14
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	leal	-1(%rax), %ebx
	addq	%rdi, %rdi
	cmpq	%rcx, %rdi
	jge	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	cmpl	$-14, %eax
	movl	%ebx, %eax
	jg	LBB0_12
	jmp	LBB0_15
LBB0_14:
	movl	%eax, %ebx
LBB0_15:
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_DIV_ROUND_CLOSEST
	cmpl	$1023, %eax                     ## imm = 0x3FF
	movl	$1023, %ecx                     ## imm = 0x3FF
	cmovll	%eax, %ecx
	movl	%ecx, %edx
	negl	%edx
	testq	%r14, %r14
	cmovnsl	%ecx, %edx
	andl	$2047, %edx                     ## imm = 0x7FF
	shll	$11, %ebx
	movzwl	%bx, %eax
	orl	%edx, %eax
LBB0_17:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PSC_VOLTAGE_OUT,8,3            ## @PSC_VOLTAGE_OUT
	.comm	_PSC_POWER,8,3                  ## @PSC_POWER
	.comm	_PSC_FAN,8,3                    ## @PSC_FAN
	.comm	_MAX_MANTISSA,8,3               ## @MAX_MANTISSA
	.comm	_MIN_MANTISSA,8,3               ## @MIN_MANTISSA
	.no_dead_strip	_pmbus_data2reg_linear
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pmbus_data2reg_linear
_pmbus_data2reg_linear:                 ; @pmbus_data2reg_linear
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	cbz	x2, LBB0_4
; %bb.1:
	mov	x19, x2
	mov	x20, x1
	ldr	x8, [x1]
Lloh0:
	adrp	x9, _PSC_VOLTAGE_OUT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PSC_VOLTAGE_OUT@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.2:
	tbnz	x19, #63, LBB0_4
; %bb.3:
	ldr	x8, [x0]
	ldr	x9, [x20, #8]
	ldr	x8, [x8, x9, lsl #3]
	neg	x9, x8
	lsl	x9, x19, x9
	lsr	x10, x19, x8
	cmp	x8, #0
	csel	x0, x9, x10, lt
	mov	w1, #1000
	bl	_DIV_ROUND_CLOSEST
	and	x0, x0, #0xffff
	b	LBB0_15
LBB0_4:
	mov	x0, #0
	b	LBB0_15
LBB0_5:
	cmp	x19, #0
	cneg	x0, x19, mi
Lloh3:
	adrp	x9, _PSC_POWER@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PSC_POWER@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	mov	w1, #1000
	bl	_DIV_ROUND_CLOSEST
	ldr	x8, [x20]
LBB0_7:
Lloh6:
	adrp	x9, _PSC_FAN@GOTPAGE
Lloh7:
	ldr	x9, [x9, _PSC_FAN@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	mov	w10, #1000
	mul	x10, x0, x10
	cmp	x8, x9
	csel	x0, x10, x0, eq
Lloh9:
	adrp	x8, _MAX_MANTISSA@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MAX_MANTISSA@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x8]
	cmp	x0, x9
	b.ge	LBB0_9
; %bb.8:
	mov	w8, #0
	b	LBB0_11
LBB0_9:
	mov	w10, #0
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	w8, w10, #1
	asr	x0, x0, #1
	cmp	x0, x9
	ccmp	w10, #14, #2, ge
	mov	x10, x8
	b.lo	LBB0_10
LBB0_11:
Lloh12:
	adrp	x9, _MIN_MANTISSA@GOTPAGE
Lloh13:
	ldr	x9, [x9, _MIN_MANTISSA@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x0, x9
	b.ge	LBB0_13
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	sub	w20, w8, #1
	lsl	x0, x0, #1
	cmp	x0, x9
	ccmn	w8, #14, #4, lt
	mov	x8, x20
	b.gt	LBB0_12
	b	LBB0_14
LBB0_13:
	mov	x20, x8
LBB0_14:
	mov	w1, #1000
	bl	_DIV_ROUND_CLOSEST
	mov	w8, #1023
	cmp	w0, #1023
	csel	w8, w0, w8, lt
	cmp	x19, #0
	cneg	w8, w8, lt
	and	w0, w8, #0x7ff
	bfi	w0, w20, #11, #5
LBB0_15:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PSC_VOLTAGE_OUT,8,3            ; @PSC_VOLTAGE_OUT
	.comm	_PSC_POWER,8,3                  ; @PSC_POWER
	.comm	_PSC_FAN,8,3                    ; @PSC_FAN
	.comm	_MAX_MANTISSA,8,3               ; @MAX_MANTISSA
	.comm	_MIN_MANTISSA,8,3               ; @MIN_MANTISSA
	.no_dead_strip	_pmbus_data2reg_linear
.subsections_via_symbols
