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>

struct road{
  int from;
  int to;
  int distance;
};

int calc_longest(int, int, int, int*, struct road*, int);
void calc_shortestDistance(int, int, int, int*, struct road*, int, int*);

int main(void)
{
  int N, M, K;
  struct road roads[100000];
  int mall[3001];
  int max_distance;
  int longest_d;
  int i;

  scanf("%d %d %d", &N, &M, &K);
  max_distance=0;
  for(i=0; i<M; i++){
    scanf("%d %d %d", &roads[i].from, &roads[i].to, &roads[i].distance);
    if(max_distance<roads[i].distance) max_distance=roads[i].distance;
  }
  for(i=0; i<K; i++){
    scanf("%d", &mall[i]);
  }
  
  longest_d=calc_longest(N, M, K, mall, roads, max_distance);
  printf("%d\n", longest_d);

  return 0;
}

int calc_longest(int N, int M, int K, int* mall, struct road* roads, int max_distance)
{
  int i;
  float longest_d, tmp_d;
  int longest_int;
  int d[3001];

  for(i=1; i<=N; i++) d[i]=max_distance*(M+1);
  calc_shortestDistance(N, M, K, mall, roads, max_distance, d);

  longest_d=0.0f;
  for(i=0; i<M; i++){
    tmp_d=(float)(d[roads[i].from]+d[roads[i].to]+roads[i].distance);
    tmp_d/=2.0f;
    if(longest_d<tmp_d) longest_d=tmp_d;
  }

  longest_int=longest_d+0.5f;
  return longest_int;
}

void calc_shortestDistance(int city_size, int n, int mall_size, int* mall, struct road* roads, int max_distance, int* d)
{
  int is_searched[3001]; //0:is not searched, 1:is searched.
  int min_d, min_city;
  int i;

  for(i=1; i<=city_size; i++) is_searched[i]=0;
  for(i=1; i<=city_size; i++) d[i]=max_distance*n+1;
  for(i=0; i<mall_size; i++) d[mall[i]]=0;

  while(1){
    min_d=max_distance*n+1;
    for(i=1; i<=city_size; i++){
      if(!is_searched[i] && d[i]<min_d){
	min_d=d[i];
	min_city=i;
      }
    }
    if(min_d==max_distance*n+1) break;

    for(i=0; i<n; i++){
      if(roads[i].from==min_city){
	if(d[roads[i].to]>min_d+roads[i].distance) d[roads[i].to]=min_d+roads[i].distance;
      }
      else if(roads[i].to==min_city){
	if(d[roads[i].from]>min_d+roads[i].distance) d[roads[i].from]=min_d+roads[i].distance;
      }
    }
    is_searched[min_city]=1;
  }

  return;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1208320(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3744, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1212048(%rbp), %rcx
	leaq	-1212052(%rbp), %rdx
	leaq	-1212056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1212044(%rbp)
	movl	$0, -1212040(%rbp)
	jmp	.L2
.L4:
	leaq	-1200016(%rbp), %rcx
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	8(%rax), %rcx
	leaq	-1200016(%rbp), %rsi
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	4(%rax), %rdx
	leaq	-1200016(%rbp), %rdi
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$1200008, %rax
	movl	(%rax), %eax
	cmpl	%eax, -1212044(%rbp)
	jge	.L3
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$1200008, %rax
	movl	(%rax), %eax
	movl	%eax, -1212044(%rbp)
.L3:
	addl	$1, -1212040(%rbp)
.L2:
	movl	-1212052(%rbp), %eax
	cmpl	%eax, -1212040(%rbp)
	jl	.L4
	movl	$0, -1212040(%rbp)
	jmp	.L5
.L6:
	leaq	-1212032(%rbp), %rdx
	movl	-1212040(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -1212040(%rbp)
.L5:
	movl	-1212048(%rbp), %eax
	cmpl	%eax, -1212040(%rbp)
	jl	.L6
	movl	-1212048(%rbp), %edx
	movl	-1212052(%rbp), %esi
	movl	-1212056(%rbp), %eax
	movl	-1212044(%rbp), %r8d
	leaq	-1200016(%rbp), %rdi
	leaq	-1212032(%rbp), %rcx
	movl	%r8d, %r9d
	movq	%rdi, %r8
	movl	%eax, %edi
	call	calc_longest
	movl	%eax, -1212036(%rbp)
	movl	-1212036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	calc_longest
	.type	calc_longest, @function
calc_longest:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3872, %rsp
	movl	%edi, -12036(%rbp)
	movl	%esi, -12040(%rbp)
	movl	%edx, -12044(%rbp)
	movq	%rcx, -12056(%rbp)
	movq	%r8, -12064(%rbp)
	movl	%r9d, -12048(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -12032(%rbp)
	jmp	.L10
.L11:
	movl	-12040(%rbp), %eax
	addl	$1, %eax
	imull	-12048(%rbp), %eax
	movl	%eax, %edx
	movl	-12032(%rbp), %eax
	cltq
	movl	%edx, -12016(%rbp,%rax,4)
	addl	$1, -12032(%rbp)
.L10:
	movl	-12032(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L11
	movl	-12048(%rbp), %r9d
	movq	-12064(%rbp), %r8
	movq	-12056(%rbp), %rcx
	movl	-12044(%rbp), %edx
	movl	-12040(%rbp), %esi
	movl	-12036(%rbp), %eax
	subq	$8, %rsp
	leaq	-12016(%rbp), %rdi
	pushq	%rdi
	movl	%eax, %edi
	call	calc_shortestDistance
	addq	$16, %rsp
	pxor	%xmm0, %xmm0
	movss	%xmm0, -12028(%rbp)
	movl	$0, -12032(%rbp)
	jmp	.L12
.L15:
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %ecx
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %eax
	addl	%eax, %ecx
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %eax
	addl	%ecx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2ssl	%eax, %xmm0
	movss	%xmm0, -12020(%rbp)
	movss	-12020(%rbp), %xmm0
	movss	.LC4(%rip), %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, -12020(%rbp)
	movss	-12020(%rbp), %xmm0
	comiss	-12028(%rbp), %xmm0
	jbe	.L13
	movss	-12020(%rbp), %xmm0
	movss	%xmm0, -12028(%rbp)
.L13:
	addl	$1, -12032(%rbp)
.L12:
	movl	-12032(%rbp), %eax
	cmpl	-12040(%rbp), %eax
	jl	.L15
	movss	-12028(%rbp), %xmm1
	movss	.LC5(%rip), %xmm0
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %eax
	movl	%eax, -12024(%rbp)
	movl	-12024(%rbp), %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	calc_longest, .-calc_longest
	.globl	calc_shortestDistance
	.type	calc_shortestDistance, @function
calc_shortestDistance:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3888, %rsp
	movl	%edi, -12036(%rbp)
	movl	%esi, -12040(%rbp)
	movl	%edx, -12044(%rbp)
	movq	%rcx, -12056(%rbp)
	movq	%r8, -12064(%rbp)
	movl	%r9d, -12048(%rbp)
	movq	16(%rbp), %rax
	movq	%rax, -12072(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -12020(%rbp)
	jmp	.L20
.L21:
	movl	-12020(%rbp), %eax
	cltq
	movl	$0, -12016(%rbp,%rax,4)
	addl	$1, -12020(%rbp)
.L20:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L21
	movl	$1, -12020(%rbp)
	jmp	.L22
.L23:
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	movl	%eax, %edx
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-12072(%rbp), %rax
	addq	%rcx, %rax
	addl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -12020(%rbp)
.L22:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L23
	movl	$0, -12020(%rbp)
	jmp	.L24
.L25:
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -12020(%rbp)
.L24:
	movl	-12020(%rbp), %eax
	cmpl	-12044(%rbp), %eax
	jl	.L25
.L35:
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12028(%rbp)
	movl	$1, -12020(%rbp)
	jmp	.L26
.L28:
	movl	-12020(%rbp), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L27
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12028(%rbp)
	jle	.L27
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12028(%rbp)
	movl	-12020(%rbp), %eax
	movl	%eax, -12024(%rbp)
.L27:
	addl	$1, -12020(%rbp)
.L26:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L28
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -12028(%rbp)
	je	.L39
	movl	$0, -12020(%rbp)
	jmp	.L31
.L34:
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12024(%rbp)
	jne	.L32
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-12028(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, %ecx
	jle	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	-12028(%rbp), %edx
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L33
.L32:
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, -12024(%rbp)
	jne	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-12028(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, %ecx
	jle	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	-12028(%rbp), %edx
	addl	%ecx, %edx
	movl	%edx, (%rax)
.L33:
	addl	$1, -12020(%rbp)
.L31:
	movl	-12020(%rbp), %eax
	cmpl	-12040(%rbp), %eax
	jl	.L34
	movl	-12024(%rbp), %eax
	cltq
	movl	$1, -12016(%rbp,%rax,4)
	jmp	.L35
.L39:
	nop
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	calc_shortestDistance, .-calc_shortestDistance
	.section	.rodata
	.align 4
.LC4:
	.long	1073741824
	.align 4
.LC5:
	.long	1056964608
	.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	calc_shortestDistance
	.type	calc_shortestDistance, @function
calc_shortestDistance:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$3848, %rsp
	.cfi_def_cfa_offset 12096
	movq	12096(%rsp), %r13
	imull	%esi, %r9d
	movl	%edi, %ebp
	movl	%esi, %r12d
	movl	%edx, %r10d
	movq	%fs:40, %rax
	movq	%rax, 12024(%rsp)
	xorl	%eax, %eax
	movq	%r8, %r14
	leal	1(%r9), %r15d
	testl	%edi, %edi
	jle	.L8
	movl	%edx, 4(%rsp)
	movl	%edi, %edx
	xorl	%esi, %esi
	leaq	20(%rsp), %rdi
	salq	$2, %rdx
	movq	%rcx, 8(%rsp)
	call	memset@PLT
	leal	-1(%rbp), %eax
	movl	4(%rsp), %r10d
	movq	8(%rsp), %rcx
	cmpl	$2, %eax
	jbe	.L20
	movl	%ebp, %edx
	movd	%r15d, %xmm1
	leaq	4(%r13), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm1, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%r13,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L6
	movl	%ebp, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%ebp, %edx
	je	.L8
.L5:
	movslq	%eax, %rdx
	movl	%r15d, 0(%r13,%rdx,4)
	leaq	0(,%rdx,4), %rsi
	leal	1(%rax), %edx
	cmpl	%edx, %ebp
	jl	.L8
	addl	$2, %eax
	movl	%r15d, 4(%r13,%rsi)
	cmpl	%ebp, %eax
	jg	.L8
	movl	%r15d, 8(%r13,%rsi)
.L8:
	testl	%r10d, %r10d
	jle	.L4
	leal	-1(%r10), %edx
	movq	%rcx, %rax
	leaq	4(%rcx,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	(%rax), %rdx
	addq	$4, %rax
	movl	$0, 0(%r13,%rdx,4)
	cmpq	%rcx, %rax
	jne	.L11
.L4:
	leal	-1(%r12), %eax
	leal	1(%rbp), %r8d
	leaq	(%rax,%rax,2), %rax
	leaq	16(%rsp), %rdi
	leaq	12(%r14,%rax,4), %r9
	testl	%ebp, %ebp
	jle	.L1
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%r15d, %esi
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rdi,%rax,4), %edx
	testl	%edx, %edx
	jne	.L13
	movl	0(%r13,%rax,4), %edx
	cmpl	%esi, %edx
	jge	.L13
	movl	%eax, %ebx
	movl	%edx, %esi
.L13:
	addq	$1, %rax
	cmpq	%r8, %rax
	jne	.L14
	cmpl	%r15d, %esi
	je	.L1
	movq	%r14, %rax
	testl	%r12d, %r12d
	jg	.L15
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%edx, %ebx
	je	.L31
.L17:
	addq	$12, %rax
	cmpq	%r9, %rax
	je	.L18
.L15:
	movslq	(%rax), %rcx
	movslq	4(%rax), %rdx
	cmpl	%ebx, %ecx
	jne	.L16
	movl	8(%rax), %ecx
	leaq	0(%r13,%rdx,4), %rdx
	addl	%esi, %ecx
	cmpl	%ecx, (%rdx)
	jle	.L17
	movl	%ecx, (%rdx)
.L34:
	addq	$12, %rax
	cmpq	%r9, %rax
	jne	.L15
.L18:
	movslq	%ebx, %rax
	movl	$1, 16(%rsp,%rax,4)
	testl	%ebp, %ebp
	jg	.L32
.L1:
	movq	12024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L33
	addq	$12040, %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
.L31:
	.cfi_restore_state
	leaq	0(%r13,%rcx,4), %rdx
	movl	8(%rax), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, (%rdx)
	jle	.L17
	movl	%ecx, (%rdx)
	jmp	.L34
.L20:
	movl	$1, %eax
	jmp	.L5
.L33:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	calc_shortestDistance, .-calc_shortestDistance
	.p2align 4
	.globl	calc_longest
	.type	calc_longest, @function
calc_longest:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4120
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8216
	orq	$0, (%rsp)
	subq	$3832, %rsp
	.cfi_def_cfa_offset 12048
	movq	%fs:40, %rax
	movq	%rax, 12008(%rsp)
	xorl	%eax, %eax
	movl	%esi, %ebp
	movl	%edx, %r10d
	movq	%rcx, %r11
	movq	%r8, %rbx
	testl	%edi, %edi
	jle	.L42
	leal	1(%rsi), %ecx
	leal	-1(%rdi), %eax
	imull	%r9d, %ecx
	cmpl	$2, %eax
	jbe	.L48
	movl	%edi, %edx
	movd	%ecx, %xmm3
	leaq	4(%rsp), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm3, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L40:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L40
	movl	%edi, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %edi
	je	.L42
.L39:
	movslq	%eax, %rdx
	movl	%ecx, (%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edi, %edx
	jg	.L42
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	%ecx, (%rsp,%rdx,4)
	cmpl	%edi, %eax
	jg	.L42
	cltq
	movl	%ecx, (%rsp,%rax,4)
.L42:
	subq	$8, %rsp
	.cfi_def_cfa_offset 12056
	movl	%r10d, %edx
	movq	%rbx, %r8
	movq	%r11, %rcx
	leaq	8(%rsp), %rax
	movl	%ebp, %esi
	pushq	%rax
	.cfi_def_cfa_offset 12064
	call	calc_shortestDistance
	popq	%rax
	.cfi_def_cfa_offset 12056
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 12048
	testl	%ebp, %ebp
	jle	.L35
	leal	-1(%rbp), %eax
	movss	.LC1(%rip), %xmm2
	movq	%rbx, %r8
	pxor	%xmm1, %xmm1
	leaq	(%rax,%rax,2), %rax
	leaq	12(%rbx,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	4(%r8), %rdx
	movslq	(%r8), %rax
	pxor	%xmm0, %xmm0
	addq	$12, %r8
	movl	(%rsp,%rax,4), %eax
	addl	(%rsp,%rdx,4), %eax
	addl	-4(%r8), %eax
	cvtsi2ssl	%eax, %xmm0
	mulss	%xmm2, %xmm0
	maxss	%xmm1, %xmm0
	movaps	%xmm0, %xmm1
	cmpq	%r8, %rcx
	jne	.L46
	addss	%xmm2, %xmm1
	cvttss2sil	%xmm1, %eax
.L35:
	movq	12008(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L53
	addq	$12024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L48:
	.cfi_restore_state
	movl	$1, %eax
	jmp	.L39
.L53:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	calc_longest, .-calc_longest
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d %d %d"
.LC3:
	.string	"%d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-1208320(%rsp), %r11
	.cfi_def_cfa 11, 1208368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3728, %rsp
	.cfi_def_cfa_offset 1212096
	leaq	.LC2(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1212040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L60
	leaq	12040(%rsp), %rbx
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L56:
	leaq	-4(%rbx), %rdx
	leaq	-8(%rbx), %rsi
	movq	%rbx, %rcx
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	cmpl	%eax, %ebp
	cmovl	%eax, %ebp
	addl	$1, %r12d
	addq	$12, %rbx
	cmpl	%r12d, 8(%rsp)
	jg	.L56
.L55:
	movl	12(%rsp), %edx
	leaq	16(%rsp), %r14
	xorl	%ebx, %ebx
	leaq	.LC3(%rip), %r13
	movq	%r14, %r12
	testl	%edx, %edx
	jle	.L57
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %r12
	cmpl	%ebx, %edx
	jg	.L58
.L57:
	movl	8(%rsp), %esi
	movl	4(%rsp), %edi
	movl	%ebp, %r9d
	movq	%r14, %rcx
	leaq	12032(%rsp), %r8
	call	calc_longest
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	1212040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L66
	addq	$1212048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L60:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L55
.L66:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	1056964608
	.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	calc_shortestDistance
	.type	calc_shortestDistance, @function
calc_shortestDistance:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$3848, %rsp
	.cfi_def_cfa_offset 12096
	movq	12096(%rsp), %r13
	imull	%esi, %r9d
	movl	%edi, %ebp
	movl	%esi, %r12d
	movl	%edx, %r10d
	movq	%fs:40, %rax
	movq	%rax, 12024(%rsp)
	xorl	%eax, %eax
	movq	%r8, %r14
	leal	1(%r9), %r15d
	testl	%edi, %edi
	jle	.L8
	movl	%edx, 4(%rsp)
	movl	%edi, %edx
	xorl	%esi, %esi
	leaq	20(%rsp), %rdi
	salq	$2, %rdx
	movq	%rcx, 8(%rsp)
	call	memset@PLT
	leal	-1(%rbp), %eax
	movl	4(%rsp), %r10d
	movq	8(%rsp), %rcx
	cmpl	$2, %eax
	jbe	.L20
	movl	%ebp, %edx
	movd	%r15d, %xmm1
	leaq	4(%r13), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm1, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%r13,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L6
	movl	%ebp, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%ebp, %edx
	je	.L8
.L5:
	movslq	%eax, %rdx
	movl	%r15d, 0(%r13,%rdx,4)
	leaq	0(,%rdx,4), %rsi
	leal	1(%rax), %edx
	cmpl	%edx, %ebp
	jl	.L8
	addl	$2, %eax
	movl	%r15d, 4(%r13,%rsi)
	cmpl	%ebp, %eax
	jg	.L8
	movl	%r15d, 8(%r13,%rsi)
.L8:
	testl	%r10d, %r10d
	jle	.L4
	leal	-1(%r10), %edx
	movq	%rcx, %rax
	leaq	4(%rcx,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	(%rax), %rdx
	addq	$4, %rax
	movl	$0, 0(%r13,%rdx,4)
	cmpq	%rcx, %rax
	jne	.L11
.L4:
	leal	-1(%r12), %eax
	leal	1(%rbp), %r8d
	leaq	(%rax,%rax,2), %rax
	leaq	16(%rsp), %rdi
	leaq	12(%r14,%rax,4), %r9
	testl	%ebp, %ebp
	jle	.L1
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%r15d, %esi
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rdi,%rax,4), %edx
	testl	%edx, %edx
	jne	.L13
	movl	0(%r13,%rax,4), %edx
	cmpl	%esi, %edx
	jge	.L13
	movl	%eax, %ebx
	movl	%edx, %esi
.L13:
	addq	$1, %rax
	cmpq	%r8, %rax
	jne	.L14
	cmpl	%r15d, %esi
	je	.L1
	movq	%r14, %rax
	testl	%r12d, %r12d
	jg	.L15
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%edx, %ebx
	je	.L31
.L17:
	addq	$12, %rax
	cmpq	%r9, %rax
	je	.L18
.L15:
	movslq	(%rax), %rcx
	movslq	4(%rax), %rdx
	cmpl	%ebx, %ecx
	jne	.L16
	movl	8(%rax), %ecx
	leaq	0(%r13,%rdx,4), %rdx
	addl	%esi, %ecx
	cmpl	%ecx, (%rdx)
	jle	.L17
	movl	%ecx, (%rdx)
.L34:
	addq	$12, %rax
	cmpq	%r9, %rax
	jne	.L15
.L18:
	movslq	%ebx, %rax
	movl	$1, 16(%rsp,%rax,4)
	testl	%ebp, %ebp
	jg	.L32
.L1:
	movq	12024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L33
	addq	$12040, %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
.L31:
	.cfi_restore_state
	leaq	0(%r13,%rcx,4), %rdx
	movl	8(%rax), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, (%rdx)
	jle	.L17
	movl	%ecx, (%rdx)
	jmp	.L34
.L20:
	movl	$1, %eax
	jmp	.L5
.L33:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	calc_shortestDistance, .-calc_shortestDistance
	.p2align 4
	.globl	calc_longest
	.type	calc_longest, @function
calc_longest:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4120
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8216
	orq	$0, (%rsp)
	subq	$3832, %rsp
	.cfi_def_cfa_offset 12048
	movq	%fs:40, %rax
	movq	%rax, 12008(%rsp)
	xorl	%eax, %eax
	movl	%esi, %ebp
	movl	%edx, %r10d
	movq	%rcx, %r11
	movq	%r8, %rbx
	testl	%edi, %edi
	jle	.L42
	leal	1(%rsi), %ecx
	leal	-1(%rdi), %eax
	imull	%r9d, %ecx
	cmpl	$2, %eax
	jbe	.L48
	movl	%edi, %edx
	movd	%ecx, %xmm3
	leaq	4(%rsp), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm3, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L40:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L40
	movl	%edi, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %edi
	je	.L42
.L39:
	movslq	%eax, %rdx
	movl	%ecx, (%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edi, %edx
	jg	.L42
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	%ecx, (%rsp,%rdx,4)
	cmpl	%edi, %eax
	jg	.L42
	cltq
	movl	%ecx, (%rsp,%rax,4)
.L42:
	subq	$8, %rsp
	.cfi_def_cfa_offset 12056
	movl	%r10d, %edx
	movq	%rbx, %r8
	movq	%r11, %rcx
	leaq	8(%rsp), %rax
	movl	%ebp, %esi
	pushq	%rax
	.cfi_def_cfa_offset 12064
	call	calc_shortestDistance
	popq	%rax
	.cfi_def_cfa_offset 12056
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 12048
	testl	%ebp, %ebp
	jle	.L35
	leal	-1(%rbp), %eax
	movss	.LC1(%rip), %xmm2
	movq	%rbx, %r8
	pxor	%xmm1, %xmm1
	leaq	(%rax,%rax,2), %rax
	leaq	12(%rbx,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	4(%r8), %rdx
	movslq	(%r8), %rax
	pxor	%xmm0, %xmm0
	addq	$12, %r8
	movl	(%rsp,%rax,4), %eax
	addl	(%rsp,%rdx,4), %eax
	addl	-4(%r8), %eax
	cvtsi2ssl	%eax, %xmm0
	mulss	%xmm2, %xmm0
	maxss	%xmm1, %xmm0
	movaps	%xmm0, %xmm1
	cmpq	%r8, %rcx
	jne	.L46
	addss	%xmm2, %xmm1
	cvttss2sil	%xmm1, %eax
.L35:
	movq	12008(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L53
	addq	$12024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L48:
	.cfi_restore_state
	movl	$1, %eax
	jmp	.L39
.L53:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	calc_longest, .-calc_longest
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d %d %d"
.LC3:
	.string	"%d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-1208320(%rsp), %r11
	.cfi_def_cfa 11, 1208368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3728, %rsp
	.cfi_def_cfa_offset 1212096
	leaq	.LC2(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1212040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L60
	leaq	12040(%rsp), %rbx
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L56:
	leaq	-4(%rbx), %rdx
	leaq	-8(%rbx), %rsi
	movq	%rbx, %rcx
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	cmpl	%eax, %ebp
	cmovl	%eax, %ebp
	addl	$1, %r12d
	addq	$12, %rbx
	cmpl	%r12d, 8(%rsp)
	jg	.L56
.L55:
	movl	12(%rsp), %edx
	leaq	16(%rsp), %r14
	xorl	%ebx, %ebx
	leaq	.LC3(%rip), %r13
	movq	%r14, %r12
	testl	%edx, %edx
	jle	.L57
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %r12
	cmpl	%ebx, %edx
	jg	.L58
.L57:
	movl	8(%rsp), %esi
	movl	4(%rsp), %edi
	movl	%ebp, %r9d
	movq	%r14, %rcx
	leaq	12032(%rsp), %r8
	call	calc_longest
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	1212040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L66
	addq	$1212048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L60:
	.cfi_restore_state
	xorl	%ebp, %ebp
	jmp	.L55
.L66:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	1056964608
	.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>

struct road{
  int from;
  int to;
  int distance;
};

int calc_longest(int, int, int, int*, struct road*, int);
void calc_shortestDistance(int, int, int, int*, struct road*, int, int*);

int main(void)
{
  int N, M, K;
  struct road roads[100000];
  int mall[3001];
  int max_distance;
  int longest_d;
  int i;

  scanf("%d %d %d", &N, &M, &K);
  max_distance=0;
  for(i=0; i<M; i++){
    scanf("%d %d %d", &roads[i].from, &roads[i].to, &roads[i].distance);
    if(max_distance<roads[i].distance) max_distance=roads[i].distance;
  }
  for(i=0; i<K; i++){
    scanf("%d", &mall[i]);
  }
  
  longest_d=calc_longest(N, M, K, mall, roads, max_distance);
  printf("%d\n", longest_d);

  return 0;
}

int calc_longest(int N, int M, int K, int* mall, struct road* roads, int max_distance)
{
  int i;
  float longest_d, tmp_d;
  int longest_int;
  int d[3001];

  for(i=1; i<=N; i++) d[i]=max_distance*(M+1);
  calc_shortestDistance(N, M, K, mall, roads, max_distance, d);

  longest_d=0.0f;
  for(i=0; i<M; i++){
    tmp_d=(float)(d[roads[i].from]+d[roads[i].to]+roads[i].distance);
    tmp_d/=2.0f;
    if(longest_d<tmp_d) longest_d=tmp_d;
  }

  longest_int=longest_d+0.5f;
  return longest_int;
}

void calc_shortestDistance(int city_size, int n, int mall_size, int* mall, struct road* roads, int max_distance, int* d)
{
  int is_searched[3001]; //0:is not searched, 1:is searched.
  int min_d, min_city;
  int i;

  for(i=1; i<=city_size; i++) is_searched[i]=0;
  for(i=1; i<=city_size; i++) d[i]=max_distance*n+1;
  for(i=0; i<mall_size; i++) d[mall[i]]=0;

  while(1){
    min_d=max_distance*n+1;
    for(i=1; i<=city_size; i++){
      if(!is_searched[i] && d[i]<min_d){
	min_d=d[i];
	min_city=i;
      }
    }
    if(min_d==max_distance*n+1) break;

    for(i=0; i<n; i++){
      if(roads[i].from==min_city){
	if(d[roads[i].to]>min_d+roads[i].distance) d[roads[i].to]=min_d+roads[i].distance;
      }
      else if(roads[i].to==min_city){
	if(d[roads[i].from]>min_d+roads[i].distance) d[roads[i].from]=min_d+roads[i].distance;
      }
    }
    is_searched[min_city]=1;
  }

  return;
}
4 3 1
1 2 1
2 3 1
3 1 1
1
 4 3 1
1 2 1
2 3 2
1 1 1
1
 4 3 1
1 2 1
2 3 1
1 2 1
2
 4 3 1
1 2 1
2 3 4
1 1 1
1
 8 3 1
1 1 2
2 3 4
3 1 0
1
 4 3 1
1 2 2
2 4 4
1 1 1
1
 4 3 1
1 1 0
1 3 0
3 2 0
1
 10 3 1
1 2 5
3 3 2
3 1 1
2
 4 3 1
1 2 1
2 3 1
1 1 1
1
 4 3 1
1 2 1
2 3 1
1 2 1
1

2
 3
 1
 5
 4
 6
 0
 7
 2
 2

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>

struct road{
  int from;
  int to;
  int distance;
};

int calc_longest(int, int, int, int*, struct road*, int);
void calc_shortestDistance(int, int, int, int*, struct road*, int, int*);

int main(void)
{
  int N, M, K;
  struct road roads[100000];
  int mall[3001];
  int max_distance;
  int longest_d;
  int i;

  scanf("%d %d %d", &N, &M, &K);
  max_distance=0;
  for(i=0; i<M; i++){
    scanf("%d %d %d", &roads[i].from, &roads[i].to, &roads[i].distance);
    if(max_distance<roads[i].distance) max_distance=roads[i].distance;
  }
  for(i=0; i<K; i++){
    scanf("%d", &mall[i]);
  }
  
  longest_d=calc_longest(N, M, K, mall, roads, max_distance);
  printf("%d\n", longest_d);

  return 0;
}

int calc_longest(int N, int M, int K, int* mall, struct road* roads, int max_distance)
{
  int i;
  float longest_d, tmp_d;
  int longest_int;
  int d[3001];

  for(i=1; i<=N; i++) d[i]=max_distance*(M+1);
  calc_shortestDistance(N, M, K, mall, roads, max_distance, d);

  longest_d=0.0f;
  for(i=0; i<M; i++){
    tmp_d=(float)(d[roads[i].from]+d[roads[i].to]+roads[i].distance);
    tmp_d/=2.0f;
    if(longest_d<tmp_d) longest_d=tmp_d;
  }

  longest_int=longest_d+0.5f;
  return longest_int;
}

void calc_shortestDistance(int city_size, int n, int mall_size, int* mall, struct road* roads, int max_distance, int* d)
{
  int is_searched[3001]; //0:is not searched, 1:is searched.
  int min_d, min_city;
  int i;

  for(i=1; i<=city_size; i++) is_searched[i]=0;
  for(i=1; i<=city_size; i++) d[i]=max_distance*n+1;
  for(i=0; i<mall_size; i++) d[mall[i]]=0;

  while(1){
    min_d=max_distance*n+1;
    for(i=1; i<=city_size; i++){
      if(!is_searched[i] && d[i]<min_d){
	min_d=d[i];
	min_city=i;
      }
    }
    if(min_d==max_distance*n+1) break;

    for(i=0; i<n; i++){
      if(roads[i].from==min_city){
	if(d[roads[i].to]>min_d+roads[i].distance) d[roads[i].to]=min_d+roads[i].distance;
      }
      else if(roads[i].to==min_city){
	if(d[roads[i].from]>min_d+roads[i].distance) d[roads[i].from]=min_d+roads[i].distance;
      }
    }
    is_searched[min_city]=1;
  }

  return;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1208320(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3744, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1212048(%rbp), %rcx
	leaq	-1212052(%rbp), %rdx
	leaq	-1212056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1212044(%rbp)
	movl	$0, -1212040(%rbp)
	jmp	.L2
.L4:
	leaq	-1200016(%rbp), %rcx
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	8(%rax), %rcx
	leaq	-1200016(%rbp), %rsi
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	4(%rax), %rdx
	leaq	-1200016(%rbp), %rdi
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$1200008, %rax
	movl	(%rax), %eax
	cmpl	%eax, -1212044(%rbp)
	jge	.L3
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$1200008, %rax
	movl	(%rax), %eax
	movl	%eax, -1212044(%rbp)
.L3:
	addl	$1, -1212040(%rbp)
.L2:
	movl	-1212052(%rbp), %eax
	cmpl	%eax, -1212040(%rbp)
	jl	.L4
	movl	$0, -1212040(%rbp)
	jmp	.L5
.L6:
	leaq	-1212032(%rbp), %rdx
	movl	-1212040(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -1212040(%rbp)
.L5:
	movl	-1212048(%rbp), %eax
	cmpl	%eax, -1212040(%rbp)
	jl	.L6
	movl	-1212048(%rbp), %edx
	movl	-1212052(%rbp), %esi
	movl	-1212056(%rbp), %eax
	movl	-1212044(%rbp), %r8d
	leaq	-1200016(%rbp), %rdi
	leaq	-1212032(%rbp), %rcx
	movl	%r8d, %r9d
	movq	%rdi, %r8
	movl	%eax, %edi
	call	calc_longest
	movl	%eax, -1212036(%rbp)
	movl	-1212036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	calc_longest
	.type	calc_longest, @function
calc_longest:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3872, %rsp
	movl	%edi, -12036(%rbp)
	movl	%esi, -12040(%rbp)
	movl	%edx, -12044(%rbp)
	movq	%rcx, -12056(%rbp)
	movq	%r8, -12064(%rbp)
	movl	%r9d, -12048(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -12032(%rbp)
	jmp	.L10
.L11:
	movl	-12040(%rbp), %eax
	addl	$1, %eax
	imull	-12048(%rbp), %eax
	movl	%eax, %edx
	movl	-12032(%rbp), %eax
	cltq
	movl	%edx, -12016(%rbp,%rax,4)
	addl	$1, -12032(%rbp)
.L10:
	movl	-12032(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L11
	movl	-12048(%rbp), %r9d
	movq	-12064(%rbp), %r8
	movq	-12056(%rbp), %rcx
	movl	-12044(%rbp), %edx
	movl	-12040(%rbp), %esi
	movl	-12036(%rbp), %eax
	subq	$8, %rsp
	leaq	-12016(%rbp), %rdi
	pushq	%rdi
	movl	%eax, %edi
	call	calc_shortestDistance
	addq	$16, %rsp
	pxor	%xmm0, %xmm0
	movss	%xmm0, -12028(%rbp)
	movl	$0, -12032(%rbp)
	jmp	.L12
.L15:
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %ecx
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %eax
	addl	%eax, %ecx
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %eax
	addl	%ecx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2ssl	%eax, %xmm0
	movss	%xmm0, -12020(%rbp)
	movss	-12020(%rbp), %xmm0
	movss	.LC4(%rip), %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, -12020(%rbp)
	movss	-12020(%rbp), %xmm0
	comiss	-12028(%rbp), %xmm0
	jbe	.L13
	movss	-12020(%rbp), %xmm0
	movss	%xmm0, -12028(%rbp)
.L13:
	addl	$1, -12032(%rbp)
.L12:
	movl	-12032(%rbp), %eax
	cmpl	-12040(%rbp), %eax
	jl	.L15
	movss	-12028(%rbp), %xmm1
	movss	.LC5(%rip), %xmm0
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %eax
	movl	%eax, -12024(%rbp)
	movl	-12024(%rbp), %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	calc_longest, .-calc_longest
	.globl	calc_shortestDistance
	.type	calc_shortestDistance, @function
calc_shortestDistance:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3888, %rsp
	movl	%edi, -12036(%rbp)
	movl	%esi, -12040(%rbp)
	movl	%edx, -12044(%rbp)
	movq	%rcx, -12056(%rbp)
	movq	%r8, -12064(%rbp)
	movl	%r9d, -12048(%rbp)
	movq	16(%rbp), %rax
	movq	%rax, -12072(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -12020(%rbp)
	jmp	.L20
.L21:
	movl	-12020(%rbp), %eax
	cltq
	movl	$0, -12016(%rbp,%rax,4)
	addl	$1, -12020(%rbp)
.L20:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L21
	movl	$1, -12020(%rbp)
	jmp	.L22
.L23:
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	movl	%eax, %edx
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-12072(%rbp), %rax
	addq	%rcx, %rax
	addl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -12020(%rbp)
.L22:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L23
	movl	$0, -12020(%rbp)
	jmp	.L24
.L25:
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -12020(%rbp)
.L24:
	movl	-12020(%rbp), %eax
	cmpl	-12044(%rbp), %eax
	jl	.L25
.L35:
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12028(%rbp)
	movl	$1, -12020(%rbp)
	jmp	.L26
.L28:
	movl	-12020(%rbp), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L27
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12028(%rbp)
	jle	.L27
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12028(%rbp)
	movl	-12020(%rbp), %eax
	movl	%eax, -12024(%rbp)
.L27:
	addl	$1, -12020(%rbp)
.L26:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L28
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -12028(%rbp)
	je	.L39
	movl	$0, -12020(%rbp)
	jmp	.L31
.L34:
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12024(%rbp)
	jne	.L32
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-12028(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, %ecx
	jle	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	-12028(%rbp), %edx
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L33
.L32:
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, -12024(%rbp)
	jne	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-12028(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, %ecx
	jle	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	-12028(%rbp), %edx
	addl	%ecx, %edx
	movl	%edx, (%rax)
.L33:
	addl	$1, -12020(%rbp)
.L31:
	movl	-12020(%rbp), %eax
	cmpl	-12040(%rbp), %eax
	jl	.L34
	movl	-12024(%rbp), %eax
	cltq
	movl	$1, -12016(%rbp,%rax,4)
	jmp	.L35
.L39:
	nop
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	calc_shortestDistance, .-calc_shortestDistance
	.section	.rodata
	.align 4
.LC4:
	.long	1073741824
	.align 4
.LC5:
	.long	1056964608
	.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
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-1208320(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3744, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1212048(%rbp), %rcx
	leaq	-1212052(%rbp), %rdx
	leaq	-1212056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1212044(%rbp)
	movl	$0, -1212040(%rbp)
	jmp	.L2
.L4:
	leaq	-1200016(%rbp), %rcx
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	8(%rax), %rcx
	leaq	-1200016(%rbp), %rsi
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	4(%rax), %rdx
	leaq	-1200016(%rbp), %rdi
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$1200008, %rax
	movl	(%rax), %eax
	cmpl	%eax, -1212044(%rbp)
	jge	.L3
	movl	-1212040(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$1200008, %rax
	movl	(%rax), %eax
	movl	%eax, -1212044(%rbp)
.L3:
	addl	$1, -1212040(%rbp)
.L2:
	movl	-1212052(%rbp), %eax
	cmpl	%eax, -1212040(%rbp)
	jl	.L4
	movl	$0, -1212040(%rbp)
	jmp	.L5
.L6:
	leaq	-1212032(%rbp), %rdx
	movl	-1212040(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -1212040(%rbp)
.L5:
	movl	-1212048(%rbp), %eax
	cmpl	%eax, -1212040(%rbp)
	jl	.L6
	movl	-1212048(%rbp), %edx
	movl	-1212052(%rbp), %esi
	movl	-1212056(%rbp), %eax
	movl	-1212044(%rbp), %r8d
	leaq	-1200016(%rbp), %rdi
	leaq	-1212032(%rbp), %rcx
	movl	%r8d, %r9d
	movq	%rdi, %r8
	movl	%eax, %edi
	call	calc_longest
	movl	%eax, -1212036(%rbp)
	movl	-1212036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	calc_longest
	.type	calc_longest, @function
calc_longest:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3872, %rsp
	movl	%edi, -12036(%rbp)
	movl	%esi, -12040(%rbp)
	movl	%edx, -12044(%rbp)
	movq	%rcx, -12056(%rbp)
	movq	%r8, -12064(%rbp)
	movl	%r9d, -12048(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -12032(%rbp)
	jmp	.L10
.L11:
	movl	-12040(%rbp), %eax
	addl	$1, %eax
	imull	-12048(%rbp), %eax
	movl	%eax, %edx
	movl	-12032(%rbp), %eax
	cltq
	movl	%edx, -12016(%rbp,%rax,4)
	addl	$1, -12032(%rbp)
.L10:
	movl	-12032(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L11
	movl	-12048(%rbp), %r9d
	movq	-12064(%rbp), %r8
	movq	-12056(%rbp), %rcx
	movl	-12044(%rbp), %edx
	movl	-12040(%rbp), %esi
	movl	-12036(%rbp), %eax
	subq	$8, %rsp
	leaq	-12016(%rbp), %rdi
	pushq	%rdi
	movl	%eax, %edi
	call	calc_shortestDistance
	addq	$16, %rsp
	pxor	%xmm0, %xmm0
	movss	%xmm0, -12028(%rbp)
	movl	$0, -12032(%rbp)
	jmp	.L12
.L15:
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %ecx
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %eax
	addl	%eax, %ecx
	movl	-12032(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %eax
	addl	%ecx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2ssl	%eax, %xmm0
	movss	%xmm0, -12020(%rbp)
	movss	-12020(%rbp), %xmm0
	movss	.LC4(%rip), %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, -12020(%rbp)
	movss	-12020(%rbp), %xmm0
	comiss	-12028(%rbp), %xmm0
	jbe	.L13
	movss	-12020(%rbp), %xmm0
	movss	%xmm0, -12028(%rbp)
.L13:
	addl	$1, -12032(%rbp)
.L12:
	movl	-12032(%rbp), %eax
	cmpl	-12040(%rbp), %eax
	jl	.L15
	movss	-12028(%rbp), %xmm1
	movss	.LC5(%rip), %xmm0
	addss	%xmm1, %xmm0
	cvttss2sil	%xmm0, %eax
	movl	%eax, -12024(%rbp)
	movl	-12024(%rbp), %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	calc_longest, .-calc_longest
	.globl	calc_shortestDistance
	.type	calc_shortestDistance, @function
calc_shortestDistance:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3888, %rsp
	movl	%edi, -12036(%rbp)
	movl	%esi, -12040(%rbp)
	movl	%edx, -12044(%rbp)
	movq	%rcx, -12056(%rbp)
	movq	%r8, -12064(%rbp)
	movl	%r9d, -12048(%rbp)
	movq	16(%rbp), %rax
	movq	%rax, -12072(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -12020(%rbp)
	jmp	.L20
.L21:
	movl	-12020(%rbp), %eax
	cltq
	movl	$0, -12016(%rbp,%rax,4)
	addl	$1, -12020(%rbp)
.L20:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L21
	movl	$1, -12020(%rbp)
	jmp	.L22
.L23:
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	movl	%eax, %edx
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-12072(%rbp), %rax
	addq	%rcx, %rax
	addl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -12020(%rbp)
.L22:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L23
	movl	$0, -12020(%rbp)
	jmp	.L24
.L25:
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -12020(%rbp)
.L24:
	movl	-12020(%rbp), %eax
	cmpl	-12044(%rbp), %eax
	jl	.L25
.L35:
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12028(%rbp)
	movl	$1, -12020(%rbp)
	jmp	.L26
.L28:
	movl	-12020(%rbp), %eax
	cltq
	movl	-12016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L27
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12028(%rbp)
	jle	.L27
	movl	-12020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12028(%rbp)
	movl	-12020(%rbp), %eax
	movl	%eax, -12024(%rbp)
.L27:
	addl	$1, -12020(%rbp)
.L26:
	movl	-12020(%rbp), %eax
	cmpl	-12036(%rbp), %eax
	jle	.L28
	movl	-12048(%rbp), %eax
	imull	-12040(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -12028(%rbp)
	je	.L39
	movl	$0, -12020(%rbp)
	jmp	.L31
.L34:
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12024(%rbp)
	jne	.L32
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-12028(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, %ecx
	jle	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	-12028(%rbp), %edx
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L33
.L32:
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, -12024(%rbp)
	jne	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %edx
	movl	-12028(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, %ecx
	jle	.L33
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	8(%rax), %ecx
	movl	-12020(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movq	-12064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-12072(%rbp), %rax
	addq	%rdx, %rax
	movl	-12028(%rbp), %edx
	addl	%ecx, %edx
	movl	%edx, (%rax)
.L33:
	addl	$1, -12020(%rbp)
.L31:
	movl	-12020(%rbp), %eax
	cmpl	-12040(%rbp), %eax
	jl	.L34
	movl	-12024(%rbp), %eax
	cltq
	movl	$1, -12016(%rbp,%rax,4)
	jmp	.L35
.L39:
	nop
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	calc_shortestDistance, .-calc_shortestDistance
	.section	.rodata
	.align 4
.LC4:
	.long	1073741824
	.align 4
.LC5:
	.long	1056964608
	.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:
