	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_elf_write_shdrs_and_ehdr       ## -- Begin function elf_write_shdrs_and_ehdr
	.p2align	4, 0x90
_elf_write_shdrs_and_ehdr:              ## @elf_write_shdrs_and_ehdr
	.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
	movq	%rdi, %rbx
	callq	_elf_elfheader
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_elf_elfsections
	movq	%rax, %r15
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_elf_swap_ehdr_out
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_bfd_seek
	movq	_FALSE@GOTPCREL(%rip), %r12
	testq	%rax, %rax
	jne	LBB0_14
## %bb.1:
	leaq	-48(%rbp), %rdi
	movl	$4, %esi
	movq	%rbx, %rdx
	callq	_bfd_bwrite
	cmpl	$4, %eax
	jne	LBB0_14
## %bb.2:
	movl	(%r14), %r13d
	movq	_SHN_LORESERVE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %eax
	cmpl	%eax, %r13d
	jl	LBB0_4
## %bb.3:
	movq	(%r15), %rax
	movl	%r13d, (%rax)
	movl	(%rcx), %eax
LBB0_4:
	movl	4(%r14), %ecx
	cmpl	%eax, %ecx
	jl	LBB0_6
## %bb.5:
	movq	(%r15), %rax
	movl	%ecx, 4(%rax)
LBB0_6:
	shll	$2, %r13d
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_bfd_alloc
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_14
## %bb.7:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	cmpl	$0, (%r14)
	movq	_SHN_LORESERVE@GOTPCREL(%rip), %rsi
	je	LBB0_10
## %bb.8:
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	xorl	%r12d, %r12d
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rsi, %r14
	movq	(%r15), %rsi
	movq	%rbx, %rdi
	movq	%r13, %rdx
	callq	_elf_swap_shdr_out
	movq	%r14, %rsi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movl	(%rsi), %eax
	leal	-1(%rax), %ecx
	movq	_SHN_HIRESERVE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	subl	%eax, %edx
	incl	%edx
	cmpq	%rcx, %r12
	movslq	%edx, %rax
	movl	$0, %ecx
	cmovneq	%rcx, %rax
	leaq	(%r15,%rax,8), %r15
	addq	$8, %r15
	incq	%r12
	movl	(%r14), %eax
	addq	$4, %r13
	cmpq	%rax, %r12
	jb	LBB0_9
LBB0_10:
	movl	8(%r14), %esi
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_bfd_seek
	testq	%rax, %rax
	movq	_FALSE@GOTPCREL(%rip), %r12
	jne	LBB0_14
## %bb.11:
	movq	%rbx, %rdx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_bfd_bwrite
	cmpl	%ebx, %eax
	jne	LBB0_12
## %bb.13:
	movq	_TRUE@GOTPCREL(%rip), %r12
	jmp	LBB0_14
LBB0_12:
	movq	_FALSE@GOTPCREL(%rip), %r12
LBB0_14:
	movl	(%r12), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_SHN_LORESERVE,4,2              ## @SHN_LORESERVE
	.comm	_SHN_HIRESERVE,4,2              ## @SHN_HIRESERVE
	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_elf_write_shdrs_and_ehdr       ; -- Begin function elf_write_shdrs_and_ehdr
	.p2align	2
_elf_write_shdrs_and_ehdr:              ; @elf_write_shdrs_and_ehdr
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	bl	_elf_elfheader
	mov	x20, x0
	mov	x0, x19
	bl	_elf_elfsections
	mov	x21, x0
	add	x2, sp, #12
	mov	x0, x19
	mov	x1, x20
	bl	_elf_swap_ehdr_out
Lloh0:
	adrp	x25, _SEEK_SET@GOTPAGE
Lloh1:
	ldr	x25, [x25, _SEEK_SET@GOTPAGEOFF]
	ldr	w2, [x25]
	mov	x0, x19
	mov	w1, #0
	bl	_bfd_seek
	cbnz	x0, LBB0_12
; %bb.1:
	add	x0, sp, #12
	mov	w1, #4
	mov	x2, x19
	bl	_bfd_bwrite
	cmp	w0, #4
	b.ne	LBB0_12
; %bb.2:
	ldr	w8, [x20]
Lloh2:
	adrp	x26, _SHN_LORESERVE@GOTPAGE
Lloh3:
	ldr	x26, [x26, _SHN_LORESERVE@GOTPAGEOFF]
	ldr	w9, [x26]
	cmp	w8, w9
	b.lt	LBB0_4
; %bb.3:
	ldr	x9, [x21]
	str	w8, [x9]
	ldr	w9, [x26]
LBB0_4:
	ldr	w10, [x20, #4]
	cmp	w10, w9
	b.lt	LBB0_6
; %bb.5:
	ldr	x9, [x21]
	str	w10, [x9, #4]
LBB0_6:
	lsl	w22, w8, #2
	mov	x0, x19
	mov	x1, x22
	bl	_bfd_alloc
	cbz	x0, LBB0_12
; %bb.7:
	mov	x23, x0
	ldr	w8, [x20]
	cbz	w8, LBB0_10
; %bb.8:
	mov	x27, #0
Lloh4:
	adrp	x28, _SHN_HIRESERVE@GOTPAGE
Lloh5:
	ldr	x28, [x28, _SHN_HIRESERVE@GOTPAGEOFF]
	mov	x24, x23
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x21]
	mov	x0, x19
	mov	x2, x24
	bl	_elf_swap_shdr_out
	ldr	w8, [x26]
	sub	w9, w8, #1
	ldr	w10, [x28]
	sub	w8, w10, w8
	add	w8, w8, #1
	sxtw	x8, w8
	cmp	x27, x9
	csel	x8, x8, xzr, eq
	add	x8, x21, x8, lsl #3
	add	x21, x8, #8
	add	x27, x27, #1
	ldr	w8, [x20]
	add	x24, x24, #4
	cmp	x27, x8
	b.lo	LBB0_9
LBB0_10:
	ldr	w1, [x20, #8]
	ldr	w2, [x25]
	mov	x0, x19
	bl	_bfd_seek
Lloh6:
	adrp	x20, _FALSE@GOTPAGE
Lloh7:
	ldr	x20, [x20, _FALSE@GOTPAGEOFF]
	cbnz	x0, LBB0_13
; %bb.11:
	mov	x0, x23
	mov	x1, x22
	mov	x2, x19
	bl	_bfd_bwrite
Lloh8:
	adrp	x8, _TRUE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
	cmp	w0, w22
	csel	x20, x8, x20, eq
	b	LBB0_13
LBB0_12:
Lloh10:
	adrp	x20, _FALSE@GOTPAGE
Lloh11:
	ldr	x20, [x20, _FALSE@GOTPAGEOFF]
LBB0_13:
	ldr	w0, [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
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_SHN_LORESERVE,4,2              ; @SHN_LORESERVE
	.comm	_SHN_HIRESERVE,4,2              ; @SHN_HIRESERVE
	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
