	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_save_mapping_settings          ## -- Begin function save_mapping_settings
	.p2align	4, 0x90
_save_mapping_settings:                 ## @save_mapping_settings
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	$0, -72(%rbp)
	movl	$12, -88(%rbp)
	leaq	-88(%rbp), %rsi
	callq	_IDirectInputDevice8_GetDeviceInfo
	leaq	16(%rbx), %rdi
	leaq	-72(%rbp), %rsi
	callq	_StringFromCLSID
	movq	_S_OK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.2:
	movl	-80(%rbp), %edi
	movq	-72(%rbp), %rdx
	movl	%r14d, %esi
	callq	_del_mapping_key
	movl	-80(%rbp), %edi
	movq	-72(%rbp), %rdx
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r14d, %esi
	callq	_get_mapping_key
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	cmpl	$0, (%rbx)
	jle	LBB0_10
## %bb.5:
	movl	$16, %r12d
	leaq	-84(%rbp), %r15
	xorl	%r13d, %r13d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	incq	%r13
	movslq	(%rbx), %rax
	addq	$24, %r12
	cmpq	%rax, %r13
	jge	LBB0_10
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%rbx), %rsi
	addq	%r12, %rsi
	movq	%r15, %rdi
	callq	_IsEqualGUID
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	8(%rbx), %rax
	movq	-16(%rax,%r12), %rcx
	movq	_DIAH_UNMAPPED@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	-4(%rax,%r12), %edx
	leaq	-57(%rbp), %r14
	movq	%r14, %rdi
	leaq	_save_mapping_settings.format(%rip), %rsi
	callq	_sprintfW
	movq	_REG_DWORD@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	8(%rbx), %rax
	leaq	(%rax,%r12), %r8
	addq	$-8, %r8
	movl	-64(%rbp), %edi                 ## 4-byte Reload
	movq	%r14, %rsi
	xorl	%edx, %edx
	movl	$4, %r9d
	callq	_RegSetValueExW
	jmp	LBB0_9
LBB0_1:
	movq	_DI_SETTINGSNOTSAVED@GOTPCREL(%rip), %rbx
	jmp	LBB0_12
LBB0_10:
	movl	-64(%rbp), %edi                 ## 4-byte Reload
	callq	_RegCloseKey
	movq	_DI_OK@GOTPCREL(%rip), %rbx
	jmp	LBB0_11
LBB0_3:
	movq	_DI_SETTINGSNOTSAVED@GOTPCREL(%rip), %rbx
LBB0_11:
	movq	-72(%rbp), %rdi
	callq	_CoTaskMemFree
LBB0_12:
	movl	(%rbx), %eax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_14
## %bb.13:
	addq	$56, %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	_S_OK,8,3                       ## @S_OK
	.comm	_DI_SETTINGSNOTSAVED,4,2        ## @DI_SETTINGSNOTSAVED
	.comm	_TRUE,4,2                       ## @TRUE
	.section	__TEXT,__const
_save_mapping_settings.format:          ## @save_mapping_settings.format
	.asciz	"%x"

	.comm	_DIAH_UNMAPPED,8,3              ## @DIAH_UNMAPPED
	.comm	_REG_DWORD,4,2                  ## @REG_DWORD
	.comm	_DI_OK,4,2                      ## @DI_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_save_mapping_settings          ; -- Begin function save_mapping_settings
	.p2align	2
_save_mapping_settings:                 ; @save_mapping_settings
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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, x2
	mov	x19, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	str	xzr, [sp, #16]
	mov	w8, #12
	str	w8, [sp]
	mov	x1, sp
	bl	_IDirectInputDevice8_GetDeviceInfo
	add	x0, x19, #16
	add	x1, sp, #16
	bl	_StringFromCLSID
Lloh3:
	adrp	x8, _S_OK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _S_OK@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_8
; %bb.1:
	ldr	w0, [sp, #8]
	ldr	x2, [sp, #16]
	mov	x1, x20
	bl	_del_mapping_key
	ldr	w0, [sp, #8]
	ldr	x2, [sp, #16]
Lloh6:
	adrp	x8, _TRUE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	x1, x20
	bl	_get_mapping_key
	cbz	w0, LBB0_10
; %bb.2:
	mov	x20, x0
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.3:
	mov	x23, #0
	mov	x24, #0
	mov	x8, sp
	orr	x21, x8, #0x4
Lloh9:
	adrp	x25, _DIAH_UNMAPPED@GOTPAGE
Lloh10:
	ldr	x25, [x25, _DIAH_UNMAPPED@GOTPAGEOFF]
Lloh11:
	adrp	x22, _save_mapping_settings.format@PAGE
Lloh12:
	add	x22, x22, _save_mapping_settings.format@PAGEOFF
Lloh13:
	adrp	x26, _REG_DWORD@GOTPAGE
Lloh14:
	ldr	x26, [x26, _REG_DWORD@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x24, x24, #1
	ldrsw	x8, [x19]
	add	x23, x23, #24
	cmp	x24, x8
	b.ge	LBB0_9
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	add	x8, x8, x23
	add	x1, x8, #16
	mov	x0, x21
	bl	_IsEqualGUID
	cbz	x0, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19, #8]
	ldr	x9, [x8, x23]
	ldr	x10, [x25]
	cmp	x9, x10
	b.eq	LBB0_4
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x8, x8, x23
	ldr	w2, [x8, #12]
	add	x0, sp, #31
	mov	x1, x22
	bl	_sprintfW
	ldr	w3, [x26]
	ldr	x8, [x19, #8]
	add	x8, x8, x23
	add	x4, x8, #8
	add	x1, sp, #31
	mov	x0, x20
	mov	w2, #0
	mov	w5, #4
	bl	_RegSetValueExW
	b	LBB0_4
LBB0_8:
Lloh15:
	adrp	x19, _DI_SETTINGSNOTSAVED@GOTPAGE
Lloh16:
	ldr	x19, [x19, _DI_SETTINGSNOTSAVED@GOTPAGEOFF]
	b	LBB0_12
LBB0_9:
	mov	x0, x20
	bl	_RegCloseKey
Lloh17:
	adrp	x19, _DI_OK@GOTPAGE
Lloh18:
	ldr	x19, [x19, _DI_OK@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:
Lloh19:
	adrp	x19, _DI_SETTINGSNOTSAVED@GOTPAGE
Lloh20:
	ldr	x19, [x19, _DI_SETTINGSNOTSAVED@GOTPAGEOFF]
LBB0_11:
	ldr	x0, [sp, #16]
	bl	_CoTaskMemFree
LBB0_12:
	ldr	w0, [x19]
	ldr	x8, [sp, #40]
Lloh21:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh22:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_S_OK,8,3                       ; @S_OK
	.comm	_DI_SETTINGSNOTSAVED,4,2        ; @DI_SETTINGSNOTSAVED
	.comm	_TRUE,4,2                       ; @TRUE
	.section	__TEXT,__const
_save_mapping_settings.format:          ; @save_mapping_settings.format
	.asciz	"%x"

	.comm	_DIAH_UNMAPPED,8,3              ; @DIAH_UNMAPPED
	.comm	_REG_DWORD,4,2                  ; @REG_DWORD
	.comm	_DI_OK,4,2                      ; @DI_OK
.subsections_via_symbols
