// File: /workspace/github_c_makefile_star2_O2/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), %r12
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
testb %al, %al
je 0x41c5
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 %r12, 0x10(%rsp)
leaq 0x2120(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x5000000020, %r13     # imm = 0x5000000020
movq %r13, (%rsp)
pushq $0x20
popq %rax
pushq $0x20
popq %r15
cmpq $0x28, %r15
ja 0x421f
movq 0x8(%rsp), %r8
movq 0x10(%rsp), %rcx
leaq (%rcx,%r15), %r9
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4232
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %rcx
leaq 0x8(%r9), %r8
movq %r8, 0x8(%rsp)
pushq $0x1
popq %rsi
movl 0x4(%rsp), %edx
movl (%r9), %r14d
testl %r14d, %r14d
je 0x42db
cmpq $0x1ff, %rsi            # imm = 0x1FF
ja 0x42db
cmpl $0x28, %eax
ja 0x4268
movq %r8, %r10
movl %eax, %r8d
addq %rcx, %r8
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4271
leaq 0x8(%r8), %r10
movq %r10, 0x8(%rsp)
movl (%r8), %ebp
cmpl $0xa0, %edx
ja 0x428e
movq %r10, %r9
movl %edx, %r10d
addq %rcx, %r10
addl $0x10, %edx
movl %edx, 0x4(%rsp)
jmp 0x4297
leaq 0x8(%r10), %r9
movq %r9, 0x8(%rsp)
movsd (%r10), %xmm1
movl %r14d, 0x8e0(%rsp,%rsi,4)
movl %ebp, 0xe0(%rsp,%rsi,4)
movsd %xmm1, 0x10e0(%rsp,%rsi,8)
cmpl $0x28, %eax
ja 0x42ca
movq %r9, %r8
movl %eax, %r9d
addq %rcx, %r9
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x42d3
leaq 0x8(%r9), %r8
movq %r8, 0x8(%rsp)
incq %rsi
jmp 0x4239
leaq 0x8e0(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
leaq 0x10e0(%rsp), %r8
movsd %xmm0, 0x20(%rsp)
movsd %xmm1, 0x28(%rsp)
callq 0x3d66
movsd 0x20(%rsp), %xmm0
callq 0x32ff
movsd 0x4fc1(%rip), %xmm0     # 0x92d8
callq 0x4404
movsd 0x28(%rsp), %xmm0
movl %ebx, %edi
movl %r14d, %esi
movl %ebp, %edx
callq *0xa119(%rip)           # 0xe448
movq %r12, 0x10(%rsp)
leaq 0x2120(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r13, (%rsp)
pushq $0x20
popq %rax
cmpq $0x28, %r15
ja 0x435b
addq 0x10(%rsp), %r15
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4369
movq 0x8(%rsp), %r15
leaq 0x8(%r15), %rcx
movq %rcx, 0x8(%rsp)
movl (%r15), %esi
testl %esi, %esi
je 0x43e5
cmpl $0x28, %eax
ja 0x4384
movl %eax, %ecx
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4392
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, 0x8(%rsp)
movl (%rcx), %edx
movl 0x4(%rsp), %ecx
cmpq $0xa0, %rcx
ja 0x43b2
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x43c0
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movsd (%rax), %xmm0
movl %ebx, %edi
callq *0xa07c(%rip)           # 0xe448
movl (%rsp), %eax
cmpq $0x28, %rax
ja 0x435b
movq %rax, %r15
addq 0x10(%rsp), %r15
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x4369
movsd 0x4eeb(%rip), %xmm0     # 0x92d8
callq 0x4473
addq $0x20e8, %rsp           # imm = 0x20E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq