// File: /workspace/github_c_makefile_star2_O3/pipde[P]deos-songlib/lib/songlib.c
// Function: ddraw
void
ddraw(double beats,int inst1,int inst2,int octave,int pitch,double length,...)
    {
    int i;
    int octaves[CHORD_LENGTH],pitches[CHORD_LENGTH];
    double lengths[CHORD_LENGTH];

    dTrace("entering\n");;

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

    /* extract the remaining arguments */

    va_list ap;

    va_start(ap, length);

    octave = va_arg(ap,int);
    i = 1;
    while (octave != (int) 0 && i < sizeof(octaves)/sizeof(int))
        {
        pitch = va_arg(ap,int);
        length = va_arg(ap,double);

        octaves[i] = octave;
        pitches[i] = pitch;
        lengths[i] = length;

        ++i;

        octave = va_arg(ap,int);
        }

    va_end(ap);

    adraw(beats,inst1,i,octaves,pitches,lengths);

    backwards(beats);

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

    /* extract the remaining arguments */

    va_start(ap, length);

    octave = va_arg(ap,int);
    while (octave != (int) 0)
        {
        pitch = va_arg(ap,int);
        length = va_arg(ap,double);

        play(length,inst2,octave,pitch);
        octave = va_arg(ap,int);
        }

    va_end(ap);

    louder(2);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20e8, %rsp           # imm = 0x20E8
movl %ecx, %ebp
movl %esi, %ebx
leaq 0x30(%rsp), %r15
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x46ef
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
movl %edx, 0x8e0(%rsp)
movl %ecx, 0xe0(%rsp)
movsd %xmm1, 0x10e0(%rsp)
movq %r15, 0x10(%rsp)
leaq 0x2120(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x5000000020, %r13     # imm = 0x5000000020
movq %r13, (%rsp)
movl $0x20, %eax
movl $0x20, %ecx
cmpq $0x28, %rcx
ja 0x4743
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4751
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movl (%rcx), %r14d
testl %r14d, %r14d
je 0x4818
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r9
movl $0x1, %edx
movl 0x4(%rsp), %r8d
cmpl $0x28, %eax
ja 0x4787
movq %r9, %r10
movl %eax, %r9d
addq %rcx, %r9
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4790
leaq 0x8(%r9), %r10
movq %r10, 0x8(%rsp)
movl (%r9), %ebp
cmpl $0xa0, %r8d
ja 0x47b0
movq %r10, %rsi
movl %r8d, %r10d
addq %rcx, %r10
addl $0x10, %r8d
movl %r8d, 0x4(%rsp)
jmp 0x47b9
leaq 0x8(%r10), %rsi
movq %rsi, 0x8(%rsp)
movsd (%r10), %xmm1
movl %r14d, 0x8e0(%rsp,%rdx,4)
movl %ebp, 0xe0(%rsp,%rdx,4)
movsd %xmm1, 0x10e0(%rsp,%rdx,8)
cmpl $0x28, %eax
ja 0x47eb
movq %rsi, %r9
movl %eax, %esi
addq %rcx, %rsi
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x47f4
leaq 0x8(%rsi), %r9
movq %r9, 0x8(%rsp)
movl (%rsi), %r14d
leaq 0x1(%rdx), %rsi
testl %r14d, %r14d
je 0x4810
cmpq $0x1ff, %rdx            # imm = 0x1FF
movq %rsi, %rdx
jb 0x4771
movsd %xmm1, 0x18(%rsp)
jmp 0x4826
movsd %xmm1, 0x18(%rsp)
xorl %r14d, %r14d
movl $0x1, %esi
leaq 0x8e0(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
leaq 0x10e0(%rsp), %r8
movaps %xmm0, 0x20(%rsp)
callq 0x41da
movaps 0x20(%rsp), %xmm0
xorps 0x5abc(%rip), %xmm0     # 0xa310
callq 0x543b
movsd 0xac07(%rip), %xmm0     # 0xf468
mulsd 0x59ff(%rip), %xmm0     # 0xa268
movsd %xmm0, 0xabf7(%rip)     # 0xf468
movabsq $0x4000000000000000, %r12 # imm = 0x4000000000000000
movq %r12, 0xab9e(%rip)      # 0xf420
movl 0x1b048(%rip), %eax     # 0x1f8d0
leaq 0x1b051(%rip), %rdx     # 0x1f8e0
cmpq $0x1fe, %rax            # imm = 0x1FE
ja 0x48a4
leal 0x1(%rax), %ecx
movl %ecx, 0x1b030(%rip)     # 0x1f8d0
movq %r12, (%rdx,%rax,8)
movsd 0x18(%rsp), %xmm0
movl %ebx, %edi
movl %r14d, %esi
movl %ebp, %edx
callq *0xab91(%rip)           # 0xf448
movq %r15, 0x10(%rsp)
leaq 0x2120(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r13, (%rsp)
movl $0x20, %eax
movl $0x20, %ecx
cmpq $0x28, %rcx
ja 0x48ea
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x48f8
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movl (%rcx), %esi
testl %esi, %esi
je 0x4973
cmpl $0x28, %eax
ja 0x4912
movl %eax, %ecx
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4920
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, 0x8(%rsp)
movl (%rcx), %edx
movl 0x4(%rsp), %ecx
cmpq $0xa0, %rcx
ja 0x4940
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x494e
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movsd (%rax), %xmm0
movl %ebx, %edi
callq *0xaaee(%rip)           # 0xf448
movl (%rsp), %eax
cmpq $0x28, %rax
ja 0x48ea
movq %rax, %rcx
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x48f8
movsd 0xaaed(%rip), %xmm0     # 0xf468
addsd %xmm0, %xmm0
movsd %xmm0, 0xaae1(%rip)     # 0xf468
movq %r12, 0xaa92(%rip)      # 0xf420
movl 0x1af3c(%rip), %eax     # 0x1f8d0
cmpq $0x1fe, %rax            # imm = 0x1FE
ja 0x49b0
leal 0x1(%rax), %ecx
movl %ecx, 0x1af2b(%rip)     # 0x1f8d0
leaq 0x1af34(%rip), %rcx     # 0x1f8e0
movq %r12, (%rcx,%rax,8)
addq $0x20e8, %rsp           # imm = 0x20E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq