// File: /workspace/github_c_makefile_star2_O0/pipde[P]deos-songlib/lib/songlib.c
// Function: addComment
void
addComment(char *drumComment)
    {
    COMMENT *temp, *temp1;
    int commentSamples = getLocation();
    commentBuffer = (COMMENT *)New(sizeof(COMMENT));

    if(tail == NULL)
        {
        head = commentBuffer;
        tail = commentBuffer;
        commentBuffer->location = commentSamples;
        strcpy(commentBuffer->comment,drumComment);
        return;
        }

    if(commentSamples > tail->location) 
	{
	tail->next = commentBuffer;
	commentBuffer->location = commentSamples;
	strcpy(commentBuffer->comment,drumComment);
	//fprintf(stderr,"%s at %d \n",commentBuffer->comment, commentBuffer->location);
	commentBuffer->next = NULL;
	tail = commentBuffer;
	}
    else /* insert in between */
	{
	/* check from head to current
	 * tail, the most suitable
	 * location to place the comment */

	temp1 = (COMMENT *)New(sizeof(COMMENT));
	temp1->location = 0;

	temp = head;
	while(temp != tail)
	    {
	    if(temp->location > commentSamples)
		{
		temp1->next = temp->next;		
		temp->next = commentBuffer;
		commentBuffer->location = commentSamples;
		strcpy(commentBuffer->comment,drumComment);
		fprintf(stderr,"%s at %f \n",commentBuffer->comment, commentBuffer->location);
		commentBuffer->next = temp1->next;
		break;
		}
	    temp = temp->next;	    
	    }
	}
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
callq 0x38b0
movl %eax, -0x1c(%rbp)
movl $0x210, %edi            # imm = 0x210
callq 0x8ec0
movq %rax, 0x1a783(%rip)     # 0x22078
cmpq $0x0, 0x1a783(%rip)     # 0x22080
jne 0x7944
movq 0x1a772(%rip), %rax     # 0x22078
movq %rax, 0x1a77b(%rip)     # 0x22088
movq 0x1a764(%rip), %rax     # 0x22078
movq %rax, 0x1a765(%rip)     # 0x22080
cvtsi2sdl -0x1c(%rbp), %xmm0
movq 0x1a751(%rip), %rax     # 0x22078
movsd %xmm0, (%rax)
movq 0x1a746(%rip), %rdi     # 0x22078
addq $0x8, %rdi
movq -0x8(%rbp), %rsi
callq 0x2060
jmp 0x7aab
cvtsi2sdl -0x1c(%rbp), %xmm0
movq 0x1a730(%rip), %rax     # 0x22080
ucomisd (%rax), %xmm0
jbe 0x79b4
movq 0x1a71b(%rip), %rcx     # 0x22078
movq 0x1a71c(%rip), %rax     # 0x22080
movq %rcx, 0x208(%rax)
cvtsi2sdl -0x1c(%rbp), %xmm0
movq 0x1a701(%rip), %rax     # 0x22078
movsd %xmm0, (%rax)
movq 0x1a6f6(%rip), %rdi     # 0x22078
addq $0x8, %rdi
movq -0x8(%rbp), %rsi
callq 0x2060
movq 0x1a6e2(%rip), %rax     # 0x22078
movq $0x0, 0x208(%rax)
movq 0x1a6d0(%rip), %rax     # 0x22078
movq %rax, 0x1a6d1(%rip)     # 0x22080
jmp 0x7aab
movl $0x210, %edi            # imm = 0x210
callq 0x8ec0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq 0x1a6b4(%rip), %rax     # 0x22088
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq 0x1a69d(%rip), %rax     # 0x22080
je 0x7aa9
movq -0x10(%rbp), %rax
movsd (%rax), %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7a95
movq -0x10(%rbp), %rax
movq 0x208(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x208(%rax)
movq 0x1a65b(%rip), %rcx     # 0x22078
movq -0x10(%rbp), %rax
movq %rcx, 0x208(%rax)
cvtsi2sdl -0x1c(%rbp), %xmm0
movq 0x1a644(%rip), %rax     # 0x22078
movsd %xmm0, (%rax)
movq 0x1a639(%rip), %rdi     # 0x22078
addq $0x8, %rdi
movq -0x8(%rbp), %rsi
callq 0x2060
movq 0xa5a5(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0x1a61b(%rip), %rdx     # 0x22078
addq $0x8, %rdx
movq 0x1a610(%rip), %rax     # 0x22078
movsd (%rax), %xmm0
leaq 0x5b75(%rip), %rsi      # 0xd5e8
movb $0x1, %al
callq 0x2190
movq -0x18(%rbp), %rax
movq 0x208(%rax), %rcx
movq 0x1a5ec(%rip), %rax     # 0x22078
movq %rcx, 0x208(%rax)
jmp 0x7aa9
movq -0x10(%rbp), %rax
movq 0x208(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x79d8
jmp 0x7aab
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)