// File: /workspace/github_cpp_makefile_star2_O3/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 0x4e90
movq %r15, %rdi
movq %r12, %rsi
callq 0x57d8
jmp 0x4e65
movq 0x50(%rsp), %r12
movb $0x1, %bl
cmpq 0x58(%rsp), %r12
je 0x4fd0
leaq 0x98(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r13, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x4270
movq %r13, %rdi
movq %rbp, %rsi
movl $0x3a, %edx
callq 0x42b0
movq 0x98(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xb8(%rsp,%rax)
jne 0x4fad
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 0x4fad
movq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movl $0xa, %edx
callq 0x41f0
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movl $0xa, %edx
callq 0x41f0
movq %rax, %r15
movq 0x78(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x4fad
movq 0x70(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x4fad
movb %bl, 0xf(%rsp)
movq %r14, %rdi
leaq 0xf(%rsp), %rsi
callq 0x5772
movq %r15, (%rax)
movq %r13, %rdi
movq 0x4038(%rip), %rsi      # 0x8fc0
callq 0x4210
leaq 0x110(%rsp), %rdi
callq 0x4070
addq $0x20, %r12
cmpq 0x58(%rsp), %r12
jne 0x4eaf
movb $0x1, %bl
jmp 0x4fd0
movq 0x400c(%rip), %rsi      # 0x8fc0
leaq 0x98(%rsp), %rdi
callq 0x4210
leaq 0x110(%rsp), %rdi
callq 0x4070
xorl %ebx, %ebx
leaq 0x80(%rsp), %rdi
callq 0x5816
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x4ff9
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x41a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5015
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41a0
leaq 0x50(%rsp), %rdi
callq 0x5816
movq 0x3f9a(%rip), %rsi      # 0x8fc0
leaq 0x218(%rsp), %rdi
callq 0x4210
leaq 0x290(%rsp), %rdi
callq 0x4070
movl %ebx, %eax
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5058
jmp 0x507e
movq %rax, %rbx
movq 0x3f5e(%rip), %rsi      # 0x8fc0
leaq 0x98(%rsp), %rdi
callq 0x4210
leaq 0x110(%rsp), %rdi
callq 0x4070
jmp 0x5081
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x5816
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x50aa
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x41a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x50c6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x41a0
leaq 0x50(%rsp), %rdi
callq 0x5816
movq 0x3ee9(%rip), %rsi      # 0x8fc0
leaq 0x218(%rsp), %rdi
callq 0x4210
leaq 0x290(%rsp), %rdi
callq 0x4070
movq %rbx, %rdi
callq 0x4290