// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/tag_value_map.c
// Function: gt_tag_value_map_set
void gt_tag_value_map_set(GtTagValueMap *map, const char *tag,
                          const char *new_value)
{
  size_t old_value_len, new_value_len, map_len = 0;
  char *old_value;
  gt_assert(map && *map && tag && new_value);
  gt_assert(strlen(tag));
  new_value_len = strlen(new_value);
  gt_assert(new_value_len);
  /* determine current map length */
  old_value = get_value(*map, tag, &map_len);
  if (!old_value)
    return gt_tag_value_map_add(map, tag, new_value);
  /* tag already used -> replace it */
  old_value_len = strlen(old_value);
  map_len = get_map_len(*map);
  if (new_value_len < old_value_len) {
    memcpy(old_value, new_value, new_value_len);
    memmove(old_value + new_value_len, old_value + old_value_len,
            map_len - ((size_t) old_value - (size_t) *map + old_value_len) + 1);
    *map = gt_realloc(*map, map_len - (old_value_len - new_value_len) + 1);
  }
  else if (new_value_len == old_value_len) {
    memcpy(old_value, new_value, new_value_len);
  }
  else { /* (new_value_len > old_value_len)  */
    *map = gt_realloc(*map, map_len + (new_value_len - old_value_len) + 1);
    /* determine old_value again, realloc() might have moved it */
    old_value = get_value(*map, tag, &map_len);
    gt_assert(old_value);
    memmove(old_value + new_value_len, old_value + old_value_len,
            map_len - ((size_t) old_value - (size_t) *map + old_value_len) + 1);
    memcpy(old_value, new_value, new_value_len);
  }
  gt_assert((*map)[map_len - old_value_len + new_value_len] == '\0');
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x36b0f
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax)
je 0x36b0f
cmpq $0x0, 0x28(%rsp)
je 0x36b0f
cmpq $0x0, 0x20(%rsp)
jne 0x36b47
movq 0x17d4c2(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x127546(%rip), %rsi    # 0x15e066
leaq 0x12fc04(%rip), %rdx    # 0x16672b
leaq 0x12fc1d(%rip), %rcx    # 0x16674b
leaq 0x12faff(%rip), %r8     # 0x166634
movl $0xa2, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x36b49
jmp 0x36b4b
movq 0x28(%rsp), %rdi
callq 0xb240
cmpq $0x0, %rax
jne 0x36b93
movq 0x17d476(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1274fa(%rip), %rsi    # 0x15e066
leaq 0x12fc41(%rip), %rdx    # 0x1667b4
leaq 0x12fbd1(%rip), %rcx    # 0x16674b
leaq 0x12fab3(%rip), %r8     # 0x166634
movl $0xa3, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x36b95
movq 0x20(%rsp), %rdi
callq 0xb240
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x36be4
movq 0x17d425(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1274a9(%rip), %rsi    # 0x15e066
leaq 0x12fb9c(%rip), %rdx    # 0x166760
leaq 0x12fb80(%rip), %rcx    # 0x16674b
leaq 0x12fa62(%rip), %r8     # 0x166634
movl $0xa5, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x36be6
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x36680
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0x36c21
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x36490
jmp 0x36e3c
movq (%rsp), %rdi
callq 0xb240
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x36a70
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x36cda
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0xb500
movq (%rsp), %rdi
addq 0x10(%rsp), %rdi
movq (%rsp), %rsi
addq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq (%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
addq 0x18(%rsp), %rax
subq %rax, %rdx
addq $0x1, %rdx
callq 0xba20
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
subq %rax, %rsi
addq $0x1, %rsi
leaq 0x12f974(%rip), %rdx    # 0x166634
movl $0xb1, %ecx
callq 0xd730
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
jmp 0x36de0
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
jne 0x36cfe
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0xb500
jmp 0x36dde
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rax
subq 0x18(%rsp), %rax
addq %rax, %rsi
addq $0x1, %rsi
leaq 0x12f911(%rip), %rdx    # 0x166634
movl $0xb7, %ecx
callq 0xd730
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x36680
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0x36d92
movq 0x17d277(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1272fb(%rip), %rsi    # 0x15e066
leaq 0x154ebd(%rip), %rdx    # 0x18bc2f
leaq 0x12f9d2(%rip), %rcx    # 0x16674b
leaq 0x12f8b4(%rip), %r8     # 0x166634
movl $0xba, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x36d94
movq (%rsp), %rdi
addq 0x10(%rsp), %rdi
movq (%rsp), %rsi
addq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq (%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
addq 0x18(%rsp), %rax
subq %rax, %rdx
addq $0x1, %rdx
callq 0xba20
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0xb500
jmp 0x36de0
jmp 0x36de2
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
subq 0x18(%rsp), %rcx
addq 0x10(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x36e3a
movq 0x17d1cf(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x127253(%rip), %rsi    # 0x15e066
leaq 0x12f954(%rip), %rdx    # 0x16676e
leaq 0x12f92a(%rip), %rcx    # 0x16674b
leaq 0x12f80c(%rip), %r8     # 0x166634
movl $0xbf, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x36e3c
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)