// File: chhylp123[P]hifiasm/main.cpp
// Function: main
int main(int argc, char *argv[])
{
	int i, ret;
	yak_reset_realtime();
    init_opt(&asm_opt);
    if (!CommandLine_process(argc, argv, &asm_opt)) return 0;
	
	// bit_extz_t exz, exz64; init_bit_extz_t(&exz, 2); init_bit_extz_t(&exz64, 2);
	
	// char *pstr = "GACCCAG", *tsrt = "GTTGTTAATTCCAT"; int32_t thre = 14; clear_align(exz); clear_align(exz64);
	// ed_band_cal_extension_64_0_w_trace((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz);
	// // // ed_band_cal_semi_64_w_absent_diag((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, 0, &exz);
	// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz.ps::%d, exz.pe::%d, exz.ts::%d, exz.te::%d\n", __func__, 
    //         exz.err, exz.ps, exz.pe, exz.ts, exz.te);
	// cigar_check((char*)pstr, (char*)tsrt, &(exz));
	// ed_band_cal_extension_64_0_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz);
	// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz.ps::%d, exz.pe::%d, exz.ts::%d, exz.te::%d\n", __func__, 
    //         exz.err, exz.ps, exz.pe, exz.ts, exz.te);
	// ed_band_cal_semi_infi_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, NULL, &exz);
	// ed_band_cal_semi_64_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
	// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__, 
    //         exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);
	// ed_band_cal_semi_64_w_trace((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
	// cigar_check((char*)pstr, (char*)tsrt, &(exz64));
	
	
	// char *pstr = "TGT", *tsrt = "CTGT"; int32_t thre = 1;
	// ed_band_cal_global_infi_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, NULL, &exz);
	// ed_band_cal_global_64_w((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
	// ed_band_cal_global_64_w_trace((char*)pstr, strlen(pstr), (char*)tsrt, strlen(tsrt), thre, &exz64);
	// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__, 
    //         exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);
	// cigar_check((char*)pstr, (char*)tsrt, &(exz64));
	
	// ed_band_cal_extension_infi0_w((char *)"AAT", 3, (char *)"ACTTTTTT", 8, 2, NULL, &exz);
    // ed_band_cal_extension_64_w((char *)"AAT", 3, (char *)"ACTTTTTT", 8, 2, &exz64);
	// fprintf(stderr, "\n[M::%s::] exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__, 
    //         exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);

	//bit_extz_t exz; ///ed_band_cal_global_128bit(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
	// ed_band_cal_extension_128bit((char *)"AAGTTTA", 7, (char *)"CCTTTTTT", 8, 4, &exz);
	// ed_band_cal_extension_128bit((char *)"AA", 2, (char *)"ACTTTTTT", 8, 1, &exz);
	// fprintf(stderr, "ed_extension::%d, pe::%d, te::%d\n", exz.err, exz.pe, exz.te);
	// exit(1);
	
	

	// fprintf(stderr, "[M::%s::] ed_global::%d, ed_global_128bit::%d\n", __func__, 
	// ed_band_cal_global((char *)"ACT", 3, (char *)"AAT", 3, 1), 
	// ed_band_cal_global_128bit((char *)"ACT", 3, (char *)"AAT", 3, 1));

	// fprintf(stderr, "[M::%s::] ed_global::%d, ed_global_128bit::%d\n", __func__, 
	// ed_band_cal_global((char*)"ACTTTTTT", 8, (char*)"AATTTT", 6, 3),
	// ed_band_cal_global_128bit((char*)"ACTTTTTT", 8, (char*)"AATTTT", 6, 3));
	// exit(1);
	if(asm_opt.sec_in) ret = ha_assemble_pair();
	else if(asm_opt.dbg_ovec_cal) ret = ha_ec_dbg();
	else ret = ha_assemble();
	
    destory_opt(&asm_opt);
	fprintf(stderr, "[M::%s] Version: %s\n", __func__, HA_VERSION);
	fprintf(stderr, "[M::%s] CMD:", __func__);
	for (i = 0; i < argc; ++i)
		fprintf(stderr, " %s", argv[i]);
	fprintf(stderr, "\n[M::%s] Real time: %.3f sec; CPU: %.3f sec; Peak RSS: %.3f GB\n", __func__, yak_realtime(), yak_cputime(), yak_peakrss_in_gb());
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x1b7c40
leaq 0x46846(%rip), %rdi     # 0x3c47f8
callq 0x32d0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x46833(%rip), %rdx     # 0x3c47f8
callq 0x56d0
cmpl $0x0, %eax
jne 0x37dfdb
movl $0x0, -0x4(%rbp)
jmp 0x37e0f9
leaq 0x46816(%rip), %rax     # 0x3c47f8
cmpq $0x0, 0x70(%rax)
je 0x37dff3
callq 0x1b9b0
movl %eax, -0x18(%rbp)
jmp 0x37e017
leaq 0x467fe(%rip), %rax     # 0x3c47f8
cmpb $0x0, 0x25c(%rax)
je 0x37e00d
callq 0x16e50
movl %eax, -0x18(%rbp)
jmp 0x37e015
callq 0x1b440
movl %eax, -0x18(%rbp)
jmp 0x37e017
leaq 0x467da(%rip), %rdi     # 0x3c47f8
callq 0x3a70
movq 0x45fb6(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
leaq 0x1d55b(%rip), %rsi     # 0x39b58f
leaq 0x1d569(%rip), %rdx     # 0x39b5a4
leaq 0x3077(%rip), %rcx      # 0x3810b9
movb $0x0, %al
callq 0x22a0
movq 0x45f90(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
leaq 0x1d54f(%rip), %rsi     # 0x39b5a9
leaq 0x1d543(%rip), %rdx     # 0x39b5a4
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x37e0a6
movq 0x45f62(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1d522(%rip), %rsi     # 0x39b5b6
movb $0x0, %al
callq 0x22a0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x37e06f
movq 0x45f33(%rip), %rax     # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x1b7ca0
movsd %xmm0, -0x20(%rbp)
callq 0x1b7be0
movsd %xmm0, -0x28(%rbp)
callq 0x1b7d00
movq -0x30(%rbp), %rdi
movsd -0x28(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x20(%rbp), %xmm0
leaq 0x1d4d5(%rip), %rsi     # 0x39b5ba
leaq 0x1d4b8(%rip), %rdx     # 0x39b5a4
movb $0x3, %al
callq 0x22a0
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq