// File: aaronpuchert[P]throttle/src/throttle.cpp
// Function: Throttle::createFromConfig(char const*, char const*)
Throttle Throttle::createFromConfig(const char *config_fn, const char* pipe_fn)
{
	// open the configuration file
	Conf conf(config_fn);

	// read all variables
	std::string temp_fn = conf.GetAttr("temp_file");
	std::vector<int> freqs = conf.ParseAttr<std::vector<int>>("freq_list");
	std::sort(freqs.begin(), freqs.end());

	Throttle ret(std::move(temp_fn),
	             FreqFilenames(conf.GetAttr("freq_set_prefix"),
	                           conf.GetAttr("freq_set_suffix"),
	                           conf.ParseAttr<unsigned>("cores")),
	             std::move(freqs), pipe_fn, conf.ParseAttr<int>("wait"));
	ret.setMinTemp(conf.ParseAttr<int>("temp_min"));
	ret.setMaxTemp(conf.ParseAttr<int>("temp_max"));
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0xd8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x7690
movq -0xc8(%rbp), %rdi
leaq 0x6036(%rip), %rsi      # 0xa030
callq 0x7a90
movq %rax, -0xc0(%rbp)
jmp 0x4008
movq -0xc0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x30f0
jmp 0x401a
leaq 0x6019(%rip), %rdx      # 0xa03a
leaq -0x78(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4830
jmp 0x4030
leaq -0x78(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x48c0
movq -0xe0(%rbp), %rdi
movq %rax, -0x80(%rbp)
callq 0x48f0
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x4880
jmp 0x4069
movb $0x0, -0x89(%rbp)
leaq 0x5fcd(%rip), %rsi      # 0xa044
leaq -0x30(%rbp), %rdi
callq 0x7a90
movq %rax, -0xe8(%rbp)
jmp 0x4089
leaq 0x5fc4(%rip), %rsi      # 0xa054
leaq -0x30(%rbp), %rdi
callq 0x7a90
movq %rax, -0xf0(%rbp)
jmp 0x40a2
leaq 0x5fbb(%rip), %rsi      # 0xa064
leaq -0x30(%rbp), %rdi
callq 0x4920
movl %eax, -0xf4(%rbp)
jmp 0x40ba
movl -0xf4(%rbp), %ecx
movq -0xf0(%rbp), %rdx
movq -0xe8(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x3d20
jmp 0x40dc
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq 0x5f7c(%rip), %rsi      # 0xa06a
leaq -0x30(%rbp), %rdi
callq 0x4950
movl %eax, -0xf8(%rbp)
jmp 0x40ff
movl -0xf8(%rbp), %r9d
movq -0x100(%rbp), %r8
movq -0xd8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
leaq -0x78(%rbp), %rcx
callq 0x4260
jmp 0x412a
leaq -0xb8(%rbp), %rdi
callq 0x38f0
leaq 0x5f32(%rip), %rsi      # 0xa06f
leaq -0x30(%rbp), %rdi
callq 0x4950
movl %eax, -0x104(%rbp)
jmp 0x414e
movl -0x104(%rbp), %esi
movq -0xd8(%rbp), %rdi
callq 0x4980
jmp 0x4162
leaq 0x5f0f(%rip), %rsi      # 0xa078
leaq -0x30(%rbp), %rdi
callq 0x4950
movl %eax, -0x108(%rbp)
jmp 0x417a
movl -0x108(%rbp), %esi
movq -0xd8(%rbp), %rdi
callq 0x49a0
jmp 0x418e
movb $0x1, -0x89(%rbp)
testb $0x1, -0x89(%rbp)
jne 0x4210
jmp 0x4204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x424d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4244
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x423b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x38f0
jmp 0x423b
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x3830
jmp 0x423b
movq -0xd8(%rbp), %rdi
callq 0x3830
leaq -0x78(%rbp), %rdi
callq 0x3890
leaq -0x50(%rbp), %rdi
callq 0x3190
leaq -0x30(%rbp), %rdi
callq 0x49c0
movq -0xd0(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x3890
leaq -0x50(%rbp), %rdi
callq 0x3190
leaq -0x30(%rbp), %rdi
callq 0x49c0
movq -0x58(%rbp), %rdi
callq 0x3420
nop