	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openpam_borrow_cred            ## -- Begin function openpam_borrow_cred
	.p2align	4, 0x90
_openpam_borrow_cred:                   ## @openpam_borrow_cred
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	(%rsi), %rdi
	callq	_ENTERI
	movq	_PAM_SAVED_CRED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	callq	_pam_get_data
	movq	_PAM_SUCCESS@GOTPCREL(%rip), %r13
	cmpl	(%r13), %eax
	jne	LBB0_3
## %bb.1:
	cmpq	$0, -48(%rbp)
	je	LBB0_3
## %bb.2:
	movq	_PAM_LOG_LIBDEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_openpam_log
	movq	_PAM_SYSTEM_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RETURNC
LBB0_3:
	xorl	%eax, %eax
	callq	_geteuid
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	xorl	%eax, %eax
	callq	_geteuid
	cmpq	(%r15), %rax
	je	LBB0_6
## %bb.5:
	movq	_PAM_LOG_LIBDEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	xorl	%eax, %eax
	callq	_geteuid
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_openpam_log
	movq	_PAM_PERM_DENIED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RETURNC
LBB0_6:
	movl	$1, %edi
	movl	$24, %esi
	callq	_calloc
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:
	movq	_PAM_BUF_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RETURNC
LBB0_8:
	xorl	%eax, %eax
	callq	_geteuid
	movq	%rax, 16(%rbx)
	xorl	%eax, %eax
	callq	_getegid
	movl	%eax, 8(%rbx)
	movq	_NGROUPS_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%rbx), %esi
	callq	_getgroups
	movl	%eax, %r12d
	testl	%eax, %eax
	jns	LBB0_10
## %bb.9:
	movq	%rbx, %rdi
	callq	_FREE
	movq	_PAM_SYSTEM_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RETURNC
LBB0_10:
	movl	%r12d, (%rbx)
	movq	_PAM_SAVED_CRED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_openpam_free_data@GOTPCREL(%rip), %rcx
	movq	%r14, %rdi
	movq	%rbx, %rdx
	callq	_pam_set_data
	cmpl	(%r13), %eax
	je	LBB0_12
## %bb.11:
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_FREE
	movl	%r12d, %edi
	callq	_RETURNC
LBB0_12:
	xorl	%eax, %eax
	callq	_geteuid
	cmpq	(%r15), %rax
	jne	LBB0_14
## %bb.13:
	movl	(%r13), %edi
	callq	_RETURNC
LBB0_14:
	movl	8(%r15), %esi
	movl	12(%r15), %edi
	callq	_initgroups
	testq	%rax, %rax
	js	LBB0_17
## %bb.15:
	movl	8(%r15), %edi
	callq	_setegid
	testq	%rax, %rax
	js	LBB0_17
## %bb.16:
	movq	(%r15), %rdi
	callq	_seteuid
	testq	%rax, %rax
	jns	LBB0_18
LBB0_17:
	movq	%r14, %rdi
	callq	_openpam_restore_cred
	movq	_PAM_SYSTEM_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RETURNC
LBB0_18:
	movl	(%r13), %edi
	callq	_RETURNC
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAM_SAVED_CRED,4,2             ## @PAM_SAVED_CRED
	.comm	_PAM_SUCCESS,4,2                ## @PAM_SUCCESS
	.comm	_PAM_LOG_LIBDEBUG,4,2           ## @PAM_LOG_LIBDEBUG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"already operating under borrowed credentials"

	.comm	_PAM_SYSTEM_ERR,4,2             ## @PAM_SYSTEM_ERR
L_.str.1:                               ## @.str.1
	.asciz	"called with non-zero euid: %d"

	.comm	_PAM_PERM_DENIED,4,2            ## @PAM_PERM_DENIED
	.comm	_PAM_BUF_ERR,4,2                ## @PAM_BUF_ERR
	.comm	_NGROUPS_MAX,4,2                ## @NGROUPS_MAX
	.comm	_openpam_free_data,4,2          ## @openpam_free_data
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openpam_borrow_cred            ; -- Begin function openpam_borrow_cred
	.p2align	2
_openpam_borrow_cred:                   ; @openpam_borrow_cred
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x0, [x1]
	bl	_ENTERI
Lloh0:
	adrp	x25, _PAM_SAVED_CRED@GOTPAGE
Lloh1:
	ldr	x25, [x25, _PAM_SAVED_CRED@GOTPAGEOFF]
	ldr	w1, [x25]
	add	x2, sp, #8
	mov	x0, x19
	bl	_pam_get_data
Lloh2:
	adrp	x23, _PAM_SUCCESS@GOTPAGE
Lloh3:
	ldr	x23, [x23, _PAM_SUCCESS@GOTPAGEOFF]
	ldr	w8, [x23]
	ldr	x9, [sp, #8]
	cmp	w0, w8
	ccmp	x9, #0, #4, eq
Lloh4:
	adrp	x24, _PAM_SYSTEM_ERR@GOTPAGE
Lloh5:
	ldr	x24, [x24, _PAM_SYSTEM_ERR@GOTPAGEOFF]
	b.eq	LBB0_2
; %bb.1:
Lloh6:
	adrp	x8, _PAM_LOG_LIBDEBUG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PAM_LOG_LIBDEBUG@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_openpam_log
	ldr	w0, [x24]
	bl	_RETURNC
LBB0_2:
	bl	_geteuid
	cbz	x0, LBB0_5
; %bb.3:
	bl	_geteuid
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_5
; %bb.4:
Lloh11:
	adrp	x8, _PAM_LOG_LIBDEBUG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PAM_LOG_LIBDEBUG@GOTPAGEOFF]
Lloh13:
	ldr	w21, [x8]
	bl	_geteuid
	str	x0, [sp]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_openpam_log
Lloh16:
	adrp	x8, _PAM_PERM_DENIED@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PAM_PERM_DENIED@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	bl	_RETURNC
LBB0_5:
	mov	w0, #1
	mov	w1, #24
	bl	_calloc
	mov	x21, x0
	cbnz	x0, LBB0_7
; %bb.6:
Lloh19:
	adrp	x8, _PAM_BUF_ERR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _PAM_BUF_ERR@GOTPAGEOFF]
Lloh21:
	ldr	w0, [x8]
	bl	_RETURNC
LBB0_7:
	bl	_geteuid
	str	x0, [x21, #16]
	bl	_getegid
	str	w0, [x21, #8]
Lloh22:
	adrp	x8, _NGROUPS_MAX@GOTPAGE
Lloh23:
	ldr	x8, [x8, _NGROUPS_MAX@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	ldr	w1, [x21, #4]
	bl	_getgroups
	mov	x22, x0
	tbz	w0, #31, LBB0_9
; %bb.8:
	mov	x0, x21
	bl	_FREE
	ldr	w0, [x24]
	bl	_RETURNC
LBB0_9:
	str	w22, [x21]
	ldr	w1, [x25]
Lloh25:
	adrp	x3, _openpam_free_data@GOTPAGE
Lloh26:
	ldr	x3, [x3, _openpam_free_data@GOTPAGEOFF]
	mov	x0, x19
	mov	x2, x21
	bl	_pam_set_data
	ldr	w8, [x23]
	cmp	w0, w8
	b.eq	LBB0_11
; %bb.10:
	mov	x22, x0
	mov	x0, x21
	bl	_FREE
	mov	x0, x22
	bl	_RETURNC
LBB0_11:
	bl	_geteuid
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_13
; %bb.12:
	ldr	w0, [x23]
	bl	_RETURNC
LBB0_13:
	ldp	w1, w0, [x20, #8]
	bl	_initgroups
	tbnz	x0, #63, LBB0_16
; %bb.14:
	ldr	w0, [x20, #8]
	bl	_setegid
	tbnz	x0, #63, LBB0_16
; %bb.15:
	ldr	x0, [x20]
	bl	_seteuid
	tbz	x0, #63, LBB0_17
LBB0_16:
	mov	x0, x19
	bl	_openpam_restore_cred
	ldr	w0, [x24]
	bl	_RETURNC
LBB0_17:
	ldr	w0, [x23]
	bl	_RETURNC
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_PAM_SAVED_CRED,4,2             ; @PAM_SAVED_CRED
	.comm	_PAM_SUCCESS,4,2                ; @PAM_SUCCESS
	.comm	_PAM_LOG_LIBDEBUG,4,2           ; @PAM_LOG_LIBDEBUG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"already operating under borrowed credentials"

	.comm	_PAM_SYSTEM_ERR,4,2             ; @PAM_SYSTEM_ERR
l_.str.1:                               ; @.str.1
	.asciz	"called with non-zero euid: %d"

	.comm	_PAM_PERM_DENIED,4,2            ; @PAM_PERM_DENIED
	.comm	_PAM_BUF_ERR,4,2                ; @PAM_BUF_ERR
	.comm	_NGROUPS_MAX,4,2                ; @NGROUPS_MAX
	.comm	_openpam_free_data,4,2          ; @openpam_free_data
.subsections_via_symbols
