// File: /workspace/github_c_makefile_star2_O1/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 0x45e8
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, %ecx
cmpq $0x28, %rcx
ja 0x463c
movl $0x20, %eax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x464a
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %r14d
testl %r14d, %r14d
je 0x4713
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %r9
movl $0x1, %r8d
cmpl $0x28, %eax
ja 0x4683
movq %r9, %r10
movl %eax, %r9d
addq %rdx, %r9
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x468c
leaq 0x8(%r9), %r10
movq %r10, 0x8(%rsp)
movl (%r9), %ebp
cmpl $0xa0, %ecx
ja 0x46a9
movq %r10, %rsi
movl %ecx, %r10d
addq %rdx, %r10
addl $0x10, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x46b2
leaq 0x8(%r10), %rsi
movq %rsi, 0x8(%rsp)
movsd (%r10), %xmm1
movl %r14d, 0x8e0(%rsp,%r8,4)
movl %ebp, 0xe0(%rsp,%r8,4)
movsd %xmm1, 0x10e0(%rsp,%r8,8)
cmpl $0x28, %eax
ja 0x46e6
movq %rsi, %r9
movl %eax, %esi
addq %rdx, %rsi
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x46ef
leaq 0x8(%rsi), %r9
movq %r9, 0x8(%rsp)
movl (%rsi), %r14d
leaq 0x1(%r8), %rsi
testl %r14d, %r14d
je 0x470b
cmpq $0x1ff, %r8             # imm = 0x1FF
movq %rsi, %r8
jb 0x466d
movsd %xmm1, 0x18(%rsp)
jmp 0x471e
movsd %xmm1, 0x18(%rsp)
movl $0x1, %esi
leaq 0x8e0(%rsp), %rdx
leaq 0xe0(%rsp), %rcx
leaq 0x10e0(%rsp), %r8
movaps %xmm0, 0x20(%rsp)
callq 0x420c
movaps 0x20(%rsp), %xmm0
xorps 0x5ba4(%rip), %xmm0     # 0xa2f0
callq 0x5359
movsd 0xad0f(%rip), %xmm0     # 0xf468
mulsd 0x5b07(%rip), %xmm0     # 0xa268
movsd %xmm0, 0xacff(%rip)     # 0xf468
movabsq $0x4000000000000000, %r12 # imm = 0x4000000000000000
movq %r12, 0xaca6(%rip)      # 0xf420
movl 0x1b150(%rip), %eax     # 0x1f8d0
leaq 0x1b159(%rip), %rdx     # 0x1f8e0
cmpq $0x1fe, %rax            # imm = 0x1FE
ja 0x479c
leal 0x1(%rax), %ecx
movl %ecx, 0x1b138(%rip)     # 0x1f8d0
movq %r12, (%rdx,%rax,8)
movsd 0x18(%rsp), %xmm0
movl %ebx, %edi
movl %r14d, %esi
movl %ebp, %edx
callq *0xac99(%rip)           # 0xf448
movq %r15, 0x10(%rsp)
leaq 0x2120(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r13, (%rsp)
movl $0x20, %ecx
cmpq $0x28, %rcx
ja 0x47e2
movl $0x20, %eax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x47f0
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %esi
testl %esi, %esi
je 0x4868
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x480f
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x481d
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %edx
movl 0x4(%rsp), %ecx
cmpq $0xa0, %rcx
ja 0x483d
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x484b
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movsd (%rax), %xmm0
movl %ebx, %edi
callq *0xabf1(%rip)           # 0xf448
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x47e2
movq %rcx, %rax
jmp 0x47d5
movsd 0xabf8(%rip), %xmm0     # 0xf468
addsd %xmm0, %xmm0
movsd %xmm0, 0xabec(%rip)     # 0xf468
movq %r12, 0xab9d(%rip)      # 0xf420
movl 0x1b047(%rip), %eax     # 0x1f8d0
cmpq $0x1fe, %rax            # imm = 0x1FE
ja 0x48a5
leal 0x1(%rax), %ecx
movl %ecx, 0x1b036(%rip)     # 0x1f8d0
leaq 0x1b03f(%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