	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bdm_update_flash_command
_bdm_update_flash_command:              ## @bdm_update_flash_command
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r12
	movq	_ocd_desc@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	testq	%r12, %r12
	je	LBB0_3
LBB0_4:
	movq	_OCD_ENTER_MON@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-52(%rbp), %rbx
	leaq	-48(%rbp), %r14
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_ocd_do_command
	movq	_OCD_ERASE_FLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_ocd_do_command
	movq	_OCD_PROGRAM_FLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_write_mem_command@GOTPCREL(%rip), %r13
	movl	%eax, (%r13)
	movq	_current_target@GOTPCREL(%rip), %r14
	movq	(%r14), %r15
	movq	_noop_store_registers@GOTPCREL(%rip), %rax
	movq	%rax, (%r14)
	movq	%r12, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_generic_load
	movq	%r15, (%r14)
	movq	_OCD_WRITE_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r13)
	movq	_OCD_EXIT_MON@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	leaq	-48(%rbp), %rdx
	callq	_ocd_do_command
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_error
	testq	%r12, %r12
	jne	LBB0_4
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	callq	_error
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_ocd_desc,4,2                   ## @ocd_desc
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Not connected to OCD device."

L_.str.1:                               ## @.str.1
	.asciz	"Must specify file containing new OCD code."

	.comm	_OCD_ENTER_MON,4,2              ## @OCD_ENTER_MON
	.comm	_OCD_ERASE_FLASH,4,2            ## @OCD_ERASE_FLASH
	.comm	_OCD_PROGRAM_FLASH,4,2          ## @OCD_PROGRAM_FLASH
	.comm	_write_mem_command,4,2          ## @write_mem_command
	.comm	_current_target,8,3             ## @current_target
	.comm	_OCD_WRITE_MEM,4,2              ## @OCD_WRITE_MEM
	.comm	_OCD_EXIT_MON,4,2               ## @OCD_EXIT_MON
	.no_dead_strip	_bdm_update_flash_command
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bdm_update_flash_command
_bdm_update_flash_command:              ; @bdm_update_flash_command
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _ocd_desc@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ocd_desc@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbz	w8, LBB0_3
; %bb.1:
	cbz	x20, LBB0_4
LBB0_2:
Lloh3:
	adrp	x8, _OCD_ENTER_MON@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OCD_ENTER_MON@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	add	x1, sp, #12
	add	x2, sp, #8
	bl	_ocd_do_command
Lloh6:
	adrp	x8, _OCD_ERASE_FLASH@GOTPAGE
Lloh7:
	ldr	x8, [x8, _OCD_ERASE_FLASH@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	add	x1, sp, #12
	add	x2, sp, #8
	bl	_ocd_do_command
Lloh9:
	adrp	x8, _OCD_PROGRAM_FLASH@GOTPAGE
Lloh10:
	ldr	x8, [x8, _OCD_PROGRAM_FLASH@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x21, _write_mem_command@GOTPAGE
Lloh13:
	ldr	x21, [x21, _write_mem_command@GOTPAGEOFF]
	str	w8, [x21]
Lloh14:
	adrp	x22, _current_target@GOTPAGE
Lloh15:
	ldr	x22, [x22, _current_target@GOTPAGEOFF]
	ldr	x23, [x22]
Lloh16:
	adrp	x8, _noop_store_registers@GOTPAGE
Lloh17:
	ldr	x8, [x8, _noop_store_registers@GOTPAGEOFF]
	str	x8, [x22]
	mov	x0, x20
	mov	x1, x19
	bl	_generic_load
Lloh18:
	adrp	x8, _OCD_WRITE_MEM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _OCD_WRITE_MEM@GOTPAGEOFF]
	str	x23, [x22]
Lloh20:
	ldr	w8, [x8]
	str	w8, [x21]
Lloh21:
	adrp	x8, _OCD_EXIT_MON@GOTPAGE
Lloh22:
	ldr	x8, [x8, _OCD_EXIT_MON@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	add	x1, sp, #12
	add	x2, sp, #8
	bl	_ocd_do_command
	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
	add	sp, sp, #80
	ret
LBB0_3:
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
	bl	_error
	cbnz	x20, LBB0_2
LBB0_4:
Lloh26:
	adrp	x0, l_.str.1@PAGE
Lloh27:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_error
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_ocd_desc,4,2                   ; @ocd_desc
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Not connected to OCD device."

l_.str.1:                               ; @.str.1
	.asciz	"Must specify file containing new OCD code."

	.comm	_OCD_ENTER_MON,4,2              ; @OCD_ENTER_MON
	.comm	_OCD_ERASE_FLASH,4,2            ; @OCD_ERASE_FLASH
	.comm	_OCD_PROGRAM_FLASH,4,2          ; @OCD_PROGRAM_FLASH
	.comm	_write_mem_command,4,2          ; @write_mem_command
	.comm	_current_target,8,3             ; @current_target
	.comm	_OCD_WRITE_MEM,4,2              ; @OCD_WRITE_MEM
	.comm	_OCD_EXIT_MON,4,2               ; @OCD_EXIT_MON
	.no_dead_strip	_bdm_update_flash_command
.subsections_via_symbols
