	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dib0700_download_firmware      ## -- Begin function dib0700_download_firmware
	.p2align	4, 0x90
_dib0700_download_firmware:             ## @dib0700_download_firmware
	.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	$1144, %rsp                     ## imm = 0x478
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	$0, -1156(%rbp)
	leaq	-1152(%rbp), %rbx
	leaq	-1180(%rbp), %r12
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	leaq	-1176(%rbp), %rsi
	leaq	-1156(%rbp), %rdx
	callq	_dvb_usb_get_hexline
	testl	%eax, %eax
	jle	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	-1176(%rbp), %esi
	movl	-1172(%rbp), %edx
	movl	-1168(%rbp), %ecx
	leaq	L_.str(%rip), %rdi
	callq	_deb_fwdata
	movl	-1176(%rbp), %eax
	movl	-1172(%rbp), %edx
	movl	%edx, -1152(%rbp)
	movzbl	%ah, %ecx
	movl	%ecx, -1148(%rbp)
	movzbl	%al, %eax
	movl	%eax, -1144(%rbp)
	movl	-1164(%rbp), %eax
	movl	%eax, -1140(%rbp)
	movl	-1160(%rbp), %esi
	leaq	-1136(%rbp), %rdi
	callq	_memcpy
	movl	-1168(%rbp), %eax
	movslq	-1172(%rbp), %rcx
	movl	%eax, -1136(%rbp,%rcx,4)
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_usb_sndbulkpipe
	movl	-1172(%rbp), %ecx
	addl	$5, %ecx
	movq	%r14, %rdi
	movl	%eax, %esi
	movq	%rbx, %rdx
	movq	%r12, %r8
	movl	$1000, %r9d                     ## imm = 0x3E8
	callq	_usb_bulk_msg
	testl	%eax, %eax
	jns	LBB0_1
## %bb.3:
	movl	%eax, %r13d
	movl	-1156(%rbp), %esi
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %edx
	callq	_err
	jmp	LBB0_22
LBB0_4:
	je	LBB0_5
## %bb.7:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_8
LBB0_5:
	movq	%r14, %rdi
	movl	$1879048192, %esi               ## imm = 0x70000000
	callq	_dib0700_jumpram
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.6:
	leaq	L_.str.2(%rip), %rdi
	callq	_info
	movl	$500, %edi                      ## imm = 0x1F4
	callq	_msleep
	xorl	%r13d, %r13d
LBB0_8:
	movq	_nb_packet_buffer_size@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	jg	LBB0_10
## %bb.9:
	movl	$1, (%r15)
LBB0_10:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_usb_rcvctrlpipe
	movq	_REQUEST_GET_VERSION@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_USB_TYPE_VENDOR@GOTPCREL(%rip), %rsi
	movq	_USB_DIR_IN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rsi), %ecx
	movq	_USB_CTRL_GET_TIMEOUT@GOTPCREL(%rip), %rsi
	movl	(%rsi), %ebx
	subq	$8, %rsp
	leaq	-112(%rbp), %r10
	movq	%r14, %rdi
	movl	%eax, %esi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	%rbx
	pushq	$64
	pushq	%r10
	callq	_usb_control_msg
	addq	$32, %rsp
	movq	_dib0700_device_count@GOTPCREL(%rip), %r8
	movl	(%r8), %r9d
	testl	%r9d, %r9d
	jle	LBB0_22
## %bb.11:
	movl	-80(%rbp), %eax
	movl	-76(%rbp), %ecx
	shll	$16, %ecx
	shll	$24, %eax
	orl	%ecx, %eax
	movl	-72(%rbp), %ecx
	shll	$8, %ecx
	orl	%eax, %ecx
	orl	-68(%rbp), %ecx
	movq	_dib0700_devices@GOTPCREL(%rip), %r10
	movq	(%r10), %rdi
	xorl	%r11d, %r11d
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_12 Depth=1
	movl	(%r8), %r9d
LBB0_21:                                ##   in Loop: Header=BB0_12 Depth=1
	incq	%r11
	movslq	%r9d, %rax
	cmpq	%rax, %r11
	jge	LBB0_22
LBB0_12:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_14 Depth 2
	movq	%r11, %rsi
	shlq	$4, %rsi
	cmpl	$0, (%rdi,%rsi)
	jle	LBB0_21
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	xorl	%edx, %edx
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_14 Depth=2
	movq	8(%rdi,%rsi), %rax
	movl	%ebx, (%rax,%rdx,4)
	movq	(%r10), %rdi
LBB0_19:                                ##   in Loop: Header=BB0_14 Depth=2
	incq	%rdx
	movslq	(%rdi,%rsi), %rax
	cmpq	%rax, %rdx
	jge	LBB0_20
LBB0_14:                                ##   Parent Loop BB0_12 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	imull	$188, (%r15), %ebx
	cmpl	$66049, %ecx                    ## imm = 0x10201
	jl	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=2
	movq	8(%rdi,%rsi), %rax
	movl	%ebx, (%rax,%rdx,4)
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_14 Depth=2
	leal	94(%rbx), %eax
	addl	$605, %ebx                      ## imm = 0x25D
	testl	%eax, %eax
	cmovnsl	%eax, %ebx
	andl	$-512, %ebx                     ## imm = 0xFE00
	cmpl	$513, %ebx                      ## imm = 0x201
	jge	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_14 Depth=2
	movl	$512, %ebx                      ## imm = 0x200
	jmp	LBB0_18
LBB0_22:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_24
## %bb.23:
	movl	%r13d, %eax
	addq	$1144, %rsp                     ## imm = 0x478
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"writing to address 0x%08x (buffer: 0x%02x %02x)\n"

L_.str.1:                               ## @.str.1
	.asciz	"firmware download failed at %d with %d"

L_.str.2:                               ## @.str.2
	.asciz	"firmware started successfully."

	.comm	_EIO,4,2                        ## @EIO
	.comm	_nb_packet_buffer_size,4,2      ## @nb_packet_buffer_size
	.comm	_REQUEST_GET_VERSION,4,2        ## @REQUEST_GET_VERSION
	.comm	_USB_TYPE_VENDOR,4,2            ## @USB_TYPE_VENDOR
	.comm	_USB_DIR_IN,4,2                 ## @USB_DIR_IN
	.comm	_USB_CTRL_GET_TIMEOUT,4,2       ## @USB_CTRL_GET_TIMEOUT
	.comm	_dib0700_device_count,4,2       ## @dib0700_device_count
	.comm	_dib0700_devices,8,3            ## @dib0700_devices
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dib0700_download_firmware      ; -- Begin function dib0700_download_firmware
	.p2align	2
_dib0700_download_firmware:             ; @dib0700_download_firmware
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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 w27, -72
	.cfi_offset w28, -80
	sub	sp, sp, #1152
	mov	x21, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	str	wzr, [sp, #12]
	add	x24, sp, #40
	add	x22, x24, #16
Lloh3:
	adrp	x23, l_.str@PAGE
Lloh4:
	add	x23, x23, l_.str@PAGEOFF
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	add	x1, sp, #16
	add	x2, sp, #12
	mov	x0, x21
	bl	_dvb_usb_get_hexline
	cmp	w0, #1
	b.lt	LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldp	w1, w2, [sp, #16]
	ldr	w3, [sp, #24]
	mov	x0, x23
	bl	_deb_fwdata
	ldp	w8, w2, [sp, #16]
	ubfx	w9, w8, #8, #8
	stp	w2, w9, [sp, #40]
	and	w8, w8, #0xff
	ldp	w9, w1, [sp, #28]
	stp	w8, w9, [sp, #48]
	mov	x0, x22
	bl	_memcpy
	ldp	w9, w8, [sp, #20]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	add	x9, x24, x9, lsl #2
	str	w8, [x9, #16]
	mov	x0, x20
	mov	w1, #1
	bl	_usb_sndbulkpipe
	mov	x1, x0
	ldr	w8, [sp, #20]
	add	w3, w8, #5
	add	x2, sp, #40
	add	x4, sp, #8
	mov	x0, x20
	mov	w5, #1000
	bl	_usb_bulk_msg
	tbz	w0, #31, LBB0_1
; %bb.3:
	mov	x19, x0
	ldr	w1, [sp, #12]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_err
	b	LBB0_20
LBB0_4:
	cbz	w0, LBB0_6
; %bb.5:
Lloh7:
	adrp	x8, _EIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w19, w8
	b	LBB0_8
LBB0_6:
	mov	x0, x20
	mov	w1, #1879048192
	bl	_dib0700_jumpram
	mov	x19, x0
	cbnz	w0, LBB0_8
; %bb.7:
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_info
	mov	w0, #500
	bl	_msleep
LBB0_8:
Lloh12:
	adrp	x21, _nb_packet_buffer_size@GOTPAGE
Lloh13:
	ldr	x21, [x21, _nb_packet_buffer_size@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #0
	b.gt	LBB0_10
; %bb.9:
	mov	w8, #1
	str	w8, [x21]
LBB0_10:
	mov	x0, x20
	mov	w1, #0
	bl	_usb_rcvctrlpipe
	mov	x1, x0
Lloh14:
	adrp	x8, _REQUEST_GET_VERSION@GOTPAGE
Lloh15:
	ldr	x8, [x8, _REQUEST_GET_VERSION@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
Lloh17:
	adrp	x8, _USB_TYPE_VENDOR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _USB_TYPE_VENDOR@GOTPAGEOFF]
Lloh19:
	adrp	x9, _USB_DIR_IN@GOTPAGE
Lloh20:
	ldr	x9, [x9, _USB_DIR_IN@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	ldr	w9, [x9]
	orr	w3, w9, w8
Lloh23:
	adrp	x8, _USB_CTRL_GET_TIMEOUT@GOTPAGE
Lloh24:
	ldr	x8, [x8, _USB_CTRL_GET_TIMEOUT@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	str	w8, [sp]
	sub	x6, x29, #136
	mov	x0, x20
	mov	w4, #0
	mov	w5, #0
	mov	w7, #64
	bl	_usb_control_msg
Lloh26:
	adrp	x8, _dib0700_device_count@GOTPAGE
Lloh27:
	ldr	x8, [x8, _dib0700_device_count@GOTPAGEOFF]
	ldr	w16, [x8]
	cmp	w16, #1
	b.lt	LBB0_20
; %bb.11:
	mov	x9, #0
	ldp	w11, w10, [x29, #-104]
	lsl	w10, w10, #16
	orr	w10, w10, w11, lsl #24
	ldp	w11, w12, [x29, #-96]
	orr	w10, w10, w11, lsl #8
	orr	w10, w10, w12
Lloh28:
	adrp	x11, _dib0700_devices@GOTPAGE
Lloh29:
	ldr	x11, [x11, _dib0700_devices@GOTPAGEOFF]
	ldr	x14, [x11]
	mov	w12, #188
	mov	w13, #513
	movk	w13, #1, lsl #16
	mov	w15, #512
	b	LBB0_14
LBB0_12:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	w16, [x8]
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x9, x9, #1
	cmp	x9, w16, sxtw
	b.ge	LBB0_20
LBB0_14:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_18 Depth 2
	lsl	x17, x9, #4
	ldr	w0, [x14, x17]
	cmp	w0, #1
	b.lt	LBB0_13
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	x16, #0
	b	LBB0_18
LBB0_16:                                ;   in Loop: Header=BB0_18 Depth=2
	add	w1, w0, #94
	add	w0, w0, #605
	cmp	w1, #0
	csel	w0, w0, w1, lt
	and	w0, w0, #0xfffffe00
	add	x14, x14, x9, lsl #4
	ldr	x14, [x14, #8]
	cmp	w0, #512
	csel	w0, w0, w15, gt
	str	w0, [x14, x16, lsl #2]
	ldr	x14, [x11]
LBB0_17:                                ;   in Loop: Header=BB0_18 Depth=2
	add	x16, x16, #1
	ldrsw	x0, [x14, x17]
	cmp	x16, x0
	b.ge	LBB0_12
LBB0_18:                                ;   Parent Loop BB0_14 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x21]
	mul	w0, w0, w12
	cmp	w10, w13
	b.lt	LBB0_16
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=2
	add	x1, x14, x9, lsl #4
	ldr	x1, [x1, #8]
	str	w0, [x1, x16, lsl #2]
	b	LBB0_17
LBB0_20:
	ldur	x8, [x29, #-72]
Lloh30:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh31:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh32:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_22
; %bb.21:
	mov	x0, x19
	add	sp, sp, #1152
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_22:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh21
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"writing to address 0x%08x (buffer: 0x%02x %02x)\n"

l_.str.1:                               ; @.str.1
	.asciz	"firmware download failed at %d with %d"

l_.str.2:                               ; @.str.2
	.asciz	"firmware started successfully."

	.comm	_EIO,4,2                        ; @EIO
	.comm	_nb_packet_buffer_size,4,2      ; @nb_packet_buffer_size
	.comm	_REQUEST_GET_VERSION,4,2        ; @REQUEST_GET_VERSION
	.comm	_USB_TYPE_VENDOR,4,2            ; @USB_TYPE_VENDOR
	.comm	_USB_DIR_IN,4,2                 ; @USB_DIR_IN
	.comm	_USB_CTRL_GET_TIMEOUT,4,2       ; @USB_CTRL_GET_TIMEOUT
	.comm	_dib0700_device_count,4,2       ; @dib0700_device_count
	.comm	_dib0700_devices,8,3            ; @dib0700_devices
.subsections_via_symbols
