// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/aligned_segment.c
// Function: gt_aligned_segment_new_from_sa
GtAlignedSegment *gt_aligned_segment_new_from_sa(GtSamAlignment *sa,
    GtSamfileEncseqMapping *sem)
{
  GtAlignedSegment *as;
  size_t dlen;
  as = gt_malloc(sizeof (GtAlignedSegment));
  gt_assert(sa != NULL);
  as->r_reverse = gt_sam_alignment_is_reverse(sa);
  as->has_indels = false;
  if (gt_sam_alignment_is_unmapped(sa))
    gt_aligned_segment_init_from_unmapped_sa(as, sa);
  else
    gt_aligned_segment_init_from_mapped_sa(as, sa, sem);
  dlen = strlen(gt_sam_alignment_identifier(sa)) + 1UL;
  as->d = gt_malloc(sizeof (*as->d) * dlen);
  (void)memcpy(as->d, gt_sam_alignment_identifier(sa), sizeof (*as->d) * dlen);
  as->s_edited = false;
  as->r_edited = false;
  as->s_orig = NULL;
  as->mapq = gt_sam_alignment_mapping_quality(sa);
  as->orig_seqlen = gt_sam_alignment_read_length(sa);
  return as;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r13
leaq 0xe2001(%rip), %rsi     # 0x3dc304
movl $0x58, %edi
movl $0xc3, %edx
callq 0x104226
testq %r13, %r13
je 0x2fa72e
movq %rax, %r14
movq %r13, %rdi
callq 0x170522
movb %al, 0x38(%r14)
movb $0x0, 0x39(%r14)
movq %r13, %rdi
callq 0x1704f4
testb %al, %al
movq %r13, 0x8(%rsp)
je 0x2fa3b8
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x28(%r14)
movq %r13, %rdi
callq 0x1701e2
movq %rax, 0x20(%r14)
leaq 0x1(%rax), %rdi
leaq 0xe1fa3(%rip), %r15     # 0x3dc304
movq %r15, %rsi
movl $0xa4, %edx
callq 0x104226
movq %rax, (%r14)
movq 0x20(%r14), %rdi
incq %rdi
movq %r15, %rsi
movl $0xa5, %edx
callq 0x104226
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
movq (%r14), %rax
movq 0x20(%r14), %rcx
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x8(%r14), %rax
movq 0x20(%r14), %rcx
movb %dl, (%rax,%rcx)
movq %r14, %rdi
movq %r13, %rsi
callq 0x2fabe9
jmp 0x2fa683
movq %r13, %rdi
callq 0x17024b
movl %eax, %ebp
movq %r13, %rdi
callq 0x1701cf
movq %r15, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x170986
movq %rax, 0x28(%r14)
movq %r13, %rdi
callq 0x17024b
movl %eax, %ebp
movq %r13, %rdi
callq 0x170208
movq %r15, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x170986
movq %rax, 0x30(%r14)
movq %r13, %rdi
callq 0x17044a
testw %ax, %ax
je 0x2fa43d
movl %eax, %ebp
xorl %r15d, %r15d
xorl %eax, %eax
movzwl %ax, %r12d
movq %r13, %rdi
movl %r12d, %esi
callq 0x17047d
movq %r13, %rdi
movl %r12d, %esi
callq 0x17045d
movl %eax, %eax
addq %rax, %r15
leal 0x1(%r12), %eax
cmpw %ax, %bp
jne 0x2fa412
jmp 0x2fa440
xorl %r15d, %r15d
movq %r13, %rdi
callq 0x1701e2
cmpq %rax, %r15
jb 0x2fa738
movq %r15, 0x20(%r14)
incq %r15
leaq 0xe1ea5(%rip), %r12     # 0x3dc304
movq %r15, %rdi
movq %r12, %rsi
movl $0xb4, %edx
callq 0x104226
movq %rax, (%r14)
movq 0x20(%r14), %rdi
incq %rdi
movq %r12, %rsi
movl $0xb5, %edx
callq 0x104226
movq %rax, 0x8(%r14)
movq 0x20(%r14), %rdi
incq %rdi
movq %r12, %rsi
movl $0xb6, %edx
callq 0x104226
movq %rax, 0x10(%r14)
movq (%r14), %rax
movq 0x20(%r14), %rcx
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x8(%r14), %rax
movq 0x20(%r14), %rcx
movb %dl, (%rax,%rcx)
movq 0x10(%r14), %rax
movq 0x20(%r14), %rcx
movb %dl, (%rax,%rcx)
movq %r14, %rdi
movq %r13, %rsi
callq 0x2fabe9
movq 0x20(%r14), %rbx
movq %r13, %rdi
callq 0x1701e2
cmpq %rax, %rbx
jb 0x2fa73d
movq 0x20(%r14), %r12
movq %r13, %rdi
callq 0x1701e2
movq %rax, %r15
movq %r13, %rdi
callq 0x17044a
testw %ax, %ax
je 0x2fa683
subq %r15, %r12
movzwl %ax, %eax
movq %rax, 0x20(%rsp)
decq %rax
movq %rax, 0x18(%rsp)
xorl %edi, %edi
xorl %ebx, %ebx
movq 0x8(%rsp), %r13
movq %rdi, 0x10(%rsp)
movzwl %di, %r15d
movq %r13, %rdi
movl %r15d, %esi
callq 0x17047d
movl %eax, %ebp
movq %r13, %rdi
movl %r15d, %esi
callq 0x17045d
movzbl %bpl, %ecx
leal -0x48(%rcx), %edx
cmpl $0x10, %edx
ja 0x2fa5b8
leaq 0xe1d6c(%rip), %rsi     # 0x3dc2c0
movslq (%rsi,%rdx,4), %rcx
addq %rsi, %rcx
movq 0x10(%rsp), %rdi
jmpq *%rcx
testw %ax, %ax
je 0x2fa5f0
cmpq %r12, %rbx
je 0x2fa5a3
jae 0x2fa71a
movq (%r14), %rcx
movb (%rcx,%r12), %dl
cmpb $0x2d, %dl
je 0x2fa715
movq 0x8(%r14), %rsi
cmpb $0x7f, (%rsi,%r12)
je 0x2fa71f
movb %dl, (%rcx,%rbx)
movq 0x8(%r14), %rcx
movb (%rcx,%r12), %dl
movb %dl, (%rcx,%rbx)
movq 0x10(%r14), %rcx
movb $0x2d, (%rcx,%rbx)
incq %rbx
incq %r12
decw %ax
jne 0x2fa56b
jmp 0x2fa5f0
cmpl $0x3d, %ecx
movq 0x10(%rsp), %rdi
je 0x2fa617
cmpl $0x44, %ecx
jne 0x2fa724
andl $0xffff, %eax           # imm = 0xFFFF
je 0x2fa5f0
movq (%r14), %rcx
movb $0x2d, (%rcx,%rbx)
movq 0x8(%r14), %rcx
movb $0x7f, (%rcx,%rbx)
movq 0x10(%r14), %rcx
movb $0x3f, (%rcx,%rbx)
incq %rbx
decl %eax
jne 0x2fa5d2
movb $0x1, 0x39(%r14)
jmp 0x2fa675
testq %rdi, %rdi
je 0x2fa610
cmpq %rdi, 0x18(%rsp)
jne 0x2fa733
movzwl %ax, %ecx
addq %rcx, 0x30(%r14)
jmp 0x2fa617
movzwl %ax, %ecx
subq %rcx, 0x28(%r14)
testw %ax, %ax
je 0x2fa675
cmpq %r12, %rbx
je 0x2fa654
jae 0x2fa70b
movq (%r14), %rcx
movb (%rcx,%r12), %dl
cmpb $0x2d, %dl
je 0x2fa706
movq 0x8(%r14), %rsi
cmpb $0x7f, (%rsi,%r12)
je 0x2fa710
movb %dl, (%rcx,%rbx)
movq 0x8(%r14), %rcx
movb (%rcx,%r12), %dl
movb %dl, (%rcx,%rbx)
movb $0x3f, %cl
cmpb $0x3d, %bpl
jne 0x2fa663
movq (%r14), %rcx
movb (%rcx,%r12), %cl
movq 0x10(%r14), %rdx
movb %cl, (%rdx,%rbx)
incq %rbx
incq %r12
decw %ax
jne 0x2fa61c
incq %rdi
cmpq 0x20(%rsp), %rdi
jne 0x2fa520
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x170238
movq %rax, %rdi
callq 0x172f0
leaq 0x1(%rax), %r15
leaq 0xe1c61(%rip), %rsi     # 0x3dc304
movq %r15, %rdi
movl $0xcc, %edx
callq 0x104226
movq %rax, %r12
movq %rax, 0x18(%r14)
movq %rbx, %rdi
callq 0x170238
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x17660
movw $0x0, 0x3a(%r14)
movq $0x0, 0x40(%r14)
movq %rbx, %rdi
callq 0x1701f5
movq %rax, 0x50(%r14)
movq %rbx, %rdi
callq 0x1701e2
movq %rax, 0x48(%r14)
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x89bd6
callq 0x89b68
callq 0x89b9f
callq 0x89afa
callq 0x89a8c
callq 0x89ac3
movl $0x2, %edi
callq 0x17940
callq 0x89c7b
callq 0x89b31
callq 0x89c44
callq 0x89c0d