// File: /workspace/github_cpp_makefile_star2_O1/coolsuperman[P]ShareCataLogServer/upload.cc
// Function: Upload::ProcessUpload()
bool ProcessUpload(){//对正文进行处理，将文件数据进行存储（处理上传）
      int64_t tlen = 0,blen=0;//已读取多少；当前buffer数据长度；
      char buf[MAX_BUFF];
      while(tlen<content_len){
        int len = read(0,buf+blen,MAX_BUFF-blen);
        blen+=len;//当前buf中数据长度
        int boundry_pos,content_pos;
        if(MatchBoundry(buf,blen,&boundry_pos)==BOUNDRY_FIRST){
            std::cerr<<"first boundry match success!"<<std::endl;
          //1.匹配到firstBoundry，获取头部，从中获取文件名
          //2.若获取文件名成功，则创建文件，打开文件
          //3.将头信息从buf移除，上下数据进行下一步匹配
          if(GetFileName(buf,&content_pos)){
            CreateFile();
            std::cerr<<"OutCreatFile content_pos:"<<content_pos << " blen:" << blen<<std::endl;
            blen-=content_pos;
            memmove(buf,buf+content_pos,blen);
           // std::cerr << "buf:[" << buf << "]\n";
          }else{
            blen-=_f_boundry.size();
            memmove(buf,buf+_f_boundry.size(),blen);
          }
        }
       // std::cerr << "will middle boundary match\n";
        while(1){
          if(MatchBoundry(buf,blen,&boundry_pos)!=BOUNDRY_MIDDLE){
           // std::cerr<<"middle boundry match fail!"<<std::endl;
            break;
          }
          std::cerr<<"middle boundry match success!"<<std::endl;
          //匹配middle_boundry成功
          //1.将boundry之前数据写入文件，将数据从buf中移除,关闭文件
          //2.看boundry头中是否有文件名--雷同first_boundry;
          WriteFile(buf,boundry_pos);//
          CloseFile();
          blen-=boundry_pos;//
          memmove(buf,buf+content_pos,blen);
          if(GetFileName(buf,&content_pos)){
            CreateFile();
            blen-=content_pos;
            memmove(buf,buf+content_pos,blen);
          }else{
            if(content_pos==0)
              break;
            blen-=_m_boundry.size();
            memmove(buf,buf+_m_boundry.size(),blen);
          }
        }
        if(MatchBoundry(buf,blen,&boundry_pos)==BOUNDRY_LAST){
          std::cerr<<"last boundry match success!"<<std::endl;
          //匹配Boundry_LAST成功
          //1.将boundry之前的数据写入文件
          //2.关闭文件
          //3.上传文件处理完毕，退出
          WriteFile(buf,boundry_pos);//
          CloseFile();
          return true;
        }
        if(MatchBoundry(buf,blen,&boundry_pos)==BOUNDRY_BAK){
          //1.将类似boundry位置之前的数据写入文件
          //2.移除之前的数据
          //3.剩下的数据不动，重新继续接收数据，补全后继续匹配
          WriteFile(buf,boundry_pos);//
          blen-=boundry_pos;//
          memmove(buf,buf+content_pos,blen);
        }
        if(MatchBoundry(buf,blen,&boundry_pos)==BOUNDRY_NO){
          WriteFile(buf,blen);//
          blen=0;//
        }
        tlen +=len;
      }
      return false;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movq %rdi, %rbx
xorl %ecx, %ecx
leaq -0x1050(%rbp), %r14
leaq -0x2c(%rbp), %r15
movq 0x4b8b(%rip), %r12      # 0x7ff0
xorl %r13d, %r13d
movq %rcx, %rax
movq (%rbx), %rcx
movq %rcx, -0x40(%rbp)
cmpq %rcx, %rax
jge 0x378c
movq %rax, -0x38(%rbp)
leaq -0x1050(,%r13), %rsi
addq %rbp, %rsi
movl $0x1000, %edx           # imm = 0x1000
subq %r13, %rdx
xorl %edi, %edi
callq 0x22c0
cltq
movq %rax, -0x48(%rbp)
addq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq %r15, %rcx
callq 0x3aac
cmpl $0x1, %eax
jne 0x35a4
movl $0x1c, %edx
movq %r12, %rdi
leaq 0x1dbb(%rip), %rsi      # 0x5286
callq 0x2250
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rbx, %rdi
movq %r14, %rsi
leaq -0x30(%rbp), %rdx
callq 0x3ba8
testb %al, %al
je 0x3587
movq %rbx, %rdi
callq 0x3d4e
movl $0x19, %edx
movq %r12, %rdi
leaq 0x1d81(%rip), %rsi      # 0x52a3
callq 0x2250
movl -0x30(%rbp), %esi
movq %r12, %rdi
callq 0x2350
movq %rax, %r15
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1d79(%rip), %rsi      # 0x52bd
callq 0x2250
movq %r15, %rdi
movq %r13, %rsi
callq 0x21f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r15, %rdi
leaq -0x2c(%rbp), %r15
callq 0x2030
movq %rax, %rdi
callq 0x2130
jmp 0x365e
movq 0x38(%rbx), %rax
subq %rax, %r13
leaq (%rax,%rbp), %rsi
addq $-0x1050, %rsi          # imm = 0xEFB0
movq %r14, %rdi
movq %r13, %rdx
callq 0x2330
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq %r15, %rcx
callq 0x3aac
cmpl $0x2, %eax
jne 0x3676
movl $0x1d, %edx
movq %r12, %rdi
leaq 0x1cf7(%rip), %rsi      # 0x52c4
callq 0x2250
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x360e
movslq -0x2c(%rbp), %rdx
movq %r14, %rsi
callq 0x20c0
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x3622
callq 0x23c0
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movslq -0x2c(%rbp), %rax
subq %rax, %r13
movslq -0x30(%rbp), %rax
leaq (%rax,%rbp), %rsi
addq $-0x1050, %rsi          # imm = 0xEFB0
movq %r14, %rdi
movq %r13, %rdx
callq 0x2330
movq %rbx, %rdi
movq %r14, %rsi
leaq -0x30(%rbp), %rdx
callq 0x3ba8
testb %al, %al
je 0x3667
movq %rbx, %rdi
callq 0x3d4e
movslq -0x30(%rbp), %rax
jmp 0x358b
cmpl $0x0, -0x30(%rbp)
je 0x3676
movq 0x58(%rbx), %rax
jmp 0x358b
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq %r15, %rcx
callq 0x3aac
movq %r15, %rcx
movl %eax, %r15d
cmpl $0x3, %eax
jne 0x36ff
movl $0x1b, %edx
movq %r12, %rdi
leaq 0x1c41(%rip), %rsi      # 0x52e2
callq 0x2250
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x36e2
movslq -0x2c(%rbp), %rdx
movq %r14, %rsi
callq 0x20c0
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x36f6
callq 0x23c0
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rax
movq %rax, %rcx
jmp 0x377e
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x3aac
cmpl $0x4, %eax
jne 0x3747
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x3726
movslq -0x2c(%rbp), %rdx
movq %r14, %rsi
callq 0x20c0
movslq -0x2c(%rbp), %rax
subq %rax, %r13
movslq -0x30(%rbp), %rax
leaq (%rax,%rbp), %rsi
addq $-0x1050, %rsi          # imm = 0xEFB0
movq %r14, %rdi
movq %r13, %rdx
callq 0x2330
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
leaq -0x2c(%rbp), %rcx
callq 0x3aac
testl %eax, %eax
jne 0x3773
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x3770
movslq %r13d, %rdx
movq %r14, %rsi
callq 0x20c0
xorl %r13d, %r13d
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
addq %rax, %rcx
cmpl $0x3, %r15d
leaq -0x2c(%rbp), %r15
jne 0x3468
cmpq -0x40(%rbp), %rax
setl %al
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop