	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_toast_build_flattened_tuple    ## -- Begin function toast_build_flattened_tuple
	.p2align	4, 0x90
_toast_build_flattened_tuple:           ## @toast_build_flattened_tuple
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r12
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	(%rdi), %r14d
	movq	_MaxTupleAttributeNumber@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	(,%rbx,4), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	%rbx, %rax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -64(%rbp)                 ## 8-byte Spill
	xorl	%edi, %edi
	cmpl	%ebx, %r14d
	movq	%r15, %rbx
	setle	%dil
	callq	_Assert
	leal	(,%r14,4), %edx
	movq	%r15, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_memcpy
	testl	%r14d, %r14d
	jle	LBB0_1
## %bb.2:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	movl	$0, -56(%rbp)                   ## 4-byte Folded Spill
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_3
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%rbx
	cmpq	%rbx, %r14
	je	LBB0_9
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$0, (%r12,%rbx,4)
	jne	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_TupleDescAttr
	cmpl	$-1, (%rax)
	jne	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r15,%rbx,4), %edi
	callq	_DatumGetPointer
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_VARATT_IS_EXTERNAL
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, %rdi
	callq	_detoast_external_attr
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_PointerGetDatum
	movl	%eax, (%r15,%rbx,4)
	movl	-56(%rbp), %ecx                 ## 4-byte Reload
	movslq	%ecx, %rax
	incl	%ecx
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	%r13, (%rcx,%rax,8)
	jmp	LBB0_7
LBB0_9:
	movq	%r13, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%r12, %rdx
	callq	_heap_form_tuple
	movl	%eax, %r14d
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	testl	%eax, %eax
	jle	LBB0_12
## %bb.10:
	movl	%eax, %r12d
	xorl	%ebx, %ebx
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r15,%rbx,8), %rdi
	callq	_pfree
	incq	%rbx
	cmpq	%rbx, %r12
	jne	LBB0_11
	jmp	LBB0_12
LBB0_1:
	movq	%r13, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_heap_form_tuple
	movl	%eax, %r14d
LBB0_12:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_14
## %bb.13:
	movl	%r14d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MaxTupleAttributeNumber,4,2    ## @MaxTupleAttributeNumber
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_toast_build_flattened_tuple    ; -- Begin function toast_build_flattened_tuple
	.p2align	2
_toast_build_flattened_tuple:           ; @toast_build_flattened_tuple
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	sub	sp, sp, #16
	mov	x19, x2
	mov	x22, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	ldr	w25, [x0]
Lloh3:
	adrp	x8, _MaxTupleAttributeNumber@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MaxTupleAttributeNumber@GOTPAGEOFF]
Lloh5:
	ldr	w12, [x8]
	lsl	x8, x12, #2
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x21, x9, x8
	mov	sp, x21
	lsl	x8, x12, #3
	mov	x9, x8
Lloh8:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh9:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x24, x9, x8
	mov	sp, x24
	cmp	w25, w12
	cset	w0, le
	bl	_Assert
	lsl	w2, w25, #2
	mov	x0, x21
	mov	x1, x22
	bl	_memcpy
	cmp	w25, #0
	b.le	LBB0_10
; %bb.1:
	mov	x22, #0
	mov	w26, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	cmp	x25, x22
	b.eq	LBB0_7
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x19, x22, lsl #2]
	cbnz	w8, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	mov	x1, x22
	bl	_TupleDescAttr
	ldr	w8, [x0]
	cmn	w8, #1
	b.ne	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x21, x22, lsl #2]
	bl	_DatumGetPointer
	mov	x23, x0
	bl	_VARATT_IS_EXTERNAL
	cbz	x0, LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x23
	bl	_detoast_external_attr
	mov	x23, x0
	bl	_PointerGetDatum
	str	w0, [x21, x22, lsl #2]
	str	x23, [x24, w26, sxtw #3]
	add	w26, w26, #1
	b	LBB0_2
LBB0_7:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_heap_form_tuple
	mov	x19, x0
	cmp	w26, #1
	b.lt	LBB0_11
; %bb.8:
	mov	w20, w26
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x24], #8
	bl	_pfree
	subs	x20, x20, #1
	b.ne	LBB0_9
	b	LBB0_11
LBB0_10:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_heap_form_tuple
	mov	x19, x0
LBB0_11:
	ldur	x8, [x29, #-72]
Lloh10:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh11:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.12:
	mov	x0, x19
	sub	sp, x29, #64
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_MaxTupleAttributeNumber,4,2    ; @MaxTupleAttributeNumber
.subsections_via_symbols
