// File: /workspace/github_c_makefile_star2_O0/pipde[P]deos-songlib/lib/songlib.c
// Function: chord
void
chord(double beats,int inst,int octave,int pitch,...)
    {
    int offset;
    int noteCount = 0;
    int notes[CHORD_LENGTH];
    va_list ap;

    dTrace("entering\n");;
    /* store the first absolute note */

    notes[noteCount++] = octave * 12 + pitch;

    /* extract the following pitch deltas */

    va_start(ap, pitch);

    offset = va_arg(ap,int);
    while (offset != 0)
        {
        if (offset < - OCTAVES * NOTES || offset >= OCTAVES * NOTES)
            Fatal("chord: bad offset: %d (missing zero terminator?)\n",offset);
        if (noteCount >= sizeof(notes) / sizeof(int))
            Fatal("chord: too many notes\n");
        notes[noteCount++] = notes[0]+offset;
        offset = va_arg(ap,int);
        }
    va_end(ap);

    anchord(beats,inst,notes,noteCount);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x920, %rsp            # imm = 0x920
testb %al, %al
je 0x3c60
movaps %xmm1, -0x8b0(%rbp)
movaps %xmm2, -0x8a0(%rbp)
movaps %xmm3, -0x890(%rbp)
movaps %xmm4, -0x880(%rbp)
movaps %xmm5, -0x870(%rbp)
movaps %xmm6, -0x860(%rbp)
movaps %xmm7, -0x850(%rbp)
movq %r9, -0x8c8(%rbp)
movq %r8, -0x8d0(%rbp)
movq %rcx, -0x8d8(%rbp)
movsd %xmm0, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x1c(%rbp)
imull $0xc, -0x10(%rbp), %ecx
addl -0x14(%rbp), %ecx
movl -0x1c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
cltq
movl %ecx, -0x820(%rbp,%rax,4)
leaq -0x840(%rbp), %rax
leaq -0x8f0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x40, 0x4(%rax)
movl $0x18, (%rax)
leaq -0x840(%rbp), %rax
movq %rax, -0x900(%rbp)
movl -0x840(%rbp), %eax
movl %eax, -0x8f4(%rbp)
cmpl $0x28, %eax
ja 0x3d0d
movq -0x900(%rbp), %rcx
movl -0x8f4(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x908(%rbp)
jmp 0x3d2a
movq -0x900(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x908(%rbp)
movq -0x908(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x3e09
cmpl $0xffffff7c, -0x18(%rbp) # imm = 0xFFFFFF7C
jl 0x3d52
cmpl $0x84, -0x18(%rbp)
jl 0x3d63
movl -0x18(%rbp), %esi
leaq 0x9739(%rip), %rdi      # 0xd495
movb $0x0, %al
callq 0x8c70
movslq -0x1c(%rbp), %rax
cmpq $0x200, %rax            # imm = 0x200
jb 0x3d7d
leaq 0x9752(%rip), %rdi      # 0xd4c8
movb $0x0, %al
callq 0x8c70
movl -0x820(%rbp), %ecx
addl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
cltq
movl %ecx, -0x820(%rbp,%rax,4)
leaq -0x840(%rbp), %rax
movq %rax, -0x918(%rbp)
movl -0x840(%rbp), %eax
movl %eax, -0x90c(%rbp)
cmpl $0x28, %eax
ja 0x3ddb
movq -0x918(%rbp), %rcx
movl -0x90c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x920(%rbp)
jmp 0x3df8
movq -0x918(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x920(%rbp)
movq -0x920(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
jmp 0x3d36
movsd -0x8(%rbp), %xmm0
movl -0xc(%rbp), %edi
movl -0x1c(%rbp), %edx
leaq -0x820(%rbp), %rsi
callq 0x3e30
addq $0x920, %rsp            # imm = 0x920
popq %rbp
retq
nopl (%rax)