	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_detect_hostname                ## -- Begin function detect_hostname
	.p2align	4, 0x90
_detect_hostname:                       ## @detect_hostname
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_hostname@GOTPCREL(%rip), %r15
	movq	(%r15), %rbx
	testq	%rbx, %rbx
	je	LBB0_2
## %bb.1:
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	LBB0_18
LBB0_2:
	leaq	L_.str(%rip), %rdi
	callq	_getenv
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	%rax, %rbx
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	LBB0_18
LBB0_4:
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_open
	testl	%eax, %eax
	js	LBB0_5
## %bb.7:
	movl	%eax, %r14d
	leaq	_detect_hostname.hostname_buffer(%rip), %rbx
	movl	%eax, %edi
	movq	%rbx, %rsi
	movl	$256, %edx                      ## imm = 0x100
	callq	_read
                                        ## kill: def $eax killed $eax def $rax
	leal	-256(%rax), %ecx
	cmpl	$-256, %ecx
	jbe	LBB0_27
## %bb.8:
	movl	%eax, %eax
	movb	$0, (%rax,%rbx)
	movl	%r14d, %edi
	callq	_close
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=1
	addq	$4, %rbx
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rbx), %eax
	cmpl	$9, %eax
	je	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpl	$32, %eax
	je	LBB0_13
## %bb.11:
	movq	%rbx, (%r15)
	jle	LBB0_12
## %bb.14:
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	cmpl	$32, 4(%rbx,%rax,4)
	leaq	1(%rax), %rax
	jg	LBB0_15
## %bb.16:
	movl	%eax, %eax
	jmp	LBB0_17
LBB0_12:
	xorl	%eax, %eax
LBB0_17:
	movl	$0, (%rbx,%rax,4)
	movl	(%rbx), %eax
	testl	%eax, %eax
	je	LBB0_28
LBB0_18:
	xorl	%ecx, %ecx
	movabsq	$1125899906842627, %rdx         ## imm = 0x4000000000003
	jmp	LBB0_19
LBB0_22:                                ##   in Loop: Header=BB0_19 Depth=1
	movl	%eax, %esi
	andl	$-33, %esi
	addl	$-65, %esi
	cmpl	$25, %esi
	ja	LBB0_24
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_19 Depth=1
	movl	4(%rbx,%rcx,4), %eax
	incq	%rcx
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	leal	-48(%rax), %esi
	cmpl	$10, %esi
	jb	LBB0_23
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	leal	-45(%rax), %esi
	cmpl	$50, %esi
	ja	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_19 Depth=1
	btq	%rsi, %rdx
	jb	LBB0_23
	jmp	LBB0_22
LBB0_24:
	testl	%eax, %eax
	jne	LBB0_29
## %bb.25:
	andl	$-64, %ecx
	testq	%rcx, %rcx
	jne	LBB0_29
## %bb.26:
	leaq	L_.str.6(%rip), %rsi
	movl	$1, %edi
	movq	%rbx, %rdx
	callq	_vkprintf
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_29:
	leaq	L_.str.5(%rip), %rdi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_kprintf
	movl	$2, %edi
	callq	_exit
LBB0_5:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_6
LBB0_27:
	leaq	L_.str.3(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_kprintf
	movl	$2, %edi
	callq	_exit
LBB0_28:
	leaq	L_.str.4(%rip), %rdi
LBB0_6:
	xorl	%eax, %eax
	callq	_kprintf
	movl	$2, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_detect_hostname.hostname_buffer,256,4 ## @detect_hostname.hostname_buffer
	.comm	_hostname,8,3                   ## @hostname
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"HOSTNAME"

L_.str.1:                               ## @.str.1
	.asciz	"/etc/hostname"

	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
L_.str.2:                               ## @.str.2
	.asciz	"cannot read /etc/hostname: %m\n"

L_.str.3:                               ## @.str.3
	.asciz	"cannot read hostname from /etc/hostname: %d bytes read\n"

L_.str.4:                               ## @.str.4
	.asciz	"fatal: cannot detect hostname\n"

L_.str.5:                               ## @.str.5
	.asciz	"fatal: bad hostname '%s'\n"

L_.str.6:                               ## @.str.6
	.asciz	"hostname is %s\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_detect_hostname                ; -- Begin function detect_hostname
	.p2align	2
_detect_hostname:                       ; @detect_hostname
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
Lloh0:
	adrp	x21, _hostname@GOTPAGE
Lloh1:
	ldr	x21, [x21, _hostname@GOTPAGEOFF]
	ldr	x19, [x21]
	cbz	x19, LBB0_2
; %bb.1:
	ldr	w8, [x19]
	cbnz	w8, LBB0_16
LBB0_2:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_getenv
	str	x0, [x21]
	cbz	x0, LBB0_4
; %bb.3:
	mov	x19, x0
	ldr	w8, [x0]
	cbnz	w8, LBB0_16
LBB0_4:
Lloh4:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_open
	tbnz	w0, #31, LBB0_26
; %bb.5:
	mov	x20, x0
Lloh9:
	adrp	x19, _detect_hostname.hostname_buffer@PAGE
Lloh10:
	add	x19, x19, _detect_hostname.hostname_buffer@PAGEOFF
	mov	x1, x19
	mov	w2, #256
	bl	_read
                                        ; kill: def $w0 killed $w0 def $x0
	sub	w8, w0, #256
	cmn	w8, #256
	b.ls	LBB0_27
; %bb.6:
	strb	wzr, [x19, w0, uxtw]
	mov	x0, x20
	bl	_close
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x19, x19, #4
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x19]
	cmp	w8, #9
	b.eq	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	w8, #32
	b.eq	LBB0_7
; %bb.10:
	str	x19, [x21]
	cmp	w8, #33
	b.lt	LBB0_14
; %bb.11:
	mov	x9, #0
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	add	x8, x9, #1
	add	x9, x19, x9, lsl #2
	ldr	w10, [x9, #4]
	mov	x9, x8
	cmp	w10, #32
	b.gt	LBB0_12
; %bb.13:
	and	x8, x8, #0xffffffff
	b	LBB0_15
LBB0_14:
	mov	x8, #0
LBB0_15:
	str	wzr, [x19, x8, lsl #2]
	ldr	w8, [x19]
	cbz	w8, LBB0_28
LBB0_16:
	mov	x9, #0
	mov	w10, #1
	mov	x11, #3
	movk	x11, #4, lsl #48
	b	LBB0_19
LBB0_17:                                ;   in Loop: Header=BB0_19 Depth=1
	and	w12, w8, #0xffffffdf
	sub	w12, w12, #65
	cmp	w12, #25
	b.hi	LBB0_22
LBB0_18:                                ;   in Loop: Header=BB0_19 Depth=1
	add	x8, x19, x9, lsl #2
	add	x9, x9, #1
	ldr	w8, [x8, #4]
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	sub	w12, w8, #48
	cmp	w12, #10
	b.lo	LBB0_18
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	sub	w12, w8, #45
	cmp	w12, #50
	b.hi	LBB0_17
; %bb.21:                               ;   in Loop: Header=BB0_19 Depth=1
	lsl	x12, x10, x12
	tst	x12, x11
	b.ne	LBB0_18
	b	LBB0_17
LBB0_22:
	cbnz	w8, LBB0_25
; %bb.23:
	and	x8, x9, #0xffffffc0
	cbnz	x8, LBB0_25
; %bb.24:
Lloh11:
	adrp	x1, l_.str.6@PAGE
Lloh12:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	w0, #1
	mov	x2, x19
	bl	_vkprintf
	mov	w0, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_25:
	str	x19, [sp]
Lloh13:
	adrp	x0, l_.str.5@PAGE
Lloh14:
	add	x0, x0, l_.str.5@PAGEOFF
	b	LBB0_29
LBB0_26:
Lloh15:
	adrp	x0, l_.str.2@PAGE
Lloh16:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_29
LBB0_27:
	str	x0, [sp]
Lloh17:
	adrp	x0, l_.str.3@PAGE
Lloh18:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_29
LBB0_28:
Lloh19:
	adrp	x0, l_.str.4@PAGE
Lloh20:
	add	x0, x0, l_.str.4@PAGEOFF
LBB0_29:
	bl	_kprintf
	mov	w0, #2
	bl	_exit
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_detect_hostname.hostname_buffer,256,0 ; @detect_hostname.hostname_buffer
	.comm	_hostname,8,3                   ; @hostname
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"HOSTNAME"

l_.str.1:                               ; @.str.1
	.asciz	"/etc/hostname"

	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
l_.str.2:                               ; @.str.2
	.asciz	"cannot read /etc/hostname: %m\n"

l_.str.3:                               ; @.str.3
	.asciz	"cannot read hostname from /etc/hostname: %d bytes read\n"

l_.str.4:                               ; @.str.4
	.asciz	"fatal: cannot detect hostname\n"

l_.str.5:                               ; @.str.5
	.asciz	"fatal: bad hostname '%s'\n"

l_.str.6:                               ; @.str.6
	.asciz	"hostname is %s\n"

.subsections_via_symbols
