// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rnxobs/Patterns.cpp
// Function: bamboo::Patterns::m_getPatternName(int, char const*, char const*, int, int, int, int, char*)
void Patterns::m_getPatternName(int ldefined, const char* keyword, const char* param_list, int iyear,
		int imonth, int iday, int ihour, char* name) {
	char varword[1024];
	char form[1024] = { '\0' };
	int npar, nword, mjd, week, wd, idoy;
	bool lfound;
	char word[40][256], param[40][256];
	int i, j, k, index;
	if (ldefined)
		strcpy(form, name);
	else {
		for (i = 0; i < nfile; i++) {
			if (!strcmp(fname[i], keyword)) {
				strcpy(form, fform[i]);
				break;
			}
		}
		if (len_trim(form) == 0) {
			printf("keyword = %s,keyword not defined in panda_file_name",keyword);
			exit(1);
		}
	}
	split_string(false, form, ' ', ' ', '-', &nword, (char*)word, 256);
	strcpy(varword, param_list);
	split_string(true, varword, ' ', ' ', ':', &npar, (char*)param, 256);
	mjd = md_julday(iyear, imonth, iday);
	gpsweek(iyear, imonth, iday, &week, &wd);
	mjd2doy(mjd, &iyear, &idoy);
	sprintf(param[npar], "Y=%1.1d", iyear % 10);
	sprintf(param[npar + 1], "YY=%2.2d", iyear % 100);
	sprintf(param[npar + 2], "YYYY=%4.4d", iyear);
	sprintf(param[npar + 3], "DDD=%3.3d", idoy);
	sprintf(param[npar + 4], "HH=%2.2d", ihour);
	sprintf(param[npar + 5], "WWW=%4.4d", week);
	sprintf(param[npar + 6], "GPSW=%4.4d", week);
	sprintf(param[npar + 7], "WWWWD=%5.5d", week * 10 + wd);
	sprintf(param[npar + 8], "MJD=%5.5d", mjd);
	npar += 9;
	memset(name,0,strlen(name) * sizeof(char));
	for (i = 0; i < nword; i++) {
		if (len_trim(word[i]) == 0)
			continue;
		trim(word[i]);
		if (i % 2 != 0) {
			lfound = false;
			for (j = 0; j < npar; j++) {
				//if (strstr(param[j], word[i]) != NULL) {
				if (!strncmp(param[j], word[i],strlen(word[i]))) {
					lfound = true;
					k = len_trim(name);
					index = index_string(param[j], '=');
					substringEx(varword, param[j], index + 1,
							strlen(param[j]) - index - 1);
					strcpy(name + k, varword);
					break;
				}
			}
			if (!lfound) {
				printf("word = %s,keyword = %s,word is not defined in keyword",word[i],keyword);
				exit(1);
			}
		} else {
			k = len_trim(name);
			strcpy(name + k, word[i]);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5828, %rsp           # imm = 0x5828
movl %r9d, -0x2c(%rbp)
movq %rcx, %rbx
movq %rdx, -0x40(%rbp)
movl %esi, %r13d
movq %rdi, %r15
movq 0x20(%rbp), %r14
movl %r8d, -0x50(%rbp)
leaq -0x450(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x8390
testl %r13d, %r13d
je 0x23163
leaq -0x450(%rbp), %rdi
movq %r14, %rsi
callq 0x85c0
movq %r14, %r15
jmp 0x231be
movslq 0xc800(%r15), %r14
testq %r14, %r14
movq -0x40(%rbp), %r13
jle 0x231a6
movq %r15, %rdi
movq %r13, %rsi
callq 0x8890
testl %eax, %eax
je 0x23190
addq $0x100, %r15            # imm = 0x100
decq %r14
jne 0x23173
jmp 0x231a6
addq $0x6400, %r15           # imm = 0x6400
leaq -0x450(%rbp), %rdi
movq %r15, %rsi
callq 0x85c0
leaq -0x450(%rbp), %rdi
callq 0x1d95b
testl %eax, %eax
movq 0x20(%rbp), %r15
je 0x23554
movl 0x10(%rbp), %r13d
movl $0x100, %r14d           # imm = 0x100
leaq -0x5850(%rbp), %rax
leaq -0x450(%rbp), %rsi
leaq -0x30(%rbp), %r9
xorl %edi, %edi
movl $0x20, %edx
movl $0x20, %ecx
movl $0x2d, %r8d
pushq %r14
pushq %rax
callq 0x1df8b
addq $0x10, %rsp
leaq -0x850(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x85c0
leaq -0x3050(%rbp), %rax
leaq -0x34(%rbp), %r9
movl $0x1, %edi
movq %r12, %rsi
movl $0x20, %edx
movl $0x20, %ecx
movl $0x3a, %r8d
pushq %r14
pushq %rax
callq 0x1df8b
addq $0x10, %rsp
leaq -0x50(%rbp), %r12
movl (%r12), %edi
movl -0x2c(%rbp), %ebx
movl %ebx, %esi
movl %r13d, %edx
callq 0x1cf58
movl %eax, %r14d
movl (%r12), %edi
leaq -0x4c(%rbp), %rcx
leaq -0x48(%rbp), %r8
movl %ebx, %esi
movl %r13d, %edx
callq 0x1d015
leaq -0x44(%rbp), %rdx
movl %r14d, %edi
movq %r12, %rsi
callq 0x1d09a
leaq -0x34(%rbp), %r13
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbp), %rdi
addq $-0x3050, %rdi          # imm = 0xCFB0
movslq (%r12), %rdx
imulq $0x66666667, %rdx, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x22, %rax
addl %ecx, %eax
addl %eax, %eax
leal (%rax,%rax,4), %eax
subl %eax, %edx
leaq 0x48447(%rip), %rsi     # 0x6b6fa
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq -0x3050(%rbp), %rbx
leaq (%rax,%rbx), %rdi
addq $0x100, %rdi            # imm = 0x100
movslq (%r12), %rdx
imulq $0x51eb851f, %rdx, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x25, %rax
addl %ecx, %eax
imull $0x64, %eax, %eax
subl %eax, %edx
leaq 0x4840a(%rip), %rsi     # 0x6b702
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x200, %rdi            # imm = 0x200
movl (%r12), %edx
leaq 0x483ee(%rip), %rsi     # 0x6b70b
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x300, %rdi            # imm = 0x300
leaq -0x44(%rbp), %rax
movl (%rax), %edx
leaq 0x483d2(%rip), %rsi     # 0x6b716
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x400, %rdi            # imm = 0x400
leaq 0x483bb(%rip), %rsi     # 0x6b720
movl 0x18(%rbp), %edx
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x500, %rdi            # imm = 0x500
leaq -0x4c(%rbp), %r12
movl (%r12), %edx
leaq 0x48398(%rip), %rsi     # 0x6b729
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x600, %rdi            # imm = 0x600
movl (%r12), %edx
leaq 0x4837d(%rip), %rsi     # 0x6b733
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x700, %rdi            # imm = 0x700
movl (%r12), %eax
leal (%rax,%rax,4), %edx
addl %edx, %edx
leaq -0x48(%rbp), %rax
addl (%rax), %edx
leaq 0x48358(%rip), %rsi     # 0x6b73e
xorl %eax, %eax
callq 0x8120
movslq (%r13), %rax
shlq $0x8, %rax
leaq (%rax,%rbx), %rdi
addq $0x800, %rdi            # imm = 0x800
leaq 0x48343(%rip), %rsi     # 0x6b74a
movl %r14d, %edx
xorl %eax, %eax
callq 0x8120
addl $0x9, (%r13)
movq %r15, %rdi
callq 0x8290
movq %r15, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x8390
leaq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x23523
xorl %r14d, %r14d
movq %r14, %rax
shlq $0x8, %rax
leaq (%rax,%rbp), %rbx
addq $-0x5850, %rbx          # imm = 0xA7B0
movq %rbx, %rdi
callq 0x1d95b
testl %eax, %eax
je 0x23513
movq %rbx, %rdi
callq 0x1df4c
testb $0x1, %r14b
jne 0x2347b
movq %r15, %rdi
callq 0x1d95b
movl %eax, %r13d
jmp 0x23505
movslq -0x34(%rbp), %r15
testq %r15, %r15
jle 0x23535
movq %rbx, %rdi
callq 0x8290
movq %rax, %r13
leaq -0x3050(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x82f0
testl %eax, %eax
je 0x234ba
addq $0x100, %r12            # imm = 0x100
decq %r15
jne 0x2349a
jmp 0x23535
movq 0x20(%rbp), %r15
movq %r15, %rdi
callq 0x1d95b
movl %eax, %r13d
movq %r12, %rdi
movl $0x3d, %esi
callq 0x1db90
movl %eax, %ebx
leal 0x1(%rbx), %eax
movl %eax, -0x2c(%rbp)
movq %r12, %rdi
callq 0x8290
notl %ebx
addl %eax, %ebx
leaq -0x850(%rbp), %rdi
movq %r12, %rsi
movl -0x2c(%rbp), %edx
movl %ebx, %ecx
callq 0x1d9a3
leaq -0x850(%rbp), %rbx
movslq %r13d, %rdi
addq %r15, %rdi
movq %rbx, %rsi
callq 0x85c0
incq %r14
movslq -0x30(%rbp), %rax
cmpq %rax, %r14
jl 0x2343b
addq $0x5828, %rsp           # imm = 0x5828
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x48218(%rip), %rdi     # 0x6b754
movq %rbx, %rsi
movq -0x40(%rbp), %rdx
xorl %eax, %eax
callq 0x8080
movl $0x1, %edi
callq 0x87c0
leaq 0x4816b(%rip), %rdi     # 0x6b6c6
movq -0x40(%rbp), %rsi
xorl %eax, %eax
callq 0x8080
jmp 0x2354a