// File: /workspace/github_c_makefile_star2_O0/Openvario[P]sensord/configfile_parser.c
// Function: cfgfile_parser
int cfgfile_parser(FILE *fp, t_ms5611 *static_sensor, t_ms5611 *tek_sensor, t_ams5915 *dynamic_sensor, t_ads1110 *voltage_sensor, t_ds2482 *temp_sensor, t_config *config)
{
	char line[70];
	char tmp[20],tmp2[20];
	float data;

	// is config file used ??
	if (fp)
	{
		// read whole config file
		while (! feof(fp))
		{
			// get line from config file
			if (fgets(line, 70, fp)!=NULL) {
				//fprintf(stderr, "getting line: '%69s'\n", line);

				// check if line is comment
				if((!(line[0] == '#')) && (!(line[0] == '\n')))
				{

					// get first config tag
					sscanf(line, "%19s", tmp);

					// check for output of POV_E sentence
					if (strcmp(tmp,"output_POV_E") == 0)
					{
						config->output_POV_E = 1;
						//fprintf(stderr, "OUTput POV_E enabled !! \n");
					}

					// check for output of POV_P_Q sentence
					if (strcmp(tmp,"output_POV_P_Q") == 0)
					{
						config->output_POV_P_Q = 1;
						//fprintf(stderr, "OUTput POV_P_Q enabled !! \n");
					}

					// check for output of POV_V sentence
					if (strcmp(tmp,"output_POV_V") == 0)
					{
						config->output_POV_V= 1;
						//fprintf(stderr, "OUTput POV_V enabled !! \n");
					}

					// check for output of POV_T sentence
					if (strcmp(tmp,"output_POV_T") == 0)
					{
						config->output_POV_T = 1;
						//fprintf(stderr, "OUTput POV_T enabled !! \n");
					}

				       // check for output of POV_H sentence
					if (strcmp(tmp,"output_POV_H") == 0)
					{
						config->output_POV_H = 1;
						//fprintf(stderr, "OUTput POV_H enabled !! \n");
					}

					// check for static_sensor
					if (strcmp(tmp,"static_sensor") == 0)
					{
						// get config data for static sensor
						sscanf(line, "%19s %f %f %hhx %hhu", tmp, &static_sensor->offset, &static_sensor->linearity, &static_sensor->address, &static_sensor->bus);
						static_sensor->offset*=16;
					}

					// check for temp_sensor_type
					if (strcmp(tmp,"temp_sensor_type") == 0)
					{
						// get config data for temp sensor type
						sscanf(line, "%19s %19s", tmp, tmp2);
						char *s = tmp2;
						while (*s) {
							*s = toupper((unsigned char) *s);
							s++;
						}
						if (!strcmp(tmp2,"AUTO")) temp_sensor->sensor_type=AUTO;
						else if (!strcmp(tmp2,"HTU21D")) temp_sensor->sensor_type=HTU21D;
							else if (!strcmp(tmp2,"HTU31D")) temp_sensor->sensor_type=HTU31D;
								else if (!strcmp(tmp2,"SHT85")) temp_sensor->sensor_type=SHT85;
									else if (!strcmp(tmp2,"SHT4X")) temp_sensor->sensor_type=SHT4X;
										else if (!strcmp(tmp2,"SI7021")) temp_sensor->sensor_type=SI7021;
											else if (!strcmp(tmp2,"DS18B20")) temp_sensor->sensor_type=DS18B20;
												else if (!strcmp(tmp2,"AM2321")) temp_sensor->sensor_type=AM2321;
													else fprintf(stderr, "Invalid sensor type.  Supported types are: auto, htu21d, htu31d, sht4x, sht85, si7021, ds18b20, and am2321 !!\n");
					}

					if (strcmp(tmp,"static_comp") == 0)
					{
						// get compensation data for static sensor
						sscanf(line, "%19s %lf %lf %lf",tmp, &static_sensor->comp2, &static_sensor->comp1, &static_sensor->comp0);
					}

					if (strcmp(tmp,"static_Pcomp") == 0)
					{
						// get pressure compensation data for static sensor
						sscanf(line, "%19s %lf %lf %lf",tmp, &static_sensor->Pcomp2, &static_sensor->Pcomp1, &static_sensor->Pcomp0);
					}

					// check for tek_sensor
					if (strcmp(tmp,"tek_sensor") == 0)
					{
						// get config data for tek sensor
						sscanf(line, "%19s %f %f %hhx %hhu", tmp, &tek_sensor->offset, &tek_sensor->linearity, &tek_sensor->address, &tek_sensor->bus);
						tek_sensor->offset*=16;
					}

					if (strcmp(tmp,"tek_comp") == 0)
					{
						// get compensation data for tek sensor
						sscanf (line, "%19s %lf %lf %lf",tmp, &tek_sensor->comp2, &tek_sensor->comp1, &tek_sensor->comp0);
					}

					if (strcmp(tmp,"tek_Pcomp") == 0)
					{
						// get pressure compensation data for tek sensor
						sscanf(line, "%19s %lf %lf %lf",tmp, &tek_sensor->Pcomp2, &tek_sensor->Pcomp1, &tek_sensor->Pcomp0);
					}

					// check for glitch watchdog_timing
					if (strcmp(tmp,"glitch_timing") == 0)
					{
						// get config data for glitch watchdog timer
						sscanf(line, "%19s %lf %lf %lf", tmp, &config->timing_log, &config->timing_mult, &config->timing_off);
					}

					// check for dynamic_sensor
					if (strcmp(tmp,"dynamic_sensor") == 0)
					{
						// get config data for dynamic sensor
						sscanf(line, "%19s %f %f", tmp, &dynamic_sensor->offset, &dynamic_sensor->linearity);
					}

					// check for vario config
					if (strcmp(tmp,"vario_config") == 0)
					{
						// get config data for dynamic sensor
						sscanf(line, "%19s %f", tmp, &config->vario_x_accel);
					}

					// check for voltage sensor config
					if (strcmp(tmp,"voltage_config") == 0)
					{
						// get config data for dynamic sensor
						sscanf(line, "%19s %f %f", tmp, &voltage_sensor->scale,&voltage_sensor->offset);
						voltage_sensor->scale=1.0/voltage_sensor->scale;
					}

					// check for temperature sensor config
					if (strcmp(tmp,"temp_databits") == 0) {
						// get config data for temperature sensor
						sscanf(line,"%19s %d",tmp, &temp_sensor->databits);
					}

					// check for temperature sensor sample rate
					if (strcmp(tmp,"temp_rate") == 0) {
						// get config data for temperature sensor sample rate
						sscanf (line,"%19s %f",tmp, &data);
						temp_sensor->rollover=((int)(round(80.0/data)));
						temp_sensor->maxrollover=temp_sensor->rollover+40;
						if (temp_sensor->maxrollover<100) temp_sensor->maxrollover=100;
					}

				}
			}

		}
		return(1);
	}
	else
	{
		// no config file used
		return (0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7526
jmp 0x6e44
movq -0x10(%rbp), %rdi
callq 0x21f0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6e5e
jmp 0x751d
leaq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x46, %esi
callq 0x2190
cmpq $0x0, %rax
je 0x7518
movsbl -0x80(%rbp), %eax
cmpl $0x23, %eax
je 0x7516
movsbl -0x80(%rbp), %eax
cmpl $0xa, %eax
je 0x7516
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq 0x57e6(%rip), %rsi      # 0xc68c
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x5755(%rip), %rsi      # 0xc610
callq 0x21b0
cmpl $0x0, %eax
jne 0x6ecc
movq 0x10(%rbp), %rax
movb $0x1, (%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x5743(%rip), %rsi      # 0xc61d
callq 0x21b0
cmpl $0x0, %eax
jne 0x6eec
movq 0x10(%rbp), %rax
movb $0x1, 0x1(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x5732(%rip), %rsi      # 0xc62c
callq 0x21b0
cmpl $0x0, %eax
jne 0x6f0c
movq 0x10(%rbp), %rax
movb $0x1, 0x2(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x571f(%rip), %rsi      # 0xc639
callq 0x21b0
cmpl $0x0, %eax
jne 0x6f2c
movq 0x10(%rbp), %rax
movb $0x1, 0x3(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x570c(%rip), %rsi      # 0xc646
callq 0x21b0
cmpl $0x0, %eax
jne 0x6f4c
movq 0x10(%rbp), %rax
movb $0x1, 0x4(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x56f9(%rip), %rsi      # 0xc653
callq 0x21b0
cmpl $0x0, %eax
jne 0x6fc3
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq $0x90, %rcx
movq -0x18(%rbp), %r8
addq $0x8c, %r8
movq -0x18(%rbp), %r9
addq $0x4, %r9
movq -0x18(%rbp), %rax
addq $0x5, %rax
leaq 0x56c5(%rip), %rsi      # 0xc661
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2220
movq -0x18(%rbp), %rax
movss 0x4665(%rip), %xmm0     # 0xb618
mulss 0x90(%rax), %xmm0
movss %xmm0, 0x90(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x56a5(%rip), %rsi      # 0xc676
callq 0x21b0
cmpl $0x0, %eax
jne 0x718e
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
leaq 0x568f(%rip), %rsi      # 0xc687
movb $0x0, %al
callq 0x2220
leaq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
cmpb $0x0, (%rax)
je 0x7047
movq -0xd0(%rbp), %rax
movzbl (%rax), %edi
callq 0x2070
movb %al, %cl
movq -0xd0(%rbp), %rax
movb %cl, (%rax)
movq -0xd0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
jmp 0x700d
leaq -0xc0(%rbp), %rdi
leaq 0x563c(%rip), %rsi      # 0xc691
callq 0x21b0
cmpl $0x0, %eax
jne 0x706c
movq -0x38(%rbp), %rax
movb $0x0, 0x30(%rax)
jmp 0x718c
leaq -0xc0(%rbp), %rdi
leaq 0x561c(%rip), %rsi      # 0xc696
callq 0x21b0
cmpl $0x0, %eax
jne 0x7091
movq -0x38(%rbp), %rax
movb $0x1, 0x30(%rax)
jmp 0x718a
leaq -0xc0(%rbp), %rdi
leaq 0x55fe(%rip), %rsi      # 0xc69d
callq 0x21b0
cmpl $0x0, %eax
jne 0x70b6
movq -0x38(%rbp), %rax
movb $0x2, 0x30(%rax)
jmp 0x7188
leaq -0xc0(%rbp), %rdi
leaq 0x55e0(%rip), %rsi      # 0xc6a4
callq 0x21b0
cmpl $0x0, %eax
jne 0x70db
movq -0x38(%rbp), %rax
movb $0x7, 0x30(%rax)
jmp 0x7186
leaq -0xc0(%rbp), %rdi
leaq 0x55c1(%rip), %rsi      # 0xc6aa
callq 0x21b0
cmpl $0x0, %eax
jne 0x7100
movq -0x38(%rbp), %rax
movb $0x6, 0x30(%rax)
jmp 0x7184
leaq -0xc0(%rbp), %rdi
leaq 0x55a2(%rip), %rsi      # 0xc6b0
callq 0x21b0
cmpl $0x0, %eax
jne 0x7122
movq -0x38(%rbp), %rax
movb $0x3, 0x30(%rax)
jmp 0x7182
leaq -0xc0(%rbp), %rdi
leaq 0x5587(%rip), %rsi      # 0xc6b7
callq 0x21b0
cmpl $0x0, %eax
jne 0x7144
movq -0x38(%rbp), %rax
movb $0x4, 0x30(%rax)
jmp 0x7180
leaq -0xc0(%rbp), %rdi
leaq 0x556d(%rip), %rsi      # 0xc6bf
callq 0x21b0
cmpl $0x0, %eax
jne 0x7166
movq -0x38(%rbp), %rax
movb $0x5, 0x30(%rax)
jmp 0x717e
movq 0x7e8b(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x554f(%rip), %rsi      # 0xc6c6
movb $0x0, %al
callq 0x21d0
jmp 0x7180
jmp 0x7182
jmp 0x7184
jmp 0x7186
jmp 0x7188
jmp 0x718a
jmp 0x718c
jmp 0x718e
leaq -0xa0(%rbp), %rdi
leaq 0x5599(%rip), %rsi      # 0xc735
callq 0x21b0
cmpl $0x0, %eax
jne 0x71da
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq $0x70, %rcx
movq -0x18(%rbp), %r8
addq $0x78, %r8
movq -0x18(%rbp), %r9
addq $0x80, %r9
leaq 0x556e(%rip), %rsi      # 0xc741
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x556a(%rip), %rsi      # 0xc752
callq 0x21b0
cmpl $0x0, %eax
jne 0x7223
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq $0x58, %rcx
movq -0x18(%rbp), %r8
addq $0x60, %r8
movq -0x18(%rbp), %r9
addq $0x68, %r9
leaq 0x5525(%rip), %rsi      # 0xc741
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x552e(%rip), %rsi      # 0xc75f
callq 0x21b0
cmpl $0x0, %eax
jne 0x729a
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x20(%rbp), %rcx
addq $0x90, %rcx
movq -0x20(%rbp), %r8
addq $0x8c, %r8
movq -0x20(%rbp), %r9
addq $0x4, %r9
movq -0x20(%rbp), %rax
addq $0x5, %rax
leaq 0x53ee(%rip), %rsi      # 0xc661
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2220
movq -0x20(%rbp), %rax
movss 0x438e(%rip), %xmm0     # 0xb618
mulss 0x90(%rax), %xmm0
movss %xmm0, 0x90(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x54c2(%rip), %rsi      # 0xc76a
callq 0x21b0
cmpl $0x0, %eax
jne 0x72e6
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x20(%rbp), %rcx
addq $0x70, %rcx
movq -0x20(%rbp), %r8
addq $0x78, %r8
movq -0x20(%rbp), %r9
addq $0x80, %r9
leaq 0x5462(%rip), %rsi      # 0xc741
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x547f(%rip), %rsi      # 0xc773
callq 0x21b0
cmpl $0x0, %eax
jne 0x732f
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x20(%rbp), %rcx
addq $0x58, %rcx
movq -0x20(%rbp), %r8
addq $0x60, %r8
movq -0x20(%rbp), %r9
addq $0x68, %r9
leaq 0x5419(%rip), %rsi      # 0xc741
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x5440(%rip), %rsi      # 0xc77d
callq 0x21b0
cmpl $0x0, %eax
jne 0x7378
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq 0x10(%rbp), %rcx
addq $0x10, %rcx
movq 0x10(%rbp), %r8
addq $0x18, %r8
movq 0x10(%rbp), %r9
addq $0x20, %r9
leaq 0x53d0(%rip), %rsi      # 0xc741
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x5405(%rip), %rsi      # 0xc78b
callq 0x21b0
cmpl $0x0, %eax
jne 0x73b9
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x20, %rcx
movq -0x28(%rbp), %r8
addq $0x1c, %r8
leaq 0x53e8(%rip), %rsi      # 0xc79a
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x53de(%rip), %rsi      # 0xc7a5
callq 0x21b0
cmpl $0x0, %eax
jne 0x73f2
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq 0x10(%rbp), %rcx
addq $0x8, %rcx
leaq 0x53c7(%rip), %rsi      # 0xc7b2
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x53ba(%rip), %rsi      # 0xc7ba
callq 0x21b0
cmpl $0x0, %eax
jne 0x7453
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x30(%rbp), %r8
addq $0x4, %r8
leaq 0x5372(%rip), %rsi      # 0xc79a
movb $0x0, %al
callq 0x2220
movq -0x30(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x408d(%rip), %xmm0     # 0xb4d0
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, (%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x5368(%rip), %rsi      # 0xc7c9
callq 0x21b0
cmpl $0x0, %eax
jne 0x748c
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movq -0x38(%rbp), %rcx
addq $0x3c, %rcx
leaq 0x5352(%rip), %rsi      # 0xc7d7
movb $0x0, %al
callq 0x2220
leaq -0xa0(%rbp), %rdi
leaq 0x5345(%rip), %rsi      # 0xc7df
callq 0x21b0
cmpl $0x0, %eax
jne 0x7514
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq 0x52fc(%rip), %rsi      # 0xc7b2
leaq -0xc4(%rbp), %rcx
movb $0x0, %al
callq 0x2220
movss -0xc4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x5130(%rip), %xmm0     # 0xc608
divsd %xmm1, %xmm0
callq 0x2040
cvttsd2si %xmm0, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x38(%rbp), %rax
movl 0x48(%rax), %ecx
addl $0x28, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x38(%rbp), %rax
cmpl $0x64, 0x4c(%rax)
jge 0x7512
movq -0x38(%rbp), %rax
movl $0x64, 0x4c(%rax)
jmp 0x7514
jmp 0x7516
jmp 0x7518
jmp 0x6e44
movl $0x1, -0x4(%rbp)
jmp 0x752d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)