LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/str.c
// Function: strAppendPath
StringView strAppendPath(StringView path, StringView filename,
                         Allocator *a)
{
  const size_t new_path_length =
    sSizeAdd(sSizeAdd(path.length, 1), filename.length);

  char *raw_string = allocate(a, sSizeAdd(new_path_length, 1));
  memcpy(raw_string, path.content, path.length);
  raw_string[path.length] = '/';
  memcpy(&raw_string[path.length + 1], filename.content, filename.length);
  raw_string[new_path_length] = '\0';

  return (StringView){
    .content = raw_string,
    .length = new_path_length,
    .is_terminated = true,
  };
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r13
movq %rdi, %rbx
movq 0x38(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdi
callq 0x8924
movq 0x50(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x8924
movq %rax, %r12
movl $0x1, %esi
movq %rax, %rdi
callq 0x8924
movq %r13, %rdi
movq %rax, %rsi
callq 0x284c
movq %rax, %r13
movq 0x30(%rsp), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x2280
leaq (%r14,%r13), %rdi
incq %rdi
movb $0x2f, -0x1(%rdi)
movq 0x48(%rsp), %rsi
movq %r15, %rdx
callq 0x2280
movb $0x0, (%r13,%r12)
movq %r13, (%rbx)
movq %r12, 0x8(%rbx)
movb $0x1, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/string-table.c
// Function: strTableNew
StringTable *strTableNew(CR_Region *region)
{
  StringTable *table = CR_RegionAlloc(region, sizeof(*table));
  table->region = region;
  table->associations = 0;
  table->capacity = 32; /* A small initial value allows the test suite to
                           cover table resizing. */

  for(size_t index = 0; index < sizeof(table->secret_key); index++)
  {
    table->secret_key[index] = sRand() % UINT8_MAX;
  }

  const size_t array_size =
    sSizeMul(table->capacity, sizeof(*table->buckets));
  table->buckets = sMalloc(array_size);
  CR_RegionAttach(table->region, releaseStringTable, table);
  memset(table->buckets, 0, array_size);

  return table;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x30, %esi
callq 0xdd40
movq %rax, %rbx
movq %r14, (%rax)
movq $0x0, 0x18(%rax)
movq $0x20, 0x10(%rax)
movl $0x20, %r14d
callq 0x9cf8
cltq
imulq $-0x7f7f7f7f, %rax, %rcx # imm = 0x80808081
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
shrl $0x7, %ecx
addl %edx, %ecx
addl %eax, %ecx
movb %cl, (%rbx,%r14)
incq %r14
cmpq $0x30, %r14
jne 0xb3a1
movq 0x10(%rbx), %rdi
movl $0x8, %esi
callq 0x893c
movq %rax, %r14
movq %rax, %rdi
callq 0x89b0
movq %rax, 0x8(%rbx)
movq (%rbx), %rdi
leaq 0x21(%rip), %rsi        # 0xb416
movq %rbx, %rdx
callq 0xde19
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x2190
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/string-table.c
// Function: strTableMap
void strTableMap(StringTable *table, StringView key, void *data)
{
  if(table->associations == table->capacity)
  {
    doubleTableCapacity(table);
  }

  Bucket *bucket = CR_RegionAlloc(table->region, sizeof(*bucket));
  bucket->hash =
    siphash((const uint8_t *)key.content, key.length, table->secret_key);
  strSet(&bucket->key, key);
  bucket->data = data;

  /* Prepend the bucket to the bucket slot in the bucket array. */
  const size_t bucket_id = bucket->hash % table->capacity;
  bucket->next = table->buckets[bucket_id];
  table->buckets[bucket_id] = bucket;

  table->associations++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x50(%rsp), %rbp
movq 0x10(%rdi), %rdi
cmpq %rdi, 0x18(%rbx)
jne 0xb4cc
movl $0x2, %esi
callq 0x893c
movq %rax, %r15
movl $0x8, %esi
movq %rax, %rdi
callq 0x893c
movq %rax, %r13
movq %rax, %rdi
callq 0x89b0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x2190
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0xb4bb
xorl %esi, %esi
movq 0x8(%rbx), %rax
movq (%rax,%rsi,8), %rdi
testq %rdi, %rdi
je 0xb4b3
movq (%rdi), %rax
movq 0x28(%rdi), %r8
xorl %edx, %edx
divq %r15
movq (%r12,%rdx,8), %rax
movq %rax, 0x28(%rdi)
movq %rdi, (%r12,%rdx,8)
movq %r8, %rdi
testq %r8, %r8
jne 0xb493
incq %rsi
cmpq %rcx, %rsi
jne 0xb486
movq 0x8(%rbx), %rdi
callq 0x2040
movq %r12, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movq (%rbx), %rdi
movl $0x30, %esi
callq 0xdd40
movq %rax, %r15
movq (%rbp), %rdi
movq 0x8(%rbp), %rsi
leaq 0x20(%rbx), %rdx
callq 0xd818
movq %rax, (%r15)
leaq 0x8(%r15), %rdi
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
callq 0xaff1
movq %r14, 0x20(%r15)
movq (%r15), %rax
xorl %edx, %edx
divq 0x10(%rbx)
movq 0x8(%rbx), %rax
movq (%rax,%rdx,8), %rcx
movq %rcx, 0x28(%r15)
movq %r15, (%rax,%rdx,8)
incq 0x18(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/string-table.c
// Function: strTableGet
void *strTableGet(const StringTable *table, StringView key)
{
  const size_t hash =
    siphash((const uint8_t *)key.content, key.length, table->secret_key);
  const size_t bucket_id = hash % table->capacity;

  for(const Bucket *bucket = table->buckets[bucket_id]; bucket != NULL;
      bucket = bucket->next)
  {
    if(strIsEqual(key, bucket->key))
    {
      return bucket->data;
    }
  }

  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %r14
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0x20(%r14), %rdx
callq 0xd818
xorl %ebx, %ebx
xorl %edx, %edx
divq 0x10(%r14)
movq 0x8(%r14), %rax
movq (%rax,%rdx,8), %r14
testq %r14, %r14
je 0xb5b1
leaq 0x50(%rsp), %r15
xorl %ebx, %ebx
movq 0x18(%r14), %rax
movq %rax, 0x28(%rsp)
movups 0x8(%r14), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0xb126
testb %al, %al
jne 0xb5ad
movq 0x28(%r14), %r14
testq %r14, %r14
jne 0xb575
jmp 0xb5b1
movq 0x20(%r14), %rbx
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/BLAKE2/blake2b-optimized.h
// Function: blake2b_init
int blake2b_init( blake2b_state *S, size_t outlen )
{
  blake2b_param P[1];

  if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;

  P->digest_length = (uint8_t)outlen;
  P->key_length    = 0;
  P->fanout        = 1;
  P->depth         = 1;
  store32( &P->leaf_length, 0 );
  store32( &P->node_offset, 0 );
  store32( &P->xof_length, 0 );
  P->node_depth    = 0;
  P->inner_length  = 0;
  memset( P->reserved, 0, sizeof( P->reserved ) );
  memset( P->salt,     0, sizeof( P->salt ) );
  memset( P->personal, 0, sizeof( P->personal ) );

  return blake2b_init_param( S, P );
}

// Assembly:
leaq -0x41(%rsi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $-0x40, %rcx
jb 0xb649
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movb %bl, (%rsp)
movw $0x100, 0x1(%rsp)       # imm = 0x100
movb $0x1, 0x3(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rsp)
movups %xmm0, 0x14(%rsp)
movups %xmm0, 0x24(%rsp)
movups %xmm0, 0x30(%rsp)
xorl %r15d, %r15d
movl $0xf8, %edx
xorl %esi, %esi
callq 0x2190
leaq 0x3a42(%rip), %rax      # 0xf060
movaps (%rsp,%r15), %xmm0
xorps (%r15,%rax), %xmm0
movups %xmm0, (%r14,%r15)
addq $0x10, %r15
cmpq $0x40, %r15
jne 0xb61e
movq %rbx, 0xe8(%r14)
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/BLAKE2/blake2b-optimized.h
// Function: blake2b_update
int blake2b_update( blake2b_state *S, const void *pin, size_t inlen )
{
  const unsigned char * in = (const unsigned char *)pin;
  if( inlen > 0 )
  {
    size_t left = S->buflen;
    size_t fill = BLAKE2B_BLOCKBYTES - left;
    if( inlen > fill )
    {
      S->buflen = 0;
      memcpy( S->buf + left, in, fill ); /* Fill buffer */
      blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
      blake2b_compress( S, S->buf ); /* Compress */
      in += fill; inlen -= fill;
      while(inlen > BLAKE2B_BLOCKBYTES) {
        blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
        blake2b_compress( S, in );
        in += BLAKE2B_BLOCKBYTES;
        inlen -= BLAKE2B_BLOCKBYTES;
      }
    }
    memcpy( S->buf + S->buflen, in, inlen );
    S->buflen += inlen;
  }
  return 0;
}

// Assembly:
testq %rdx, %rdx
je 0xb725
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0xe0(%rdi), %rax
movl $0x80, %r12d
subq %rax, %r12
movq %rdx, %r15
subq %r12, %r15
jbe 0xb6f8
movq $0x0, 0xe0(%rbx)
leaq 0x60(%rbx), %r13
leaq (%rbx,%rax), %rdi
addq $0x60, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2280
movq 0x40(%rbx), %rax
subq $-0x80, %rax
movq %rax, 0x40(%rbx)
sbbq $-0x1, 0x48(%rbx)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb728
addq %r12, %r14
cmpq $0x81, %r15
jb 0xb6fb
movl $0x80, %r12d
movq 0x40(%rbx), %rax
leaq (%rax,%r12), %rcx
movq %rcx, 0x40(%rbx)
cmpq $-0x80, %rax
sbbq $-0x1, 0x48(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb728
addq %r12, %r14
addq $-0x80, %r15
cmpq %r12, %r15
ja 0xb6ca
jmp 0xb6fb
movq %rdx, %r15
movq 0xe0(%rbx), %rax
leaq (%rbx,%rax), %rdi
addq $0x60, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2280
addq %r15, 0xe0(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/BLAKE2/blake2b-optimized.h
// Function: blake2b_final
int blake2b_final( blake2b_state *S, void *out, size_t outlen )
{
  if( out == NULL || outlen < S->outlen )
    return -1;

  if( blake2b_is_lastblock( S ) )
    return -1;

  blake2b_increment_counter( S, S->buflen );
  blake2b_set_lastblock( S );
  memset( S->buf + S->buflen, 0, BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
  blake2b_compress( S, S->buf );

  memcpy( out, &S->h[0], S->outlen );
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0xd80a
movq %rdi, %rbx
cmpq %rdx, 0xe8(%rdi)
ja 0xd80a
cmpq $0x0, 0x50(%rbx)
jne 0xd80a
movq %rsi, %r14
movq 0xe0(%rbx), %rax
addq %rax, 0x40(%rbx)
adcq $0x0, 0x48(%rbx)
cmpb $0x0, 0xf0(%rbx)
je 0xd7c8
movq $-0x1, 0x58(%rbx)
movq $-0x1, 0x50(%rbx)
leaq 0x60(%rbx), %r15
leaq (%rbx,%rax), %rdi
addq $0x60, %rdi
movl $0x80, %edx
subq %rax, %rdx
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x2190
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb728
movq 0xe8(%rbx), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2280
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/alloc-growable.c
// Function: CR_RegionAllocGrowable
void *CR_RegionAllocGrowable(CR_Region *r, size_t size)
{
  if(size == 0)
  {
    CR_ExitFailure("unable to allocate 0 bytes");
  }

  CR_StaticAssert(sizeof(Header) % 8 == 0);
  const size_t chunk_size = CR_SafeAdd(sizeof(Header), size);

  void **attached_pointer = CR_RegionAlloc(r, sizeof *attached_pointer);

  Header *header = malloc(chunk_size);
  if(header == NULL)
  {
    CR_ExitFailure("failed to allocate %zu bytes", chunk_size);
  }

  *attached_pointer = header;
  header->attached_pointer = attached_pointer;
  header->capacity = size;

  CR_RegionAttach(r, freeAttachedPointer, attached_pointer);

  ASAN_POISON_MEMORY_REGION(header, sizeof(Header));
  return header + 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rsi, %rsi
je 0xd9ff
movq %rsi, %r14
movq %rdi, %rbx
movl $0x10, %edi
callq 0xdf10
movq %rax, %r15
movl $0x8, %esi
movq %rbx, %rdi
callq 0xdd40
movq %rax, %r12
movq %r15, %rdi
callq 0x22d0
testq %rax, %rax
je 0xda0d
movq %rax, %r13
movq %rax, (%r12)
movq %r12, (%rax)
movq %r14, 0x8(%rax)
leaq 0x3b(%rip), %rsi        # 0xda1e
movq %rbx, %rdi
movq %r12, %rdx
callq 0xde19
addq $0x10, %r13
movq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x5fe(%rip), %rdi       # 0xe004
xorl %eax, %eax
callq 0x3dc4
leaq 0x61a(%rip), %rdi       # 0xe02e
movq %r15, %rsi
xorl %eax, %eax
callq 0x3dc4
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/alloc-growable.c
// Function: CR_EnsureCapacity
void *CR_EnsureCapacity(void *ptr, size_t size)
{
  if(size == 0)
  {
    CR_ExitFailure("unable to allocate 0 bytes");
  }
  else if(ptr == NULL)
  {
    return CR_RegionAllocGrowable(CR_GetGlobalRegion(), size);
  }

  Header *header = (Header *)ptr - 1;
  ASAN_UNPOISON_MEMORY_REGION(header, sizeof(Header));
  if(size <= header->capacity)
  {
    ASAN_POISON_MEMORY_REGION(header, sizeof(Header));
    return ptr;
  }

  const size_t chunk_size = CR_SafeAdd(sizeof(Header), size);
  Header *reallocated_header = realloc(header, chunk_size);
  if(reallocated_header == NULL)
  {
    CR_ExitFailure("failed to reallocate %zu bytes", chunk_size);
  }

  *reallocated_header->attached_pointer = reallocated_header;
  reallocated_header->capacity = size;

  ASAN_POISON_MEMORY_REGION(reallocated_header, sizeof(Header));
  return reallocated_header + 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0xda94
movq %rsi, %rbx
movq %rdi, %r14
testq %rdi, %rdi
je 0xda7f
cmpq %rbx, -0x8(%r14)
jae 0xda76
addq $-0x10, %r14
movl $0x10, %edi
movq %rbx, %rsi
callq 0xdf10
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x2340
testq %rax, %rax
je 0xdaa2
movq %rax, %r14
movq (%rax), %rax
movq %r14, (%rax)
movq %rbx, 0x8(%r14)
addq $0x10, %r14
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
callq 0xdab4
movq %rax, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xd990
leaq 0x569(%rip), %rdi       # 0xe004
xorl %eax, %eax
callq 0x3dc4
leaq 0x1617(%rip), %rdi      # 0xf0c0
movq %r15, %rsi
xorl %eax, %eax
callq 0x3dc4
nop
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/mempool.c
// Function: CR_MempoolNew
CR_Mempool *CR_MempoolNew(CR_Region *r, size_t object_size,
                          CR_FailableDestructor *explicit_destructor,
                          CR_ReleaseCallback *implicit_destructor)
{
  if(object_size == 0)
  {
    CR_ExitFailure("unable to create memory pool for allocating zero size objects");
  }
  CR_StaticAssert(sizeof(Header) % 8 == 0);

  CR_Mempool *mp = CR_RegionAlloc(r, sizeof *mp);
  mp->r = r;
  mp->explicit_destructor = explicit_destructor;
  mp->implicit_destructor = implicit_destructor;
  mp->chunk_size = CR_SafeAdd(sizeof(Header), object_size);
  mp->allocated_chunks = NULL;
  mp->released_chunks = NULL;
  CR_RegionAttach(r, destroyObjects, mp);

  return mp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rsi, %rsi
je 0xdb42
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movl $0x30, %esi
callq 0xdd40
movq %rax, %r13
movq %rbx, (%rax)
movq %r12, 0x8(%rax)
movq %r15, 0x10(%rax)
movl $0x20, %edi
movq %r14, %rsi
callq 0xdf10
movq %rax, 0x18(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r13)
leaq 0x26(%rip), %rsi        # 0xdb50
movq %rbx, %rdi
movq %r13, %rdx
callq 0xde19
movq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1596(%rip), %rdi      # 0xf0df
xorl %eax, %eax
callq 0x3dc4
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/mempool.c
// Function: CR_MempoolAlloc
void *CR_MempoolAlloc(CR_Mempool *mp)
{
  Header *header = getAvailableChunk(mp);

  header->destructor_state = DS_disabled;
  header->mp = mp;
  header->prev = NULL;

  /* Prepend header to the mempools allocated chunk list. */
  header->next = mp->allocated_chunks;
  mp->allocated_chunks = header;

  if(header->next != NULL)
  {
    ASAN_UNPOISON_MEMORY_REGION(header->next, sizeof(Header));
    header->next->prev = header;
    ASAN_POISON_MEMORY_REGION(header->next, sizeof(Header));
  }

  ASAN_POISON_MEMORY_REGION(header, sizeof(Header));
  return header + 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0xdba6
movq 0x18(%rax), %rcx
movq %rcx, 0x28(%rbx)
testq %rcx, %rcx
je 0xdbb2
movq $0x0, 0x10(%rcx)
jmp 0xdbb2
movq (%rbx), %rdi
movq 0x18(%rbx), %rsi
callq 0xdd40
movl $0x0, (%rax)
movq %rbx, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq 0x20(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x20(%rbx)
testq %rcx, %rcx
je 0xdbd9
movq %rax, 0x10(%rcx)
addq $0x20, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/region.c
// Function: checkedMalloc
static void *checkedMalloc(size_t size)
{
  void *data = malloc(size);
  if(data == NULL)
  {
    CR_ExitFailure("failed to allocate %zu bytes", size);
  }

  return data;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x22d0
testq %rax, %rax
je 0xdd2f
popq %rbx
retq
leaq 0x2f8(%rip), %rdi       # 0xe02e
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3dc4
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/region.c
// Function: allocFromChunk
static void *allocFromChunk(CR_Region *r, Chunk *chunk, size_t size)
{
  if(size == 0)
  {
    CR_ExitFailure("unable to allocate 0 bytes");
  }

  if(size <= chunk->capacity - chunk->bytes_used)
  {
    return popBytesFromChunk(chunk, size);
  }
  else if(size < chunk->next_chunk_size - sizeof(ChunkList))
  {
    ChunkList *element = checkedMalloc(chunk->next_chunk_size);

    chunk->chunk = (unsigned char *)element;
    chunk->bytes_used = sizeof *element;
    chunk->capacity = chunk->next_chunk_size;

    element->next = r->chunk_list;
    r->chunk_list = element;

    chunk->next_chunk_size = CR_SafeMultiply(chunk->next_chunk_size, 2);

    return popBytesFromChunk(chunk, size);
  }
  else
  {
    ChunkList *element = checkedMalloc(CR_SafeAdd(sizeof(ChunkList), size));

    element->next = r->chunk_list;
    r->chunk_list = element;

    return element + 1;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdx, %rdx
je 0xde0b
movq %rdx, %rbx
movq %rsi, %r14
movq 0x8(%rsi), %rcx
movq 0x10(%rsi), %rax
subq %rcx, %rax
cmpq %rdx, %rax
jae 0xddd2
movq %rdi, %r15
movq 0x18(%r14), %rdi
leaq -0x8(%rdi), %rax
cmpq %rbx, %rax
jbe 0xdde1
callq 0xdd1f
movq %rax, (%r14)
movq $0x8, 0x8(%r14)
movq 0x18(%r14), %rdi
movq %rdi, 0x10(%r14)
movq 0x40(%r15), %rcx
movq %rcx, (%rax)
movq %rax, 0x40(%r15)
movl $0x2, %esi
callq 0xdf28
movq %rax, 0x18(%r14)
movq 0x8(%r14), %rcx
movq (%r14), %rax
addq %rcx, %rax
addq %rcx, %rbx
movq %rbx, 0x8(%r14)
jmp 0xde05
movl $0x8, %edi
movq %rbx, %rsi
callq 0xdf10
movq %rax, %rdi
callq 0xdd1f
movq 0x40(%r15), %rcx
movq %rcx, (%rax)
movq %rax, 0x40(%r15)
addq $0x8, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1f2(%rip), %rdi       # 0xe004
xorl %eax, %eax
callq 0x3dc4
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/region.c
// Function: CR_RegionAttach
void CR_RegionAttach(CR_Region *r, CR_ReleaseCallback *callback, void *data)
{
  /* Store the callback inside the region as the current pending
     callback. This is required in case the following allocation
     fails and terminates the program. */
  r->pending_callback = callback;
  r->pending_callback_data = data;

  CallbackList *element = allocFromChunkWithPadding(r, sizeof *element);

  r->pending_callback = NULL;
  r->pending_callback_data = NULL;

  /* Prepend the callback to the regions callback-list. */
  element->callback = callback;
  element->data = data;

  element->next = r->callback_list;
  r->callback_list = element;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, 0x50(%rdi)
movq %rdx, 0x58(%rdi)
movl $0x18, %edi
xorl %esi, %esi
callq 0xdf10
movq %r15, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xdd69
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r15)
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
movq 0x48(%r15), %rcx
movq %rcx, 0x10(%rax)
movq %rax, 0x48(%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/third-party/CRegion/region.c
// Function: CR_RegionRelease
void CR_RegionRelease(CR_Region *r)
{
  /* Call all attached callbacks. */
  if(r->pending_callback != NULL)
  {
    r->pending_callback(r->pending_callback_data);
  }
  for(CallbackList *element = r->callback_list;
      element != NULL; element = element->next)
  {
    element->callback(element->data);
  }

  /* Detach the region from the region-list. */
  if(r->prev != NULL)
  {
    r->prev->next = r->next;
  }
  if(r->next != NULL)
  {
    r->next->prev = r->prev;
  }
  if(r == region_list)
  {
    region_list = region_list->next;
  }

  /* Free all chunks associated with the region. */
  ChunkList *element = r->chunk_list;
  while(element != NULL)
  {
    ChunkList *next = element->next;
    free(element);
    element = next;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rdi), %rax
testq %rax, %rax
je 0xde80
movq 0x58(%rbx), %rdi
callq *%rax
movq 0x48(%rbx), %r14
testq %r14, %r14
je 0xde96
movq 0x8(%r14), %rdi
callq *(%r14)
movq 0x10(%r14), %r14
jmp 0xde84
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0xdea7
movq 0x68(%rbx), %rcx
movq %rcx, 0x68(%rax)
movq 0x68(%rbx), %rcx
testq %rcx, %rcx
je 0xdeb4
movq %rax, 0x60(%rcx)
movq 0x53cd(%rip), %rax      # 0x13288
cmpq %rbx, %rax
jne 0xdecb
movq 0x68(%rax), %rax
movq %rax, 0x53bd(%rip)      # 0x13288
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0xdee4
movq (%rdi), %rbx
callq 0x2040
movq %rbx, %rdi
testq %rbx, %rbx
jne 0xded4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: readsetCreate
Readset *readsetCreate (Moshset *ms, int n) /* create empty - n is used to initialise arrays */
{
  Readset *rs = new0 (1, Readset) ;
  rs->ms = ms ;
  rs->reads = arrayCreate (n, Read) ;
  arrayp(rs->reads,0,Read)->nHit = 0 ; /* burn first read, so can use 0 as null */
  /* create inv, invSpace in invBuild() */
  return rs ;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x6cbc
movq %rax, %r15
movq %r14, (%rax)
movl %ebx, %edi
movl $0x48, %esi
callq 0x6434
movq %rax, 0x8(%r15)
movq %rax, %rdi
xorl %esi, %esi
callq 0x66ef
movl $0x0, 0x4(%rax)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: readsetDestroy
void readsetDestroy (Readset *rs)
{
  int i, n = arrayMax(rs->reads) ; Read *r = arrp(rs->reads,0,Read) ;
  for (i = 0 ; i < n ; ++i, ++r) if (r->nHit) { free(r->hit) ; free(r->dx) ; }
  arrayDestroy (rs->reads) ;
  if (rs->inv) { free (rs->inv) ; free (rs->invSpace) ; }
  free (rs) ;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movl 0x18(%rax), %ebp
testl %ebp, %ebp
jle 0x1e8f
movq 0x8(%rax), %r14
addq $0x10, %r14
cmpl $0x0, -0xc(%r14)
je 0x1e87
movq -0x8(%r14), %rdi
callq 0x1040
movq (%r14), %rdi
callq 0x1040
addq $0x48, %r14
decl %ebp
jne 0x1e6f
movq 0x8(%rbx), %rdi
callq 0x658d
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x1eaf
callq 0x1040
movq 0x20(%rbx), %rdi
callq 0x1040
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: readsetWrite
void readsetWrite (Readset *rs, char *root)
{
  FILE *f ;
  if (!(f = fopenTag (root, "mosh", "w"))) die ("can't open file %s.mosh", root) ;
  moshsetWrite (rs->ms, f) ; fclose (f) ;
  if (!(f = fopenTag (root, "readset", "w"))) die ("can't open file %s.readset", root) ;
  if (fwrite("RSMSHv2",8,1,f) != 1) die ("failed to write readset header") ;
  if (fwrite (&rs->totHit,sizeof(U64),1,f) != 1) die ("failed to write totHit") ;
  arrayWrite (rs->reads, f) ;
  int i, n ; Read *r = arrp(rs->reads,0,Read) ;
  for (i = 0 ; i < arrayMax(rs->reads) ; ++i, ++r)
    if ((n = r->nHit))
      { if (fwrite(r->hit,sizeof(U32),n,f) != n) die ("failed write hits %d", n) ;
	if (fwrite(r->dx,sizeof(U16),n,f) != n) die ("failed write dx %d", n) ;
      }
  fclose (f) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x6178(%rip), %rsi      # 0x804b
leaq 0x6b0d(%rip), %rdx      # 0x89e7
movq %r15, %rdi
callq 0x6e23
movq %rax, %r14
testq %rax, %rax
jne 0x1efb
leaq 0x6147(%rip), %rdi      # 0x8038
movq %r15, %rsi
xorl %eax, %eax
callq 0x6bcc
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x5318
movq %r14, %rdi
callq 0x10a0
leaq 0x614e(%rip), %rsi      # 0x8063
leaq 0x6acb(%rip), %rdx      # 0x89e7
movq %r15, %rdi
callq 0x6e23
movq %rax, %r14
testq %rax, %rax
jne 0x1f3d
leaq 0x611d(%rip), %rdi      # 0x8050
movq %r15, %rsi
xorl %eax, %eax
callq 0x6bcc
leaq 0x61bc(%rip), %rdi      # 0x8100
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1230
cmpq $0x1, %rax
je 0x1f6a
leaq 0x6108(%rip), %rdi      # 0x806b
xorl %eax, %eax
callq 0x6bcc
leaq 0x10(%rbx), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1230
cmpq $0x1, %rax
je 0x1f94
leaq 0x60fd(%rip), %rdi      # 0x808a
xorl %eax, %eax
callq 0x6bcc
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x67d5
movq 0x8(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jle 0x2026
movq 0x8(%rax), %rbp
addq $0x10, %rbp
leaq 0x60e8(%rip), %r12      # 0x80a1
xorl %r15d, %r15d
movslq -0xc(%rbp), %r13
testq %r13, %r13
je 0x2015
movq -0x8(%rbp), %rdi
movl $0x4, %esi
movq %r13, %rdx
movq %r14, %rcx
callq 0x1230
cmpq %r13, %rax
je 0x1feb
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x6bcc
movq (%rbp), %rdi
movl $0x2, %esi
movq %r13, %rdx
movq %r14, %rcx
callq 0x1230
cmpq %r13, %rax
je 0x2015
leaq 0x60ab(%rip), %rdi      # 0x80b6
movl %r13d, %esi
xorl %eax, %eax
callq 0x6bcc
incl %r15d
movq 0x8(%rbx), %rax
addq $0x48, %rbp
cmpl 0x18(%rax), %r15d
jl 0x1fbc
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10a0
// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: invBuild
static void invBuild (Readset *rs) /* run this after ms->depth built from reads->hit[] */
{
  Moshset *ms = rs->ms ;
  U32 i, j ;
  U64 offset = 0 ;
  rs->inv = new0 (ms->max+1, U32*) ;
  rs->invSpace = new (rs->totHit, U32) ;
  for (i = 1 ; i <= ms->max ; ++i)
    if (ms->depth[i] && ms->depth[i] < U16MAX)
      { rs->inv[i] = rs->invSpace + offset ;
	offset += ms->depth[i] ;
      }
  Read *read = arrp(rs->reads,1,Read) ;
  for (i = 1 ; i < arrayMax(rs->reads) ; ++i, ++read)
    { for (j = 0 ; j < 4 ; ++j) read->nCopy[j] = 0 ; /* build nCopy here in case msCopy changed */
      U32 *x = read->hit ;
      for (j = 0 ; j < read->nHit ; ++j, ++x)
	{ U32 y = *x & TOPMASK ;
	  ++read->nCopy[msCopy(rs->ms,y)] ;
	  if (ms->depth[y] < U16MAX) *rs->inv[y]++ = i ; /* this is the inverse map */
	}
    }
  offset = 0 ; /* now recreate rs->inv because we moved the pointers */
  for (i = 1 ; i <= ms->max ; ++i)
    if (ms->depth[i] && ms->depth[i] < U16MAX)
      { rs->inv[i] = rs->invSpace + offset ;
	offset += ms->depth[i] ;
      }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movl 0x40(%r14), %edi
incl %edi
movl $0x8, %esi
callq 0x6cbc
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x2, %rdi
callq 0x6c94
movq %rax, 0x20(%rbx)
movl 0x40(%r14), %ecx
testl %ecx, %ecx
je 0x229e
incl %ecx
cmpl $0x3, %ecx
movl $0x2, %eax
cmovael %ecx, %eax
movl $0x1, %ecx
xorl %edx, %edx
movq 0x30(%r14), %rsi
movzwl (%rsi,%rcx,2), %esi
testl %esi, %esi
je 0x2296
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x2296
leaq (,%rdx,4), %rsi
addq 0x20(%rbx), %rsi
movq 0x18(%rbx), %rdi
movq %rsi, (%rdi,%rcx,8)
movq 0x30(%r14), %rsi
movzwl (%rsi,%rcx,2), %esi
addq %rsi, %rdx
incq %rcx
cmpq %rcx, %rax
jne 0x2263
movq 0x8(%rbx), %rax
cmpl $0x2, 0x18(%rax)
jb 0x2342
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rcx
movslq 0x14(%rax), %rdx
leaq (%rcx,%rdx), %rax
addq %rdx, %rcx
addq $0x24, %rcx
movl $0x1, %edx
xorl %esi, %esi
xorps %xmm0, %xmm0
leaq (%rsi,%rsi,8), %rdi
movups %xmm0, (%rcx,%rdi,8)
cmpl $0x0, 0x4(%rax)
je 0x2330
movq 0x8(%rax), %rdi
xorl %r8d, %r8d
movl (%rdi,%r8,4), %r10d
movl %r10d, %r9d
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
movq (%rbx), %r11
movq 0x38(%r11), %r11
movzbl (%r11,%r9), %r11d
andl $0x3, %r11d
incl 0x24(%rax,%r11,4)
movq 0x30(%r14), %r11
addl %r10d, %r10d
cmpw $-0x1, (%r11,%r10)
je 0x2327
movq 0x18(%rbx), %r10
movq (%r10,%r9,8), %r11
leaq 0x4(%r11), %r15
movq %r15, (%r10,%r9,8)
movl %edx, (%r11)
incq %r8
cmpl 0x4(%rax), %r8d
jb 0x22e2
incl %edx
addq $0x48, %rax
movq 0x8(%rbx), %rdi
incq %rsi
cmpl 0x18(%rdi), %edx
jb 0x22cd
movl 0x40(%r14), %ecx
testl %ecx, %ecx
je 0x2399
incl %ecx
cmpl $0x3, %ecx
movl $0x2, %eax
cmovael %ecx, %eax
movl $0x1, %ecx
xorl %edx, %edx
movq 0x30(%r14), %rsi
movzwl (%rsi,%rcx,2), %esi
testl %esi, %esi
je 0x2391
cmpl $0xffff, %esi           # imm = 0xFFFF
je 0x2391
leaq (,%rdx,4), %rsi
addq 0x20(%rbx), %rsi
movq 0x18(%rbx), %rdi
movq %rsi, (%rdi,%rcx,8)
movq 0x30(%r14), %rsi
movzwl (%rsi,%rcx,2), %esi
addq %rsi, %rdx
incq %rcx
cmpq %rcx, %rax
jne 0x235e
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: badOverlaps
int badOverlaps (Readset *rs, Read *x)
{
  int i, nBad = 0 ;
  Array olap = findOverlaps (rs, x, 0) ;
  for (i = 0 ; i < arrayMax(olap) ; ++i) if (arrp(olap,i,Overlap)->isBad) ++nBad ;
  arrayDestroy (olap) ;
  return nBad ;
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x2cbe
movslq 0x18(%rax), %rcx
testq %rcx, %rcx
jle 0x34f8
movq 0x8(%rax), %rdx
movslq 0x14(%rax), %rsi
addq $0xd, %rdx
xorl %ebx, %ebx
cmpb $0x1, (%rdx)
sbbl $-0x1, %ebx
addq %rsi, %rdx
decq %rcx
jne 0x34ea
movq %rax, %rdi
callq 0x658d
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/richarddurbin[P]hash10x/moshasm.c
// Function: markBadReads
void markBadReads (Readset *rs)
{
  int ix ;
  Read *x, *x0 = arrp(rs->reads,0,Read) ;

  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    x->bad = 0 ; /* initialise by clearing all bad flags */
  
  /* first pass through findOverlaps - set badOrder10 */
  int nBad = 0 ;
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    if (badOverlaps (rs, x) >= 10) { x->badOrder10 = 1 ; ++nBad ; }
  printf ("MB  %d with >=10 bad overlaps\n", nBad) ;

  /* second pass, set badOrder1 for all 2 or more - will remove some more singleton errors */
  nBad = 0 ;
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    if (badOverlaps (rs, x) > 1 && !x->badOrder10) { x->badOrder1 = 1 ; ++nBad ; }
  printf ("MB  %d with multiple bad overlaps\n", nBad) ;

  /* third pass, set badOrder1 for anything bad  - must be simple pairs - might be too harsh */
  nBad = 0 ;
  for (ix = 0, x = x0 ; ix < arrayMax(rs->reads) ; ++ix, ++x)
    if (badOverlaps (rs, x) > 0 && !x->badOrder10) { x->badOrder1 = 1 ; ++nBad ; }
  printf ("MB  %d with single bad overlaps\n", nBad) ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x8(%rax), %r14
cmpl $0x0, 0x18(%rax)
jle 0x3538
leaq 0x18(%r14), %rax
xorl %ecx, %ecx
movb $0x0, (%rax)
incl %ecx
movq 0x8(%rbx), %rdx
addq $0x48, %rax
cmpl 0x18(%rdx), %ecx
jl 0x3526
movq 0x8(%rbx), %rax
xorl %ebp, %ebp
cmpl $0x0, 0x18(%rax)
movl $0x0, %r15d
jle 0x357d
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r14, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x34c9
cmpl $0xa, %eax
jl 0x356c
orb $0x2, 0x18(%r12)
incl %r15d
incl %r13d
addq $0x48, %r12
movq 0x8(%rbx), %rax
cmpl 0x18(%rax), %r13d
jl 0x3553
leaq 0x4ec3(%rip), %rdi      # 0x8447
movl %r15d, %esi
xorl %eax, %eax
callq 0x10c0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jle 0x35d1
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %r14, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x34c9
cmpl $0x2, %eax
jl 0x35c0
movb 0x18(%r15), %al
testb $0x2, %al
jne 0x35c0
orb $0x4, %al
movb %al, 0x18(%r15)
incl %ebp
incl %r12d
addq $0x48, %r15
movq 0x8(%rbx), %rax
cmpl 0x18(%rax), %r12d
jl 0x35a0
leaq 0x4e8e(%rip), %rdi      # 0x8466
xorl %r15d, %r15d
movl %ebp, %esi
xorl %eax, %eax
callq 0x10c0
movq 0x8(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jle 0x3622
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x34c9
testl %eax, %eax
jle 0x3613
movb 0x18(%r14), %al
testb $0x2, %al
jne 0x3613
orb $0x4, %al
movb %al, 0x18(%r14)
incl %r15d
incl %ebp
addq $0x48, %r14
movq 0x8(%rbx), %rax
cmpl 0x18(%rax), %ebp
jl 0x35f3
leaq 0x4e60(%rip), %rdi      # 0x8489
movl %r15d, %esi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10c0
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/inject.c
// Function: join
static void join(pid_t pid, char *type) {
  char *path;
  int fd;

  path = string("/proc/%u/ns/%s", pid, type);

  if ((fd = open(path, O_RDONLY)) >= 0) {
    if (syscall(__NR_setns, fd, 0) < 0 && strcmp(type, "user") == 0)
      errx(EXIT_FAILURE, "Failed to join user namespace");
    close(fd);
  } else if (errno != ENOENT) {
    errx(EXIT_FAILURE, "PID %u does not belong to you", pid);
  } else if (strcmp(type, "user") == 0) {
    errx(EXIT_FAILURE, "PID %u not found or user namespace unavailable", pid);
  }

  free(path);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
leaq 0x188a(%rip), %rdi      # 0x4129
movl %ebp, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3612
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x22a0
testl %eax, %eax
js 0x28f3
movl %eax, %r15d
movl $0x134, %edi            # imm = 0x134
movl %eax, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x21c0
testq %rax, %rax
jns 0x28e9
leaq 0x1763(%rip), %rsi      # 0x4040
movq %r14, %rdi
callq 0x2180
testl %eax, %eax
je 0x2940
movl %r15d, %edi
callq 0x2140
jmp 0x2910
callq 0x2050
cmpl $0x2, (%rax)
jne 0x2922
leaq 0x173c(%rip), %rsi      # 0x4040
movq %r14, %rdi
callq 0x2180
testl %eax, %eax
je 0x292b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2040
leaq 0x182d(%rip), %rsi      # 0x4156
jmp 0x2932
leaq 0x1842(%rip), %rsi      # 0x4174
movl $0x1, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2110
leaq 0x17f1(%rip), %rsi      # 0x4138
movl $0x1, %edi
xorl %eax, %eax
callq 0x2110
nop
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/map.c
// Function: denysetgroups
void denysetgroups(pid_t pid) {
  char *path, *text = "deny";
  int fd;

  path = string("/proc/%d/setgroups", pid);
  if ((fd = open(path, O_WRONLY)) < 0)
    errx(EXIT_FAILURE, "Failed to disable setgroups() in container");
  else if (write(fd, text, strlen(text)) != (ssize_t) strlen(text))
    errx(EXIT_FAILURE, "Failed to disable setgroups() in container");
  close(fd);
  free(path);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %esi
leaq 0x1856(%rip), %rdi      # 0x41b6
xorl %eax, %eax
callq 0x3612
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x22a0
testl %eax, %eax
js 0x29ad
movl %eax, %ebp
leaq 0x182b(%rip), %rsi      # 0x41b1
movl $0x4, %edx
movl %eax, %edi
callq 0x2090
cmpq $0x4, %rax
jne 0x29ad
movl %ebp, %edi
callq 0x2140
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
leaq 0x1815(%rip), %rsi      # 0x41c9
movl $0x1, %edi
xorl %eax, %eax
callq 0x2110
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/map.c
// Function: writemap
void writemap(pid_t pid, int type, char *map) {
  char *path, *range, *text = NULL;
  int fd;
  unsigned count, first, lower;

  if (!map) {
    map = (getuid() == 0 ? rootdefault : userdefault)(type);
  } else if (getuid() != 0) {
    range = readranges(type);
    verifymap(map, range);
    free(range);
  }

  while ((map = mapitem(map, &first, &lower, &count)))
    append(&text, "%u %u %u\n", first, lower, count);

  path = string("/proc/%d/%s", pid, idfile(type));
  if ((fd = open(path, O_WRONLY)) < 0)
    errx(EXIT_FAILURE, "Failed to set container %s map", idname(type));
  else if (write(fd, text, strlen(text)) != (ssize_t) strlen(text))
    errx(EXIT_FAILURE, "Failed to set container %s map", idname(type));

  close(fd);
  free(path);
  free(text);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movl %esi, %ebx
movl %edi, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
callq 0x2100
testq %r14, %r14
movl %ebx, 0x24(%rsp)
je 0x2a61
testl %eax, %eax
je 0x2a7c
movl %ebx, %edi
callq 0x2edc
movq %rax, %r15
leaq 0x14(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
callq 0x30d1
testq %rax, %rax
je 0x2a57
movq %rax, %r12
leaq 0x14(%rsp), %rbx
leaq 0xc(%rsp), %r13
leaq 0x10(%rsp), %rbp
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movq %r15, %rdi
callq 0x338d
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x30d1
movq %rax, %r12
testq %rax, %rax
jne 0x2a2e
movq %r15, %rdi
callq 0x2040
jmp 0x2a7c
testl %eax, %eax
leaq 0x13f(%rip), %rax       # 0x2ba9
leaq 0x2eb(%rip), %rcx       # 0x2d5c
cmoveq %rax, %rcx
movl %ebx, %edi
callq *%rcx
movq %rax, %r14
leaq 0x14(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
callq 0x30d1
testq %rax, %rax
je 0x2ae9
movq %rax, %r15
leaq 0x1752(%rip), %r14      # 0x41f4
leaq 0x18(%rsp), %r12
leaq 0x14(%rsp), %r13
leaq 0xc(%rsp), %rbp
leaq 0x10(%rsp), %rbx
movl 0x14(%rsp), %edx
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %r8d
movq %r12, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3434
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x30d1
movq %rax, %r15
testq %rax, %rax
jne 0x2ab6
movl 0x24(%rsp), %r15d
testl %r15d, %r15d
leaq 0x1712(%rip), %rax      # 0x420a
leaq 0x1713(%rip), %rdx      # 0x4212
cmoveq %rax, %rdx
leaq 0x16f4(%rip), %rdi      # 0x41fe
movl 0x20(%rsp), %esi
xorl %eax, %eax
callq 0x3612
movq %rax, %r14
movq %rax, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x22a0
testl %eax, %eax
js 0x2b81
movl %eax, %ebp
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x20e0
movl %ebp, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2090
movq %rax, %rbx
movq 0x18(%rsp), %rdi
callq 0x20e0
cmpq %rax, %rbx
jne 0x2b81
movl %ebp, %edi
callq 0x2140
movq %r14, %rdi
callq 0x2040
movq 0x18(%rsp), %rdi
callq 0x2040
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r15d, %r15d
leaq 0x16ae(%rip), %rax      # 0x4239
leaq 0x16ab(%rip), %rdx      # 0x423d
cmoveq %rax, %rdx
leaq 0x167d(%rip), %rsi      # 0x421a
movl $0x1, %edi
xorl %eax, %eax
callq 0x2110
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/map.c
// Function: rootdefault
static char *rootdefault(int type) {
  char *cursor, *map, *result;
  unsigned count, first, last = INVALID, lower;

  cursor = map = getmap(-1, type);
  while ((cursor = mapitem(cursor, &first, &lower, &count)))
    if (last == INVALID || last < first + count - 1)
      last = first + count - 1;
  result = string("0:%u:1", last);

  cursor = map;
  while ((cursor = mapitem(cursor, &first, &lower, &count))) {
    if (first == 0) {
      if (count == 1 && first >= last)
        errx(EXIT_FAILURE, "No unprivileged %s available\n", idname(type));
      first++, lower++, count--;
    }

    if (last <= first + count - 1 && count > 0)
      count--;

    if (count > 0)
      append(&result, "%s%u:%u:%u", result ? "," : "", first, first, count);
  }

  free(map);
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edi, 0x1c(%rsp)
callq 0x318c
movq %rax, %r12
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x4(%rsp), %rcx
movq %rax, %rdi
callq 0x30d1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2c2b
leaq 0x8(%rsp), %rbx
leaq 0xc(%rsp), %r14
leaq 0x4(%rsp), %r15
cmpl $-0x1, %ebp
je 0x2c08
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %edx
addl %edx, %ecx
decl %ecx
cmpl %ecx, %ebp
jae 0x2c15
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %edx
leal (%rcx,%rdx), %ebp
decl %ebp
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x30d1
testq %rax, %rax
jne 0x2bf3
leaq 0x160f(%rip), %rdi      # 0x4241
movl %ebp, %esi
xorl %eax, %eax
callq 0x3612
movq %rax, 0x10(%rsp)
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x4(%rsp), %rcx
movq %r12, 0x20(%rsp)
movq %r12, %rdi
callq 0x30d1
testq %rax, %rax
je 0x2d14
movq %rax, %r12
leaq 0x8(%rsp), %r15
leaq 0xc(%rsp), %r13
leaq 0x4(%rsp), %rbx
leaq 0x10(%rsp), %r14
cmpl $0x0, 0x8(%rsp)
jne 0x2ca6
movl 0x4(%rsp), %eax
cmpl $0x1, %eax
jne 0x2c94
testl %ebp, %ebp
je 0x2d32
incl 0xc(%rsp)
movl $0x1, 0x8(%rsp)
decl %eax
movl %eax, 0x4(%rsp)
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %eax
movl %eax, %edx
addl $-0x1, %edx
jae 0x2cc1
addl %ecx, %edx
cmpl %edx, %ebp
ja 0x2cc1
decl %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %r9d
testl %r9d, %r9d
je 0x2cf7
cmpq $0x0, 0x10(%rsp)
leaq 0x1599(%rip), %rdx      # 0x4271
leaq 0x1633(%rip), %rax      # 0x4312
cmoveq %rax, %rdx
movq %r14, %rdi
leaq 0x1579(%rip), %rsi      # 0x4266
movl %ecx, %r8d
xorl %eax, %eax
callq 0x3434
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x30d1
movq %rax, %r12
testq %rax, %rax
jne 0x2c7c
movq 0x20(%rsp), %rdi
callq 0x2040
movq 0x10(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x1c(%rsp)
leaq 0x14fb(%rip), %rax      # 0x4239
leaq 0x14f8(%rip), %rdx      # 0x423d
cmoveq %rax, %rdx
leaq 0x14f8(%rip), %rsi      # 0x4248
movl $0x1, %edi
xorl %eax, %eax
callq 0x2110
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/map.c
// Function: userdefault
static char *userdefault(int type) {
  char *cursor, *map, *range, *result = NULL;
  unsigned count, first, index = 0, length, lower, start;

  if (geteuid() != 0)
    return string("0:%u:1", getid(type));

  map = getmap(-1, type);
  range = readranges(type);

  while ((range = rangeitem(range, &start, &length))) {
    cursor = map;
    while ((cursor = mapitem(cursor, &first, &lower, &count))) {
      if (start + length <= first || first + count <= start)
        continue;
      if (first + count < start + length)
        length = start - first + count;
      if (start < first) {
        index += first - start;
        length -= first - start;
        start = first;
      }
      append(&result, "%s%u:%u:%u", result ? "," : "", index, start, length);
      index += length;
    }
  }

  free(map);
  free(range);
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebx
movq $0x0, 0x8(%rsp)
callq 0x2130
testl %eax, %eax
je 0x2d90
testl %ebx, %ebx
je 0x2eb9
callq 0x2100
jmp 0x2ebe
movl %ebx, %edi
callq 0x318c
movq %rax, 0x18(%rsp)
movl %ebx, %edi
callq 0x2edc
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
movq %rax, %rdi
callq 0x32e2
testq %rax, %rax
je 0x2e9b
movq %rax, %r14
leaq 0x10(%rsp), %r15
leaq 0x24(%rsp), %r12
leaq 0x14(%rsp), %r13
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x30d1
testq %rax, %rax
je 0x2e7f
movq %rax, %rbx
movl 0x4(%rsp), %eax
movl (%rsp), %edx
addl %eax, %edx
movl 0x10(%rsp), %ecx
cmpl %ecx, %edx
jbe 0x2e0b
movl 0x14(%rsp), %esi
leal (%rsi,%rcx), %edi
cmpl %eax, %edi
ja 0x2e26
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x30d1
movq %rax, %rbx
testq %rax, %rax
jne 0x2def
jmp 0x2e7f
cmpl %edx, %edi
jae 0x2e33
movl %eax, %edx
subl %ecx, %edx
addl %esi, %edx
movl %edx, (%rsp)
cmpl %ecx, %eax
jae 0x2e44
movl %ecx, %edx
subl %eax, %edx
addl %edx, %ebp
subl %edx, (%rsp)
movl %ecx, 0x4(%rsp)
cmpq $0x0, 0x8(%rsp)
leaq 0x1420(%rip), %rdx      # 0x4271
leaq 0x14ba(%rip), %rax      # 0x4312
cmoveq %rax, %rdx
movl 0x4(%rsp), %r8d
movl (%rsp), %r9d
leaq 0x8(%rsp), %rdi
leaq 0x13f5(%rip), %rsi      # 0x4266
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3434
addl (%rsp), %ebp
jmp 0x2e0b
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
callq 0x32e2
movq %rax, %r14
testq %rax, %rax
jne 0x2dd0
movq 0x18(%rsp), %rdi
callq 0x2040
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x21e0
leaq 0x137c(%rip), %rdi      # 0x4241
movl %eax, %esi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3612
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/map.c
// Function: mapitem
static char *mapitem(char *map, unsigned *first, unsigned *lower,
    unsigned *count) {
  ssize_t skip;

  while (map && *map && strchr(",;", *map))
    map++;
  if (map == NULL || *map == '\0')
    return NULL;
  if (sscanf(map, "%u:%u:%u%zn", first, lower, count, &skip) < 3)
    errx(EXIT_FAILURE, "Invalid ID map '%s'", map);
  return map + skip;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x3131
movq %rdi, %rbx
movb (%rdi), %al
testb %al, %al
sete %r14b
je 0x3131
movq %rdx, %r15
movq %rsi, %r12
movq %rcx, 0x8(%rsp)
leaq 0x11ae(%rip), %rbp      # 0x42b1
xorl %r13d, %r13d
movsbl %al, %esi
movl $0x3, %edx
movq %rbp, %rdi
callq 0x2170
testq %rax, %rax
je 0x312b
movb 0x1(%rbx), %al
incq %rbx
testb %al, %al
sete %r14b
jne 0x3106
jmp 0x3134
testb $0x1, %r14b
je 0x3146
xorl %r13d, %r13d
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11ff(%rip), %rsi      # 0x434c
leaq 0x10(%rsp), %r9
movq %rbx, %rdi
movq %r12, %rdx
movq %r15, %rcx
movq 0x8(%rsp), %r8
xorl %eax, %eax
callq 0x2210
cmpl $0x2, %eax
jle 0x3176
addq 0x10(%rsp), %rbx
movq %rbx, %r13
jmp 0x3134
leaq 0x11db(%rip), %rsi      # 0x4358
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2110
// File: /workspace/github_c_makefile_star2_O1/arachsys[P]containers/map.c
// Function: getmap
static char *getmap(pid_t pid, int type) {
  char *line = NULL, *result = NULL, *path;
  size_t size;
  unsigned count, first, lower;
  FILE *file;

  if (pid == -1)
    path = string("/proc/self/%s", idfile(type));
  else
    path = string("/proc/%d/%s", pid, idfile(type));
  if (!(file = fopen(path, "r")))
    errx(EXIT_FAILURE, "Cannot read %s", path);

  while (getline(&line, &size, file) >= 0) {
    if (sscanf(line, " %u %u %u", &first, &lower, &count) != 3)
      errx(EXIT_FAILURE, "Invalid map data in %s", path);
    append(&result, "%s%u:%u:%u", result ? "," : "", first, lower, count);
  }

  if (!result)
    errx(EXIT_FAILURE, "Invalid map data in %s", path);

  fclose(file);
  free(line);
  free(path);
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %eax, %eax
movq %rax, 0x18(%rsp)
movq %rax, 0x10(%rsp)
testl %edi, %edi
leaq 0x105b(%rip), %rax      # 0x420a
leaq 0x105c(%rip), %rsi      # 0x4212
cmoveq %rax, %rsi
leaq 0x10b2(%rip), %rdi      # 0x4273
xorl %eax, %eax
callq 0x3612
leaq 0x1023(%rip), %rsi      # 0x41f2
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0x22b0
testq %rax, %rax
je 0x32d9
movq %rax, %r14
leaq 0x18(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %rax, %rdx
callq 0x22d0
testq %rax, %rax
js 0x3289
leaq 0x1067(%rip), %rbp      # 0x4271
leaq 0x1055(%rip), %rbx      # 0x4266
leaq 0x10(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x30(%rsp), %r13
movq 0x18(%rsp), %rdi
leaq 0x1064(%rip), %rsi      # 0x4290
leaq 0x28(%rsp), %rdx
leaq 0x24(%rsp), %rcx
leaq 0x2c(%rsp), %r8
xorl %eax, %eax
callq 0x2210
cmpl $0x3, %eax
jne 0x32c1
cmpq $0x0, 0x10(%rsp)
movq %rbp, %rdx
leaq 0x10bb(%rip), %rax      # 0x4312
cmoveq %rax, %rdx
movl 0x28(%rsp), %ecx
movl 0x24(%rsp), %r8d
movl 0x2c(%rsp), %r9d
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3434
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x22d0
testq %rax, %rax
jns 0x3220
cmpq $0x0, 0x10(%rsp)
je 0x32c1
movq %r14, %rdi
callq 0x20b0
movq 0x18(%rsp), %rdi
callq 0x2040
movq 0x8(%rsp), %rdi
callq 0x2040
movq 0x10(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfd2(%rip), %rsi       # 0x429a
movl $0x1, %edi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2110
leaq 0xfa1(%rip), %rsi       # 0x4281
jmp 0x32c8