// File: aaronpuchert[P]throttle/src/conf.cpp
// Function: Conf::Conf(char const*)
Conf::Conf(const char *config_fn) {
	// open the file
	std::ifstream conf_file(config_fn);
	if (!conf_file)
		throw std::runtime_error(std::string("Couldn't open config file '") + config_fn + '\'');

	// Read every line and put it in the list.
	char line[LINE_LENGTH];
	std::string name;

	// parse: first comes the name of the command
	while (conf_file >> name) {
		// if line starts with '#', ignore it
		if (name[0] == '#') {
			conf_file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
			continue;
		}

		conf_file.ignore(std::numeric_limits<std::streamsize>::max(), '=');
		conf_file.ignore(std::numeric_limits<std::streamsize>::max(), ' ');
		conf_file.getline(line, LINE_LENGTH);

		DEBUG_PRINT("[Conf] " << name << " = " << line);

		// Write into attribute list
		attributes.emplace_back(name, std::string(line));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x730, %rsp            # imm = 0x730
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x6e8(%rbp)
movq %rdi, %rax
movq %rax, -0x6e0(%rbp)
callq 0x84e0
movq -0x10(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x3450
jmp 0x76d4
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x3110
movb %al, -0x6e9(%rbp)
jmp 0x76f4
movb -0x6e9(%rbp), %al
testb $0x1, %al
jne 0x7703
jmp 0x7880
movb $0x1, -0x28a(%rbp)
movl $0x10, %edi
callq 0x3140
movq %rax, -0x700(%rbp)
leaq -0x289(%rbp), %rdi
movq %rdi, -0x6f8(%rbp)
callq 0x3430
movq -0x6f8(%rbp), %rdx
leaq 0x29a0(%rip), %rsi      # 0xa0dc
leaq -0x288(%rbp), %rdi
callq 0x85a0
jmp 0x774a
movq -0x10(%rbp), %rdx
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x8550
jmp 0x7763
leaq -0x248(%rbp), %rdi
leaq -0x268(%rbp), %rsi
movl $0x27, %edx
callq 0x8500
jmp 0x777d
movq -0x700(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x33c0
jmp 0x7792
movq -0x700(%rbp), %rdi
movb $0x0, -0x28a(%rbp)
movq 0x7849(%rip), %rsi      # 0xeff0
movq 0x781a(%rip), %rdx      # 0xefc8
callq 0x3400
jmp 0x7a8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x7a73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x7a67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x7858
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x784c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x7840
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x3190
leaq -0x268(%rbp), %rdi
callq 0x3190
leaq -0x288(%rbp), %rdi
callq 0x3190
leaq -0x289(%rbp), %rdi
callq 0x32a0
testb $0x1, -0x28a(%rbp)
jne 0x786f
jmp 0x787b
movq -0x700(%rbp), %rdi
callq 0x31e0
jmp 0x7a67
leaq -0x6b0(%rbp), %rdi
callq 0x3340
leaq -0x218(%rbp), %rdi
leaq -0x6b0(%rbp), %rsi
callq 0x3320
movq %rax, -0x708(%rbp)
jmp 0x78a8
movq -0x708(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3310
movb %al, -0x709(%rbp)
jmp 0x78c6
movb -0x709(%rbp), %al
testb $0x1, %al
jne 0x78d5
jmp 0x7a3a
xorl %eax, %eax
movl %eax, %esi
leaq -0x6b0(%rbp), %rdi
callq 0x3490
movq %rax, -0x718(%rbp)
jmp 0x78ee
movq -0x718(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x7934
callq 0x8650
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0xa, %edx
callq 0x31a0
jmp 0x7918
jmp 0x788c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x7a5b
callq 0x8650
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0x3d, %edx
callq 0x31a0
jmp 0x794f
callq 0x8650
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0x20, %edx
callq 0x31a0
jmp 0x796a
leaq -0x218(%rbp), %rdi
leaq -0x690(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x30a0
jmp 0x7984
movq -0x6e0(%rbp), %rax
movq %rax, -0x728(%rbp)
leaq -0x6d1(%rbp), %rdi
movq %rdi, -0x720(%rbp)
callq 0x3430
movq -0x720(%rbp), %rdx
leaq -0x6d0(%rbp), %rdi
leaq -0x690(%rbp), %rsi
callq 0x85a0
jmp 0x79c1
movq -0x728(%rbp), %rdi
leaq -0x6b0(%rbp), %rsi
leaq -0x6d0(%rbp), %rdx
callq 0x8660
jmp 0x79dd
leaq -0x6d0(%rbp), %rdi
callq 0x3190
leaq -0x6d1(%rbp), %rdi
callq 0x32a0
jmp 0x788c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x7a2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x6d0(%rbp), %rdi
callq 0x3190
leaq -0x6d1(%rbp), %rdi
callq 0x32a0
jmp 0x7a5b
leaq -0x6b0(%rbp), %rdi
callq 0x3190
leaq -0x218(%rbp), %rdi
callq 0x3070
addq $0x730, %rsp            # imm = 0x730
popq %rbp
retq
leaq -0x6b0(%rbp), %rdi
callq 0x3190
leaq -0x218(%rbp), %rdi
callq 0x3070
movq -0x6e8(%rbp), %rdi
callq 0x4c60
movq -0x220(%rbp), %rdi
callq 0x3420
nopl (%rax,%rax)