// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
leaq 0x218(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x4270
xorl %eax, %eax
leaq 0x50(%rsp), %r15
movq %rax, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x40(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq %rax, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
leaq 0x10(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
movl $0x2c, %edx
callq 0x42b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4dcc
movq %r15, %rdi
movq %r12, %rsi
callq 0x571a
jmp 0x4da1
movq 0x50(%rsp), %r15
cmpq 0x58(%rsp), %r15
sete %bl
je 0x4f0a
leaq 0x98(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x4270
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movl $0x3a, %edx
callq 0x42b0
movq 0x98(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xb8(%rsp,%rax)
jne 0x4ee9
leaq (%rsp,%rax), %rdi
addq $0x98, %rdi
movl $0xa, %esi
callq 0x4170
movsbl %al, %edx
movq %r13, %rdi
leaq 0x30(%rsp), %rsi
callq 0x42b0
movq 0x98(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xb8(%rsp,%rax)
je 0x4ee9
movq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movl $0xa, %edx
callq 0x41f0
movq %rax, %rbp
movq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movl $0xa, %edx
callq 0x41f0
movq %rax, %r12
movq 0x78(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x4ee9
movq 0x70(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x4ee9
movb %bpl, 0xf(%rsp)
movq %r14, %rdi
leaq 0xf(%rsp), %rsi
callq 0x56b6
movq %r12, (%rax)
movq %r13, %rdi
movq 0x40fd(%rip), %rsi      # 0x8fc0
callq 0x4210
leaq 0x110(%rsp), %rdi
callq 0x4070
addq $0x20, %r15
cmpq 0x58(%rsp), %r15
sete %bl
jne 0x4de7
jmp 0x4f0a
movq 0x40d0(%rip), %rsi      # 0x8fc0
leaq 0x98(%rsp), %rdi
callq 0x4210
leaq 0x110(%rsp), %rdi
callq 0x4070
leaq 0x80(%rsp), %rdi
callq 0x5758
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4f33
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x41a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x4f4f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41a0
leaq 0x50(%rsp), %rdi
callq 0x5758
movq 0x4060(%rip), %rsi      # 0x8fc0
leaq 0x218(%rsp), %rdi
callq 0x4210
leaq 0x290(%rsp), %rdi
callq 0x4070
andb $0x1, %bl
movl %ebx, %eax
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4f95
jmp 0x4fbb
movq %rax, %rbx
movq 0x4021(%rip), %rsi      # 0x8fc0
leaq 0x98(%rsp), %rdi
callq 0x4210
leaq 0x110(%rsp), %rdi
callq 0x4070
jmp 0x4fbe
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x5758
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4fe7
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x41a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5003
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41a0
leaq 0x50(%rsp), %rdi
callq 0x5758
movq 0x3fac(%rip), %rsi      # 0x8fc0
leaq 0x218(%rsp), %rdi
callq 0x4210
leaq 0x290(%rsp), %rdi
callq 0x4070
movq %rbx, %rdi
callq 0x4290