	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bin_to_res_menu                ## -- Begin function bin_to_res_menu
	.p2align	4, 0x90
_bin_to_res_menu:                       ## @bin_to_res_menu
	.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
	movl	%edx, %r13d
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movl	$16, %edi
	callq	_res_alloc
	movq	%rax, %r14
	movq	_RES_TYPE_MENU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	movl	$16, %edi
	callq	_res_alloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, (%r14)
	cmpl	$1, %r13d
	jg	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	__
	movl	%eax, %edi
	callq	_toosmall
LBB0_2:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$2, %edx
	callq	_windres_get_16
	cmpl	$1, %eax
	je	LBB0_7
## %bb.3:
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_12
## %bb.4:
	cmpl	$3, %r13d
	jg	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	callq	__
	movl	%eax, %edi
	callq	_toosmall
LBB0_6:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	$0, 8(%rbx)
	addq	$16, %r15
	addl	$-4, %r13d
	leaq	-60(%rbp), %rcx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	movl	%r13d, %edx
	callq	_bin_to_res_menuitems
	movl	%eax, (%rbx)
	jmp	LBB0_13
LBB0_7:
	cmpl	$7, %r13d
	jg	LBB0_9
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	callq	__
	movl	%eax, %edi
	callq	_toosmall
LBB0_9:
	leaq	16(%r15), %rsi
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movl	$4, %edx
	callq	_windres_get_32
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, 8(%rcx)
	addq	$8, %r15
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$2, %edx
	callq	_windres_get_16
	movl	%eax, %ebx
	leal	4(%rbx), %r12d
	cmpl	%r13d, %r12d
	jl	LBB0_11
## %bb.10:
	leaq	L_.str.2(%rip), %rdi
	callq	__
	movl	%eax, %edi
	callq	_toosmall
LBB0_11:
	movslq	%ebx, %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rsi
	subl	%r12d, %r13d
	leaq	-60(%rbp), %rcx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %edx
	callq	_bin_to_res_menuexitems
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	jmp	LBB0_13
LBB0_12:
	leaq	L_.str.3(%rip), %rdi
	callq	__
	movl	%eax, %edi
	movl	%r12d, %esi
	callq	_fatal
LBB0_13:
	movq	%r14, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RES_TYPE_MENU,4,2              ## @RES_TYPE_MENU
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"menu header"

L_.str.1:                               ## @.str.1
	.asciz	"menuex header"

L_.str.2:                               ## @.str.2
	.asciz	"menuex offset"

L_.str.3:                               ## @.str.3
	.asciz	"unsupported menu version %d"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bin_to_res_menu                ; -- Begin function bin_to_res_menu
	.p2align	2
_bin_to_res_menu:                       ; @bin_to_res_menu
	.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	x22, x2
	mov	x23, x1
	mov	x20, x0
	mov	w0, #16
	bl	_res_alloc
	mov	x19, x0
Lloh0:
	adrp	x8, _RES_TYPE_MENU@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RES_TYPE_MENU@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x0, #8]
	mov	w0, #16
	bl	_res_alloc
	mov	x21, x0
	str	x0, [x19]
	cmp	w22, #1
	b.gt	LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	__
	bl	_toosmall
LBB0_2:
	mov	x0, x20
	mov	x1, x23
	mov	w2, #2
	bl	_windres_get_16
	cmp	w0, #1
	b.eq	LBB0_7
; %bb.3:
	mov	x24, x0
	cbnz	w0, LBB0_12
; %bb.4:
	cmp	w22, #3
	b.gt	LBB0_6
; %bb.5:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	__
	bl	_toosmall
LBB0_6:
	str	xzr, [x21, #8]
	add	x1, x23, #16
	sub	w2, w22, #4
	add	x3, sp, #12
	mov	x0, x20
	bl	_bin_to_res_menuitems
	str	w0, [x21]
	b	LBB0_13
LBB0_7:
	cmp	w22, #7
	b.gt	LBB0_9
; %bb.8:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	__
	bl	_toosmall
LBB0_9:
	add	x24, x23, #16
	mov	x0, x20
	mov	x1, x24
	mov	w2, #4
	bl	_windres_get_32
	str	x0, [x21, #8]
	add	x1, x23, #8
	mov	x0, x20
	mov	w2, #2
	bl	_windres_get_16
	mov	x23, x0
	add	w25, w0, #4
	cmp	w25, w22
	b.lt	LBB0_11
; %bb.10:
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	__
	bl	_toosmall
LBB0_11:
	add	x1, x24, w23, sxtw #2
	sub	w2, w22, w25
	add	x3, sp, #12
	mov	x0, x20
	bl	_bin_to_res_menuexitems
	str	w0, [x21]
	b	LBB0_13
LBB0_12:
Lloh11:
	adrp	x0, l_.str.3@PAGE
Lloh12:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	__
	mov	x1, x24
	bl	_fatal
LBB0_13:
	mov	x0, x19
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_RES_TYPE_MENU,4,2              ; @RES_TYPE_MENU
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"menu header"

l_.str.1:                               ; @.str.1
	.asciz	"menuex header"

l_.str.2:                               ; @.str.2
	.asciz	"menuex offset"

l_.str.3:                               ; @.str.3
	.asciz	"unsupported menu version %d"

.subsections_via_symbols
