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>


const int toll[][8] = {
    {0, 300, 500, 600, 700, 1350, 1650},
    {300, 0, 350, 450, 600, 1150, 1500},
    {500, 350, 0, 250, 400, 1000, 1350},
    {600, 450, 250, 0, 250, 850, 1300},
    {700, 600, 400, 250, 0, 600, 1150},
    {1350, 1150, 1000, 850, 600, 0, 500},
    {1650, 1500, 1350, 1300, 1150, 500, 0}
};

const int dist[][8] = {
    {0, 6, 13, 18, 23, 43, 58},
    {6, 0, 7, 12, 17, 37, 52},
    {13, 7, 0, 5, 10, 30, 45},
    {18, 12, 5, 0, 5, 25, 40},
    {23, 17, 10, 5, 0, 20, 35},
    {43, 37, 30, 25, 20, 0, 15},
    {58, 52, 45, 40, 35, 15, 0}
};

int main(void) {
    int sic, sh, sm, gic, gh, gm, t, st, gt;

    while (scanf("%d", &sic) == 1 && sic) {
        scanf("%d%d", &sh, &sm);
        scanf("%d", &gic);
        scanf("%d%d", &gh, &gm);

        t = toll[sic-1][gic-1];
        st = sh * 100 + sm;
        gt = gh * 100 + gm; 
        if (((1730 <= st && st <= 1930) ||
             (1730 <= gt && gt <= 1930)) &&
            dist[sic-1][gic-1] <= 40) {
            t = ((t / 100) + (t % 100 > 0)) * 50;
        }
        printf("%d\n", t);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	toll
	.section	.rodata
	.align 32
	.type	toll, @object
	.size	toll, 224
toll:
	.long	0
	.long	300
	.long	500
	.long	600
	.long	700
	.long	1350
	.long	1650
	.zero	4
	.long	300
	.long	0
	.long	350
	.long	450
	.long	600
	.long	1150
	.long	1500
	.zero	4
	.long	500
	.long	350
	.long	0
	.long	250
	.long	400
	.long	1000
	.long	1350
	.zero	4
	.long	600
	.long	450
	.long	250
	.long	0
	.long	250
	.long	850
	.long	1300
	.zero	4
	.long	700
	.long	600
	.long	400
	.long	250
	.long	0
	.long	600
	.long	1150
	.zero	4
	.long	1350
	.long	1150
	.long	1000
	.long	850
	.long	600
	.long	0
	.long	500
	.zero	4
	.long	1650
	.long	1500
	.long	1350
	.long	1300
	.long	1150
	.long	500
	.long	0
	.zero	4
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 224
dist:
	.long	0
	.long	6
	.long	13
	.long	18
	.long	23
	.long	43
	.long	58
	.zero	4
	.long	6
	.long	0
	.long	7
	.long	12
	.long	17
	.long	37
	.long	52
	.zero	4
	.long	13
	.long	7
	.long	0
	.long	5
	.long	10
	.long	30
	.long	45
	.zero	4
	.long	18
	.long	12
	.long	5
	.long	0
	.long	5
	.long	25
	.long	40
	.zero	4
	.long	23
	.long	17
	.long	10
	.long	5
	.long	0
	.long	20
	.long	35
	.zero	4
	.long	43
	.long	37
	.long	30
	.long	25
	.long	20
	.long	0
	.long	15
	.zero	4
	.long	58
	.long	52
	.long	45
	.long	40
	.long	35
	.long	15
	.long	0
	.zero	4
.LC0:
	.string	"%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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	toll(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	movl	-40(%rbp), %eax
	imull	$100, %eax, %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	imull	$100, %eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	cmpl	$1729, -16(%rbp)
	jle	.L3
	cmpl	$1930, -16(%rbp)
	jle	.L4
.L3:
	cmpl	$1729, -12(%rbp)
	jle	.L5
	cmpl	$1930, -12(%rbp)
	jg	.L5
.L4:
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$40, %eax
	jg	.L5
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1374389535, %rax, %rax
	shrq	$32, %rax
	sarl	$5, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	testl	%eax, %eax
	setg	%al
	movzbl	%al, %eax
	addl	%esi, %eax
	imull	$50, %eax, %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L6
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
.L6:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	dist(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	toll(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L5
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	20(%rsp), %rdx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	movl	16(%rsp), %esi
	movl	20(%rsp), %edi
	leal	-1(%rax), %edx
	movl	12(%rsp), %eax
	movslq	%edx, %rdx
	subl	$1, %eax
	cltq
	leaq	(%rax,%rdx,8), %rcx
	movl	(%r14,%rcx,4), %r8d
	imull	$100, 4(%rsp), %ecx
	addl	8(%rsp), %ecx
	subl	$1730, %ecx
	cmpl	$200, %ecx
	jbe	.L3
	imull	$100, %esi, %esi
	leal	-1730(%rdi,%rsi), %ecx
	cmpl	$200, %ecx
	ja	.L4
.L3:
	leaq	(%rax,%rdx,8), %rax
	cmpl	$40, (%r15,%rax,4)
	jg	.L4
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	subl	%edx, %r8d
	testl	%r8d, %r8d
	setg	%r8b
	movzbl	%r8b, %r8d
	addl	%eax, %r8d
	imull	$50, %r8d, %r8d
.L4:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L10
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$40, %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
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	dist
	.section	.rodata
	.align 32
	.type	dist, @object
	.size	dist, 224
dist:
	.long	0
	.long	6
	.long	13
	.long	18
	.long	23
	.long	43
	.long	58
	.zero	4
	.long	6
	.long	0
	.long	7
	.long	12
	.long	17
	.long	37
	.long	52
	.zero	4
	.long	13
	.long	7
	.long	0
	.long	5
	.long	10
	.long	30
	.long	45
	.zero	4
	.long	18
	.long	12
	.long	5
	.long	0
	.long	5
	.long	25
	.long	40
	.zero	4
	.long	23
	.long	17
	.long	10
	.long	5
	.long	0
	.long	20
	.long	35
	.zero	4
	.long	43
	.long	37
	.long	30
	.long	25
	.long	20
	.long	0
	.long	15
	.zero	4
	.long	58
	.long	52
	.long	45
	.long	40
	.long	35
	.long	15
	.long	0
	.zero	4
	.globl	toll
	.align 32
	.type	toll, @object
	.size	toll, 224
toll:
	.long	0
	.long	300
	.long	500
	.long	600
	.long	700
	.long	1350
	.long	1650
	.zero	4
	.long	300
	.long	0
	.long	350
	.long	450
	.long	600
	.long	1150
	.long	1500
	.zero	4
	.long	500
	.long	350
	.long	0
	.long	250
	.long	400
	.long	1000
	.long	1350
	.zero	4
	.long	600
	.long	450
	.long	250
	.long	0
	.long	250
	.long	850
	.long	1300
	.zero	4
	.long	700
	.long	600
	.long	400
	.long	250
	.long	0
	.long	600
	.long	1150
	.zero	4
	.long	1350
	.long	1150
	.long	1000
	.long	850
	.long	600
	.long	0
	.long	500
	.zero	4
	.long	1650
	.long	1500
	.long	1350
	.long	1300
	.long	1150
	.long	500
	.long	0
	.zero	4
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	dist(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	toll(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L5
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	20(%rsp), %rdx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	movl	16(%rsp), %esi
	movl	20(%rsp), %edi
	leal	-1(%rax), %edx
	movl	12(%rsp), %eax
	movslq	%edx, %rdx
	subl	$1, %eax
	cltq
	leaq	(%rax,%rdx,8), %rcx
	movl	(%r14,%rcx,4), %r8d
	imull	$100, 4(%rsp), %ecx
	addl	8(%rsp), %ecx
	subl	$1730, %ecx
	cmpl	$200, %ecx
	jbe	.L3
	imull	$100, %esi, %esi
	leal	-1730(%rdi,%rsi), %ecx
	cmpl	$200, %ecx
	ja	.L4
.L3:
	leaq	(%rax,%rdx,8), %rax
	cmpl	$40, (%r15,%rax,4)
	jg	.L4
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	subl	%edx, %r8d
	testl	%r8d, %r8d
	setg	%r8b
	movzbl	%r8b, %r8d
	addl	%eax, %r8d
	imull	$50, %r8d, %r8d
.L4:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L10
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$40, %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
.L11:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	dist
	.section	.rodata
	.align 32
	.type	dist, @object
	.size	dist, 224
dist:
	.long	0
	.long	6
	.long	13
	.long	18
	.long	23
	.long	43
	.long	58
	.zero	4
	.long	6
	.long	0
	.long	7
	.long	12
	.long	17
	.long	37
	.long	52
	.zero	4
	.long	13
	.long	7
	.long	0
	.long	5
	.long	10
	.long	30
	.long	45
	.zero	4
	.long	18
	.long	12
	.long	5
	.long	0
	.long	5
	.long	25
	.long	40
	.zero	4
	.long	23
	.long	17
	.long	10
	.long	5
	.long	0
	.long	20
	.long	35
	.zero	4
	.long	43
	.long	37
	.long	30
	.long	25
	.long	20
	.long	0
	.long	15
	.zero	4
	.long	58
	.long	52
	.long	45
	.long	40
	.long	35
	.long	15
	.long	0
	.zero	4
	.globl	toll
	.align 32
	.type	toll, @object
	.size	toll, 224
toll:
	.long	0
	.long	300
	.long	500
	.long	600
	.long	700
	.long	1350
	.long	1650
	.zero	4
	.long	300
	.long	0
	.long	350
	.long	450
	.long	600
	.long	1150
	.long	1500
	.zero	4
	.long	500
	.long	350
	.long	0
	.long	250
	.long	400
	.long	1000
	.long	1350
	.zero	4
	.long	600
	.long	450
	.long	250
	.long	0
	.long	250
	.long	850
	.long	1300
	.zero	4
	.long	700
	.long	600
	.long	400
	.long	250
	.long	0
	.long	600
	.long	1150
	.zero	4
	.long	1350
	.long	1150
	.long	1000
	.long	850
	.long	600
	.long	0
	.long	500
	.zero	4
	.long	1650
	.long	1500
	.long	1350
	.long	1300
	.long	1150
	.long	500
	.long	0
	.zero	4
	.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>


const int toll[][8] = {
    {0, 300, 500, 600, 700, 1350, 1650},
    {300, 0, 350, 450, 600, 1150, 1500},
    {500, 350, 0, 250, 400, 1000, 1350},
    {600, 450, 250, 0, 250, 850, 1300},
    {700, 600, 400, 250, 0, 600, 1150},
    {1350, 1150, 1000, 850, 600, 0, 500},
    {1650, 1500, 1350, 1300, 1150, 500, 0}
};

const int dist[][8] = {
    {0, 6, 13, 18, 23, 43, 58},
    {6, 0, 7, 12, 17, 37, 52},
    {13, 7, 0, 5, 10, 30, 45},
    {18, 12, 5, 0, 5, 25, 40},
    {23, 17, 10, 5, 0, 20, 35},
    {43, 37, 30, 25, 20, 0, 15},
    {58, 52, 45, 40, 35, 15, 0}
};

int main(void) {
    int sic, sh, sm, gic, gh, gm, t, st, gt;

    while (scanf("%d", &sic) == 1 && sic) {
        scanf("%d%d", &sh, &sm);
        scanf("%d", &gic);
        scanf("%d%d", &gh, &gm);

        t = toll[sic-1][gic-1];
        st = sh * 100 + sm;
        gt = gh * 100 + gm; 
        if (((1730 <= st && st <= 1930) ||
             (1730 <= gt && gt <= 1930)) &&
            dist[sic-1][gic-1] <= 40) {
            t = ((t / 100) + (t % 100 > 0)) * 50;
        }
        printf("%d\n", t);
    }
    return 0;
}
2
17 25
4
17 45
4
17 25
7
1 35
0
 2
19 25
4
17 37
4
17 47
7
0 63
0
 2
14 25
4
3 37
4
17 47
7
0 63
0
 2
13 25
3
17 45
4
17 25
7
1 35
0
 2
14 25
4
17 37
0
17 47
7
0 63
0
 2
13 25
3
17 45
4
17 47
7
1 35
0
 2
19 25
4
23 37
3
17 25
7
1 63
0
 2
14 25
6
17 37
0
17 47
7
0 63
0
 2
14 25
4
3 57
6
17 47
7
0 63
0
 2
19 25
5
17 37
4
17 2
7
-1 63
0

250
1300
 250
650
 450
650
 200
1300
 250
 200
650
 250
1350
 600
 450
250
 300
1300

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>


const int toll[][8] = {
    {0, 300, 500, 600, 700, 1350, 1650},
    {300, 0, 350, 450, 600, 1150, 1500},
    {500, 350, 0, 250, 400, 1000, 1350},
    {600, 450, 250, 0, 250, 850, 1300},
    {700, 600, 400, 250, 0, 600, 1150},
    {1350, 1150, 1000, 850, 600, 0, 500},
    {1650, 1500, 1350, 1300, 1150, 500, 0}
};

const int dist[][8] = {
    {0, 6, 13, 18, 23, 43, 58},
    {6, 0, 7, 12, 17, 37, 52},
    {13, 7, 0, 5, 10, 30, 45},
    {18, 12, 5, 0, 5, 25, 40},
    {23, 17, 10, 5, 0, 20, 35},
    {43, 37, 30, 25, 20, 0, 15},
    {58, 52, 45, 40, 35, 15, 0}
};

int main(void) {
    int sic, sh, sm, gic, gh, gm, t, st, gt;

    while (scanf("%d", &sic) == 1 && sic) {
        scanf("%d%d", &sh, &sm);
        scanf("%d", &gic);
        scanf("%d%d", &gh, &gm);

        t = toll[sic-1][gic-1];
        st = sh * 100 + sm;
        gt = gh * 100 + gm; 
        if (((1730 <= st && st <= 1930) ||
             (1730 <= gt && gt <= 1930)) &&
            dist[sic-1][gic-1] <= 40) {
            t = ((t / 100) + (t % 100 > 0)) * 50;
        }
        printf("%d\n", t);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	toll
	.section	.rodata
	.align 32
	.type	toll, @object
	.size	toll, 224
toll:
	.long	0
	.long	300
	.long	500
	.long	600
	.long	700
	.long	1350
	.long	1650
	.zero	4
	.long	300
	.long	0
	.long	350
	.long	450
	.long	600
	.long	1150
	.long	1500
	.zero	4
	.long	500
	.long	350
	.long	0
	.long	250
	.long	400
	.long	1000
	.long	1350
	.zero	4
	.long	600
	.long	450
	.long	250
	.long	0
	.long	250
	.long	850
	.long	1300
	.zero	4
	.long	700
	.long	600
	.long	400
	.long	250
	.long	0
	.long	600
	.long	1150
	.zero	4
	.long	1350
	.long	1150
	.long	1000
	.long	850
	.long	600
	.long	0
	.long	500
	.zero	4
	.long	1650
	.long	1500
	.long	1350
	.long	1300
	.long	1150
	.long	500
	.long	0
	.zero	4
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 224
dist:
	.long	0
	.long	6
	.long	13
	.long	18
	.long	23
	.long	43
	.long	58
	.zero	4
	.long	6
	.long	0
	.long	7
	.long	12
	.long	17
	.long	37
	.long	52
	.zero	4
	.long	13
	.long	7
	.long	0
	.long	5
	.long	10
	.long	30
	.long	45
	.zero	4
	.long	18
	.long	12
	.long	5
	.long	0
	.long	5
	.long	25
	.long	40
	.zero	4
	.long	23
	.long	17
	.long	10
	.long	5
	.long	0
	.long	20
	.long	35
	.zero	4
	.long	43
	.long	37
	.long	30
	.long	25
	.long	20
	.long	0
	.long	15
	.zero	4
	.long	58
	.long	52
	.long	45
	.long	40
	.long	35
	.long	15
	.long	0
	.zero	4
.LC0:
	.string	"%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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	toll(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	movl	-40(%rbp), %eax
	imull	$100, %eax, %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	imull	$100, %eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	cmpl	$1729, -16(%rbp)
	jle	.L3
	cmpl	$1930, -16(%rbp)
	jle	.L4
.L3:
	cmpl	$1729, -12(%rbp)
	jle	.L5
	cmpl	$1930, -12(%rbp)
	jg	.L5
.L4:
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$40, %eax
	jg	.L5
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1374389535, %rax, %rax
	shrq	$32, %rax
	sarl	$5, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	testl	%eax, %eax
	setg	%al
	movzbl	%al, %eax
	addl	%esi, %eax
	imull	$50, %eax, %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L6
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
.L6:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	toll
	.section	.rodata
	.align 32
	.type	toll, @object
	.size	toll, 224
toll:
	.long	0
	.long	300
	.long	500
	.long	600
	.long	700
	.long	1350
	.long	1650
	.zero	4
	.long	300
	.long	0
	.long	350
	.long	450
	.long	600
	.long	1150
	.long	1500
	.zero	4
	.long	500
	.long	350
	.long	0
	.long	250
	.long	400
	.long	1000
	.long	1350
	.zero	4
	.long	600
	.long	450
	.long	250
	.long	0
	.long	250
	.long	850
	.long	1300
	.zero	4
	.long	700
	.long	600
	.long	400
	.long	250
	.long	0
	.long	600
	.long	1150
	.zero	4
	.long	1350
	.long	1150
	.long	1000
	.long	850
	.long	600
	.long	0
	.long	500
	.zero	4
	.long	1650
	.long	1500
	.long	1350
	.long	1300
	.long	1150
	.long	500
	.long	0
	.zero	4
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 224
dist:
	.long	0
	.long	6
	.long	13
	.long	18
	.long	23
	.long	43
	.long	58
	.zero	4
	.long	6
	.long	0
	.long	7
	.long	12
	.long	17
	.long	37
	.long	52
	.zero	4
	.long	13
	.long	7
	.long	0
	.long	5
	.long	10
	.long	30
	.long	45
	.zero	4
	.long	18
	.long	12
	.long	5
	.long	0
	.long	5
	.long	25
	.long	40
	.zero	4
	.long	23
	.long	17
	.long	10
	.long	5
	.long	0
	.long	20
	.long	35
	.zero	4
	.long	43
	.long	37
	.long	30
	.long	25
	.long	20
	.long	0
	.long	15
	.zero	4
	.long	58
	.long	52
	.long	45
	.long	40
	.long	35
	.long	15
	.long	0
	.zero	4
.LC0:
	.string	"%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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	toll(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	movl	-40(%rbp), %eax
	imull	$100, %eax, %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	imull	$100, %eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	cmpl	$1729, -16(%rbp)
	jle	.L3
	cmpl	$1930, -16(%rbp)
	jle	.L4
.L3:
	cmpl	$1729, -12(%rbp)
	jle	.L5
	cmpl	$1930, -12(%rbp)
	jg	.L5
.L4:
	movl	-44(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$40, %eax
	jg	.L5
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1374389535, %rax, %rax
	shrq	$32, %rax
	sarl	$5, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$100, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	testl	%eax, %eax
	setg	%al
	movzbl	%al, %eax
	addl	%esi, %eax
	imull	$50, %eax, %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L6
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
.L6:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
