// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/lzma/C/MtCoder.c
// Function: ThreadFunc
static THREAD_FUNC_DECL ThreadFunc(void *pp)
{
  CMtCoderThread *t = (CMtCoderThread *)pp;
  for (;;)
  {
    if (Event_Wait(&t->startEvent) != 0)
      return (THREAD_FUNC_RET_TYPE)SZ_ERROR_THREAD;
    if (t->stop)
      return 0;
    {
      SRes res = ThreadFunc2(t);
      CMtCoder *mtc = t->mtCoder;
      if (res != SZ_OK)
      {
        MtProgress_SetError(&mtc->mtProgress, res);
      }
      
      #ifndef MTCODER_USE_WRITE_THREAD
      {
        unsigned numFinished = (unsigned)InterlockedIncrement(&mtc->numFinishedThreads);
        if (numFinished == mtc->numStartedThreads)
          if (Event_Set(&mtc->finishedEvent) != 0)
            return (THREAD_FUNC_RET_TYPE)SZ_ERROR_THREAD;
      }
      #endif
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
leaq 0x18(%rdi), %rbx
movq %rbx, %rdi
callq 0x3dc62
movl $0xc, %ecx
movq %rcx, 0x48(%rsp)
testl %eax, %eax
je 0x3becc
movq 0x48(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x40(%rsp)
movq %rbx, 0x60(%rsp)
cmpl $0x0, 0xc(%r14)
jne 0x3c44f
movq (%r14), %rbx
leaq 0x58(%rbx), %r14
leaq 0x368(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0xc0(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x740(%rbx), %rax
movq %rax, 0x68(%rsp)
leaq 0x208(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0x3b0(%rbx), %rax
movq %rax, 0x50(%rsp)
movq %r14, 0x38(%rsp)
movl %eax, %r12d
movq %r14, %rdi
callq 0x3dc62
movl %eax, %ecx
movl $0xc, %eax
movl $0x1, %ebp
testl %ecx, %ecx
jne 0x3c3c7
cmpl $0x0, 0x128(%rbx)
je 0x3bf68
movq %r14, %rdi
callq 0x3dbe9
testl %eax, %eax
movl $0xc, %ecx
cmovnel %ecx, %eax
jmp 0x3c3c7
movq 0x18(%rsp), %rdi
callq 0x3c509
movq $0x0, 0x10(%rsp)
testl %eax, %eax
je 0x3bf9c
movl %eax, %r14d
movb $0x1, %r13b
movq $0x0, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
jmp 0x3c091
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x18(%rbx)
je 0x3bfbe
movq 0x40(%rsp), %r15
cmpq $0x0, 0x10(%r15)
je 0x3c000
xorl %r14d, %r14d
movb $0x1, %al
jmp 0x3c01d
movq 0x28(%rbx), %rcx
movq 0x200(%rbx), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jbe 0x3bfd6
movq %rcx, 0x10(%rsp)
movq 0x20(%rbx), %rax
addq %rdx, %rax
movq %rax, 0x30(%rsp)
addq 0x10(%rsp), %rdx
movq %rdx, 0x200(%rbx)
movq %rdx, 0x20(%rsp)
cmpq %rdx, 0x28(%rbx)
sete %r13b
jmp 0x3c08e
movq (%rbx), %rsi
movq 0x38(%rbx), %rdi
callq *(%rdi)
xorl %r14d, %r14d
testq %rax, %rax
sete %r14b
movq %rax, 0x10(%r15)
setne %al
addl %r14d, %r14d
testb %al, %al
je 0x3c04b
movq 0x18(%rbx), %rdi
movq 0x10(%r15), %rsi
leaq 0x10(%rsp), %rdx
callq 0x37578
movl %eax, %r14d
movq 0x10(%rsp), %rax
addq 0x200(%rbx), %rax
movq %rax, 0x200(%rbx)
jmp 0x3c04d
xorl %eax, %eax
movq %rax, 0x20(%rsp)
testl %r14d, %r14d
je 0x3c079
movl %r14d, 0x12c(%rbx)
movq 0x18(%rsp), %rdi
movl %r14d, %esi
callq 0x3c531
movb $0x1, %r13b
movq $0x0, 0x30(%rsp)
jmp 0x3c091
movq 0x10(%rsp), %rax
cmpq (%rbx), %rax
setne %r13b
movq $0x0, 0x30(%rsp)
xorl %r14d, %r14d
movq 0x58(%rsp), %rdi
callq 0x3dde1
testl %r14d, %r14d
movl %r14d, %r15d
movl $0xc, %ecx
cmovel %ecx, %r15d
movl %eax, %ebp
testl %eax, %eax
cmovel %r14d, %r15d
movl 0x1fc(%rbx), %eax
movq %rax, 0x70(%rsp)
incl %eax
cmpl 0x1f8(%rbx), %eax
movl $0x0, %ecx
cmovael %ecx, %eax
movl %eax, 0x1fc(%rbx)
testl %r15d, %r15d
jne 0x3c0e5
movq 0x18(%rsp), %rdi
callq 0x3c509
movl %eax, %r15d
testl %r15d, %r15d
setne %al
orb %r13b, %al
movl $0x1, 0xc(%rsp)
movb $0x1, %r13b
testb $0x1, %al
movq 0x38(%rsp), %r14
jne 0x3c167
movl 0x1f4(%rbx), %eax
xorl %r13d, %r13d
cmpl 0x1f0(%rbx), %eax
jae 0x3c15f
xorl %r13d, %r13d
movl $0x0, 0xc(%rsp)
movq 0x20(%rsp), %rcx
cmpq %rcx, 0x10(%rbx)
je 0x3c167
leaq (%rax,%rax,8), %rdi
shlq $0x4, %rdi
addq 0x68(%rsp), %rdi
callq 0x3be28
testl %eax, %eax
je 0x3c3da
movl %eax, %r15d
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x3c531
movb $0x1, %r13b
movl $0x1, 0xc(%rsp)
jmp 0x3c167
movl $0x0, 0xc(%rsp)
testb %r13b, %r13b
je 0x3c176
movl $0x1, 0x128(%rbx)
movq %r14, %rdi
callq 0x3dbe9
orl %ebp, %eax
movl $0xc, %eax
movl $0x0, %ecx
cmovel %ecx, %eax
movl $0x1, %ebp
jne 0x3c3c7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r15d, %r15d
jne 0x3c210
movq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x3de7a
movl 0x230(%rbx), %ebp
movl 0x234(%rbx,%rbp,4), %eax
movl %eax, 0x230(%rbx)
movq %r14, %rdi
callq 0x3de84
cmpq $0x0, 0x18(%rbx)
movq 0x40(%rsp), %rdx
movq 0x30(%rsp), %rcx
je 0x3c1df
movq 0x10(%rdx), %rcx
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rdi
movl 0x8(%rdx), %esi
movq 0x10(%rsp), %r8
movl %ebp, %edx
movl 0xc(%rsp), %r9d
callq *(%rax)
testl %eax, %eax
je 0x3c20d
movl %eax, %r15d
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x3c531
jmp 0x3c210
xorl %r15d, %r15d
movl %r13d, 0x20(%rsp)
movq 0x70(%rsp), %r13
leaq (,%r13,2), %rax
addq %r13, %rax
movq 0x50(%rsp), %rcx
movl %r15d, (%rcx,%rax,4)
movl %ebp, 0x4(%rcx,%rax,4)
movl 0xc(%rsp), %edx
movl %edx, 0x8(%rcx,%rax,4)
movq 0x28(%rsp), %rdi
callq 0x3de7a
movl 0x19c(%rbx), %r14d
cmpl %r13d, %r14d
jne 0x3c25c
movl $0xffffffff, 0x19c(%rbx) # imm = 0xFFFFFFFF
jmp 0x3c265
movb $0x1, 0x1a0(%rbx,%r13)
movq 0x28(%rsp), %rdi
callq 0x3de84
cmpl %r13d, %r14d
jne 0x3c36e
movl 0x198(%rbx), %eax
testl %eax, %eax
cmovnel %eax, %r15d
testl %r15d, %r15d
jne 0x3c2b9
cmpl $-0x1, %ebp
je 0x3c2b9
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rdi
movl %ebp, %esi
callq *0x8(%rax)
testl %eax, %eax
je 0x3c2b6
movl %eax, %r15d
movl %eax, 0x198(%rbx)
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x3c531
jmp 0x3c2b9
xorl %r15d, %r15d
incl %r14d
cmpl 0x1f8(%rbx), %r14d
jb 0x3c2c8
xorl %r14d, %r14d
movq 0x28(%rsp), %rdi
callq 0x3de7a
cmpl $-0x1, %ebp
je 0x3c2ec
movl 0x230(%rbx), %eax
movl %ebp, %ecx
movl %eax, 0x234(%rbx,%rcx,4)
movl %ebp, 0x230(%rbx)
movl %r14d, %r13d
cmpb $0x0, 0x1a0(%rbx,%r13)
je 0x3c307
movb $0x0, 0x1a0(%rbx,%r13)
xorl %ebp, %ebp
jmp 0x3c313
movl %r14d, 0x19c(%rbx)
movl $0x4, %ebp
movq 0x28(%rsp), %rdi
callq 0x3de84
movq 0x58(%rsp), %rdi
movl $0x1, %esi
callq 0x3dd7c
testl %eax, %eax
movl $0x1, %eax
cmovnel %eax, %ebp
movl $0xc, %eax
cmovnel %eax, %r12d
testl %ebp, %ebp
jne 0x3c3a0
leaq (,%r13,2), %rax
addq %r13, %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
testl %r15d, %r15d
jne 0x3c35f
movl (%rax), %r15d
movl 0x4(%rax), %ebp
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
jmp 0x3c284
testl %r15d, %r15d
setne %al
movl 0x20(%rsp), %ecx
orb %al, %cl
movl %ecx, %eax
xorb $0x1, %al
movzbl %al, %eax
leal 0x1(,%rax,2), %ebp
testb %cl, %cl
movl $0x0, %eax
movl 0xc(%rsp), %ecx
cmovel %eax, %ecx
movl %ecx, 0xc(%rsp)
cmovnel %eax, %r12d
jmp 0x3c3a7
cmpl $0x4, %ebp
jne 0x3c3a7
xorl %ebp, %ebp
movq 0x38(%rsp), %r14
testl %ebp, %ebp
jne 0x3c3c4
xorl %ebp, %ebp
orl 0xc(%rsp), %r15d
setne %bpl
movl $0x0, %eax
cmovnel %eax, %r12d
movl %r12d, %eax
testl %ebp, %ebp
je 0x3bf29
cmpl $0x3, %ebp
je 0x3bf29
jmp 0x3c3f3
incl 0x1f4(%rbx)
xorl %r13d, %r13d
movl $0x0, 0xc(%rsp)
xorl %r15d, %r15d
jmp 0x3c167
movq 0x40(%rsp), %r14
movq (%r14), %rbx
testl %eax, %eax
je 0x3c40d
leaq 0x368(%rbx), %rdi
movl %eax, %esi
callq 0x3c531
leaq 0x1ec(%rbx), %rdi
callq 0x3de98
cmpl 0x1f4(%rbx), %eax
jne 0x3c438
addq $0x130, %rbx            # imm = 0x130
movq %rbx, %rdi
callq 0x3dbe9
testl %eax, %eax
jne 0x3beb8
movq 0x60(%rsp), %rdi
callq 0x3dc62
testl %eax, %eax
je 0x3bed6
jmp 0x3beb8
movq $0x0, 0x48(%rsp)
jmp 0x3beb8
nopl (%rax)