	.file	"560204.c"
	.intel_syntax noprefix
	.text
	.globl	max_happiness
	.bss
	.align 4
	.type	max_happiness, @object
	.size	max_happiness, 4
max_happiness:
	.zero	4
	.text
	.globl	calculate
	.type	calculate, @function
calculate:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	QWORD PTR -40[rbp], rdx
	mov	DWORD PTR -8[rbp], 0
	mov	DWORD PTR -4[rbp], 0
	jmp	.L2
.L3:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	mov	rcx, QWORD PTR [rax]
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	cdq
	idiv	DWORD PTR -28[rbp]
	mov	eax, edx
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	cdqe
	sal	rax, 2
	add	rax, rcx
	mov	ecx, DWORD PTR [rax]
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	cdq
	idiv	DWORD PTR -28[rbp]
	mov	eax, edx
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	mov	rdx, QWORD PTR [rax]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rsi, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rsi
	mov	eax, DWORD PTR [rax]
	cdqe
	sal	rax, 2
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	add	eax, ecx
	add	DWORD PTR -8[rbp], eax
	add	DWORD PTR -4[rbp], 1
.L2:
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L3
	mov	eax, DWORD PTR max_happiness[rip]
	cmp	DWORD PTR -8[rbp], eax
	cmovge	eax, DWORD PTR -8[rbp]
	mov	DWORD PTR max_happiness[rip], eax
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	calculate, .-calculate
	.globl	swap
	.type	swap, @function
swap:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	DWORD PTR -32[rbp], edx
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	edx, DWORD PTR -28[rbp]
	movsx	rdx, edx
	lea	rcx, 0[0+rdx*4]
	mov	rdx, QWORD PTR -24[rbp]
	add	rdx, rcx
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR [rdx], eax
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -24[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR [rdx], eax
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap, .-swap
	.globl	permute
	.type	permute, @function
permute:
.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, 48
	mov	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	DWORD PTR -32[rbp], edx
	mov	QWORD PTR -40[rbp], rcx
	cmp	DWORD PTR -28[rbp], 1
	jne	.L6
	mov	rdx, QWORD PTR -40[rbp]
	mov	ecx, DWORD PTR -32[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, ecx
	mov	rdi, rax
	call	calculate
	jmp	.L5
.L6:
	mov	DWORD PTR -4[rbp], 0
	jmp	.L8
.L11:
	mov	eax, DWORD PTR -28[rbp]
	lea	esi, -1[rax]
	mov	rcx, QWORD PTR -40[rbp]
	mov	edx, DWORD PTR -32[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	permute
	mov	eax, DWORD PTR -28[rbp]
	cdq
	shr	edx, 31
	add	eax, edx
	and	eax, 1
	sub	eax, edx
	cmp	eax, 1
	jne	.L9
	mov	eax, DWORD PTR -28[rbp]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	swap
	jmp	.L10
.L9:
	mov	eax, DWORD PTR -28[rbp]
	lea	edx, -1[rax]
	mov	ecx, DWORD PTR -4[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, ecx
	mov	rdi, rax
	call	swap
.L10:
	add	DWORD PTR -4[rbp], 1
.L8:
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L11
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	permute, .-permute
	.globl	heap_permutation_start
	.type	heap_permutation_start, @function
heap_permutation_start:
.LFB9:
	.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	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	eax, DWORD PTR -28[rbp]
	cdqe
	sal	rax, 3
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	DWORD PTR -12[rbp], 0
	jmp	.L13
.L14:
	mov	eax, DWORD PTR -12[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -12[rbp]
	mov	DWORD PTR [rdx], eax
	add	DWORD PTR -12[rbp], 1
.L13:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L14
	mov	rcx, QWORD PTR -24[rbp]
	mov	edx, DWORD PTR -28[rbp]
	mov	esi, DWORD PTR -28[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	permute
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	heap_permutation_start, .-heap_permutation_start
	.section	.rodata
.LC0:
	.string	" "
	.text
	.globl	number_of_people
	.type	number_of_people, @function
number_of_people:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 160
	mov	QWORD PTR -152[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -132[rbp], 0
	jmp	.L16
.L20:
	lea	rax, -96[rbp]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	call	strcspn@PLT
	mov	BYTE PTR -96[rbp+rax], 0
	cmp	DWORD PTR -132[rbp], 0
	jne	.L17
	lea	rdx, -96[rbp]
	lea	rax, -128[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcpy@PLT
	jmp	.L18
.L17:
	lea	rdx, -128[rbp]
	lea	rax, -96[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L23
.L18:
	add	DWORD PTR -132[rbp], 1
.L16:
	mov	rdx, QWORD PTR -152[rbp]
	lea	rax, -96[rbp]
	mov	esi, 80
	mov	rdi, rax
	call	fgets@PLT
	test	rax, rax
	jne	.L20
	jmp	.L19
.L23:
	nop
.L19:
	mov	eax, DWORD PTR -132[rbp]
	add	eax, 1
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	number_of_people, .-number_of_people
	.section	.rodata
	.align 8
.LC1:
	.string	"%s would gain %d happiness units by sitting next to %s"
	.align 8
.LC2:
	.string	"%s would lose %d happiness units by sitting next to %sn"
	.text
	.globl	build_grid
	.type	build_grid, @function
build_grid:
.LFB11:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 216
	.cfi_offset 3, -24
	mov	QWORD PTR -216[rbp], rdi
	mov	DWORD PTR -220[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -24[rbp], rax
	xor	eax, eax
	mov	eax, DWORD PTR -220[rbp]
	cdqe
	sal	rax, 3
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -184[rbp], rax
	mov	DWORD PTR -200[rbp], 0
	jmp	.L25
.L28:
	mov	eax, DWORD PTR -220[rbp]
	cdqe
	sal	rax, 2
	mov	edx, DWORD PTR -200[rbp]
	movsx	rdx, edx
	lea	rcx, 0[0+rdx*8]
	mov	rdx, QWORD PTR -184[rbp]
	lea	rbx, [rcx+rdx]
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR [rbx], rax
	mov	DWORD PTR -196[rbp], 0
	jmp	.L26
.L27:
	mov	eax, DWORD PTR -200[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -184[rbp]
	add	rax, rdx
	mov	rdx, QWORD PTR [rax]
	mov	eax, DWORD PTR -196[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	mov	DWORD PTR [rax], 0
	add	DWORD PTR -196[rbp], 1
.L26:
	mov	eax, DWORD PTR -196[rbp]
	cmp	eax, DWORD PTR -220[rbp]
	jl	.L27
	add	DWORD PTR -200[rbp], 1
.L25:
	mov	eax, DWORD PTR -200[rbp]
	cmp	eax, DWORD PTR -220[rbp]
	jl	.L28
	mov	rax, QWORD PTR -216[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	rdi, rax
	call	fseek@PLT
	jmp	.L29
.L33:
	lea	rax, -112[rbp]
	mov	rdi, rax
	call	strlen@PLT
	sub	rax, 2
	mov	BYTE PTR -112[rbp+rax], 0
	lea	rsi, -144[rbp]
	lea	rcx, -204[rbp]
	lea	rdx, -176[rbp]
	lea	rax, -112[rbp]
	mov	r8, rsi
	lea	rsi, .LC1[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	cmp	eax, 3
	je	.L30
	lea	rsi, -144[rbp]
	lea	rcx, -204[rbp]
	lea	rdx, -176[rbp]
	lea	rax, -112[rbp]
	mov	r8, rsi
	lea	rsi, .LC2[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	mov	eax, DWORD PTR -204[rbp]
	neg	eax
	mov	DWORD PTR -204[rbp], eax
.L30:
	movzx	eax, BYTE PTR -176[rbp]
	cmp	al, 77
	jne	.L31
	mov	BYTE PTR -176[rbp], 72
.L31:
	movzx	eax, BYTE PTR -144[rbp]
	cmp	al, 77
	jne	.L32
	mov	BYTE PTR -144[rbp], 72
.L32:
	movzx	eax, BYTE PTR -176[rbp]
	movsx	eax, al
	sub	eax, 65
	mov	DWORD PTR -192[rbp], eax
	movzx	eax, BYTE PTR -144[rbp]
	movsx	eax, al
	sub	eax, 65
	mov	DWORD PTR -188[rbp], eax
	mov	eax, DWORD PTR -192[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -184[rbp]
	add	rax, rdx
	mov	rdx, QWORD PTR [rax]
	mov	eax, DWORD PTR -188[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	mov	eax, DWORD PTR -204[rbp]
	mov	DWORD PTR [rdx], eax
.L29:
	mov	rdx, QWORD PTR -216[rbp]
	lea	rax, -112[rbp]
	mov	esi, 80
	mov	rdi, rax
	call	fgets@PLT
	test	rax, rax
	jne	.L33
	mov	rax, QWORD PTR -184[rbp]
	mov	rbx, QWORD PTR -24[rbp]
	sub	rbx, QWORD PTR fs:40
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	build_grid, .-build_grid
	.section	.rodata
.LC3:
	.string	"r"
.LC4:
	.string	"13-input.txt"
.LC5:
	.string	"13-input.txt: unable to read"
.LC6:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.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
	lea	rsi, .LC3[rip]
	lea	rdi, .LC4[rip]
	call	fopen@PLT
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], 0
	jne	.L37
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 28
	mov	esi, 1
	lea	rdi, .LC5[rip]
	call	fwrite@PLT
	mov	eax, 1
	jmp	.L38
.L37:
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	number_of_people
	mov	DWORD PTR -20[rbp], eax
	mov	eax, DWORD PTR -20[rbp]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, edx
	mov	rdi, rax
	call	build_grid
	mov	QWORD PTR -8[rbp], rax
	mov	DWORD PTR max_happiness[rip], 0
	mov	edx, DWORD PTR -20[rbp]
	mov	rax, QWORD PTR -8[rbp]
	mov	esi, edx
	mov	rdi, rax
	call	heap_permutation_start
	mov	eax, DWORD PTR max_happiness[rip]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR max_happiness[rip], 0
	mov	eax, DWORD PTR -20[rbp]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	esi, edx
	mov	rdi, rax
	call	heap_permutation_start
	mov	eax, DWORD PTR max_happiness[rip]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
.L38:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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	"560204.c"
	.text
	.comm	max_happiness,4,4
	.global	__aeabi_idivmod
	.align	2
	.global	calculate
	.syntax unified
	.arm
	.fpu softvfp
	.type	calculate, %function
calculate:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #28
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	str	r2, [fp, #-32]
	mov	r3, #0
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L2
.L3:
	ldr	r3, [fp, #-16]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-24]
	add	r3, r2, r3
	ldr	r3, [r3]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-32]
	add	r3, r2, r3
	ldr	r4, [r3]
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	ldr	r1, [fp, #-28]
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	lsl	r3, r3, #2
	ldr	r2, [fp, #-24]
	add	r3, r2, r3
	ldr	r3, [r3]
	lsl	r3, r3, #2
	add	r3, r4, r3
	ldr	r4, [r3]
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	ldr	r1, [fp, #-28]
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	lsl	r3, r3, #2
	ldr	r2, [fp, #-24]
	add	r3, r2, r3
	ldr	r3, [r3]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-32]
	add	r3, r2, r3
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	lsl	r3, r3, #2
	ldr	r1, [fp, #-24]
	add	r3, r1, r3
	ldr	r3, [r3]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r3, [r3]
	add	r3, r4, r3
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L2:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L3
	ldr	r3, .L4
	ldr	r2, [r3]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	movge	r3, r2
	movlt	r3, r3
	ldr	r2, .L4
	str	r3, [r2]
	nop
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L5:
	.align	2
.L4:
	.word	max_happiness
	.size	calculate, .-calculate
	.align	2
	.global	swap
	.syntax unified
	.arm
	.fpu softvfp
	.type	swap, %function
swap:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #28
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	str	r2, [fp, #-24]
	ldr	r3, [fp, #-20]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-24]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-16]
	add	r2, r2, r3
	ldr	r3, [fp, #-20]
	lsl	r3, r3, #2
	ldr	r1, [fp, #-16]
	add	r3, r1, r3
	ldr	r2, [r2]
	str	r2, [r3]
	ldr	r3, [fp, #-24]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldr	r2, [fp, #-8]
	str	r2, [r3]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	swap, .-swap
	.align	2
	.global	permute
	.syntax unified
	.arm
	.fpu softvfp
	.type	permute, %function
permute:
	@ 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, #-16]
	str	r1, [fp, #-20]
	str	r2, [fp, #-24]
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-20]
	cmp	r3, #1
	bne	.L8
	ldr	r2, [fp, #-28]
	ldr	r1, [fp, #-24]
	ldr	r0, [fp, #-16]
	bl	calculate
	b	.L7
.L8:
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L10
.L13:
	ldr	r3, [fp, #-20]
	sub	r1, r3, #1
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-24]
	ldr	r0, [fp, #-16]
	bl	permute
	ldr	r3, [fp, #-20]
	cmp	r3, #0
	and	r3, r3, #1
	rsblt	r3, r3, #0
	cmp	r3, #1
	bne	.L11
	ldr	r3, [fp, #-20]
	sub	r3, r3, #1
	mov	r2, r3
	mov	r1, #0
	ldr	r0, [fp, #-16]
	bl	swap
	b	.L12
.L11:
	ldr	r3, [fp, #-20]
	sub	r3, r3, #1
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, [fp, #-16]
	bl	swap
.L12:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L10:
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L13
.L7:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	permute, .-permute
	.align	2
	.global	heap_permutation_start
	.syntax unified
	.arm
	.fpu softvfp
	.type	heap_permutation_start, %function
heap_permutation_start:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, [fp, #-20]
	lsl	r3, r3, #2
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-8]
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L15
.L16:
	ldr	r3, [fp, #-12]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-8]
	add	r3, r2, r3
	ldr	r2, [fp, #-12]
	str	r2, [r3]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L15:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	blt	.L16
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-20]
	ldr	r1, [fp, #-20]
	ldr	r0, [fp, #-8]
	bl	permute
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	heap_permutation_start, .-heap_permutation_start
	.section	.rodata
	.align	2
.LC0:
	.ascii	" \000"
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	number_of_people
	.syntax unified
	.arm
	.fpu softvfp
	.type	number_of_people, %function
number_of_people:
	@ args = 0, pretend = 0, frame = 128
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #128
	str	r0, [fp, #-128]
	ldr	r3, .L26
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-124]
	b	.L18
.L22:
	sub	r3, fp, #88
	ldr	r1, .L26+4
	mov	r0, r3
	bl	strcspn
	mov	r3, r0
	sub	r2, fp, #4
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3, #-84]
	ldr	r3, [fp, #-124]
	cmp	r3, #0
	bne	.L19
	sub	r2, fp, #88
	sub	r3, fp, #120
	mov	r1, r2
	mov	r0, r3
	bl	strcpy
	b	.L20
.L19:
	sub	r2, fp, #120
	sub	r3, fp, #88
	mov	r1, r2
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L25
.L20:
	ldr	r3, [fp, #-124]
	add	r3, r3, #1
	str	r3, [fp, #-124]
.L18:
	sub	r3, fp, #88
	ldr	r2, [fp, #-128]
	mov	r1, #80
	mov	r0, r3
	bl	fgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L22
	b	.L21
.L25:
	nop
.L21:
	ldr	r3, [fp, #-124]
	add	r3, r3, #1
	ldr	r2, .L26
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L24
	bl	__stack_chk_fail
.L24:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L27:
	.align	2
.L26:
	.word	.LC1
	.word	.LC0
	.size	number_of_people, .-number_of_people
	.section	.rodata
	.align	2
.LC2:
	.ascii	"%s would gain %d happiness units by sitting next to"
	.ascii	" %s\000"
	.align	2
.LC3:
	.ascii	"%s would lose %d happiness units by sitting next to"
	.ascii	" %sn\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	build_grid
	.syntax unified
	.arm
	.fpu softvfp
	.type	build_grid, %function
build_grid:
	@ args = 0, pretend = 0, frame = 160
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #172
	str	r0, [fp, #-168]
	str	r1, [fp, #-172]
	ldr	r3, .L40
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	ldr	r3, [fp, #-172]
	lsl	r3, r3, #2
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-148]
	mov	r3, #0
	str	r3, [fp, #-156]
	b	.L29
.L32:
	ldr	r3, [fp, #-172]
	lsl	r1, r3, #2
	ldr	r3, [fp, #-156]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-148]
	add	r4, r2, r3
	mov	r0, r1
	bl	malloc
	mov	r3, r0
	str	r3, [r4]
	mov	r3, #0
	str	r3, [fp, #-152]
	b	.L30
.L31:
	ldr	r3, [fp, #-156]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-148]
	add	r3, r2, r3
	ldr	r2, [r3]
	ldr	r3, [fp, #-152]
	lsl	r3, r3, #2
	add	r3, r2, r3
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-152]
	add	r3, r3, #1
	str	r3, [fp, #-152]
.L30:
	ldr	r2, [fp, #-152]
	ldr	r3, [fp, #-172]
	cmp	r2, r3
	blt	.L31
	ldr	r3, [fp, #-156]
	add	r3, r3, #1
	str	r3, [fp, #-156]
.L29:
	ldr	r2, [fp, #-156]
	ldr	r3, [fp, #-172]
	cmp	r2, r3
	blt	.L32
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-168]
	bl	fseek
	b	.L33
.L37:
	sub	r3, fp, #96
	mov	r0, r3
	bl	strlen
	mov	r3, r0
	sub	r3, r3, #2
	sub	r2, fp, #12
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3, #-84]
	sub	r1, fp, #160
	sub	r2, fp, #136
	sub	r0, fp, #96
	sub	r3, fp, #116
	str	r3, [sp]
	mov	r3, r1
	ldr	r1, .L40+4
	bl	__isoc99_sscanf
	mov	r3, r0
	cmp	r3, #3
	beq	.L34
	sub	r1, fp, #160
	sub	r2, fp, #136
	sub	r0, fp, #96
	sub	r3, fp, #116
	str	r3, [sp]
	mov	r3, r1
	ldr	r1, .L40+8
	bl	__isoc99_sscanf
	ldr	r3, [fp, #-160]
	rsb	r3, r3, #0
	str	r3, [fp, #-160]
.L34:
	ldrb	r3, [fp, #-136]	@ zero_extendqisi2
	cmp	r3, #77
	bne	.L35
	mov	r3, #72
	strb	r3, [fp, #-136]
.L35:
	ldrb	r3, [fp, #-116]	@ zero_extendqisi2
	cmp	r3, #77
	bne	.L36
	mov	r3, #72
	strb	r3, [fp, #-116]
.L36:
	ldrb	r3, [fp, #-136]	@ zero_extendqisi2
	sub	r3, r3, #65
	str	r3, [fp, #-144]
	ldrb	r3, [fp, #-116]	@ zero_extendqisi2
	sub	r3, r3, #65
	str	r3, [fp, #-140]
	ldr	r3, [fp, #-144]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-148]
	add	r3, r2, r3
	ldr	r2, [r3]
	ldr	r3, [fp, #-140]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, [fp, #-160]
	str	r2, [r3]
.L33:
	sub	r3, fp, #96
	ldr	r2, [fp, #-168]
	mov	r1, #80
	mov	r0, r3
	bl	fgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L37
	ldr	r3, [fp, #-148]
	ldr	r2, .L40
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L39
	bl	__stack_chk_fail
.L39:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L41:
	.align	2
.L40:
	.word	.LC4
	.word	.LC2
	.word	.LC3
	.size	build_grid, .-build_grid
	.section	.rodata
	.align	2
.LC5:
	.ascii	"r\000"
	.align	2
.LC6:
	.ascii	"13-input.txt\000"
	.align	2
.LC7:
	.ascii	"13-input.txt: unable to read\000"
	.align	2
.LC8:
	.ascii	"%d\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	ldr	r1, .L45
	ldr	r0, .L45+4
	bl	fopen
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	bne	.L43
	ldr	r3, .L45+8
	ldr	r3, [r3]
	mov	r2, #28
	mov	r1, #1
	ldr	r0, .L45+12
	bl	fwrite
	mov	r3, #1
	b	.L44
.L43:
	ldr	r0, [fp, #-16]
	bl	number_of_people
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, [fp, #-16]
	bl	build_grid
	str	r0, [fp, #-8]
	ldr	r3, .L45+16
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, [fp, #-12]
	ldr	r0, [fp, #-8]
	bl	heap_permutation_start
	ldr	r3, .L45+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L45+20
	bl	printf
	ldr	r3, .L45+16
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, [fp, #-8]
	bl	heap_permutation_start
	ldr	r3, .L45+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L45+20
	bl	printf
	mov	r3, #0
.L44:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L46:
	.align	2
.L45:
	.word	.LC5
	.word	.LC6
	.word	stderr
	.word	.LC7
	.word	max_happiness
	.word	.LC8
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
