// File: /workspace/github_c_makefile_star2_O0/aokad[P]sequeeze/seqtk.c
// Function: stk_randbase
int stk_randbase(int argc, char *argv[])
{
	gzFile fp;
	kseq_t *seq;
	int l;
	if (argc == 1) {
		fprintf(stderr, "Usage: seqtk randbase <in.fa>\n");
		return 1;
	}
	fp = (strcmp(argv[1], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[1], "r");
	if (fp == 0) {
		fprintf(stderr, "[E::%s] failed to open the input file/stream.\n", __func__);
		return 1;
	}
	seq = kseq_init(fp);
	while ((l = kseq_read(seq)) >= 0) {
		int i;
		printf(">%s", seq->name.s);
		for (i = 0; i < l; ++i) {
			int c, b, a, j, k, m;
			b = seq->seq.s[i];
			c = seq_nt16_table[b];
			a = bitcnt_table[c];
			if (a == 2) {
				m = (drand48() < 0.5);
				for (j = k = 0; j < 4; ++j) {
					if ((1<<j & c) == 0) continue;
					if (k == m) break;
					++k;
				}
				seq->seq.s[i] = islower(b)? "acgt"[j] : "ACGT"[j];
			}
			if (i%60 == 0) putchar('\n');
			putchar(seq->seq.s[i]);
		}
		putchar('\n');
	}
	kseq_destroy(seq);
	gzclose(fp);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0x43d9
movq 0xcc3c(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x918a(%rip), %rsi      # 0xd550
movb $0x0, %al
callq 0x2190
movl $0x1, -0x4(%rbp)
jmp 0x4610
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xa0ae(%rip), %rsi      # 0xe496
callq 0x2170
cmpl $0x0, %eax
jne 0x4415
movq 0xcbcf(%rip), %rax      # 0x10fc8
movq (%rax), %rdi
callq 0x21b0
movl %eax, %edi
leaq 0x8e76(%rip), %rsi      # 0xd280
callq 0x20b0
movq %rax, -0x48(%rbp)
jmp 0x442d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x8e5c(%rip), %rsi      # 0xd280
callq 0x2220
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x4467
movq 0xcbb5(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x902c(%rip), %rsi      # 0xd479
leaq 0x911b(%rip), %rdx      # 0xd56f
movb $0x0, %al
callq 0x2190
movl $0x1, -0x4(%rbp)
jmp 0x4610
movq -0x18(%rbp), %rdi
callq 0x38f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3930
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
jl 0x45f7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x90e4(%rip), %rdi      # 0xd57c
movb $0x0, %al
callq 0x20f0
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x45e8
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x30(%rbp)
movslq -0x30(%rbp), %rcx
leaq 0xcc90(%rip), %rax      # 0x11160
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movslq -0x2c(%rbp), %rcx
leaq 0xceae(%rip), %rax      # 0x11390
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jne 0x45ab
callq 0x2290
movaps %xmm0, %xmm1
movsd 0x8b16(%rip), %xmm0     # 0xd018
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
cmpl $0x4, -0x38(%rbp)
jge 0x4557
movl -0x38(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
andl -0x2c(%rbp), %eax
cmpl $0x0, %eax
jne 0x4539
jmp 0x454c
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jne 0x4543
jmp 0x4557
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x451f
callq 0x2280
movq (%rax), %rax
movslq -0x30(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x4585
movslq -0x38(%rbp), %rcx
leaq 0x9004(%rip), %rax      # 0xd580
movsbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
jmp 0x4597
movslq -0x38(%rbp), %rcx
leaq 0x8ff5(%rip), %rax      # 0xd585
movsbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movb %al, %dl
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
movl $0x3c, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x45c5
movl $0xa, %edi
callq 0x2050
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x2050
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x44a6
movl $0xa, %edi
callq 0x2050
jmp 0x4474
movq -0x20(%rbp), %rdi
callq 0x3d40
movq -0x18(%rbp), %rdi
callq 0x2030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)