	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bfd_openw_with_cleanup
_bfd_openw_with_cleanup:                ## @bfd_openw_with_cleanup
	.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
	movb	(%rdx), %al
	cmpb	$97, %al
	je	LBB0_6
## %bb.1:
	cmpb	$119, %al
	jne	LBB0_7
## %bb.2:
	movq	%rdi, %r14
	callq	_bfd_openw
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_4
## %bb.3:
	xorl	%eax, %eax
	callq	_bfd_get_error
	movl	%eax, %edi
	callq	_bfd_errmsg
	leaq	L_.str(%rip), %rdi
	movq	%r14, %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_error
LBB0_4:
	movq	%rbx, %rdi
	callq	_make_cleanup_bfd_close
	movq	_bfd_object@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_bfd_set_format
	testl	%eax, %eax
	jne	LBB0_9
## %bb.5:
	xorl	%eax, %eax
	callq	_bfd_get_error
	movl	%eax, %edi
	callq	_bfd_errmsg
	leaq	L_.str.1(%rip), %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	_error
	jmp	LBB0_9
LBB0_6:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_error
	jmp	LBB0_8
LBB0_7:
	leaq	L_.str.3(%rip), %rdi
	movq	%rdx, %rsi
	xorl	%eax, %eax
	callq	_error
LBB0_8:
                                        ## implicit-def: $rbx
LBB0_9:
	movq	%rbx, %rax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to open %s: %s."

	.comm	_bfd_object,4,2                 ## @bfd_object
L_.str.1:                               ## @.str.1
	.asciz	"bfd_openw_with_cleanup: %s."

L_.str.2:                               ## @.str.2
	.asciz	"bfd_openw does not work with append."

L_.str.3:                               ## @.str.3
	.asciz	"bfd_openw_with_cleanup: unknown mode %s."

	.no_dead_strip	_bfd_openw_with_cleanup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bfd_openw_with_cleanup
_bfd_openw_with_cleanup:                ; @bfd_openw_with_cleanup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	ldrb	w8, [x2]
	cmp	w8, #97
	b.eq	LBB0_6
; %bb.1:
	cmp	w8, #119
	b.ne	LBB0_7
; %bb.2:
	mov	x20, x0
	bl	_bfd_openw
	mov	x19, x0
	cbnz	x0, LBB0_4
; %bb.3:
	bl	_bfd_get_error
	bl	_bfd_errmsg
	stp	x20, x0, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_error
LBB0_4:
	mov	x0, x19
	bl	_make_cleanup_bfd_close
Lloh2:
	adrp	x8, _bfd_object@GOTPAGE
Lloh3:
	ldr	x8, [x8, _bfd_object@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bfd_set_format
	cbnz	w0, LBB0_9
; %bb.5:
	bl	_bfd_get_error
	bl	_bfd_errmsg
	str	x0, [sp]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_error
	b	LBB0_9
LBB0_6:
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_8
LBB0_7:
	str	x2, [sp]
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_8:
	bl	_error
                                        ; implicit-def: $x19
LBB0_9:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to open %s: %s."

	.comm	_bfd_object,4,2                 ; @bfd_object
l_.str.1:                               ; @.str.1
	.asciz	"bfd_openw_with_cleanup: %s."

l_.str.2:                               ; @.str.2
	.asciz	"bfd_openw does not work with append."

l_.str.3:                               ; @.str.3
	.asciz	"bfd_openw_with_cleanup: unknown mode %s."

	.no_dead_strip	_bfd_openw_with_cleanup
.subsections_via_symbols
