// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rdi, %r14
leaq 0x18(%rdi), %r15
movq %r15, %rdi
callq 0x3d81e
movl $0xc, %ecx
movq %rcx, 0x48(%rsp)
testl %eax, %eax
je 0x3ba79
movq 0x48(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x18(%rsp)
movq %r15, 0x38(%rsp)
cmpl $0x0, 0xc(%r14)
jne 0x3bfb7
movq (%r14), %r12
leaq 0x58(%r12), %rdi
movq %rdi, 0x40(%rsp)
callq 0x3d81e
testl %eax, %eax
je 0x3bafe
movq 0x18(%rsp), %r14
movq (%r14), %rbx
leaq 0x368(%rbx), %rdi
movl $0xc, %esi
callq 0x3c0b0
movq 0x38(%rsp), %r15
leaq 0x1ec(%rbx), %rdi
callq 0x3da52
cmpl 0x1f4(%rbx), %eax
jne 0x3baed
addq $0x130, %rbx            # imm = 0x130
movq %rbx, %rdi
callq 0x3d7a5
testl %eax, %eax
jne 0x3ba65
movq %r15, %rdi
callq 0x3d81e
testl %eax, %eax
je 0x3ba83
jmp 0x3ba65
leaq 0x368(%r12), %rax
movq %rax, 0x10(%rsp)
leaq 0xc0(%r12), %rax
movq %rax, 0x58(%rsp)
leaq 0x740(%r12), %rax
movq %rax, 0x60(%rsp)
leaq 0x208(%r12), %rbx
leaq 0x3b0(%r12), %rax
movq %rax, 0x50(%rsp)
cmpl $0x0, 0x128(%r12)
jne 0x3bf98
movq 0x10(%rsp), %rdi
callq 0x3c088
movq $0x0, 0x20(%rsp)
testl %eax, %eax
je 0x3bb7f
movl %eax, %r13d
movb $0x1, 0xc(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
jmp 0x3bc87
movq (%r12), %r8
movq %r8, 0x20(%rsp)
movq 0x18(%r12), %rdi
testq %rdi, %rdi
je 0x3bc0b
movq %rbx, %r14
movq 0x18(%rsp), %rbx
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
jne 0x3bbc2
movq 0x38(%r12), %rdi
movq %r8, %rsi
callq *(%rdi)
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x3bc52
movq %rax, %rsi
movq 0x18(%r12), %rdi
leaq 0x20(%rsp), %rdx
callq 0x37224
movl %eax, %r13d
movq 0x20(%rsp), %rax
movq 0x200(%r12), %rcx
addq %rax, %rcx
movq %rcx, 0x200(%r12)
testl %r13d, %r13d
movq %rcx, 0x28(%rsp)
jne 0x3bc61
cmpq (%r12), %rax
setne 0xc(%rsp)
movq $0x0, 0x30(%rsp)
xorl %r13d, %r13d
movq %r14, %rbx
jmp 0x3bc87
movq 0x28(%r12), %rax
movq 0x200(%r12), %rdx
movq %rax, %rcx
subq %rdx, %rcx
cmpq %rcx, %r8
jbe 0x3bc2b
movq %rcx, 0x20(%rsp)
movq %rcx, %r8
addq %rdx, %r8
addq 0x20(%r12), %rdx
movq %rdx, 0x30(%rsp)
movq %r8, 0x200(%r12)
movq %r8, 0x28(%rsp)
cmpq %r8, %rax
sete 0xc(%rsp)
xorl %r13d, %r13d
jmp 0x3bc87
movl $0x2, %r13d
movq $0x0, 0x28(%rsp)
movq %r14, %rbx
movb $0x1, 0xc(%rsp)
movl %r13d, 0x12c(%r12)
movq 0x10(%rsp), %rdi
movl %r13d, %esi
callq 0x3c0b0
movq $0x0, 0x30(%rsp)
movq 0x58(%rsp), %rdi
callq 0x3d99b
testl %r13d, %r13d
movl %r13d, %r15d
movl $0xc, %ecx
cmovel %ecx, %r15d
movl %eax, %ebp
testl %eax, %eax
cmovel %r13d, %r15d
movl 0x1fc(%r12), %r14d
leal 0x1(%r14), %eax
cmpl 0x1f8(%r12), %eax
movl $0x0, %ecx
cmovael %ecx, %eax
movl %eax, 0x1fc(%r12)
testl %r15d, %r15d
jne 0x3bcef
movq 0x10(%rsp), %rdi
callq 0x3c088
movl %eax, %r15d
testl %eax, %eax
setne %al
orb 0xc(%rsp), %al
testb $0x1, %al
je 0x3bd93
movl $0x1, 0x128(%r12)
movb $0x1, %dl
movl $0x1, %r13d
movl %edx, 0xc(%rsp)
movq 0x40(%rsp), %rdi
callq 0x3d7a5
orl %ebp, %eax
jne 0x3baa4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %r15d, %r15d
jne 0x3bdfb
movq %rbx, %rdi
callq 0x3da34
movl 0x230(%r12), %ebp
movl 0x234(%r12,%rbp,4), %eax
movl %eax, 0x230(%r12)
movq %rbx, %rdi
callq 0x3da3e
cmpq $0x0, 0x18(%r12)
movq 0x18(%rsp), %rdx
movq 0x30(%rsp), %rcx
je 0x3bd65
movq 0x10(%rdx), %rcx
movq 0x40(%r12), %rax
movq 0x48(%r12), %rdi
movl 0x8(%rdx), %esi
movq 0x20(%rsp), %r8
movl %ebp, %edx
movl %r13d, %r9d
callq *(%rax)
testl %eax, %eax
je 0x3bdf8
movl %eax, %r15d
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x3c0b0
jmp 0x3bdfb
movl 0x1f4(%r12), %eax
xorl %r15d, %r15d
movl $0x0, %r13d
movl $0x0, %edx
cmpl 0x1f0(%r12), %eax
jae 0x3bd03
xorl %r15d, %r15d
movq 0x28(%rsp), %rcx
cmpq %rcx, 0x10(%r12)
je 0x3bd03
leaq (%rax,%rax,8), %rdi
shlq $0x4, %rdi
addq 0x60(%rsp), %rdi
callq 0x3b9d5
testl %eax, %eax
je 0x3bf83
movl %eax, %r15d
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x3c0b0
jmp 0x3bcef
xorl %r15d, %r15d
leaq (%r14,%r14,2), %rax
movq 0x50(%rsp), %rcx
movl %r15d, (%rcx,%rax,4)
movl %ebp, 0x4(%rcx,%rax,4)
movl %r13d, 0x8(%rcx,%rax,4)
movq %rbx, %rdi
callq 0x3da34
cmpl %r14d, 0x19c(%r12)
jne 0x3bf38
movl $0xffffffff, 0x19c(%r12) # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x3da3e
movl 0x198(%r12), %eax
testl %eax, %eax
cmovnel %eax, %r15d
testl %r15d, %r15d
jne 0x3be82
cmpl $-0x1, %ebp
je 0x3be82
movq 0x40(%r12), %rax
movq 0x48(%r12), %rdi
movl %ebp, %esi
callq *0x8(%rax)
testl %eax, %eax
je 0x3be7f
movl %eax, %r15d
movl %eax, 0x198(%r12)
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x3c0b0
jmp 0x3be82
xorl %r15d, %r15d
incl %r14d
cmpl 0x1f8(%r12), %r14d
jb 0x3be92
xorl %r14d, %r14d
movl %r13d, 0xc(%rsp)
movq %rbx, %rdi
callq 0x3da34
cmpl $-0x1, %ebp
je 0x3bebe
movl 0x230(%r12), %eax
movl %ebp, %ecx
movl %eax, 0x234(%r12,%rcx,4)
movl %ebp, 0x230(%r12)
movq %rbx, %r13
movl %r14d, %ebp
cmpb $0x0, 0x1a0(%r12,%rbp)
je 0x3bedc
movb $0x0, 0x1a0(%r12,%rbp)
xorl %ebx, %ebx
jmp 0x3bee9
movl %r14d, 0x19c(%r12)
movl $0x4, %ebx
movq %r13, %rdi
callq 0x3da3e
movq 0x58(%rsp), %rdi
movl $0x1, %esi
callq 0x3d936
testl %eax, %eax
je 0x3bf09
movl $0x1, %ebx
testl %ebx, %ebx
jne 0x3bf59
leaq (,%rbp,2), %rax
addq %rbp, %rax
movq 0x50(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
testl %r15d, %r15d
movq %r13, %rbx
jne 0x3bf2c
movl (%rax), %r15d
movl 0x4(%rax), %ebp
movl 0x8(%rax), %r13d
jmp 0x3be49
movb $0x1, 0x1a0(%r12,%r14)
movq %rbx, %rdi
callq 0x3da3e
testl %r15d, %r15d
setne %al
movl 0xc(%rsp), %ecx
orb %al, %cl
je 0x3bf6c
jmp 0x3bfaa
cmpl $0x4, %ebx
jne 0x3baa4
orl 0xc(%rsp), %r15d
movq %r13, %rbx
jne 0x3bfaa
movq 0x40(%rsp), %rdi
callq 0x3d81e
testl %eax, %eax
je 0x3bb3a
jmp 0x3baa4
incl 0x1f4(%r12)
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %edx, %edx
jmp 0x3bd03
movq 0x40(%rsp), %rdi
callq 0x3d7a5
testl %eax, %eax
jne 0x3baa4
movq 0x18(%rsp), %r14
movq (%r14), %rbx
jmp 0x3babd
movq $0x0, 0x48(%rsp)
jmp 0x3ba65
nopl (%rax)