LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/samtools-0.1.18/bam_sort.c
// Function: sort_blocks
static void sort_blocks(int n, int k, bam1_p *buf, const char *prefix, const bam_header_t *h, int is_stdout)
{
	char *name, mode[3];
	int i;
	bamFile fp;
	ks_mergesort(sort, k, buf, 0);
	name = (char*)calloc(strlen(prefix) + 20, 1);
	if (n >= 0) {
		sprintf(name, "%s.%.4d.bam", prefix, n);
		strcpy(mode, "w1");
	} else {
		sprintf(name, "%s.bam", prefix);
		strcpy(mode, "w");
	}
	fp = is_stdout? bam_dopen(fileno(stdout), mode) : bam_open(name, mode);
	if (fp == 0) {
		fprintf(stderr, "[sort_blocks] fail to create file %s.\n", name);
		free(name);
		// FIXME: possible memory leak
		return;
	}
	free(name);
	bam_header_write(fp, h);
	for (i = 0; i < k; ++i)
		bam_write1_core(fp, &buf[i]->core, buf[i]->data_len, buf[i]->data);
	bam_close(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r12d
movq %r8, 0x10(%rsp)
movq %rcx, %r13
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
movslq %esi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2fac89
movq %r13, %rdi
callq 0x2ee50
leaq 0x14(%rax), %rdi
movl $0x1, %esi
callq 0x30ed0
movq %rax, %r15
testl %r14d, %r14d
js 0x2fba82
leaq 0xbd807(%rip), %rsi     # 0x3b926b
movq %r15, %rdi
movq %r13, %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2f3c0
movw $0x3177, 0xc(%rsp)      # imm = 0x3177
movb $0x0, 0xe(%rsp)
jmp 0x2fba9d
leaq 0xbd7db(%rip), %rsi     # 0x3b9264
movq %r15, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2f3c0
movw $0x77, 0xc(%rsp)
testl %r12d, %r12d
je 0x2fbabf
movq 0x18a547(%rip), %rax    # 0x485ff0
movq (%rax), %rdi
callq 0x2d230
leaq 0xc(%rsp), %rsi
movl %eax, %edi
callq 0x2e5a78
jmp 0x2fbacc
leaq 0xc(%rsp), %rsi
movq %r15, %rdi
callq 0x2e5723
movq %rax, %r12
movq %r15, %rdi
testq %rax, %rax
je 0x2fbb25
callq 0x32018
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x2e82e4
testl %ebp, %ebp
jle 0x2fbb0e
movl %ebp, %r14d
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rsi
movl 0x24(%rsi), %edx
movq 0x30(%rsi), %rcx
movq %r12, %rdi
callq 0x2e87c6
incq %r15
cmpq %r15, %r14
jne 0x2fbaf3
movq %r12, %rdi
callq 0x2e582b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xa9545
jmp 0x2fbb16
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/samtools-0.1.18/bam_sort.c
// Function: bam1_lt
static inline int bam1_lt(const bam1_p a, const bam1_p b)
{
	if (g_is_by_qname) {
		int t = strnum_cmp(bam1_qname(a), bam1_qname(b));
		return (t < 0 || (t == 0 && (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1)))));
	} else return (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1)));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
cmpl $0x0, 0x19544a(%rip)    # 0x490364
je 0x2fb005
movq 0x30(%r14), %rbp
movq %rsi, 0x10(%rsp)
movq 0x30(%rsi), %r12
movq %rbp, 0x18(%rsp)
movq %r12, 0x8(%rsp)
movb (%rbp), %r13b
testb %r13b, %r13b
movq %r12, 0x20(%rsp)
je 0x2fafcf
movq %rbp, %r15
movq 0x8(%rsp), %r12
movsbq (%r12), %rbx
testq %rbx, %rbx
je 0x2fafd5
callq 0x2f1b0
movq (%rax), %rax
movsbq %r13b, %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x2faf75
testb $0x8, 0x1(%rax,%rbx,2)
jne 0x2faf8c
cmpb %bl, %r13b
jne 0x2fafd5
incq %r15
movq %r15, 0x18(%rsp)
incq %r12
movq %r12, 0x8(%rsp)
jmp 0x2fafbd
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x2fbd0
movq %rax, %r15
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
movl $0xa, %edx
callq 0x2fbd0
cmpq %rax, %r15
jne 0x2faff0
movq 0x18(%rsp), %r15
movb (%r15), %r13b
testb %r13b, %r13b
jne 0x2faf4c
movq 0x8(%rsp), %r12
xorl %r13d, %r13d
jmp 0x2fafd5
xorl %r13d, %r13d
movq %rbp, %r15
cmpb (%r12), %r13b
jne 0x2faff0
subq %rbp, %r15
subq 0x20(%rsp), %r12
movl $0x1, %eax
cmpq %r12, %r15
setg %cl
jmp 0x2faff8
setg %cl
movl $0x1, %eax
movq 0x10(%rsp), %rsi
jl 0x2fb02e
xorl %eax, %eax
testb %cl, %cl
jne 0x2fb02e
movl (%r14), %eax
shlq $0x20, %rax
movslq 0x4(%r14), %rcx
incq %rcx
orq %rax, %rcx
movl (%rsi), %eax
shlq $0x20, %rax
movslq 0x4(%rsi), %rdx
incq %rdx
orq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
setb %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/samtools-0.1.18/bam_sort.c
// Function: bam_sort
int bam_sort(int argc, char *argv[])
{
	size_t max_mem = 500000000;
	int c, is_by_qname = 0, is_stdout = 0;
	while ((c = getopt(argc, argv, "nom:")) >= 0) {
		switch (c) {
		case 'o': is_stdout = 1; break;
		case 'n': is_by_qname = 1; break;
		case 'm': max_mem = atol(optarg); break;
		}
	}
	if (optind + 2 > argc) {
		fprintf(stderr, "Usage: samtools sort [-on] [-m <maxMem>] <in.bam> <out.prefix>\n");
		return 1;
	}
	bam_sort_core_ext(is_by_qname, argv[optind], argv[optind+1], max_mem, is_stdout);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xbd72c(%rip), %rdx     # 0x3b9277
callq 0x2e000
testl %eax, %eax
js 0x2fbbab
movl $0x1dcd6500, %r15d      # imm = 0x1DCD6500
xorl %r14d, %r14d
leaq 0xbd713(%rip), %r13     # 0x3b9277
xorl %r12d, %r12d
cmpl $0x6d, %eax
je 0x2fbb86
cmpl $0x6e, %eax
je 0x2fbb7e
cmpl $0x6f, %eax
jne 0x2fbb98
movl $0x1, %r14d
jmp 0x2fbb98
movl $0x1, %r12d
jmp 0x2fbb98
movq 0x18a3e3(%rip), %rax    # 0x485f70
movq (%rax), %rdi
callq 0x2f650
movq %rax, %r15
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2e000
testl %eax, %eax
jns 0x2fbb67
jmp 0x2fbbb7
xorl %r12d, %r12d
movl $0x1dcd6500, %r15d      # imm = 0x1DCD6500
xorl %r14d, %r14d
movq 0x18a36a(%rip), %rax    # 0x485f28
movslq (%rax), %rax
leal 0x2(%rax), %ecx
cmpl %ebp, %ecx
jg 0x2fbbf0
movq (%rbx,%rax,8), %rsi
movq 0x8(%rbx,%rax,8), %rdx
movl %r12d, %edi
movq %r15, %rcx
movl %r14d, %r8d
callq 0x2fb6d2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xa956e
movl $0x1, %eax
jmp 0x2fbbe1
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/samtools-0.1.18/bam_reheader.c
// Function: bam_reheader
int bam_reheader(BGZF *in, const bam_header_t *h, int fd)
{
	BGZF *fp;
	bam_header_t *old;
	int len;
	uint8_t *buf;
	if (in->open_mode != 'r') return -1;
	buf = malloc(BUF_SIZE);
	old = bam_header_read(in);
	fp = bgzf_fdopen(fd, "w");
	bam_header_write(fp, h);
	if (in->block_offset < in->block_length) {
		bgzf_write(fp, in->uncompressed_block + in->block_offset, in->block_length - in->block_offset);
		bgzf_flush(fp);
	}
#ifdef _USE_KNETFILE
	while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0)
		fwrite(buf, 1, len, fp->x.fpw);
#else
	while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0)
		fwrite(buf, 1, len, fp->file);
#endif
	free(buf);
	fp->block_offset = in->block_offset = 0;
	bgzf_close(fp);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpb $0x72, 0x4(%rdi)
jne 0x2fd22e
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
movl $0x10000, %edi          # imm = 0x10000
callq 0x32008
movq %rax, %r14
movq %rbx, %rdi
callq 0x2e811e
leaq 0x79942(%rip), %rsi     # 0x376ada
movl %ebp, %edi
callq 0x2e5a78
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
callq 0x2e82e4
movslq 0x3c(%rbx), %rax
movl 0x38(%rbx), %edx
cmpl %eax, %edx
jle 0x2fd206
movq %rax, %rsi
addq 0x20(%rbx), %rsi
subl %eax, %edx
movq %r15, %rdi
callq 0x2e655e
movq %r15, %rdi
callq 0x2e6308
jmp 0x2fd206
movq 0x10(%rbx), %rcx
movl $0x1, %esi
movl $0x10000, %edx          # imm = 0x10000
movq %r14, %rdi
callq 0x30320
testl %eax, %eax
jle 0x2fd213
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x10(%r15), %rcx
movl $0x1, %esi
movq %r14, %rdi
movq %rax, %rdx
callq 0x31720
movq 0x10(%rbx), %rdi
callq 0x30f90
testl %eax, %eax
je 0x2fd1d3
movq %r14, %rdi
callq 0x32018
xorl %r14d, %r14d
movl %r14d, 0x3c(%rbx)
movl %r14d, 0x3c(%r15)
movq %r15, %rdi
callq 0x2e582b
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/tre-filter.c
// Function: tre_filter_find
int
tre_filter_find(const unsigned char *str, size_t len, tre_filter_t *filter)
{
  unsigned short counts[256];
  unsigned int i;
  unsigned int window_len = filter->window_len;
  tre_filter_profile_t *profile = filter->profile;
  const unsigned char *str_orig = str;

  DPRINT(("tre_filter_find: %.*s\n", len, str));

  for (i = 0; i < elementsof(counts); i++)
    counts[i] = 0;

  i = 0;
  while (*str && i < window_len && i < len)
    {
      counts[*str]++;
      i++;
      str++;
      len--;
    }

  while (len > 0)
    {
      tre_filter_profile_t *p;
      counts[*str]++;
      counts[*(str - window_len)]--;

      p = profile;
      while (p->ch)
	{
	  if (counts[p->ch] < p->count)
	    break;
	  p++;
	}
      if (!p->ch)
	{
	  DPRINT(("Found possible match at %d\n",
		  str - str_orig));
	  return str - str_orig;
	}
      else
	{
	  DPRINT(("No match so far...\n"));
	}
      len--;
      str++;
    }
  DPRINT(("This string cannot match.\n"));
  return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdx), %ebp
movl %ebp, %r15d
movq 0x8(%rdx), %r12
movq %rsp, %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x2d4b0
movb (%rbx), %al
testb %al, %al
sete %cl
testl %ebp, %ebp
sete %dl
orb %cl, %dl
testq %r14, %r14
sete %cl
orb %dl, %cl
jne 0x3144c5
movl $0x1, %ecx
movzbl %al, %eax
incw (%rsp,%rax,2)
decq %r14
movb (%rbx,%rcx), %al
leaq 0x1(%rcx), %rdx
testb %al, %al
je 0x3144bc
cmpq %r15, %rcx
jae 0x3144bc
cmpq %rcx, %r14
movq %rdx, %rcx
ja 0x31449a
leaq (%rbx,%rdx), %rcx
decq %rcx
jmp 0x3144c8
movq %rbx, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x314529
negq %r15
movb (%r12), %dl
addq $0x2, %r12
movq %rcx, %rsi
movzbl (%rsi), %edi
incw (%rsp,%rdi,2)
movzbl (%rsi,%r15), %edi
decw (%rsp,%rdi,2)
movq %r12, %rdi
movl %edx, %r8d
testb %dl, %dl
je 0x314525
movzbl %r8b, %r8d
movzbl -0x1(%rdi), %r9d
cmpw %r9w, (%rsp,%r8,2)
jb 0x314518
movb (%rdi), %r8b
addq $0x2, %rdi
testb %r8b, %r8b
jne 0x3144fa
jmp 0x314522
incq %rsi
decq %r14
jne 0x3144e0
jmp 0x314529
movq %rsi, %rcx
subl %ebx, %ecx
movl %ecx, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: xmalloc_init
static void
xmalloc_init(void)
{
  if (xmalloc_table == NULL)
    {
      xmalloc_table = hash_table_new();
      xmalloc_peak = 0;
      xmalloc_peak_blocks = 0;
      xmalloc_current = 0;
      xmalloc_current_blocks = 0;
      xmalloc_fail_after = -1;
    }
  assert(xmalloc_table != NULL);
  assert(xmalloc_table->table != NULL);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x177d65(%rip), %rbx    # 0x490878
testq %rbx, %rbx
jne 0x318b86
movl $0x8, %edi
callq 0x32008
xorl %r14d, %r14d
testq %rax, %rax
je 0x318b4c
movq %rax, %rbx
movl $0x100, %edi            # imm = 0x100
movl $0x8, %esi
callq 0x30ed0
movq %rax, (%rbx)
testq %rax, %rax
jne 0x318b4e
movq %rbx, %rdi
callq 0x32018
xorl %ebx, %ebx
movq %rbx, 0x177d23(%rip)    # 0x490878
movl %r14d, 0x177d24(%rip)   # 0x490880
movl %r14d, 0x177d21(%rip)   # 0x490884
leaq 0x177d1e(%rip), %rax    # 0x490888
movl %r14d, (%rax)
leaq 0x177d18(%rip), %rax    # 0x49088c
movl %r14d, (%rax)
movl $0xffffffff, 0x177cef(%rip) # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x318bb3
cmpq $0x0, (%rbx)
je 0x318b94
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xa407d(%rip), %rdi     # 0x3bcc18
leaq 0xa3ecc(%rip), %rsi     # 0x3bca6e
leaq 0xa4057(%rip), %rcx     # 0x3bcc00
movl $0xb8, %edx
callq 0x2dda0
leaq 0xa4030(%rip), %rdi     # 0x3bcbea
leaq 0xa3ead(%rip), %rsi     # 0x3bca6e
leaq 0xa4038(%rip), %rcx     # 0x3bcc00
movl $0xb7, %edx
callq 0x2dda0
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: xmalloc_dump_leaks
int
xmalloc_dump_leaks(void)
{
  int i;
  int num_leaks = 0;
  int leaked_bytes = 0;
  hashTableItem *item;

  xmalloc_init();

  for (i = 0; i < TABLE_SIZE; i++)
    {
      item = xmalloc_table->table[i];
      while (item != NULL)
	{
	  printf("%s:%d: %s: %d bytes at %p not freed\n",
		 item->file, item->line, item->func, item->bytes, item->ptr);
	  num_leaks++;
	  leaked_bytes += item->bytes;
	  item = item->next;
	}
    }
  if (num_leaks == 0)
    printf("No memory leaks.\n");
  else
    printf("%d unfreed memory chuncks, total %d unfreed bytes.\n",
	   num_leaks, leaked_bytes);
  printf("Peak memory consumption %d bytes (%.1f kB, %.1f MB) in %d blocks ",
	 xmalloc_peak, (double)xmalloc_peak / 1024,
	 (double)xmalloc_peak / (1024*1024), xmalloc_peak_blocks);
  printf("(average ");
  if (xmalloc_peak_blocks)
    printf("%d", ((xmalloc_peak + xmalloc_peak_blocks / 2)
		  / xmalloc_peak_blocks));
  else
    printf("N/A");
  printf(" bytes per block).\n");

  return num_leaks;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0x318b08
leaq 0xa3ddf(%rip), %r14     # 0x3bc9c5
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x177c84(%rip), %rax    # 0x490878
movq (%rax), %rax
movq (%rax,%r15,8), %r12
testq %r12, %r12
je 0x318c30
movq 0x10(%r12), %rsi
movl 0x18(%r12), %edx
movq 0x20(%r12), %rcx
movl 0x8(%r12), %r8d
movq (%r12), %r9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2d300
incl %ebx
addl 0x8(%r12), %ebp
movq 0x28(%r12), %r12
jmp 0x318bfb
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x318bed
testl %ebx, %ebx
je 0x318c54
leaq 0xa3da3(%rip), %rdi     # 0x3bc9ea
movl %ebx, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2d300
jmp 0x318c60
leaq 0xa404c(%rip), %rdi     # 0x3bcca7
callq 0x2dbb0
movl 0x177c1a(%rip), %esi    # 0x490880
cvtsi2sd %esi, %xmm1
movsd 0x9bce6(%rip), %xmm0    # 0x3b4958
mulsd %xmm1, %xmm0
mulsd 0x30b62(%rip), %xmm1    # 0x3497e0
movl 0x177c00(%rip), %edx    # 0x490884
leaq 0xa3d93(%rip), %rdi     # 0x3bca1e
movb $0x2, %al
callq 0x2d300
leaq 0xa3dc7(%rip), %rdi     # 0x3bca60
xorl %eax, %eax
callq 0x2d300
movl 0x177bde(%rip), %ecx    # 0x490884
testl %ecx, %ecx
je 0x318cca
movl %ecx, %eax
shrl %eax
addl 0x177bcc(%rip), %eax    # 0x490880
xorl %edx, %edx
divl %ecx
leaq 0x9f3c8(%rip), %rdi     # 0x3b8087
movl %eax, %esi
xorl %eax, %eax
callq 0x2d300
jmp 0x318cd8
leaq 0xa3d99(%rip), %rdi     # 0x3bca6a
xorl %eax, %eax
callq 0x2d300
leaq 0xa3fd9(%rip), %rdi     # 0x3bccb8
callq 0x2dbb0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: xmalloc_impl
void *
xmalloc_impl(size_t size, const char *file, int line, const char *func)
{
  void *ptr;

  xmalloc_init();
  assert(size > 0);

  if (xmalloc_fail_after == 0)
    {
      xmalloc_fail_after = -2;
#if 0
      printf("xmalloc: forced failure %s:%d: %s\n", file, line, func);
#endif
      return NULL;
    }
  else if (xmalloc_fail_after == -2)
    {
      printf("xmalloc: called after failure from %s:%d: %s\n",
	     file, line, func);
      assert(0);
    }
  else if (xmalloc_fail_after > 0)
    xmalloc_fail_after--;

  ptr = malloc(size);
  if (ptr != NULL)
    hash_table_add(xmalloc_table, ptr, (int)size, file, line, func);
  return ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
callq 0x318b08
testq %r15, %r15
je 0x318d6d
movl 0x177b5e(%rip), %eax    # 0x490870
testl %eax, %eax
je 0x318d54
cmpl $-0x2, %eax
je 0x318d8c
testl %eax, %eax
jle 0x318d27
decl %eax
movl %eax, 0x177b49(%rip)    # 0x490870
movq %r15, %rdi
callq 0x32008
testq %rax, %rax
je 0x318d5e
movq %rax, %r12
movq 0x177b3a(%rip), %rdi    # 0x490878
movq %rax, %rsi
movl %r15d, %edx
movq %r14, %rcx
movl %ebp, %r8d
movq %rbx, %r9
callq 0x318dc1
jmp 0x318d61
movl $0xfffffffe, 0x177b12(%rip) # imm = 0xFFFFFFFE
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31f6e(%rip), %rdi     # 0x34ace2
leaq 0xa3cf3(%rip), %rsi     # 0x3bca6e
leaq 0xa3d0b(%rip), %rcx     # 0x3bca8d
movl $0xf7, %edx
callq 0x2dda0
leaq 0xa3d36(%rip), %rdi     # 0x3bcac9
movq %r14, %rsi
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2d300
leaq 0x9f2ef(%rip), %rdi     # 0x3b8098
leaq 0xa3cbe(%rip), %rsi     # 0x3bca6e
leaq 0xa3cd6(%rip), %rcx     # 0x3bca8d
movl $0x105, %edx            # imm = 0x105
callq 0x2dda0
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: hash_table_add
static void
hash_table_add(hashTable *tbl, void *ptr, int bytes,
	       const char *file, int line, const char *func)
{
  int i;
  hashTableItem *item, *new;

  i = hash_void_ptr(ptr);

  item = tbl->table[i];
  if (item != NULL)
    while (item->next != NULL)
      item = item->next;

  new = malloc(sizeof(*new));
  assert(new != NULL);
  new->ptr = ptr;
  new->bytes = bytes;
  new->file = file;
  new->line = line;
  new->func = func;
  new->next = NULL;
  if (item != NULL)
    item->next = new;
  else
    tbl->table[i] = new;

  xmalloc_current += bytes;
  if (xmalloc_current > xmalloc_peak)
    xmalloc_peak = xmalloc_current;
  xmalloc_current_blocks++;
  if (xmalloc_current_blocks > xmalloc_peak_blocks)
    xmalloc_peak_blocks = xmalloc_current_blocks;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movl %r8d, 0xc(%rsp)
movq %rcx, %r15
movl %edx, %ebx
movq %rsi, %r12
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq %r12, %rsi
shrq %cl, %rsi
xorl %edx, %esi
addl %eax, %esi
movzbl %sil, %edx
addq $0x8, %rcx
addl $0x11, %eax
cmpq $0x40, %rcx
jne 0x318de7
movq (%rdi), %r13
movl %edx, %r14d
movq (%r13,%r14,8), %rax
testq %rax, %rax
je 0x318e20
movq %rax, %rbp
movq 0x28(%rax), %rax
testq %rax, %rax
jne 0x318e12
jmp 0x318e22
xorl %ebp, %ebp
movl $0x30, %edi
callq 0x32008
testq %rax, %rax
je 0x318eb0
leaq (,%r14,8), %rcx
addq %r13, %rcx
movq %r12, (%rax)
movl %ebx, 0x8(%rax)
movq %r15, 0x10(%rax)
movl 0xc(%rsp), %edx
movl %edx, 0x18(%rax)
movq 0x10(%rsp), %rdx
movq %rdx, 0x20(%rax)
movq $0x0, 0x28(%rax)
leaq 0x28(%rbp), %rdx
testq %rbp, %rbp
cmoveq %rcx, %rdx
movq %rax, (%rdx)
leaq 0x177a15(%rip), %rax    # 0x490888
addl (%rax), %ebx
movl %ebx, (%rax)
cmpl 0x177a03(%rip), %ebx    # 0x490880
jle 0x318e85
movl %ebx, 0x1779fb(%rip)    # 0x490880
leaq 0x177a00(%rip), %rcx    # 0x49088c
movl (%rcx), %edx
leal 0x1(%rdx), %eax
movl %eax, (%rcx)
cmpl 0x1779eb(%rip), %edx    # 0x490884
jl 0x318ea1
movl %eax, 0x1779e3(%rip)    # 0x490884
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa3d7e(%rip), %rdi     # 0x3bcc35
leaq 0xa3bb0(%rip), %rsi     # 0x3bca6e
leaq 0xa3d7c(%rip), %rcx     # 0x3bcc41
movl $0x6c, %edx
callq 0x2dda0
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: xcalloc_impl
void *
xcalloc_impl(size_t nmemb, size_t size, const char *file, int line,
	     const char *func)
{
  void *ptr;

  xmalloc_init();
  assert(size > 0);

  if (xmalloc_fail_after == 0)
    {
      xmalloc_fail_after = -2;
#if 0
      printf("xcalloc: forced failure %s:%d: %s\n", file, line, func);
#endif
      return NULL;
    }
  else if (xmalloc_fail_after == -2)
    {
      printf("xcalloc: called after failure from %s:%d: %s\n",
	     file, line, func);
      assert(0);
    }
  else if (xmalloc_fail_after > 0)
    xmalloc_fail_after--;

  ptr = calloc(nmemb, size);
  if (ptr != NULL)
    hash_table_add(xmalloc_table, ptr, (int)(nmemb * size), file, line, func);
  return ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x318b08
testq %r15, %r15
je 0x318f60
movl 0x177978(%rip), %eax    # 0x490870
testl %eax, %eax
je 0x318f41
cmpl $-0x2, %eax
je 0x318f7f
testl %eax, %eax
jle 0x318f0d
decl %eax
movl %eax, 0x177963(%rip)    # 0x490870
movq %r12, %rdi
movq %r15, %rsi
callq 0x30ed0
testq %rax, %rax
je 0x318f4b
movq %rax, %r13
movq 0x177951(%rip), %rdi    # 0x490878
imull %r12d, %r15d
movq %rax, %rsi
movl %r15d, %edx
movq %r14, %rcx
movl %ebp, %r8d
movq %rbx, %r9
callq 0x318dc1
jmp 0x318f4e
movl $0xfffffffe, 0x177925(%rip) # imm = 0xFFFFFFFE
xorl %r13d, %r13d
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31d7b(%rip), %rdi     # 0x34ace2
leaq 0xa3b00(%rip), %rsi     # 0x3bca6e
leaq 0xa3b82(%rip), %rcx     # 0x3bcaf7
movl $0x117, %edx            # imm = 0x117
callq 0x2dda0
leaq 0xa3bb5(%rip), %rdi     # 0x3bcb3b
movq %r14, %rsi
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2d300
leaq 0x9f0fc(%rip), %rdi     # 0x3b8098
leaq 0xa3acb(%rip), %rsi     # 0x3bca6e
leaq 0xa3b4d(%rip), %rcx     # 0x3bcaf7
movl $0x125, %edx            # imm = 0x125
callq 0x2dda0
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: xfree_impl
void
xfree_impl(void *ptr, const char *file, int line, const char *func)
{
  /*LINTED*/(void)&file;
  /*LINTED*/(void)&line;
  /*LINTED*/(void)&func;
  xmalloc_init();

  if (ptr != NULL)
    hash_table_del(xmalloc_table, ptr);
  free(ptr);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x318b08
testq %rbx, %rbx
je 0x318fd1
movq 0x1778af(%rip), %rdi    # 0x490878
movq %rbx, %rsi
callq 0x318fda
movq %rbx, %rdi
popq %rbx
jmp 0x32018
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: hash_table_del
static void
hash_table_del(hashTable *tbl, void *ptr)
{
  int i;
  hashTableItem *item, *prev;

  i = hash_void_ptr(ptr);

  item = tbl->table[i];
  if (item == NULL)
    {
      printf("xfree: invalid ptr %p\n", ptr);
      abort();
    }
  prev = NULL;
  while (item->ptr != ptr)
    {
      prev = item;
      item = item->next;
    }
  if (item->ptr != ptr)
    {
      printf("xfree: invalid ptr %p\n", ptr);
      abort();
    }

  xmalloc_current -= item->bytes;
  xmalloc_current_blocks--;

  if (prev != NULL)
    {
      prev->next = item->next;
      free(item);
    }
  else
    {
      tbl->table[i] = item->next;
      free(item);
    }
}

// Assembly:
pushq %rax
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq %rsi, %r8
shrq %cl, %r8
xorl %edx, %r8d
addl %eax, %r8d
movzbl %r8b, %edx
addq $0x8, %rcx
addl $0x11, %eax
cmpq $0x40, %rcx
jne 0x318fe1
movq (%rdi), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0x319052
leaq (%rax,%rcx,8), %rax
cmpq %rsi, (%rdi)
je 0x319023
movq %rdi, %rcx
movq 0x28(%rdi), %rdi
cmpq %rsi, (%rdi)
jne 0x319015
jmp 0x319025
xorl %ecx, %ecx
movl 0x8(%rdi), %edx
leaq 0x177859(%rip), %rsi    # 0x490888
subl %edx, (%rsi)
leaq 0x177854(%rip), %rdx    # 0x49088c
decl (%rdx)
leaq 0x28(%rcx), %rdx
testq %rcx, %rcx
movq 0x28(%rdi), %rcx
cmoveq %rax, %rdx
movq %rcx, (%rdx)
popq %rax
jmp 0x32018
leaq 0xa3c37(%rip), %rdi     # 0x3bcc90
xorl %eax, %eax
callq 0x2d300
callq 0x2d820
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/tre/lib/xmalloc.c
// Function: xrealloc_impl
void *
xrealloc_impl(void *ptr, size_t new_size, const char *file, int line,
	      const char *func)
{
  void *new_ptr;

  xmalloc_init();
  assert(ptr != NULL);
  assert(new_size > 0);

  if (xmalloc_fail_after == 0)
    {
      xmalloc_fail_after = -2;
      return NULL;
    }
  else if (xmalloc_fail_after == -2)
    {
      printf("xrealloc: called after failure from %s:%d: %s\n",
	     file, line, func);
      assert(0);
    }
  else if (xmalloc_fail_after > 0)
    xmalloc_fail_after--;

  hash_table_del(xmalloc_table, ptr);
  new_ptr = realloc(ptr, new_size);
  if (new_ptr != NULL)
    {
      hash_table_add(xmalloc_table, new_ptr, (int)new_size, file, line, func);
    }
  return new_ptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x318b08
testq %r12, %r12
je 0x319109
testq %r15, %r15
je 0x319128
movl 0x1777d8(%rip), %eax    # 0x490870
testl %eax, %eax
je 0x3190f0
cmpl $-0x2, %eax
je 0x319147
testl %eax, %eax
jle 0x3190b1
decl %eax
movl %eax, 0x1777bf(%rip)    # 0x490870
movq 0x1777c0(%rip), %rdi    # 0x490878
movq %r12, %rsi
callq 0x318fda
movq %r12, %rdi
movq %r15, %rsi
callq 0x32068
testq %rax, %rax
je 0x3190fa
movq %rax, %r12
movq 0x17779e(%rip), %rdi    # 0x490878
movq %rax, %rsi
movl %r15d, %edx
movq %r14, %rcx
movl %ebp, %r8d
movq %rbx, %r9
callq 0x318dc1
jmp 0x3190fd
movl $0xfffffffe, 0x177776(%rip) # imm = 0xFFFFFFFE
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7d5f8(%rip), %rdi     # 0x396708
leaq 0xa3957(%rip), %rsi     # 0x3bca6e
leaq 0xa3a4b(%rip), %rcx     # 0x3bcb69
movl $0x144, %edx            # imm = 0x144
callq 0x2dda0
leaq 0xa3a7f(%rip), %rdi     # 0x3bcbae
leaq 0xa3938(%rip), %rsi     # 0x3bca6e
leaq 0xa3a2c(%rip), %rcx     # 0x3bcb69
movl $0x145, %edx            # imm = 0x145
callq 0x2dda0
leaq 0xa3a6d(%rip), %rdi     # 0x3bcbbb
movq %r14, %rsi
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2d300
leaq 0x9ef34(%rip), %rdi     # 0x3b8098
leaq 0xa3903(%rip), %rsi     # 0x3bca6e
leaq 0xa39f7(%rip), %rcx     # 0x3bcb69
movl $0x150, %edx            # imm = 0x150
callq 0x2dda0
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/zlib-1.3.0.1/compress.c
// Function: compress2
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
                      uLong sourceLen, int level) {
    z_stream stream;
    int err;
    const uInt max = (uInt)-1;
    uLong left;

    left = *destLen;
    *destLen = 0;

    stream.zalloc = (alloc_func)0;
    stream.zfree = (free_func)0;
    stream.opaque = (voidpf)0;

    err = deflateInit(&stream, level);
    if (err != Z_OK) return err;

    stream.next_out = dest;
    stream.avail_out = 0;
    stream.next_in = (z_const Bytef *)source;
    stream.avail_in = 0;

    do {
        if (stream.avail_out == 0) {
            stream.avail_out = left > (uLong)max ? max : (uInt)left;
            left -= stream.avail_out;
        }
        if (stream.avail_in == 0) {
            stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
            sourceLen -= stream.avail_in;
        }
        err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
    } while (err == Z_OK);

    *destLen = stream.total_out;
    deflateEnd(&stream);
    return err == Z_STREAM_END ? Z_OK : err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r13
movq (%rsi), %r12
xorl %ebp, %ebp
movq %rbp, (%rsi)
leaq 0x8(%rsp), %rdi
movq %rbp, 0x50(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rdi)
leaq 0x9210e(%rip), %rdx     # 0x3b750b
movl %r8d, %esi
movl $0x70, %ecx
callq 0x327744
testl %eax, %eax
jne 0x325499
movq %r15, %rax
leaq 0x8(%rsp), %r15
movq %r13, 0x18(%r15)
movl %ebp, 0x20(%r15)
movq %rax, (%r15)
movl %ebp, 0x8(%r15)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %ebp, %ebp
jne 0x325446
cmpq %r13, %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbq %r12, %rax
movl %eax, 0x28(%rsp)
subq %rax, %r12
cmpl $0x0, 0x10(%rsp)
jne 0x325460
cmpq %r13, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbq %r14, %rax
movl %eax, 0x10(%rsp)
subq %rax, %r14
xorl %esi, %esi
testq %r14, %r14
sete %sil
shll $0x2, %esi
movq %r15, %rdi
callq 0x3283d7
testl %eax, %eax
jne 0x32547e
movl 0x28(%rsp), %ebp
jmp 0x32542f
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
movq 0x28(%rdi), %rax
movq %rax, (%rbx)
callq 0x327a3e
xorl %eax, %eax
cmpl $0x1, %ebp
cmovnel %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/zlib-1.3.0.1/infback.c
// Function: inflateBackInit_
int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
                             unsigned char FAR *window, const char *version,
                             int stream_size) {
    struct inflate_state FAR *state;

    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
        stream_size != (int)(sizeof(z_stream)))
        return Z_VERSION_ERROR;
    if (strm == Z_NULL || window == Z_NULL ||
        windowBits < 8 || windowBits > 15)
        return Z_STREAM_ERROR;
    strm->msg = Z_NULL;                 /* in case we return an error */
    if (strm->zalloc == (alloc_func)0) {
#ifdef Z_SOLO
        return Z_STREAM_ERROR;
#else
        strm->zalloc = zcalloc;
        strm->opaque = (voidpf)0;
#endif
    }
    if (strm->zfree == (free_func)0)
#ifdef Z_SOLO
        return Z_STREAM_ERROR;
#else
    strm->zfree = zcfree;
#endif
    state = (struct inflate_state FAR *)ZALLOC(strm, 1,
                                               sizeof(struct inflate_state));
    if (state == Z_NULL) return Z_MEM_ERROR;
    Tracev((stderr, "inflate: allocated\n"));
    strm->state = (struct internal_state FAR *)state;
    state->dmax = 32768U;
    state->wbits = (uInt)windowBits;
    state->wsize = 1U << windowBits;
    state->window = window;
    state->wnext = 0;
    state->whave = 0;
    state->sane = 1;
    return Z_OK;
}

// Assembly:
movl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
testq %rcx, %rcx
je 0x32f079
cmpl $0x70, %r8d
jne 0x32f079
cmpb $0x31, (%rcx)
jne 0x32f079
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
leal -0x10(%r14), %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl $-0x8, %ecx
jb 0x32f06f
movq %rdi, %r15
testq %rdi, %rdi
je 0x32f06f
movq %rdx, %rbx
testq %rdx, %rdx
je 0x32f06f
movq $0x0, 0x30(%r15)
movq 0x40(%r15), %rax
testq %rax, %rax
jne 0x32f00d
leaq -0x24da(%rip), %rax     # 0x32cb27
movq %rax, 0x40(%r15)
movq $0x0, 0x50(%r15)
cmpq $0x0, 0x48(%r15)
jne 0x32f01f
leaq -0x24ea(%rip), %rcx     # 0x32cb31
movq %rcx, 0x48(%r15)
movq 0x50(%r15), %rdi
movl $0x1, %ebp
movl $0x1, %esi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq *%rax
testq %rax, %rax
je 0x32f06a
movq %rax, 0x38(%r15)
movl $0x8000, 0x1c(%rax)     # imm = 0x8000
movl %r14d, 0x38(%rax)
movl %r14d, %ecx
shll %cl, %ebp
movl %ebp, 0x3c(%rax)
movq %rbx, 0x48(%rax)
movq $0x0, 0x40(%rax)
movl $0x1, 0x1be8(%rax)
xorl %eax, %eax
jmp 0x32f06f
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/zlib-1.3.0.1/infback.c
// Function: inflateBackEnd
int ZEXPORT inflateBackEnd(z_streamp strm) {
    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
        return Z_STREAM_ERROR;
    ZFREE(strm, strm->state);
    strm->state = Z_NULL;
    Tracev((stderr, "inflate: end\n"));
    return Z_OK;
}

// Assembly:
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x32ffa1
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rsi
testq %rsi, %rsi
je 0x32ffa0
movq 0x48(%rbx), %rcx
testq %rcx, %rcx
je 0x32ffa0
movq 0x50(%rbx), %rdi
callq *%rcx
movq $0x0, 0x38(%rbx)
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/capacity.c
// Function: capacity_init
struct capacity_reader *
capacity_init(const char * key_id, const char * key_secret,
    const char * tname, const char * rname, struct serverpool * SP,
    struct dynamodb_request_queue * QW, struct dynamodb_request_queue * QR)
{
	struct capacity_reader * M;

	/* Allocate space for our state and copy in parameters. */
	if ((M = malloc(sizeof(struct capacity_reader))) == NULL)
		goto err0;
	if ((M->key_id = strdup(key_id)) == NULL)
		goto err1;
	if ((M->key_secret = strdup(key_secret)) == NULL)
		goto err2;
	M->tname = tname;
	M->rname = rname;
	M->SP = SP;
	M->QW = QW;
	M->QR = QR;

	/* Initialize internal state. */
	M->ddbreq = NULL;
	M->addrs[0] = M->addrs[1] = NULL;
	M->http_cookie = NULL;
	M->timer_cookie = NULL;
	M->done = 0;

	/* Start reading table metadata. */
	if (readmetadata(M))
		goto err3;

	/* Wait for response. */
	if (events_spin(&M->done))
		goto err0;

	/* Success! */
	return (M);

err3:
	insecure_memzero(M->key_secret, strlen(M->key_secret));
err2:
	free(M->key_id);
err1:
	free(M);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %r14
movl $0x68, %edi
callq 0x34d0
testq %rax, %rax
je 0x4805
movq %rax, %rbx
movq %r14, %rdi
callq 0x3610
movq %rax, (%rbx)
testq %rax, %rax
je 0x47fd
movq %rax, %r14
movq %rbp, %rdi
callq 0x3610
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x47f5
movq 0x40(%rsp), %rax
movq %r13, 0x10(%rbx)
movq %r12, 0x18(%rbx)
movq %r15, 0x20(%rbx)
movq (%rsp), %rcx
movq %rcx, 0x28(%rbx)
movq %rax, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x48(%rbx)
movups %xmm0, 0x54(%rbx)
movq %rbx, %rdi
callq 0x482b
testl %eax, %eax
je 0x4819
movq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x3180
leaq 0x18e99(%rip), %rcx     # 0x1d680
movq (%rcx), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *%rcx
movq (%rbx), %r14
movq %r14, %rdi
callq 0x3460
movq %rbx, %rdi
callq 0x3460
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x60, %rdi
callq 0x5b09
testl %eax, %eax
jne 0x4805
jmp 0x4807
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/capacity.c
// Function: readmetadata
static int
readmetadata(struct capacity_reader * M)
{

	/* Construct the DynamoDB request body. */
	if (asprintf(&M->ddbreq, "{\"TableName\":\"%s\"}", M->tname) == -1) {
		warnp("asprintf");
		goto err0;
	}

	/* Get an address. */
	if ((M->addrs[0] = serverpool_pick(M->SP)) == NULL)
		goto err1;

	/* Send the request. */
	if ((M->http_cookie = dynamodb_request(M->addrs, M->key_id,
	    M->key_secret, M->rname, "DescribeTable",
	    (const uint8_t *)M->ddbreq, strlen(M->ddbreq), 4096,
	    callback_readmetadata, M)) == NULL)
		goto err2;

	/* Success! */
	return (0);

err2:
	sock_addr_free(M->addrs[0]);
	M->addrs[0] = NULL;
err1:
	free(M->ddbreq);
	M->ddbreq = NULL;
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x38(%rdi), %rbx
movq 0x10(%rdi), %rdx
leaq 0xfae5(%rip), %rsi      # 0x14330
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9410
cmpl $-0x1, %eax
je 0x48fa
movq 0x20(%r14), %rdi
callq 0xe4f5
movq %rax, 0x40(%r14)
testq %rax, %rax
je 0x48e9
leaq 0x40(%r14), %r12
movq (%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%r14), %r13
movq 0x18(%r14), %rbp
movq 0x38(%r14), %r15
movq %r15, %rdi
callq 0x3180
leaq 0x10f(%rip), %r10       # 0x49a6
leaq 0xfaa5(%rip), %r8       # 0x14343
movq %r12, 0x8(%rsp)
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq %r15, %r9
pushq %r14
pushq %r10
pushq $0x1000                 # imm = 0x1000
pushq %rax
callq 0xc532
addq $0x20, %rsp
movq %rax, %rcx
movq %rax, 0x50(%r14)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x4930
movq 0x8(%rsp), %r14
movq (%r14), %rdi
callq 0xafaa
movq $0x0, (%r14)
movq (%rbx), %rdi
callq 0x3460
movq $0x0, (%rbx)
jmp 0x492b
callq 0x3040
cmpl $0x0, (%rax)
je 0x491d
movq %rax, %rbx
leaq 0xf7c1(%rip), %rdi      # 0x140cf
xorl %eax, %eax
callq 0xb938
movl $0x0, (%rbx)
jmp 0x492b
leaq 0xf7ab(%rip), %rdi      # 0x140cf
xorl %eax, %eax
callq 0xba57
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/capacity.c
// Function: capacity_free
void
capacity_free(struct capacity_reader * M)
{

	/* Behave consistently with free(NULL). */
	if (M == NULL)
		return;

	/* Cancel HTTP request and pending timer, if they exist. */
	if (M->http_cookie)
		http_request_cancel(M->http_cookie);
	if (M->timer_cookie)
		events_timer_cancel(M->timer_cookie);

	/* Free the AWS keys. */
	insecure_memzero(M->key_secret, strlen(M->key_secret));
	free(M->key_secret);
	free(M->key_id);

	/* Free our cookie. */
	free(M);
}

// Assembly:
testq %rdi, %rdi
je 0x49a5
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
testq %rdi, %rdi
je 0x4959
callq 0x6feb
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x4967
callq 0x6b3a
movq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x3180
leaq 0x18d06(%rip), %rcx     # 0x1d680
movq (%rcx), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *%rcx
movq 0x8(%rbx), %rdi
callq 0x3460
movq (%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3460
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/dispatch.c
// Function: dispatch_accept
struct dispatch_state *
dispatch_accept(struct dynamodb_request_queue * QW,
    struct dynamodb_request_queue * QR, const char * table, int s)
{
	struct dispatch_state * D;

	/* Allocate space for dispatcher state. */
	if ((D = malloc(sizeof(struct dispatch_state))) == NULL)
		goto err0;

	/* Initialize dispatcher. */
	D->QW = QW;
	D->QR = QR;
	D->table = table;
	D->ip_head = D->ip_tail = NULL;

	/* Accept a connection. */
	D->accepting = 1;
	if (network_accept(s, callback_accept, D) == NULL)
		goto err1;

	/* Success! */
	return (D);

err1:
	free(D);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0x48, %edi
callq 0x34d0
testq %rax, %rax
je 0x4d40
movq %rax, %rbx
movq %r12, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movl $0x1, 0x28(%rax)
leaq 0x25(%rip), %rsi        # 0x4d4e
movl %ebp, %edi
movq %rax, %rdx
callq 0x84bc
testq %rax, %rax
jne 0x4d42
movq %rbx, %rdi
callq 0x3460
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/dispatch.c
// Function: dispatch_done
int
dispatch_done(struct dispatch_state * D)
{

	/* Sanity check. */
	assert(D->accepting == 0);
	assert(D->read_cookie == NULL);
	assert(D->ip_head == NULL);
	assert(D->ip_tail == NULL);

	/* Free the buffered reader for the connection. */
	netbuf_read_free(D->readq);

	/* Free the buffered writer for the connection. */
	netbuf_write_free(D->writeq);

	/* Close the connection. */
	if (close(D->sconn))
		warnp("close");

	/* Free allocated memory. */
	free(D);

	/* Success! */
	return (0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x28(%rdi)
jne 0x4fdb
movq %rdi, %rbx
cmpq $0x0, 0x40(%rdi)
jne 0x4ffa
cmpq $0x0, 0x18(%rbx)
jne 0x5019
cmpq $0x0, 0x20(%rbx)
jne 0x5038
movq 0x38(%rbx), %rdi
callq 0x7f72
movq 0x30(%rbx), %rdi
callq 0x833b
movl 0x2c(%rbx), %edi
callq 0x3670
testl %eax, %eax
je 0x4fc9
callq 0x3040
cmpl $0x0, (%rax)
je 0x4fbb
movq %rax, %r14
leaq 0xf781(%rip), %rdi      # 0x1472c
xorl %eax, %eax
callq 0xb938
movl $0x0, (%r14)
jmp 0x4fc9
leaq 0xf76a(%rip), %rdi      # 0x1472c
xorl %eax, %eax
callq 0xba57
movq %rbx, %rdi
callq 0x3460
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xf493(%rip), %rdi      # 0x14475
leaq 0xf49e(%rip), %rsi      # 0x14487
leaq 0xf4a2(%rip), %rcx      # 0x14492
movl $0x1be, %edx            # imm = 0x1BE
callq 0x3210
leaq 0xf4bc(%rip), %rdi      # 0x144bd
leaq 0xf47f(%rip), %rsi      # 0x14487
leaq 0xf483(%rip), %rcx      # 0x14492
movl $0x1bf, %edx            # imm = 0x1BF
callq 0x3210
leaq 0xf4b4(%rip), %rdi      # 0x144d4
leaq 0xf460(%rip), %rsi      # 0x14487
leaq 0xf464(%rip), %rcx      # 0x14492
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x3210
leaq 0xf4a8(%rip), %rdi      # 0x144e7
leaq 0xf441(%rip), %rsi      # 0x14487
leaq 0xf445(%rip), %rcx      # 0x14492
movl $0x1c1, %edx            # imm = 0x1C1
callq 0x3210
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/dispatch.c
// Function: request_dequeue
static void
request_dequeue(struct dispatch_state * D, struct request * R)
{

	/* Sanity-check linked list. */
	assert(D == R->D);

	/* Free the contents of the kivaloo-dynamodb-kv request. */
	proto_dynamodb_kv_request_free(&R->R);

	/* Free the DynamoDB request body we constructed. */
	free(R->body);

	/* Remove from the linked list. */
	if (D->ip_head == R) {
		assert(R->prev == NULL);
		D->ip_head = R->next;
	} else {
		assert(R->prev != NULL);
		R->prev->next = R->next;
	}
	if (D->ip_tail == R) {
		assert(R->next == NULL);
		D->ip_tail = R->prev;
	} else {
		assert(R->next != NULL);
		R->next->prev = R->prev;
	}

	/* Free the request structure. */
	free(R);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq %rdi, (%rsi)
jne 0x53bd
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rsi), %rdi
callq 0xdd97
movq 0x50(%rbx), %rdi
callq 0x3460
movq 0x8(%rbx), %rax
cmpq %rbx, 0x18(%r14)
je 0x5377
testq %rax, %rax
je 0x53dc
movq 0x10(%rbx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x538a
testq %rax, %rax
jne 0x541a
movq 0x10(%rbx), %rcx
movq %rcx, 0x18(%r14)
xorl %eax, %eax
cmpq %rbx, 0x20(%r14)
je 0x539e
testq %rcx, %rcx
je 0x53fb
addq $0x8, %rcx
movq %rcx, %r14
jmp 0x53ab
testq %rcx, %rcx
jne 0x5439
addq $0x20, %r14
movq %rax, (%r14)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3460
leaq 0xf1dc(%rip), %rdi      # 0x145a0
leaq 0xf0bc(%rip), %rsi      # 0x14487
leaq 0xf1d8(%rip), %rcx      # 0x145aa
movl $0x3a, %edx
callq 0x3210
leaq 0xf217(%rip), %rdi      # 0x145fa
leaq 0xf09d(%rip), %rsi      # 0x14487
leaq 0xf1b9(%rip), %rcx      # 0x145aa
movl $0x47, %edx
callq 0x3210
leaq 0xf218(%rip), %rdi      # 0x1461a
leaq 0xf07e(%rip), %rsi      # 0x14487
leaq 0xf19a(%rip), %rcx      # 0x145aa
movl $0x4e, %edx
callq 0x3210
leaq 0xf1c9(%rip), %rdi      # 0x145ea
leaq 0xf05f(%rip), %rsi      # 0x14487
leaq 0xf17b(%rip), %rcx      # 0x145aa
movl $0x44, %edx
callq 0x3210
leaq 0xf1ca(%rip), %rdi      # 0x1460a
leaq 0xf040(%rip), %rsi      # 0x14487
leaq 0xf15c(%rip), %rcx      # 0x145aa
movl $0x4b, %edx
callq 0x3210
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/dynamodb-kv/dispatch.c
// Function: callback_response
static int
callback_response(void * cookie, struct http_response * res, const char * err)
{
	struct request * R = cookie;
	struct dispatch_state * D = R->D;
	uint8_t * vbuf;
	uint32_t vlen;
	int status;

	/* Did we succeed? */
	switch (res->status) {
	case 200:
		status = 0;
		break;
	case 400:
		if (strcmp(err, "ConditionalCheckFailedException") == 0)
			status = 2;
		else
			status = 1;
		break;
	default:
		status = 1;
		break;
	}

	/* Send appropriate response back to the client. */
	switch (R->R.type) {
	case PROTO_DDBKV_PUT:
	case PROTO_DDBKV_ICAS:
	case PROTO_DDBKV_CREATE:
	case PROTO_DDBKV_DELETE:	/* Has same response as PUT. */
		if (proto_dynamodb_kv_response_put(D->writeq, R->R.ID,
		    status))
			goto err1;
		break;
	case PROTO_DDBKV_GET:
	case PROTO_DDBKV_GETC:		/* Has same response as GET. */
		/* Extract the value. */
		if (dynamodb_kv_extractv(res->body, res->bodylen,
		    &vbuf, &vlen))
			goto err1;

		/* A success without data is a status of 2. */
		if ((status == 0) && (vbuf == NULL))
			status = 2;

		/* Send a response back. */
		if (proto_dynamodb_kv_response_get(D->writeq, R->R.ID,
		    status, vlen, vbuf))
			goto err2;

		/* Free the value. */
		free(vbuf);
		break;
	}

	/* Free the response body buffer. */
	free(res->body);

	/* Remove this request from the in-progress list. */
	request_dequeue(D, R);

	/* Success! */
	return (0);

err2:
	free(vbuf);
err1:
	free(res->body);
	request_dequeue(D, R);

	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r14
movl (%rsi), %eax
xorl %ebp, %ebp
cmpl $0xc8, %eax
je 0x54a2
cmpl $0x190, %eax            # imm = 0x190
jne 0x54aa
leaq 0xf1d9(%rip), %rsi      # 0x14661
movq %rdx, %rdi
callq 0x3520
xorl %r13d, %r13d
cmpl $0x1, %eax
movl $0x0, %r12d
adcl $0x1, %r12d
jmp 0x54b3
movb $0x1, %r13b
xorl %r12d, %r12d
jmp 0x54b3
movl $0x1, %r12d
xorl %r13d, %r13d
movl $0xfffeff00, %eax       # imm = 0xFFFEFF00
addl 0x20(%rbx), %eax
cmpl $0x20, %eax
ja 0x5550
movabsq $0x100000007, %rcx      # imm = 0x100000007
btq %rax, %rcx
jae 0x54ea
movq 0x30(%r14), %rdi
movq 0x18(%rbx), %rsi
movl %r12d, %edx
callq 0xddcf
testl %eax, %eax
jne 0x554b
jmp 0x5550
movl $0x30000, %ecx          # imm = 0x30000
btq %rax, %rcx
jae 0x5550
movq 0x18(%r15), %rsi
movq 0x20(%r15), %rdi
leaq 0x10(%rsp), %rdx
leaq 0xc(%rsp), %rcx
callq 0xc356
testl %eax, %eax
jne 0x554b
movq 0x10(%rsp), %r8
testq %r8, %r8
movl $0x2, %edx
cmovnel %r12d, %edx
testb %r13b, %r13b
cmovel %r12d, %edx
movq 0x30(%r14), %rdi
movq 0x18(%rbx), %rsi
movl 0xc(%rsp), %ecx
callq 0xde3b
movl %eax, %r12d
movq 0x10(%rsp), %rdi
callq 0x3460
testl %r12d, %r12d
je 0x5550
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x20(%r15), %rdi
callq 0x3460
movq %r14, %rdi
movq %rbx, %rsi
callq 0x533d
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../lib/proto_dynamodb_kv/proto_dynamodb_kv_server.c
// Function: proto_dynamodb_kv_response_data
int
proto_dynamodb_kv_response_data(struct netbuf_write * Q, uint64_t ID,
    int status, uint32_t len, const uint8_t * buf)
{
	uint8_t * wbuf;
	size_t rlen;

	/* Sanity check. */
	assert((status == 0) || (status == 1) || (status == 2));

	/* Compute the response length. */
	rlen = 4 + ((status == 0) ? len + 4 : 0);

	/* Get a packet data buffer. */
	if ((wbuf = wire_writepacket_getbuf(Q, ID, rlen)) == NULL)
		goto err0;

	/* Write the packet data. */
	be32enc(&wbuf[0], (uint32_t)status);
	if (status == 0) {
		be32enc(&wbuf[4], len);
		memcpy(&wbuf[8], buf, len);
	}

	/* Finish the packet. */
	if (wire_writepacket_done(Q, wbuf, rlen))
		goto err0;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x3, %edx
jae 0xdecf
movq %r8, %r14
movl %ecx, %r12d
movl %edx, %ebp
movq %rdi, %rbx
leal 0x8(%r12), %eax
testl %edx, %edx
movl $0x4, %r15d
cmovel %eax, %r15d
movq %r15, %rdx
callq 0xed68
testq %rax, %rax
je 0xdeb7
movq %rax, %r13
movb %bpl, 0x3(%rax)
movb $0x0, 0x2(%rax)
movw $0x0, (%rax)
testl %ebp, %ebp
jne 0xdea5
movl %r12d, %edx
bswapl %r12d
movl %r12d, 0x4(%r13)
movq %r13, %rdi
addq $0x8, %rdi
movq %r14, %rsi
callq 0x3290
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xee36
testl %eax, %eax
je 0xdebe
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xdec0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x807f(%rip), %rdi      # 0x15f55
leaq 0x80a8(%rip), %rsi      # 0x15f85
leaq 0x8121(%rip), %rcx      # 0x16005
movl $0xe8, %edx
callq 0x3210
nop