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 <string.h>
#include <limits.h>

#define MIN(A,B) \
  ( (A) < (B) ? (A) : (B) )

struct
{
  char name[ 128 ];
  int  value;
}   item[ 128 ];
int item_count;

struct
{
  char name[ 128 ];
  char need[ 128 ][ 128 ];
  int  need_count;
} recipe[ 128 ];
int recipe_count;

static int
solve (
  const char * name
  )
{
  int res = INT_MAX;
  int i, j;

  for ( i = 0; i < item_count; ++i )
  {
    if ( strcmp ( name, item[ i ].name ) )  continue;

    res = MIN( res, item[ i ].value );
  }

  for ( i = 0; i < recipe_count; ++i )
  {
    int tmp = 0;

    if ( strcmp ( name, recipe[ i ].name ) ) continue;

    for ( j = 0; j < recipe[ i ].need_count; ++j )
    {
      const int G__1 = solve ( recipe[ i ].need[ j ] );
      if ( tmp  == INT_MAX
        || G__1 == INT_MAX ) tmp = INT_MAX;
      else tmp += solve ( recipe[ i ].need[ j ] );
    }

    res = MIN ( res, tmp );
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; )
  {
    char require[ 128 ];

    scanf ( " %d", &item_count );
    if ( !( item_count ) )  break ;

    for ( i = 0; i < item_count; ++i )
    {
      scanf ( " %s %d", item[ i ].name, &item[ i ].value );
    }
    scanf ( " %d", &recipe_count );
    for ( i = 0; i < recipe_count; ++i )
    {
      scanf ( " %s %d", recipe[ i ].name, &recipe[ i ].need_count );
      for ( j = 0; j < recipe[ i ].need_count; ++j )
      {
        scanf ( " %s", recipe[ i ].need[ j ] );
      }
    }
    scanf ( " %s", require );

    printf ( "%d\n", solve ( require ) );
  }

  return ( 0 );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	item
	.bss
	.align 32
	.type	item, @object
	.size	item, 16896
item:
	.zero	16896
	.globl	item_count
	.align 4
	.type	item_count, @object
	.size	item_count, 4
item_count:
	.zero	4
	.globl	recipe
	.align 32
	.type	recipe, @object
	.size	recipe, 2114048
recipe:
	.zero	2114048
	.globl	recipe_count
	.align 4
	.type	recipe_count, @object
	.size	recipe_count, 4
recipe_count:
	.zero	4
	.text
	.type	solve, @function
solve:
.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	%rdi, -40(%rbp)
	movl	$2147483647, -20(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L5:
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	item(%rip), %rdx
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L16
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	128+item(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L16:
	nop
.L4:
	addl	$1, -16(%rbp)
.L2:
	movl	item_count(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L14:
	movl	$0, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	recipe(%rip), %rdx
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L17
	movl	$0, -12(%rbp)
	jmp	.L9
.L13:
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	solve
	movl	%eax, -4(%rbp)
	cmpl	$2147483647, -8(%rbp)
	je	.L10
	cmpl	$2147483647, -4(%rbp)
	jne	.L11
.L10:
	movl	$2147483647, -8(%rbp)
	jmp	.L12
.L11:
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	solve
	addl	%eax, -8(%rbp)
.L12:
	addl	$1, -12(%rbp)
.L9:
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512+recipe(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L13
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L8
.L17:
	nop
.L8:
	addl	$1, -16(%rbp)
.L6:
	movl	recipe_count(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	movl	-20(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	" %d"
.LC1:
	.string	" %s %d"
.LC2:
	.string	" %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$176, %rsp
	movl	%edi, -164(%rbp)
	movq	%rsi, -176(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L27:
	leaq	item_count(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	item_count(%rip), %eax
	testl	%eax, %eax
	jne	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	jmp	.L29
.L19:
	movl	$0, -152(%rbp)
	jmp	.L21
.L22:
	movl	-152(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	128(%rax), %rdx
	leaq	item(%rip), %rax
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$5, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	leaq	item(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -152(%rbp)
.L21:
	movl	item_count(%rip), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L22
	leaq	recipe_count(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -152(%rbp)
	jmp	.L23
.L26:
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512(%rax), %rdx
	leaq	recipe(%rip), %rax
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	recipe(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L24
.L25:
	movl	-148(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L24:
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512+recipe(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L25
	addl	$1, -152(%rbp)
.L23:
	movl	recipe_count(%rip), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L26
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	solve
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L27
.L29:
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.type	solve, @function
solve:
.LFB35:
	.cfi_startproc
	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
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	item_count(%rip), %eax
	testl	%eax, %eax
	jle	.L11
	leal	-1(%rax), %edx
	leaq	item(%rip), %rbx
	movl	$2147483647, %r12d
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	leaq	132(%rbx), %rdx
	leaq	(%rdx,%rax,4), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	128(%rbx), %eax
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
.L3:
	addq	$132, %rbx
	cmpq	%r13, %rbx
	jne	.L4
.L2:
	movl	recipe_count(%rip), %eax
	testl	%eax, %eax
	jle	.L1
	leal	-1(%rax), %ebx
	leaq	128+recipe(%rip), %r15
	movq	$-128, %r13
	imulq	$16516, %rbx, %rbx
	leaq	16516(%r15), %rax
	addq	%rax, %rbx
	leaq	-128(%r15), %rax
	subq	%rax, %r13
.L10:
	leaq	-128(%r15), %rsi
	movq	%rbp, %rdi
	leaq	0(%r13,%r15), %r14
	call	strcmp@PLT
	movl	%eax, %ecx
	testl	%eax, %eax
	je	.L18
.L6:
	addq	$16516, %r15
	cmpq	%rbx, %r15
	jne	.L10
.L1:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.L18:
	.cfi_restore_state
	movl	16384(%r15), %eax
	testl	%eax, %eax
	jle	.L7
	leal	-1(%rax), %esi
	leaq	recipe(%rip), %rax
	leaq	256(%rax,%r14), %rax
	salq	$7, %rsi
	movq	%r15, %r14
	addq	%rax, %rsi
.L9:
	movq	%r14, %rdi
	movq	%rsi, 8(%rsp)
	movl	%ecx, 4(%rsp)
	call	solve
	movl	4(%rsp), %ecx
	movq	8(%rsp), %rsi
	cmpl	$2147483647, %ecx
	je	.L12
	addl	%eax, %ecx
	cmpl	$2147483647, %eax
	jne	.L8
.L12:
	movl	$2147483647, %ecx
.L8:
	subq	$-128, %r14
	cmpq	%rsi, %r14
	jne	.L9
.L7:
	cmpl	%ecx, %r12d
	cmovg	%ecx, %r12d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	$2147483647, %r12d
	jmp	.L2
	.cfi_endproc
.LFE35:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" %d"
.LC1:
	.string	" %s %d"
.LC2:
	.string	" %s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.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
	leaq	.LC1(%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	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L26:
	leaq	item_count(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	item_count(%rip), %ecx
	testl	%ecx, %ecx
	je	.L20
	leaq	item(%rip), %rbx
	movl	$0, %r12d
	jle	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	128(%rbx), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	addl	$1, %r12d
	addq	$132, %rbx
	cmpl	%r12d, item_count(%rip)
	jg	.L24
.L25:
	leaq	recipe_count(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	recipe_count(%rip), %edx
	leaq	recipe(%rip), %rbx
	testl	%edx, %edx
	jle	.L23
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	16512(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16512(%rbx), %eax
	leaq	128(%rbx), %r14
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jle	.L30
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	subq	$-128, %r14
	cmpl	%r15d, 16512(%rbx)
	jg	.L29
.L30:
	addl	$1, %r12d
	addq	$16516, %rbx
	cmpl	%r12d, recipe_count(%rip)
	jg	.L28
.L23:
	movq	%rsp, %r12
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	solve
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L26
.L20:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L39
	addq	$152, %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
.L39:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	recipe_count
	.bss
	.align 4
	.type	recipe_count, @object
	.size	recipe_count, 4
recipe_count:
	.zero	4
	.globl	recipe
	.align 32
	.type	recipe, @object
	.size	recipe, 2114048
recipe:
	.zero	2114048
	.globl	item_count
	.align 4
	.type	item_count, @object
	.size	item_count, 4
item_count:
	.zero	4
	.globl	item
	.align 32
	.type	item, @object
	.size	item, 16896
item:
	.zero	16896
	.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
	.type	solve, @function
solve:
.LFB35:
	.cfi_startproc
	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
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	item_count(%rip), %eax
	testl	%eax, %eax
	jle	.L11
	leal	-1(%rax), %edx
	leaq	item(%rip), %rbx
	movl	$2147483647, %r12d
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	leaq	132(%rbx), %rdx
	leaq	(%rdx,%rax,4), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	128(%rbx), %eax
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
.L3:
	addq	$132, %rbx
	cmpq	%r13, %rbx
	jne	.L4
.L2:
	movl	recipe_count(%rip), %eax
	testl	%eax, %eax
	jle	.L1
	leal	-1(%rax), %ebx
	leaq	128+recipe(%rip), %r15
	movq	$-128, %r13
	imulq	$16516, %rbx, %rbx
	leaq	16516(%r15), %rax
	addq	%rax, %rbx
	leaq	-128(%r15), %rax
	subq	%rax, %r13
.L10:
	leaq	-128(%r15), %rsi
	movq	%rbp, %rdi
	leaq	0(%r13,%r15), %r14
	call	strcmp@PLT
	movl	%eax, %ecx
	testl	%eax, %eax
	je	.L18
.L6:
	addq	$16516, %r15
	cmpq	%rbx, %r15
	jne	.L10
.L1:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.L18:
	.cfi_restore_state
	movl	16384(%r15), %eax
	testl	%eax, %eax
	jle	.L7
	leal	-1(%rax), %esi
	leaq	recipe(%rip), %rax
	leaq	256(%rax,%r14), %rax
	salq	$7, %rsi
	movq	%r15, %r14
	addq	%rax, %rsi
.L9:
	movq	%r14, %rdi
	movq	%rsi, 8(%rsp)
	movl	%ecx, 4(%rsp)
	call	solve
	movl	4(%rsp), %ecx
	movq	8(%rsp), %rsi
	cmpl	$2147483647, %ecx
	je	.L12
	addl	%eax, %ecx
	cmpl	$2147483647, %eax
	jne	.L8
.L12:
	movl	$2147483647, %ecx
.L8:
	subq	$-128, %r14
	cmpq	%rsi, %r14
	jne	.L9
.L7:
	cmpl	%ecx, %r12d
	cmovg	%ecx, %r12d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	$2147483647, %r12d
	jmp	.L2
	.cfi_endproc
.LFE35:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" %d"
.LC1:
	.string	" %s %d"
.LC2:
	.string	" %s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.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
	leaq	.LC1(%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	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L26:
	leaq	item_count(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	item_count(%rip), %ecx
	testl	%ecx, %ecx
	je	.L20
	leaq	item(%rip), %rbx
	movl	$0, %r12d
	jle	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	128(%rbx), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	addl	$1, %r12d
	addq	$132, %rbx
	cmpl	%r12d, item_count(%rip)
	jg	.L24
.L25:
	leaq	recipe_count(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	recipe_count(%rip), %edx
	leaq	recipe(%rip), %rbx
	testl	%edx, %edx
	jle	.L23
	.p2align 4,,10
	.p2align 3
.L28:
	leaq	16512(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16512(%rbx), %eax
	leaq	128(%rbx), %r14
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jle	.L30
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	subq	$-128, %r14
	cmpl	%r15d, 16512(%rbx)
	jg	.L29
.L30:
	addl	$1, %r12d
	addq	$16516, %rbx
	cmpl	%r12d, recipe_count(%rip)
	jg	.L28
.L23:
	movq	%rsp, %r12
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	solve
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L26
.L20:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L39
	addq	$152, %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
.L39:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	recipe_count
	.bss
	.align 4
	.type	recipe_count, @object
	.size	recipe_count, 4
recipe_count:
	.zero	4
	.globl	recipe
	.align 32
	.type	recipe, @object
	.size	recipe, 2114048
recipe:
	.zero	2114048
	.globl	item_count
	.align 4
	.type	item_count, @object
	.size	item_count, 4
item_count:
	.zero	4
	.globl	item
	.align 32
	.type	item, @object
	.size	item, 16896
item:
	.zero	16896
	.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 <string.h>
#include <limits.h>

#define MIN(A,B) \
  ( (A) < (B) ? (A) : (B) )

struct
{
  char name[ 128 ];
  int  value;
}   item[ 128 ];
int item_count;

struct
{
  char name[ 128 ];
  char need[ 128 ][ 128 ];
  int  need_count;
} recipe[ 128 ];
int recipe_count;

static int
solve (
  const char * name
  )
{
  int res = INT_MAX;
  int i, j;

  for ( i = 0; i < item_count; ++i )
  {
    if ( strcmp ( name, item[ i ].name ) )  continue;

    res = MIN( res, item[ i ].value );
  }

  for ( i = 0; i < recipe_count; ++i )
  {
    int tmp = 0;

    if ( strcmp ( name, recipe[ i ].name ) ) continue;

    for ( j = 0; j < recipe[ i ].need_count; ++j )
    {
      const int G__1 = solve ( recipe[ i ].need[ j ] );
      if ( tmp  == INT_MAX
        || G__1 == INT_MAX ) tmp = INT_MAX;
      else tmp += solve ( recipe[ i ].need[ j ] );
    }

    res = MIN ( res, tmp );
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; )
  {
    char require[ 128 ];

    scanf ( " %d", &item_count );
    if ( !( item_count ) )  break ;

    for ( i = 0; i < item_count; ++i )
    {
      scanf ( " %s %d", item[ i ].name, &item[ i ].value );
    }
    scanf ( " %d", &recipe_count );
    for ( i = 0; i < recipe_count; ++i )
    {
      scanf ( " %s %d", recipe[ i ].name, &recipe[ i ].need_count );
      for ( j = 0; j < recipe[ i ].need_count; ++j )
      {
        scanf ( " %s", recipe[ i ].need[ j ] );
      }
    }
    scanf ( " %s", require );

    printf ( "%d\n", solve ( require ) );
  }

  return ( 0 );
}
8
wood 3000
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 3000
string 800
rice 1
water 0
racket 5000
microphone 4961
onigiri 113
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 tekcar microphone onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 3000
string 800
rice 1
water 0
racket 5000
enohporcim 4961
onigiri 113
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 tekcar enohporcim onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 196
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 112750
-1
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 reci water
guitar 3 tekcar enohporcim onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 5003
string 800
rice 36
wrtea 0
racket 196
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microohone onigiri
guitar
1
computer 112750
-1
computer
0

8797
300000
 9997
300000
 9997
112750
 8762
300000
 98000
112750
 98000
300000
 98000
112750
 5193
112750
 98000
112750
 98000
112750

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 <string.h>
#include <limits.h>

#define MIN(A,B) \
  ( (A) < (B) ? (A) : (B) )

struct
{
  char name[ 128 ];
  int  value;
}   item[ 128 ];
int item_count;

struct
{
  char name[ 128 ];
  char need[ 128 ][ 128 ];
  int  need_count;
} recipe[ 128 ];
int recipe_count;

static int
solve (
  const char * name
  )
{
  int res = INT_MAX;
  int i, j;

  for ( i = 0; i < item_count; ++i )
  {
    if ( strcmp ( name, item[ i ].name ) )  continue;

    res = MIN( res, item[ i ].value );
  }

  for ( i = 0; i < recipe_count; ++i )
  {
    int tmp = 0;

    if ( strcmp ( name, recipe[ i ].name ) ) continue;

    for ( j = 0; j < recipe[ i ].need_count; ++j )
    {
      const int G__1 = solve ( recipe[ i ].need[ j ] );
      if ( tmp  == INT_MAX
        || G__1 == INT_MAX ) tmp = INT_MAX;
      else tmp += solve ( recipe[ i ].need[ j ] );
    }

    res = MIN ( res, tmp );
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; )
  {
    char require[ 128 ];

    scanf ( " %d", &item_count );
    if ( !( item_count ) )  break ;

    for ( i = 0; i < item_count; ++i )
    {
      scanf ( " %s %d", item[ i ].name, &item[ i ].value );
    }
    scanf ( " %d", &recipe_count );
    for ( i = 0; i < recipe_count; ++i )
    {
      scanf ( " %s %d", recipe[ i ].name, &recipe[ i ].need_count );
      for ( j = 0; j < recipe[ i ].need_count; ++j )
      {
        scanf ( " %s", recipe[ i ].need[ j ] );
      }
    }
    scanf ( " %s", require );

    printf ( "%d\n", solve ( require ) );
  }

  return ( 0 );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	item
	.bss
	.align 32
	.type	item, @object
	.size	item, 16896
item:
	.zero	16896
	.globl	item_count
	.align 4
	.type	item_count, @object
	.size	item_count, 4
item_count:
	.zero	4
	.globl	recipe
	.align 32
	.type	recipe, @object
	.size	recipe, 2114048
recipe:
	.zero	2114048
	.globl	recipe_count
	.align 4
	.type	recipe_count, @object
	.size	recipe_count, 4
recipe_count:
	.zero	4
	.text
	.type	solve, @function
solve:
.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	%rdi, -40(%rbp)
	movl	$2147483647, -20(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L5:
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	item(%rip), %rdx
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L16
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	128+item(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L16:
	nop
.L4:
	addl	$1, -16(%rbp)
.L2:
	movl	item_count(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L14:
	movl	$0, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	recipe(%rip), %rdx
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L17
	movl	$0, -12(%rbp)
	jmp	.L9
.L13:
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	solve
	movl	%eax, -4(%rbp)
	cmpl	$2147483647, -8(%rbp)
	je	.L10
	cmpl	$2147483647, -4(%rbp)
	jne	.L11
.L10:
	movl	$2147483647, -8(%rbp)
	jmp	.L12
.L11:
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	solve
	addl	%eax, -8(%rbp)
.L12:
	addl	$1, -12(%rbp)
.L9:
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512+recipe(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L13
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L8
.L17:
	nop
.L8:
	addl	$1, -16(%rbp)
.L6:
	movl	recipe_count(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	movl	-20(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	" %d"
.LC1:
	.string	" %s %d"
.LC2:
	.string	" %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$176, %rsp
	movl	%edi, -164(%rbp)
	movq	%rsi, -176(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L27:
	leaq	item_count(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	item_count(%rip), %eax
	testl	%eax, %eax
	jne	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	jmp	.L29
.L19:
	movl	$0, -152(%rbp)
	jmp	.L21
.L22:
	movl	-152(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	128(%rax), %rdx
	leaq	item(%rip), %rax
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$5, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	leaq	item(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -152(%rbp)
.L21:
	movl	item_count(%rip), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L22
	leaq	recipe_count(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -152(%rbp)
	jmp	.L23
.L26:
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512(%rax), %rdx
	leaq	recipe(%rip), %rax
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	recipe(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L24
.L25:
	movl	-148(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L24:
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512+recipe(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L25
	addl	$1, -152(%rbp)
.L23:
	movl	recipe_count(%rip), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L26
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	solve
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L27
.L29:
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	item
	.bss
	.align 32
	.type	item, @object
	.size	item, 16896
item:
	.zero	16896
	.globl	item_count
	.align 4
	.type	item_count, @object
	.size	item_count, 4
item_count:
	.zero	4
	.globl	recipe
	.align 32
	.type	recipe, @object
	.size	recipe, 2114048
recipe:
	.zero	2114048
	.globl	recipe_count
	.align 4
	.type	recipe_count, @object
	.size	recipe_count, 4
recipe_count:
	.zero	4
	.text
	.type	solve, @function
solve:
.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	%rdi, -40(%rbp)
	movl	$2147483647, -20(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L5:
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	item(%rip), %rdx
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L16
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	128+item(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L16:
	nop
.L4:
	addl	$1, -16(%rbp)
.L2:
	movl	item_count(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L14:
	movl	$0, -8(%rbp)
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	recipe(%rip), %rdx
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L17
	movl	$0, -12(%rbp)
	jmp	.L9
.L13:
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	solve
	movl	%eax, -4(%rbp)
	cmpl	$2147483647, -8(%rbp)
	je	.L10
	cmpl	$2147483647, -4(%rbp)
	jne	.L11
.L10:
	movl	$2147483647, -8(%rbp)
	jmp	.L12
.L11:
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	solve
	addl	%eax, -8(%rbp)
.L12:
	addl	$1, -12(%rbp)
.L9:
	movl	-16(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512+recipe(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L13
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L8
.L17:
	nop
.L8:
	addl	$1, -16(%rbp)
.L6:
	movl	recipe_count(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	movl	-20(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	" %d"
.LC1:
	.string	" %s %d"
.LC2:
	.string	" %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$176, %rsp
	movl	%edi, -164(%rbp)
	movq	%rsi, -176(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L27:
	leaq	item_count(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	item_count(%rip), %eax
	testl	%eax, %eax
	jne	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	jmp	.L29
.L19:
	movl	$0, -152(%rbp)
	jmp	.L21
.L22:
	movl	-152(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$5, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	128(%rax), %rdx
	leaq	item(%rip), %rax
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$5, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	leaq	item(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -152(%rbp)
.L21:
	movl	item_count(%rip), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L22
	leaq	recipe_count(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -152(%rbp)
	jmp	.L23
.L26:
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512(%rax), %rdx
	leaq	recipe(%rip), %rax
	addq	%rax, %rdx
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	recipe(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L24
.L25:
	movl	-148(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$7, %rax
	movq	%rax, %rdx
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	addq	%rax, %rdx
	leaq	recipe(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L24:
	movl	-152(%rbp), %eax
	cltq
	imulq	$16516, %rax, %rax
	leaq	16512+recipe(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L25
	addl	$1, -152(%rbp)
.L23:
	movl	recipe_count(%rip), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L26
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	solve
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L27
.L29:
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
