// File: /workspace/github_cpp_makefile_star2_O2/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), %rax
movq %rax, 0x60(%rsp)
movq %rdi, 0x20(%rsp)
movq 0x60(%rsp), %rdi
callq 0x35001
testl %eax, %eax
jne 0x33a74
cmpl $0x0, 0xc(%r14)
jne 0x33a79
movq (%r14), %r15
leaq 0x58(%r15), %rbp
leaq 0x368(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0xc0(%r15), %rax
movq %rax, 0x50(%rsp)
leaq 0x740(%r15), %rax
movq %rax, 0x58(%rsp)
leaq 0x208(%r15), %r13
leaq 0x3b0(%r15), %rax
movq %rax, 0x40(%rsp)
movq %rbp, 0x38(%rsp)
movq %r13, 0x48(%rsp)
movq %rbp, %rdi
callq 0x35001
testl %eax, %eax
jne 0x33a22
cmpl $0x0, 0x128(%r15)
jne 0x33a16
movq 0x18(%rsp), %rdi
callq 0x33b45
andq $0x0, 0x28(%rsp)
testl %eax, %eax
je 0x33637
movl %eax, %r13d
movb $0x1, 0xc(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x10(%rsp)
jmp 0x33725
movq (%r15), %r8
movq %r8, 0x28(%rsp)
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x336b3
movq 0x20(%rsp), %rbx
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
jne 0x33673
movq 0x38(%r15), %rdi
movq %r8, %rsi
callq *(%rdi)
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x336f6
movq %rax, %rsi
movq 0x18(%r15), %rdi
leaq 0x28(%rsp), %rdx
callq 0x2f018
movl %eax, %r13d
movq 0x28(%rsp), %rax
movq 0x200(%r15), %rcx
addq %rax, %rcx
movq %rcx, 0x200(%r15)
testl %r13d, %r13d
movq %rcx, 0x10(%rsp)
jne 0x33703
cmpq (%r15), %rax
setne 0xc(%rsp)
movq $0x0, 0x30(%rsp)
jmp 0x336f1
movq 0x28(%r15), %rax
movq 0x200(%r15), %rdx
movq %rax, %rcx
subq %rdx, %rcx
cmpq %rcx, %r8
jbe 0x336d1
movq %rcx, 0x28(%rsp)
movq %rcx, %r8
addq %rdx, %r8
addq 0x20(%r15), %rdx
movq %rdx, 0x30(%rsp)
movq %r8, 0x200(%r15)
movq %r8, 0x10(%rsp)
cmpq %r8, %rax
sete 0xc(%rsp)
xorl %r13d, %r13d
jmp 0x33725
pushq $0x2
popq %r13
movq $0x0, 0x10(%rsp)
movb $0x1, 0xc(%rsp)
movl %r13d, 0x12c(%r15)
movq 0x18(%rsp), %rdi
movl %r13d, %esi
callq 0x33b6d
movq $0x0, 0x30(%rsp)
movq 0x50(%rsp), %rdi
callq 0x35170
testl %r13d, %r13d
movl %r13d, %r14d
pushq $0xc
popq %rcx
cmovel %ecx, %r14d
movl %eax, %r12d
testl %eax, %eax
cmovel %r13d, %r14d
movl 0x1fc(%r15), %ebx
leal 0x1(%rbx), %eax
cmpl 0x1f8(%r15), %eax
movl $0x0, %ecx
cmovael %ecx, %eax
movl %eax, 0x1fc(%r15)
testl %r14d, %r14d
movq 0x48(%rsp), %r13
jne 0x3378d
movq 0x18(%rsp), %rdi
callq 0x33b45
movl %eax, %r14d
testl %eax, %eax
setne %al
orb 0xc(%rsp), %al
testb $0x1, %al
je 0x3382f
movl $0x1, 0x128(%r15)
movb $0x1, %dl
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
movl %edx, 0x10(%rsp)
movq %rbp, %rdi
callq 0x34f8b
orl %r12d, %eax
jne 0x33a22
pushq $-0x1
popq %rax
movl %eax, %r12d
testl %r14d, %r14d
jne 0x3389d
movq %r13, %rdi
callq 0x351fe
movl 0x230(%r15), %r12d
movl 0x234(%r15,%r12,4), %eax
movl %eax, 0x230(%r15)
movq %r13, %rdi
callq 0x35208
cmpq $0x0, 0x18(%r15)
movq 0x20(%rsp), %rdx
movq 0x30(%rsp), %rcx
je 0x33800
movq 0x10(%rdx), %rcx
movq 0x40(%r15), %rax
movq 0x48(%r15), %rdi
movl 0x8(%rdx), %esi
movq 0x28(%rsp), %r8
movl %r12d, %edx
movl 0xc(%rsp), %r9d
callq *(%rax)
testl %eax, %eax
je 0x3389a
movl %eax, %r14d
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x33b6d
jmp 0x3389d
movl 0x1f4(%r15), %eax
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
movl $0x0, %edx
cmpl 0x1f0(%r15), %eax
jae 0x337a1
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
movq 0x10(%rsp), %rcx
cmpq %rcx, 0x10(%r15)
je 0x337a1
imulq $0x90, %rax, %rdi
addq 0x58(%rsp), %rdi
callq 0x33500
testl %eax, %eax
je 0x339fd
movl %eax, %r14d
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x33b6d
jmp 0x3378d
xorl %r14d, %r14d
imulq $0xc, %rbx, %rax
movq 0x40(%rsp), %rcx
movl %r14d, (%rcx,%rax)
movl %r12d, 0x4(%rcx,%rax)
movl 0xc(%rsp), %edx
movl %edx, 0x8(%rcx,%rax)
movq %r13, %rdi
callq 0x351fe
movl 0x19c(%r15), %ebp
cmpl %ebx, %ebp
jne 0x338d4
orl $-0x1, 0x19c(%r15)
jmp 0x338dd
movb $0x1, 0x1a0(%r15,%rbx)
movq %r13, %rdi
callq 0x35208
cmpl %ebx, %ebp
jne 0x339d8
movl 0x198(%r15), %eax
testl %eax, %eax
cmovnel %eax, %r14d
testl %r14d, %r14d
jne 0x33932
cmpl $-0x1, %r12d
je 0x33932
movq 0x40(%r15), %rax
movq 0x48(%r15), %rdi
movl %r12d, %esi
callq *0x8(%rax)
testl %eax, %eax
je 0x3392f
movl %eax, %r14d
movl %eax, 0x198(%r15)
movq 0x18(%rsp), %rdi
movl %eax, %esi
callq 0x33b6d
jmp 0x33932
xorl %r14d, %r14d
incl %ebx
cmpl 0x1f8(%r15), %ebx
movl $0x0, %eax
cmovael %eax, %ebx
movq %r13, %rdi
callq 0x351fe
cmpl $-0x1, %r12d
je 0x3396a
movl 0x230(%r15), %eax
movl %r12d, %ecx
movl %eax, 0x234(%r15,%rcx,4)
movl %r12d, 0x230(%r15)
movl %ebx, %r12d
cmpb $0x0, 0x1a0(%r15,%r12)
je 0x33985
movb $0x0, 0x1a0(%r15,%r12)
xorl %ebp, %ebp
jmp 0x3398f
movl %ebx, 0x19c(%r15)
pushq $0x4
popq %rbp
movq %r13, %rdi
callq 0x35208
movq 0x50(%rsp), %rdi
pushq $0x1
popq %r13
movl %r13d, %esi
callq 0x3510d
testl %eax, %eax
cmovnel %r13d, %ebp
testl %ebp, %ebp
jne 0x339e6
imulq $0xc, %r12, %rax
addq 0x40(%rsp), %rax
testl %r14d, %r14d
jne 0x339c3
movl (%rax), %r14d
movl 0x4(%rax), %r12d
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x48(%rsp), %r13
jmp 0x338fa
testl %r14d, %r14d
setne %al
movl 0x10(%rsp), %ecx
orb %al, %cl
jmp 0x339f0
cmpl $0x4, %ebp
jne 0x33a22
orl 0xc(%rsp), %r14d
movq 0x38(%rsp), %rbp
je 0x335e6
jmp 0x33a6a
incl 0x1f4(%r15)
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
xorl %edx, %edx
jmp 0x337a1
movq %rbp, %rdi
callq 0x34f8b
testl %eax, %eax
je 0x33a6a
movq 0x20(%rsp), %r14
movq (%r14), %rbx
leaq 0x368(%rbx), %rdi
pushq $0xc
popq %rsi
callq 0x33b6d
leaq 0x1ec(%rbx), %rdi
callq 0x3521c
cmpl 0x1f4(%rbx), %eax
jne 0x33581
addq $0x130, %rbx            # imm = 0x130
movq %rbx, %rdi
callq 0x34f8b
testl %eax, %eax
je 0x33581
jmp 0x33a74
movq 0x20(%rsp), %r14
movq (%r14), %rbx
jmp 0x33a39
pushq $0xc
popq %rax
jmp 0x33a7b
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop