// File: /workspace/github_c_makefile_star2_O0/pipde[P]deos-songlib/lib/songlib.c
// Function: dtrill
void
dtrill(double beats,int inst1,int inst2,int octave,int pitch,int offset,
    double initial,double tlength,int count)
    {
    int i,j;
    int octaves[CHORD_LENGTH];
    int pitches[CHORD_LENGTH];
    double lengths[CHORD_LENGTH];

    octaves[0] = octave;
    pitches[0] = pitch;
    lengths[0] = initial;

    j = 1;
    for (i = 0; j < sizeof(octaves)/sizeof(int) && i < count; ++i)
        {
        octaves[j] = octave;
        pitches[j] = pitch + offset;
        lengths[j] = tlength;
        ++j;
        octaves[j] = octave;
        pitches[j] = pitch;
        lengths[j] = tlength;
        ++j;
        }

    /*
    for (i = 0; i < 2*count+1; ++i)
        printf("[%d,%d,%f]\n",octaves[i],pitches[i],lengths[i]);
    */

    adraw(beats,inst1,2*count+1,octaves,pitches,lengths);

    backwards(beats);

    softer(2);
    play(initial,inst2,octave,pitch);

    for (i = 0; i < count-1; ++i)
        {
        play(tlength,inst2,octave,pitch+offset);
        play(tlength,inst2,octave,pitch);
        }

    play(tlength,inst2,octave,pitch+offset);
    play(beats-initial-2*tlength*(count-1)-tlength,inst2,octave,pitch);

    louder(2);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2050, %rsp           # imm = 0x2050
movsd %xmm0, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movsd %xmm1, -0x28(%rbp)
movsd %xmm2, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x840(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1040(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x2040(%rbp)
movl $0x1, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movslq -0x3c(%rbp), %rcx
xorl %eax, %eax
cmpq $0x200, %rcx            # imm = 0x200
movb %al, -0x2041(%rbp)
jae 0x586f
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
setl %al
movb %al, -0x2041(%rbp)
movb -0x2041(%rbp), %al
testb $0x1, %al
jne 0x587b
jmp 0x58fa
movl -0x14(%rbp), %ecx
movslq -0x3c(%rbp), %rax
movl %ecx, -0x840(%rbp,%rax,4)
movl -0x18(%rbp), %ecx
addl -0x1c(%rbp), %ecx
movslq -0x3c(%rbp), %rax
movl %ecx, -0x1040(%rbp,%rax,4)
movsd -0x30(%rbp), %xmm0
movslq -0x3c(%rbp), %rax
movsd %xmm0, -0x2040(%rbp,%rax,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x14(%rbp), %ecx
movslq -0x3c(%rbp), %rax
movl %ecx, -0x840(%rbp,%rax,4)
movl -0x18(%rbp), %ecx
movslq -0x3c(%rbp), %rax
movl %ecx, -0x1040(%rbp,%rax,4)
movsd -0x30(%rbp), %xmm0
movslq -0x3c(%rbp), %rax
movsd %xmm0, -0x2040(%rbp,%rax,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x584b
movsd -0x8(%rbp), %xmm0
movl -0xc(%rbp), %edi
movl -0x34(%rbp), %esi
shll %esi
addl $0x1, %esi
leaq -0x840(%rbp), %rdx
leaq -0x1040(%rbp), %rcx
leaq -0x2040(%rbp), %r8
callq 0x45e0
movsd -0x8(%rbp), %xmm0
callq 0x3870
movsd 0x79fa(%rip), %xmm0     # 0xd330
callq 0x5080
movq 0xcad6(%rip), %rax      # 0x12418
movsd -0x28(%rbp), %xmm0
movl -0x10(%rbp), %edi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq *%rax
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x59a2
movq 0xcaab(%rip), %rax      # 0x12418
movsd -0x30(%rbp), %xmm0
movl -0x10(%rbp), %edi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
addl -0x1c(%rbp), %edx
callq *%rax
movq 0xca91(%rip), %rax      # 0x12418
movsd -0x30(%rbp), %xmm0
movl -0x10(%rbp), %edi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq *%rax
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5959
movq 0xca6f(%rip), %rax      # 0x12418
movsd -0x30(%rbp), %xmm0
movl -0x10(%rbp), %edi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
addl -0x1c(%rbp), %edx
callq *%rax
movq 0xca55(%rip), %rax      # 0x12418
movsd -0x8(%rbp), %xmm1
subsd -0x28(%rbp), %xmm1
movsd 0x795b(%rip), %xmm0     # 0xd330
mulsd -0x30(%rbp), %xmm0
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
cvtsi2sd %ecx, %xmm2
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
subsd -0x30(%rbp), %xmm0
movl -0x10(%rbp), %edi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq *%rax
movsd 0x7915(%rip), %xmm0     # 0xd330
callq 0x50f0
addq $0x2050, %rsp           # imm = 0x2050
popq %rbp
retq
nopl (%rax)