	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function diolan_init
_diolan_init:                           ## @diolan_init
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_frequency@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	cmpl	$200000, %edi                   ## imm = 0x30D40
	jl	LBB0_2
## %bb.1:
	movq	_U2C_I2C_SPEED_FAST@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_U2C_I2C_FREQ_FAST@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_2:
	cmpl	$99999, %edi                    ## imm = 0x1869F
	jg	LBB0_5
## %bb.3:
	testl	%edi, %edi
	je	LBB0_5
## %bb.4:
	callq	_U2C_I2C_SPEED
	movq	_U2C_I2C_SPEED_2KHZ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	cmpl	%r14d, %eax
	cmovll	%eax, %r14d
	movl	%r14d, %edi
	callq	_U2C_I2C_FREQ
	movl	%eax, %r8d
	jmp	LBB0_7
LBB0_5:
	movq	_U2C_I2C_SPEED_STD@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_U2C_I2C_FREQ_STD@GOTPCREL(%rip), %rax
LBB0_6:
	movl	(%rax), %r8d
LBB0_7:
	movl	%r8d, (%r15)
	movq	(%rbx), %rax
	movq	8(%rbx), %rdi
	movq	8(%rax), %rcx
	movl	(%rcx), %edx
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movq	%rbx, %rdi
	callq	_diolan_flush_input
	movq	%rbx, %rdi
	callq	_diolan_fw_version
	movq	%rbx, %rdi
	callq	_diolan_get_serial
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_diolan_set_speed
	testl	%eax, %eax
	js	LBB0_11
## %bb.8:
	movq	_U2C_I2C_SPEED_FAST@GOTPCREL(%rip), %r15
	xorl	%esi, %esi
	cmpl	(%r15), %r14d
	setne	%sil
	movq	%rbx, %rdi
	callq	_diolan_set_clock_synch
	testl	%eax, %eax
	js	LBB0_11
## %bb.9:
	cmpl	(%r15), %r14d
	je	LBB0_11
## %bb.10:
	movq	_DIOLAN_SYNC_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_diolan_set_clock_synch_timeout ## TAILCALL
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_frequency,4,2                  ## @frequency
	.comm	_U2C_I2C_SPEED_FAST,4,2         ## @U2C_I2C_SPEED_FAST
	.comm	_U2C_I2C_FREQ_FAST,4,2          ## @U2C_I2C_FREQ_FAST
	.comm	_U2C_I2C_SPEED_STD,4,2          ## @U2C_I2C_SPEED_STD
	.comm	_U2C_I2C_FREQ_STD,4,2           ## @U2C_I2C_FREQ_STD
	.comm	_U2C_I2C_SPEED_2KHZ,4,2         ## @U2C_I2C_SPEED_2KHZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Diolan U2C at USB bus %03d address %03d speed %d Hz\n"

	.comm	_DIOLAN_SYNC_TIMEOUT,4,2        ## @DIOLAN_SYNC_TIMEOUT
	.no_dead_strip	_diolan_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function diolan_init
_diolan_init:                           ; @diolan_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
Lloh0:
	adrp	x22, _frequency@GOTPAGE
Lloh1:
	ldr	x22, [x22, _frequency@GOTPAGEOFF]
	ldr	w0, [x22]
	mov	w8, #3392
	movk	w8, #3, lsl #16
Lloh2:
	adrp	x21, _U2C_I2C_SPEED_FAST@GOTPAGE
Lloh3:
	ldr	x21, [x21, _U2C_I2C_SPEED_FAST@GOTPAGEOFF]
	cmp	w0, w8
	b.lt	LBB0_2
; %bb.1:
	ldr	w20, [x21]
Lloh4:
	adrp	x8, _U2C_I2C_FREQ_FAST@GOTPAGE
Lloh5:
	ldr	x8, [x8, _U2C_I2C_FREQ_FAST@GOTPAGEOFF]
Lloh6:
	ldr	w4, [x8]
	b	LBB0_5
LBB0_2:
	mov	w8, #34463
	movk	w8, #1, lsl #16
	cmp	w0, w8
	ccmp	w0, #0, #4, le
	b.ne	LBB0_4
; %bb.3:
Lloh7:
	adrp	x8, _U2C_I2C_SPEED_STD@GOTPAGE
Lloh8:
	ldr	x8, [x8, _U2C_I2C_SPEED_STD@GOTPAGEOFF]
Lloh9:
	ldr	w20, [x8]
Lloh10:
	adrp	x8, _U2C_I2C_FREQ_STD@GOTPAGE
Lloh11:
	ldr	x8, [x8, _U2C_I2C_FREQ_STD@GOTPAGEOFF]
Lloh12:
	ldr	w4, [x8]
	b	LBB0_5
LBB0_4:
	bl	_U2C_I2C_SPEED
Lloh13:
	adrp	x8, _U2C_I2C_SPEED_2KHZ@GOTPAGE
Lloh14:
	ldr	x8, [x8, _U2C_I2C_SPEED_2KHZ@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	w0, w8
	csel	w20, w0, w8, lt
	mov	x0, x20
	bl	_U2C_I2C_FREQ
	mov	x4, x0
LBB0_5:
	str	w4, [x22]
	ldp	x8, x0, [x19]
	ldr	x9, [x8, #8]
	ldr	w2, [x9]
	ldr	w3, [x8]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
	mov	x0, x19
	bl	_diolan_flush_input
	mov	x0, x19
	bl	_diolan_fw_version
	mov	x0, x19
	bl	_diolan_get_serial
	mov	x0, x19
	mov	x1, x20
	bl	_diolan_set_speed
	tbnz	w0, #31, LBB0_9
; %bb.6:
	ldr	w8, [x21]
	cmp	w20, w8
	cset	w1, ne
	mov	x0, x19
	bl	_diolan_set_clock_synch
	tbnz	w0, #31, LBB0_9
; %bb.7:
	ldr	w8, [x21]
	cmp	w20, w8
	b.eq	LBB0_9
; %bb.8:
Lloh18:
	adrp	x8, _DIOLAN_SYNC_TIMEOUT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _DIOLAN_SYNC_TIMEOUT@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_diolan_set_clock_synch_timeout
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_frequency,4,2                  ; @frequency
	.comm	_U2C_I2C_SPEED_FAST,4,2         ; @U2C_I2C_SPEED_FAST
	.comm	_U2C_I2C_FREQ_FAST,4,2          ; @U2C_I2C_FREQ_FAST
	.comm	_U2C_I2C_SPEED_STD,4,2          ; @U2C_I2C_SPEED_STD
	.comm	_U2C_I2C_FREQ_STD,4,2           ; @U2C_I2C_FREQ_STD
	.comm	_U2C_I2C_SPEED_2KHZ,4,2         ; @U2C_I2C_SPEED_2KHZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Diolan U2C at USB bus %03d address %03d speed %d Hz\n"

	.comm	_DIOLAN_SYNC_TIMEOUT,4,2        ; @DIOLAN_SYNC_TIMEOUT
	.no_dead_strip	_diolan_init
.subsections_via_symbols
