	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wpa_config_write               ## -- Begin function wpa_config_write
	.p2align	4, 0x90
_wpa_config_write:                      ## @wpa_config_write
	.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	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	callq	_os_strlen
	movl	%eax, %ebx
	addl	$5, %ebx
	movl	%ebx, %edi
	callq	_os_malloc
	movq	%rax, %r12
	movq	%r15, %r14
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdx
	movq	%r12, %rdi
	movl	%ebx, %esi
	movq	%r15, %rcx
	callq	_os_snprintf
	movq	%r12, %r14
LBB0_2:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	_MSG_DEBUG@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_wpa_printf
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r13
	movq	%rax, %rdi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_wpa_config_write_global
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_9
## %bb.5:
	leaq	L_.str.4(%rip), %r14
	leaq	L_.str.5(%rip), %r15
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_9
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%rbx)
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$8, %esi
	movl	$1, %edx
	movq	%r14, %rdi
	movq	%r13, %rcx
	callq	_fwrite
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_wpa_config_write_cred
	movl	$2, %esi
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r13, %rcx
	callq	_fwrite
	jmp	LBB0_8
LBB0_9:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_18
## %bb.10:
	movq	_WPA_KEY_MGMT_WPS@GOTPCREL(%rip), %r14
	leaq	L_.str.6(%rip), %r15
	jmp	LBB0_11
LBB0_16:                                ##   in Loop: Header=BB0_11 Depth=1
	movl	$11, %esi
	movl	$1, %edx
	movq	%r15, %rdi
	movq	%r13, %rcx
	callq	_fwrite
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_wpa_config_write_network
	movl	$2, %esi
	movl	$1, %edx
	leaq	L_.str.5(%rip), %rdi
	movq	%r13, %rcx
	callq	_fwrite
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	24(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_18
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rdi
	cmpq	(%r14), %rdi
	je	LBB0_17
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	cmpq	$0, 16(%rbx)
	jne	LBB0_17
## %bb.13:                              ##   in Loop: Header=BB0_11 Depth=1
	callq	_wpa_key_mgmt_wpa_psk
	testq	%rax, %rax
	je	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=1
	cmpl	$0, 12(%rbx)
	jne	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_11 Depth=1
	cmpl	$0, 8(%rbx)
	jne	LBB0_16
	jmp	LBB0_17
LBB0_18:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rbx
	xorl	%r15d, %r15d
	testq	%rbx, %rbx
	je	LBB0_23
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_wpa_config_write_blob
	testl	%eax, %eax
	jne	LBB0_22
## %bb.19:                              ##   in Loop: Header=BB0_21 Depth=1
	movq	(%rbx), %rbx
	testq	%rbx, %rbx
	jne	LBB0_21
	jmp	LBB0_23
LBB0_3:
	movl	(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_wpa_printf
	movq	%r12, %rdi
	callq	_os_free
	movl	$-1, %r15d
	jmp	LBB0_27
LBB0_22:
	movl	%eax, %r15d
LBB0_23:
	movq	%r13, %rdi
	callq	_os_fdatasync
	movq	%r13, %rdi
	callq	_fclose
	testq	%r12, %r12
	je	LBB0_24
## %bb.25:
	movq	%r12, %rdi
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_rename
	xorl	%ecx, %ecx
	negq	%rax
	sbbl	%ecx, %ecx
	orl	%ecx, %r15d
	movq	%r12, %rdi
	callq	_os_free
	jmp	LBB0_26
LBB0_24:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
LBB0_26:
	movq	_MSG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	testl	%r15d, %r15d
	leaq	L_.str.9(%rip), %rax
	leaq	L_.str.8(%rip), %rcx
	cmoveq	%rax, %rcx
	leaq	L_.str.7(%rip), %rsi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	_wpa_printf
LBB0_27:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s.tmp"

	.comm	_MSG_DEBUG,4,2                  ## @MSG_DEBUG
L_.str.1:                               ## @.str.1
	.asciz	"Writing configuration file '%s'"

L_.str.2:                               ## @.str.2
	.asciz	"w"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to open '%s' for writing"

L_.str.4:                               ## @.str.4
	.asciz	"\ncred={\n"

L_.str.5:                               ## @.str.5
	.asciz	"}\n"

	.comm	_WPA_KEY_MGMT_WPS,8,3           ## @WPA_KEY_MGMT_WPS
L_.str.6:                               ## @.str.6
	.asciz	"\nnetwork={\n"

L_.str.7:                               ## @.str.7
	.asciz	"Configuration file '%s' written %ssuccessfully"

L_.str.8:                               ## @.str.8
	.asciz	"un"

L_.str.9:                               ## @.str.9
	.space	1

	.comm	_S_IRGRP,4,2                    ## @S_IRGRP
	.comm	_S_IRUSR,4,2                    ## @S_IRUSR
	.comm	_S_IWGRP,4,2                    ## @S_IWGRP
	.comm	_S_IWUSR,4,2                    ## @S_IWUSR
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wpa_config_write               ; -- Begin function wpa_config_write
	.p2align	2
_wpa_config_write:                      ; @wpa_config_write
	.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	x21, x1
	mov	x19, x0
	bl	_os_strlen
	add	w22, w0, #5
	mov	x0, x22
	bl	_os_malloc
	mov	x20, x0
	mov	x23, x19
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x2, l_.str@PAGE
Lloh1:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	mov	x1, x22
	mov	x3, x19
	bl	_os_snprintf
	mov	x23, x20
LBB0_2:
Lloh2:
	adrp	x26, _MSG_DEBUG@GOTPAGE
Lloh3:
	ldr	x26, [x26, _MSG_DEBUG@GOTPAGEOFF]
	ldr	w0, [x26]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x23
	bl	_wpa_printf
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x23
	bl	_fopen
	cbz	x0, LBB0_21
; %bb.3:
	mov	x22, x0
	mov	x1, x21
	bl	_wpa_config_write_global
	ldr	x23, [x21, #16]
	cbz	x23, LBB0_8
; %bb.4:
Lloh8:
	adrp	x24, l_.str.4@PAGE
Lloh9:
	add	x24, x24, l_.str.4@PAGEOFF
Lloh10:
	adrp	x25, l_.str.5@PAGE
Lloh11:
	add	x25, x25, l_.str.5@PAGEOFF
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x23, [x23, #8]
	cbz	x23, LBB0_8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	cbnz	x8, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x24
	mov	w1, #8
	mov	w2, #1
	mov	x3, x22
	bl	_fwrite
	mov	x0, x22
	mov	x1, x23
	bl	_wpa_config_write_cred
	mov	x0, x25
	mov	w1, #2
	mov	w2, #1
	mov	x3, x22
	bl	_fwrite
	b	LBB0_5
LBB0_8:
	ldr	x23, [x21, #8]
	cbz	x23, LBB0_17
; %bb.9:
Lloh12:
	adrp	x27, _WPA_KEY_MGMT_WPS@GOTPAGE
Lloh13:
	ldr	x27, [x27, _WPA_KEY_MGMT_WPS@GOTPAGEOFF]
Lloh14:
	adrp	x24, l_.str.6@PAGE
Lloh15:
	add	x24, x24, l_.str.6@PAGEOFF
Lloh16:
	adrp	x25, l_.str.5@PAGE
Lloh17:
	add	x25, x25, l_.str.5@PAGEOFF
	b	LBB0_12
LBB0_10:                                ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x24
	mov	w1, #11
	mov	w2, #1
	mov	x3, x22
	bl	_fwrite
	mov	x0, x22
	mov	x1, x23
	bl	_wpa_config_write_network
	mov	x0, x25
	mov	w1, #2
	mov	w2, #1
	mov	x3, x22
	bl	_fwrite
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	ldr	x23, [x23, #24]
	cbz	x23, LBB0_17
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x23]
	ldr	x8, [x27]
	cmp	x0, x8
	b.eq	LBB0_11
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x8, [x23, #16]
	cbnz	x8, LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	bl	_wpa_key_mgmt_wpa_psk
	cbz	x0, LBB0_10
; %bb.15:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	w8, [x23, #12]
	cbnz	w8, LBB0_10
; %bb.16:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	w8, [x23, #8]
	cbnz	w8, LBB0_10
	b	LBB0_11
LBB0_17:
	ldr	x23, [x21]
	cbz	x23, LBB0_20
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	mov	x1, x23
	bl	_wpa_config_write_blob
	cbnz	w0, LBB0_22
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	ldr	x23, [x23]
	cbnz	x23, LBB0_18
LBB0_20:
	mov	w21, #0
	b	LBB0_23
LBB0_21:
	ldr	w0, [x26]
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x23
	bl	_wpa_printf
	mov	x0, x20
	bl	_os_free
	mov	w21, #-1
	b	LBB0_26
LBB0_22:
	mov	x21, x0
LBB0_23:
	mov	x0, x22
	bl	_os_fdatasync
	mov	x0, x22
	bl	_fclose
	cbz	x20, LBB0_25
; %bb.24:
	mov	x0, x20
	mov	x1, x19
	bl	_rename
	cmp	x0, #0
	csinv	w21, w21, wzr, eq
	mov	x0, x20
	bl	_os_free
LBB0_25:
	ldr	w0, [x26]
Lloh20:
	adrp	x8, l_.str.8@PAGE
Lloh21:
	add	x8, x8, l_.str.8@PAGEOFF
Lloh22:
	adrp	x9, l_.str.9@PAGE
Lloh23:
	add	x9, x9, l_.str.9@PAGEOFF
	cmp	w21, #0
	csel	x8, x9, x8, eq
	str	x8, [sp]
Lloh24:
	adrp	x1, l_.str.7@PAGE
Lloh25:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	x2, x19
	bl	_wpa_printf
LBB0_26:
	mov	x0, x21
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s.tmp"

	.comm	_MSG_DEBUG,4,2                  ; @MSG_DEBUG
l_.str.1:                               ; @.str.1
	.asciz	"Writing configuration file '%s'"

l_.str.2:                               ; @.str.2
	.asciz	"w"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to open '%s' for writing"

l_.str.4:                               ; @.str.4
	.asciz	"\ncred={\n"

l_.str.5:                               ; @.str.5
	.asciz	"}\n"

	.comm	_WPA_KEY_MGMT_WPS,8,3           ; @WPA_KEY_MGMT_WPS
l_.str.6:                               ; @.str.6
	.asciz	"\nnetwork={\n"

l_.str.7:                               ; @.str.7
	.asciz	"Configuration file '%s' written %ssuccessfully"

l_.str.8:                               ; @.str.8
	.asciz	"un"

l_.str.9:                               ; @.str.9
	.space	1

	.comm	_S_IRGRP,4,2                    ; @S_IRGRP
	.comm	_S_IRUSR,4,2                    ; @S_IRUSR
	.comm	_S_IWGRP,4,2                    ; @S_IWGRP
	.comm	_S_IWUSR,4,2                    ; @S_IWUSR
.subsections_via_symbols
