	.file	"713784.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC1:
	.string	"NOT NORMAL, thresholdValue = 160\n"
	.align 8
.LC2:
	.string	"# threshold: value ihist chist mass_dipol_moment\n"
	.align 8
.LC4:
	.string	"# threshold: %3d %6d %6d %8.2f\n"
.LC5:
	.string	"# threshold: Value >gmax\n"
.LC6:
	.string	"# threshold: Value<=gmin\n"
	.align 8
.LC7:
	.string	"# threshold: Value = %d gmin=%d gmax=%d cmax=%d i= %d %d\n"
	.align 8
.LC8:
	.string	"# threshold: invert the image\n"
	.text
	.globl	otsu
	.type	otsu, @function
otsu:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 2208
	mov	QWORD PTR -2184[rbp], rdi
	mov	DWORD PTR -2188[rbp], esi
	mov	DWORD PTR -2192[rbp], edx
	mov	DWORD PTR -2196[rbp], ecx
	mov	DWORD PTR -2200[rbp], r8d
	mov	DWORD PTR -2204[rbp], r9d
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -2172[rbp], 0
	mov	DWORD PTR -2168[rbp], 1
	lea	rax, -2064[rbp]
	mov	edx, 1024
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	lea	rax, -1040[rbp]
	mov	edx, 1024
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	mov	BYTE PTR -2173[rbp], 0
	movzx	eax, BYTE PTR -2173[rbp]
	mov	BYTE PTR -2174[rbp], al
	mov	DWORD PTR -2136[rbp], 255
	mov	DWORD PTR -2132[rbp], 0
	mov	eax, DWORD PTR 16[rbp]
	lea	edx, 511[rax]
	test	eax, eax
	cmovs	eax, edx
	sar	eax, 9
	add	eax, 1
	mov	DWORD PTR -2156[rbp], eax
	mov	DWORD PTR -2164[rbp], 0
	jmp	.L2
.L9:
	mov	edx, DWORD PTR -2200[rbp]
	mov	eax, DWORD PTR -2164[rbp]
	add	eax, edx
	imul	eax, DWORD PTR -2192[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -2196[rbp]
	add	eax, edx
	movsx	rdx, eax
	mov	rax, QWORD PTR -2184[rbp]
	add	rax, rdx
	mov	QWORD PTR -2120[rbp], rax
	mov	DWORD PTR -2160[rbp], 0
	jmp	.L3
.L8:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movsx	rdx, eax
	mov	edx, DWORD PTR -2064[rbp+rdx*4]
	add	edx, 1
	cdqe
	mov	DWORD PTR -2064[rbp+rax*4], edx
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR -2132[rbp], eax
	jge	.L4
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -2132[rbp], eax
.L4:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR -2136[rbp], eax
	jle	.L5
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -2136[rbp], eax
.L5:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movzx	edx, BYTE PTR -2174[rbp]
	sub	eax, edx
	cdq
	xor	eax, edx
	sub	eax, edx
	cmp	DWORD PTR -2172[rbp], eax
	jge	.L6
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movzx	edx, BYTE PTR -2174[rbp]
	sub	eax, edx
	cdq
	xor	eax, edx
	mov	DWORD PTR -2172[rbp], eax
	sub	DWORD PTR -2172[rbp], edx
.L6:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movzx	edx, BYTE PTR -2173[rbp]
	sub	eax, edx
	cdq
	xor	eax, edx
	sub	eax, edx
	cmp	DWORD PTR -2172[rbp], eax
	jge	.L7
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movzx	edx, BYTE PTR -2173[rbp]
	sub	eax, edx
	cdq
	xor	eax, edx
	mov	DWORD PTR -2172[rbp], eax
	sub	DWORD PTR -2172[rbp], edx
.L7:
	movzx	eax, BYTE PTR -2174[rbp]
	mov	BYTE PTR -2173[rbp], al
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -2174[rbp], al
	add	QWORD PTR -2120[rbp], 1
	add	DWORD PTR -2160[rbp], 1
.L3:
	mov	eax, DWORD PTR -2160[rbp]
	cmp	eax, DWORD PTR -2204[rbp]
	jl	.L8
	mov	eax, DWORD PTR -2156[rbp]
	add	DWORD PTR -2164[rbp], eax
.L2:
	mov	eax, DWORD PTR -2164[rbp]
	cmp	eax, DWORD PTR 16[rbp]
	jl	.L9
	mov	DWORD PTR -2164[rbp], 0
	jmp	.L10
.L15:
	mov	edx, DWORD PTR -2200[rbp]
	mov	eax, DWORD PTR -2164[rbp]
	add	eax, edx
	imul	eax, DWORD PTR -2192[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -2196[rbp]
	add	eax, edx
	movsx	rdx, eax
	mov	rax, QWORD PTR -2184[rbp]
	add	rax, rdx
	mov	QWORD PTR -2120[rbp], rax
	mov	DWORD PTR -2160[rbp], 0
	jmp	.L11
.L14:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movzx	edx, BYTE PTR -2174[rbp]
	sub	eax, edx
	mov	ecx, eax
	sar	ecx, 31
	xor	eax, ecx
	mov	edx, eax
	sub	edx, ecx
	mov	eax, DWORD PTR -2172[rbp]
	lea	ecx, 3[rax]
	test	eax, eax
	cmovs	eax, ecx
	sar	eax, 2
	cmp	edx, eax
	jg	.L12
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movzx	edx, BYTE PTR -2173[rbp]
	sub	eax, edx
	mov	ecx, eax
	sar	ecx, 31
	xor	eax, ecx
	mov	edx, eax
	sub	edx, ecx
	mov	eax, DWORD PTR -2172[rbp]
	lea	ecx, 3[rax]
	test	eax, eax
	cmovs	eax, ecx
	sar	eax, 2
	cmp	edx, eax
	jle	.L13
.L12:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	movsx	rdx, eax
	mov	edx, DWORD PTR -1040[rbp+rdx*4]
	add	edx, 1
	cdqe
	mov	DWORD PTR -1040[rbp+rax*4], edx
.L13:
	movzx	eax, BYTE PTR -2174[rbp]
	mov	BYTE PTR -2173[rbp], al
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -2174[rbp], al
	add	QWORD PTR -2120[rbp], 1
	add	DWORD PTR -2160[rbp], 1
.L11:
	mov	eax, DWORD PTR -2160[rbp]
	cmp	eax, DWORD PTR -2204[rbp]
	jl	.L14
	mov	eax, DWORD PTR -2156[rbp]
	add	DWORD PTR -2164[rbp], eax
.L10:
	mov	eax, DWORD PTR -2164[rbp]
	cmp	eax, DWORD PTR 16[rbp]
	jl	.L15
	pxor	xmm0, xmm0
	movsd	QWORD PTR -2104[rbp], xmm0
	movsd	xmm0, QWORD PTR -2104[rbp]
	movsd	QWORD PTR -2112[rbp], xmm0
	mov	DWORD PTR -2144[rbp], 0
	mov	DWORD PTR -2152[rbp], 0
	mov	DWORD PTR -2156[rbp], 0
	jmp	.L16
.L17:
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, DWORD PTR -2156[rbp]
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -1040[rbp+rax*4]
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, eax
	mulsd	xmm0, xmm1
	movsd	xmm1, QWORD PTR -2112[rbp]
	addsd	xmm0, xmm1
	movsd	QWORD PTR -2112[rbp], xmm0
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -1040[rbp+rax*4]
	add	DWORD PTR -2144[rbp], eax
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -2064[rbp+rax*4]
	add	DWORD PTR -2152[rbp], eax
	add	DWORD PTR -2156[rbp], 1
.L16:
	cmp	DWORD PTR -2156[rbp], 255
	jle	.L17
	cmp	DWORD PTR -2144[rbp], 0
	jne	.L18
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 33
	mov	esi, 1
	lea	rdi, .LC1[rip]
	call	fwrite@PLT
	mov	eax, 160
	jmp	.L40
.L18:
	mov	eax, DWORD PTR 24[rbp]
	and	eax, 1
	test	eax, eax
	je	.L20
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 49
	mov	esi, 1
	lea	rdi, .LC2[rip]
	call	fwrite@PLT
.L20:
	movsd	xmm0, QWORD PTR .LC3[rip]
	movsd	QWORD PTR -2096[rbp], xmm0
	mov	DWORD PTR -2140[rbp], 0
	mov	DWORD PTR -2156[rbp], 0
	jmp	.L21
.L28:
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -1040[rbp+rax*4]
	add	DWORD PTR -2140[rbp], eax
	cmp	DWORD PTR -2140[rbp], 0
	je	.L43
	mov	eax, DWORD PTR -2144[rbp]
	sub	eax, DWORD PTR -2140[rbp]
	mov	DWORD PTR -2128[rbp], eax
	cmp	DWORD PTR -2128[rbp], 0
	je	.L44
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, DWORD PTR -2156[rbp]
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -1040[rbp+rax*4]
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, eax
	mulsd	xmm0, xmm1
	movsd	xmm1, QWORD PTR -2104[rbp]
	addsd	xmm0, xmm1
	movsd	QWORD PTR -2104[rbp], xmm0
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, DWORD PTR -2140[rbp]
	movsd	xmm0, QWORD PTR -2104[rbp]
	divsd	xmm0, xmm1
	movsd	QWORD PTR -2088[rbp], xmm0
	movsd	xmm0, QWORD PTR -2112[rbp]
	subsd	xmm0, QWORD PTR -2104[rbp]
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, DWORD PTR -2128[rbp]
	divsd	xmm0, xmm1
	movsd	QWORD PTR -2080[rbp], xmm0
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, DWORD PTR -2140[rbp]
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, DWORD PTR -2128[rbp]
	mulsd	xmm1, xmm0
	movsd	xmm0, QWORD PTR -2080[rbp]
	subsd	xmm0, QWORD PTR -2088[rbp]
	mulsd	xmm0, xmm1
	movsd	QWORD PTR -2072[rbp], xmm0
	movsd	xmm0, QWORD PTR -2072[rbp]
	comisd	xmm0, QWORD PTR -2096[rbp]
	jbe	.L26
	movsd	xmm0, QWORD PTR -2072[rbp]
	movsd	QWORD PTR -2096[rbp], xmm0
	mov	eax, DWORD PTR -2156[rbp]
	add	eax, 1
	mov	DWORD PTR -2168[rbp], eax
.L26:
	mov	eax, DWORD PTR 24[rbp]
	and	eax, 1
	test	eax, eax
	je	.L23
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -2064[rbp+rax*4]
	test	eax, eax
	je	.L23
	mov	eax, DWORD PTR -2204[rbp]
	imul	eax, DWORD PTR 16[rbp]
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, eax
	movsd	xmm0, QWORD PTR -2072[rbp]
	divsd	xmm0, xmm1
	movq	rsi, xmm0
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	edi, DWORD PTR -1040[rbp+rax*4]
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	ecx, DWORD PTR -2064[rbp+rax*4]
	mov	rax, QWORD PTR stderr[rip]
	mov	edx, DWORD PTR -2156[rbp]
	movq	xmm0, rsi
	mov	r8d, edi
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 1
	call	fprintf@PLT
	jmp	.L23
.L43:
	nop
.L23:
	add	DWORD PTR -2156[rbp], 1
.L21:
	cmp	DWORD PTR -2156[rbp], 254
	jle	.L28
	jmp	.L25
.L44:
	nop
.L25:
	mov	DWORD PTR -2148[rbp], 0
	mov	DWORD PTR -2156[rbp], 0
	jmp	.L29
.L30:
	mov	eax, DWORD PTR -2156[rbp]
	cdqe
	mov	eax, DWORD PTR -2064[rbp+rax*4]
	add	DWORD PTR -2148[rbp], eax
	add	DWORD PTR -2156[rbp], 1
.L29:
	mov	eax, DWORD PTR -2156[rbp]
	cmp	eax, DWORD PTR -2168[rbp]
	jl	.L30
	mov	eax, DWORD PTR -2152[rbp]
	sub	eax, DWORD PTR -2148[rbp]
	mov	DWORD PTR -2124[rbp], eax
	mov	eax, DWORD PTR -2168[rbp]
	cmp	eax, DWORD PTR -2132[rbp]
	jle	.L31
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 25
	mov	esi, 1
	lea	rdi, .LC5[rip]
	call	fwrite@PLT
	mov	eax, DWORD PTR -2132[rbp]
	mov	DWORD PTR -2168[rbp], eax
.L31:
	mov	eax, DWORD PTR -2168[rbp]
	cmp	eax, DWORD PTR -2136[rbp]
	jg	.L32
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 25
	mov	esi, 1
	lea	rdi, .LC6[rip]
	call	fwrite@PLT
	mov	eax, DWORD PTR -2136[rbp]
	add	eax, 1
	mov	DWORD PTR -2168[rbp], eax
.L32:
	mov	eax, DWORD PTR 24[rbp]
	and	eax, 1
	test	eax, eax
	je	.L33
	mov	rax, QWORD PTR stderr[rip]
	mov	r8d, DWORD PTR -2172[rbp]
	mov	edi, DWORD PTR -2132[rbp]
	mov	ecx, DWORD PTR -2136[rbp]
	mov	edx, DWORD PTR -2168[rbp]
	mov	esi, DWORD PTR -2124[rbp]
	push	rsi
	mov	esi, DWORD PTR -2148[rbp]
	push	rsi
	mov	r9d, r8d
	mov	r8d, edi
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	add	rsp, 16
.L33:
	mov	eax, DWORD PTR -2124[rbp]
	sal	eax, 2
	cmp	DWORD PTR -2148[rbp], eax
	jl	.L34
	mov	eax, DWORD PTR 24[rbp]
	and	eax, 1
	test	eax, eax
	je	.L35
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 30
	mov	esi, 1
	lea	rdi, .LC8[rip]
	call	fwrite@PLT
.L35:
	mov	DWORD PTR -2164[rbp], 0
	jmp	.L36
.L39:
	mov	edx, DWORD PTR -2200[rbp]
	mov	eax, DWORD PTR -2164[rbp]
	add	eax, edx
	imul	eax, DWORD PTR -2192[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -2196[rbp]
	add	eax, edx
	movsx	rdx, eax
	mov	rax, QWORD PTR -2184[rbp]
	add	rax, rdx
	mov	QWORD PTR -2120[rbp], rax
	mov	DWORD PTR -2160[rbp], 0
	jmp	.L37
.L38:
	mov	rax, QWORD PTR -2120[rbp]
	movzx	eax, BYTE PTR [rax]
	not	eax
	mov	edx, eax
	mov	rax, QWORD PTR -2120[rbp]
	mov	BYTE PTR [rax], dl
	add	QWORD PTR -2120[rbp], 1
	add	DWORD PTR -2160[rbp], 1
.L37:
	mov	eax, DWORD PTR -2160[rbp]
	cmp	eax, DWORD PTR -2204[rbp]
	jl	.L38
	add	DWORD PTR -2164[rbp], 1
.L36:
	mov	eax, DWORD PTR -2164[rbp]
	cmp	eax, DWORD PTR 16[rbp]
	jl	.L39
	mov	eax, 256
	sub	eax, DWORD PTR -2168[rbp]
	mov	DWORD PTR -2168[rbp], eax
.L34:
	mov	eax, DWORD PTR -2168[rbp]
.L40:
	mov	rdi, QWORD PTR -8[rbp]
	sub	rdi, QWORD PTR fs:40
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	otsu, .-otsu
	.section	.rodata
	.align 8
.LC9:
	.string	"# thresholdValue out of range %d..%d, reset to %d\n"
	.text
	.globl	thresholding
	.type	thresholding, @function
thresholding:
.LFB1:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	mov	QWORD PTR -40[rbp], rdi
	mov	DWORD PTR -44[rbp], esi
	mov	DWORD PTR -48[rbp], edx
	mov	DWORD PTR -52[rbp], ecx
	mov	DWORD PTR -56[rbp], r8d
	mov	DWORD PTR -60[rbp], r9d
	mov	DWORD PTR -24[rbp], 255
	mov	DWORD PTR -20[rbp], 0
	mov	DWORD PTR -16[rbp], 255
	mov	DWORD PTR -12[rbp], 0
	mov	eax, DWORD PTR -56[rbp]
	add	eax, 1
	mov	DWORD PTR -32[rbp], eax
	jmp	.L46
.L51:
	mov	eax, DWORD PTR -32[rbp]
	imul	eax, DWORD PTR -48[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -52[rbp]
	add	eax, edx
	cdqe
	lea	rdx, 1[rax]
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	mov	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -52[rbp]
	add	eax, 1
	mov	DWORD PTR -28[rbp], eax
	jmp	.L47
.L50:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR -20[rbp], eax
	jge	.L48
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -20[rbp], eax
.L48:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR -24[rbp], eax
	jle	.L49
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -24[rbp], eax
.L49:
	add	QWORD PTR -8[rbp], 1
	add	DWORD PTR -28[rbp], 1
.L47:
	mov	edx, DWORD PTR -52[rbp]
	mov	eax, DWORD PTR -60[rbp]
	add	eax, edx
	sub	eax, 1
	cmp	DWORD PTR -28[rbp], eax
	jl	.L50
	add	DWORD PTR -32[rbp], 1
.L46:
	mov	edx, DWORD PTR -56[rbp]
	mov	eax, DWORD PTR 16[rbp]
	add	eax, edx
	sub	eax, 1
	cmp	DWORD PTR -32[rbp], eax
	jl	.L51
	mov	eax, DWORD PTR 24[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jle	.L52
	mov	eax, DWORD PTR 24[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jle	.L53
.L52:
	mov	edx, DWORD PTR -24[rbp]
	mov	eax, DWORD PTR -20[rbp]
	add	eax, edx
	add	eax, 1
	mov	edx, eax
	shr	edx, 31
	add	eax, edx
	sar	eax
	mov	DWORD PTR 24[rbp], eax
	mov	rax, QWORD PTR stderr[rip]
	mov	esi, DWORD PTR 24[rbp]
	mov	ecx, DWORD PTR -20[rbp]
	mov	edx, DWORD PTR -24[rbp]
	mov	r8d, esi
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
.L53:
	mov	eax, DWORD PTR -56[rbp]
	mov	DWORD PTR -32[rbp], eax
	jmp	.L54
.L61:
	mov	eax, DWORD PTR -32[rbp]
	imul	eax, DWORD PTR -48[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -52[rbp]
	add	eax, edx
	movsx	rdx, eax
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	mov	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -52[rbp]
	mov	DWORD PTR -28[rbp], eax
	jmp	.L55
.L60:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR 24[rbp], eax
	jg	.L56
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	ecx, al
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	sal	eax, 4
	mov	ecx, eax
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, DWORD PTR 24[rbp]
	lea	edi, 1[rax]
	mov	eax, ecx
	cdq
	idiv	edi
	not	eax
	mov	edx, eax
	jmp	.L57
.L56:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	sub	eax, DWORD PTR -24[rbp]
	imul	eax, eax, 150
	mov	edx, DWORD PTR 24[rbp]
	mov	esi, edx
	sub	esi, DWORD PTR -24[rbp]
	cdq
	idiv	esi
	mov	edx, eax
.L57:
	mov	rax, QWORD PTR -8[rbp]
	mov	BYTE PTR [rax], dl
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR -12[rbp], eax
	jge	.L58
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -12[rbp], eax
.L58:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	cmp	DWORD PTR -16[rbp], eax
	jle	.L59
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -16[rbp], eax
.L59:
	add	QWORD PTR -8[rbp], 1
	add	DWORD PTR -28[rbp], 1
.L55:
	mov	edx, DWORD PTR -52[rbp]
	mov	eax, DWORD PTR -60[rbp]
	add	eax, edx
	cmp	DWORD PTR -28[rbp], eax
	jl	.L60
	add	DWORD PTR -32[rbp], 1
.L54:
	mov	edx, DWORD PTR -56[rbp]
	mov	eax, DWORD PTR 16[rbp]
	add	eax, edx
	cmp	DWORD PTR -32[rbp], eax
	jl	.L61
	mov	eax, 160
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	thresholding, .-thresholding
	.section	.rodata
	.align 8
.LC3:
	.long	0
	.long	-1074790400
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"713784.c"
	.text
	.global	__aeabi_i2d
	.global	__aeabi_dmul
	.global	__aeabi_dadd
	.section	.rodata
	.align	2
.LC0:
	.ascii	"NOT NORMAL, thresholdValue = 160\012\000"
	.align	2
.LC1:
	.ascii	"# threshold: value ihist chist mass_dipol_moment\012"
	.ascii	"\000"
	.global	__aeabi_ddiv
	.global	__aeabi_dsub
	.global	__aeabi_dcmpgt
	.align	2
.LC2:
	.ascii	"# threshold: %3d %6d %6d %8.2f\012\000"
	.align	2
.LC3:
	.ascii	"# threshold: Value >gmax\012\000"
	.align	2
.LC4:
	.ascii	"# threshold: Value<=gmin\012\000"
	.align	2
.LC5:
	.ascii	"# threshold: Value = %d gmin=%d gmax=%d cmax=%d i= "
	.ascii	"%d %d\012\000"
	.align	2
.LC6:
	.ascii	"# threshold: invert the image\012\000"
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	otsu
	.syntax unified
	.arm
	.fpu softvfp
	.type	otsu, %function
otsu:
	@ args = 16, pretend = 0, frame = 2184
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, fp, lr}
	add	fp, sp, #16
	sub	sp, sp, #2192
	sub	sp, sp, #12
	str	r0, [fp, #-2192]
	str	r1, [fp, #-2196]
	str	r2, [fp, #-2200]
	str	r3, [fp, #-2204]
	ldr	r3, .L45
	ldr	r3, [r3]
	str	r3, [fp, #-24]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-2176]
	mov	r3, #1
	str	r3, [fp, #-2172]
	sub	r3, fp, #2064
	sub	r3, r3, #4
	sub	r3, r3, #4
	mov	r2, #1024
	mov	r1, #0
	mov	r0, r3
	bl	memset
	sub	r3, fp, #1040
	sub	r3, r3, #4
	sub	r3, r3, #4
	mov	r2, #1024
	mov	r1, #0
	mov	r0, r3
	bl	memset
	mov	r3, #0
	strb	r3, [fp, #-2181]
	ldrb	r3, [fp, #-2181]
	strb	r3, [fp, #-2182]
	mov	r3, #255
	str	r3, [fp, #-2140]
	mov	r3, #0
	str	r3, [fp, #-2136]
	ldr	r3, [fp, #12]
	add	r2, r3, #508
	add	r2, r2, #3
	cmp	r3, #0
	movlt	r3, r2
	movge	r3, r3
	asr	r3, r3, #9
	add	r3, r3, #1
	str	r3, [fp, #-2160]
	mov	r3, #0
	str	r3, [fp, #-2168]
	b	.L2
.L9:
	ldr	r2, [fp, #4]
	ldr	r3, [fp, #-2168]
	add	r3, r2, r3
	ldr	r2, [fp, #-2200]
	mul	r2, r3, r2
	ldr	r3, [fp, #-2204]
	add	r3, r2, r3
	mov	r2, r3
	ldr	r3, [fp, #-2192]
	add	r3, r3, r2
	str	r3, [fp, #-2180]
	mov	r3, #0
	str	r3, [fp, #-2164]
	b	.L3
.L8:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	lsl	r3, r2, #2
	sub	r1, fp, #20
	add	r3, r1, r3
	ldr	r3, [r3, #-2052]
	add	r1, r3, #1
	lsl	r3, r2, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	str	r1, [r3, #-2052]
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-2136]
	cmp	r3, r2
	bge	.L4
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-2136]
.L4:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-2140]
	cmp	r3, r2
	ble	.L5
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-2140]
.L5:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldrb	r3, [fp, #-2182]	@ zero_extendqisi2
	sub	r3, r2, r3
	cmp	r3, #0
	rsblt	r3, r3, #0
	ldr	r2, [fp, #-2176]
	cmp	r2, r3
	bge	.L6
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldrb	r3, [fp, #-2182]	@ zero_extendqisi2
	sub	r3, r2, r3
	cmp	r3, #0
	rsblt	r3, r3, #0
	str	r3, [fp, #-2176]
.L6:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldrb	r3, [fp, #-2181]	@ zero_extendqisi2
	sub	r3, r2, r3
	cmp	r3, #0
	rsblt	r3, r3, #0
	ldr	r2, [fp, #-2176]
	cmp	r2, r3
	bge	.L7
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldrb	r3, [fp, #-2181]	@ zero_extendqisi2
	sub	r3, r2, r3
	cmp	r3, #0
	rsblt	r3, r3, #0
	str	r3, [fp, #-2176]
.L7:
	ldrb	r3, [fp, #-2182]
	strb	r3, [fp, #-2181]
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]
	strb	r3, [fp, #-2182]
	ldr	r3, [fp, #-2180]
	add	r3, r3, #1
	str	r3, [fp, #-2180]
	ldr	r3, [fp, #-2164]
	add	r3, r3, #1
	str	r3, [fp, #-2164]
.L3:
	ldr	r2, [fp, #-2164]
	ldr	r3, [fp, #8]
	cmp	r2, r3
	blt	.L8
	ldr	r2, [fp, #-2168]
	ldr	r3, [fp, #-2160]
	add	r3, r2, r3
	str	r3, [fp, #-2168]
.L2:
	ldr	r2, [fp, #-2168]
	ldr	r3, [fp, #12]
	cmp	r2, r3
	blt	.L9
	mov	r3, #0
	str	r3, [fp, #-2168]
	b	.L10
.L15:
	ldr	r2, [fp, #4]
	ldr	r3, [fp, #-2168]
	add	r3, r2, r3
	ldr	r2, [fp, #-2200]
	mul	r2, r3, r2
	ldr	r3, [fp, #-2204]
	add	r3, r2, r3
	mov	r2, r3
	ldr	r3, [fp, #-2192]
	add	r3, r3, r2
	str	r3, [fp, #-2180]
	mov	r3, #0
	str	r3, [fp, #-2164]
	b	.L11
.L14:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldrb	r3, [fp, #-2182]	@ zero_extendqisi2
	sub	r3, r2, r3
	eor	r2, r3, r3, asr #31
	sub	r2, r2, r3, asr #31
	ldr	r3, [fp, #-2176]
	add	r1, r3, #3
	cmp	r3, #0
	movlt	r3, r1
	movge	r3, r3
	asr	r3, r3, #2
	cmp	r2, r3
	bgt	.L12
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldrb	r3, [fp, #-2181]	@ zero_extendqisi2
	sub	r3, r2, r3
	eor	r2, r3, r3, asr #31
	sub	r2, r2, r3, asr #31
	ldr	r3, [fp, #-2176]
	add	r1, r3, #3
	cmp	r3, #0
	movlt	r3, r1
	movge	r3, r3
	asr	r3, r3, #2
	cmp	r2, r3
	ble	.L13
.L12:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	lsl	r3, r2, #2
	sub	r1, fp, #20
	add	r3, r1, r3
	ldr	r3, [r3, #-1028]
	add	r1, r3, #1
	lsl	r3, r2, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	str	r1, [r3, #-1028]
.L13:
	ldrb	r3, [fp, #-2182]
	strb	r3, [fp, #-2181]
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]
	strb	r3, [fp, #-2182]
	ldr	r3, [fp, #-2180]
	add	r3, r3, #1
	str	r3, [fp, #-2180]
	ldr	r3, [fp, #-2164]
	add	r3, r3, #1
	str	r3, [fp, #-2164]
.L11:
	ldr	r2, [fp, #-2164]
	ldr	r3, [fp, #8]
	cmp	r2, r3
	blt	.L14
	ldr	r2, [fp, #-2168]
	ldr	r3, [fp, #-2160]
	add	r3, r2, r3
	str	r3, [fp, #-2168]
.L10:
	ldr	r2, [fp, #-2168]
	ldr	r3, [fp, #12]
	cmp	r2, r3
	blt	.L15
	mov	r2, #0
	mov	r3, #0
	str	r2, [fp, #-2116]
	str	r3, [fp, #-2112]
	ldr	r2, [fp, #-2116]
	ldr	r3, [fp, #-2112]
	str	r2, [fp, #-2124]
	str	r3, [fp, #-2120]
	mov	r3, #0
	str	r3, [fp, #-2148]
	mov	r3, #0
	str	r3, [fp, #-2156]
	mov	r3, #0
	str	r3, [fp, #-2160]
	b	.L16
.L17:
	ldr	r0, [fp, #-2160]
	bl	__aeabi_i2d
	mov	r4, r0
	mov	r5, r1
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-1028]
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	ldr	r0, [fp, #-2124]
	ldr	r1, [fp, #-2120]
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-2124]
	str	r3, [fp, #-2120]
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-1028]
	ldr	r2, [fp, #-2148]
	add	r3, r2, r3
	str	r3, [fp, #-2148]
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-2052]
	ldr	r2, [fp, #-2156]
	add	r3, r2, r3
	str	r3, [fp, #-2156]
	ldr	r3, [fp, #-2160]
	add	r3, r3, #1
	str	r3, [fp, #-2160]
.L16:
	ldr	r3, [fp, #-2160]
	cmp	r3, #255
	ble	.L17
	ldr	r3, [fp, #-2148]
	cmp	r3, #0
	bne	.L18
	ldr	r3, .L45+4
	ldr	r3, [r3]
	mov	r2, #33
	mov	r1, #1
	ldr	r0, .L45+8
	bl	fwrite
	mov	r3, #160
	b	.L40
.L18:
	ldr	r3, [fp, #16]
	and	r3, r3, #1
	cmp	r3, #0
	beq	.L20
	ldr	r3, .L45+4
	ldr	r3, [r3]
	mov	r2, #49
	mov	r1, #1
	ldr	r0, .L45+12
	bl	fwrite
.L20:
	mov	r2, #0
	ldr	r3, .L45+16
	str	r2, [fp, #-2108]
	str	r3, [fp, #-2104]
	mov	r3, #0
	str	r3, [fp, #-2144]
	mov	r3, #0
	str	r3, [fp, #-2160]
	b	.L21
.L28:
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-1028]
	ldr	r2, [fp, #-2144]
	add	r3, r2, r3
	str	r3, [fp, #-2144]
	ldr	r3, [fp, #-2144]
	cmp	r3, #0
	beq	.L43
	ldr	r2, [fp, #-2148]
	ldr	r3, [fp, #-2144]
	sub	r3, r2, r3
	str	r3, [fp, #-2132]
	ldr	r3, [fp, #-2132]
	cmp	r3, #0
	beq	.L44
	ldr	r0, [fp, #-2160]
	bl	__aeabi_i2d
	mov	r4, r0
	mov	r5, r1
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-1028]
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	ldr	r0, [fp, #-2116]
	ldr	r1, [fp, #-2112]
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-2116]
	str	r3, [fp, #-2112]
	ldr	r0, [fp, #-2144]
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, [fp, #-2116]
	ldr	r1, [fp, #-2112]
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-2100]
	str	r3, [fp, #-2096]
	ldr	r2, [fp, #-2116]
	ldr	r3, [fp, #-2112]
	ldr	r0, [fp, #-2124]
	ldr	r1, [fp, #-2120]
	bl	__aeabi_dsub
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	ldr	r0, [fp, #-2132]
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-2092]
	str	r3, [fp, #-2088]
	ldr	r0, [fp, #-2144]
	bl	__aeabi_i2d
	mov	r4, r0
	mov	r5, r1
	ldr	r0, [fp, #-2132]
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	ldr	r2, [fp, #-2100]
	ldr	r3, [fp, #-2096]
	ldr	r0, [fp, #-2092]
	ldr	r1, [fp, #-2088]
	bl	__aeabi_dsub
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-2084]
	str	r3, [fp, #-2080]
	ldr	r2, [fp, #-2108]
	ldr	r3, [fp, #-2104]
	ldr	r0, [fp, #-2084]
	ldr	r1, [fp, #-2080]
	bl	__aeabi_dcmpgt
	mov	r3, r0
	cmp	r3, #0
	beq	.L26
	ldr	r2, [fp, #-2084]
	ldr	r3, [fp, #-2080]
	str	r2, [fp, #-2108]
	str	r3, [fp, #-2104]
	ldr	r3, [fp, #-2160]
	add	r3, r3, #1
	str	r3, [fp, #-2172]
.L26:
	ldr	r3, [fp, #16]
	and	r3, r3, #1
	cmp	r3, #0
	beq	.L23
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-2052]
	cmp	r3, #0
	beq	.L23
	ldr	r3, .L45+4
	ldr	r5, [r3]
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r6, [r3, #-2052]
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r4, [r3, #-1028]
	ldr	r3, [fp, #8]
	ldr	r2, [fp, #12]
	mul	r3, r2, r3
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, [fp, #-2084]
	ldr	r1, [fp, #-2080]
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	str	r2, [sp, #8]
	str	r3, [sp, #12]
	str	r4, [sp]
	mov	r3, r6
	ldr	r2, [fp, #-2160]
	ldr	r1, .L45+20
	mov	r0, r5
	bl	fprintf
	b	.L23
.L43:
	nop
.L23:
	ldr	r3, [fp, #-2160]
	add	r3, r3, #1
	str	r3, [fp, #-2160]
.L21:
	ldr	r3, [fp, #-2160]
	cmp	r3, #254
	ble	.L28
	b	.L25
.L44:
	nop
.L25:
	mov	r3, #0
	str	r3, [fp, #-2152]
	mov	r3, #0
	str	r3, [fp, #-2160]
	b	.L29
.L30:
	ldr	r3, [fp, #-2160]
	lsl	r3, r3, #2
	sub	r2, fp, #20
	add	r3, r2, r3
	ldr	r3, [r3, #-2052]
	ldr	r2, [fp, #-2152]
	add	r3, r2, r3
	str	r3, [fp, #-2152]
	ldr	r3, [fp, #-2160]
	add	r3, r3, #1
	str	r3, [fp, #-2160]
.L29:
	ldr	r2, [fp, #-2160]
	ldr	r3, [fp, #-2172]
	cmp	r2, r3
	blt	.L30
	ldr	r2, [fp, #-2156]
	ldr	r3, [fp, #-2152]
	sub	r3, r2, r3
	str	r3, [fp, #-2128]
	ldr	r2, [fp, #-2172]
	ldr	r3, [fp, #-2136]
	cmp	r2, r3
	ble	.L31
	ldr	r3, .L45+4
	ldr	r3, [r3]
	mov	r2, #25
	mov	r1, #1
	ldr	r0, .L45+24
	bl	fwrite
	ldr	r3, [fp, #-2136]
	str	r3, [fp, #-2172]
.L31:
	ldr	r2, [fp, #-2172]
	ldr	r3, [fp, #-2140]
	cmp	r2, r3
	bgt	.L32
	ldr	r3, .L45+4
	ldr	r3, [r3]
	mov	r2, #25
	mov	r1, #1
	ldr	r0, .L45+28
	bl	fwrite
	ldr	r3, [fp, #-2140]
	add	r3, r3, #1
	str	r3, [fp, #-2172]
.L32:
	ldr	r3, [fp, #16]
	and	r3, r3, #1
	cmp	r3, #0
	beq	.L33
	ldr	r3, .L45+4
	ldr	r0, [r3]
	ldr	r3, [fp, #-2128]
	str	r3, [sp, #12]
	ldr	r3, [fp, #-2152]
	str	r3, [sp, #8]
	ldr	r3, [fp, #-2176]
	str	r3, [sp, #4]
	ldr	r3, [fp, #-2136]
	str	r3, [sp]
	ldr	r3, [fp, #-2140]
	ldr	r2, [fp, #-2172]
	ldr	r1, .L45+32
	bl	fprintf
.L33:
	ldr	r3, [fp, #-2128]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-2152]
	cmp	r2, r3
	blt	.L34
	ldr	r3, [fp, #16]
	and	r3, r3, #1
	cmp	r3, #0
	beq	.L35
	ldr	r3, .L45+4
	ldr	r3, [r3]
	mov	r2, #30
	mov	r1, #1
	ldr	r0, .L45+36
	bl	fwrite
.L35:
	mov	r3, #0
	str	r3, [fp, #-2168]
	b	.L36
.L39:
	ldr	r2, [fp, #4]
	ldr	r3, [fp, #-2168]
	add	r3, r2, r3
	ldr	r2, [fp, #-2200]
	mul	r2, r3, r2
	ldr	r3, [fp, #-2204]
	add	r3, r2, r3
	mov	r2, r3
	ldr	r3, [fp, #-2192]
	add	r3, r3, r2
	str	r3, [fp, #-2180]
	mov	r3, #0
	str	r3, [fp, #-2164]
	b	.L37
.L38:
	ldr	r3, [fp, #-2180]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mvn	r3, r3
	and	r2, r3, #255
	ldr	r3, [fp, #-2180]
	strb	r2, [r3]
	ldr	r3, [fp, #-2180]
	add	r3, r3, #1
	str	r3, [fp, #-2180]
	ldr	r3, [fp, #-2164]
	add	r3, r3, #1
	str	r3, [fp, #-2164]
.L37:
	ldr	r2, [fp, #-2164]
	ldr	r3, [fp, #8]
	cmp	r2, r3
	blt	.L38
	ldr	r3, [fp, #-2168]
	add	r3, r3, #1
	str	r3, [fp, #-2168]
.L36:
	ldr	r2, [fp, #-2168]
	ldr	r3, [fp, #12]
	cmp	r2, r3
	blt	.L39
	ldr	r3, [fp, #-2172]
	rsb	r3, r3, #256
	str	r3, [fp, #-2172]
.L34:
	ldr	r3, [fp, #-2172]
.L40:
	ldr	r2, .L45
	ldr	r1, [r2]
	ldr	r2, [fp, #-24]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L41
	bl	__stack_chk_fail
.L41:
	mov	r0, r3
	sub	sp, fp, #16
	@ sp needed
	pop	{r4, r5, r6, fp, pc}
.L46:
	.align	2
.L45:
	.word	.LC7
	.word	stderr
	.word	.LC0
	.word	.LC1
	.word	-1074790400
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	otsu, .-otsu
	.section	.rodata
	.align	2
.LC8:
	.ascii	"# thresholdValue out of range %d..%d, reset to %d\012"
	.ascii	"\000"
	.global	__aeabi_idiv
	.text
	.align	2
	.global	thresholding
	.syntax unified
	.arm
	.fpu softvfp
	.type	thresholding, %function
thresholding:
	@ args = 16, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	str	r0, [fp, #-40]
	str	r1, [fp, #-44]
	str	r2, [fp, #-48]
	str	r3, [fp, #-52]
	mov	r3, #255
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-16]
	mov	r3, #255
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #4]
	add	r3, r3, #1
	str	r3, [fp, #-28]
	b	.L48
.L53:
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-48]
	mul	r2, r3, r2
	ldr	r3, [fp, #-52]
	add	r3, r2, r3
	add	r3, r3, #1
	ldr	r2, [fp, #-40]
	add	r3, r2, r3
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-52]
	add	r3, r3, #1
	str	r3, [fp, #-24]
	b	.L49
.L52:
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-16]
	cmp	r3, r2
	bge	.L50
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-16]
.L50:
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-20]
	cmp	r3, r2
	ble	.L51
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-20]
.L51:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L49:
	ldr	r2, [fp, #-52]
	ldr	r3, [fp, #8]
	add	r3, r2, r3
	sub	r3, r3, #1
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L52
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L48:
	ldr	r2, [fp, #4]
	ldr	r3, [fp, #12]
	add	r3, r2, r3
	sub	r3, r3, #1
	ldr	r2, [fp, #-28]
	cmp	r2, r3
	blt	.L53
	ldr	r2, [fp, #16]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	ble	.L54
	ldr	r2, [fp, #16]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	ble	.L55
.L54:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-16]
	add	r3, r2, r3
	add	r3, r3, #1
	lsr	r2, r3, #31
	add	r3, r2, r3
	asr	r3, r3, #1
	str	r3, [fp, #16]
	ldr	r3, .L65
	ldr	r0, [r3]
	ldr	r3, [fp, #16]
	str	r3, [sp]
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-20]
	ldr	r1, .L65+4
	bl	fprintf
.L55:
	ldr	r3, [fp, #4]
	str	r3, [fp, #-28]
	b	.L56
.L63:
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-48]
	mul	r2, r3, r2
	ldr	r3, [fp, #-52]
	add	r3, r2, r3
	mov	r2, r3
	ldr	r3, [fp, #-40]
	add	r3, r3, r2
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-52]
	str	r3, [fp, #-24]
	b	.L57
.L62:
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #16]
	cmp	r3, r2
	bgt	.L58
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-16]
	sub	r2, r3, r2
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #4
	mov	r0, r3
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #16]
	sub	r3, r2, r3
	add	r3, r3, #1
	mov	r1, r3
	bl	__aeabi_idiv
	mov	r3, r0
	and	r3, r3, #255
	mvn	r3, r3
	and	r3, r3, #255
	b	.L59
.L58:
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-20]
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #4
	sub	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r0, r2
	ldr	r2, [fp, #16]
	ldr	r3, [fp, #-20]
	sub	r3, r2, r3
	mov	r1, r3
	bl	__aeabi_idiv
	mov	r3, r0
	and	r3, r3, #255
.L59:
	ldr	r2, [fp, #-32]
	strb	r3, [r2]
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	cmp	r3, r2
	bge	.L60
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-8]
.L60:
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	cmp	r3, r2
	ble	.L61
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-12]
.L61:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L57:
	ldr	r2, [fp, #-52]
	ldr	r3, [fp, #8]
	add	r3, r2, r3
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L62
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L56:
	ldr	r2, [fp, #4]
	ldr	r3, [fp, #12]
	add	r3, r2, r3
	ldr	r2, [fp, #-28]
	cmp	r2, r3
	blt	.L63
	mov	r3, #160
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L66:
	.align	2
.L65:
	.word	stderr
	.word	.LC8
	.size	thresholding, .-thresholding
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
