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

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

/* subroutines */

int count_rec(int pi, int qi, int ai, int ni, int q0) {
  int a1, c, g, p1, q, q1;

  if (pi == 0) return 1;
  if (ni <= 0) return 0;

  c = 0;

  for (q = q0; q <= ai; q++) {
    p1 = pi * q - qi;
    if (p1 < 0) continue;
    q1 = qi * q;
    a1 = ai / q;
    c += count_rec(p1, q1, a1, ni - 1, q);
  }

  return c;
}


/* main */

int main(int argc, char **argv) {
  int ai, c, ni, pi, qi;

  for (;;) {
    scanf("%d%d%d%d", &pi, &qi, &ai, &ni);
    if ((pi | qi | ai | ni) == 0) break;

    c = count_rec(pi, qi, ai, ni, 1);
    printf("%d\n", c);
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	count_rec
	.type	count_rec, @function
count_rec:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	%r8d, -52(%rbp)
	cmpl	$0, -36(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -48(%rbp)
	jg	.L4
	movl	$0, %eax
	jmp	.L3
.L4:
	movl	$0, -20(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L8:
	movl	-36(%rbp), %eax
	imull	-16(%rbp), %eax
	subl	-40(%rbp), %eax
	movl	%eax, -12(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L9
	movl	-40(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-44(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%eax, -4(%rbp)
	movl	-48(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %edi
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%edi, %r8d
	movl	%eax, %edi
	call	count_rec
	addl	%eax, -20(%rbp)
	jmp	.L7
.L9:
	nop
.L7:
	addl	$1, -16(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L8
	movl	-20(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	count_rec, .-count_rec
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.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
	movl	%edi, -36(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L13:
	leaq	-24(%rbp), %rsi
	leaq	-28(%rbp), %rcx
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	orl	%eax, %edx
	movl	-28(%rbp), %eax
	orl	%eax, %edx
	movl	-24(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	je	.L17
	movl	-24(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	$1, %r8d
	movl	%eax, %edi
	call	count_rec
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	count_rec
	.type	count_rec, @function
count_rec:
.LFB51:
	.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	$104, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 40(%rsp)
	movl	%esi, 44(%rsp)
	movl	%edx, 24(%rsp)
	movl	%ecx, 16(%rsp)
	movl	$1, 20(%rsp)
	testl	%edi, %edi
	je	.L1
	movl	$0, 20(%rsp)
	testl	%ecx, %ecx
	jle	.L1
	cmpl	%edx, %r8d
	jg	.L1
	imull	%r8d, %edi
	movl	%r8d, 4(%rsp)
	subl	$5, %ecx
	movl	%edi, %eax
	subl	%esi, %eax
	imull	%r8d, %esi
	movl	%eax, %r11d
	movl	%esi, 12(%rsp)
.L20:
	testl	%r11d, %r11d
	js	.L3
	je	.L4
	cmpl	$1, 16(%rsp)
	je	.L3
	movl	24(%rsp), %eax
	movl	4(%rsp), %ebx
	cltd
	movl	%ebx, %r9d
	idivl	%ebx
	movl	%eax, 36(%rsp)
	cmpl	%ebx, %eax
	jl	.L3
	movl	12(%rsp), %edx
	movl	%ebx, %eax
	movl	%r11d, 52(%rsp)
	imull	%r11d, %eax
	movl	$0, 72(%rsp)
	imull	%edx, %ebx
	subl	%edx, %eax
	movl	%ebx, 8(%rsp)
	movl	%eax, %r10d
.L19:
	testl	%r10d, %r10d
	js	.L6
	je	.L7
	cmpl	$2, 16(%rsp)
	je	.L6
	movl	36(%rsp), %eax
	cltd
	idivl	%r9d
	movl	%eax, 32(%rsp)
	cmpl	%r9d, %eax
	jl	.L6
	movl	%r10d, %eax
	movl	8(%rsp), %edx
	movl	%r10d, 48(%rsp)
	movl	%r9d, %r15d
	imull	%r9d, %eax
	movl	$0, 68(%rsp)
	movl	%r9d, 92(%rsp)
	subl	%edx, %eax
	movl	%eax, %r11d
	movl	%edx, %eax
	imull	%r9d, %eax
	movl	%r11d, %r14d
	movl	%eax, %r11d
.L18:
	testl	%r14d, %r14d
	js	.L9
	je	.L10
	cmpl	$3, 16(%rsp)
	je	.L9
	movl	32(%rsp), %eax
	cltd
	idivl	%r15d
	movl	%eax, 28(%rsp)
	cmpl	%r15d, %eax
	jl	.L9
	movl	%r15d, %r9d
	movl	%r14d, %ebx
	movl	%r15d, 88(%rsp)
	movl	%r15d, %r12d
	imull	%r15d, %ebx
	movl	$0, 64(%rsp)
	movl	%r14d, %r10d
	imull	%r11d, %r9d
	subl	%r11d, %ebx
	movl	%r9d, %r15d
.L17:
	testl	%ebx, %ebx
	js	.L12
	je	.L13
	cmpl	$4, 16(%rsp)
	je	.L12
	movl	28(%rsp), %eax
	cltd
	idivl	%r12d
	cmpl	%r12d, %eax
	jl	.L12
	movl	%ebx, %r13d
	movl	%r12d, %esi
	movl	%r10d, 80(%rsp)
	xorl	%r9d, %r9d
	imull	%r12d, %r13d
	movl	%r11d, 76(%rsp)
	movl	%r12d, %ebp
	movl	%ebx, %r11d
	imull	%r15d, %esi
	movl	%r12d, 84(%rsp)
	movl	%eax, %ebx
	movl	%r15d, %r12d
	subl	%r15d, %r13d
	movl	%r9d, %r15d
	movl	%esi, %r14d
.L16:
	testl	%r13d, %r13d
	js	.L15
	movl	%ebx, %eax
	movl	%ebp, %r8d
	movl	%r14d, %esi
	movl	%r13d, %edi
	cltd
	movl	%r11d, 60(%rsp)
	idivl	%ebp
	movl	%ecx, 56(%rsp)
	movl	%eax, %edx
	call	count_rec
	movl	60(%rsp), %r11d
	movl	56(%rsp), %ecx
	addl	%eax, %r15d
.L15:
	addl	$1, %ebp
	addl	%r11d, %r13d
	addl	%r12d, %r14d
	cmpl	%ebp, %ebx
	jge	.L16
	movl	%r15d, %r9d
	addl	%r9d, 64(%rsp)
	movl	%r12d, %r15d
	movl	%r11d, %ebx
	movl	80(%rsp), %r10d
	movl	84(%rsp), %r12d
	movl	76(%rsp), %r11d
.L12:
	addl	$1, %r12d
	addl	%r10d, %ebx
	addl	%r11d, %r15d
	cmpl	%r12d, 28(%rsp)
	jge	.L17
	movl	64(%rsp), %edx
	addl	%edx, 68(%rsp)
	movl	%r10d, %r14d
	movl	88(%rsp), %r15d
.L9:
	addl	$1, %r15d
	addl	48(%rsp), %r14d
	addl	8(%rsp), %r11d
	cmpl	%r15d, 32(%rsp)
	jge	.L18
	movl	68(%rsp), %esi
	addl	%esi, 72(%rsp)
	movl	48(%rsp), %r10d
	movl	92(%rsp), %r9d
.L6:
	movl	12(%rsp), %esi
	addl	$1, %r9d
	addl	%esi, 8(%rsp)
	addl	52(%rsp), %r10d
	cmpl	%r9d, 36(%rsp)
	jge	.L19
	movl	72(%rsp), %edi
	addl	%edi, 20(%rsp)
	movl	52(%rsp), %r11d
.L3:
	addl	$1, 4(%rsp)
	movl	44(%rsp), %edx
	movl	4(%rsp), %eax
	addl	%edx, 12(%rsp)
	addl	40(%rsp), %r11d
	cmpl	%eax, 24(%rsp)
	jge	.L20
.L1:
	movl	20(%rsp), %eax
	addq	$104, %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
.L13:
	.cfi_restore_state
	addl	$1, 64(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, 68(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, 72(%rsp)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, 20(%rsp)
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	count_rec, .-count_rec
	.p2align 4
	.type	count_rec.part.0, @function
count_rec.part.0:
.LFB53:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%ecx, 16(%rsp)
	movl	$0, 12(%rsp)
	cmpl	%r8d, %edx
	jl	.L44
	movl	%edi, %r12d
	movl	%r8d, %r14d
	movl	%edi, (%rsp)
	movl	%esi, %r10d
	imull	%r8d, %r12d
	movl	%edx, %r9d
	movl	%r8d, %ebx
	subl	$2, %ecx
	imull	%esi, %r14d
	subl	%esi, %r12d
.L51:
	testl	%r12d, %r12d
	js	.L46
	je	.L47
	cmpl	$1, 16(%rsp)
	jle	.L46
	movl	%r9d, %eax
	cltd
	idivl	%ebx
	cmpl	%ebx, %eax
	jl	.L46
	movl	%r12d, %r13d
	movl	%ebx, %esi
	movl	%r9d, 24(%rsp)
	xorl	%r11d, %r11d
	imull	%ebx, %r13d
	movl	%r10d, 20(%rsp)
	movl	%ebx, %ebp
	movl	%r14d, %r10d
	imull	%r14d, %esi
	movl	%ebx, 28(%rsp)
	movl	%eax, %ebx
	subl	%r14d, %r13d
	movl	%r12d, %r14d
	movl	%r11d, %r12d
	movl	%esi, %r15d
.L50:
	testl	%r13d, %r13d
	js	.L49
	movl	%ebx, %eax
	movl	%ebp, %r8d
	movl	%r15d, %esi
	movl	%r13d, %edi
	cltd
	movl	%r10d, 8(%rsp)
	idivl	%ebp
	movl	%ecx, 4(%rsp)
	movl	%eax, %edx
	call	count_rec
	movl	8(%rsp), %r10d
	movl	4(%rsp), %ecx
	addl	%eax, %r12d
.L49:
	addl	$1, %ebp
	addl	%r14d, %r13d
	addl	%r10d, %r15d
	cmpl	%ebp, %ebx
	jge	.L50
	movl	%r12d, %r11d
	addl	%r11d, 12(%rsp)
	movl	%r14d, %r12d
	movl	24(%rsp), %r9d
	movl	%r10d, %r14d
	movl	28(%rsp), %ebx
	movl	20(%rsp), %r10d
.L46:
	addl	$1, %ebx
	addl	(%rsp), %r12d
	addl	%r10d, %r14d
	cmpl	%ebx, %r9d
	jge	.L51
.L44:
	movl	12(%rsp), %eax
	addq	$40, %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
.L47:
	.cfi_restore_state
	addl	$1, 12(%rsp)
	jmp	.L46
	.cfi_endproc
.LFE53:
	.size	count_rec.part.0, .-count_rec.part.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rax
	leaq	60(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %r14
	leaq	68(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L68:
	movq	8(%rsp), %rsi
	movq	%r13, %rdx
	xorl	%eax, %eax
	movq	%r15, %r8
	movq	%r14, %rcx
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %r9d
	movl	68(%rsp), %r10d
	movl	56(%rsp), %ebx
	movl	60(%rsp), %edx
	movl	%r9d, %eax
	orl	%r10d, %eax
	orl	%ebx, %eax
	orl	%edx, %eax
	je	.L57
	movl	$1, %r12d
	testl	%r9d, %r9d
	je	.L58
	xorl	%r12d, %r12d
	testl	%edx, %edx
	jle	.L58
	testl	%ebx, %ebx
	jle	.L58
	movl	%edx, %ecx
	subl	$1, %ecx
	je	.L59
	movl	%r9d, %edi
	movq	%r13, 24(%rsp)
	movl	%r12d, %r11d
	movl	$1, %ebp
	subl	%r10d, %edi
	movq	%r14, 32(%rsp)
	movl	%ebx, %r12d
	movl	%r9d, %r14d
	movq	%r15, 40(%rsp)
	movl	%r10d, %ebx
	movl	%edi, %r13d
	movl	%r10d, %r15d
.L64:
	testl	%r13d, %r13d
	js	.L60
	je	.L61
	movl	%r12d, %eax
	movl	%ebp, %r8d
	movl	%ebx, %esi
	movl	%r13d, %edi
	cltd
	movl	%r11d, 20(%rsp)
	idivl	%ebp
	movl	%ecx, 16(%rsp)
	movl	%eax, %edx
	call	count_rec.part.0
	movl	20(%rsp), %r11d
	movl	16(%rsp), %ecx
	addl	%eax, %r11d
.L60:
	addl	$1, %ebp
	addl	%r14d, %r13d
	addl	%r15d, %ebx
	cmpl	%ebp, %r12d
	jge	.L64
	movq	24(%rsp), %r13
	movq	32(%rsp), %r14
	movl	%r11d, %r12d
	movq	40(%rsp), %r15
.L58:
	movl	%r12d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L68
	.p2align 4,,10
	.p2align 3
.L61:
	addl	$1, %r11d
	jmp	.L60
	.p2align 4,,10
	.p2align 3
.L57:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L77
	addq	$88, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	movl	%r9d, %eax
	addl	$1, %ebx
	movl	$1, %edx
	subl	%r10d, %eax
.L67:
	cmpl	$1, %eax
	movl	%r12d, %ecx
	adcl	$0, %r12d
	testl	%eax, %eax
	cmovs	%ecx, %r12d
	addl	$1, %edx
	addl	%r9d, %eax
	cmpl	%ebx, %edx
	jne	.L67
	jmp	.L58
.L77:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	count_rec
	.type	count_rec, @function
count_rec:
.LFB51:
	.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	$104, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 40(%rsp)
	movl	%esi, 44(%rsp)
	movl	%edx, 24(%rsp)
	movl	%ecx, 16(%rsp)
	movl	$1, 20(%rsp)
	testl	%edi, %edi
	je	.L1
	movl	$0, 20(%rsp)
	testl	%ecx, %ecx
	jle	.L1
	cmpl	%edx, %r8d
	jg	.L1
	imull	%r8d, %edi
	movl	%r8d, 4(%rsp)
	subl	$5, %ecx
	movl	%edi, %eax
	subl	%esi, %eax
	imull	%r8d, %esi
	movl	%eax, %r11d
	movl	%esi, 12(%rsp)
.L20:
	testl	%r11d, %r11d
	js	.L3
	je	.L4
	cmpl	$1, 16(%rsp)
	je	.L3
	movl	24(%rsp), %eax
	movl	4(%rsp), %ebx
	cltd
	movl	%ebx, %r9d
	idivl	%ebx
	movl	%eax, 36(%rsp)
	cmpl	%ebx, %eax
	jl	.L3
	movl	12(%rsp), %edx
	movl	%ebx, %eax
	movl	%r11d, 52(%rsp)
	imull	%r11d, %eax
	movl	$0, 72(%rsp)
	imull	%edx, %ebx
	subl	%edx, %eax
	movl	%ebx, 8(%rsp)
	movl	%eax, %r10d
.L19:
	testl	%r10d, %r10d
	js	.L6
	je	.L7
	cmpl	$2, 16(%rsp)
	je	.L6
	movl	36(%rsp), %eax
	cltd
	idivl	%r9d
	movl	%eax, 32(%rsp)
	cmpl	%r9d, %eax
	jl	.L6
	movl	%r10d, %eax
	movl	8(%rsp), %edx
	movl	%r10d, 48(%rsp)
	movl	%r9d, %r15d
	imull	%r9d, %eax
	movl	$0, 68(%rsp)
	movl	%r9d, 92(%rsp)
	subl	%edx, %eax
	movl	%eax, %r11d
	movl	%edx, %eax
	imull	%r9d, %eax
	movl	%r11d, %r14d
	movl	%eax, %r11d
.L18:
	testl	%r14d, %r14d
	js	.L9
	je	.L10
	cmpl	$3, 16(%rsp)
	je	.L9
	movl	32(%rsp), %eax
	cltd
	idivl	%r15d
	movl	%eax, 28(%rsp)
	cmpl	%r15d, %eax
	jl	.L9
	movl	%r15d, %r9d
	movl	%r14d, %ebx
	movl	%r15d, 88(%rsp)
	movl	%r15d, %r12d
	imull	%r15d, %ebx
	movl	$0, 64(%rsp)
	movl	%r14d, %r10d
	imull	%r11d, %r9d
	subl	%r11d, %ebx
	movl	%r9d, %r15d
.L17:
	testl	%ebx, %ebx
	js	.L12
	je	.L13
	cmpl	$4, 16(%rsp)
	je	.L12
	movl	28(%rsp), %eax
	cltd
	idivl	%r12d
	cmpl	%r12d, %eax
	jl	.L12
	movl	%ebx, %r13d
	movl	%r12d, %esi
	movl	%r10d, 80(%rsp)
	xorl	%r9d, %r9d
	imull	%r12d, %r13d
	movl	%r11d, 76(%rsp)
	movl	%r12d, %ebp
	movl	%ebx, %r11d
	imull	%r15d, %esi
	movl	%r12d, 84(%rsp)
	movl	%eax, %ebx
	movl	%r15d, %r12d
	subl	%r15d, %r13d
	movl	%r9d, %r15d
	movl	%esi, %r14d
.L16:
	testl	%r13d, %r13d
	js	.L15
	movl	%ebx, %eax
	movl	%ebp, %r8d
	movl	%r14d, %esi
	movl	%r13d, %edi
	cltd
	movl	%r11d, 60(%rsp)
	idivl	%ebp
	movl	%ecx, 56(%rsp)
	movl	%eax, %edx
	call	count_rec
	movl	60(%rsp), %r11d
	movl	56(%rsp), %ecx
	addl	%eax, %r15d
.L15:
	addl	$1, %ebp
	addl	%r11d, %r13d
	addl	%r12d, %r14d
	cmpl	%ebp, %ebx
	jge	.L16
	movl	%r15d, %r9d
	addl	%r9d, 64(%rsp)
	movl	%r12d, %r15d
	movl	%r11d, %ebx
	movl	80(%rsp), %r10d
	movl	84(%rsp), %r12d
	movl	76(%rsp), %r11d
.L12:
	addl	$1, %r12d
	addl	%r10d, %ebx
	addl	%r11d, %r15d
	cmpl	%r12d, 28(%rsp)
	jge	.L17
	movl	64(%rsp), %edx
	addl	%edx, 68(%rsp)
	movl	%r10d, %r14d
	movl	88(%rsp), %r15d
.L9:
	addl	$1, %r15d
	addl	48(%rsp), %r14d
	addl	8(%rsp), %r11d
	cmpl	%r15d, 32(%rsp)
	jge	.L18
	movl	68(%rsp), %esi
	addl	%esi, 72(%rsp)
	movl	48(%rsp), %r10d
	movl	92(%rsp), %r9d
.L6:
	movl	12(%rsp), %esi
	addl	$1, %r9d
	addl	%esi, 8(%rsp)
	addl	52(%rsp), %r10d
	cmpl	%r9d, 36(%rsp)
	jge	.L19
	movl	72(%rsp), %edi
	addl	%edi, 20(%rsp)
	movl	52(%rsp), %r11d
.L3:
	addl	$1, 4(%rsp)
	movl	44(%rsp), %edx
	movl	4(%rsp), %eax
	addl	%edx, 12(%rsp)
	addl	40(%rsp), %r11d
	cmpl	%eax, 24(%rsp)
	jge	.L20
.L1:
	movl	20(%rsp), %eax
	addq	$104, %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
.L13:
	.cfi_restore_state
	addl	$1, 64(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, 68(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, 72(%rsp)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, 20(%rsp)
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	count_rec, .-count_rec
	.p2align 4
	.type	count_rec.part.0, @function
count_rec.part.0:
.LFB53:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%ecx, 16(%rsp)
	movl	$0, 12(%rsp)
	cmpl	%r8d, %edx
	jl	.L44
	movl	%edi, %r12d
	movl	%r8d, %r14d
	movl	%edi, (%rsp)
	movl	%esi, %r10d
	imull	%r8d, %r12d
	movl	%edx, %r9d
	movl	%r8d, %ebx
	subl	$2, %ecx
	imull	%esi, %r14d
	subl	%esi, %r12d
.L51:
	testl	%r12d, %r12d
	js	.L46
	je	.L47
	cmpl	$1, 16(%rsp)
	jle	.L46
	movl	%r9d, %eax
	cltd
	idivl	%ebx
	cmpl	%ebx, %eax
	jl	.L46
	movl	%r12d, %r13d
	movl	%ebx, %esi
	movl	%r9d, 24(%rsp)
	xorl	%r11d, %r11d
	imull	%ebx, %r13d
	movl	%r10d, 20(%rsp)
	movl	%ebx, %ebp
	movl	%r14d, %r10d
	imull	%r14d, %esi
	movl	%ebx, 28(%rsp)
	movl	%eax, %ebx
	subl	%r14d, %r13d
	movl	%r12d, %r14d
	movl	%r11d, %r12d
	movl	%esi, %r15d
.L50:
	testl	%r13d, %r13d
	js	.L49
	movl	%ebx, %eax
	movl	%ebp, %r8d
	movl	%r15d, %esi
	movl	%r13d, %edi
	cltd
	movl	%r10d, 8(%rsp)
	idivl	%ebp
	movl	%ecx, 4(%rsp)
	movl	%eax, %edx
	call	count_rec
	movl	8(%rsp), %r10d
	movl	4(%rsp), %ecx
	addl	%eax, %r12d
.L49:
	addl	$1, %ebp
	addl	%r14d, %r13d
	addl	%r10d, %r15d
	cmpl	%ebp, %ebx
	jge	.L50
	movl	%r12d, %r11d
	addl	%r11d, 12(%rsp)
	movl	%r14d, %r12d
	movl	24(%rsp), %r9d
	movl	%r10d, %r14d
	movl	28(%rsp), %ebx
	movl	20(%rsp), %r10d
.L46:
	addl	$1, %ebx
	addl	(%rsp), %r12d
	addl	%r10d, %r14d
	cmpl	%ebx, %r9d
	jge	.L51
.L44:
	movl	12(%rsp), %eax
	addq	$40, %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
.L47:
	.cfi_restore_state
	addl	$1, 12(%rsp)
	jmp	.L46
	.cfi_endproc
.LFE53:
	.size	count_rec.part.0, .-count_rec.part.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rax
	leaq	60(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %r14
	leaq	68(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L68:
	movq	8(%rsp), %rsi
	movq	%r13, %rdx
	xorl	%eax, %eax
	movq	%r15, %r8
	movq	%r14, %rcx
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %r9d
	movl	68(%rsp), %r10d
	movl	56(%rsp), %ebx
	movl	60(%rsp), %edx
	movl	%r9d, %eax
	orl	%r10d, %eax
	orl	%ebx, %eax
	orl	%edx, %eax
	je	.L57
	movl	$1, %r12d
	testl	%r9d, %r9d
	je	.L58
	xorl	%r12d, %r12d
	testl	%edx, %edx
	jle	.L58
	testl	%ebx, %ebx
	jle	.L58
	movl	%edx, %ecx
	subl	$1, %ecx
	je	.L59
	movl	%r9d, %edi
	movq	%r13, 24(%rsp)
	movl	%r12d, %r11d
	movl	$1, %ebp
	subl	%r10d, %edi
	movq	%r14, 32(%rsp)
	movl	%ebx, %r12d
	movl	%r9d, %r14d
	movq	%r15, 40(%rsp)
	movl	%r10d, %ebx
	movl	%edi, %r13d
	movl	%r10d, %r15d
.L64:
	testl	%r13d, %r13d
	js	.L60
	je	.L61
	movl	%r12d, %eax
	movl	%ebp, %r8d
	movl	%ebx, %esi
	movl	%r13d, %edi
	cltd
	movl	%r11d, 20(%rsp)
	idivl	%ebp
	movl	%ecx, 16(%rsp)
	movl	%eax, %edx
	call	count_rec.part.0
	movl	20(%rsp), %r11d
	movl	16(%rsp), %ecx
	addl	%eax, %r11d
.L60:
	addl	$1, %ebp
	addl	%r14d, %r13d
	addl	%r15d, %ebx
	cmpl	%ebp, %r12d
	jge	.L64
	movq	24(%rsp), %r13
	movq	32(%rsp), %r14
	movl	%r11d, %r12d
	movq	40(%rsp), %r15
.L58:
	movl	%r12d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L68
	.p2align 4,,10
	.p2align 3
.L61:
	addl	$1, %r11d
	jmp	.L60
	.p2align 4,,10
	.p2align 3
.L57:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L77
	addq	$88, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	movl	%r9d, %eax
	addl	$1, %ebx
	movl	$1, %edx
	subl	%r10d, %eax
.L67:
	cmpl	$1, %eax
	movl	%r12d, %ecx
	adcl	$0, %r12d
	testl	%eax, %eax
	cmovs	%ecx, %r12d
	addl	$1, %edx
	addl	%r9d, %eax
	cmpl	%ebx, %edx
	jne	.L67
	jmp	.L58
.L77:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:

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

/* subroutines */

int count_rec(int pi, int qi, int ai, int ni, int q0) {
  int a1, c, g, p1, q, q1;

  if (pi == 0) return 1;
  if (ni <= 0) return 0;

  c = 0;

  for (q = q0; q <= ai; q++) {
    p1 = pi * q - qi;
    if (p1 < 0) continue;
    q1 = qi * q;
    a1 = ai / q;
    c += count_rec(p1, q1, a1, ni - 1, q);
  }

  return c;
}


/* main */

int main(int argc, char **argv) {
  int ai, c, ni, pi, qi;

  for (;;) {
    scanf("%d%d%d%d", &pi, &qi, &ai, &ni);
    if ((pi | qi | ai | ni) == 0) break;

    c = count_rec(pi, qi, ai, ni, 1);
    printf("%d\n", c);
  }

  return 0;
}
2 3 120 3
2 3 300 3
2 3 299 3
2 3 12 3
2 3 12000 7
54 795 12000 7
2 4 300 1
2 1 200 5
2 4 54 2
0 0 0 0
 2 3 120 3
2 3 300 3
2 3 299 3
2 3 12 2
2 3 12000 7
54 795 12000 7
2 4 300 1
2 1 16 5
2 4 54 2
0 0 0 0
 2 3 120 3
2 3 300 3
2 3 299 3
2 3 12 2
2 3 12000 7
54 795 12000 7
2 4 300 1
2 1 8 5
2 4 54 2
0 0 0 0
 2 6 120 3
2 3 300 3
2 3 299 3
2 3 12 2
2 3 12000 7
54 795 12000 7
2 4 300 1
2 1 8 5
2 4 54 2
0 0 0 0
 2 6 120 5
2 3 300 3
2 3 299 3
2 3 12 2
2 0 12000 7
54 795 22620 7
2 4 300 1
2 1 8 5
2 4 54 2
0 0 0 0
 2 6 120 5
2 3 300 3
3 3 299 3
2 3 12 2
2 0 12000 7
54 795 22620 7
2 4 300 1
2 1 8 5
2 4 54 2
0 0 0 0
 2 6 120 5
2 3 300 3
3 3 299 3
2 3 7 2
2 0 12000 7
54 795 22620 7
2 4 300 1
2 1 8 5
2 4 54 2
0 0 0 0
 2 6 120 5
2 3 300 3
3 3 299 3
2 3 7 2
2 0 12000 7
54 781 35092 7
2 4 300 1
2 1 8 5
2 4 54 2
0 0 0 0
 2 3 120 3
2 3 300 3
2 3 299 3
2 3 12 3
2 3 12000 7
54 795 12000 7
2 3 300 1
2 1 200 5
2 6 54 2
0 0 0 0
 2 3 120 3
2 3 300 3
2 1 299 3
2 3 12 3
2 3 12000 7
54 795 12000 7
2 4 300 1
2 1 200 5
2 4 54 2
0 0 0 0

4
7
6
2
42
1
1
9
3
 4
7
6
2
42
1
1
3
3
 4
7
6
2
42
1
1
2
3
 3
7
6
2
42
1
1
2
3
 3
7
6
2
0
1
1
2
3
 3
7
5
2
0
1
1
2
3
 3
7
5
0
0
1
1
2
3
 3
7
5
0
0
0
1
2
3
 4
7
6
2
42
1
0
9
3
 4
7
2
2
42
1
1
9
3

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

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

/* subroutines */

int count_rec(int pi, int qi, int ai, int ni, int q0) {
  int a1, c, g, p1, q, q1;

  if (pi == 0) return 1;
  if (ni <= 0) return 0;

  c = 0;

  for (q = q0; q <= ai; q++) {
    p1 = pi * q - qi;
    if (p1 < 0) continue;
    q1 = qi * q;
    a1 = ai / q;
    c += count_rec(p1, q1, a1, ni - 1, q);
  }

  return c;
}


/* main */

int main(int argc, char **argv) {
  int ai, c, ni, pi, qi;

  for (;;) {
    scanf("%d%d%d%d", &pi, &qi, &ai, &ni);
    if ((pi | qi | ai | ni) == 0) break;

    c = count_rec(pi, qi, ai, ni, 1);
    printf("%d\n", c);
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	count_rec
	.type	count_rec, @function
count_rec:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	%r8d, -52(%rbp)
	cmpl	$0, -36(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -48(%rbp)
	jg	.L4
	movl	$0, %eax
	jmp	.L3
.L4:
	movl	$0, -20(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L8:
	movl	-36(%rbp), %eax
	imull	-16(%rbp), %eax
	subl	-40(%rbp), %eax
	movl	%eax, -12(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L9
	movl	-40(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-44(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%eax, -4(%rbp)
	movl	-48(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %edi
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%edi, %r8d
	movl	%eax, %edi
	call	count_rec
	addl	%eax, -20(%rbp)
	jmp	.L7
.L9:
	nop
.L7:
	addl	$1, -16(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L8
	movl	-20(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	count_rec, .-count_rec
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.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
	movl	%edi, -36(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L13:
	leaq	-24(%rbp), %rsi
	leaq	-28(%rbp), %rcx
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	orl	%eax, %edx
	movl	-28(%rbp), %eax
	orl	%eax, %edx
	movl	-24(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	je	.L17
	movl	-24(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	$1, %r8d
	movl	%eax, %edi
	call	count_rec
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	count_rec
	.type	count_rec, @function
count_rec:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	%r8d, -52(%rbp)
	cmpl	$0, -36(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -48(%rbp)
	jg	.L4
	movl	$0, %eax
	jmp	.L3
.L4:
	movl	$0, -20(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L8:
	movl	-36(%rbp), %eax
	imull	-16(%rbp), %eax
	subl	-40(%rbp), %eax
	movl	%eax, -12(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L9
	movl	-40(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-44(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%eax, -4(%rbp)
	movl	-48(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %edi
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%edi, %r8d
	movl	%eax, %edi
	call	count_rec
	addl	%eax, -20(%rbp)
	jmp	.L7
.L9:
	nop
.L7:
	addl	$1, -16(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L8
	movl	-20(%rbp), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	count_rec, .-count_rec
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.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
	movl	%edi, -36(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L13:
	leaq	-24(%rbp), %rsi
	leaq	-28(%rbp), %rcx
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-16(%rbp), %eax
	orl	%eax, %edx
	movl	-28(%rbp), %eax
	orl	%eax, %edx
	movl	-24(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	je	.L17
	movl	-24(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	$1, %r8d
	movl	%eax, %edi
	call	count_rec
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
