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 fraction{
  int p, q;
};

int unit_fraction_partition(struct fraction f1, int a, int n, int multiple, int denominator);
struct fraction difference(struct fraction f1, struct fraction f2);
struct fraction reduction(struct fraction f);
struct fraction times(struct fraction f, int n);
int numerator(struct fraction f);
int gcd(int m, int n);

int main(void){
  struct fraction f;
  int a, n;
  do{
    scanf("%d%d%d%d", &(f.p), &(f.q), &a, &n);
    if(f.p!=0 || f.q!=0 || a!=0 || n!=0)
      printf("%d\n", unit_fraction_partition(f, a, n, 1, 1));
  }while(f.p!=0 || f.q!=0 || a!=0 || n!=0);
  
  return 0;
}

int unit_fraction_partition(struct fraction f1, int a, int n, int multiple, int denominator){
  int total=0;
  struct fraction f2;
  f2.p = 1;
  for(f2.q=denominator; f2.q*multiple<=a && numerator(difference(f1, times(f2, n)))<=0; f2.q++)
    if(numerator(difference(f1, f2)) == 0) total++;
    else if(numerator(difference(f1, f2)) > 0)
      total += unit_fraction_partition(difference(f1, f2), a, n-1, f2.q*multiple, f2.q);
  return total;
}

struct fraction difference(struct fraction f1, struct fraction f2){
  struct fraction f3;
  f3.p = f1.p * f2.q - f2.p * f1.q;
  f3.q = f1.q * f2.q;
  if(f3.p > 0) f3 = reduction(f3);
  return f3;
}
  
struct fraction reduction(struct fraction f){
  int tmp = gcd(f.p, f.q);
  f.p /= tmp;
  f.q /= tmp;
  return f;
}
 
struct fraction times(struct fraction f, int n){
  f.p *= n;
  return reduction(f);
}
   
int numerator(struct fraction f){
  return f.p;
}

int gcd(int m, int n){
  int tmp;
  if(m < n){
    tmp = m;
    m = n;
    n = tmp;
  }
  while(n != 0){
    tmp = n;
    n = m % n;
    m = tmp;
  }
  return m;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L4:
	leaq	-20(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-16(%rbp), %rax
	leaq	4(%rax), %rsi
	leaq	-16(%rbp), %rax
	movq	%rcx, %r8
	movq	%rdx, %rcx
	movq	%rsi, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	je	.L3
.L2:
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %esi
	movq	-16(%rbp), %rax
	movl	$1, %r8d
	movl	$1, %ecx
	movq	%rax, %rdi
	call	unit_fraction_partition
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L3:
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	unit_fraction_partition
	.type	unit_fraction_partition, @function
unit_fraction_partition:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%rdi, -56(%rbp)
	movl	%esi, -60(%rbp)
	movl	%edx, -64(%rbp)
	movl	%ecx, -68(%rbp)
	movl	%r8d, -72(%rbp)
	movl	$0, -44(%rbp)
	movl	$1, -40(%rbp)
	movl	-72(%rbp), %eax
	movl	%eax, -36(%rbp)
	jmp	.L8
.L12:
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jne	.L9
	addl	$1, -44(%rbp)
	jmp	.L10
.L9:
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jle	.L10
	movl	-36(%rbp), %r13d
	movl	-36(%rbp), %eax
	imull	-68(%rbp), %eax
	movl	%eax, %ebx
	movl	-64(%rbp), %eax
	leal	-1(%rax), %r12d
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	movl	-60(%rbp), %eax
	movl	%r13d, %r8d
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movl	%eax, %esi
	call	unit_fraction_partition
	addl	%eax, -44(%rbp)
.L10:
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
.L8:
	movl	-36(%rbp), %eax
	imull	-68(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L11
	movl	-64(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	times
	movq	%rax, %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jle	.L12
.L11:
	movl	-44(%rbp), %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	unit_fraction_partition, .-unit_fraction_partition
	.globl	difference
	.type	difference, @function
difference:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	imull	%edx, %eax
	movl	-32(%rbp), %ecx
	movl	-20(%rbp), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	testl	%eax, %eax
	jle	.L15
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	reduction
	movq	%rax, -8(%rbp)
.L15:
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	difference, .-difference
	.globl	reduction
	.type	reduction, @function
reduction:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	gcd
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -20(%rbp)
	movq	-24(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	reduction, .-reduction
	.globl	times
	.type	times, @function
times:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-8(%rbp), %eax
	imull	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	reduction
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	times, .-times
	.globl	numerator
	.type	numerator, @function
numerator:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	numerator, .-numerator
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L25
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L25
.L26:
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%edx, -24(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -20(%rbp)
.L25:
	cmpl	$0, -24(%rbp)
	jne	.L26
	movl	-20(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.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	unit_fraction_partition
	.type	unit_fraction_partition, @function
unit_fraction_partition:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%r8d, %r11d
	imull	%ecx, %r11d
	cmpl	%r11d, %esi
	jl	.L27
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r10d, %r10d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leal	(%rcx,%r11), %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r8d, %r12d
	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
	movq	%rdi, %rbx
	sarq	$32, %rbp
	imull	%r8d, %ebx
	movl	%ebp, %r9d
	movl	%r9d, %r15d
	movl	%ecx, %r9d
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%ebp, 16(%rsp)
	subl	%ebp, %ebx
	imull	%r8d, %ebp
	movl	%edi, 8(%rsp)
	movl	%edi, 12(%rsp)
.L3:
	cmpl	%r12d, %r13d
	jge	.L29
	movl	%r13d, %edx
	movl	%r12d, %eax
	testl	%edx, %edx
	je	.L30
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L16
.L15:
	movl	%r12d, %eax
	movl	8(%rsp), %edi
	cltd
	idivl	%r8d
	imull	%eax, %edi
	movl	%eax, %ecx
	movl	%r13d, %eax
	cltd
	idivl	%r8d
	imull	%r15d, %eax
	subl	%eax, %edi
	testl	%edi, %edi
	jle	.L17
	imull	%r15d, %ecx
	cmpl	%ecx, %edi
	jge	.L18
	movl	%edi, %edx
	movl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L19
	movl	%edi, %eax
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jg	.L1
.L17:
	testl	%ebx, %ebx
	jle	.L4
	cmpl	%ebp, %ebx
	jge	.L5
	movl	%ebx, %edx
	movl	%ebp, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L6
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jne	.L7
.L22:
	addl	$1, %r10d
.L8:
	movl	%r14d, %r11d
	addl	$1, %r12d
	addl	%r9d, %r14d
	addl	12(%rsp), %ebx
	addl	16(%rsp), %ebp
	cmpl	%esi, %r11d
	jle	.L3
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r10d, %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
.L29:
	.cfi_restore_state
	movl	%r12d, %edx
	movl	%r13d, %eax
	testl	%edx, %edx
	jne	.L16
.L30:
	movl	%eax, %r8d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L4:
	je	.L22
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L18:
	testl	%ecx, %ecx
	je	.L1
	movl	%ecx, %edx
	movl	%edi, %eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%ebp, %edx
	movl	%ebx, %eax
	testl	%ebp, %ebp
	jne	.L6
.L24:
	movl	$1, %eax
	leal	-1(%r13), %edi
	movl	%ebx, %r8d
	movd	%eax, %xmm0
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%ebp, %ebx
	jge	.L9
	movl	%ebx, %edx
	movl	%ebp, %eax
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L10
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jle	.L8
	leal	-1(%r13), %edi
	movl	%ebx, %edx
	movl	%ebp, %eax
	cmpl	%ebp, %ebx
	jge	.L52
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L13
.L53:
	movl	%ebx, %eax
	cltd
	idivl	%r8d
	movd	%eax, %xmm0
.L12:
	movl	%ebp, %eax
	movdqa	%xmm0, %xmm1
	movl	%r11d, %ecx
	movl	%r9d, 28(%rsp)
	cltd
	movl	%r10d, 24(%rsp)
	idivl	%r8d
	movl	%esi, 20(%rsp)
	movl	%edi, %edx
	movl	%r12d, %r8d
	movd	%eax, %xmm2
	punpckldq	%xmm2, %xmm1
	movq	%xmm1, %rdi
	call	unit_fraction_partition
	movl	24(%rsp), %r10d
	movl	28(%rsp), %r9d
	movl	20(%rsp), %esi
	addl	%eax, %r10d
	jmp	.L8
.L52:
	testl	%ebp, %ebp
	je	.L28
	movl	%ebp, %edx
	movl	%ebx, %eax
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L13
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%ebp, %ebp
	je	.L24
	movl	%ebp, %edx
	movl	%ebx, %eax
	jmp	.L10
.L27:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	xorl	%eax, %eax
	ret
.L28:
	.cfi_def_cfa_offset 96
	.cfi_offset 3, -56
	.cfi_offset 6, -48
	.cfi_offset 12, -40
	.cfi_offset 13, -32
	.cfi_offset 14, -24
	.cfi_offset 15, -16
	movl	$1, %eax
	movl	%ebx, %r8d
	movd	%eax, %xmm0
	jmp	.L12
	.cfi_endproc
.LFE24:
	.size	unit_fraction_partition, .-unit_fraction_partition
	.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:
.LFB23:
	.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	60(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 32(%rsp)
	leaq	68(%rsp), %rax
	movq	%rax, 40(%rsp)
	.p2align 4,,10
	.p2align 3
.L99:
	movq	32(%rsp), %rsi
	movq	24(%rsp), %r8
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movq	16(%rsp), %rcx
	movq	40(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %r10d
	movl	68(%rsp), %r15d
	movl	56(%rsp), %esi
	movl	%r10d, %r9d
	orl	%r15d, %r9d
	orl	%esi, %r9d
	movl	%r9d, %r13d
	jne	.L55
	movl	60(%rsp), %edx
	testl	%edx, %edx
	jne	.L56
.L57:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L107
	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
.L55:
	.cfi_restore_state
	movl	60(%rsp), %ebp
	testl	%esi, %esi
	jle	.L84
	movl	$1, %r14d
	movl	%r10d, %ebx
	movl	%r15d, %r12d
	xorl	%r13d, %r13d
	movl	%r14d, %r8d
	subl	%r15d, %ebx
	movl	%r10d, %r14d
.L58:
	cmpl	%r8d, %ebp
	jge	.L86
	testl	%ebp, %ebp
	je	.L87
	movl	%ebp, %edx
	movl	%r8d, %eax
	.p2align 4,,10
	.p2align 3
.L71:
	movl	%edx, %edi
	cltd
	idivl	%edi
	movl	%edi, %eax
	testl	%edx, %edx
	jne	.L71
	movl	%r8d, %eax
	movl	%r14d, %r9d
	cltd
	idivl	%edi
	imull	%eax, %r9d
	imull	%r15d, %eax
	movl	%eax, %ecx
.L70:
	movl	%ebp, %eax
	cltd
	idivl	%edi
	imull	%r15d, %eax
	subl	%eax, %r9d
	testl	%r9d, %r9d
	jle	.L72
	cmpl	%r9d, %ecx
	jle	.L73
	movl	%r9d, %edx
	movl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L74:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L74
	movl	%r9d, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jg	.L56
.L72:
	testl	%ebx, %ebx
	jle	.L59
	cmpl	%r12d, %ebx
	jge	.L60
	movl	%ebx, %edx
	movl	%r12d, %eax
	.p2align 4,,10
	.p2align 3
.L61:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L61
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jne	.L62
.L78:
	addl	$1, %r13d
.L63:
	addl	$1, %r8d
	addl	%r14d, %ebx
	addl	%r15d, %r12d
	cmpl	%r8d, %esi
	jge	.L58
.L56:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	64(%rsp), %eax
	testl	%eax, %eax
	jne	.L99
	movl	68(%rsp), %eax
	orl	60(%rsp), %eax
	orl	56(%rsp), %eax
	jne	.L99
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L86:
	movl	%r8d, %edx
	movl	%ebp, %eax
	jmp	.L71
	.p2align 4,,10
	.p2align 3
.L59:
	jne	.L63
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L73:
	testl	%ecx, %ecx
	je	.L56
	movl	%ecx, %edx
	movl	%r9d, %eax
	jmp	.L74
	.p2align 4,,10
	.p2align 3
.L60:
	movl	%r12d, %edx
	movl	%ebx, %eax
	testl	%r12d, %r12d
	jne	.L61
.L80:
	movl	$1, %eax
	leal	-1(%rbp), %r9d
	movl	%ebx, %ecx
	movd	%eax, %xmm0
	.p2align 4,,10
	.p2align 3
.L67:
	movl	%r12d, %eax
	movdqa	%xmm0, %xmm1
	movl	%r8d, 12(%rsp)
	cltd
	movl	%esi, 8(%rsp)
	idivl	%ecx
	movl	%r8d, %ecx
	movl	%r9d, %edx
	movd	%eax, %xmm2
	punpckldq	%xmm2, %xmm1
	movq	%xmm1, %rdi
	call	unit_fraction_partition
	movl	12(%rsp), %r8d
	movl	8(%rsp), %esi
	addl	%eax, %r13d
	jmp	.L63
	.p2align 4,,10
	.p2align 3
.L62:
	cmpl	%r12d, %ebx
	jge	.L64
	movl	%ebx, %edx
	movl	%r12d, %eax
	.p2align 4,,10
	.p2align 3
.L65:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L65
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jle	.L63
	leal	-1(%rbp), %r9d
	movl	%ebx, %edx
	movl	%r12d, %eax
	cmpl	%r12d, %ebx
	jge	.L108
	.p2align 4,,10
	.p2align 3
.L68:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L68
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movd	%eax, %xmm0
	jmp	.L67
	.p2align 4,,10
	.p2align 3
.L87:
	movl	%r15d, %ecx
	movl	%r14d, %r9d
	movl	%r8d, %edi
	jmp	.L70
	.p2align 4,,10
	.p2align 3
.L64:
	testl	%r12d, %r12d
	je	.L80
	movl	%r12d, %edx
	movl	%ebx, %eax
	jmp	.L65
.L108:
	testl	%r12d, %r12d
	je	.L85
	movl	%r12d, %edx
	movl	%ebx, %eax
	jmp	.L68
.L84:
	xorl	%r13d, %r13d
	jmp	.L56
.L107:
	call	__stack_chk_fail@PLT
.L85:
	movl	$1, %eax
	movl	%ebx, %ecx
	movd	%eax, %xmm0
	jmp	.L67
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	difference
	.type	difference, @function
difference:
.LFB25:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	sarq	$32, %rax
	sarq	$32, %r8
	imull	%r8d, %edi
	imull	%eax, %esi
	imull	%eax, %r8d
	subl	%esi, %edi
	testl	%edi, %edi
	jle	.L110
	cmpl	%r8d, %edi
	jl	.L114
	testl	%r8d, %r8d
	je	.L115
	movl	%r8d, %edx
	movl	%edi, %ecx
	.p2align 4,,10
	.p2align 3
.L113:
	movl	%ecx, %eax
	movl	%edx, %esi
	cltd
	movl	%esi, %ecx
	idivl	%esi
	testl	%edx, %edx
	jne	.L113
	movl	%edi, %eax
	cltd
	idivl	%esi
	movl	%eax, %edi
.L112:
	movl	%r8d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r8d
.L110:
	movd	%edi, %xmm0
	movd	%r8d, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L114:
	movl	%edi, %edx
	movl	%r8d, %ecx
	jmp	.L113
	.p2align 4,,10
	.p2align 3
.L115:
	movl	%edi, %esi
	movl	$1, %edi
	jmp	.L112
	.cfi_endproc
.LFE25:
	.size	difference, .-difference
	.p2align 4
	.globl	reduction
	.type	reduction, @function
reduction:
.LFB26:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	%edi, %esi
	movl	%edi, %edx
	sarq	$32, %rax
	movl	%eax, %r8d
	cmpl	%eax, %edi
	jl	.L118
	movl	%eax, %edx
	movl	%edi, %eax
.L118:
	testl	%edx, %edx
	je	.L122
	.p2align 4,,10
	.p2align 3
.L120:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L120
.L119:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %esi
	movl	%r8d, %eax
	cltd
	movd	%esi, %xmm0
	idivl	%ecx
	movd	%eax, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L122:
	movl	%eax, %ecx
	jmp	.L119
	.cfi_endproc
.LFE26:
	.size	reduction, .-reduction
	.p2align 4
	.globl	times
	.type	times, @function
times:
.LFB27:
	.cfi_startproc
	endbr64
	imull	%edi, %esi
	movq	%rdi, %rax
	sarq	$32, %rax
	movl	%eax, %edi
	movl	%esi, %edx
	cmpl	%eax, %esi
	jl	.L125
	movl	%eax, %edx
	movl	%esi, %eax
.L125:
	testl	%edx, %edx
	je	.L129
	.p2align 4,,10
	.p2align 3
.L127:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L127
.L126:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %esi
	movl	%edi, %eax
	cltd
	movd	%esi, %xmm0
	idivl	%ecx
	movd	%eax, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L129:
	movl	%eax, %ecx
	jmp	.L126
	.cfi_endproc
.LFE27:
	.size	times, .-times
	.p2align 4
	.globl	numerator
	.type	numerator, @function
numerator:
.LFB28:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	ret
	.cfi_endproc
.LFE28:
	.size	numerator, .-numerator
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB29:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %edx
	cmpl	%esi, %edi
	jge	.L133
	movl	%esi, %eax
	movl	%edi, %edx
.L133:
	testl	%edx, %edx
	je	.L136
	.p2align 4,,10
	.p2align 3
.L135:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L135
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L136:
	movl	%eax, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE29:
	.size	gcd, .-gcd
	.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	unit_fraction_partition
	.type	unit_fraction_partition, @function
unit_fraction_partition:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%r8d, %r11d
	imull	%ecx, %r11d
	cmpl	%r11d, %esi
	jl	.L27
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r10d, %r10d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leal	(%rcx,%r11), %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r8d, %r12d
	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
	movq	%rdi, %rbx
	sarq	$32, %rbp
	imull	%r8d, %ebx
	movl	%ebp, %r9d
	movl	%r9d, %r15d
	movl	%ecx, %r9d
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	%ebp, 16(%rsp)
	subl	%ebp, %ebx
	imull	%r8d, %ebp
	movl	%edi, 8(%rsp)
	movl	%edi, 12(%rsp)
.L3:
	cmpl	%r12d, %r13d
	jge	.L29
	movl	%r13d, %edx
	movl	%r12d, %eax
	testl	%edx, %edx
	je	.L30
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L16
.L15:
	movl	%r12d, %eax
	movl	8(%rsp), %edi
	cltd
	idivl	%r8d
	imull	%eax, %edi
	movl	%eax, %ecx
	movl	%r13d, %eax
	cltd
	idivl	%r8d
	imull	%r15d, %eax
	subl	%eax, %edi
	testl	%edi, %edi
	jle	.L17
	imull	%r15d, %ecx
	cmpl	%ecx, %edi
	jge	.L18
	movl	%edi, %edx
	movl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L19
	movl	%edi, %eax
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jg	.L1
.L17:
	testl	%ebx, %ebx
	jle	.L4
	cmpl	%ebp, %ebx
	jge	.L5
	movl	%ebx, %edx
	movl	%ebp, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L6
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jne	.L7
.L22:
	addl	$1, %r10d
.L8:
	movl	%r14d, %r11d
	addl	$1, %r12d
	addl	%r9d, %r14d
	addl	12(%rsp), %ebx
	addl	16(%rsp), %ebp
	cmpl	%esi, %r11d
	jle	.L3
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r10d, %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
.L29:
	.cfi_restore_state
	movl	%r12d, %edx
	movl	%r13d, %eax
	testl	%edx, %edx
	jne	.L16
.L30:
	movl	%eax, %r8d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L4:
	je	.L22
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L18:
	testl	%ecx, %ecx
	je	.L1
	movl	%ecx, %edx
	movl	%edi, %eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%ebp, %edx
	movl	%ebx, %eax
	testl	%ebp, %ebp
	jne	.L6
.L24:
	movl	$1, %eax
	leal	-1(%r13), %edi
	movl	%ebx, %r8d
	movd	%eax, %xmm0
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%ebp, %ebx
	jge	.L9
	movl	%ebx, %edx
	movl	%ebp, %eax
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L10
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jle	.L8
	leal	-1(%r13), %edi
	movl	%ebx, %edx
	movl	%ebp, %eax
	cmpl	%ebp, %ebx
	jge	.L52
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L13
.L53:
	movl	%ebx, %eax
	cltd
	idivl	%r8d
	movd	%eax, %xmm0
.L12:
	movl	%ebp, %eax
	movdqa	%xmm0, %xmm1
	movl	%r11d, %ecx
	movl	%r9d, 28(%rsp)
	cltd
	movl	%r10d, 24(%rsp)
	idivl	%r8d
	movl	%esi, 20(%rsp)
	movl	%edi, %edx
	movl	%r12d, %r8d
	movd	%eax, %xmm2
	punpckldq	%xmm2, %xmm1
	movq	%xmm1, %rdi
	call	unit_fraction_partition
	movl	24(%rsp), %r10d
	movl	28(%rsp), %r9d
	movl	20(%rsp), %esi
	addl	%eax, %r10d
	jmp	.L8
.L52:
	testl	%ebp, %ebp
	je	.L28
	movl	%ebp, %edx
	movl	%ebx, %eax
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L13
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%ebp, %ebp
	je	.L24
	movl	%ebp, %edx
	movl	%ebx, %eax
	jmp	.L10
.L27:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	xorl	%eax, %eax
	ret
.L28:
	.cfi_def_cfa_offset 96
	.cfi_offset 3, -56
	.cfi_offset 6, -48
	.cfi_offset 12, -40
	.cfi_offset 13, -32
	.cfi_offset 14, -24
	.cfi_offset 15, -16
	movl	$1, %eax
	movl	%ebx, %r8d
	movd	%eax, %xmm0
	jmp	.L12
	.cfi_endproc
.LFE24:
	.size	unit_fraction_partition, .-unit_fraction_partition
	.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:
.LFB23:
	.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	60(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 32(%rsp)
	leaq	68(%rsp), %rax
	movq	%rax, 40(%rsp)
	.p2align 4,,10
	.p2align 3
.L99:
	movq	32(%rsp), %rsi
	movq	24(%rsp), %r8
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movq	16(%rsp), %rcx
	movq	40(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %r10d
	movl	68(%rsp), %r15d
	movl	56(%rsp), %esi
	movl	%r10d, %r9d
	orl	%r15d, %r9d
	orl	%esi, %r9d
	movl	%r9d, %r13d
	jne	.L55
	movl	60(%rsp), %edx
	testl	%edx, %edx
	jne	.L56
.L57:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L107
	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
.L55:
	.cfi_restore_state
	movl	60(%rsp), %ebp
	testl	%esi, %esi
	jle	.L84
	movl	$1, %r14d
	movl	%r10d, %ebx
	movl	%r15d, %r12d
	xorl	%r13d, %r13d
	movl	%r14d, %r8d
	subl	%r15d, %ebx
	movl	%r10d, %r14d
.L58:
	cmpl	%r8d, %ebp
	jge	.L86
	testl	%ebp, %ebp
	je	.L87
	movl	%ebp, %edx
	movl	%r8d, %eax
	.p2align 4,,10
	.p2align 3
.L71:
	movl	%edx, %edi
	cltd
	idivl	%edi
	movl	%edi, %eax
	testl	%edx, %edx
	jne	.L71
	movl	%r8d, %eax
	movl	%r14d, %r9d
	cltd
	idivl	%edi
	imull	%eax, %r9d
	imull	%r15d, %eax
	movl	%eax, %ecx
.L70:
	movl	%ebp, %eax
	cltd
	idivl	%edi
	imull	%r15d, %eax
	subl	%eax, %r9d
	testl	%r9d, %r9d
	jle	.L72
	cmpl	%r9d, %ecx
	jle	.L73
	movl	%r9d, %edx
	movl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L74:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L74
	movl	%r9d, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jg	.L56
.L72:
	testl	%ebx, %ebx
	jle	.L59
	cmpl	%r12d, %ebx
	jge	.L60
	movl	%ebx, %edx
	movl	%r12d, %eax
	.p2align 4,,10
	.p2align 3
.L61:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L61
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jne	.L62
.L78:
	addl	$1, %r13d
.L63:
	addl	$1, %r8d
	addl	%r14d, %ebx
	addl	%r15d, %r12d
	cmpl	%r8d, %esi
	jge	.L58
.L56:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	64(%rsp), %eax
	testl	%eax, %eax
	jne	.L99
	movl	68(%rsp), %eax
	orl	60(%rsp), %eax
	orl	56(%rsp), %eax
	jne	.L99
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L86:
	movl	%r8d, %edx
	movl	%ebp, %eax
	jmp	.L71
	.p2align 4,,10
	.p2align 3
.L59:
	jne	.L63
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L73:
	testl	%ecx, %ecx
	je	.L56
	movl	%ecx, %edx
	movl	%r9d, %eax
	jmp	.L74
	.p2align 4,,10
	.p2align 3
.L60:
	movl	%r12d, %edx
	movl	%ebx, %eax
	testl	%r12d, %r12d
	jne	.L61
.L80:
	movl	$1, %eax
	leal	-1(%rbp), %r9d
	movl	%ebx, %ecx
	movd	%eax, %xmm0
	.p2align 4,,10
	.p2align 3
.L67:
	movl	%r12d, %eax
	movdqa	%xmm0, %xmm1
	movl	%r8d, 12(%rsp)
	cltd
	movl	%esi, 8(%rsp)
	idivl	%ecx
	movl	%r8d, %ecx
	movl	%r9d, %edx
	movd	%eax, %xmm2
	punpckldq	%xmm2, %xmm1
	movq	%xmm1, %rdi
	call	unit_fraction_partition
	movl	12(%rsp), %r8d
	movl	8(%rsp), %esi
	addl	%eax, %r13d
	jmp	.L63
	.p2align 4,,10
	.p2align 3
.L62:
	cmpl	%r12d, %ebx
	jge	.L64
	movl	%ebx, %edx
	movl	%r12d, %eax
	.p2align 4,,10
	.p2align 3
.L65:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L65
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%eax, %eax
	jle	.L63
	leal	-1(%rbp), %r9d
	movl	%ebx, %edx
	movl	%r12d, %eax
	cmpl	%r12d, %ebx
	jge	.L108
	.p2align 4,,10
	.p2align 3
.L68:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L68
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movd	%eax, %xmm0
	jmp	.L67
	.p2align 4,,10
	.p2align 3
.L87:
	movl	%r15d, %ecx
	movl	%r14d, %r9d
	movl	%r8d, %edi
	jmp	.L70
	.p2align 4,,10
	.p2align 3
.L64:
	testl	%r12d, %r12d
	je	.L80
	movl	%r12d, %edx
	movl	%ebx, %eax
	jmp	.L65
.L108:
	testl	%r12d, %r12d
	je	.L85
	movl	%r12d, %edx
	movl	%ebx, %eax
	jmp	.L68
.L84:
	xorl	%r13d, %r13d
	jmp	.L56
.L107:
	call	__stack_chk_fail@PLT
.L85:
	movl	$1, %eax
	movl	%ebx, %ecx
	movd	%eax, %xmm0
	jmp	.L67
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	difference
	.type	difference, @function
difference:
.LFB25:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	sarq	$32, %rax
	sarq	$32, %r8
	imull	%r8d, %edi
	imull	%eax, %esi
	imull	%eax, %r8d
	subl	%esi, %edi
	testl	%edi, %edi
	jle	.L110
	cmpl	%r8d, %edi
	jl	.L114
	testl	%r8d, %r8d
	je	.L115
	movl	%r8d, %edx
	movl	%edi, %ecx
	.p2align 4,,10
	.p2align 3
.L113:
	movl	%ecx, %eax
	movl	%edx, %esi
	cltd
	movl	%esi, %ecx
	idivl	%esi
	testl	%edx, %edx
	jne	.L113
	movl	%edi, %eax
	cltd
	idivl	%esi
	movl	%eax, %edi
.L112:
	movl	%r8d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r8d
.L110:
	movd	%edi, %xmm0
	movd	%r8d, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L114:
	movl	%edi, %edx
	movl	%r8d, %ecx
	jmp	.L113
	.p2align 4,,10
	.p2align 3
.L115:
	movl	%edi, %esi
	movl	$1, %edi
	jmp	.L112
	.cfi_endproc
.LFE25:
	.size	difference, .-difference
	.p2align 4
	.globl	reduction
	.type	reduction, @function
reduction:
.LFB26:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	%edi, %esi
	movl	%edi, %edx
	sarq	$32, %rax
	movl	%eax, %r8d
	cmpl	%eax, %edi
	jl	.L118
	movl	%eax, %edx
	movl	%edi, %eax
.L118:
	testl	%edx, %edx
	je	.L122
	.p2align 4,,10
	.p2align 3
.L120:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L120
.L119:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %esi
	movl	%r8d, %eax
	cltd
	movd	%esi, %xmm0
	idivl	%ecx
	movd	%eax, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L122:
	movl	%eax, %ecx
	jmp	.L119
	.cfi_endproc
.LFE26:
	.size	reduction, .-reduction
	.p2align 4
	.globl	times
	.type	times, @function
times:
.LFB27:
	.cfi_startproc
	endbr64
	imull	%edi, %esi
	movq	%rdi, %rax
	sarq	$32, %rax
	movl	%eax, %edi
	movl	%esi, %edx
	cmpl	%eax, %esi
	jl	.L125
	movl	%eax, %edx
	movl	%esi, %eax
.L125:
	testl	%edx, %edx
	je	.L129
	.p2align 4,,10
	.p2align 3
.L127:
	movl	%edx, %ecx
	cltd
	idivl	%ecx
	movl	%ecx, %eax
	testl	%edx, %edx
	jne	.L127
.L126:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %esi
	movl	%edi, %eax
	cltd
	movd	%esi, %xmm0
	idivl	%ecx
	movd	%eax, %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L129:
	movl	%eax, %ecx
	jmp	.L126
	.cfi_endproc
.LFE27:
	.size	times, .-times
	.p2align 4
	.globl	numerator
	.type	numerator, @function
numerator:
.LFB28:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	ret
	.cfi_endproc
.LFE28:
	.size	numerator, .-numerator
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB29:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %edx
	cmpl	%esi, %edi
	jge	.L133
	movl	%esi, %eax
	movl	%edi, %edx
.L133:
	testl	%edx, %edx
	je	.L136
	.p2align 4,,10
	.p2align 3
.L135:
	movl	%edx, %r8d
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L135
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L136:
	movl	%eax, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE29:
	.size	gcd, .-gcd
	.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 fraction{
  int p, q;
};

int unit_fraction_partition(struct fraction f1, int a, int n, int multiple, int denominator);
struct fraction difference(struct fraction f1, struct fraction f2);
struct fraction reduction(struct fraction f);
struct fraction times(struct fraction f, int n);
int numerator(struct fraction f);
int gcd(int m, int n);

int main(void){
  struct fraction f;
  int a, n;
  do{
    scanf("%d%d%d%d", &(f.p), &(f.q), &a, &n);
    if(f.p!=0 || f.q!=0 || a!=0 || n!=0)
      printf("%d\n", unit_fraction_partition(f, a, n, 1, 1));
  }while(f.p!=0 || f.q!=0 || a!=0 || n!=0);
  
  return 0;
}

int unit_fraction_partition(struct fraction f1, int a, int n, int multiple, int denominator){
  int total=0;
  struct fraction f2;
  f2.p = 1;
  for(f2.q=denominator; f2.q*multiple<=a && numerator(difference(f1, times(f2, n)))<=0; f2.q++)
    if(numerator(difference(f1, f2)) == 0) total++;
    else if(numerator(difference(f1, f2)) > 0)
      total += unit_fraction_partition(difference(f1, f2), a, n-1, f2.q*multiple, f2.q);
  return total;
}

struct fraction difference(struct fraction f1, struct fraction f2){
  struct fraction f3;
  f3.p = f1.p * f2.q - f2.p * f1.q;
  f3.q = f1.q * f2.q;
  if(f3.p > 0) f3 = reduction(f3);
  return f3;
}
  
struct fraction reduction(struct fraction f){
  int tmp = gcd(f.p, f.q);
  f.p /= tmp;
  f.q /= tmp;
  return f;
}
 
struct fraction times(struct fraction f, int n){
  f.p *= n;
  return reduction(f);
}
   
int numerator(struct fraction f){
  return f.p;
}

int gcd(int m, int n){
  int tmp;
  if(m < n){
    tmp = m;
    m = n;
    n = tmp;
  }
  while(n != 0){
    tmp = n;
    n = m % n;
    m = tmp;
  }
  return m;
}
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>

struct fraction{
  int p, q;
};

int unit_fraction_partition(struct fraction f1, int a, int n, int multiple, int denominator);
struct fraction difference(struct fraction f1, struct fraction f2);
struct fraction reduction(struct fraction f);
struct fraction times(struct fraction f, int n);
int numerator(struct fraction f);
int gcd(int m, int n);

int main(void){
  struct fraction f;
  int a, n;
  do{
    scanf("%d%d%d%d", &(f.p), &(f.q), &a, &n);
    if(f.p!=0 || f.q!=0 || a!=0 || n!=0)
      printf("%d\n", unit_fraction_partition(f, a, n, 1, 1));
  }while(f.p!=0 || f.q!=0 || a!=0 || n!=0);
  
  return 0;
}

int unit_fraction_partition(struct fraction f1, int a, int n, int multiple, int denominator){
  int total=0;
  struct fraction f2;
  f2.p = 1;
  for(f2.q=denominator; f2.q*multiple<=a && numerator(difference(f1, times(f2, n)))<=0; f2.q++)
    if(numerator(difference(f1, f2)) == 0) total++;
    else if(numerator(difference(f1, f2)) > 0)
      total += unit_fraction_partition(difference(f1, f2), a, n-1, f2.q*multiple, f2.q);
  return total;
}

struct fraction difference(struct fraction f1, struct fraction f2){
  struct fraction f3;
  f3.p = f1.p * f2.q - f2.p * f1.q;
  f3.q = f1.q * f2.q;
  if(f3.p > 0) f3 = reduction(f3);
  return f3;
}
  
struct fraction reduction(struct fraction f){
  int tmp = gcd(f.p, f.q);
  f.p /= tmp;
  f.q /= tmp;
  return f;
}
 
struct fraction times(struct fraction f, int n){
  f.p *= n;
  return reduction(f);
}
   
int numerator(struct fraction f){
  return f.p;
}

int gcd(int m, int n){
  int tmp;
  if(m < n){
    tmp = m;
    m = n;
    n = tmp;
  }
  while(n != 0){
    tmp = n;
    n = m % n;
    m = tmp;
  }
  return m;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L4:
	leaq	-20(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-16(%rbp), %rax
	leaq	4(%rax), %rsi
	leaq	-16(%rbp), %rax
	movq	%rcx, %r8
	movq	%rdx, %rcx
	movq	%rsi, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	je	.L3
.L2:
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %esi
	movq	-16(%rbp), %rax
	movl	$1, %r8d
	movl	$1, %ecx
	movq	%rax, %rdi
	call	unit_fraction_partition
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L3:
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	unit_fraction_partition
	.type	unit_fraction_partition, @function
unit_fraction_partition:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%rdi, -56(%rbp)
	movl	%esi, -60(%rbp)
	movl	%edx, -64(%rbp)
	movl	%ecx, -68(%rbp)
	movl	%r8d, -72(%rbp)
	movl	$0, -44(%rbp)
	movl	$1, -40(%rbp)
	movl	-72(%rbp), %eax
	movl	%eax, -36(%rbp)
	jmp	.L8
.L12:
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jne	.L9
	addl	$1, -44(%rbp)
	jmp	.L10
.L9:
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jle	.L10
	movl	-36(%rbp), %r13d
	movl	-36(%rbp), %eax
	imull	-68(%rbp), %eax
	movl	%eax, %ebx
	movl	-64(%rbp), %eax
	leal	-1(%rax), %r12d
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	movl	-60(%rbp), %eax
	movl	%r13d, %r8d
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movl	%eax, %esi
	call	unit_fraction_partition
	addl	%eax, -44(%rbp)
.L10:
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
.L8:
	movl	-36(%rbp), %eax
	imull	-68(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L11
	movl	-64(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	times
	movq	%rax, %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jle	.L12
.L11:
	movl	-44(%rbp), %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	unit_fraction_partition, .-unit_fraction_partition
	.globl	difference
	.type	difference, @function
difference:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	imull	%edx, %eax
	movl	-32(%rbp), %ecx
	movl	-20(%rbp), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	testl	%eax, %eax
	jle	.L15
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	reduction
	movq	%rax, -8(%rbp)
.L15:
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	difference, .-difference
	.globl	reduction
	.type	reduction, @function
reduction:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	gcd
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -20(%rbp)
	movq	-24(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	reduction, .-reduction
	.globl	times
	.type	times, @function
times:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-8(%rbp), %eax
	imull	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	reduction
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	times, .-times
	.globl	numerator
	.type	numerator, @function
numerator:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	numerator, .-numerator
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L25
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L25
.L26:
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%edx, -24(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -20(%rbp)
.L25:
	cmpl	$0, -24(%rbp)
	jne	.L26
	movl	-20(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.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%d"
.LC1:
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L4:
	leaq	-20(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-16(%rbp), %rax
	leaq	4(%rax), %rsi
	leaq	-16(%rbp), %rax
	movq	%rcx, %r8
	movq	%rdx, %rcx
	movq	%rsi, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	je	.L3
.L2:
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %esi
	movq	-16(%rbp), %rax
	movl	$1, %r8d
	movl	$1, %ecx
	movq	%rax, %rdi
	call	unit_fraction_partition
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L3:
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	unit_fraction_partition
	.type	unit_fraction_partition, @function
unit_fraction_partition:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%rdi, -56(%rbp)
	movl	%esi, -60(%rbp)
	movl	%edx, -64(%rbp)
	movl	%ecx, -68(%rbp)
	movl	%r8d, -72(%rbp)
	movl	$0, -44(%rbp)
	movl	$1, -40(%rbp)
	movl	-72(%rbp), %eax
	movl	%eax, -36(%rbp)
	jmp	.L8
.L12:
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jne	.L9
	addl	$1, -44(%rbp)
	jmp	.L10
.L9:
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jle	.L10
	movl	-36(%rbp), %r13d
	movl	-36(%rbp), %eax
	imull	-68(%rbp), %eax
	movl	%eax, %ebx
	movl	-64(%rbp), %eax
	leal	-1(%rax), %r12d
	movq	-40(%rbp), %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	movl	-60(%rbp), %eax
	movl	%r13d, %r8d
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movl	%eax, %esi
	call	unit_fraction_partition
	addl	%eax, -44(%rbp)
.L10:
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
.L8:
	movl	-36(%rbp), %eax
	imull	-68(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L11
	movl	-64(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	times
	movq	%rax, %rdx
	movq	-56(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	difference
	movq	%rax, %rdi
	call	numerator
	testl	%eax, %eax
	jle	.L12
.L11:
	movl	-44(%rbp), %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	unit_fraction_partition, .-unit_fraction_partition
	.globl	difference
	.type	difference, @function
difference:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	-24(%rbp), %edx
	movl	-28(%rbp), %eax
	imull	%edx, %eax
	movl	-32(%rbp), %ecx
	movl	-20(%rbp), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %edx
	movl	-28(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	testl	%eax, %eax
	jle	.L15
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	reduction
	movq	%rax, -8(%rbp)
.L15:
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	difference, .-difference
	.globl	reduction
	.type	reduction, @function
reduction:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	gcd
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%eax, -20(%rbp)
	movq	-24(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	reduction, .-reduction
	.globl	times
	.type	times, @function
times:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	-8(%rbp), %eax
	imull	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	reduction
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	times, .-times
	.globl	numerator
	.type	numerator, @function
numerator:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	numerator, .-numerator
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L25
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L25
.L26:
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%edx, -24(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -20(%rbp)
.L25:
	cmpl	$0, -24(%rbp)
	jne	.L26
	movl	-20(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.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:
