	.file	"extr_tgafb.c_tgafb_setcolreg.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	tgafb_setcolreg, @function
tgafb_setcolreg:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15d, esi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14d, edx
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12d, edi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, ecx
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	rbp, QWORD PTR 8[r9]
	mov	QWORD PTR 8[rsp], r9
	mov	edi, DWORD PTR 8[rbp]
	call	dev_is_pci@PLT
	mov	edi, DWORD PTR 8[rbp]
	mov	r13d, eax
	call	TGA_BUS_TC@PLT
	cmp	r12d, 255
	ja	.L6
	mov	rcx, QWORD PTR TGA_TYPE_8PLANE[rip]
	shr	r15d, 8
	shr	r14d, 8
	mov	r9, QWORD PTR 8[rsp]
	shr	ebx, 8
	cmp	QWORD PTR 0[rbp], rcx
	je	.L12
.L3:
	cmp	r12d, 15
	jbe	.L13
.L5:
	mov	esi, r12d
	mov	rdi, rbp
	xor	r13d, r13d
	call	BT463_LOAD_ADDR@PLT
	mov	eax, DWORD PTR BT463_PALETTE[rip]
	mov	edx, DWORD PTR TGA_RAMDAC_SETUP_REG[rip]
	mov	rdi, rbp
	lea	esi, 0[0+rax*4]
	call	TGA_WRITE_REG@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	esi, r15d
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	esi, r14d
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	esi, ebx
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r13d
	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
.L13:
	.cfi_restore_state
	mov	eax, r12d
	mov	esi, r12d
	mov	rdx, QWORD PTR [r9]
	mov	ecx, r12d
	sal	eax, 16
	sal	esi, 8
	or	eax, esi
	or	eax, r12d
	mov	DWORD PTR [rdx+rcx*4], eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L12:
	test	r13d, r13d
	jne	.L14
	test	eax, eax
	je	.L3
	mov	esi, r12d
	mov	rdi, rbp
	call	BT459_LOAD_ADDR@PLT
	mov	eax, DWORD PTR BT459_PALETTE[rip]
	mov	edx, DWORD PTR TGA_RAMDAC_SETUP_REG[rip]
	mov	rdi, rbp
	lea	esi, 0[0+rax*4]
	call	TGA_WRITE_REG@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	esi, r15d
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	esi, r14d
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	esi, ebx
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	mov	r13d, 1
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L14:
	mov	edx, DWORD PTR BT485_ADDR_PAL_WRITE[rip]
	mov	esi, r12d
	mov	rdi, rbp
	xor	r13d, r13d
	call	BT485_WRITE@PLT
	mov	edx, DWORD PTR TGA_RAMDAC_SETUP_REG[rip]
	mov	esi, DWORD PTR BT485_DATA_PAL[rip]
	mov	rdi, rbp
	call	TGA_WRITE_REG@PLT
	mov	esi, DWORD PTR BT485_DATA_PAL[rip]
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	rdi, rbp
	sal	esi, 8
	or	esi, r15d
	call	TGA_WRITE_REG@PLT
	mov	esi, DWORD PTR BT485_DATA_PAL[rip]
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	rdi, rbp
	sal	esi, 8
	or	esi, r14d
	call	TGA_WRITE_REG@PLT
	mov	esi, DWORD PTR BT485_DATA_PAL[rip]
	mov	edx, DWORD PTR TGA_RAMDAC_REG[rip]
	mov	rdi, rbp
	sal	esi, 8
	or	esi, ebx
	call	TGA_WRITE_REG@PLT
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	tgafb_setcolreg, .-tgafb_setcolreg
	.comm	TGA_TYPE_8PLANE,8,8
	.comm	TGA_RAMDAC_SETUP_REG,4,4
	.comm	TGA_RAMDAC_REG,4,4
	.comm	BT485_DATA_PAL,4,4
	.comm	BT485_ADDR_PAL_WRITE,4,4
	.comm	BT463_PALETTE,4,4
	.comm	BT459_PALETTE,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_tgafb.c_tgafb_setcolreg.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	tgafb_setcolreg, %function
tgafb_setcolreg:
	@ args = 8, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r10, [sp, #36]
	mov	r5, r0
	ldr	r4, [r10, #4]
	mov	r9, r1
	ldr	r0, [r4, #4]
	mov	r8, r2
	mov	r7, r3
	bl	dev_is_pci
	mov	r6, r0
	ldr	r0, [r4, #4]
	bl	TGA_BUS_TC
	cmp	r5, #255
	movhi	r6, #1
	bhi	.L1
	ldr	r3, .L14
	ldr	r2, [r4]
	ldr	r3, [r3]
	lsr	r9, r9, #8
	cmp	r2, r3
	lsr	r8, r8, #8
	lsr	r7, r7, #8
	beq	.L12
.L3:
	cmp	r5, #15
	lslls	r3, r5, #8
	orrls	r3, r3, r5, lsl #16
	ldrls	r2, [r10]
	orrls	r3, r3, r5
	strls	r3, [r2, r5, lsl #2]
	mov	r1, r5
	mov	r0, r4
	bl	BT463_LOAD_ADDR
	ldr	r2, .L14+4
	ldr	r3, .L14+8
	ldr	r1, [r2]
	ldr	r5, .L14+12
	ldr	r2, [r3]
	lsl	r1, r1, #2
	mov	r0, r4
	bl	TGA_WRITE_REG
	mov	r1, r9
	ldr	r2, [r5]
	mov	r0, r4
	bl	TGA_WRITE_REG
	mov	r1, r8
	ldr	r2, [r5]
	mov	r0, r4
	bl	TGA_WRITE_REG
	mov	r1, r7
	mov	r0, r4
	ldr	r2, [r5]
	bl	TGA_WRITE_REG
	mov	r6, #0
.L1:
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L12:
	cmp	r6, #0
	bne	.L13
	cmp	r0, #0
	beq	.L3
	mov	r1, r5
	mov	r0, r4
	bl	BT459_LOAD_ADDR
	ldr	r2, .L14+16
	ldr	r3, .L14+8
	ldr	r1, [r2]
	ldr	r5, .L14+12
	ldr	r2, [r3]
	mov	r0, r4
	lsl	r1, r1, #2
	bl	TGA_WRITE_REG
	mov	r1, r9
	ldr	r2, [r5]
	mov	r0, r4
	bl	TGA_WRITE_REG
	mov	r1, r8
	ldr	r2, [r5]
	mov	r0, r4
	bl	TGA_WRITE_REG
	mov	r1, r7
	mov	r0, r4
	ldr	r2, [r5]
	bl	TGA_WRITE_REG
	b	.L1
.L13:
	ldr	r3, .L14+20
	mov	r1, r5
	ldr	r2, [r3]
	mov	r0, r4
	bl	BT485_WRITE
	ldr	r5, .L14+24
	ldr	r3, .L14+8
	ldr	r1, [r5]
	ldr	r2, [r3]
	mov	r0, r4
	bl	TGA_WRITE_REG
	ldr	r6, .L14+12
	ldr	r1, [r5]
	ldr	r2, [r6]
	orr	r1, r9, r1, lsl #8
	mov	r0, r4
	bl	TGA_WRITE_REG
	ldr	r1, [r5]
	ldr	r2, [r6]
	orr	r1, r8, r1, lsl #8
	mov	r0, r4
	bl	TGA_WRITE_REG
	ldr	r1, [r5]
	ldr	r2, [r6]
	mov	r0, r4
	orr	r1, r7, r1, lsl #8
	bl	TGA_WRITE_REG
	mov	r6, #0
	b	.L1
.L15:
	.align	2
.L14:
	.word	TGA_TYPE_8PLANE
	.word	BT463_PALETTE
	.word	TGA_RAMDAC_SETUP_REG
	.word	TGA_RAMDAC_REG
	.word	BT459_PALETTE
	.word	BT485_ADDR_PAL_WRITE
	.word	BT485_DATA_PAL
	.size	tgafb_setcolreg, .-tgafb_setcolreg
	.comm	TGA_TYPE_8PLANE,4,4
	.comm	TGA_RAMDAC_SETUP_REG,4,4
	.comm	TGA_RAMDAC_REG,4,4
	.comm	BT485_DATA_PAL,4,4
	.comm	BT485_ADDR_PAL_WRITE,4,4
	.comm	BT463_PALETTE,4,4
	.comm	BT459_PALETTE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
