	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openwad                        ## -- Begin function openwad
	.p2align	4, 0x90
_openwad:                               ## @openwad
	.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
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	movl	%eax, %r12d
	testl	%eax, %eax
	jns	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_derror
LBB0_2:
	leaq	-88(%rbp), %rsi
	movl	%r12d, %edi
	movl	$24, %edx
	callq	_read
	movl	-68(%rbp), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	$4, %edx
	callq	_strncmp
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	callq	_derror
LBB0_4:
	movl	-72(%rbp), %edi
	callq	_LONG
	movq	_numlumps@GOTPCREL(%rip), %rbx
	movl	%eax, (%rbx)
	movl	-76(%rbp), %edi
	callq	_LONG
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %eax
	movl	%eax, %r15d
	shll	$5, %r15d
	shll	$3, %eax
	leal	(%rax,%rax,2), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	%r15d, %edi
	callq	_malloc
	movq	_lumpinfo@GOTPCREL(%rip), %r14
	movq	%rax, (%r14)
	movslq	%r15d, %rbx
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	(%rax,%rbx), %r13
	movslq	-52(%rbp), %r15                 ## 4-byte Folded Reload
	subq	%r15, %r13
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r12d, %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_lseek
	movl	%r12d, %edi
	movq	%r13, %rsi
	movl	%r15d, %edx
	callq	_read
	movq	_numlumps@GOTPCREL(%rip), %rcx
	cmpl	$0, (%rcx)
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	jle	LBB0_7
## %bb.5:
	subq	%r15, %rbx
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rbx,%rax), %r15
	addq	$8, %r15
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movl	24(%rax,%rbx), %edi
	movl	(%r15), %esi
	movl	$8, %edx
	movq	%rcx, %r12
	callq	_strncpy
	movq	(%r14), %rax
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax,%rbx)
	movl	-4(%r15), %edi
	callq	_LONG
	movq	(%r14), %rcx
	movq	%rax, 16(%rcx,%rbx)
	movl	-8(%r15), %edi
	callq	_LONG
	movq	(%r14), %rcx
	movq	%rax, 8(%rcx,%rbx)
	movq	%r12, %rcx
	incq	%r13
	movslq	(%r12), %rax
	addq	$32, %rbx
	addq	$24, %r15
	cmpq	%rax, %r13
	jl	LBB0_6
LBB0_7:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not open wadfile"

L_.str.1:                               ## @.str.1
	.asciz	"IWAD"

L_.str.2:                               ## @.str.2
	.asciz	"wadfile has weirdo header"

	.comm	_numlumps,4,2                   ## @numlumps
	.comm	_lumpinfo,8,3                   ## @lumpinfo
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openwad                        ; -- Begin function openwad
	.p2align	2
_openwad:                               ; @openwad
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_open
	mov	x19, x0
	tbz	w0, #31, LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_derror
LBB0_2:
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #24
	bl	_read
	ldr	w0, [sp, #28]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w2, #4
	bl	_strncmp
	cbz	x0, LBB0_4
; %bb.3:
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_derror
LBB0_4:
	ldr	w0, [sp, #24]
	bl	_LONG
Lloh9:
	adrp	x24, _numlumps@GOTPAGE
Lloh10:
	ldr	x24, [x24, _numlumps@GOTPAGEOFF]
	str	w0, [x24]
	ldr	w0, [sp, #20]
	bl	_LONG
	mov	x21, x0
	ldr	w8, [x24]
	lsl	w22, w8, #5
	add	w8, w8, w8, lsl #1
	lsl	w23, w8, #3
	mov	x0, x22
	bl	_malloc
	mov	x20, x0
Lloh11:
	adrp	x25, _lumpinfo@GOTPAGE
Lloh12:
	ldr	x25, [x25, _lumpinfo@GOTPAGEOFF]
	str	x0, [x25]
	sxtw	x26, w22
	sxtw	x27, w23
	add	x8, x0, x26
	sub	x22, x8, x27
Lloh13:
	adrp	x8, _SEEK_SET@GOTPAGE
Lloh14:
	ldr	x8, [x8, _SEEK_SET@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_lseek
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	bl	_read
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.5:
	mov	x21, #0
	mov	x22, #0
	sub	x8, x26, x27
	add	x8, x8, x20
	add	x20, x8, #8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x25]
	add	x8, x8, x21
	ldr	w0, [x8, #24]
	ldr	w1, [x20]
	mov	w2, #8
	bl	_strncpy
	ldr	x8, [x25]
	str	w19, [x8, x21]
	ldur	w0, [x20, #-4]
	bl	_LONG
	ldr	x8, [x25]
	add	x8, x8, x21
	str	x0, [x8, #16]
	ldur	w0, [x20, #-8]
	bl	_LONG
	ldr	x8, [x25]
	add	x8, x8, x21
	str	x0, [x8, #8]
	add	x22, x22, #1
	ldrsw	x8, [x24]
	add	x21, x21, #32
	add	x20, x20, #24
	cmp	x22, x8
	b.lt	LBB0_6
LBB0_7:
	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
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not open wadfile"

l_.str.1:                               ; @.str.1
	.asciz	"IWAD"

l_.str.2:                               ; @.str.2
	.asciz	"wadfile has weirdo header"

	.comm	_numlumps,4,2                   ; @numlumps
	.comm	_lumpinfo,8,3                   ; @lumpinfo
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
.subsections_via_symbols
