// File: /workspace/github_cpp_makefile_star2_O3/joao18araujo[P]pierluigi/src/second_species_counterpoint.cpp
// Function: SecondSpeciesCounterpoint::dfs_generate_counterpoint(Song&, bool, int, int)
Song SecondSpeciesCounterpoint::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();

  SecondSpeciesCounterpoint::solve(0, 0, paralels, same_movements, ascendant, counterpoint);
  SecondSpeciesCounterpoint::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 0x9bf3f00(%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 0xb29e
leaq 0x120(%rsp), %r13
leaq 0x50(%r12), %rsi
movq %r13, %rdi
callq 0x1aa22
leaq 0x178(%rsp), %rdi
leaq 0x188(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xa8(%r12), %rsi
movq 0xb0(%r12), %rdx
addq %rsi, %rdx
callq 0xb50a
movq 0xc8(%r12), %rdx
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xfa10
movq 0x178(%rsp), %rdi
cmpq %r15, %rdi
je 0x1e665
movq 0x188(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e686
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e6a7
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0xe8(%rsp), %rdi
callq 0xb4e4
leaq 0x9bf3ded(%rip), %rax   # 0x9c124a8
movq (%rax), %rdi
callq 0x242b0
cmpl $0x258, %ebp            # imm = 0x258
jg 0x1e782
cmpl $0x4, %r14d
jg 0x1e782
cmpl $0xc9, %eax
jae 0x1e782
movzbl 0x4(%rsp), %r8d
leaq 0x10(%rsp), %r9
xorl %edi, %edi
xorl %esi, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x1e8ae
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xb046
leaq 0x28(%rsp), %rdx
movaps -0x18(%rdx), %xmm0
movups %xmm0, (%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 0xfb98
leaq 0x50(%rbx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1aa22
movl $0xb8, %edx
leaq (%rbx,%rdx), %rax
movq %rax, 0xa8(%rbx)
movq 0xb8(%rsp), %rcx
addq %rdx, %r14
cmpq %r14, %rcx
je 0x1e7ad
movq %rcx, 0xa8(%rbx)
movq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rbx)
jmp 0x1e7b4
movq %rbx, %rdi
callq 0xfae6
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e7ee
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5360
jmp 0x1e7ee
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 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e80f
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e82a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0xb4e4
leaq 0x10(%rsp), %rdi
callq 0xb1a2
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 0xb4e4
movq %rbx, %rdi
callq 0xb1a2
jmp 0x1e89c
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
callq 0xb1d2
jmp 0x1e8a6
movq %rax, %r14
movq %r13, %rdi
callq 0xb0e0
jmp 0x1e88a
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
callq 0xb4e4
jmp 0x1e8a6
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0xfb30
movq %r14, %rdi
callq 0x55e0