	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gb_hd_create                   ## -- Begin function gb_hd_create
	.p2align	4, 0x90
_gb_hd_create:                          ## @gb_hd_create
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	cmpl	$0, 12(%rdi)
	je	LBB0_4
## %bb.1:
	movq	%rdi, %rbx
	cmpl	$0, 8(%rdi)
	je	LBB0_4
## %bb.2:
	movq	%rdx, %r15
	movq	_GB_OPERATION_MESSAGE_SIZE_MIN@GOTPCREL(%rip), %rax
	cmpq	%rdx, (%rax)
	jbe	LBB0_9
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_5
LBB0_4:
	leaq	L_.str(%rip), %rsi
LBB0_5:
	xorl	%r12d, %r12d
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_7:
	subl	(%rax), %r12d
LBB0_8:
	movl	%r12d, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_9:
	movq	%rcx, %r14
	testq	%rcx, %rcx
	je	LBB0_11
## %bb.10:
	movq	_CPORT_ID_MAX@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	incq	%rax
	cmpq	%r14, %rax
	jae	LBB0_12
LBB0_11:
	leaq	L_.str.2(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%r13, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_6
LBB0_12:
	movq	_GB_OPERATION_MESSAGE_SIZE_MAX@GOTPCREL(%rip), %r12
	movq	(%r12), %rdx
	cmpq	%r15, %rdx
	jae	LBB0_14
## %bb.13:
	leaq	L_.str.3(%rip), %rsi
	movq	%r13, %rdi
	callq	_dev_warn
	movq	(%r12), %r15
LBB0_14:
	movq	(%rbx), %rdi
	addq	$88, %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_kzalloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_18
## %bb.15:
	movl	(%r12), %ecx
	movq	_gb_hd_bus_id_map@GOTPCREL(%rip), %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_ida_simple_get
	movl	%eax, %r12d
	testl	%eax, %eax
	js	LBB0_19
## %bb.16:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	%r12d, (%rax)
	movq	%rax, %r12
	movq	%rbx, 80(%rax)
	leaq	76(%rax), %rdi
	callq	_INIT_LIST_HEAD
	leaq	72(%r12), %rdi
	callq	_INIT_LIST_HEAD
	leaq	68(%r12), %rdi
	callq	_ida_init
	movq	%r15, 8(%r12)
	movq	%r14, 16(%r12)
	movq	%r12, %rbx
	addq	$24, %rbx
	movq	%r13, 32(%r12)
	movq	_greybus_bus_type@GOTPCREL(%rip), %rax
	movq	%rax, 56(%r12)
	movq	_greybus_hd_type@GOTPCREL(%rip), %rax
	movq	%rax, 48(%r12)
	movq	_bus_groups@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%r12)
	movl	(%r13), %eax
	movl	%eax, 24(%r12)
	movq	%rbx, %rdi
	callq	_device_initialize
	movl	(%r12), %edx
	leaq	L_.str.4(%rip), %rsi
	movq	%rbx, %rdi
	callq	_dev_set_name
	movq	%r12, %rdi
	callq	_trace_gb_hd_create
	movq	%r12, %rdi
	callq	_gb_svc_create
	movl	%eax, 64(%r12)
	testl	%eax, %eax
	je	LBB0_20
## %bb.17:
	movq	%r12, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	jmp	LBB0_7
LBB0_19:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	jmp	LBB0_8
LBB0_20:
	leaq	L_.str.5(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	%rbx, %rdi
	callq	_put_device
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mandatory hd-callbacks missing\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GB_OPERATION_MESSAGE_SIZE_MIN,8,3 ## @GB_OPERATION_MESSAGE_SIZE_MIN
L_.str.1:                               ## @.str.1
	.asciz	"greybus host-device buffers too small\n"

	.comm	_CPORT_ID_MAX,4,2               ## @CPORT_ID_MAX
L_.str.2:                               ## @.str.2
	.asciz	"Invalid number of CPorts: %zu\n"

	.comm	_GB_OPERATION_MESSAGE_SIZE_MAX,8,3 ## @GB_OPERATION_MESSAGE_SIZE_MAX
L_.str.3:                               ## @.str.3
	.asciz	"limiting buffer size to %u\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_gb_hd_bus_id_map,4,2           ## @gb_hd_bus_id_map
	.comm	_greybus_bus_type,4,2           ## @greybus_bus_type
	.comm	_greybus_hd_type,4,2            ## @greybus_hd_type
	.comm	_bus_groups,4,2                 ## @bus_groups
L_.str.4:                               ## @.str.4
	.asciz	"greybus%d"

L_.str.5:                               ## @.str.5
	.asciz	"failed to create svc\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gb_hd_create                   ; -- Begin function gb_hd_create
	.p2align	2
_gb_hd_create:                          ; @gb_hd_create
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	ldr	w8, [x0, #12]
	cbz	w8, LBB0_4
; %bb.1:
	mov	x23, x0
	ldr	w8, [x0, #8]
	cbz	w8, LBB0_4
; %bb.2:
	mov	x21, x2
Lloh0:
	adrp	x8, _GB_OPERATION_MESSAGE_SIZE_MIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GB_OPERATION_MESSAGE_SIZE_MIN@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x2
	b.ls	LBB0_8
; %bb.3:
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_5
LBB0_4:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
LBB0_5:
	mov	x0, x19
	bl	_dev_err
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_7:
	mov	x0, x24
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_ERR_PTR
LBB0_8:
	mov	x20, x3
	cbz	x3, LBB0_10
; %bb.9:
Lloh9:
	adrp	x8, _CPORT_ID_MAX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _CPORT_ID_MAX@GOTPAGEOFF]
Lloh11:
	ldrsw	x8, [x8]
	add	x8, x8, #1
	cmp	x8, x20
	b.hs	LBB0_11
LBB0_10:
	str	x20, [sp]
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_5
LBB0_11:
Lloh14:
	adrp	x22, _GB_OPERATION_MESSAGE_SIZE_MAX@GOTPAGE
Lloh15:
	ldr	x22, [x22, _GB_OPERATION_MESSAGE_SIZE_MAX@GOTPAGEOFF]
	ldr	x2, [x22]
	cmp	x2, x21
	b.hs	LBB0_13
; %bb.12:
Lloh16:
	adrp	x1, l_.str.3@PAGE
Lloh17:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_dev_warn
	ldr	x21, [x22]
LBB0_13:
	ldr	x8, [x23]
	add	x0, x8, #88
Lloh18:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh19:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x24]
	bl	_kzalloc
	cbz	x0, LBB0_19
; %bb.14:
	mov	x22, x0
	ldr	w3, [x24]
Lloh20:
	adrp	x0, _gb_hd_bus_id_map@GOTPAGE
Lloh21:
	ldr	x0, [x0, _gb_hd_bus_id_map@GOTPAGEOFF]
	mov	w1, #1
	mov	w2, #0
	bl	_ida_simple_get
	mov	x24, x0
	tbnz	w0, #31, LBB0_17
; %bb.15:
	str	w24, [x22]
	str	x23, [x22, #80]
	add	x0, x22, #76
	bl	_INIT_LIST_HEAD
	add	x0, x22, #72
	bl	_INIT_LIST_HEAD
	add	x0, x22, #68
	bl	_ida_init
	ldr	w8, [x19]
	mov	x23, x22
	str	w8, [x23, #24]!
	stp	x21, x20, [x22, #8]
	str	x19, [x22, #32]
Lloh22:
	adrp	x8, _greybus_bus_type@GOTPAGE
Lloh23:
	ldr	x8, [x8, _greybus_bus_type@GOTPAGEOFF]
Lloh24:
	adrp	x9, _greybus_hd_type@GOTPAGE
Lloh25:
	ldr	x9, [x9, _greybus_hd_type@GOTPAGEOFF]
	stp	x9, x8, [x22, #48]
Lloh26:
	adrp	x8, _bus_groups@GOTPAGE
Lloh27:
	ldr	x8, [x8, _bus_groups@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	str	w8, [x22, #40]
	mov	x0, x23
	bl	_device_initialize
	ldr	w2, [x22]
Lloh29:
	adrp	x1, l_.str.4@PAGE
Lloh30:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x23
	bl	_dev_set_name
	mov	x0, x22
	bl	_trace_gb_hd_create
	mov	x0, x22
	bl	_gb_svc_create
	str	w0, [x22, #64]
	cbz	w0, LBB0_18
; %bb.16:
	mov	x0, x22
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_17:
	mov	x0, x22
	bl	_kfree
	b	LBB0_7
LBB0_18:
Lloh31:
	adrp	x1, l_.str.5@PAGE
Lloh32:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x23
	bl	_dev_err
	mov	x0, x23
	bl	_put_device
LBB0_19:
Lloh33:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mandatory hd-callbacks missing\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GB_OPERATION_MESSAGE_SIZE_MIN,8,3 ; @GB_OPERATION_MESSAGE_SIZE_MIN
l_.str.1:                               ; @.str.1
	.asciz	"greybus host-device buffers too small\n"

	.comm	_CPORT_ID_MAX,4,2               ; @CPORT_ID_MAX
l_.str.2:                               ; @.str.2
	.asciz	"Invalid number of CPorts: %zu\n"

	.comm	_GB_OPERATION_MESSAGE_SIZE_MAX,8,3 ; @GB_OPERATION_MESSAGE_SIZE_MAX
l_.str.3:                               ; @.str.3
	.asciz	"limiting buffer size to %u\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_gb_hd_bus_id_map,4,2           ; @gb_hd_bus_id_map
	.comm	_greybus_bus_type,4,2           ; @greybus_bus_type
	.comm	_greybus_hd_type,4,2            ; @greybus_hd_type
	.comm	_bus_groups,4,2                 ; @bus_groups
l_.str.4:                               ; @.str.4
	.asciz	"greybus%d"

l_.str.5:                               ; @.str.5
	.asciz	"failed to create svc\n"

.subsections_via_symbols
