	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %r15
	movl	$0, -44(%rbp)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$260, %edi                      ## imm = 0x104
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_23
## %bb.1:
	movq	%rax, %r13
	movq	%rax, %rbx
	addq	$16, %rbx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	leaq	-64(%rbp), %rsi
	leaq	-44(%rbp), %rdx
	callq	_dvb_usb_get_hexline
	testl	%eax, %eax
	jle	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-64(%rbp), %esi
	movl	-60(%rbp), %edx
	movl	-56(%rbp), %ecx
	leaq	L_.str(%rip), %rdi
	callq	_deb_fwdata
	movl	-60(%rbp), %eax
	movl	%eax, (%r13)
	movl	-64(%rbp), %eax
	movzbl	%ah, %ecx
	movl	%ecx, 4(%r13)
	movzbl	%al, %eax
	movl	%eax, 8(%r13)
	movl	-52(%rbp), %eax
	movl	%eax, 12(%r13)
	movl	-60(%rbp), %edx
	movl	-48(%rbp), %esi
	movq	%rbx, %rdi
	callq	_memcpy
	movl	-56(%rbp), %eax
	movslq	-60(%rbp), %rcx
	movl	%eax, 16(%r13,%rcx,4)
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_usb_sndbulkpipe
	movl	-60(%rbp), %ecx
	addl	$5, %ecx
	movq	%r15, %rdi
	movl	%eax, %esi
	movq	%r13, %rdx
	leaq	-68(%rbp), %r8
	movl	$1000, %r9d                     ## imm = 0x3E8
	callq	_usb_bulk_msg
	testl	%eax, %eax
	jns	LBB0_2
## %bb.4:
	movl	%eax, %r14d
	movl	-44(%rbp), %esi
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %edx
	callq	_err
	jmp	LBB0_21
LBB0_23:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_22
LBB0_5:
	je	LBB0_6
## %bb.8:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_9
LBB0_6:
	movq	%r15, %rdi
	movl	$1879048192, %esi               ## imm = 0x70000000
	callq	_dib0700_jumpram
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_9
## %bb.7:
	leaq	L_.str.2(%rip), %rdi
	callq	_info
	movl	$500, %edi                      ## imm = 0x1F4
	callq	_msleep
	xorl	%r14d, %r14d
LBB0_9:
	movq	_nb_packet_buffer_size@GOTPCREL(%rip), %r12
	cmpl	$0, (%r12)
	jg	LBB0_11
## %bb.10:
	movl	$1, (%r12)
LBB0_11:
	movq	%r15, %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
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	%rbx
	pushq	$16
	pushq	%r13
	callq	_usb_control_msg
	addq	$32, %rsp
	movq	_dib0700_device_count@GOTPCREL(%rip), %r8
	movl	(%r8), %r9d
	testl	%r9d, %r9d
	jle	LBB0_21
## %bb.12:
	movl	32(%r13), %eax
	movl	36(%r13), %ecx
	shll	$16, %ecx
	shll	$24, %eax
	orl	%ecx, %eax
	movl	40(%r13), %ecx
	shll	$8, %ecx
	orl	%eax, %ecx
	orl	44(%r13), %ecx
	movq	_dib0700_devices@GOTPCREL(%rip), %r10
	movq	(%r10), %rax
	xorl	%r15d, %r15d
	movl	$512, %r11d                     ## imm = 0x200
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_13 Depth=1
	movl	(%r8), %r9d
LBB0_20:                                ##   in Loop: Header=BB0_13 Depth=1
	incq	%r15
	movslq	%r9d, %rdx
	cmpq	%rdx, %r15
	jge	LBB0_21
LBB0_13:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	movq	%r15, %rsi
	shlq	$4, %rsi
	cmpl	$0, (%rax,%rsi)
	jle	LBB0_20
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	xorl	%edi, %edi
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_15 Depth=2
	leal	94(%rbx), %edx
	addl	$605, %ebx                      ## imm = 0x25D
	testl	%edx, %edx
	cmovnsl	%edx, %ebx
	andl	$-512, %ebx                     ## imm = 0xFE00
	movq	8(%rax,%rsi), %rax
	movq	(%rax,%rdi,8), %rax
	cmpl	$513, %ebx                      ## imm = 0x201
	cmovll	%r11d, %ebx
	movl	%ebx, (%rax)
	movq	(%r10), %rax
LBB0_18:                                ##   in Loop: Header=BB0_15 Depth=2
	incq	%rdi
	movslq	(%rax,%rsi), %rdx
	cmpq	%rdx, %rdi
	jge	LBB0_19
LBB0_15:                                ##   Parent Loop BB0_13 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	imull	$188, (%r12), %ebx
	cmpl	$66049, %ecx                    ## imm = 0x10201
	jl	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=2
	movq	8(%rax,%rsi), %rdx
	movq	(%rdx,%rdi,8), %rdx
	movl	%ebx, (%rdx)
	jmp	LBB0_18
LBB0_21:
	movq	%r13, %rdi
	callq	_kfree
LBB0_22:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.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:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x22, x1
	mov	x21, x0
	str	wzr, [sp, #20]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #260
	bl	_kmalloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
	add	x23, x0, #16
Lloh3:
	adrp	x24, l_.str@PAGE
Lloh4:
	add	x24, x24, l_.str@PAGEOFF
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	add	x1, sp, #24
	add	x2, sp, #20
	mov	x0, x22
	bl	_dvb_usb_get_hexline
	cmp	w0, #1
	b.lt	LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldp	w1, w2, [sp, #24]
	ldr	w3, [sp, #32]
	mov	x0, x24
	bl	_deb_fwdata
	ldr	w8, [sp, #28]
	str	w8, [x19]
	ldr	w8, [sp, #24]
	ubfx	w9, w8, #8, #8
	and	w8, w8, #0xff
	stp	w9, w8, [x19, #4]
	ldr	w8, [sp, #36]
	ldr	w2, [sp, #28]
	str	w8, [x19, #12]
	ldr	w1, [sp, #40]
	mov	x0, x23
	bl	_memcpy
	ldp	w9, w8, [sp, #28]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	add	x9, x19, x9, lsl #2
	str	w8, [x9, #16]
	mov	x0, x21
	mov	w1, #1
	bl	_usb_sndbulkpipe
	mov	x1, x0
	ldr	w8, [sp, #28]
	add	w3, w8, #5
	add	x4, sp, #16
	mov	x0, x21
	mov	x2, x19
	mov	w5, #1000
	bl	_usb_bulk_msg
	tbz	w0, #31, LBB0_2
; %bb.4:
	mov	x20, x0
	ldr	w1, [sp, #20]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_err
	b	LBB0_22
LBB0_5:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_23
LBB0_6:
	cbz	w0, LBB0_8
; %bb.7:
Lloh10:
	adrp	x8, _EIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_10
LBB0_8:
	mov	x0, x21
	mov	w1, #1879048192
	bl	_dib0700_jumpram
	mov	x20, x0
	cbnz	w0, LBB0_10
; %bb.9:
Lloh13:
	adrp	x0, l_.str.2@PAGE
Lloh14:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_info
	mov	w0, #500
	bl	_msleep
LBB0_10:
Lloh15:
	adrp	x22, _nb_packet_buffer_size@GOTPAGE
Lloh16:
	ldr	x22, [x22, _nb_packet_buffer_size@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #0
	b.gt	LBB0_12
; %bb.11:
	mov	w8, #1
	str	w8, [x22]
LBB0_12:
	mov	x0, x21
	mov	w1, #0
	bl	_usb_rcvctrlpipe
	mov	x1, x0
Lloh17:
	adrp	x8, _REQUEST_GET_VERSION@GOTPAGE
Lloh18:
	ldr	x8, [x8, _REQUEST_GET_VERSION@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x8]
Lloh20:
	adrp	x8, _USB_TYPE_VENDOR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _USB_TYPE_VENDOR@GOTPAGEOFF]
Lloh22:
	adrp	x9, _USB_DIR_IN@GOTPAGE
Lloh23:
	ldr	x9, [x9, _USB_DIR_IN@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
Lloh25:
	ldr	w9, [x9]
	orr	w3, w9, w8
Lloh26:
	adrp	x8, _USB_CTRL_GET_TIMEOUT@GOTPAGE
Lloh27:
	ldr	x8, [x8, _USB_CTRL_GET_TIMEOUT@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	str	w8, [sp]
	mov	x0, x21
	mov	w4, #0
	mov	w5, #0
	mov	x6, x19
	mov	w7, #16
	bl	_usb_control_msg
Lloh29:
	adrp	x8, _dib0700_device_count@GOTPAGE
Lloh30:
	ldr	x8, [x8, _dib0700_device_count@GOTPAGEOFF]
	ldr	w16, [x8]
	cmp	w16, #1
	b.lt	LBB0_22
; %bb.13:
	mov	x9, #0
	ldp	w11, w10, [x19, #32]
	lsl	w10, w10, #16
	orr	w10, w10, w11, lsl #24
	ldp	w11, w12, [x19, #40]
	orr	w10, w10, w11, lsl #8
	orr	w10, w10, w12
Lloh31:
	adrp	x11, _dib0700_devices@GOTPAGE
Lloh32:
	ldr	x11, [x11, _dib0700_devices@GOTPAGEOFF]
	ldr	x15, [x11]
	mov	w12, #188
	mov	w13, #513
	movk	w13, #1, lsl #16
	mov	w14, #512
	b	LBB0_16
LBB0_14:                                ;   in Loop: Header=BB0_16 Depth=1
	ldr	w16, [x8]
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=1
	add	x9, x9, #1
	cmp	x9, w16, sxtw
	b.ge	LBB0_22
LBB0_16:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_20 Depth 2
	lsl	x17, x9, #4
	ldr	w0, [x15, x17]
	cmp	w0, #1
	b.lt	LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	mov	x16, #0
	b	LBB0_20
LBB0_18:                                ;   in Loop: Header=BB0_20 Depth=2
	add	w1, w0, #94
	add	w0, w0, #605
	cmp	w1, #0
	csel	w0, w0, w1, lt
	and	w0, w0, #0xfffffe00
	add	x15, x15, x9, lsl #4
	ldr	x15, [x15, #8]
	ldr	x15, [x15, x16, lsl #3]
	cmp	w0, #512
	csel	w0, w0, w14, gt
	str	w0, [x15]
	ldr	x15, [x11]
LBB0_19:                                ;   in Loop: Header=BB0_20 Depth=2
	add	x16, x16, #1
	ldrsw	x0, [x15, x17]
	cmp	x16, x0
	b.ge	LBB0_14
LBB0_20:                                ;   Parent Loop BB0_16 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x22]
	mul	w0, w0, w12
	cmp	w10, w13
	b.lt	LBB0_18
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=2
	add	x1, x15, x9, lsl #4
	ldr	x1, [x1, #8]
	ldr	x1, [x1, x16, lsl #3]
	str	w0, [x1]
	b	LBB0_19
LBB0_22:
	mov	x0, x19
	bl	_kfree
LBB0_23:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh24
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.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
