	.file	"extr_mktitanimg.c_cs_calc_sum.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	cs_calc_sum
	.type	cs_calc_sum, @function
cs_calc_sum:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	mov	r13, rdi
	push	r12
	.cfi_offset 12, -48
	mov	r12d, edx
	push	rbx
	sub	rsp, 40
	.cfi_offset 3, -56
	mov	QWORD PTR -72[rbp], rsi
	mov	rdi, rsp
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	movsx	rax, DWORD PTR BUFLEN[rip]
	add	rax, 15
	mov	rdx, rax
	and	rax, -4096
	sub	rdi, rax
	and	rdx, -16
	mov	rax, rdi
	cmp	rsp, rax
	je	.L3
.L39:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L39
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L40
.L4:
	mov	edx, DWORD PTR SEEK_SET[rip]
	xor	esi, esi
	mov	rdi, r13
	mov	r15, rsp
	xor	r14d, r14d
	xor	ebx, ebx
	call	fseek@PLT
	mov	r9d, DWORD PTR BUFLEN[rip]
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rcx, r13
	mov	edx, r9d
	mov	esi, 1
	mov	rdi, r15
	call	fread@PLT
	test	rax, rax
	je	.L41
	mov	rcx, r14
	add	rcx, rax
	jc	.L14
	movsx	rdx, DWORD PTR BUFLEN[rip]
	mov	r9, rdx
	cmp	rdx, rax
	je	.L10
	test	r12d, r12d
	je	.L10
	lea	rdx, -8[rax]
	add	r14, rdx
	test	rdx, rdx
	je	.L5
	sub	rax, 9
.L17:
	mov	rcx, QWORD PTR crctab[rip]
	lea	rsi, 1[r15+rax]
	mov	rax, r15
	.p2align 4,,10
	.p2align 3
.L12:
	add	rax, 1
	mov	rdx, rbx
	shr	rbx, 24
	xor	bl, BYTE PTR -1[rax]
	sal	rdx, 8
	movzx	ebx, bl
	xor	rdx, QWORD PTR [rcx+rbx*8]
	mov	rbx, rdx
	cmp	rax, rsi
	jne	.L12
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L10:
	sub	rax, 1
	mov	r14, rcx
	jmp	.L17
.L14:
	xor	eax, eax
.L1:
	mov	rdi, QWORD PTR -56[rbp]
	xor	rdi, QWORD PTR fs:40
	jne	.L42
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L41:
	.cfi_restore_state
	mov	rdi, r13
	call	ferror@PLT
	test	rax, rax
	jne	.L14
	test	r14, r14
	je	.L15
	mov	rcx, QWORD PTR crctab[rip]
	.p2align 4,,10
	.p2align 3
.L16:
	mov	rdx, rbx
	shr	rbx, 24
	xor	rbx, r14
	sal	rdx, 8
	movzx	eax, bl
	xor	rdx, QWORD PTR [rcx+rax*8]
	shr	r14, 8
	mov	rbx, rdx
	jne	.L16
.L15:
	mov	rax, QWORD PTR -72[rbp]
	not	ebx
	mov	QWORD PTR [rax], rbx
	mov	eax, 1
	jmp	.L1
.L40:
	or	QWORD PTR -8[rsp+rdx], 0
	jmp	.L4
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	cs_calc_sum, .-cs_calc_sum
	.comm	crctab,8,8
	.comm	SEEK_SET,4,4
	.comm	BUFLEN,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_mktitanimg.c_cs_calc_sum.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	cs_calc_sum
	.syntax unified
	.arm
	.fpu softvfp
	.type	cs_calc_sum, %function
cs_calc_sum:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #20
	mov	r5, #0
	ldr	r8, .L31
	mov	ip, r1
	ldr	r3, [r8]
	mov	r4, r5
	add	r3, r3, #7
	bic	r3, r3, #7
	sub	sp, sp, r3
	mov	r6, sp
	mov	r9, r2
	ldr	r2, .L31+4
	ldr	r3, .L31+8
	ldr	r2, [r2]
	str	ip, [fp, #-48]
	mov	r1, r5
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	mov	r7, r0
	ldr	r10, .L31+12
	bl	fseek
	ldr	r2, [r8]
.L2:
	mov	r3, r7
	mov	r1, #1
	mov	r0, r6
	bl	fread
	cmp	r0, #0
	beq	.L27
	adds	r3, r5, r0
	bcs	.L11
	ldr	r2, [r8]
	cmp	r2, r0
	cmpne	r9, #0
	moveq	r5, r3
	subeq	r0, r0, #1
	bne	.L28
.L14:
	mov	r1, r6
	add	r0, r0, #1
	ldr	ip, [r10]
	add	r0, r6, r0
.L9:
	ldrb	r3, [r1], #1	@ zero_extendqisi2
	eor	r3, r3, r4, lsr #24
	ldr	r3, [ip, r3, lsl #2]
	cmp	r1, r0
	eor	r4, r3, r4, lsl #8
	bne	.L9
	b	.L2
.L28:
	sub	r3, r0, #8
	cmp	r3, #0
	add	r5, r5, r3
	beq	.L2
	sub	r0, r0, #9
	b	.L14
.L27:
	mov	r0, r7
	bl	ferror
	cmp	r0, #0
	beq	.L29
.L11:
	mov	r0, #0
.L1:
	ldr	r3, .L31+8
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L30
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L29:
	cmp	r5, #0
	beq	.L12
	ldr	r3, .L31+12
	ldr	r2, [r3]
.L13:
	eor	r3, r5, r4, lsr #24
	and	r3, r3, #255
	ldr	r3, [r2, r3, lsl #2]
	lsrs	r5, r5, #8
	eor	r4, r3, r4, lsl #8
	bne	.L13
.L12:
	mvn	r4, r4
	ldr	r3, [fp, #-48]
	mov	r0, #1
	str	r4, [r3]
	b	.L1
.L30:
	bl	__stack_chk_fail
.L32:
	.align	2
.L31:
	.word	BUFLEN
	.word	SEEK_SET
	.word	.LC0
	.word	crctab
	.size	cs_calc_sum, .-cs_calc_sum
	.comm	crctab,4,4
	.comm	SEEK_SET,4,4
	.comm	BUFLEN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
