	.file	"extr_device.c_get_device.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Not enough permissions to read device %s.\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"got error %u\n"
	.section	.rodata.str1.8
	.align 8
.LC2:
	.string	"Failed to get preparsed data(0x%x)\n"
	.section	.rodata.str1.1
.LC3:
	.string	"Failed to get Caps(0x%x)\n"
	.section	.rodata.str1.8
	.align 8
.LC4:
	.string	"Failed to free preparsed data(0x%x)\n"
	.text
	.p2align 4
	.type	get_device, @function
get_device:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 104
	.cfi_def_cfa_offset 160
	mov	DWORD PTR 28[rsp], edx
	lea	r15, 52[rsp]
	lea	r12, 56[rsp]
	mov	QWORD PTR 8[rsp], rdi
	mov	rdi, r15
	mov	QWORD PTR 32[rsp], rsi
	mov	DWORD PTR 24[rsp], ecx
	mov	rcx, QWORD PTR fs:40
	mov	QWORD PTR 88[rsp], rcx
	xor	ecx, ecx
	mov	ecx, DWORD PTR MAX_PATH[rip]
	lea	r14d, 0[0+rcx*4]
	call	HidD_GetHidGuid@PLT
	mov	esi, 4
	mov	rdi, r12
	lea	ebx, 8[r14]
	call	ZeroMemory@PLT
	xor	eax, eax
	mov	DWORD PTR [rsp], ebx
	mov	DWORD PTR 56[rsp], 4
	call	GetProcessHeap@PLT
	mov	edx, ebx
	xor	esi, esi
	mov	edi, eax
	call	HeapAlloc@PLT
	mov	ecx, DWORD PTR DIGCF_DEVICEINTERFACE[rip]
	xor	edx, edx
	xor	esi, esi
	mov	DWORD PTR [rax], 8
	or	ecx, DWORD PTR DIGCF_PRESENT[rip]
	mov	rdi, r15
	mov	r13, rax
	call	SetupDiGetClassDevsW@PLT
	mov	rbx, QWORD PTR 32[rsp]
	mov	ebp, eax
	mov	eax, DWORD PTR 28[rsp]
	sub	eax, 1
	lea	rax, 8[rbx+rax*8]
	xor	ebx, ebx
	mov	QWORD PTR 40[rsp], rax
	lea	rax, 60[rsp]
	mov	QWORD PTR 16[rsp], rax
	.p2align 4,,10
	.p2align 3
.L2:
	mov	r8, r12
	mov	ecx, ebx
	mov	rdx, r15
	xor	esi, esi
	mov	edi, ebp
	call	SetupDiEnumDeviceInterfaces@PLT
	mov	r14, rax
	test	rax, rax
	je	.L29
	mov	ecx, DWORD PTR [rsp]
	xor	r9d, r9d
	xor	r8d, r8d
	mov	rdx, r13
	mov	rsi, r12
	mov	edi, ebp
	add	ebx, 1
	call	SetupDiGetDeviceInterfaceDetailW@PLT
	test	rax, rax
	je	.L2
	sub	rsp, 8
	.cfi_def_cfa_offset 168
	mov	edi, DWORD PTR 4[r13]
	xor	ecx, ecx
	mov	edx, DWORD PTR FILE_SHARE_READ[rip]
	mov	r9d, DWORD PTR FILE_FLAG_OVERLAPPED[rip]
	mov	r8d, DWORD PTR OPEN_EXISTING[rip]
	push	0
	.cfi_def_cfa_offset 176
	mov	esi, DWORD PTR 40[rsp]
	or	edx, DWORD PTR FILE_SHARE_WRITE[rip]
	call	CreateFileW@PLT
	cmp	QWORD PTR INVALID_HANDLE_VALUE[rip], rax
	pop	rdx
	.cfi_def_cfa_offset 168
	mov	r14, rax
	pop	rcx
	.cfi_def_cfa_offset 160
	je	.L31
.L4:
	xor	eax, eax
	call	GetLastError@PLT
	xor	edi, edi
	cmp	QWORD PTR INVALID_HANDLE_VALUE[rip], r14
	lea	rsi, .LC1[rip]
	setne	dil
	mov	rdx, rax
	call	ok@PLT
	mov	rsi, QWORD PTR 16[rsp]
	mov	rdi, r14
	call	HidD_GetPreparsedData@PLT
	mov	DWORD PTR 4[rsp], eax
	xor	eax, eax
	call	GetLastError@PLT
	mov	edi, DWORD PTR 4[rsp]
	lea	rsi, .LC2[rip]
	mov	rdx, rax
	call	ok@PLT
	mov	edi, DWORD PTR 60[rsp]
	lea	rsi, 64[rsp]
	call	HidP_GetCaps@PLT
	xor	edi, edi
	cmp	QWORD PTR HIDP_STATUS_SUCCESS[rip], rax
	lea	rsi, .LC3[rip]
	sete	dil
	mov	rdx, rax
	call	ok@PLT
	mov	edi, DWORD PTR 60[rsp]
	call	HidD_FreePreparsedData@PLT
	mov	DWORD PTR 4[rsp], eax
	xor	eax, eax
	call	GetLastError@PLT
	mov	edi, DWORD PTR 4[rsp]
	lea	rsi, .LC4[rip]
	mov	rdx, rax
	call	ok@PLT
	mov	rax, QWORD PTR 8[rsp]
	test	rax, rax
	je	.L5
	cmp	QWORD PTR 64[rsp], rax
	je	.L5
.L6:
	mov	rdi, r14
	call	CloseHandle@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	mov	eax, DWORD PTR 28[rsp]
	test	eax, eax
	je	.L29
	mov	rcx, QWORD PTR 72[rsp]
	mov	rax, QWORD PTR 32[rsp]
	mov	rsi, QWORD PTR 40[rsp]
	jg	.L12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L32:
	cmp	rdx, rcx
	je	.L29
	add	rax, 8
	cmp	rax, rsi
	je	.L6
.L12:
	mov	rdx, QWORD PTR [rax]
	test	rdx, rdx
	jne	.L32
.L29:
	xor	eax, eax
	call	GetProcessHeap@PLT
	xor	esi, esi
	mov	rdx, r13
	mov	edi, eax
	call	HeapFree@PLT
	mov	edi, ebp
	call	SetupDiDestroyDeviceInfoList@PLT
	mov	rax, QWORD PTR 88[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L33
	add	rsp, 104
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r14
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	xor	eax, eax
	call	GetLastError@PLT
	cmp	rax, QWORD PTR ERROR_ACCESS_DENIED[rip]
	jne	.L4
	mov	edi, DWORD PTR 4[r13]
	call	wine_dbgstr_w@PLT
	lea	rdi, .LC0[rip]
	mov	esi, eax
	call	trace@PLT
	jmp	.L2
.L33:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	get_device, .-get_device
	.comm	OPEN_EXISTING,4,4
	.comm	MAX_PATH,4,4
	.comm	INVALID_HANDLE_VALUE,8,8
	.comm	HIDP_STATUS_SUCCESS,8,8
	.comm	FILE_SHARE_WRITE,4,4
	.comm	FILE_SHARE_READ,4,4
	.comm	FILE_FLAG_OVERLAPPED,4,4
	.comm	ERROR_ACCESS_DENIED,8,8
	.comm	DIGCF_PRESENT,4,4
	.comm	DIGCF_DEVICEINTERFACE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_device.c_get_device.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Not enough permissions to read device %s.\012\000"
	.align	2
.LC1:
	.ascii	"got error %u\012\000"
	.align	2
.LC2:
	.ascii	"Failed to get preparsed data(0x%x)\012\000"
	.align	2
.LC3:
	.ascii	"Failed to get Caps(0x%x)\012\000"
	.align	2
.LC4:
	.ascii	"Failed to free preparsed data(0x%x)\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	get_device, %function
get_device:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 0, uses_anonymous_args = 0
	mov	ip, r0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r0, .L33
	sub	sp, sp, #60
	str	r3, [sp, #20]
	ldr	r3, .L33+4
	str	ip, [sp, #24]
	ldr	r9, [r0]
	str	r1, [sp, #28]
	add	r0, sp, #32
	add	r7, sp, #36
	mov	r10, r2
	ldr	r3, [r3]
	str	r3, [sp, #52]
	mov	r3,#0
	bl	HidD_GetHidGuid
	mov	r1, #4
	mov	r0, r7
	bl	ZeroMemory
	mov	r3, #4
	lsl	r9, r9, #2
	add	r9, r9, #8
	str	r3, [sp, #36]
	bl	GetProcessHeap
	mov	r2, r9
	mov	r1, #0
	bl	HeapAlloc
	mov	ip, #8
	mov	r2, #0
	ldr	r1, .L33+8
	ldr	r3, .L33+12
	ldr	r1, [r1]
	ldr	r3, [r3]
	mov	r8, r0
	str	ip, [r0]
	orr	r3, r1, r3
	add	r0, sp, #32
	mov	r1, r2
	bl	SetupDiGetClassDevsW
	mov	r5, #0
	mov	r6, r0
	ldr	fp, .L33+16
.L2:
	mov	r3, r5
	mov	r1, #0
	mov	r0, r6
	str	r7, [sp]
	add	r2, sp, #32
	bl	SetupDiEnumDeviceInterfaces
	subs	r4, r0, #0
	beq	.L29
	mov	r4, #0
	mov	r3, r9
	mov	r2, r8
	mov	r1, r7
	mov	r0, r6
	str	r4, [sp, #4]
	str	r4, [sp]
	bl	SetupDiGetDeviceInterfaceDetailW
	cmp	r0, r4
	add	r5, r5, #1
	beq	.L2
	ldr	r3, .L33+20
	ldr	r2, [fp]
	ldr	r3, [r3]
	ldr	r1, .L33+24
	orr	r2, r2, r3
	ldr	r3, .L33+28
	ldr	ip, [r1]
	ldr	r1, [r3]
	ldr	r0, [r8, #4]
	mov	r3, r4
	stm	sp, {r1, ip}
	str	r4, [sp, #8]
	ldr	r1, [sp, #20]
	bl	CreateFileW
	ldr	r3, .L33+32
	mov	r4, r0
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L30
.L4:
	str	r3, [sp, #16]
	bl	GetLastError
	ldr	r3, [sp, #16]
	mov	r2, r0
	subs	r0, r4, r3
	movne	r0, #1
	ldr	r1, .L33+36
	bl	ok
	add	r1, sp, #40
	mov	r0, r4
	bl	HidD_GetPreparsedData
	str	r0, [sp, #16]
	bl	GetLastError
	ldr	r3, [sp, #16]
	mov	r2, r0
	ldr	r1, .L33+40
	mov	r0, r3
	bl	ok
	add	r1, sp, #44
	ldr	r0, [sp, #40]
	bl	HidP_GetCaps
	mov	r2, r0
	ldr	r3, .L33+44
	ldr	r1, .L33+48
	ldr	r0, [r3]
	sub	r0, r0, r2
	clz	r0, r0
	lsr	r0, r0, #5
	bl	ok
	ldr	r0, [sp, #40]
	bl	HidD_FreePreparsedData
	str	r0, [sp, #16]
	bl	GetLastError
	ldr	r3, [sp, #16]
	mov	r2, r0
	ldr	r1, .L33+52
	mov	r0, r3
	bl	ok
	ldr	r2, [sp, #24]
	cmp	r2, #0
	beq	.L6
	ldr	r3, [sp, #44]
	cmp	r3, r2
	beq	.L6
.L7:
	mov	r0, r4
	bl	CloseHandle
	b	.L2
.L6:
	cmp	r10, #0
	beq	.L11
	ble	.L7
	ldr	r3, [sp, #28]
	mov	r2, #0
	ldr	r0, [sp, #48]
	sub	r1, r3, #4
	b	.L13
.L31:
	cmp	r3, r0
	beq	.L11
	add	r2, r2, #1
	cmp	r10, r2
	beq	.L7
.L13:
	ldr	r3, [r1, #4]!
	cmp	r3, #0
	bne	.L31
.L11:
	bl	GetProcessHeap
	mov	r2, r8
	mov	r1, #0
	bl	HeapFree
	mov	r0, r6
	bl	SetupDiDestroyDeviceInfoList
.L1:
	ldr	r3, .L33+4
	ldr	r2, [r3]
	ldr	r3, [sp, #52]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L32
	mov	r0, r4
	add	sp, sp, #60
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L30:
	bl	GetLastError
	ldr	r3, .L33+56
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L5
	ldr	r3, .L33+32
	ldr	r3, [r3]
	b	.L4
.L29:
	bl	GetProcessHeap
	mov	r2, r8
	mov	r1, r4
	bl	HeapFree
	mov	r0, r6
	bl	SetupDiDestroyDeviceInfoList
	b	.L1
.L5:
	ldr	r0, [r8, #4]
	bl	wine_dbgstr_w
	mov	r1, r0
	ldr	r0, .L33+60
	bl	trace
	b	.L2
.L32:
	bl	__stack_chk_fail
.L34:
	.align	2
.L33:
	.word	MAX_PATH
	.word	.LC5
	.word	DIGCF_DEVICEINTERFACE
	.word	DIGCF_PRESENT
	.word	FILE_SHARE_READ
	.word	FILE_SHARE_WRITE
	.word	FILE_FLAG_OVERLAPPED
	.word	OPEN_EXISTING
	.word	INVALID_HANDLE_VALUE
	.word	.LC1
	.word	.LC2
	.word	HIDP_STATUS_SUCCESS
	.word	.LC3
	.word	.LC4
	.word	ERROR_ACCESS_DENIED
	.word	.LC0
	.size	get_device, .-get_device
	.comm	OPEN_EXISTING,4,4
	.comm	MAX_PATH,4,4
	.comm	INVALID_HANDLE_VALUE,4,4
	.comm	HIDP_STATUS_SUCCESS,4,4
	.comm	FILE_SHARE_WRITE,4,4
	.comm	FILE_SHARE_READ,4,4
	.comm	FILE_FLAG_OVERLAPPED,4,4
	.comm	ERROR_ACCESS_DENIED,4,4
	.comm	DIGCF_PRESENT,4,4
	.comm	DIGCF_DEVICEINTERFACE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
