Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define min(a, b) (((a) < (b)) ? (a) : (b))

#define INIT_CAP 10

typedef struct {
	int *to, cap, size;
} AdjList;

typedef struct {
	char name[11];
	int cost;
} Rec;

int n;
AdjList adj[5000];
Rec ing[5000];

void init(int n) {
	int i;
	for (i = 0; i < n; i++) {
		adj[i].to = malloc(sizeof(int) * INIT_CAP);
		adj[i].cap = INIT_CAP;
		adj[i].size = 0;
	}
}

void add(int from, int to) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].to = realloc(adj[from].to, sizeof(int) * adj[from].cap);
	}
	adj[from].to[adj[from].size++] = to;
}

int searchIdx(char str[]) {
	int i;

	for (i = 0; i < n; i++)
		if (!strcmp(str, ing[i].name))
			break;

	return i;
}

int min, visited[5000];

void dfs(int i) {
	int j;

	visited[i] = 1;
	min = min(min, ing[i].cost);

	for (j = 0; j < adj[i].size; j++) {
		int to = adj[i].to[j];
		if (!visited[to])
			dfs(to);
	}
}

int searchMinCost(int i) {
	min = 100000;
	memset(visited, 0, sizeof visited);

	dfs(i);

	return ing[i].cost = min;
}

int main(void) {
	int i;
	int m;
	int ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%s %d", ing[i].name, &ing[i].cost);

	scanf("%d", &m);
	init(n);
	while (m--) {
		char s[11], t[11];
		int idx_s, idx_t;

		scanf("%s %s", s, t);
		idx_s = searchIdx(s);
		idx_t = searchIdx(t);

		add(idx_s, idx_t);
		add(idx_t, idx_s);
	}

	ans = 0;
	for (i = 0; i < n; i++)
		ans += searchMinCost(i);

	printf("%d\n", ans);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 80000
adj:
	.zero	80000
	.globl	ing
	.align 32
	.type	ing, @object
	.size	ing, 80000
ing:
	.zero	80000
	.text
	.globl	init
	.type	init, @function
init:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	$40, %edi
	call	malloc@PLT
	movq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	$10, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init, .-init
	.globl	add
	.type	add, @function
add:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+adj(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	adj(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L5:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdi
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-4(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	%rcx, %rsi
	salq	$4, %rsi
	leaq	12+adj(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	cltq
	salq	$2, %rax
	leaq	(%rdi,%rax), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	add, .-add
	.globl	searchIdx
	.type	searchIdx, @function
searchIdx:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L7
.L10:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	ing(%rip), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L12
	addl	$1, -4(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L10
	jmp	.L9
.L12:
	nop
.L9:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	searchIdx, .-searchIdx
	.globl	min
	.bss
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	visited
	.align 32
	.type	visited, @object
	.size	visited, 20000
visited:
	.zero	20000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	visited(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+ing(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	min(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, min(%rip)
	movl	$0, -8(%rbp)
	jmp	.L14
.L16:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	visited(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	dfs
.L15:
	addl	$1, -8(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	dfs, .-dfs
	.globl	searchMinCost
	.type	searchMinCost, @function
searchMinCost:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	$100000, min(%rip)
	movl	$20000, %edx
	movl	$0, %esi
	leaq	visited(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	min(%rip), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	12+ing(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+ing(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	searchMinCost, .-searchMinCost
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -48(%rbp)
	jmp	.L20
.L21:
	movl	-48(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	ing(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	ing(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L20:
	movl	n(%rip), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L21
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	%eax, %edi
	call	init
	jmp	.L22
.L23:
	leaq	-19(%rbp), %rdx
	leaq	-30(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-30(%rbp), %rax
	movq	%rax, %rdi
	call	searchIdx
	movl	%eax, -40(%rbp)
	leaq	-19(%rbp), %rax
	movq	%rax, %rdi
	call	searchIdx
	movl	%eax, -36(%rbp)
	movl	-36(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
.L22:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L23
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L24
.L25:
	movl	-48(%rbp), %eax
	movl	%eax, %edi
	call	searchMinCost
	addl	%eax, -44(%rbp)
	addl	$1, -48(%rbp)
.L24:
	movl	n(%rip), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L25
	movl	-44(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.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:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	init
	.type	init, @function
init:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L6
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leal	-1(%rdi), %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	adj(%rip), %rbx
	salq	$4, %rbp
	leaq	16(%rbx), %rax
	addq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$40, %edi
	addq	$16, %rbx
	call	malloc@PLT
	movq	%r12, -8(%rbx)
	movq	%rax, -16(%rbx)
	cmpq	%rbp, %rbx
	jne	.L3
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE51:
	.size	init, .-init
	.p2align 4
	.globl	add
	.type	add, @function
add:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	adj(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edi, %rbx
	movq	%rbx, %rbp
	salq	$4, %rbp
	addq	%r13, %rbp
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movslq	12(%rbp), %rdx
	cmpl	8(%rbp), %edx
	je	.L11
	movq	0(%rbp), %rax
.L12:
	salq	$4, %rbx
	leal	1(%rdx), %ecx
	movl	%ecx, 12(%r13,%rbx)
	movl	%r12d, (%rax,%rdx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	addl	%edx, %edx
	movq	0(%rbp), %rdi
	movl	%edx, 8(%rbp)
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	call	realloc@PLT
	movslq	12(%rbp), %rdx
	movq	%rax, 0(%rbp)
	jmp	.L12
	.cfi_endproc
.LFE52:
	.size	add, .-add
	.p2align 4
	.globl	searchIdx
	.type	searchIdx, @function
searchIdx:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	n(%rip), %r13d
	testl	%r13d, %r13d
	jle	.L17
	movq	%rdi, %rbp
	leaq	ing(%rip), %rbx
	xorl	%r12d, %r12d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %r12d
	addq	$16, %rbx
	cmpl	%r13d, %r12d
	je	.L14
.L16:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L23
.L14:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L14
	.cfi_endproc
.LFE53:
	.size	searchIdx, .-searchIdx
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	visited(%rip), %r9
	leaq	ing(%rip), %r10
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	adj(%rip), %r8
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movl	$1, (%r9,%rdi,4)
	salq	$4, %rdi
	movl	min(%rip), %eax
	movl	12(%r10,%rdi), %edx
	movq	%rdi, 144(%rsp)
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rdi), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L24
	movq	$0, 24(%rsp)
	movq	(%rax), %rax
	movq	%rax, 80(%rsp)
.L53:
	movq	80(%rsp), %rax
	movq	24(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rax
	movl	(%r9,%rax,4), %r14d
	testl	%r14d, %r14d
	je	.L71
.L26:
	addq	$1, 24(%rsp)
	movq	24(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L53
.L24:
	addq	$184, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L71:
	.cfi_restore_state
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rbx
	movq	%rax, 136(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rbx), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rbx), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L70
	movq	$0, 16(%rsp)
	movq	(%rax), %rax
	movq	%rax, 64(%rsp)
.L52:
	movq	64(%rsp), %rax
	movq	16(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rax
	movl	(%r9,%rax,4), %r13d
	testl	%r13d, %r13d
	je	.L72
.L28:
	addq	$1, 16(%rsp)
	movq	16(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L52
.L70:
	movq	144(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L72:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rcx
	movq	%rax, 120(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rcx), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rcx), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L69
	movq	$0, 8(%rsp)
	movq	(%rax), %rax
	movq	%rax, 56(%rsp)
.L51:
	movq	56(%rsp), %rax
	movq	8(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rax
	movl	(%r9,%rax,4), %r12d
	testl	%r12d, %r12d
	je	.L73
.L30:
	addq	$1, 8(%rsp)
	movq	8(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L51
.L69:
	movq	136(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L73:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rsi
	movq	%rax, 104(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rsi), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rsi), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L68
	movq	(%rax), %rax
	xorl	%esi, %esi
	movq	%rax, 48(%rsp)
.L50:
	movq	48(%rsp), %rax
	movslq	(%rax,%rsi,4), %rax
	movl	(%r9,%rax,4), %ebp
	testl	%ebp, %ebp
	je	.L74
.L32:
	addq	$1, %rsi
	cmpl	%esi, %edx
	jg	.L50
.L68:
	movq	120(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L74:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rcx
	movq	%rax, 88(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rcx), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rcx), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L67
	movq	(%rax), %rax
	xorl	%r11d, %r11d
	movq	%rsi, 128(%rsp)
	movq	%r11, %rsi
	movq	%rax, 40(%rsp)
.L49:
	movq	40(%rsp), %rax
	movslq	(%rax,%rsi,4), %rax
	movl	(%r9,%rax,4), %ebx
	testl	%ebx, %ebx
	je	.L75
.L34:
	addq	$1, %rsi
	cmpl	%esi, %edx
	jg	.L49
	movq	128(%rsp), %rsi
.L67:
	movq	104(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L75:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rdi
	movq	%rax, 72(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rdi), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	leaq	(%r8,%rdi), %rdx
	movl	%eax, min(%rip)
	movl	12(%rdx), %eax
	testl	%eax, %eax
	jle	.L66
	movq	(%rdx), %rcx
	movq	%rsi, 112(%rsp)
	movq	%rcx, 32(%rsp)
	xorl	%ecx, %ecx
.L48:
	movq	32(%rsp), %rbx
	movslq	(%rbx,%rcx,4), %r15
	movl	(%r9,%r15,4), %r11d
	testl	%r11d, %r11d
	je	.L76
.L36:
	addq	$1, %rcx
	cmpl	%ecx, %eax
	jg	.L48
	movq	112(%rsp), %rsi
.L66:
	movq	88(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L76:
	movl	$1, (%r9,%r15,4)
	salq	$4, %r15
	movl	min(%rip), %eax
	movl	12(%r10,%r15), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	leaq	(%r8,%r15), %rdx
	movl	%eax, min(%rip)
	movl	12(%rdx), %eax
	testl	%eax, %eax
	jle	.L65
	movq	(%rdx), %rbx
	movq	%rcx, 96(%rsp)
	xorl	%r13d, %r13d
	movq	%r15, %rsi
	movq	%rbx, %rcx
.L47:
	movslq	(%rcx,%r13,4), %r14
	movl	(%r9,%r14,4), %edi
	testl	%edi, %edi
	je	.L77
.L38:
	addq	$1, %r13
	cmpl	%r13d, %eax
	jg	.L47
	movq	96(%rsp), %rcx
.L65:
	movq	72(%rsp), %rax
	movl	12(%r8,%rax), %eax
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L77:
	movl	$1, (%r9,%r14,4)
	salq	$4, %r14
	movl	min(%rip), %eax
	movl	12(%r10,%r14), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	leaq	(%r8,%r14), %rdx
	movl	%eax, min(%rip)
	movl	12(%rdx), %eax
	testl	%eax, %eax
	jle	.L64
	movq	(%rdx), %rdx
	xorl	%ebp, %ebp
	movq	%rdx, %r15
.L46:
	movslq	(%r15,%rbp,4), %rdi
	movl	(%r9,%rdi,4), %edx
	testl	%edx, %edx
	je	.L78
.L40:
	addq	$1, %rbp
	cmpl	%ebp, %eax
	jg	.L46
.L64:
	movl	12(%r8,%rsi), %eax
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L78:
	movl	$1, (%r9,%rdi,4)
	salq	$4, %rdi
	movl	min(%rip), %eax
	movl	12(%r10,%rdi), %edx
	movq	%rdi, %r12
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rdi), %rax
	movl	12(%rax), %r11d
	testl	%r11d, %r11d
	jle	.L44
	movq	(%rax), %rdx
	xorl	%ebx, %ebx
.L45:
	movslq	(%rdx,%rbx,4), %rax
	movq	%rax, %rdi
	movl	(%r9,%rax,4), %eax
	testl	%eax, %eax
	je	.L79
	addq	$1, %rbx
	cmpl	%ebx, %r11d
	jg	.L45
.L44:
	movl	12(%r8,%r14), %eax
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L79:
	movq	%rsi, 168(%rsp)
	addq	$1, %rbx
	movq	%rdx, 160(%rsp)
	movq	%rcx, 152(%rsp)
	call	dfs
	leaq	adj(%rip), %r8
	movq	152(%rsp), %rcx
	movq	160(%rsp), %rdx
	movl	12(%r8,%r12), %r11d
	movq	168(%rsp), %rsi
	leaq	ing(%rip), %r10
	leaq	visited(%rip), %r9
	cmpl	%ebx, %r11d
	jg	.L45
	movl	12(%r8,%r14), %eax
	jmp	.L40
	.cfi_endproc
.LFE54:
	.size	dfs, .-dfs
	.p2align 4
	.globl	searchMinCost
	.type	searchMinCost, @function
searchMinCost:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%esi, %esi
	movl	$20000, %edx
	leaq	adj(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	visited(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%edi, %rbp
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %r14
	salq	$4, %r14
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	memset@PLT
	leaq	ing(%rip), %rcx
	movl	$100000, %edx
	leaq	(%r15,%r14), %rsi
	movl	12(%rcx,%r14), %eax
	movl	$1, (%r12,%rbp,4)
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	12(%rsi), %edx
	movl	%eax, min(%rip)
	testl	%edx, %edx
	jle	.L81
	movq	(%rsi), %r13
	xorl	%ebx, %ebx
.L85:
	movslq	0(%r13,%rbx,4), %rax
	movq	%rax, %rdi
	movl	(%r12,%rax,4), %eax
	testl	%eax, %eax
	je	.L87
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L85
.L84:
	movl	min(%rip), %eax
.L81:
	salq	$4, %rbp
	movl	%eax, 12(%rcx,%rbp)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L87:
	.cfi_restore_state
	call	dfs
	movl	12(%r15,%r14), %edx
	addq	$1, %rbx
	leaq	ing(%rip), %rcx
	cmpl	%ebx, %edx
	jg	.L85
	jmp	.L84
	.cfi_endproc
.LFE55:
	.size	searchMinCost, .-searchMinCost
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%s %d"
.LC3:
	.string	"%s %s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	ing(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L93
	.p2align 4,,10
	.p2align 3
.L92:
	leaq	12(%rbx), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$16, %rbx
	cmpl	%ebp, n(%rip)
	jg	.L92
.L93:
	movq	%r13, %rdi
	leaq	28(%rsp), %rsi
	leaq	45(%rsp), %r14
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edi
	leaq	34(%rsp), %r13
	leaq	ing(%rip), %r12
	call	init
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	je	.L91
	.p2align 4,,10
	.p2align 3
.L90:
	movq	%r14, %rdx
	movq	%r13, %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L111
	movslq	%ebx, %rax
	xorl	%ebx, %ebx
	movq	%rax, 8(%rsp)
	jmp	.L98
	.p2align 4,,10
	.p2align 3
.L133:
	leal	1(%rbx), %ebp
	addq	$1, %rbx
	cmpq	8(%rsp), %rbx
	je	.L97
.L98:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	movl	%ebx, %ebp
	salq	$4, %rsi
	addq	%r12, %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L133
.L97:
	xorl	%ebx, %ebx
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L134:
	leal	1(%rbx), %r15d
	addq	$1, %rbx
	cmpq	%rbx, 8(%rsp)
	je	.L96
.L99:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	movl	%ebx, %r15d
	salq	$4, %rsi
	addq	%r12, %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L134
.L96:
	movslq	%ebp, %r8
	leaq	adj(%rip), %rax
	movq	%r8, %rbx
	salq	$4, %rbx
	addq	%rax, %rbx
	movslq	12(%rbx), %rdx
	cmpl	8(%rbx), %edx
	je	.L100
	movq	(%rbx), %rax
.L101:
	movslq	%r15d, %rcx
	leaq	adj(%rip), %rdi
	salq	$4, %r8
	leal	1(%rdx), %esi
	salq	$4, %rcx
	movl	%esi, 12(%rdi,%r8)
	leaq	(%rdi,%rcx), %rbx
	movl	%r15d, (%rax,%rdx,4)
	movslq	12(%rbx), %rax
	cmpl	8(%rbx), %eax
	je	.L102
	movq	(%rbx), %rdx
	leal	1(%rax), %ecx
	movl	%ecx, 12(%rbx)
	movl	%ebp, (%rdx,%rax,4)
.L132:
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	jne	.L90
.L91:
	movl	n(%rip), %ebx
	leaq	12+ing(%rip), %r15
	leaq	12+adj(%rip), %r14
	movl	$0, 8(%rsp)
	xorl	%ebp, %ebp
	leaq	visited(%rip), %r13
	testl	%ebx, %ebx
	jle	.L95
	.p2align 4,,10
	.p2align 3
.L109:
	movl	$20000, %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	memset@PLT
	movl	(%r15), %eax
	movl	$100000, %edx
	movl	$1, 0(%r13,%rbp,4)
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	(%r14), %edx
	movl	%eax, min(%rip)
	testl	%edx, %edx
	jle	.L104
	movq	-12(%r14), %r12
	xorl	%ebx, %ebx
.L108:
	movslq	(%r12,%rbx,4), %rax
	movq	%rax, %rdi
	movl	0(%r13,%rax,4), %eax
	testl	%eax, %eax
	je	.L135
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L108
.L107:
	movl	n(%rip), %ebx
	movl	min(%rip), %eax
.L104:
	addq	$1, %rbp
	movl	%eax, (%r15)
	addq	$16, %r14
	addq	$16, %r15
	addl	%eax, 8(%rsp)
	cmpl	%ebp, %ebx
	jg	.L109
.L95:
	movl	8(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L136
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L135:
	.cfi_restore_state
	call	dfs
	movl	(%r14), %edx
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L108
	jmp	.L107
	.p2align 4,,10
	.p2align 3
.L102:
	addl	%eax, %eax
	movq	(%rbx), %rdi
	movl	%eax, 8(%rbx)
	cltq
	leaq	0(,%rax,4), %rsi
	call	realloc@PLT
	movslq	12(%rbx), %rdx
	movq	%rax, (%rbx)
	leal	1(%rdx), %ecx
	movl	%ecx, 12(%rbx)
	movl	%ebp, (%rax,%rdx,4)
	jmp	.L132
	.p2align 4,,10
	.p2align 3
.L100:
	addl	%edx, %edx
	movq	(%rbx), %rdi
	movq	%r8, 8(%rsp)
	movl	%edx, 8(%rbx)
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	call	realloc@PLT
	movslq	12(%rbx), %rdx
	movq	8(%rsp), %r8
	movq	%rax, (%rbx)
	jmp	.L101
.L111:
	xorl	%ebp, %ebp
	xorl	%r15d, %r15d
	jmp	.L96
.L136:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.size	main, .-main
	.globl	visited
	.bss
	.align 32
	.type	visited, @object
	.size	visited, 20000
visited:
	.zero	20000
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	ing
	.align 32
	.type	ing, @object
	.size	ing, 80000
ing:
	.zero	80000
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 80000
adj:
	.zero	80000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	10
	.long	0
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	init
	.type	init, @function
init:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L6
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leal	-1(%rdi), %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	adj(%rip), %rbx
	salq	$4, %rbp
	leaq	16(%rbx), %rax
	addq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$40, %edi
	addq	$16, %rbx
	call	malloc@PLT
	movq	%r12, -8(%rbx)
	movq	%rax, -16(%rbx)
	cmpq	%rbp, %rbx
	jne	.L3
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE51:
	.size	init, .-init
	.p2align 4
	.globl	add
	.type	add, @function
add:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	adj(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edi, %rbx
	movq	%rbx, %rbp
	salq	$4, %rbp
	addq	%r13, %rbp
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movslq	12(%rbp), %rdx
	cmpl	8(%rbp), %edx
	je	.L11
	movq	0(%rbp), %rax
.L12:
	salq	$4, %rbx
	leal	1(%rdx), %ecx
	movl	%ecx, 12(%r13,%rbx)
	movl	%r12d, (%rax,%rdx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	addl	%edx, %edx
	movq	0(%rbp), %rdi
	movl	%edx, 8(%rbp)
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	call	realloc@PLT
	movslq	12(%rbp), %rdx
	movq	%rax, 0(%rbp)
	jmp	.L12
	.cfi_endproc
.LFE52:
	.size	add, .-add
	.p2align 4
	.globl	searchIdx
	.type	searchIdx, @function
searchIdx:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	n(%rip), %r13d
	testl	%r13d, %r13d
	jle	.L17
	movq	%rdi, %rbp
	leaq	ing(%rip), %rbx
	xorl	%r12d, %r12d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %r12d
	addq	$16, %rbx
	cmpl	%r13d, %r12d
	je	.L14
.L16:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L23
.L14:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L14
	.cfi_endproc
.LFE53:
	.size	searchIdx, .-searchIdx
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	visited(%rip), %r9
	leaq	ing(%rip), %r10
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	adj(%rip), %r8
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movl	$1, (%r9,%rdi,4)
	salq	$4, %rdi
	movl	min(%rip), %eax
	movl	12(%r10,%rdi), %edx
	movq	%rdi, 144(%rsp)
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rdi), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L24
	movq	$0, 24(%rsp)
	movq	(%rax), %rax
	movq	%rax, 80(%rsp)
.L53:
	movq	80(%rsp), %rax
	movq	24(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rax
	movl	(%r9,%rax,4), %r14d
	testl	%r14d, %r14d
	je	.L71
.L26:
	addq	$1, 24(%rsp)
	movq	24(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L53
.L24:
	addq	$184, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L71:
	.cfi_restore_state
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rbx
	movq	%rax, 136(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rbx), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rbx), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L70
	movq	$0, 16(%rsp)
	movq	(%rax), %rax
	movq	%rax, 64(%rsp)
.L52:
	movq	64(%rsp), %rax
	movq	16(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rax
	movl	(%r9,%rax,4), %r13d
	testl	%r13d, %r13d
	je	.L72
.L28:
	addq	$1, 16(%rsp)
	movq	16(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L52
.L70:
	movq	144(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L72:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rcx
	movq	%rax, 120(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rcx), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rcx), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L69
	movq	$0, 8(%rsp)
	movq	(%rax), %rax
	movq	%rax, 56(%rsp)
.L51:
	movq	56(%rsp), %rax
	movq	8(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rax
	movl	(%r9,%rax,4), %r12d
	testl	%r12d, %r12d
	je	.L73
.L30:
	addq	$1, 8(%rsp)
	movq	8(%rsp), %rax
	cmpl	%eax, %edx
	jg	.L51
.L69:
	movq	136(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L73:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rsi
	movq	%rax, 104(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rsi), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rsi), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L68
	movq	(%rax), %rax
	xorl	%esi, %esi
	movq	%rax, 48(%rsp)
.L50:
	movq	48(%rsp), %rax
	movslq	(%rax,%rsi,4), %rax
	movl	(%r9,%rax,4), %ebp
	testl	%ebp, %ebp
	je	.L74
.L32:
	addq	$1, %rsi
	cmpl	%esi, %edx
	jg	.L50
.L68:
	movq	120(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L74:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rcx
	movq	%rax, 88(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rcx), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rcx), %rax
	movl	12(%rax), %edx
	testl	%edx, %edx
	jle	.L67
	movq	(%rax), %rax
	xorl	%r11d, %r11d
	movq	%rsi, 128(%rsp)
	movq	%r11, %rsi
	movq	%rax, 40(%rsp)
.L49:
	movq	40(%rsp), %rax
	movslq	(%rax,%rsi,4), %rax
	movl	(%r9,%rax,4), %ebx
	testl	%ebx, %ebx
	je	.L75
.L34:
	addq	$1, %rsi
	cmpl	%esi, %edx
	jg	.L49
	movq	128(%rsp), %rsi
.L67:
	movq	104(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L75:
	movl	$1, (%r9,%rax,4)
	salq	$4, %rax
	movq	%rax, %rdi
	movq	%rax, 72(%rsp)
	movl	min(%rip), %eax
	movl	12(%r10,%rdi), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	leaq	(%r8,%rdi), %rdx
	movl	%eax, min(%rip)
	movl	12(%rdx), %eax
	testl	%eax, %eax
	jle	.L66
	movq	(%rdx), %rcx
	movq	%rsi, 112(%rsp)
	movq	%rcx, 32(%rsp)
	xorl	%ecx, %ecx
.L48:
	movq	32(%rsp), %rbx
	movslq	(%rbx,%rcx,4), %r15
	movl	(%r9,%r15,4), %r11d
	testl	%r11d, %r11d
	je	.L76
.L36:
	addq	$1, %rcx
	cmpl	%ecx, %eax
	jg	.L48
	movq	112(%rsp), %rsi
.L66:
	movq	88(%rsp), %rax
	movl	12(%r8,%rax), %edx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L76:
	movl	$1, (%r9,%r15,4)
	salq	$4, %r15
	movl	min(%rip), %eax
	movl	12(%r10,%r15), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	leaq	(%r8,%r15), %rdx
	movl	%eax, min(%rip)
	movl	12(%rdx), %eax
	testl	%eax, %eax
	jle	.L65
	movq	(%rdx), %rbx
	movq	%rcx, 96(%rsp)
	xorl	%r13d, %r13d
	movq	%r15, %rsi
	movq	%rbx, %rcx
.L47:
	movslq	(%rcx,%r13,4), %r14
	movl	(%r9,%r14,4), %edi
	testl	%edi, %edi
	je	.L77
.L38:
	addq	$1, %r13
	cmpl	%r13d, %eax
	jg	.L47
	movq	96(%rsp), %rcx
.L65:
	movq	72(%rsp), %rax
	movl	12(%r8,%rax), %eax
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L77:
	movl	$1, (%r9,%r14,4)
	salq	$4, %r14
	movl	min(%rip), %eax
	movl	12(%r10,%r14), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	leaq	(%r8,%r14), %rdx
	movl	%eax, min(%rip)
	movl	12(%rdx), %eax
	testl	%eax, %eax
	jle	.L64
	movq	(%rdx), %rdx
	xorl	%ebp, %ebp
	movq	%rdx, %r15
.L46:
	movslq	(%r15,%rbp,4), %rdi
	movl	(%r9,%rdi,4), %edx
	testl	%edx, %edx
	je	.L78
.L40:
	addq	$1, %rbp
	cmpl	%ebp, %eax
	jg	.L46
.L64:
	movl	12(%r8,%rsi), %eax
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L78:
	movl	$1, (%r9,%rdi,4)
	salq	$4, %rdi
	movl	min(%rip), %eax
	movl	12(%r10,%rdi), %edx
	movq	%rdi, %r12
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, min(%rip)
	leaq	(%r8,%rdi), %rax
	movl	12(%rax), %r11d
	testl	%r11d, %r11d
	jle	.L44
	movq	(%rax), %rdx
	xorl	%ebx, %ebx
.L45:
	movslq	(%rdx,%rbx,4), %rax
	movq	%rax, %rdi
	movl	(%r9,%rax,4), %eax
	testl	%eax, %eax
	je	.L79
	addq	$1, %rbx
	cmpl	%ebx, %r11d
	jg	.L45
.L44:
	movl	12(%r8,%r14), %eax
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L79:
	movq	%rsi, 168(%rsp)
	addq	$1, %rbx
	movq	%rdx, 160(%rsp)
	movq	%rcx, 152(%rsp)
	call	dfs
	leaq	adj(%rip), %r8
	movq	152(%rsp), %rcx
	movq	160(%rsp), %rdx
	movl	12(%r8,%r12), %r11d
	movq	168(%rsp), %rsi
	leaq	ing(%rip), %r10
	leaq	visited(%rip), %r9
	cmpl	%ebx, %r11d
	jg	.L45
	movl	12(%r8,%r14), %eax
	jmp	.L40
	.cfi_endproc
.LFE54:
	.size	dfs, .-dfs
	.p2align 4
	.globl	searchMinCost
	.type	searchMinCost, @function
searchMinCost:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%esi, %esi
	movl	$20000, %edx
	leaq	adj(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	visited(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%edi, %rbp
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %r14
	salq	$4, %r14
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	memset@PLT
	leaq	ing(%rip), %rcx
	movl	$100000, %edx
	leaq	(%r15,%r14), %rsi
	movl	12(%rcx,%r14), %eax
	movl	$1, (%r12,%rbp,4)
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	12(%rsi), %edx
	movl	%eax, min(%rip)
	testl	%edx, %edx
	jle	.L81
	movq	(%rsi), %r13
	xorl	%ebx, %ebx
.L85:
	movslq	0(%r13,%rbx,4), %rax
	movq	%rax, %rdi
	movl	(%r12,%rax,4), %eax
	testl	%eax, %eax
	je	.L87
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L85
.L84:
	movl	min(%rip), %eax
.L81:
	salq	$4, %rbp
	movl	%eax, 12(%rcx,%rbp)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L87:
	.cfi_restore_state
	call	dfs
	movl	12(%r15,%r14), %edx
	addq	$1, %rbx
	leaq	ing(%rip), %rcx
	cmpl	%ebx, %edx
	jg	.L85
	jmp	.L84
	.cfi_endproc
.LFE55:
	.size	searchMinCost, .-searchMinCost
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%s %d"
.LC3:
	.string	"%s %s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	ing(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L93
	.p2align 4,,10
	.p2align 3
.L92:
	leaq	12(%rbx), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	addl	$1, %ebp
	addq	$16, %rbx
	cmpl	%ebp, n(%rip)
	jg	.L92
.L93:
	movq	%r13, %rdi
	leaq	28(%rsp), %rsi
	leaq	45(%rsp), %r14
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edi
	leaq	34(%rsp), %r13
	leaq	ing(%rip), %r12
	call	init
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	je	.L91
	.p2align 4,,10
	.p2align 3
.L90:
	movq	%r14, %rdx
	movq	%r13, %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L111
	movslq	%ebx, %rax
	xorl	%ebx, %ebx
	movq	%rax, 8(%rsp)
	jmp	.L98
	.p2align 4,,10
	.p2align 3
.L133:
	leal	1(%rbx), %ebp
	addq	$1, %rbx
	cmpq	8(%rsp), %rbx
	je	.L97
.L98:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	movl	%ebx, %ebp
	salq	$4, %rsi
	addq	%r12, %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L133
.L97:
	xorl	%ebx, %ebx
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L134:
	leal	1(%rbx), %r15d
	addq	$1, %rbx
	cmpq	%rbx, 8(%rsp)
	je	.L96
.L99:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	movl	%ebx, %r15d
	salq	$4, %rsi
	addq	%r12, %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L134
.L96:
	movslq	%ebp, %r8
	leaq	adj(%rip), %rax
	movq	%r8, %rbx
	salq	$4, %rbx
	addq	%rax, %rbx
	movslq	12(%rbx), %rdx
	cmpl	8(%rbx), %edx
	je	.L100
	movq	(%rbx), %rax
.L101:
	movslq	%r15d, %rcx
	leaq	adj(%rip), %rdi
	salq	$4, %r8
	leal	1(%rdx), %esi
	salq	$4, %rcx
	movl	%esi, 12(%rdi,%r8)
	leaq	(%rdi,%rcx), %rbx
	movl	%r15d, (%rax,%rdx,4)
	movslq	12(%rbx), %rax
	cmpl	8(%rbx), %eax
	je	.L102
	movq	(%rbx), %rdx
	leal	1(%rax), %ecx
	movl	%ecx, 12(%rbx)
	movl	%ebp, (%rdx,%rax,4)
.L132:
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	jne	.L90
.L91:
	movl	n(%rip), %ebx
	leaq	12+ing(%rip), %r15
	leaq	12+adj(%rip), %r14
	movl	$0, 8(%rsp)
	xorl	%ebp, %ebp
	leaq	visited(%rip), %r13
	testl	%ebx, %ebx
	jle	.L95
	.p2align 4,,10
	.p2align 3
.L109:
	movl	$20000, %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	memset@PLT
	movl	(%r15), %eax
	movl	$100000, %edx
	movl	$1, 0(%r13,%rbp,4)
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	(%r14), %edx
	movl	%eax, min(%rip)
	testl	%edx, %edx
	jle	.L104
	movq	-12(%r14), %r12
	xorl	%ebx, %ebx
.L108:
	movslq	(%r12,%rbx,4), %rax
	movq	%rax, %rdi
	movl	0(%r13,%rax,4), %eax
	testl	%eax, %eax
	je	.L135
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L108
.L107:
	movl	n(%rip), %ebx
	movl	min(%rip), %eax
.L104:
	addq	$1, %rbp
	movl	%eax, (%r15)
	addq	$16, %r14
	addq	$16, %r15
	addl	%eax, 8(%rsp)
	cmpl	%ebp, %ebx
	jg	.L109
.L95:
	movl	8(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L136
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L135:
	.cfi_restore_state
	call	dfs
	movl	(%r14), %edx
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L108
	jmp	.L107
	.p2align 4,,10
	.p2align 3
.L102:
	addl	%eax, %eax
	movq	(%rbx), %rdi
	movl	%eax, 8(%rbx)
	cltq
	leaq	0(,%rax,4), %rsi
	call	realloc@PLT
	movslq	12(%rbx), %rdx
	movq	%rax, (%rbx)
	leal	1(%rdx), %ecx
	movl	%ecx, 12(%rbx)
	movl	%ebp, (%rax,%rdx,4)
	jmp	.L132
	.p2align 4,,10
	.p2align 3
.L100:
	addl	%edx, %edx
	movq	(%rbx), %rdi
	movq	%r8, 8(%rsp)
	movl	%edx, 8(%rbx)
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	call	realloc@PLT
	movslq	12(%rbx), %rdx
	movq	8(%rsp), %r8
	movq	%rax, (%rbx)
	jmp	.L101
.L111:
	xorl	%ebp, %ebp
	xorl	%r15d, %r15d
	jmp	.L96
.L136:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE56:
	.size	main, .-main
	.globl	visited
	.bss
	.align 32
	.type	visited, @object
	.size	visited, 20000
visited:
	.zero	20000
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	ing
	.align 32
	.type	ing, @object
	.size	ing, 80000
ing:
	.zero	80000
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 80000
adj:
	.zero	80000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	10
	.long	0
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.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:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define min(a, b) (((a) < (b)) ? (a) : (b))

#define INIT_CAP 10

typedef struct {
	int *to, cap, size;
} AdjList;

typedef struct {
	char name[11];
	int cost;
} Rec;

int n;
AdjList adj[5000];
Rec ing[5000];

void init(int n) {
	int i;
	for (i = 0; i < n; i++) {
		adj[i].to = malloc(sizeof(int) * INIT_CAP);
		adj[i].cap = INIT_CAP;
		adj[i].size = 0;
	}
}

void add(int from, int to) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].to = realloc(adj[from].to, sizeof(int) * adj[from].cap);
	}
	adj[from].to[adj[from].size++] = to;
}

int searchIdx(char str[]) {
	int i;

	for (i = 0; i < n; i++)
		if (!strcmp(str, ing[i].name))
			break;

	return i;
}

int min, visited[5000];

void dfs(int i) {
	int j;

	visited[i] = 1;
	min = min(min, ing[i].cost);

	for (j = 0; j < adj[i].size; j++) {
		int to = adj[i].to[j];
		if (!visited[to])
			dfs(to);
	}
}

int searchMinCost(int i) {
	min = 100000;
	memset(visited, 0, sizeof visited);

	dfs(i);

	return ing[i].cost = min;
}

int main(void) {
	int i;
	int m;
	int ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%s %d", ing[i].name, &ing[i].cost);

	scanf("%d", &m);
	init(n);
	while (m--) {
		char s[11], t[11];
		int idx_s, idx_t;

		scanf("%s %s", s, t);
		idx_s = searchIdx(s);
		idx_t = searchIdx(t);

		add(idx_s, idx_t);
		add(idx_t, idx_s);
	}

	ans = 0;
	for (i = 0; i < n; i++)
		ans += searchMinCost(i);

	printf("%d\n", ans);

	return 0;
}
2
tako 2
yaki 1
0
tako yaki

3

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define min(a, b) (((a) < (b)) ? (a) : (b))

#define INIT_CAP 10

typedef struct {
	int *to, cap, size;
} AdjList;

typedef struct {
	char name[11];
	int cost;
} Rec;

int n;
AdjList adj[5000];
Rec ing[5000];

void init(int n) {
	int i;
	for (i = 0; i < n; i++) {
		adj[i].to = malloc(sizeof(int) * INIT_CAP);
		adj[i].cap = INIT_CAP;
		adj[i].size = 0;
	}
}

void add(int from, int to) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].to = realloc(adj[from].to, sizeof(int) * adj[from].cap);
	}
	adj[from].to[adj[from].size++] = to;
}

int searchIdx(char str[]) {
	int i;

	for (i = 0; i < n; i++)
		if (!strcmp(str, ing[i].name))
			break;

	return i;
}

int min, visited[5000];

void dfs(int i) {
	int j;

	visited[i] = 1;
	min = min(min, ing[i].cost);

	for (j = 0; j < adj[i].size; j++) {
		int to = adj[i].to[j];
		if (!visited[to])
			dfs(to);
	}
}

int searchMinCost(int i) {
	min = 100000;
	memset(visited, 0, sizeof visited);

	dfs(i);

	return ing[i].cost = min;
}

int main(void) {
	int i;
	int m;
	int ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%s %d", ing[i].name, &ing[i].cost);

	scanf("%d", &m);
	init(n);
	while (m--) {
		char s[11], t[11];
		int idx_s, idx_t;

		scanf("%s %s", s, t);
		idx_s = searchIdx(s);
		idx_t = searchIdx(t);

		add(idx_s, idx_t);
		add(idx_t, idx_s);
	}

	ans = 0;
	for (i = 0; i < n; i++)
		ans += searchMinCost(i);

	printf("%d\n", ans);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 80000
adj:
	.zero	80000
	.globl	ing
	.align 32
	.type	ing, @object
	.size	ing, 80000
ing:
	.zero	80000
	.text
	.globl	init
	.type	init, @function
init:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	$40, %edi
	call	malloc@PLT
	movq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	$10, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init, .-init
	.globl	add
	.type	add, @function
add:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+adj(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	adj(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L5:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdi
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-4(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	%rcx, %rsi
	salq	$4, %rsi
	leaq	12+adj(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	cltq
	salq	$2, %rax
	leaq	(%rdi,%rax), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	add, .-add
	.globl	searchIdx
	.type	searchIdx, @function
searchIdx:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L7
.L10:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	ing(%rip), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L12
	addl	$1, -4(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L10
	jmp	.L9
.L12:
	nop
.L9:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	searchIdx, .-searchIdx
	.globl	min
	.bss
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	visited
	.align 32
	.type	visited, @object
	.size	visited, 20000
visited:
	.zero	20000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	visited(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+ing(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	min(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, min(%rip)
	movl	$0, -8(%rbp)
	jmp	.L14
.L16:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	visited(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	dfs
.L15:
	addl	$1, -8(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	dfs, .-dfs
	.globl	searchMinCost
	.type	searchMinCost, @function
searchMinCost:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	$100000, min(%rip)
	movl	$20000, %edx
	movl	$0, %esi
	leaq	visited(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	min(%rip), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	12+ing(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+ing(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	searchMinCost, .-searchMinCost
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -48(%rbp)
	jmp	.L20
.L21:
	movl	-48(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	ing(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	ing(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L20:
	movl	n(%rip), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L21
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	%eax, %edi
	call	init
	jmp	.L22
.L23:
	leaq	-19(%rbp), %rdx
	leaq	-30(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-30(%rbp), %rax
	movq	%rax, %rdi
	call	searchIdx
	movl	%eax, -40(%rbp)
	leaq	-19(%rbp), %rax
	movq	%rax, %rdi
	call	searchIdx
	movl	%eax, -36(%rbp)
	movl	-36(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
.L22:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L23
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L24
.L25:
	movl	-48(%rbp), %eax
	movl	%eax, %edi
	call	searchMinCost
	addl	%eax, -44(%rbp)
	addl	$1, -48(%rbp)
.L24:
	movl	n(%rip), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L25
	movl	-44(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.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:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	adj
	.align 32
	.type	adj, @object
	.size	adj, 80000
adj:
	.zero	80000
	.globl	ing
	.align 32
	.type	ing, @object
	.size	ing, 80000
ing:
	.zero	80000
	.text
	.globl	init
	.type	init, @function
init:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	$40, %edi
	call	malloc@PLT
	movq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	$10, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init, .-init
	.globl	add
	.type	add, @function
add:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+adj(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	adj(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	adj(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L5:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdi
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-4(%rbp), %ecx
	movslq	%ecx, %rcx
	movq	%rcx, %rsi
	salq	$4, %rsi
	leaq	12+adj(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	cltq
	salq	$2, %rax
	leaq	(%rdi,%rax), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	add, .-add
	.globl	searchIdx
	.type	searchIdx, @function
searchIdx:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L7
.L10:
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	ing(%rip), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L12
	addl	$1, -4(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L10
	jmp	.L9
.L12:
	nop
.L9:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	searchIdx, .-searchIdx
	.globl	min
	.bss
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	visited
	.align 32
	.type	visited, @object
	.size	visited, 20000
visited:
	.zero	20000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	visited(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+ing(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	min(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, min(%rip)
	movl	$0, -8(%rbp)
	jmp	.L14
.L16:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	adj(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	visited(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	dfs
.L15:
	addl	$1, -8(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+adj(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	dfs, .-dfs
	.globl	searchMinCost
	.type	searchMinCost, @function
searchMinCost:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	$100000, min(%rip)
	movl	$20000, %edx
	movl	$0, %esi
	leaq	visited(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	dfs
	movl	min(%rip), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	12+ing(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+ing(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	searchMinCost, .-searchMinCost
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -48(%rbp)
	jmp	.L20
.L21:
	movl	-48(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	ing(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	ing(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L20:
	movl	n(%rip), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L21
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	%eax, %edi
	call	init
	jmp	.L22
.L23:
	leaq	-19(%rbp), %rdx
	leaq	-30(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-30(%rbp), %rax
	movq	%rax, %rdi
	call	searchIdx
	movl	%eax, -40(%rbp)
	leaq	-19(%rbp), %rax
	movq	%rax, %rdi
	call	searchIdx
	movl	%eax, -36(%rbp)
	movl	-36(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
.L22:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L23
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L24
.L25:
	movl	-48(%rbp), %eax
	movl	%eax, %edi
	call	searchMinCost
	addl	%eax, -44(%rbp)
	addl	$1, -48(%rbp)
.L24:
	movl	n(%rip), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L25
	movl	-44(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.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:
