	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_res_file                 ## -- Begin function write_res_file
	.p2align	4, 0x90
_write_res_file:                        ## @write_res_file
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	_filename@GOTPCREL(%rip), %rax
	movq	%rdi, (%rax)
	xorl	%esi, %esi
	callq	_windres_open_as_binary
	movq	%rax, %r15
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rdi
	callq	_bfd_make_section
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	callq	_bfd_fatal
LBB0_2:
	movq	_SEC_HAS_CONTENTS@GOTPCREL(%rip), %rax
	movq	_SEC_ALLOC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_SEC_LOAD@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	_SEC_DATA@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_bfd_set_section_flags
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	callq	_bfd_fatal
LBB0_4:
	movq	%rbx, (%rbx)
	movq	_target_is_bigendian@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jne	LBB0_5
## %bb.6:
	movq	_WR_KIND_BFD_BIN_L@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	movq	_WR_KIND_BFD_BIN_B@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %ecx
	leaq	-40(%rbp), %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_set_windres_bfd
	movl	$-1, -36(%rbp)
	movl	$1, (%rsp)
	leaq	-36(%rbp), %r9
	xorl	%edi, %edi
	movl	$32, %esi
	movq	%r14, %rdx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_write_res_directory
	movq	%rax, %r12
	leaq	3(%rax), %rdx
	andq	$-4, %rdx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_bfd_set_section_size
	testl	%eax, %eax
	jne	LBB0_9
## %bb.8:
	leaq	L_.str.3(%rip), %rdi
	callq	_bfd_fatal
LBB0_9:
	movq	%r12, %rax
	andq	$3, %rax
	je	LBB0_11
## %bb.10:
	movl	$4, %ecx
	subl	%eax, %ecx
	leaq	_write_res_file.sign(%rip), %rsi
	leaq	-40(%rbp), %rdi
	movq	%r12, %rdx
	callq	_set_windres_bfd_content
LBB0_11:
	leaq	_write_res_file.sign(%rip), %rsi
	leaq	-40(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%edx, %edx
	movl	$128, %ecx
	callq	_set_windres_bfd_content
	movl	$-1, -36(%rbp)
	movl	$1, (%rsp)
	leaq	-36(%rbp), %r9
	movq	%rbx, %rdi
	movl	$32, %esi
	movq	%r14, %rdx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_write_res_directory
	cmpq	%rax, %r12
	je	LBB0_13
## %bb.12:
	leaq	L_.str.4(%rip), %rdi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_fatal
LBB0_13:
	movq	%r15, %rdi
	callq	_bfd_close
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @write_res_file.sign
_write_res_file.sign:
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	32                              ## 0x20
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	255                             ## 0xff
	.long	255                             ## 0xff
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	255                             ## 0xff
	.long	255                             ## 0xff
	.space	72

	.comm	_filename,8,3                   ## @filename
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	".data"

L_.str.1:                               ## @.str.1
	.asciz	"bfd_make_section"

	.comm	_SEC_HAS_CONTENTS,4,2           ## @SEC_HAS_CONTENTS
	.comm	_SEC_ALLOC,4,2                  ## @SEC_ALLOC
	.comm	_SEC_LOAD,4,2                   ## @SEC_LOAD
	.comm	_SEC_DATA,4,2                   ## @SEC_DATA
L_.str.2:                               ## @.str.2
	.asciz	"bfd_set_section_flags"

	.comm	_target_is_bigendian,8,3        ## @target_is_bigendian
	.comm	_WR_KIND_BFD_BIN_B,4,2          ## @WR_KIND_BFD_BIN_B
	.comm	_WR_KIND_BFD_BIN_L,4,2          ## @WR_KIND_BFD_BIN_L
L_.str.3:                               ## @.str.3
	.asciz	"bfd_set_section_size"

L_.str.4:                               ## @.str.4
	.asciz	"res write failed with different sizes (%lu/%lu)."

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_res_file                 ; -- Begin function write_res_file
	.p2align	2
_write_res_file:                        ; @write_res_file
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x1
Lloh0:
	adrp	x8, _filename@GOTPAGE
Lloh1:
	ldr	x8, [x8, _filename@GOTPAGEOFF]
Lloh2:
	str	x0, [x8]
	mov	w1, #0
	bl	_windres_open_as_binary
	mov	x19, x0
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_bfd_make_section
	mov	x21, x0
	cbnz	x0, LBB0_2
; %bb.1:
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_bfd_fatal
LBB0_2:
Lloh7:
	adrp	x8, _SEC_HAS_CONTENTS@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SEC_HAS_CONTENTS@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _SEC_ALLOC@GOTPAGE
Lloh11:
	ldr	x9, [x9, _SEC_ALLOC@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh13:
	adrp	x9, _SEC_LOAD@GOTPAGE
Lloh14:
	ldr	x9, [x9, _SEC_LOAD@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh16:
	adrp	x9, _SEC_DATA@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SEC_DATA@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	orr	w2, w8, w9
	mov	x0, x19
	mov	x1, x21
	bl	_bfd_set_section_flags
	cbnz	w0, LBB0_4
; %bb.3:
Lloh19:
	adrp	x0, l_.str.2@PAGE
Lloh20:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_bfd_fatal
LBB0_4:
	str	x21, [x21]
Lloh21:
	adrp	x8, _target_is_bigendian@GOTPAGE
Lloh22:
	ldr	x8, [x8, _target_is_bigendian@GOTPAGEOFF]
Lloh23:
	adrp	x9, _WR_KIND_BFD_BIN_B@GOTPAGE
Lloh24:
	ldr	x9, [x9, _WR_KIND_BFD_BIN_B@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
Lloh26:
	adrp	x10, _WR_KIND_BFD_BIN_L@GOTPAGE
Lloh27:
	ldr	x10, [x10, _WR_KIND_BFD_BIN_L@GOTPAGEOFF]
	cmp	x8, #0
	csel	x8, x10, x9, eq
	ldr	w3, [x8]
	add	x0, sp, #8
	mov	x1, x19
	mov	x2, x21
	bl	_set_windres_bfd
	mov	w8, #-1
	str	w8, [sp, #12]
	add	x5, sp, #12
	mov	x0, #0
	mov	w1, #32
	mov	x2, x20
	mov	x3, #0
	mov	x4, #0
	mov	w6, #1
	bl	_write_res_directory
	mov	x22, x0
	add	x8, x0, #3
	and	x2, x8, #0xfffffffffffffffc
	mov	x0, x19
	mov	x1, x21
	bl	_bfd_set_section_size
	cbz	w0, LBB0_10
; %bb.5:
	ands	x8, x22, #0x3
	b.eq	LBB0_7
LBB0_6:
	mov	w9, #4
	sub	w3, w9, w8
Lloh28:
	adrp	x1, _write_res_file.sign@PAGE
Lloh29:
	add	x1, x1, _write_res_file.sign@PAGEOFF
	add	x0, sp, #8
	mov	x2, x22
	bl	_set_windres_bfd_content
LBB0_7:
Lloh30:
	adrp	x1, _write_res_file.sign@PAGE
Lloh31:
	add	x1, x1, _write_res_file.sign@PAGEOFF
	add	x0, sp, #8
	mov	x2, #0
	mov	w3, #128
	bl	_set_windres_bfd_content
	mov	w8, #-1
	str	w8, [sp, #12]
	add	x0, sp, #8
	add	x5, sp, #12
	mov	w1, #32
	mov	x2, x20
	mov	x3, #0
	mov	x4, #0
	mov	w6, #1
	bl	_write_res_directory
	cmp	x22, x0
	b.eq	LBB0_9
; %bb.8:
	mov	x2, x0
Lloh32:
	adrp	x0, l_.str.4@PAGE
Lloh33:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x22
	bl	_fatal
LBB0_9:
	mov	x0, x19
	bl	_bfd_close
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_10:
Lloh34:
	adrp	x0, l_.str.3@PAGE
Lloh35:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_bfd_fatal
	ands	x8, x22, #0x3
	b.ne	LBB0_6
	b	LBB0_7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh25
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @write_res_file.sign
_write_res_file.sign:
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	32                              ; 0x20
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	255                             ; 0xff
	.long	255                             ; 0xff
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	255                             ; 0xff
	.long	255                             ; 0xff
	.space	72

	.comm	_filename,8,3                   ; @filename
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	".data"

l_.str.1:                               ; @.str.1
	.asciz	"bfd_make_section"

	.comm	_SEC_HAS_CONTENTS,4,2           ; @SEC_HAS_CONTENTS
	.comm	_SEC_ALLOC,4,2                  ; @SEC_ALLOC
	.comm	_SEC_LOAD,4,2                   ; @SEC_LOAD
	.comm	_SEC_DATA,4,2                   ; @SEC_DATA
l_.str.2:                               ; @.str.2
	.asciz	"bfd_set_section_flags"

	.comm	_target_is_bigendian,8,3        ; @target_is_bigendian
	.comm	_WR_KIND_BFD_BIN_B,4,2          ; @WR_KIND_BFD_BIN_B
	.comm	_WR_KIND_BFD_BIN_L,4,2          ; @WR_KIND_BFD_BIN_L
l_.str.3:                               ; @.str.3
	.asciz	"bfd_set_section_size"

l_.str.4:                               ; @.str.4
	.asciz	"res write failed with different sizes (%lu/%lu)."

.subsections_via_symbols
