	.file	"196138.c"
	.intel_syntax noprefix
	.text
	.globl	check
	.bss
	.align 32
	.type	check, @object
	.size	check, 500
check:
	.zero	500
	.globl	arr
	.align 32
	.type	arr, @object
	.size	arr, 500000
arr:
	.zero	500000
	.globl	last
	.align 32
	.type	last, @object
	.size	last, 1000
last:
	.zero	1000
	.globl	times
	.align 32
	.type	times, @object
	.size	times, 1000
times:
	.zero	1000
	.globl	nums
	.align 32
	.type	nums, @object
	.size	nums, 2000
nums:
	.zero	2000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	tmp
	.align 4
	.type	tmp, @object
	.size	tmp, 4
tmp:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.text
	.globl	calc
	.type	calc, @function
calc:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	DWORD PTR -12[rbp], 0
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, 1
	cdqe
	lea	rdx, check[rip]
	mov	BYTE PTR [rax+rdx], 1
	mov	DWORD PTR -8[rbp], 0
	jmp	.L2
.L6:
	mov	eax, DWORD PTR -20[rbp]
	lea	edx, -1[rax]
	mov	eax, DWORD PTR -8[rbp]
	movsx	rcx, eax
	movsx	rax, edx
	imul	rax, rax, 500
	add	rax, rcx
	lea	rdx, [rax+rax]
	lea	rax, arr[rip]
	movzx	eax, WORD PTR [rdx+rax]
	cwde
	sub	eax, 1
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, nums[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	je	.L3
	mov	eax, DWORD PTR -20[rbp]
	lea	edx, -1[rax]
	mov	eax, DWORD PTR -8[rbp]
	movsx	rcx, eax
	movsx	rax, edx
	imul	rax, rax, 500
	add	rax, rcx
	lea	rdx, [rax+rax]
	lea	rax, arr[rip]
	movzx	eax, WORD PTR [rdx+rax]
	cwde
	sub	eax, 1
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, nums[rip]
	mov	eax, DWORD PTR [rdx+rax]
	jmp	.L4
.L3:
	mov	eax, DWORD PTR -20[rbp]
	lea	edx, -1[rax]
	mov	eax, DWORD PTR -8[rbp]
	movsx	rcx, eax
	movsx	rax, edx
	imul	rax, rax, 500
	add	rax, rcx
	lea	rdx, [rax+rax]
	lea	rax, arr[rip]
	movzx	eax, WORD PTR [rdx+rax]
	cwde
	mov	edi, eax
	call	calc
.L4:
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -12[rbp]
	jle	.L5
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR -12[rbp], eax
.L5:
	add	DWORD PTR -8[rbp], 1
.L2:
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, 1
	cdqe
	lea	rdx, [rax+rax]
	lea	rax, last[rip]
	movzx	eax, WORD PTR [rdx+rax]
	cwde
	cmp	DWORD PTR -8[rbp], eax
	jl	.L6
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, 1
	cdqe
	lea	rdx, [rax+rax]
	lea	rax, times[rip]
	movzx	eax, WORD PTR [rdx+rax]
	movsx	ecx, ax
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, 1
	mov	edx, DWORD PTR -12[rbp]
	lea	esi, [rcx+rdx]
	movsx	rdx, eax
	lea	rcx, 0[0+rdx*4]
	lea	rdx, nums[rip]
	mov	DWORD PTR [rcx+rdx], esi
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, nums[rip]
	mov	eax, DWORD PTR [rdx+rax]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 16
	lea	rsi, n[rip]
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR i[rip], 0
	jmp	.L9
.L13:
	mov	eax, DWORD PTR i[rip]
	cdqe
	lea	rdx, [rax+rax]
	lea	rax, times[rip]
	add	rax, rdx
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR j[rip], 0
	jmp	.L10
.L12:
	mov	eax, DWORD PTR j[rip]
	add	eax, 1
	mov	DWORD PTR j[rip], eax
.L10:
	mov	eax, DWORD PTR i[rip]
	mov	edx, DWORD PTR j[rip]
	movsx	rdx, edx
	cdqe
	imul	rax, rax, 500
	add	rax, rdx
	lea	rdx, [rax+rax]
	lea	rax, arr[rip]
	add	rax, rdx
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	test	eax, eax
	je	.L11
	mov	eax, DWORD PTR i[rip]
	mov	edx, DWORD PTR j[rip]
	movsx	rdx, edx
	cdqe
	imul	rax, rax, 500
	add	rax, rdx
	lea	rdx, [rax+rax]
	lea	rax, arr[rip]
	movzx	eax, WORD PTR [rdx+rax]
	cmp	ax, -1
	jne	.L12
.L11:
	mov	edx, DWORD PTR j[rip]
	mov	eax, DWORD PTR i[rip]
	mov	ecx, edx
	cdqe
	lea	rdx, [rax+rax]
	lea	rax, last[rip]
	mov	WORD PTR [rdx+rax], cx
	mov	eax, DWORD PTR i[rip]
	add	eax, 1
	mov	DWORD PTR i[rip], eax
.L9:
	mov	edx, DWORD PTR i[rip]
	mov	eax, DWORD PTR n[rip]
	cmp	edx, eax
	jl	.L13
	mov	eax, DWORD PTR n[rip]
	mov	edi, eax
	call	calc
	mov	eax, DWORD PTR n[rip]
	sub	eax, 1
	mov	DWORD PTR -4[rbp], eax
	jmp	.L14
.L16:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, check[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	test	al, al
	jne	.L15
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	mov	edi, eax
	call	calc
.L15:
	sub	DWORD PTR -4[rbp], 1
.L14:
	cmp	DWORD PTR -4[rbp], 0
	jns	.L16
	mov	DWORD PTR i[rip], 0
	jmp	.L17
.L18:
	mov	eax, DWORD PTR i[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, nums[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR i[rip]
	add	eax, 1
	mov	DWORD PTR i[rip], eax
.L17:
	mov	edx, DWORD PTR i[rip]
	mov	eax, DWORD PTR n[rip]
	cmp	edx, eax
	jl	.L18
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.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	"196138.c"
	.text
	.comm	check,500,4
	.global	arr
	.bss
	.align	2
	.type	arr, %object
	.size	arr, 500000
arr:
	.space	500000
	.global	last
	.align	2
	.type	last, %object
	.size	last, 1000
last:
	.space	1000
	.global	times
	.align	2
	.type	times, %object
	.size	times, 1000
times:
	.space	1000
	.global	nums
	.align	2
	.type	nums, %object
	.size	nums, 2000
nums:
	.space	2000
	.comm	n,4,4
	.comm	max,4,4
	.comm	tmp,4,4
	.comm	i,4,4
	.comm	j,4,4
	.text
	.align	2
	.global	calc
	.syntax unified
	.arm
	.fpu softvfp
	.type	calc, %function
calc:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	mov	r3, #0
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-24]
	sub	r3, r3, #1
	ldr	r2, .L8
	mov	r1, #1
	strb	r1, [r2, r3]
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L2
.L6:
	ldr	r3, [fp, #-24]
	sub	r2, r3, #1
	ldr	r1, .L8+4
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	ldr	r2, [fp, #-12]
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r1, r3
	ldrsh	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L8+8
	ldr	r3, [r2, r3, lsl #2]
	cmp	r3, #0
	beq	.L3
	ldr	r3, [fp, #-24]
	sub	r2, r3, #1
	ldr	r1, .L8+4
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	ldr	r2, [fp, #-12]
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r1, r3
	ldrsh	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L8+8
	ldr	r3, [r2, r3, lsl #2]
	b	.L4
.L3:
	ldr	r3, [fp, #-24]
	sub	r2, r3, #1
	ldr	r1, .L8+4
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	ldr	r2, [fp, #-12]
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r1, r3
	ldrsh	r3, [r3]
	mov	r0, r3
	bl	calc
	mov	r3, r0
.L4:
	str	r3, [fp, #-8]
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	ble	.L5
	ldr	r3, [fp, #-8]
	str	r3, [fp, #-16]
.L5:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L2:
	ldr	r3, [fp, #-24]
	sub	r3, r3, #1
	ldr	r2, .L8+12
	lsl	r3, r3, #1
	add	r3, r2, r3
	ldrsh	r3, [r3]
	mov	r2, r3
	ldr	r3, [fp, #-12]
	cmp	r3, r2
	blt	.L6
	ldr	r3, [fp, #-24]
	sub	r3, r3, #1
	ldr	r2, .L8+16
	lsl	r3, r3, #1
	add	r3, r2, r3
	ldrsh	r3, [r3]
	mov	r1, r3
	ldr	r3, [fp, #-24]
	sub	r3, r3, #1
	ldr	r2, [fp, #-16]
	add	r2, r1, r2
	ldr	r1, .L8+8
	str	r2, [r1, r3, lsl #2]
	ldr	r2, .L8+8
	ldr	r3, [r2, r3, lsl #2]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L9:
	.align	2
.L8:
	.word	check
	.word	arr
	.word	nums
	.word	last
	.word	times
	.size	calc, .-calc
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%d\000"
	.align	2
.LC1:
	.ascii	"%d\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r1, .L22
	ldr	r0, .L22+4
	bl	__isoc99_scanf
	ldr	r3, .L22+8
	mov	r2, #0
	str	r2, [r3]
	b	.L11
.L15:
	ldr	r3, .L22+8
	ldr	r3, [r3]
	lsl	r3, r3, #1
	ldr	r2, .L22+12
	add	r3, r3, r2
	mov	r1, r3
	ldr	r0, .L22+4
	bl	__isoc99_scanf
	ldr	r3, .L22+16
	mov	r2, #0
	str	r2, [r3]
	b	.L12
.L14:
	ldr	r3, .L22+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L22+16
	str	r3, [r2]
.L12:
	ldr	r3, .L22+8
	ldr	r2, [r3]
	ldr	r3, .L22+16
	ldr	r1, [r3]
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	ldr	r2, .L22+20
	add	r3, r3, r2
	mov	r1, r3
	ldr	r0, .L22+4
	bl	__isoc99_scanf
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	ldr	r3, .L22+8
	ldr	r2, [r3]
	ldr	r3, .L22+16
	ldr	r1, [r3]
	ldr	r0, .L22+20
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	add	r3, r0, r3
	ldrsh	r3, [r3]
	cmn	r3, #1
	bne	.L14
.L13:
	ldr	r3, .L22+16
	ldr	r2, [r3]
	ldr	r3, .L22+8
	ldr	r3, [r3]
	lsl	r2, r2, #16
	asr	r2, r2, #16
	ldr	r1, .L22+24
	lsl	r3, r3, #1
	add	r3, r1, r3
	strh	r2, [r3]	@ movhi
	ldr	r3, .L22+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L22+8
	str	r3, [r2]
.L11:
	ldr	r3, .L22+8
	ldr	r2, [r3]
	ldr	r3, .L22
	ldr	r3, [r3]
	cmp	r2, r3
	blt	.L15
	ldr	r3, .L22
	ldr	r3, [r3]
	mov	r0, r3
	bl	calc
	ldr	r3, .L22
	ldr	r3, [r3]
	sub	r3, r3, #1
	str	r3, [fp, #-8]
	b	.L16
.L18:
	ldr	r2, .L22+28
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L17
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	mov	r0, r3
	bl	calc
.L17:
	ldr	r3, [fp, #-8]
	sub	r3, r3, #1
	str	r3, [fp, #-8]
.L16:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L18
	ldr	r3, .L22+8
	mov	r2, #0
	str	r2, [r3]
	b	.L19
.L20:
	ldr	r3, .L22+8
	ldr	r3, [r3]
	ldr	r2, .L22+32
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, r3
	ldr	r0, .L22+36
	bl	printf
	ldr	r3, .L22+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L22+8
	str	r3, [r2]
.L19:
	ldr	r3, .L22+8
	ldr	r2, [r3]
	ldr	r3, .L22
	ldr	r3, [r3]
	cmp	r2, r3
	blt	.L20
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	n
	.word	.LC0
	.word	i
	.word	times
	.word	j
	.word	arr
	.word	last
	.word	check
	.word	nums
	.word	.LC1
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
