// File: /workspace/github_cpp_makefile_star2_O1/joao18araujo[P]pierluigi/src/fourth_species_counterpoint.cpp
// Function: FourthSpeciesCounterpoint::dfs_generate_counterpoint(Song&, bool, int, int)
Song FourthSpeciesCounterpoint::dfs_generate_counterpoint(Song & c_song, bool ascendant, int paralels, int same_movements){
  song = &c_song;
  Song counterpoint(c_song.scale, c_song.time);
  if(song->size() > 200 || paralels > 4 || same_movements > 600)
    return Song();

  FourthSpeciesCounterpoint::solve(0, 0, paralels, same_movements, ascendant, counterpoint);
  FourthSpeciesCounterpoint::add_trailing_rests(counterpoint);
  return counterpoint;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, 0x4(%rsp)
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x9c026e4(%rip), %rax   # 0x9c124a8
movq %rsi, (%rax)
addq $0x18, %rsi
xorl %eax, %eax
leaq 0xe8(%rsp), %rdi
movq %rax, (%rdi)
movq 0x20(%r12), %rcx
movq %rcx, 0x8(%rdi)
movq %rax, 0x10(%rdi)
movq 0x30(%r12), %rcx
movq %rcx, 0x18(%rdi)
movups 0x38(%r12), %xmm0
movups %xmm0, 0x20(%rdi)
movq %rax, 0x30(%rdi)
leaq 0x8(%rsp), %rdx
movq %rdi, (%rdx)
callq 0xb2d2
leaq 0x120(%rsp), %r13
leaq 0x50(%r12), %rsi
movq %r13, %rdi
callq 0x1a9c6
leaq 0x178(%rsp), %rdi
leaq 0x188(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xa8(%r12), %rsi
movq 0xb0(%r12), %rdx
addq %rsi, %rdx
callq 0xb544
movq 0xc8(%r12), %rdx
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xf9e8
movq 0x178(%rsp), %rdi
cmpq %r15, %rdi
je 0xfe81
movq 0x188(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfea2
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfec3
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0xe8(%rsp), %rdi
callq 0xb51e
leaq 0x9c025d1(%rip), %rax   # 0x9c124a8
movq (%rax), %rdi
callq 0x24288
cmpl $0x258, %ebp            # imm = 0x258
jg 0xffa6
cmpl $0x4, %r14d
jg 0xffa6
cmpl $0xc9, %eax
jae 0xffa6
movzbl 0x4(%rsp), %r8d
leaq 0x10(%rsp), %r9
xorl %edi, %edi
xorl %esi, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x100d2
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xb06c
leaq 0x28(%rsp), %rdx
movq -0x18(%rdx), %rax
movq %rax, (%rbx)
movq -0x10(%rdx), %rax
movq %rax, 0x8(%rbx)
movq -0x8(%rdx), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, -0x18(%rdx)
movq $0x0, -0x8(%rdx)
leaq 0x18(%rbx), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0xfb70
leaq 0x50(%rbx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1a9c6
movl $0xb8, %edx
leaq (%rbx,%rdx), %rax
movq %rax, 0xa8(%rbx)
movq 0xb8(%rsp), %rcx
addq %rdx, %r14
cmpq %r14, %rcx
je 0xffb0
movq %rcx, 0xa8(%rbx)
movq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rbx)
jmp 0xffb7
movq %rbx, %rdi
callq 0xfabe
jmp 0xfff1
movups (%r14), %xmm0
movups %xmm0, (%rax)
movq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rbx)
movq %r14, 0xb8(%rsp)
movq $0x0, 0xc0(%rsp)
movb $0x0, 0xc8(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0xc8(%rbx)
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10012
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10033
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1004e
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0xb51e
leaq 0x10(%rsp), %rdi
callq 0xb1d6
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %r15, %rdi
callq 0xb51e
movq %rbx, %rdi
callq 0xb1d6
jmp 0x100c0
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
callq 0xb206
jmp 0x100ca
movq %rax, %r14
movq %r13, %rdi
callq 0xb116
jmp 0x100ae
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
callq 0xb51e
jmp 0x100ca
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0xfb08
movq %r14, %rdi
callq 0x55e0