	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pb0100_set_blue_balance
_pb0100_set_blue_balance:               ## @pb0100_set_blue_balance
	.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
	movq	(%rdi), %rax
	movq	_AUTOGAIN_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	$0, (%rax,%rcx,4)
	je	LBB0_2
## %bb.1:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_3
LBB0_2:
	movq	_BLUE_BALANCE_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%esi, (%rax,%rcx,4)
	movq	_GAIN_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	addl	(%rax,%rcx,4), %esi
	cmpl	$255, %esi
	movl	$255, %eax
	cmovll	%esi, %eax
	xorl	%r14d, %r14d
	testl	%eax, %eax
	cmovgl	%eax, %r14d
	movq	_PB_BGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edx
	callq	_stv06xx_write_sensor
	movl	%eax, %ebx
	movq	_D_V4L2@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	movl	%ebx, %ecx
	callq	_PDEBUG
LBB0_3:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AUTOGAIN_IDX,8,3               ## @AUTOGAIN_IDX
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_BLUE_BALANCE_IDX,8,3           ## @BLUE_BALANCE_IDX
	.comm	_GAIN_IDX,8,3                   ## @GAIN_IDX
	.comm	_PB_BGAIN,4,2                   ## @PB_BGAIN
	.comm	_D_V4L2,4,2                     ## @D_V4L2
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Set blue gain to %d, status: %d"

	.no_dead_strip	_pb0100_set_blue_balance
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pb0100_set_blue_balance
_pb0100_set_blue_balance:               ; @pb0100_set_blue_balance
	.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
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _AUTOGAIN_IDX@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AUTOGAIN_IDX@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	ldr	w9, [x8, x9, lsl #2]
	cbz	w9, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EBUSY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w19, w8
	b	LBB0_3
LBB0_2:
Lloh6:
	adrp	x9, _BLUE_BALANCE_IDX@GOTPAGE
Lloh7:
	ldr	x9, [x9, _BLUE_BALANCE_IDX@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	str	w1, [x8, x9, lsl #2]
Lloh9:
	adrp	x9, _GAIN_IDX@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GAIN_IDX@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	ldr	w8, [x8, x9, lsl #2]
	add	w8, w8, w1
	mov	w9, #255
	cmp	w8, #255
	csel	w8, w8, w9, lt
	cmp	w8, #0
	csel	w20, w8, wzr, gt
Lloh12:
	adrp	x8, _PB_BGAIN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PB_BGAIN@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_stv06xx_write_sensor
	mov	x19, x0
Lloh15:
	adrp	x8, _D_V4L2@GOTPAGE
Lloh16:
	ldr	x8, [x8, _D_V4L2@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	mov	x3, x19
	bl	_PDEBUG
LBB0_3:
	mov	x0, x19
	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 AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_AUTOGAIN_IDX,8,3               ; @AUTOGAIN_IDX
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_BLUE_BALANCE_IDX,8,3           ; @BLUE_BALANCE_IDX
	.comm	_GAIN_IDX,8,3                   ; @GAIN_IDX
	.comm	_PB_BGAIN,4,2                   ; @PB_BGAIN
	.comm	_D_V4L2,4,2                     ; @D_V4L2
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Set blue gain to %d, status: %d"

	.no_dead_strip	_pb0100_set_blue_balance
.subsections_via_symbols
