// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::openfile(char const*, int, char*)
static file_t *openfile(const char *path, int mode, char *msg)
	{
		file_t *file;
		gtime_t time, time0 = { 0 };
		double speed = 0.0, start = 0.0, swapintv = 0.0;
		char *p;
		int timetag = 0, size_fpos = (int)sizeof(size_t);

		tracet(3, "openfile: path=%s mode=%d\n", path, mode);

		if (!(mode&(STR_MODE_R | STR_MODE_W))) return NULL;

		/* file options */
		for (p = (char *)path; (p = strstr(p, "::")); p += 2) { /* file options */
			if (*(p + 2) == 'T') timetag = 1;
			else if (*(p + 2) == '+') sscanf(p + 2, "+%lf", &start);
			else if (*(p + 2) == 'x') sscanf(p + 2, "x%lf", &speed);
			else if (*(p + 2) == 'S') sscanf(p + 2, "S=%lf", &swapintv);
			else if (*(p + 2) == 'P') sscanf(p + 2, "P=%d", &size_fpos);
		}
		if (start <= 0.0) start = 0.0;
		if (swapintv <= 0.0) swapintv = 0.0;

		if (!(file = (file_t *)malloc(sizeof(file_t)))) return NULL;

		file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL;
		strcpy(file->path, path);
		if ((p = strstr(file->path, "::"))) *p = '\0';
		file->openpath[0] = '\0';
		file->mode = mode;
		file->timetag = timetag;
		file->repmode = 0;
		file->offset = 0;
		file->size_fpos = size_fpos;
		file->time = file->wtime = time0;
		file->tick = file->tick_f = file->tick_n = file->fpos_n = 0;
		file->start = start;
		file->speed = speed;
		file->swapintv = swapintv;
		initlock(&file->lock);

		time = utc2gpst(timeget());

		/* open new file */
		if (!openfile_(file, time, msg)) {
			free(file);
			return NULL;
		}
		return file;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x93d0
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x8, -0x70(%rbp)
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl $0x3, %edi
leaq 0x2b0da(%rip), %rsi     # 0xc8d89
movb $0x0, %al
callq 0x95890
movl -0x14(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x9dcce
movq $0x0, -0x8(%rbp)
jmp 0x9e00f
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
leaq 0x2b0c3(%rip), %rsi     # 0xc8da4
callq 0x91b0
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x9ddca
movq -0x68(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x54, %eax
jne 0x9dd0d
movl $0x1, -0x6c(%rbp)
jmp 0x9ddb7
movq -0x68(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x2b, %eax
jne 0x9dd36
movq -0x68(%rbp), %rdi
addq $0x2, %rdi
leaq 0x2b07e(%rip), %rsi     # 0xc8da7
leaq -0x58(%rbp), %rdx
movb $0x0, %al
callq 0x9750
jmp 0x9ddb5
movq -0x68(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x78, %eax
jne 0x9dd5f
movq -0x68(%rbp), %rdi
addq $0x2, %rdi
leaq 0x2b05a(%rip), %rsi     # 0xc8dac
leaq -0x50(%rbp), %rdx
movb $0x0, %al
callq 0x9750
jmp 0x9ddb3
movq -0x68(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x53, %eax
jne 0x9dd88
movq -0x68(%rbp), %rdi
addq $0x2, %rdi
leaq 0x2b036(%rip), %rsi     # 0xc8db1
leaq -0x60(%rbp), %rdx
movb $0x0, %al
callq 0x9750
jmp 0x9ddb1
movq -0x68(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x50, %eax
jne 0x9ddaf
movq -0x68(%rbp), %rdi
addq $0x2, %rdi
leaq 0x2dcdf(%rip), %rsi     # 0xcba83
leaq -0x70(%rbp), %rdx
movb $0x0, %al
callq 0x9750
jmp 0x9ddb1
jmp 0x9ddb3
jmp 0x9ddb5
jmp 0x9ddb7
jmp 0x9ddb9
movq -0x68(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x68(%rbp)
jmp 0x9dcd6
xorps %xmm0, %xmm0
ucomisd -0x58(%rbp), %xmm0
jb 0x9dddc
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x60(%rbp), %xmm0
jb 0x9ddee
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movl $0x8b0, %edi            # imm = 0x8B0
callq 0x99e0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x9de0f
movq $0x0, -0x8(%rbp)
jmp 0x9e00f
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
callq 0x96f0
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
leaq 0x2af46(%rip), %rsi     # 0xc8da4
callq 0x91b0
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x9de74
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x420(%rax)
movl -0x14(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x820(%rax)
movl -0x6c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x824(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x828(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x82c(%rax)
movl -0x70(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x830(%rax)
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rax, 0x848(%rcx)
movq -0x40(%rbp), %rax
movq %rax, 0x850(%rcx)
movq -0x28(%rbp), %rax
movq 0x848(%rcx), %rdx
movq %rdx, 0x838(%rax)
movq 0x850(%rcx), %rcx
movq %rcx, 0x840(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x860(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x868(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x85c(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x858(%rax)
movsd -0x58(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x870(%rax)
movsd -0x50(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x878(%rax)
movsd -0x60(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x880(%rax)
movq -0x28(%rbp), %rdi
addq $0x888, %rdi            # imm = 0x888
xorl %eax, %eax
movl %eax, %esi
callq 0x9ae0
callq 0x8e920
movq %rax, -0x90(%rbp)
movsd %xmm0, -0x88(%rbp)
movq -0x90(%rbp), %rdi
movsd -0x88(%rbp), %xmm0
callq 0x8f0a0
movq %rax, -0x80(%rbp)
movsd %xmm0, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rdx
movq -0xa0(%rbp), %rsi
movsd -0x98(%rbp), %xmm0
callq 0xa3bf0
cmpl $0x0, %eax
jne 0x9e007
movq -0x28(%rbp), %rdi
callq 0x9900
movq $0x0, -0x8(%rbp)
jmp 0x9e00f
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)