	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TIFFWriteBufferSetup           ## -- Begin function TIFFWriteBufferSetup
	.p2align	4, 0x90
_TIFFWriteBufferSetup:                  ## @TIFFWriteBufferSetup
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	16(%rdi), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.1:
	movq	_TIFF_MYBUFFER@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	testl	%eax, (%rbx)
	je	LBB0_3
## %bb.2:
	callq	__TIFFfree
	movl	(%r12), %eax
	notl	%eax
	andl	%eax, (%rbx)
LBB0_3:
	movq	$0, 16(%rbx)
LBB0_4:
	cmpl	$-1, %r14d
	je	LBB0_5
## %bb.9:
	testq	%r15, %r15
	je	LBB0_10
## %bb.13:
	movq	_TIFF_MYBUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	(%rbx), %eax
	jmp	LBB0_14
LBB0_5:
	movq	%rbx, %rdi
	callq	_isTiled
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movl	4(%rbx), %eax
	jmp	LBB0_8
LBB0_7:
	movq	%rbx, %rdi
	callq	_TIFFStripSize
LBB0_8:
	cmpl	$8193, %eax                     ## imm = 0x2001
	movl	$8192, %r14d                    ## imm = 0x2000
	cmovgel	%eax, %r14d
LBB0_10:
	movl	%r14d, %edi
	callq	__TIFFmalloc
	testq	%rax, %rax
	je	LBB0_11
## %bb.12:
	movq	%rax, %r15
	movq	_TIFF_MYBUFFER@GOTPCREL(%rip), %rcx
	movl	(%rbx), %eax
	orl	(%rcx), %eax
LBB0_14:
	movl	%eax, (%rbx)
	movq	%r15, 16(%rbx)
	movl	%r14d, 8(%rbx)
	movq	$0, 32(%rbx)
	movq	%r15, 24(%rbx)
	movq	_TIFF_BUFFERSETUP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%rbx)
	movl	$1, %eax
	jmp	LBB0_15
LBB0_11:
	movl	40(%rbx), %edi
	leaq	_TIFFWriteBufferSetup.module(%rip), %rsi
	leaq	L_.str(%rip), %rdx
	callq	_TIFFErrorExt
	xorl	%eax, %eax
LBB0_15:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @TIFFWriteBufferSetup.module
_TIFFWriteBufferSetup.module:
	.asciz	"TIFFWriteBufferSetup"

	.comm	_TIFF_MYBUFFER,4,2              ## @TIFF_MYBUFFER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No space for output buffer"

	.comm	_TIFF_BUFFERSETUP,4,2           ## @TIFF_BUFFERSETUP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TIFFWriteBufferSetup           ; -- Begin function TIFFWriteBufferSetup
	.p2align	2
_TIFFWriteBufferSetup:                  ; @TIFFWriteBufferSetup
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x0, [x0, #16]
Lloh0:
	adrp	x22, _TIFF_MYBUFFER@GOTPAGE
Lloh1:
	ldr	x22, [x22, _TIFF_MYBUFFER@GOTPAGEOFF]
	cbz	x0, LBB0_4
; %bb.1:
	ldr	w8, [x19]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_3
; %bb.2:
	bl	__TIFFfree
	ldr	w8, [x22]
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
LBB0_3:
	str	xzr, [x19, #16]
LBB0_4:
	cmn	w20, #1
	b.eq	LBB0_7
; %bb.5:
	cbz	x21, LBB0_11
; %bb.6:
	ldr	w8, [x22]
	ldr	w9, [x19]
	bic	w8, w9, w8
	b	LBB0_13
LBB0_7:
	mov	x0, x19
	bl	_isTiled
	cbz	x0, LBB0_9
; %bb.8:
	ldr	w0, [x19, #4]
	b	LBB0_10
LBB0_9:
	mov	x0, x19
	bl	_TIFFStripSize
LBB0_10:
	mov	w8, #8192
	cmp	w0, #2, lsl #12                 ; =8192
	csel	w20, w0, w8, gt
LBB0_11:
	mov	x0, x20
	bl	__TIFFmalloc
	cbz	x0, LBB0_14
; %bb.12:
	mov	x21, x0
	ldr	w8, [x22]
	ldr	w9, [x19]
	orr	w8, w9, w8
LBB0_13:
	str	w8, [x19]
	str	w20, [x19, #8]
	stp	x21, xzr, [x19, #24]
	str	x21, [x19, #16]
Lloh2:
	adrp	x9, _TIFF_BUFFERSETUP@GOTPAGE
Lloh3:
	ldr	x9, [x9, _TIFF_BUFFERSETUP@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x19]
	mov	w0, #1
	b	LBB0_15
LBB0_14:
	ldr	w0, [x19, #40]
Lloh5:
	adrp	x1, _TIFFWriteBufferSetup.module@PAGE
Lloh6:
	add	x1, x1, _TIFFWriteBufferSetup.module@PAGEOFF
Lloh7:
	adrp	x2, l_.str@PAGE
Lloh8:
	add	x2, x2, l_.str@PAGEOFF
	bl	_TIFFErrorExt
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
_TIFFWriteBufferSetup.module:           ; @TIFFWriteBufferSetup.module
	.asciz	"TIFFWriteBufferSetup"

	.comm	_TIFF_MYBUFFER,4,2              ; @TIFF_MYBUFFER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No space for output buffer"

	.comm	_TIFF_BUFFERSETUP,4,2           ; @TIFF_BUFFERSETUP
.subsections_via_symbols
