// File: coolsuperman[P]ShareCataLogServer/upload.cc
// Function: Upload::MatchBoundry(char*, int, int*)
int MatchBoundry(char* buf,int blen,int* boundryPos){
      //----boundry;
      //first_boundry:------boundry;
      //middle_boundry:\r\n------boundry\r\n
      //last_boundry:\r\n------boundry--\r\n
      //从起始位置匹配first_boundry
      if(!memcmp(buf,_f_boundry.c_str(),_f_boundry.size())){
        boundryPos = 0;
        return BOUNDRY_FIRST;
      }
      for(int i = 0;i<blen;++i){
        //字符串剩余长度大于boundry的长度，则全部匹配
       // if((size_t)(blen-i)>_m_boundry.size()){
          if(!memcmp(buf+i,_m_boundry.c_str(),_m_boundry.size())){
            *boundryPos = i;
            return BOUNDRY_MIDDLE;
          }
          else if(!memcmp(buf+i,_l_boundry.c_str(),_l_boundry.size())){
            *boundryPos = i;
            return BOUNDRY_LAST;
          }
       // }
       else{
          //否则，如果剩余长度小于boundry长度，防止出现半个boundry
          //所以进行部分匹配
          int cmp_len=(blen-i);
          if(!memcmp(buf+i,_l_boundry.c_str(),cmp_len)){
            *boundryPos = i;
            return BOUNDRY_BAK;
          }
          if(!memcmp(buf+i,_m_boundry.c_str(),cmp_len)){
            *boundryPos = i;
            return BOUNDRY_BAK;
          }
        }
      }
      return BOUNDRY_NO;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
addq $0x30, %rdi
callq 0x20e0
movq -0x48(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x30, %rdi
callq 0x2170
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
callq 0x2110
cmpl $0x0, %eax
jne 0x4a4d
movq $0x0, -0x28(%rbp)
movl $0x1, -0x4(%rbp)
jmp 0x4bb8
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x4bb1
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
addq $0x50, %rdi
callq 0x20e0
movq -0x48(%rbp), %rdi
movq %rax, -0x50(%rbp)
addq $0x50, %rdi
callq 0x2170
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rax, %rdx
callq 0x2110
cmpl $0x0, %eax
jne 0x4ab7
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x2, -0x4(%rbp)
jmp 0x4bb8
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
addq $0x70, %rdi
callq 0x20e0
movq -0x48(%rbp), %rdi
movq %rax, -0x60(%rbp)
addq $0x70, %rdi
callq 0x2170
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq %rax, %rdx
callq 0x2110
cmpl $0x0, %eax
jne 0x4b0e
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x3, -0x4(%rbp)
jmp 0x4bb8
movq -0x48(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
addq $0x70, %rdi
callq 0x20e0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
movslq -0x30(%rbp), %rdx
callq 0x2110
cmpl $0x0, %eax
jne 0x4b5a
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x4, -0x4(%rbp)
jmp 0x4bb8
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
addq $0x50, %rdi
callq 0x20e0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
movslq -0x30(%rbp), %rdx
callq 0x2110
cmpl $0x0, %eax
jne 0x4b9d
movl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x4, -0x4(%rbp)
jmp 0x4bb8
jmp 0x4b9f
jmp 0x4ba1
jmp 0x4ba3
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4a54
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop