// File: /workspace/github_c_makefile_star2_O2/hcmiya[P]opuscomment/src/parse-tags.c
// Function: parse_tags
void *parse_tags(void* nouse_) {
	bool do_read = true;
	if (tagnum) {
		// -tでタグを追加した場合、-cが無ければstdinを使わない
		if (!O.tag_filename) {
			do_read = false;
		}
	}
	if (O.tag_filename && strcmp(O.tag_filename, "-") != 0) {
		from_file = true;
		edit_input = fopen(O.tag_filename, "r");
		if (!edit_input) {
			fileerror(O.tag_filename);
		}
	}
	else {
		edit_input = stdin;
	}
	
	if (do_read) {
		// UTF-8化された文字列をチャンク化する処理をスレッド化(化が多い)
		int pfd[2];
		pipe(pfd);
		FILE *fpu8 = fdopen(pfd[0], "r");
		pthread_t split_thread;
		void *(*split)(void*) = O.tag_escape == TAG_ESCAPE_NUL ? split_binary : split_text;
		pthread_create(&split_thread, NULL, split, fpu8);
		
		// 本スレッドはstdinをUTF-8化する
		toutf8(pfd[1]);
		pthread_join(split_thread, NULL);
	}
	
	struct edit_st *rtn = calloc(1, sizeof(*rtn));
	rtn->str = strstore;
	rtn->len = strcount;
	rtn->pict = flacpict;
	rtn->num = tagnum;
	return rtn;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1048, %rsp           # imm = 0x1048
leaq 0x195d6(%rip), %rax     # 0x1c688
movq 0x18(%rax), %rdi
testq %rdi, %rdi
je 0x30f7
cmpb $0x2d, (%rdi)
jne 0x30c6
cmpb $0x0, 0x1(%rdi)
je 0x311a
movb $0x1, 0x9493(%rip)      # 0xc560
leaq 0x4fa9(%rip), %rsi      # 0x807d
callq 0x23c0
movq %rax, 0x9488(%rip)      # 0xc568
testq %rax, %rax
jne 0x312b
leaq 0x1959c(%rip), %rax     # 0x1c688
movq 0x18(%rax), %rdi
callq 0x687e
jmp 0x312b
movq 0x945a(%rip), %rbx      # 0xc558
movq 0x8ec3(%rip), %rax      # 0xbfc8
movq (%rax), %rax
movq %rax, 0x9459(%rip)      # 0xc568
testq %rbx, %rbx
jne 0x336c
jmp 0x312b
movq 0x8ea7(%rip), %rax      # 0xbfc8
movq (%rax), %rax
movq %rax, 0x943d(%rip)      # 0xc568
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x21e0
movl (%rbx), %edi
leaq 0x4f3c(%rip), %rsi      # 0x807d
callq 0x2340
leaq 0x1953b(%rip), %r14     # 0x1c688
cmpl $0x2, 0x10(%r14)
leaq -0x23e(%rip), %rcx      # 0x2f1b
leaq -0x616(%rip), %rdx      # 0x2b4a
cmoveq %rcx, %rdx
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x2390
movl 0x4(%rbx), %ebx
cmpb $0x0, 0x15(%r14)
je 0x3186
leaq 0x4e80(%rip), %rsi      # 0x8004
jmp 0x3191
pushq $0xe
popq %rdi
callq 0x22f0
movq %rax, %rsi
leaq 0x840(%rsp), %r12
leaq 0x4e64(%rip), %rdi      # 0x8004
callq 0x289e
movq %rax, %r14
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
leaq 0x40(%rsp), %r15
xorl %eax, %eax
xorl %ebp, %ebp
leaq (%r12,%rax), %rdi
movl $0x800, %edx            # imm = 0x800
subq %rax, %rdx
movq 0x939b(%rip), %rcx      # 0xc568
pushq $0x1
popq %rsi
callq 0x20e0
testq %rax, %rax
je 0x32b2
movq %rax, %r13
addq %rax, %rbp
movq %rbp, 0x28(%rsp)
cmpq $0x7800001, %rbp        # imm = 0x7800001
jb 0x31fc
pushq $0xb
popq %rdi
xorl %eax, %eax
callq 0x6563
leaq 0x19485(%rip), %rax     # 0x1c688
cmpl $0x2, 0x10(%rax)
movq 0x8(%rsp), %rbp
je 0x3223
leaq (%r12,%rbp), %rdi
movq %r13, %rsi
callq 0x21b0
cmpq %r13, %rax
jne 0x33ad
addq %r13, %rbp
movq %rbp, 0x8(%rsp)
movq $0x800, 0x20(%rsp)      # imm = 0x800
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x20b0
movq %rax, %r13
callq 0x2050
movl (%rax), %ebp
cmpq $-0x1, %r13
jne 0x3286
cmpl $0x54, %ebp
jne 0x3274
callq 0x67b6
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x22a0
movq 0x18(%rsp), %rdx
subq %r15, %rdx
movl %ebx, %edi
movq %r15, %rsi
callq 0x2100
cmpq $-0x1, %r13
jne 0x32a3
cmpl $0x16, %ebp
jne 0x322b
movq 0x8(%rsp), %rax
movq 0x28(%rsp), %rbp
jmp 0x31ba
movq 0x92af(%rip), %rdi      # 0xc568
callq 0x2120
cmpl $-0x1, %eax
jne 0x32c8
callq 0x3ba2
cmpq $0x0, 0x8(%rsp)
je 0x32e0
callq 0x2050
movl $0x54, (%rax)
callq 0x3ba2
leaq 0x10(%rsp), %rcx
movq %r15, (%rcx)
leaq 0x20(%rsp), %r8
movq $0x800, (%r8)           # imm = 0x800
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x20b0
movq %rax, 0x8(%rsp)
cmpq $-0x1, %rax
jne 0x3310
callq 0x67b6
movq %r14, %rdi
callq 0x2370
movq 0x10(%rsp), %rdx
subq %r15, %rdx
movl %ebx, %edi
movq %r15, %rsi
callq 0x2100
movl %ebx, %edi
callq 0x21c0
testq %rbp, %rbp
jne 0x3359
leaq 0x1934b(%rip), %rax     # 0x1c688
cmpl $0x2, (%rax)
jne 0x3359
leaq 0x1933f(%rip), %rax     # 0x1c688
cmpb $0x1, 0x20(%rax)
jne 0x3359
pushq $0xc
popq %rdi
xorl %eax, %eax
callq 0x6563
movq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x2490
movq 0x91ec(%rip), %rbx      # 0xc558
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x2220
movq 0x91c2(%rip), %rcx      # 0xc540
movq %rcx, (%rax)
movq 0x91c0(%rip), %rcx      # 0xc548
movq %rcx, 0x8(%rax)
movq 0x91bd(%rip), %rcx      # 0xc550
movq %rcx, 0x10(%rax)
movq %rbx, 0x18(%rax)
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2ef6