LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/ingowald[P]closestSurfacePointQueries/src/distanceQueries.cpp
// Function: bvhlib::computeDistance(bvhlib::BVH::Node const*, ospcommon::vec_t<float, 3, 1> const&)
inline float computeDistance(const BVH::Node *node, const vec3fa &P)
  {
#if 0
    // vectorized version - but doesn't cost enough to actually gain anything :-(
    const __m128 lo = (__m128&)node->lower;
    const __m128 hi = (__m128&)node->upper;
    const __m128 p  = (__m128&)P;
    const __m128 pp = _mm_min_ps(_mm_max_ps(p,lo),hi);
    const __m128 d  = _mm_sub_ps(pp,p);
    const __m128 dd = _mm_mul_ps(d,d);
    float xx,yy,zz;
    (int&)xx = _mm_extract_ps(dd,0);
    (int&)yy = _mm_extract_ps(dd,1);
    (int&)zz = _mm_extract_ps(dd,2);
    const float vec = sqrtf(xx+yy+zz);
    return vec;
#else
    const vec3fa Pclamped = min(max(P,(const vec3fa&)node->lower),(const vec3fa&)node->upper);
    return length(P-Pclamped);
#endif
  }

// Assembly:
subq $0x28, %rsp
movq %rsi, %rax
movss 0x8(%rdi), %xmm0
maxss 0x8(%rsi), %xmm0
minss 0x18(%rdi), %xmm0
movsd (%rdi), %xmm1
movsd (%rsi), %xmm2
maxps %xmm2, %xmm1
movsd 0x10(%rdi), %xmm2
minps %xmm2, %xmm1
leaq 0x18(%rsp), %rsi
movlps %xmm1, (%rsi)
movss %xmm0, 0x8(%rsi)
movq %rax, %rdi
callq 0x4d62
leaq 0x8(%rsp), %rdi
movlps %xmm0, (%rdi)
movss %xmm1, 0x8(%rdi)
callq 0x4d45
addq $0x28, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ingowald[P]closestSurfacePointQueries/src/distanceQueries.cpp
// Function: bvhlib::projectToPlane(float&, ospcommon::vec_t<float, 3, 1> const&, ospcommon::vec_t<float, 3, 1> const&, ospcommon::vec_t<float, 3, 1> const&)
inline vec3fa projectToPlane(float &dist, const vec3fa &P, const vec3fa &N, const vec3fa &A)
  {
    const float den = dot(N,N);
    if (den == 0.f) {
      const vec3fa PP = A;
      dist = length(PP-P);
      return PP;
    } else {
      const vec3fa PP = P - float((dot(P-A,N)/(double)den)) * N;
      dist = length(PP-P);
      return PP;
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %r13
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, %rdi
movq %rcx, %rsi
callq 0x53cf
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x52c2
jp 0x52c2
movsd (%r13), %xmm0
movsd %xmm0, (%rbx)
movss 0x8(%r13), %xmm0
movss %xmm0, 0x8(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d62
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss %xmm1, 0x8(%rdi)
jmp 0x534a
movq %r15, %rdi
movq %r13, %rsi
movss %xmm0, 0xc(%rsp)
callq 0x4d62
movss 0x8(%r12), %xmm2
movsd (%r12), %xmm3
movaps %xmm0, %xmm4
mulps %xmm3, %xmm4
shufps $0x55, %xmm4, %xmm4     # xmm4 = xmm4[1,1,1,1]
mulss %xmm3, %xmm0
addss %xmm4, %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
divss 0xc(%rsp), %xmm1
mulss %xmm1, %xmm2
unpcklps %xmm1, %xmm1            # xmm1 = xmm1[0,0,1,1]
mulps %xmm3, %xmm1
leaq 0x10(%rsp), %r12
movlps %xmm1, (%r12)
movss %xmm2, 0x8(%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x4d62
movlps %xmm0, (%rbx)
movss %xmm1, 0x8(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d62
movlps %xmm0, (%r12)
movss %xmm1, 0x8(%r12)
leaq 0x10(%rsp), %rdi
callq 0x4d45
movss %xmm0, (%r14)
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ingowald[P]closestSurfacePointQueries/src/distanceQueries.cpp
// Function: bvhlib::checkEdge(ospcommon::vec_t<float, 3, 1>&, float&, ospcommon::vec_t<float, 3, 1> const&, ospcommon::vec_t<float, 3, 1> const&, ospcommon::vec_t<float, 3, 1> const&)
inline void checkEdge(vec3fa &closestPoint, float &closestDist,
                        const vec3fa &queryPoint,
                        const vec3fa &v0, const vec3fa &e0)
  {
    const vec3fa PP = projectToEdge(queryPoint,v0,e0);
    const float dist = length(PP-queryPoint);
    if (dist < closestDist) {
      closestDist = dist;
      closestPoint = PP;
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x53f4
movq %r12, %rdi
movq %r15, %rsi
callq 0x4d62
leaq 0x18(%rsp), %rdi
movlps %xmm0, (%rdi)
movss %xmm1, 0x8(%rdi)
callq 0x4d45
movss (%r14), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x53c3
movss %xmm0, (%r14)
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ingowald[P]closestSurfacePointQueries/src/distanceQueries.cpp
// Function: bvhlib::projectToEdge(ospcommon::vec_t<float, 3, 1> const&, ospcommon::vec_t<float, 3, 1> const&, ospcommon::vec_t<float, 3, 1> const&)
inline vec3fa projectToEdge(const vec3fa &P, const vec3fa &v0, const vec3fa &e0)
  {
    const float den = dot(e0,e0);
    if (den == 0.f) return v0;

#if 0
    float f = dot(P-v0,e0) / den;
#else
    float f = dot(P-v0,e0) / (double)den;
#endif
    f = std::max(0.f,std::min(1.f,f));
    return v0+f*e0;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq %rcx, %rdi
movq %rcx, %rsi
callq 0x53cf
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x542d
jp 0x542d
movsd (%r14), %xmm0
movss 0x8(%r14), %xmm1
jmp 0x5498
movq %r12, %rdi
movq %r14, %rsi
movss %xmm0, 0x4(%rsp)
callq 0x4d62
movss 0x8(%r15), %xmm2
movsd (%r15), %xmm3
movaps %xmm0, %xmm4
mulps %xmm3, %xmm4
shufps $0x55, %xmm4, %xmm4     # xmm4 = xmm4[1,1,1,1]
mulss %xmm3, %xmm0
addss %xmm4, %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
divss 0x4(%rsp), %xmm1
minss 0x31db(%rip), %xmm1     # 0x864c
maxss 0x31d7(%rip), %xmm1     # 0x8650
mulss %xmm1, %xmm2
unpcklps %xmm1, %xmm1            # xmm1 = xmm1[0,0,1,1]
mulps %xmm3, %xmm1
leaq 0x8(%rsp), %rsi
movlps %xmm1, (%rsi)
movss %xmm2, 0x8(%rsi)
movq %r14, %rdi
callq 0x54af
movlps %xmm0, (%rbx)
movss %xmm1, 0x8(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ingowald[P]closestSurfacePointQueries/src/distanceQueries.cpp
// Function: bvhlib::GeneralTriangleMesh<float, int, true>::getTriangle(unsigned long) const
inline Triangle GeneralTriangleMesh<coord_t,index_t,has_strides>::getTriangle(const size_t primID) const
  {
    Triangle t;
    if (has_strides) {
      const size_t i0 = this->idx_x[primID*idx_stride];
      const size_t i1 = this->idx_y[primID*idx_stride];
      const size_t i2 = this->idx_z[primID*idx_stride];
    
      t.v0 = vec3fa(this->vtx_x[i0*vtx_stride],
                    this->vtx_y[i0*vtx_stride],
                    this->vtx_z[i0*vtx_stride]);
      t.v1 = vec3fa(this->vtx_x[i1*vtx_stride],
                    this->vtx_y[i1*vtx_stride],
                    this->vtx_z[i1*vtx_stride]);
      t.v2 = vec3fa(this->vtx_x[i2*vtx_stride],
                    this->vtx_y[i2*vtx_stride],
                    this->vtx_z[i2*vtx_stride]);
    } else {
      const size_t i0 = this->idx_x[primID];
      const size_t i1 = this->idx_y[primID];
      const size_t i2 = this->idx_z[primID];
    
      t.v0 = vec3fa(this->vtx_x[i0],
                    this->vtx_y[i0],
                    this->vtx_z[i0]);
      t.v1 = vec3fa(this->vtx_x[i1],
                    this->vtx_y[i1],
                    this->vtx_z[i1]);
      t.v2 = vec3fa(this->vtx_x[i2],
                    this->vtx_y[i2],
                    this->vtx_z[i2]);
    }
    return t;
  }

// Assembly:
movq %rdi, %rax
imulq 0x80(%rsi), %rdx
movq 0x68(%rsi), %rcx
movslq (%rcx,%rdx,4), %rcx
movq 0x70(%rsi), %rdi
movslq (%rdi,%rdx,4), %rdi
movq 0x78(%rsi), %r8
movslq (%r8,%rdx,4), %rdx
movq 0x60(%rsi), %r8
imulq %r8, %rcx
movq 0x48(%rsi), %r9
movq 0x50(%rsi), %r10
movss (%r9,%rcx,4), %xmm0
movss (%r10,%rcx,4), %xmm1
movq 0x58(%rsi), %rsi
movss (%rsi,%rcx,4), %xmm2
movss %xmm0, (%rax)
movss %xmm1, 0x4(%rax)
movss %xmm2, 0x8(%rax)
imulq %r8, %rdi
movss (%r9,%rdi,4), %xmm0
movss (%r10,%rdi,4), %xmm1
movss (%rsi,%rdi,4), %xmm2
movss %xmm0, 0x10(%rax)
movss %xmm1, 0x14(%rax)
movss %xmm2, 0x18(%rax)
imulq %r8, %rdx
movss (%r9,%rdx,4), %xmm0
movss (%r10,%rdx,4), %xmm1
movss (%rsi,%rdx,4), %xmm2
movss %xmm0, 0x20(%rax)
movss %xmm1, 0x24(%rax)
movss %xmm2, 0x28(%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ingowald[P]closestSurfacePointQueries/src/bvh.cpp
// Function: bvhlib::widestDimension(ospcommon::box_t<float, 3, 1> const&)
inline size_t widestDimension(const box3fa &box) 
  {
    const vec3fa width = box.upper - box.lower;
    size_t widest = width.y > width.x;
    if (width.z > width[widest]) widest = 2;
    return widest;
  }

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rsi
addq $0x10, %rdi
callq 0x4d62
movss %xmm1, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss %xmm1, 0x8(%rdi)
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
xorl %ebx, %ebx
ucomiss %xmm0, %xmm1
seta %bl
movq %rbx, %rsi
callq 0x70c2
movss 0xc(%rsp), %xmm0
ucomiss (%rax), %xmm0
pushq $0x2
popq %rax
cmovbeq %rbx, %rax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: readRefFile(char*)
void readRefFile(char *refFile) { // processing reference file
	int _ref_seq_len = 0;
	char ch[1024];
	FILE *fp = fopen(refFile, "r");
	if (NULL == fp) {
		printf("fail to open file %s\n", refFile);
		return;
	}
	int temp_len, index;
	char temp_ch;
	
	// fscanf(fp, "%s", ch);//meta_data
	fgets(ch, 1024, fp);
	while (fscanf(fp, "%s", ch) != EOF) {
		temp_len = strlen(ch);
		for (int i = 0; i < temp_len; i++) {
			temp_ch = ch[i];
			if (islower(temp_ch)) {
				temp_ch = toupper(temp_ch);
			}
			index = agctIndex(temp_ch);
			if (index^4) {//only A T C T are saved
				ref_seq_code[_ref_seq_len++] = index;
			}
		}
	}
	fclose(fp);
	ref_seq_len = _ref_seq_len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rdi, %r14
leaq 0x28c2(%rip), %rsi      # 0x5050
callq 0x2180
testq %rax, %rax
je 0x2866
movq %rax, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x2220
xorl %r15d, %r15d
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x28e8(%rip), %rsi      # 0x50ae
movq %r14, %rdx
xorl %eax, %eax
callq 0x2280
cmpl $-0x1, %eax
je 0x2845
movq %r14, %rdi
callq 0x20c0
movq %rax, %r12
movq 0x59c1(%rip), %r14      # 0x81a8
testl %r12d, %r12d
movl $0x0, %eax
cmovlel %eax, %r12d
xorl %ebx, %ebx
cmpq %rbx, %r12
je 0x2836
movb 0x10(%rsp,%rbx), %bpl
movsbl %bpl, %r13d
movl %r13d, %edi
callq 0x21c0
testl %eax, %eax
je 0x2819
movl %r13d, %edi
callq 0x2290
movl %eax, %ebp
movsbl %bpl, %edi
callq 0x274c
cmpl $0x4, %eax
je 0x2831
movslq %r15d, %rcx
incl %r15d
movl %eax, (%r14,%rcx,4)
incq %rbx
jmp 0x27f5
movq 0x8(%rsp), %rbx
leaq 0x10(%rsp), %r14
jmp 0x27bc
movq %rbx, %rdi
callq 0x2160
movl %r15d, 0x5968(%rip)     # 0x81bc
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x27fd(%rip), %rdi      # 0x506a
movq %r14, %rsi
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: writeRunLengthCoding(_IO_FILE*, int, int*)
void writeRunLengthCoding(FILE *fp, int vec_len, int *vec) { // run-length coding for EOL
	vector<int> code;
	if (vec_len > 0) {
		code.push_back(vec[0]);
		int pre_value = code[0], cnt = 1;
		for (int i = 1; i < vec_len; i++) {
			if (vec[i] == pre_value) {
				cnt++;
			} else {
				code.push_back(cnt);
				code.push_back(vec[i]);
				pre_value = vec[i];
				cnt = 1;
			}
		}
		code.push_back(cnt);
	}
	int code_len = code.size();
	fprintf(fp, "%d", code_len);

	for (int i = 0; i < code_len; i++) {
		fprintf(fp, " %d", code[i]);
	}
	fprintf(fp, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
xorl %r12d, %r12d
movl $0x0, %r15d
testl %esi, %esi
jle 0x2c2c
movq %rdx, %r14
movl %esi, %ebp
leaq 0x10(%rsp), %rdi
movq %rdx, %rsi
callq 0x3d26
leaq 0x10(%rsp), %r15
movq (%r15), %rax
movl (%rax), %eax
leaq 0xc(%rsp), %r12
movl $0x1, (%r12)
movl %ebp, %ebp
decq %rbp
addq $0x4, %r14
pushq $0x1
popq %r13
movl %r13d, %ecx
subq $0x1, %rbp
jb 0x2c0c
cmpl %eax, (%r14)
jne 0x2be6
incl %ecx
jmp 0x2c02
movq %r15, %rdi
movq %r12, %rsi
callq 0x3d26
movq %r15, %rdi
movq %r14, %rsi
callq 0x3d26
movl (%r14), %eax
movl %r13d, %ecx
movl %ecx, 0xc(%rsp)
addq $0x4, %r14
jmp 0x2bd7
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x3d26
movq 0x18(%rsp), %r15
subq 0x10(%rsp), %r15
shrq $0x2, %r15
xorl %r12d, %r12d
leaq 0x2427(%rip), %rsi      # 0x505a
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x21f0
testl %r15d, %r15d
cmovlel %r12d, %r15d
leaq 0x2407(%rip), %r14      # 0x5055
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x2c71
movq 0x10(%rsp), %rax
movl (%rax,%r12,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
incq %r12
jmp 0x2c51
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x2190
leaq 0x10(%rsp), %rdi
callq 0x3f6c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c99
jmp 0x2c99
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3f6c
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: preProcessRef()
void preProcessRef() { // construction of hash table
	for (int i = 0; i < max_arr_num; i++) {//initial entries
		point[i] = -1;
	}

	// memset(point, -1, sizeof(int)*max_arr_num);

	uint64_t value = 0;
	for (int k = sub_str_num - 1; k >= 0; k--) {
		value <<= 2;
		value += ref_seq_code[k];
	}
	int id = value&(uint64_t)(max_arr_num-1);
	loc[0] = point[id];
	point[id] = 0;

	int step_len = ref_seq_len - sub_str_num + 1;
	int shift_bit_num = (sub_str_num*2-2);
	int one_sub_str = sub_str_num - 1;

	for (int i = 1; i < step_len; i++) {
		value >>= 2;
		value += ((uint64_t)ref_seq_code[i + one_sub_str]<<shift_bit_num);
		
		id = value&(uint64_t)(max_arr_num-1);
		loc[i] = point[id];
		point[id] = i;
	}	
}

// Assembly:
movq 0x5217(%rip), %rax      # 0x81d8
xorl %ecx, %ecx
cmpq $0x40000000, %rcx       # imm = 0x40000000
je 0x2fd5
orl $-0x1, (%rax,%rcx,4)
incq %rcx
jmp 0x2fc3
pushq $0x13
popq %rdx
movq 0x51c9(%rip), %rsi      # 0x81a8
xorl %ecx, %ecx
testl %edx, %edx
js 0x2ff3
movl %edx, %edi
movslq (%rsi,%rdi,4), %rdi
leaq (%rdi,%rcx,4), %rcx
decl %edx
jmp 0x2fe1
leal (,%rcx,4), %esi
movl (%rax,%rsi), %edi
movq 0x51cc(%rip), %rdx      # 0x81d0
movl %edi, (%rdx)
andl $0x0, (%rax,%rsi)
movslq 0x51ab(%rip), %rsi      # 0x81bc
addq $-0x13, %rsi
movq 0x518c(%rip), %rdi      # 0x81a8
addq $0x50, %rdi
pushq $0x1
popq %r8
cmpq %rsi, %r8
jge 0x3052
shrq $0x2, %rcx
movl (%rdi), %r9d
shlq $0x26, %r9
addq %rcx, %r9
shll $0x2, %ecx
movl (%rax,%rcx), %r10d
movl %r10d, (%rdx,%r8,4)
movl %r8d, (%rax,%rcx)
incq %r8
addq $0x4, %rdi
movq %r9, %rcx
jmp 0x3024
retq
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: compressFile(char*, char*)
void compressFile(char *refFile, char *tarFile) {
	char res[100];
	char cmd[200];
	initial(); //important************* must initial before other operation

	sprintf(res, "%s_ref_%s", tarFile, refFile);
	compressFile(refFile, tarFile, res);
	sprintf(cmd, "./7za a %s.7z %s -m0=PPMd", res, res);
	system(cmd);
	sprintf(cmd, "rm %s", res);
	system(cmd);

	clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x140, %rsp            # imm = 0x140
movq %rsi, %r14
movq %rdi, %r15
callq 0x3d4d
leaq 0x1db5(%rip), %rsi      # 0x5087
movq %rsp, %rbx
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2060
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3dff
leaq 0x1d97(%rip), %rsi      # 0x5091
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2060
movq %r14, %rdi
callq 0x2120
leaq 0x1d8d(%rip), %rsi      # 0x50ab
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2060
movq %r14, %rdi
callq 0x2120
callq 0x3e2a
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: compressGenome(char*, char*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void compressGenome(char *refFold, char *tarFold, vector<string> &chr_name_list) {
    char ref[1020], tar[1020], res[1020];
	char cmd[2048];
	char temp[100];
	sprintf(temp, "%s_ref_%s", tarFold, refFold);
	sprintf(cmd, "rm -r %s", temp);
	system(cmd);
	sprintf(cmd, "mkdir %s", temp);
	system(cmd);

	initial(); //important************* must initial before other operation

	int size = chr_name_list.size();
	for (int i = 0; i < size; i++) {
		sprintf(ref, "%s/%s", refFold, chr_name_list[i].c_str());
		sprintf(tar, "%s/%s", tarFold, chr_name_list[i].c_str());
		printf("compressing %s\n", tar);
		sprintf(res, "%s/%s", temp, chr_name_list[i].c_str());
		compressFile(ref, tar, res);
	}
	
	sprintf(cmd, "./7za a %s.7z %s -m0=PPMd", temp, temp);
	system(cmd);

	sprintf(cmd, "rm -r %s", temp);
	system(cmd);
	
	clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1498, %rsp           # imm = 0x1498
movq %rdx, %rbx
movq %rsi, %rdx
movq %rdi, %rcx
leaq 0x1d21(%rip), %rsi      # 0x5087
xorl %r12d, %r12d
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rdx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
xorl %eax, %eax
callq 0x2060
leaq 0x1d28(%rip), %rsi      # 0x50b1
leaq 0xc90(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2060
movq %r14, %rdi
callq 0x2120
leaq 0x1d0d(%rip), %rsi      # 0x50ba
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2060
movq %r14, %rdi
callq 0x2120
callq 0x3d4d
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x5, %rax
testl %eax, %eax
cmovlel %r12d, %eax
shlq $0x5, %rax
movq %rax, 0x18(%rsp)
leaq 0x1cdb(%rip), %r13      # 0x50c3
leaq 0x490(%rsp), %r12
xorl %ebp, %ebp
cmpq %rbp, 0x18(%rsp)
je 0x3480
movq (%rbx), %rax
movq (%rax,%rbp), %rcx
leaq 0x890(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2060
movq (%rbx), %rax
movq (%rax,%rbp), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x2060
leaq 0x1c8b(%rip), %rdi      # 0x50c9
movq %r12, %rsi
xorl %eax, %eax
callq 0x2040
movq (%rbx), %rax
movq (%rax,%rbp), %rcx
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x2060
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3dff
addq $0x20, %rbp
jmp 0x33f2
leaq 0x1c0a(%rip), %rsi      # 0x5091
leaq 0xc90(%rsp), %rbx
leaq 0x20(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2060
movq %rbx, %rdi
callq 0x2120
leaq 0x1bfe(%rip), %rsi      # 0x50b1
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2060
movq %rbx, %rdi
callq 0x2120
callq 0x3e2a
addq $0x1498, %rsp           # imm = 0x1498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: getList(char*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
bool getList(char *list_file, vector<string> &name_list) {
	FILE *fp = fopen(list_file, "r");
	if (fp == NULL) {
		printf("%s open fail!\n", list_file);
		return false;
	}
	char str[1024];
	while (fscanf(fp, "%s", str) != EOF) {
		name_list.push_back(string(str));
	}
	fclose(fp);
	if (name_list.size() == 0) {
		printf("%s is empty!\n", list_file);
		return false;
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x438, %rsp            # imm = 0x438
movq %rsi, %r14
movq %rdi, %r12
leaq 0x18d9(%rip), %rsi      # 0x5050
callq 0x2180
testq %rax, %rax
je 0x37f9
movq %rax, %r15
movq %r12, 0x8(%rsp)
leaq 0x191e(%rip), %r12      # 0x50ae
leaq 0x30(%rsp), %r13
leaq 0x10(%rsp), %rbp
leaq 0x7(%rsp), %rbx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2280
cmpl $-0x1, %eax
je 0x37d7
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x20a0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x420e
movq %rbp, %rdi
callq 0x20d0
jmp 0x379f
movq %r15, %rdi
callq 0x2160
movq 0x8(%r14), %rax
cmpq (%r14), %rax
setne %bl
jne 0x380c
leaq 0x19d7(%rip), %rdi      # 0x51c9
movq 0x8(%rsp), %rsi
jmp 0x3805
leaq 0x19ba(%rip), %rdi      # 0x51ba
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: show_usage()
void show_usage() {
    cout << "HiRGC v1.0\n";
	cout << "Usage: hirgc -m <mode> -r <reference> -t <target> -n <file>\n";
	cout << "  -m is the mode, three limited values <file, genome, set>, required\n";
    cout << "  -r is the reference, a FASTA file or a genome folder according to the mode, required\n";
	cout << "  -t is the target, a FASTA file or a genome folder or a file contains a list of genome folder, required\n";
    cout << "  -n is a file containing name of chromosomes or a string \"default\"\n";
	cout << "Examples:\n";
	cout << "  hirgc -m file -r YH_chr1.fa -t HG18_chr1.fa\n";
	cout << "  hirgc -m genome -r YH -t HG18 -n default\n";
	cout << "  hirgc -m genome -r YH -t HG18 -n chr_name.txt\n";
	cout << "  hirgc -m set -r YH -t genome_set.txt -n default\n";
	cout << "  hirgc -m set -r YH -t genome_set.txt -n chr_name.txt\n";
}

// Assembly:
pushq %rbx
movq 0x4750(%rip), %rbx      # 0x7fd8
leaq 0x1948(%rip), %rsi      # 0x51d7
movq %rbx, %rdi
callq 0x2150
leaq 0x1945(%rip), %rsi      # 0x51e3
movq %rbx, %rdi
callq 0x2150
leaq 0x1973(%rip), %rsi      # 0x5220
movq %rbx, %rdi
callq 0x2150
leaq 0x19aa(%rip), %rsi      # 0x5266
movq %rbx, %rdi
callq 0x2150
leaq 0x19f3(%rip), %rsi      # 0x52be
movq %rbx, %rdi
callq 0x2150
leaq 0x1a4e(%rip), %rsi      # 0x5328
movq %rbx, %rdi
callq 0x2150
leaq 0x1a84(%rip), %rsi      # 0x536d
movq %rbx, %rdi
callq 0x2150
leaq 0x1a80(%rip), %rsi      # 0x5378
movq %rbx, %rdi
callq 0x2150
leaq 0x1aa0(%rip), %rsi      # 0x53a7
movq %rbx, %rdi
callq 0x2150
leaq 0x1abd(%rip), %rsi      # 0x53d3
movq %rbx, %rdi
callq 0x2150
leaq 0x1adf(%rip), %rsi      # 0x5404
movq %rbx, %rdi
callq 0x2150
leaq 0x1b03(%rip), %rsi      # 0x5437
movq %rbx, %rdi
popq %rbx
jmp 0x2150
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: initial()
inline void initial() { // malloc momories
	meta_data = new char[1024];
	pos_vec = new POSITION_RANGE[min_size];
	line_break_vec = new int[1<<23];
	n_vec = new  POSITION_RANGE[min_size];
	other_char_vec = new POSITION_OTHER_CHAR[min_size];

	tar_seq_code = new int[MAX_CHAR_NUM];
	ref_seq_code = new int[MAX_CHAR_NUM];

	loc = new int[MAX_CHAR_NUM];
	point = new int[max_arr_num];

	dismatched_str = new char[min_size];
}

// Assembly:
pushq %rax
movl $0x400, %edi            # imm = 0x400
callq 0x2030
movq %rax, 0x4419(%rip)      # 0x8178
movl $0x800000, %edi         # imm = 0x800000
callq 0x2030
movq %rax, 0x4410(%rip)      # 0x8180
movl $0x2000000, %edi        # imm = 0x2000000
callq 0x2030
movq %rax, 0x4417(%rip)      # 0x8198
movl $0x800000, %edi         # imm = 0x800000
callq 0x2030
movq %rax, 0x43f6(%rip)      # 0x8188
movl $0x800000, %edi         # imm = 0x800000
callq 0x2030
movq %rax, 0x43ed(%rip)      # 0x8190
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x2030
movq %rax, 0x43ec(%rip)      # 0x81a0
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x2030
movq %rax, 0x43e3(%rip)      # 0x81a8
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x2030
movq %rax, 0x43fa(%rip)      # 0x81d0
movabsq $0x100000000, %rdi      # imm = 0x100000000
callq 0x2030
movq %rax, 0x43ec(%rip)      # 0x81d8
movl $0x100000, %edi         # imm = 0x100000
callq 0x2030
movq %rax, 0x43e3(%rip)      # 0x81e0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: compressFile(char*, char*, char*)
inline void compressFile(char *refFile, char *tarFile, char *resFile) {
	readRefFile(refFile);
	preProcessRef();
	readTarFile(tarFile);
	searchMatch(resFile);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
callq 0x2773
callq 0x2fba
movq %r14, %rdi
callq 0x2888
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3053
// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: clear()
inline void clear() { // free
	delete[] meta_data;
	delete[] pos_vec;
	delete[] line_break_vec;
	delete[] n_vec;
	delete[] other_char_vec;
	delete[] tar_seq_code;
	delete[] ref_seq_code;
	delete[] loc;
	delete[] point;
	delete[] dismatched_str;
}

// Assembly:
pushq %rax
movq 0x4346(%rip), %rdi      # 0x8178
testq %rdi, %rdi
je 0x3e3c
callq 0x21a0
movq 0x433d(%rip), %rdi      # 0x8180
testq %rdi, %rdi
je 0x3e4d
callq 0x21a0
movq 0x4344(%rip), %rdi      # 0x8198
testq %rdi, %rdi
je 0x3e5e
callq 0x21a0
movq 0x4323(%rip), %rdi      # 0x8188
testq %rdi, %rdi
je 0x3e6f
callq 0x21a0
movq 0x431a(%rip), %rdi      # 0x8190
testq %rdi, %rdi
je 0x3e80
callq 0x21a0
movq 0x4319(%rip), %rdi      # 0x81a0
testq %rdi, %rdi
je 0x3e91
callq 0x21a0
movq 0x4310(%rip), %rdi      # 0x81a8
testq %rdi, %rdi
je 0x3ea2
callq 0x21a0
movq 0x4327(%rip), %rdi      # 0x81d0
testq %rdi, %rdi
je 0x3eb3
callq 0x21a0
movq 0x431e(%rip), %rdi      # 0x81d8
testq %rdi, %rdi
je 0x3ec4
callq 0x21a0
movq 0x4315(%rip), %rdi      # 0x81e0
testq %rdi, %rdi
je 0x3ed6
popq %rax
jmp 0x21a0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/conversions.cpp
// Function: test(char const*)
void test(const char *str) {
   Reader::Error err;
   int res = 0;
   double x = 0;
   string s;
   short b = 0;

   outs("input")(str)();
   //~ Writer("/tmp/tmp.tmp")(str);
   //~ Reader s1("/tmp/tmp.tmp");
   StrReader s1(str);
   s1 (res)(x)(s)(b)(err);
   outs("output")(res)(x)(s)(b)();
   outs("error")(err.msg)();

}

// Assembly:
pushq %r14
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
leaq 0x40(%rsp), %rbx
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
andl $0x0, 0xc(%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
andw $0x0, 0xa(%rsp)
leaq 0x4cb8(%rip), %rdi      # 0x7230
leaq 0x1ab3(%rip), %rsi      # 0x4032
xorl %edx, %edx
callq 0x275a
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x275a
movq %rax, %rdi
callq 0x3b12
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x349a
leaq 0x68(%rsp), %rdi
leaq 0xc(%rsp), %rsi
xorl %edx, %edx
callq 0x3088
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x3008
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x2d5e
leaq 0xa(%rsp), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x311c
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x2fd8
leaq 0x4c36(%rip), %rdi      # 0x7230
leaq 0x1a37(%rip), %rsi      # 0x4038
xorl %edx, %edx
callq 0x275a
movl 0xc(%rsp), %esi
movq %rax, %rdi
xorl %edx, %edx
callq 0x276c
movsd 0x10(%rsp), %xmm0
movq %rax, %rdi
xorl %esi, %esi
callq 0x277c
movq 0x18(%rsp), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x275a
movswl 0xa(%rsp), %esi
movq %rax, %rdi
xorl %edx, %edx
callq 0x276c
movq %rax, %rdi
callq 0x3b12
leaq 0x4bdd(%rip), %rdi      # 0x7230
leaq 0x19e5(%rip), %rsi      # 0x403f
xorl %edx, %edx
callq 0x275a
movq 0x40(%rsp), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x275a
movq %rax, %rdi
callq 0x3b12
leaq 0x68(%rsp), %rdi
callq 0x2972
leaq 0x18(%rsp), %rdi
callq 0x2288
movq %rbx, %rdi
callq 0x2288
addq $0xb8, %rsp
popq %rbx
popq %r14
retq
jmp 0x26a1
movq %rax, %r14
jmp 0x26b3
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x2972
leaq 0x18(%rsp), %rdi
callq 0x2288
movq %rbx, %rdi
callq 0x2288
movq %r14, %rdi
callq 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/conversions.cpp
// Function: main
int main()
{
   outs.sep(' '); // DEFAULT

   test("10 4.2 boo 34");
   test("10 4.2 boo 344455555");
   test("10 x4.2 boo 23");
   test("x10 4.2 boo 52");
   test("10 4.2");

   return 0;
}

// Assembly:
pushq %rax
leaq 0x4b5b(%rip), %rdi      # 0x7230
pushq $0x20
popq %rsi
callq 0x3ad0
leaq 0x1961(%rip), %rdi      # 0x4045
callq 0x252c
leaq 0x1963(%rip), %rdi      # 0x4053
callq 0x252c
leaq 0x196c(%rip), %rdi      # 0x4068
callq 0x252c
leaq 0x196f(%rip), %rdi      # 0x4077
callq 0x252c
leaq 0x1972(%rip), %rdi      # 0x4086
callq 0x252c
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*)
bool Reader::open(const std::string& file, const char *how) {
    in = fopen(file.c_str(),how);
    bad = errno;
    if (bad) {
        err_msg = strerror(errno);
    }
    return ! bad;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %rdi
movq %rdx, %rsi
callq 0x2180
movq %rax, 0x8(%rbx)
callq 0x2040
movl (%rax), %edi
movl %edi, 0x1c(%rbx)
testl %edi, %edi
je 0x291b
callq 0x2090
leaq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x2250
cmpl $0x0, 0x1c(%rbx)
sete %al
jmp 0x291d
movb $0x1, %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::set(_IO_FILE*, bool)
void Reader::set(FILE *new_in, bool own) {
  close();
  in = new_in;
  owner = own;
  pos = 0;
  bad = in == nullptr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
callq 0x299a
movq %r14, 0x8(%r15)
movb %bl, 0x10(%r15)
andl $0x0, 0x18(%r15)
xorl %eax, %eax
testq %r14, %r14
sete %al
movl %eax, 0x1c(%r15)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, char const*)
Reader& Reader::operator() (std::string &s,const char *fmt) {
  if (fail()) return *this;
  char buff[line_size];
  if (! formatted_read("string","%s%n",fmt,buff,&fpos)) return *this;
  s = buff;
  return *this;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
cmpl $0x0, 0x1c(%rdi)
jne 0x2da7
movq %rdx, %rcx
movq %rsi, %r14
leaq 0x14(%rbx), %r9
leaq 0x13cd(%rip), %rsi      # 0x414f
leaq 0x13cd(%rip), %rdx      # 0x4156
movq %rsp, %r8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2a74
cmpl $0x0, 0x1c(%rbx)
jne 0x2da7
movq %rsp, %rsi
movq %r14, %rdi
callq 0x2250
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::conversion_error(char const*, unsigned long, bool)
Reader& Reader::conversion_error(const char *kind, uint64_t val, bool was_unsigned) {
   bad = ERANGE;
   std::string msg = "error converting " + std::string(kind) + " out of range ";
   if (was_unsigned) {
      msg += std::to_string(val);
   } else {
      msg += std::to_string((int64_t)val);
   }
   set_error(msg,1);
   return *this;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rdi, %rbx
movl $0x22, 0x1c(%rdi)
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x271e
leaq 0x1303(%rip), %rsi      # 0x40e6
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x3550
leaq 0x12ff(%rip), %rdx      # 0x40f8
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3574
leaq 0x10(%rsp), %rdi
callq 0x2288
leaq 0x50(%rsp), %rdi
callq 0x2288
testb %bpl, %bpl
je 0x2e3f
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x35b2
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2270
jmp 0x2e5b
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x35f4
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2270
leaq 0x10(%rsp), %rdi
callq 0x2288
leaq 0x20(%rbx), %rdi
leaq 0x30(%rsp), %rsi
callq 0x20c0
movl $0x1, 0x1c(%rbx)
leaq 0x30(%rsp), %rdi
callq 0x2288
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x2e92
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2288
jmp 0x2ea8
jmp 0x2ea5
jmp 0x2ea5
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x2ec6
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2288
jmp 0x2ec1
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2288
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
jmp 0x2ecb
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::read_line(char*, int)
int Reader::read_line(char *buff, int buffsize) {
  char *res = read_raw_line(buff,buffsize);
  if (res == nullptr) {
     set_error("EOF",EOF);
     return 0;
  }
  int sz = res != nullptr ? strlen(res) : 0;
  pos += sz;
  return sz;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x10(%rax)
testq %rax, %rax
je 0x2f1e
movq %rax, %rdi
callq 0x20b0
addl %eax, 0x18(%rbx)
jmp 0x2f53
leaq 0x11e2(%rip), %rsi      # 0x4107
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x271e
leaq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x20c0
orl $-0x1, 0x1c(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x2288
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2288
movq %rbx, %rdi
callq 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::readall(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool Reader::readall (std::string& s) {
  char buff[512];
  size_t sz;
  s.clear();
  while ((sz = read(buff,sizeof(buff))) > 0) {
     s.append(buff,sz);
  }
  return errno != 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %rbx
andq $0x0, 0x8(%rsi)
movq %rdi, %r14
movq (%rsi), %rax
movb $0x0, (%rax)
movq %rsp, %r15
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movl $0x200, %edx            # imm = 0x200
callq *0x18(%rax)
testq %rax, %rax
je 0x2fb6
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2050
jmp 0x2f90
callq 0x2040
cmpl $0x0, (%rax)
setne %al
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::operator()(int&, char const*)
Reader& Reader::operator() (int32_t &i,const char *fmt) {
   int64_t val;
   if (! (*this)(val)) return *this;
   if (val < INT32_MIN || val > INT32_MAX) return conversion_error("int32",val,false);
   i = (int16_t)val;
   return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
xorl %edx, %edx
callq 0x3048
cmpl $0x0, 0x1c(%rbx)
jne 0x30c7
movq (%rsp), %rdx
movslq %edx, %rax
cmpq %rdx, %rax
je 0x30c1
leaq 0x1082(%rip), %rsi      # 0x4137
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x2db6
jmp 0x30c7
movswl %dx, %eax
movl %eax, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::operator()(unsigned int&, char const*)
Reader& Reader::operator() (uint32_t &i,const char *fmt) {
   uint64_t val;
   if (! (*this)(val)) return *this;
   if (val > UINT32_MAX) return conversion_error("uint32",val,true);
   i = (uint32_t)val;
   return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
xorl %edx, %edx
callq 0x3068
cmpl $0x0, 0x1c(%rbx)
jne 0x3110
movq (%rsp), %rdx
movq %rdx, %rax
shrq $0x20, %rax
je 0x310d
leaq 0x1036(%rip), %rsi      # 0x4136
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x2db6
jmp 0x3110
movl %edx, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::operator()(short&, char const*)
Reader& Reader::operator() (int16_t &i,const char *fmt) {
   int64_t val;
   if (! (*this)(val)) return *this;
   if (val < INT16_MIN || val > INT16_MAX) return conversion_error("int16",val,false);
   i = (int16_t)val;
   return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
xorl %edx, %edx
callq 0x3048
cmpl $0x0, 0x1c(%rbx)
jne 0x315a
movq (%rsp), %rdx
movswq %dx, %rax
cmpq %rdx, %rax
je 0x3156
leaq 0xff4(%rip), %rsi       # 0x413e
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x2db6
jmp 0x315a
movw %dx, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::operator()(unsigned short&, char const*)
Reader& Reader::operator() (uint16_t &i,const char *fmt) {
   uint64_t val;
   if (! (*this)(val)) return *this;
   if (val > UINT16_MAX) return conversion_error("uint16",val,true);
   i = (uint16_t)val;
   return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
xorl %edx, %edx
callq 0x3068
cmpl $0x0, 0x1c(%rbx)
jne 0x31a5
movq (%rsp), %rdx
cmpq $0x10000, %rdx          # imm = 0x10000
jb 0x31a1
leaq 0xfa9(%rip), %rsi       # 0x413d
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x2db6
jmp 0x31a5
movw %dx, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::operator()(unsigned char&, char const*)
Reader& Reader::operator() (uint8_t &i,const char *fmt) {
   uint64_t val;
   if (! (*this)(val)) return *this;
   if (val > UINT8_MAX) return conversion_error("uchar",val,true);
   i = (uint8_t)val;
   return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
xorl %edx, %edx
callq 0x3068
cmpl $0x0, 0x1c(%rbx)
jne 0x320e
movq (%rsp), %rdx
cmpq $0x100, %rdx            # imm = 0x100
jb 0x320b
leaq 0xf4b(%rip), %rsi       # 0x4149
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x2db6
jmp 0x320e
movb %dl, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::skip(int)
Reader& Reader::skip(int lines) {
  if (fail()) return *this;
  int i = 0;
  char buff[line_size];
  while (i < lines && read_line(buff,line_size) > 0) {
     ++i;
  }
  return *this;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
cmpl $0x0, 0x1c(%rdi)
jne 0x3272
xorl %ebp, %ebp
testl %esi, %esi
cmovgl %esi, %ebp
incl %ebp
movq %rsp, %r14
decl %ebp
je 0x3272
movq %rbx, %rdi
movq %r14, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2efc
testl %eax, %eax
jg 0x325a
movq %rbx, %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::getline(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
Reader& Reader::getline(std::string& s) {
  if (fail()) return *this;
  char buff[line_size];
  s.clear();
  int n = read_line(buff,line_size);
  while (n > 1) {
    if (buff[n-1]=='\n') {
       --n;
       buff[n] = 0; // trim \n
       s.append(buff,n);
       break;
    } else {
       s.append(buff,n);
    }
    n = read_line(buff,line_size);
  }
  return *this;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
cmpl $0x0, 0x1c(%rdi)
jne 0x32e4
movq %rsi, %r14
andq $0x0, 0x8(%rsi)
movq (%rsi), %rax
movb $0x0, (%rax)
movq %rsp, %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2efc
cmpl $0x2, %eax
jl 0x32e4
leal -0x1(%rax), %edx
cmpb $0xa, (%rsp,%rdx)
je 0x32d5
movl %eax, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2050
jmp 0x32a8
movb $0x0, (%rsp,%rdx)
movq %rsp, %rsi
movq %r14, %rdi
callq 0x2050
movq %rbx, %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::Reader::getlineinfo(long)
Reader::LineInfo Reader::getlineinfo (long p) {
    if (p == -1)
        p = pos;
    setpos(0,'^');
    pos = 0;
    char buff[line_size];
    int last_pos, lineno = 1;
    read_line(buff,line_size);
    while (pos < p) {
        lineno++;
        last_pos = pos;
        read_line(buff,line_size);
    }
    int col = p - last_pos;
    setpos(p,'^');
    return {lineno, col};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
cmpq $-0x1, %rsi
movslq 0x18(%rdi), %r14
cmovneq %rsi, %r14
movq (%rdi), %rax
xorl %r12d, %r12d
pushq $0x5e
popq %rdx
xorl %esi, %esi
callq *0x28(%rax)
andl $0x0, 0x18(%rbx)
movq %rsp, %r15
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2efc
movslq 0x18(%rbx), %rax
incq %r12
cmpq %rax, %r14
jg 0x3327
movl %r14d, %r15d
subl %ebp, %r15d
movq (%rbx), %rax
pushq $0x5e
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x28(%rax)
shlq $0x20, %r15
addq %r12, %r15
movq %r15, %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/instream.cpp
// Function: stream::StrReader::read_raw_line(char*, int)
char *StrReader::read_raw_line(char *buff, int buffsize) {
    char *P = buff;
    const char *Q = pc+pos;
    int i = 1;
    while (*Q != '\n' && i < buffsize && *Q != 0) {
        *P++ = *Q++;
        ++i;
    }
    *P = 0;
    return buff;
}

// Assembly:
movq %rsi, %rax
movslq 0x18(%rdi), %rcx
addq 0x40(%rdi), %rcx
xorl %esi, %esi
leal 0x1(%rsi), %edi
cmpl %edx, %edi
jge 0x351e
movb (%rcx,%rsi), %dil
movzbl %dil, %r8d
testl %r8d, %r8d
je 0x351e
cmpl $0xa, %r8d
je 0x351e
movb %dil, (%rax,%rsi)
incq %rsi
jmp 0x34fb
movb $0x0, (%rax,%rsi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/outstream.cpp
// Function: stream::Writer::sep_out()
void Writer::sep_out() {
    if (eoln) {
        eoln = false;
    } else {
        if (sepc != next_sepc) {
            next_sepc = sepc;
        }
        if (next_sepc) {
            write_char(next_sepc);
        }
        next_sepc = sepc;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x11(%rdi)
jne 0x38a0
movb $0x0, 0x11(%rbx)
jmp 0x38c4
movb 0x10(%rbx), %al
cmpb 0x14(%rbx), %al
je 0x38ab
movb %al, 0x14(%rbx)
testb %al, %al
je 0x38bf
movq (%rbx), %rcx
movsbl %al, %esi
movq %rbx, %rdi
callq *(%rcx)
movb 0x10(%rbx), %al
jmp 0x38c1
xorl %eax, %eax
movb %al, 0x14(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/outstream.cpp
// Function: stream::Writer::formatted_write(char const*, char const*, ...)
Writer& Writer::formatted_write(const char *def, const char *fmt,...) {
    char copy_def[30];
    if (fmt!=nullptr && fmt[1]==0) { // one-character special shortcut format codes
        if (def[1] == 's') { // 'quote' or "quote" strings
            if (fmt[0] == 'q') fmt = "'%s'"; else
            if (fmt[0] == 'Q') fmt = "\"%s\"";
        } else {
            if (fmt[0] == 'x' || fmt[0] == 'X') { // numbers as hex
                const char *in = def;
                char *out = copy_def;
                while (*(in+1))  *out++ = *in++;
                if (*in == 'c') { // special case - characters as bytes
                    *out++ = 'h';   *out++ = 'h';
                }
                *out++ = fmt[0];
                *out = 0;
                fmt = copy_def;
            } else {
                fmt = nullptr;
            }
        }
    }
    sep_out();
    va_list ap;
    va_start(ap,fmt);
    write_out(fmt ? fmt : def,ap);
    va_end(ap);
    return *this;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xf0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, 0x58(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x68(%rsp)
testb %al, %al
je 0x3928
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
testq %rdx, %rdx
je 0x3977
movq %rdx, %r15
cmpb $0x0, 0x1(%rdx)
jne 0x397a
movb 0x1(%r14), %dl
movb (%r15), %al
cmpb $0x73, %dl
jne 0x3953
cmpb $0x71, %al
jne 0x39e5
leaq 0x918(%rip), %r15       # 0x4269
jmp 0x397a
movzbl %al, %ecx
orl $0x20, %ecx
cmpl $0x78, %ecx
jne 0x3977
movq %rsp, %rcx
movq %r14, %rsi
testb %dl, %dl
je 0x39cc
movb (%rsi), %dl
movb %dl, (%rcx)
movb 0x2(%rsi), %dl
incq %rsi
incq %rcx
jmp 0x3964
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x3890
leaq 0x40(%rsp), %rax
leaq 0x20(%rsp), %rdx
movq %rax, 0x10(%rdx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rdx)
testq %r15, %r15
cmovneq %r15, %r14
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rax)
movq %rbx, %rax
addq $0xf0, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpb $0x63, (%rsi)
jne 0x39da
movw $0x6868, (%rcx)         # imm = 0x6868
addq $0x2, %rcx
movb %al, (%rcx)
movb $0x0, 0x1(%rcx)
movq %rsp, %r15
jmp 0x397a
cmpb $0x51, %al
leaq 0x880(%rip), %rax       # 0x426e
cmoveq %rax, %r15
jmp 0x397a
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/outstream.cpp
// Function: stream::Writer::sep(int)
Writer& Writer::sep(int ch) {
    if (ch == -1) {
        sepc = old_sepc;
    } else {
        old_sepc = sepc;
        sepc = ch;
    }
    return *this;
}

// Assembly:
movq %rdi, %rax
cmpl $-0x1, %esi
je 0x3ae3
movb 0x10(%rax), %cl
movb %cl, 0x13(%rax)
movb %sil, 0x10(%rax)
retq
movb 0x13(%rax), %cl
movb %cl, 0x10(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O2/stevedonovan[P]outstreams/outstream.cpp
// Function: stream::BufWriter::write_out(char const*, __va_list_tag*)
void BufWriter::write_out(const char *fmt, va_list ap) {
    int nch = vsnprintf(P,sizeof(buf),fmt,ap);
    char *next = P + nch;
    if (next < P_end) {
        P = next;
    } else {
        out = nullptr;
    }
}

// Assembly:
pushq %rbx
movq %rdx, %rcx
movq %rsi, %rdx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movl $0x80, %esi
callq 0x20d0
cltq
addq 0x18(%rbx), %rax
cmpq 0x20(%rbx), %rax
jae 0x3cbe
movq %rax, 0x18(%rbx)
jmp 0x3cc3
andq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/wichtounet[P]articles/src/threads/part2/Unsafe.cpp
// Function: main
int main(){
    Counter counter;

    std::vector<std::thread> threads;
    for(int i = 0; i < 5; ++i){
        threads.push_back(std::thread([&counter](){
            for(int i = 0; i < 100; ++i){
                counter.increment();
            }
        }));
    }

    for(auto& thread : threads){
        thread.join();
    }

    std::cout << counter.value << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x20(%rsp), %rbx
vxorps %xmm0, %xmm0, %xmm0
andq $0x0, 0x10(%rbx)
vmovaps %xmm0, (%rbx)
pushq $0x5
popq %rbp
leaq 0x2b12(%rip), %r13      # 0x3d88
leaq 0x14(%rsp), %r14
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
subl $0x1, %ebp
jb 0x12d6
andq $0x0, 0x18(%rsp)
pushq $0x10
popq %rdi
callq 0x10d0
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x10b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x12c1
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13ec
movq %r15, %rdi
callq 0x137e
jmp 0x1285
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r14
cmpq %r14, %rbx
je 0x12f3
movq %rbx, %rdi
callq 0x10f0
addq $0x8, %rbx
jmp 0x12e0
movl 0x14(%rsp), %esi
movq 0x2cda(%rip), %rdi      # 0x3fd8
callq 0x1100
movq %rax, %rdi
callq 0x1070
leaq 0x20(%rsp), %rdi
callq 0x138c
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x132a
jmp 0x132a
movq %rax, %rbx
jmp 0x1351
movq 0x8(%rsp), %rdi
movq %rax, %rbx
testq %rdi, %rdi
je 0x1351
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1351
leaq 0x18(%rsp), %rdi
movq %rax, %rbx
callq 0x137e
leaq 0x20(%rsp), %rdi
callq 0x138c
movq %rbx, %rdi
callq 0x1110
nop