// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/chain.c
// Function: chainSwap
void chainSwap(struct chain *chain)
/* Swap target and query side of chain. */
{
struct chain old = *chain;
struct cBlock *b;

/* Copy basic stuff swapping t and q. */
chain->qName = old.tName;
chain->tName = old.qName;
chain->qStart = old.tStart;
chain->qEnd = old.tEnd;
chain->tStart = old.qStart;
chain->tEnd = old.qEnd;
chain->qSize = old.tSize;
chain->tSize = old.qSize;

/* Swap t and q in blocks. */
for (b = chain->blockList; b != NULL; b = b->next)
    {
    struct cBlock old = *b;
    b->qStart = old.tStart;
    b->qEnd = old.tEnd;
    b->tStart = old.qStart;
    b->tEnd = old.qEnd;
    }

/* Cope with the minus strand. */
if (chain->qStrand == '-')
    {
    /* chain's are really set up so that the target is on the
     * + strand and the query is on the minus strand.
     * Therefore we need to reverse complement both 
     * strands while swapping to preserve this. */
    for (b = chain->blockList; b != NULL; b = b->next)
        {
	reverseIntRange(&b->tStart, &b->tEnd, chain->tSize);
	reverseIntRange(&b->qStart, &b->qEnd, chain->qSize);
	}
    reverseIntRange(&chain->tStart, &chain->tEnd, chain->tSize);
    reverseIntRange(&chain->qStart, &chain->qEnd, chain->qSize);
    slReverse(&chain->blockList);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movl $0x50, %edx
callq 0x6570
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x34(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x40(%rax)
movl -0x30(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x44(%rax)
movl -0x18(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x38(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x38(%rax)
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x28a42
movq -0x60(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movl $0x28, %edx
callq 0x6570
movl -0x80(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x78(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x74(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x289f1
movq -0x8(%rbp), %rax
movsbl 0x3c(%rax), %eax
cmpl $0x2d, %eax
jne 0x28af0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x28aab
movq -0x60(%rbp), %rdi
addq $0x8, %rdi
movq -0x60(%rbp), %rsi
addq $0xc, %rsi
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edx
callq 0x33350
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
movq -0x60(%rbp), %rsi
addq $0x14, %rsi
movq -0x8(%rbp), %rax
movl 0x38(%rax), %edx
callq 0x33350
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x28a5f
movq -0x8(%rbp), %rdi
addq $0x24, %rdi
movq -0x8(%rbp), %rsi
addq $0x28, %rsi
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edx
callq 0x33350
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movq -0x8(%rbp), %rsi
addq $0x44, %rsi
movq -0x8(%rbp), %rax
movl 0x38(%rax), %edx
callq 0x33350
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0x2aad0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)