	.file	"161081555.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"w"
.LC1:
	.string	"\346\211\223\345\274\200\346\210\226\345\210\233\345\273\272%s\345\244\261\350\264\245\357\274\201\n"
	.align 8
.LC2:
	.string	"\346\230\240\345\260\204\345\205\261\344\272\253\345\206\205\345\255\230\345\214\272\345\244\261\350\264\245\357\274\201"
.LC3:
	.string	"\346\226\207\344\273\266\345\206\231\345\205\245\345\256\214\346\257\225"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 80
	mov	DWORD PTR -68[rbp], edi
	mov	QWORD PTR -80[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -52[rbp], 0
	mov	DWORD PTR -56[rbp], 1
	mov	rax, QWORD PTR -80[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -48[rbp], eax
	mov	rax, QWORD PTR -80[rbp]
	add	rax, 32
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rax, QWORD PTR -80[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	jne	.L2
	mov	rax, QWORD PTR -80[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	DWORD PTR -32[rbp], 0
	mov	DWORD PTR -28[rbp], 0
	mov	eax, DWORD PTR -48[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	shmat@PLT
	mov	QWORD PTR -24[rbp], rax
	mov	rax, QWORD PTR -24[rbp]
	cmp	rax, -1
	jne	.L4
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	mov	eax, DWORD PTR -44[rbp]
	mov	esi, 1
	mov	edi, eax
	call	P
	mov	rdx, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR -28[rbp]
	imul	eax, eax, 259
	cdqe
	add	rax, 256
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -12[rbp], al
	mov	rdx, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR -28[rbp]
	imul	eax, eax, 259
	cdqe
	add	rax, 257
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -11[rbp], al
	mov	rdx, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR -28[rbp]
	imul	eax, eax, 259
	cdqe
	add	rax, 258
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	mov	BYTE PTR -10[rbp], al
	lea	rax, -12[rbp]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -52[rbp], eax
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	mov	rcx, QWORD PTR -24[rbp]
	mov	edx, DWORD PTR -28[rbp]
	imul	edx, edx, 259
	movsx	rdx, edx
	lea	rdi, [rcx+rdx]
	mov	rdx, QWORD PTR -40[rbp]
	mov	rcx, rdx
	mov	rdx, rax
	mov	esi, 1
	call	fwrite@PLT
	mov	DWORD PTR -52[rbp], eax
	mov	eax, DWORD PTR -44[rbp]
	mov	esi, 0
	mov	edi, eax
	call	V
	cmp	DWORD PTR -52[rbp], 255
	jg	.L5
	mov	DWORD PTR -56[rbp], 0
.L5:
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	fflush@PLT
	mov	eax, DWORD PTR -28[rbp]
	lea	edx, 1[rax]
	movsx	rax, edx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax
	mov	ecx, edx
	sar	ecx, 31
	sub	eax, ecx
	mov	ecx, eax
	sal	ecx, 2
	add	ecx, eax
	mov	eax, edx
	sub	eax, ecx
	mov	DWORD PTR -28[rbp], eax
.L4:
	cmp	DWORD PTR -56[rbp], 0
	jne	.L6
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	fclose@PLT
	lea	rdi, .LC3[rip]
	call	puts@PLT
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	P
	.type	P, @function
P:
.LFB7:
	.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 -24[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, DWORD PTR -24[rbp]
	mov	WORD PTR -14[rbp], ax
	mov	WORD PTR -12[rbp], -1
	mov	WORD PTR -10[rbp], 0
	lea	rcx, -14[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	P, .-P
	.globl	V
	.type	V, @function
V:
.LFB8:
	.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 -24[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, DWORD PTR -24[rbp]
	mov	WORD PTR -14[rbp], ax
	mov	WORD PTR -12[rbp], 1
	mov	WORD PTR -10[rbp], 0
	lea	rcx, -14[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	V, .-V
	.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	"161081555.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"w\000"
	.align	2
.LC1:
	.ascii	"\346\211\223\345\274\200\346\210\226\345\210\233\345"
	.ascii	"\273\272%s\345\244\261\350\264\245\357\274\201\012\000"
	.align	2
.LC2:
	.ascii	"\346\230\240\345\260\204\345\205\261\344\272\253\345"
	.ascii	"\206\205\345\255\230\345\214\272\345\244\261\350\264"
	.ascii	"\245\357\274\201\000"
	.align	2
.LC3:
	.ascii	"\346\226\207\344\273\266\345\206\231\345\205\245\345"
	.ascii	"\256\214\346\257\225\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #48
	str	r0, [fp, #-48]
	str	r1, [fp, #-52]
	ldr	r3, .L8
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-40]
	mov	r3, #1
	str	r3, [fp, #-44]
	ldr	r3, [fp, #-52]
	add	r3, r3, #12
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-36]
	ldr	r3, [fp, #-52]
	add	r3, r3, #16
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-32]
	ldr	r3, [fp, #-52]
	add	r3, r3, #8
	ldr	r3, [r3]
	ldr	r1, .L8+4
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L2
	ldr	r3, [fp, #-52]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L8+8
	bl	printf
	mov	r0, #1
	bl	exit
.L2:
	mov	r3, #0
	str	r3, [fp, #-24]
	mov	r3, #0
	str	r3, [fp, #-20]
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-36]
	bl	shmat
	mov	r3, r0
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L8+12
	bl	puts
	mov	r0, #1
	bl	exit
.L6:
	mov	r1, #1
	ldr	r0, [fp, #-32]
	bl	P
	ldr	r1, [fp, #-16]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #7
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	add	r3, r3, #256
	add	r3, r1, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	strb	r3, [fp, #-12]
	ldr	r1, [fp, #-16]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #7
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	add	r3, r3, #256
	add	r3, r3, #1
	add	r3, r1, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	strb	r3, [fp, #-11]
	ldr	r1, [fp, #-16]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #7
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	add	r3, r3, #256
	add	r3, r3, #2
	add	r3, r1, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	strb	r3, [fp, #-10]
	sub	r3, fp, #12
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-40]
	ldr	r1, [fp, #-16]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #7
	add	r3, r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	add	r0, r1, r3
	ldr	r2, [fp, #-40]
	ldr	r3, [fp, #-28]
	mov	r1, #1
	bl	fwrite
	mov	r3, r0
	str	r3, [fp, #-40]
	mov	r1, #0
	ldr	r0, [fp, #-32]
	bl	V
	ldr	r3, [fp, #-40]
	cmp	r3, #255
	bgt	.L5
	mov	r3, #0
	str	r3, [fp, #-44]
.L5:
	ldr	r0, [fp, #-28]
	bl	fflush
	ldr	r3, [fp, #-20]
	add	r1, r3, #1
	ldr	r3, .L8+16
	smull	r2, r3, r1, r3
	asr	r2, r3, #1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	sub	r2, r1, r3
	str	r2, [fp, #-20]
.L4:
	ldr	r3, [fp, #-44]
	cmp	r3, #0
	bne	.L6
	ldr	r0, [fp, #-28]
	bl	fclose
	ldr	r0, .L8+20
	bl	puts
	mov	r0, #0
	bl	exit
.L9:
	.align	2
.L8:
	.word	.LC4
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	1717986919
	.word	.LC3
	.size	main, .-main
	.section	.rodata
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	P
	.syntax unified
	.arm
	.fpu softvfp
	.type	P, %function
P:
	@ 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]
	str	r1, [fp, #-28]
	ldr	r3, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	strh	r3, [fp, #-16]	@ movhi
	mvn	r3, #0
	strh	r3, [fp, #-14]	@ movhi
	mov	r3, #0
	strh	r3, [fp, #-12]	@ movhi
	sub	r3, fp, #16
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	semop
	nop
	ldr	r3, .L12
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L11
	bl	__stack_chk_fail
.L11:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	.LC5
	.size	P, .-P
	.section	.rodata
	.align	2
.LC6:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	V
	.syntax unified
	.arm
	.fpu softvfp
	.type	V, %function
V:
	@ 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]
	str	r1, [fp, #-28]
	ldr	r3, .L16
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	strh	r3, [fp, #-16]	@ movhi
	mov	r3, #1
	strh	r3, [fp, #-14]	@ movhi
	mov	r3, #0
	strh	r3, [fp, #-12]	@ movhi
	sub	r3, fp, #16
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	semop
	nop
	ldr	r3, .L16
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L15
	bl	__stack_chk_fail
.L15:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L17:
	.align	2
.L16:
	.word	.LC6
	.size	V, .-V
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
