// File: /workspace/github_cpp_makefile_star2_O2/spjmurray[P]nagios-plugin-check-scsi-smart/check_scsi_smart.cc
// Function: parse_thresholds(std::map<unsigned char, unsigned long, std::less<unsigned char>, std::allocator<std::pair<unsigned char const, unsigned long>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool parse_thresholds(SmartThresholdMap& thresholds, const string in) {

  istringstream in_stream(in);
  vector<string> tokens;
  string token1, token2;

  // Split the input into key value pairs
  vector<string> key_value_pairs;
  while(getline(in_stream, token1, ',')) {
    tokens.push_back(token1);
  }

  // Split each key value pair
  for(vector<string>::iterator i = tokens.begin(); i != tokens.end(); i++) {

    istringstream tok_stream(*i);

    // Read the first token delimited by =
    getline(tok_stream, token1, ':');
    if(!tok_stream.good()) {
      return false;
    }

    // Read the second token, which shoud result in EOF
    getline(tok_stream, token2);
    if(!tok_stream.eof()) {
      return false;
    }

    // Parse the tokens and ensure they are integers
    char* p1;
    char* p2;

    unsigned long k = strtol(token1.c_str(), &p1, 10);
    unsigned long v = strtol(token2.c_str(), &p2, 10);

    if(*p1 || *p2) {
      return false;
    }

    thresholds[k] = v;

  }

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
movq %rdi, 0x8(%rsp)
leaq 0x218(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x2270
leaq 0x20(%rsp), %r15
andq $0x0, 0x10(%r15)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorps %xmm0, %xmm0
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movaps %xmm0, (%r15)
andq $0x0, 0x70(%rsp)
movb %cl, (%rax)
movaps %xmm0, 0x60(%rsp)
leaq 0x40(%rsp), %r12
pushq $0x2c
popq %rbp
movq %r14, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2ac4
movq %r15, %rdi
movq %r12, %rsi
callq 0x3184
jmp 0x2a9c
movq 0x20(%rsp), %r14
leaq 0x98(%rsp), %r15
pushq $0xa
popq %rbp
movq 0x28(%rsp), %rbx
cmpq %rbx, %r14
je 0x2bae
movq %r15, %rdi
movq %r14, %rsi
pushq $0x8
popq %rdx
callq 0x2270
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
pushq $0x3a
popq %rdx
callq 0x22b0
movq 0x98(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xb8(%rsp,%rax)
jne 0x2ba1
movq %r15, %rdi
leaq 0x78(%rsp), %rsi
callq 0x2050
movq 0x98(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xb8(%rsp,%rax)
je 0x2ba1
movq 0x40(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl %ebp, %edx
callq 0x2200
movq %rax, %r13
movq 0x78(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl %ebp, %edx
callq 0x2200
movq %rax, %r12
movq 0x18(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x2ba1
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x2ba1
movb %r13b, 0x7(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rsi
callq 0x3136
movq %r12, (%rax)
movq %r15, %rdi
callq 0x20b0
addq $0x20, %r14
jmp 0x2ad4
leaq 0x98(%rsp), %rdi
callq 0x20b0
cmpq %rbx, %r14
sete %bl
leaq 0x60(%rsp), %rdi
callq 0x31b0
leaq 0x78(%rsp), %rdi
callq 0x20a0
leaq 0x40(%rsp), %rdi
callq 0x20a0
leaq 0x20(%rsp), %rdi
callq 0x31b0
leaq 0x218(%rsp), %rdi
callq 0x20b0
movl %ebx, %eax
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c01
jmp 0x2c13
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x20b0
jmp 0x2c16
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x31b0
leaq 0x78(%rsp), %rdi
callq 0x20a0
leaq 0x40(%rsp), %rdi
callq 0x20a0
leaq 0x20(%rsp), %rdi
callq 0x31b0
leaq 0x218(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2290