	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ## -- Begin function main
	.p2align	4, 0x90
_main:                                  ## @main
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movl	%edi, %ebx
	leaq	L_str(%rip), %rdi
	callq	_puts
	cmpl	$1, %ebx
	jg	LBB0_2
## %bb.1:
	movq	(%r15), %rsi
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_printf
	movl	$1, %ebx
	jmp	LBB0_10
LBB0_2:
	movq	8(%r15), %rdi
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	%eax, %r14d
	movq	_PROT_READ@GOTPCREL(%rip), %rax
	movq	_PROT_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_MAP_SHARED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%edi, %edi
	movl	$8, %esi
	movl	%r14d, %r8d
	xorl	%r9d, %r9d
	callq	_mmap
	movq	%rax, _main.header(%rip)
	movq	_MAP_FAILED@GOTPCREL(%rip), %rcx
	cmpq	%rax, (%rcx)
	je	LBB0_5
## %bb.7:
	leaq	L_str.9(%rip), %rdi
	callq	_puts
	movq	_main.header(%rip), %rax
	movl	(%rax), %esi
	movl	4(%rax), %edx
	movl	8(%rax), %ecx
	leaq	L_.str.5(%rip), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_printf
	movq	_main.header(%rip), %rax
	movabsq	$281470681808895, %rcx          ## imm = 0xFFFF0000FFFF
	movq	%rcx, (%rax)
	movl	$65535, 8(%rax)                 ## imm = 0xFFFF
	leaq	L_str.10(%rip), %rdi
	callq	_puts
	movq	_main.header(%rip), %rax
	movl	(%rax), %esi
	movl	4(%rax), %edx
	movl	8(%rax), %ecx
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_printf
	movq	_MS_SYNC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_msync
	cmpl	$-1, %eax
	je	LBB0_8
## %bb.9:
	movl	%r14d, %edi
	callq	_close
	movq	_main.header(%rip), %rdi
	xorl	%esi, %esi
	callq	_munmap
	movq	8(%r15), %rsi
	leaq	L_.str.8(%rip), %rdi
	xorl	%eax, %eax
	callq	_printf
LBB0_10:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	leaq	L_.str.2(%rip), %rdi
	callq	_perror
	movl	$1, %ebx
	jmp	LBB0_10
LBB0_5:
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_6
LBB0_8:
	leaq	L_.str.7(%rip), %rdi
LBB0_6:
	callq	_perror
	movl	%r14d, %edi
	callq	_close
	movl	$1, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_main.header,8,3 ## @main.header
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"Usage: %s file"

	.comm	_O_RDWR,4,2                     ## @O_RDWR
L_.str.2:                               ## @.str.2
	.asciz	"open"

	.comm	_PROT_READ,4,2                  ## @PROT_READ
	.comm	_PROT_WRITE,4,2                 ## @PROT_WRITE
	.comm	_MAP_SHARED,4,2                 ## @MAP_SHARED
	.comm	_MAP_FAILED,8,3                 ## @MAP_FAILED
L_.str.3:                               ## @.str.3
	.asciz	"mmap"

L_.str.5:                               ## @.str.5
	.asciz	"\te_shoff:%d\n\te_shnum:%d\n\te_shstrndx:%d\n"

	.comm	_MS_SYNC,4,2                    ## @MS_SYNC
L_.str.7:                               ## @.str.7
	.asciz	"msync"

L_.str.8:                               ## @.str.8
	.asciz	"You should no more be able to run \"%s\" inside GDB\n"

L_str:                                  ## @str
	.asciz	".: Elf corrupt :."

L_str.9:                                ## @str.9
	.asciz	"[*] Current header values:"

L_str.10:                               ## @str.10
	.asciz	"[*] Patched header values:"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x0, l_str@PAGE
Lloh1:
	add	x0, x0, l_str@PAGEOFF
	bl	_puts
	cmp	w20, #1
	b.gt	LBB0_2
; %bb.1:
	ldr	x8, [x19]
	str	x8, [sp]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_printf
	mov	w0, #1
	b	LBB0_6
LBB0_2:
	ldr	x0, [x19, #8]
Lloh4:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	bl	_open
	tbnz	w0, #31, LBB0_7
; %bb.3:
	mov	x20, x0
Lloh7:
	adrp	x8, _PROT_READ@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PROT_READ@GOTPAGEOFF]
Lloh9:
	adrp	x9, _PROT_WRITE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PROT_WRITE@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh13:
	adrp	x8, _MAP_SHARED@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MAP_SHARED@GOTPAGEOFF]
Lloh15:
	ldr	w3, [x8]
	mov	x0, #0
	mov	w1, #8
	mov	x4, x20
	mov	w5, #0
	bl	_mmap
	adrp	x22, _main.header@PAGE
	str	x0, [x22, _main.header@PAGEOFF]
Lloh16:
	adrp	x8, _MAP_FAILED@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MAP_FAILED@GOTPAGEOFF]
Lloh18:
	ldr	x8, [x8]
	cmp	x8, x0
	b.eq	LBB0_8
; %bb.4:
Lloh19:
	adrp	x0, l_str.9@PAGE
Lloh20:
	add	x0, x0, l_str.9@PAGEOFF
	bl	_puts
	ldr	x8, [x22, _main.header@PAGEOFF]
	ldp	w9, w10, [x8]
	ldr	w8, [x8, #8]
	stp	x10, x8, [sp, #8]
	str	x9, [sp]
Lloh21:
	adrp	x21, l_.str.5@PAGE
Lloh22:
	add	x21, x21, l_.str.5@PAGEOFF
	mov	x0, x21
	bl	_printf
	ldr	x8, [x22, _main.header@PAGEOFF]
	movi	d0, #0x00ffff0000ffff
	str	d0, [x8]
	mov	w9, #65535
	str	w9, [x8, #8]
Lloh23:
	adrp	x0, l_str.10@PAGE
Lloh24:
	add	x0, x0, l_str.10@PAGEOFF
	bl	_puts
	ldr	x8, [x22, _main.header@PAGEOFF]
	ldp	w9, w10, [x8]
	ldr	w8, [x8, #8]
	stp	x10, x8, [sp, #8]
	str	x9, [sp]
	mov	x0, x21
	bl	_printf
Lloh25:
	adrp	x8, _MS_SYNC@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MS_SYNC@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	mov	x0, #0
	mov	w1, #0
	bl	_msync
	cmn	w0, #1
	b.eq	LBB0_9
; %bb.5:
	mov	x0, x20
	bl	_close
	ldr	x0, [x22, _main.header@PAGEOFF]
	mov	w1, #0
	bl	_munmap
	ldr	x8, [x19, #8]
	str	x8, [sp]
Lloh28:
	adrp	x0, l_.str.8@PAGE
Lloh29:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_printf
	mov	w0, #0
LBB0_6:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_7:
Lloh30:
	adrp	x0, l_.str.2@PAGE
Lloh31:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_perror
	mov	w0, #1
	b	LBB0_6
LBB0_8:
Lloh32:
	adrp	x0, l_.str.3@PAGE
Lloh33:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_10
LBB0_9:
Lloh34:
	adrp	x0, l_.str.7@PAGE
Lloh35:
	add	x0, x0, l_.str.7@PAGEOFF
LBB0_10:
	bl	_perror
	mov	x0, x20
	bl	_close
	mov	w0, #1
	b	LBB0_6
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh11
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_main.header,8,3 ; @main.header
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"Usage: %s file"

	.comm	_O_RDWR,4,2                     ; @O_RDWR
l_.str.2:                               ; @.str.2
	.asciz	"open"

	.comm	_PROT_READ,4,2                  ; @PROT_READ
	.comm	_PROT_WRITE,4,2                 ; @PROT_WRITE
	.comm	_MAP_SHARED,4,2                 ; @MAP_SHARED
	.comm	_MAP_FAILED,8,3                 ; @MAP_FAILED
l_.str.3:                               ; @.str.3
	.asciz	"mmap"

l_.str.5:                               ; @.str.5
	.asciz	"\te_shoff:%d\n\te_shnum:%d\n\te_shstrndx:%d\n"

	.comm	_MS_SYNC,4,2                    ; @MS_SYNC
l_.str.7:                               ; @.str.7
	.asciz	"msync"

l_.str.8:                               ; @.str.8
	.asciz	"You should no more be able to run \"%s\" inside GDB\n"

l_str:                                  ; @str
	.asciz	".: Elf corrupt :."

l_str.9:                                ; @str.9
	.asciz	"[*] Current header values:"

l_str.10:                               ; @str.10
	.asciz	"[*] Patched header values:"

.subsections_via_symbols
