// File: /workspace/github_c_makefile_star2_O3/hcmiya[P]opuscomment/src/main.c
// Function: parse_args
static void parse_args(int argc, char **argv) {
	int c;
	bool added_tag = false, del_tag = false;
	int gainfmt;
	double gv;
	
	while ((c = getopt(argc, argv, "01ac:C:d:Deg:hi:lpqQrRs:t:TUvVw~")) != -1) {
		switch (c) {
		case 'l':
			O.edit = EDIT_LIST;
			break;
			
		case 'w':
			O.edit = EDIT_WRITE;
			break;
			
		case 'a':
			O.edit = EDIT_APPEND;
			break;
			
		case 'h':
			usage();
			break;
			
		case 'g':
		case 's':
			gainfmt = c;
			O.gain_fix = true;
			{
				char *endp;
				gv = strtod(optarg, &endp);
				if (optarg == endp) {
					fail_to_parse(c);
				}
				if (!isfinite(gv)) {
					out_of_range(c);
				}
				if (gv > 65536 || gv < -65536) {
					out_of_range(c);
				}
			}
			break;
			
		case 'r':
			O.gain_relative = true;
			break;
			
		case 'Q':
			O.gain_q78 = true;
			break;
			
		case '1':
			O.gain_not_zero = true;
			break;
			
		case 'p':
			O.tag_ignore_picture = true;
			break;
			
		case 'R':
			O.tag_raw = true;
			break;
			
		case '~':
			O.tag_escape_tilde = true;
			break;
			
		case 'e':
			O.tag_escape = TAG_ESCAPE_BACKSLASH;
			break;
			
		case '0':
			O.tag_escape = TAG_ESCAPE_NUL;
			break;
			
		case 'U':
			O.tag_toupper = true;
			break;
			
		case 'v':
			O.gain_put = true;
			break;
			
		case 'c':
			O.tag_filename = optarg;
			break;
		
		case 't':
			parse_opt_tag(c, optarg);
			added_tag = true;
			break;
			
		case 'd':
			parse_opt_tag(c, optarg);
			del_tag = true;
			break;
			
		case 'D':
			O.tag_deferred = true;
			O.tag_verify = true;
			O.tag_check_line_term = true;
			break;
		case 'T':
			O.tag_check_line_term = true;
			break;
		case 'V':
			O.tag_verify = true;
			break;
		case 'i':
			{
				char *endp;
				unsigned long val = strtoul(optarg, &endp, 10);
				if (endp == optarg || *endp != '\0') {
					fail_to_parse(c);
				}
				if (errno == ERANGE || val == 0 || val > INT_MAX) {
					out_of_range(c);
				}
				O.target_idx = (int)val;
			}
			break;
			
		case 'q':
			// 何もしない
			break;
			
		case 'C':
			if (!select_codec_by_name(optarg)) {
				opterror(c, catgets(catd, 7, 4, "unknown codec \"%s\""), optarg);
			}
			break;
			
		case '?':
			exit(1);
			break;
		}
	}
	// オプションループ抜け
	if (del_tag || added_tag) {
		pticonv_close();
	}
	if (del_tag) {
		switch (O.edit) {
		case EDIT_NONE:
			O.edit = EDIT_APPEND;
			break;
		case EDIT_APPEND:
			break;
		default:
			mainerror(err_main_del_without_a);
		}
	}
	if (added_tag && O.edit == EDIT_LIST) {
		mainerror(err_main_tag_with_l);
	}
	if (added_tag && !O.edit) {
		mainerror(err_main_tag_without_aw);
	}
	if (!O.gain_fix && !O.edit) {
		O.edit = EDIT_LIST;
	}
	else if (O.gain_fix) {
		switch (gainfmt) {
		case 'g':
			if (O.gain_q78) {
				O.gain_val = (int)trunc(gv);
			}
			else {
				O.gain_val = (int)trunc(gv * 256);
			}
			break;
		case 's':
			if (gv <= 0) {
				out_of_range(gainfmt);
			}
			O.gain_val = (int)trunc(20 * log10(gv) * 256);
			break;
		}
		O.gain_val_sign = signbit(gv);
		if (!O.gain_relative && (O.gain_val > 32767 || O.gain_val < -32768)) {
			out_of_range(gainfmt);
		}
		
		if (O.edit == EDIT_LIST) {
			mainerror(err_main_gain_with_l);
		}
		else if (!O.edit) {
			if (O.tag_filename/* || added_tag*/) {
				mainerror(err_main_tag_without_aw);
			}
		}
	}
	if (O.edit == EDIT_APPEND) {
		O.tag_ignore_picture = false;
	}
	if (codec->prog) {
		O.gain_fix = false;
		O.gain_put = false;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movl %edi, %ebp
movl $0x0, 0xc(%rsp)
leaq 0x17e6(%rip), %r15      # 0x8df0
movq 0x49c7(%rip), %r13      # 0xbfd8
leaq 0xf20(%rip), %rbx       # 0x8538
movl $0x0, 0x10(%rsp)
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x23f0
movl %eax, %r12d
cmpl $0x42, %eax
jle 0x7735
leal -0x51(%r12), %eax
cmpl $0x2d, %eax
ja 0x7766
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movb $0x1, 0x15035(%rip)     # 0x1c68c
movq (%r13), %rdi
leaq 0x18(%rsp), %rsi
callq 0x20f0
movq (%r13), %rax
cmpq 0x18(%rsp), %rax
movdqa %xmm0, 0x20(%rsp)
jne 0x76a6
movq 0x15003(%rip), %rdi     # 0x1c680
movl $0x7, %esi
movl $0x1, %edx
leaq 0x1796(%rip), %rcx      # 0x8e24
callq 0x2440
movl %r12d, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
movdqa 0x20(%rsp), %xmm0
movq %xmm0, %rax
btrq $0x3f, %rax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jl 0x76ef
movq 0x14fba(%rip), %rdi     # 0x1c680
movl $0x7, %esi
movl $0x2, %edx
leaq 0x1763(%rip), %rcx      # 0x8e3a
callq 0x2440
movl %r12d, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
movdqa 0x20(%rsp), %xmm0
pand 0xe19(%rip), %xmm0      # 0x8510
ucomisd 0xe21(%rip), %xmm0      # 0x8520
jbe 0x772b
movq 0x14f78(%rip), %rdi     # 0x1c680
movl $0x7, %esi
movl $0x2, %edx
leaq 0x1721(%rip), %rcx      # 0x8e3a
callq 0x2440
movl %r12d, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
movl %r12d, 0x14(%rsp)
jmp 0x7620
cmpl $0x30, %r12d
jg 0x7750
jne 0x7961
movl $0x2, 0x14f4d(%rip)     # 0x1c698
jmp 0x7620
cmpl $0x31, %r12d
jne 0x796d
movb $0x1, 0x14f2d(%rip)     # 0x1c68e
jmp 0x7620
cmpl $0x43, %r12d
je 0x791b
cmpl $0x44, %r12d
jne 0x7620
movw $0x101, 0x14f25(%rip)   # imm = 0x101
movb $0x1, 0x14f20(%rip)     # 0x1c6aa
jmp 0x7620
movb $0x1, 0x14f06(%rip)     # 0x1c69c
jmp 0x7620
movq (%r13), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x2410
movq %rax, %r12
movq 0x18(%rsp), %rax
cmpq (%r13), %rax
je 0x77c1
cmpb $0x0, (%rax)
je 0x77ed
movq 0x14eb8(%rip), %rdi     # 0x1c680
movl $0x7, %esi
movl $0x1, %edx
leaq 0x164b(%rip), %rcx      # 0x8e24
callq 0x2440
movl $0x69, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
callq 0x2050
cmpl $0x22, (%rax)
sete %al
leaq -0x80000000(%r12), %rcx
cmpq $-0x7fffffff, %rcx      # imm = 0x80000001
setb %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x783d
movq 0x14e68(%rip), %rdi     # 0x1c680
movl $0x7, %esi
movl $0x2, %edx
leaq 0x1611(%rip), %rcx      # 0x8e3a
callq 0x2440
movl $0x69, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
movl %r12d, 0x14e68(%rip)    # 0x1c6ac
jmp 0x7620
movb $0x1, 0x14e46(%rip)     # 0x1c696
jmp 0x7620
movb $0x1, 0x14e4d(%rip)     # 0x1c6a9
jmp 0x7620
movl $0x1, 0x14e1d(%rip)     # 0x1c688
jmp 0x7620
movl $0x2, 0x14e0e(%rip)     # 0x1c688
jmp 0x7620
movb $0x1, 0x14e17(%rip)     # 0x1c69d
jmp 0x7620
movb $0x1, 0x14e0c(%rip)     # 0x1c69e
jmp 0x7620
movq (%r13), %rsi
movl $0x64, %edi
callq 0x3642
movb $0x1, %al
movl %eax, 0x10(%rsp)
jmp 0x7620
movb $0x1, 0x14dd8(%rip)     # 0x1c68f
jmp 0x7620
movq (%r13), %rsi
movl $0x74, %edi
callq 0x3642
movb $0x1, %al
movl %eax, 0xc(%rsp)
jmp 0x7620
movl $0x3, 0x14da9(%rip)     # 0x1c688
jmp 0x7620
movq (%r13), %rax
movq %rax, 0x14db1(%rip)     # 0x1c6a0
jmp 0x7620
movl $0x1, 0x14d9a(%rip)     # 0x1c698
jmp 0x7620
movb $0x1, 0x14d83(%rip)     # 0x1c68d
jmp 0x7620
movb $0x1, 0x14d7f(%rip)     # 0x1c695
jmp 0x7620
movq (%r13), %rdi
callq 0x68ff
testb %al, %al
jne 0x7620
movq 0x14d4d(%rip), %rdi     # 0x1c680
movl $0x7, %esi
movl $0x4, %edx
leaq 0x14cd(%rip), %rcx      # 0x8e11
callq 0x2440
movq (%r13), %rdx
movl $0x43, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
jmp 0x7620
cmpl $-0x1, %r12d
jne 0x7620
jmp 0x7981
cmpl $0x3f, %r12d
jne 0x7620
movl $0x1, %edi
callq 0x2450
testb $0x1, 0x10(%rsp)
je 0x79ac
callq 0x3777
movl 0x14cf5(%rip), %eax     # 0x1c688
cmpl $0x3, %eax
movl 0xc(%rsp), %ebx
je 0x79c8
testl %eax, %eax
jne 0x79bc
movl $0x3, 0x14cde(%rip)     # 0x1c688
jmp 0x79c8
movl 0xc(%rsp), %ebx
testb $0x1, %bl
je 0x79c8
callq 0x3777
jmp 0x79c8
movl $0xe, %edi
xorl %eax, %eax
callq 0x6cf0
movl 0x14cba(%rip), %eax     # 0x1c688
cmpl $0x1, %eax
sete %cl
andb %bl, %cl
cmpb $0x1, %cl
jne 0x79ed
movl $0x5, %edi
xorl %eax, %eax
callq 0x6cf0
movl 0x14c9b(%rip), %eax     # 0x1c688
testl %eax, %eax
sete %cl
andb %cl, %bl
cmpb $0x1, %bl
jne 0x7a0b
movl $0x6, %edi
xorl %eax, %eax
callq 0x6cf0
movl 0x14c7d(%rip), %eax     # 0x1c688
movb 0x14c7b(%rip), %cl      # 0x1c68c
testl %eax, %eax
setne %dl
orb %cl, %dl
movapd 0x20(%rsp), %xmm0
je 0x7a53
testb %cl, %cl
je 0x7b46
movl 0x14(%rsp), %eax
cmpl $0x73, %eax
je 0x7a62
cmpl $0x67, %eax
jne 0x7ac8
cmpb $0x0, 0x14c4e(%rip)     # 0x1c68f
jne 0x7ab3
movsd 0xae5(%rip), %xmm0      # 0x8530
mulsd 0x20(%rsp), %xmm0
jmp 0x7ab3
movl $0x1, 0x14c2b(%rip)     # 0x1c688
jmp 0x7b52
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jb 0x7a9e
movq 0x14c0d(%rip), %rdi     # 0x1c680
leaq 0x13c0(%rip), %rcx      # 0x8e3a
movl $0x7, %esi
movl $0x2, %edx
callq 0x2440
movl $0x73, %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
movapd 0x20(%rsp), %xmm0
callq 0x2250
mulsd 0xa7d(%rip), %xmm0      # 0x8528
mulsd 0xa7d(%rip), %xmm0      # 0x8530
callq 0x20a0
cvttsd2si %xmm0, %eax
movl %eax, 0x14bce(%rip)     # 0x1c690
movapd 0x20(%rsp), %xmm0
movmskpd %xmm0, %eax
andl $0x1, %eax
movb %al, 0x14bbf(%rip)      # 0x1c694
cmpb $0x0, 0x14bb1(%rip)     # 0x1c68d
jne 0x7b16
movl 0x14bac(%rip), %eax     # 0x1c690
movswl %ax, %ecx
cmpl %eax, %ecx
je 0x7b16
movq 0x14b8e(%rip), %rdi     # 0x1c680
leaq 0x1341(%rip), %rcx      # 0x8e3a
movl $0x7, %esi
movl $0x2, %edx
callq 0x2440
movl 0x14(%rsp), %edi
movq %rax, %rsi
xorl %eax, %eax
callq 0x707c
movl 0x14b6c(%rip), %eax     # 0x1c688
movl $0x7, %edi
cmpl $0x1, %eax
je 0x7b39
testl %eax, %eax
jne 0x7b40
movl $0x6, %edi
cmpq $0x0, 0x14b69(%rip)     # 0x1c6a0
je 0x7b40
xorl %eax, %eax
callq 0x6cf0
movl 0x14b42(%rip), %eax     # 0x1c688
cmpl $0x3, %eax
jne 0x7b52
movb $0x0, 0x14b44(%rip)     # 0x1c696
movq 0x14b17(%rip), %rax     # 0x1c670
cmpq $0x0, 0x8(%rax)
je 0x7b6e
xorl %eax, %eax
movb %al, 0x14b24(%rip)      # 0x1c68c
movb %al, 0x14b27(%rip)      # 0x1c695
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x74c6
nopw %cs:(%rax,%rax)
nopl (%rax)