.586P
.model flat, stdcall
option casemap:none
include c:\masm32\include\windows.inc

.code

meat_sample proc USES ebx ecx edx esi edi ebp mPos:DWORD,Sample_ptr:DWORD 

				mov		edx,mPos
				mov		ebx,Sample_ptr
				mov     ebp, 014h
				xor		esi,esi

step_2:                                 ; CODE XREF: Button_Calculation+6B
                movzx   ecx, word ptr [edx+ebx]
                test    cx, 8000h
                jz      loc_8C3C20
                neg     cx

loc_8C3C20:                             ; CODE XREF: Button_Calculation+9
                add     esi, ecx
                add     edx, 2
                dec     ebp
                or      ebp, ebp
                jnz     loc_8C3BC2
                xor     edx, edx
                mov     eax, esi
                mov     ebx, 14h
                div     ebx
                and     eax, 0FFFFh
                or      eax, eax
                jnz     step_3

                xor     eax, eax
                ret
                
                
loc_8C3BC2:                
				cmp     edx, 1CB60h
				jb      step_2
				xor		eax,eax
				ret
step_3:
				xor eax,eax
				inc eax
				ret
meat_sample endp






meat_good_button proc USES ebx ecx edx esi edi ebp mEsi:DWORD,Thread5_num1:DWORD 
				 mov	ebx,Thread5_num1
				 mov	esi,mEsi
				
                 xor     edx, edx
                 xor     ecx, ecx
                 xor     eax, eax
                 mov     al, 5
                 mul     esi
                 mov     cl, al
                 add     cl, 5
                 mov     eax, 10h
                 ror     eax, cl
                 xor     ecx, ecx

 here:                             ; CODE XREF: Calculate_good_boy+162j
                 test    eax, ebx
                 jnz     step_6
                 ror     eax, 1
                 inc     ecx
                 cmp     ecx, 5
                 jb      here
                 xor     eax, eax        ; [6] CALCULATION
                 jmp     end_f        ; bad_boy
 ; ---------------------------------------------------------------------------

 step_6:                                 ; CODE XREF: Calculate_good_boy+156j
                 add     ecx, 532h
                 mov	 eax,ecx
                 ret

 end_f:
				xor eax,eax
				ret
meat_good_button endp

meat proc USES ebx ecx edx esi edi ebp mButton:DWORD,Thread5_num1:DWORD 
				mov		eax,mButton
loc_8C3C7F:                             ; CODE XREF: Calculate_good_boy+104
                mov     ebx, Thread5_num1
                mov     ebp, eax        ; ebp=button value
                xor     esi, esi
                mov     al, 40h

loc_8C3C8B:                             ; CODE XREF: Calculate_good_boy+12
                test    al, bl
                jz      loc_8C3CA5      ; al = X0XX XXXX
                ror     al, 1
                inc     esi
                cmp     al, 2
                jnz     loc_8C3C8B
                xor     eax, eax
                jmp     end_func        ; bad_boy
; ---------------------------------------------------------------------------

loc_8C3CA5:                             ; CODE XREF: Calculate_good_boy+124j
                xor     edx, edx
                xor     ecx, ecx
                xor     eax, eax
                mov     al, 5
                mul     esi
                mov     cl, al
                add     cl, 5
                mov     eax, 10h
                ror     eax, cl
                xor     ecx, ecx

loc_8C3CBD:                             ; CODE XREF: Calculate_good_boy+162j
                test    eax, ebx
                jnz     loc_8C3CD8
                ror     eax, 1
                inc     ecx
                cmp     ecx, 5
                jb      loc_8C3CBD
                xor     eax, eax
                jmp     end_func        ; bad_boy
; ---------------------------------------------------------------------------

loc_8C3CD8:                             ; CODE XREF: Calculate_good_boy+156j
                add     ecx, 532h
                cmp     ecx, ebp        ; ecx == numero du bouton?
                jz      loc_8C3CF2
                ;call    flip_782EEE
                xor     eax, eax
                jmp     end_func        ; bad_boy
; ---------------------------------------------------------------------------

loc_8C3CF2:                             ; CODE XREF: Calculate_good_boy+177j
                mov     al, 40h
                mov     ecx, esi
                ror     al, cl
                ;or      Thread5_num1, eax
                cmp     esi, 4          ; esi>=4 sinon rien
                jnb     loc_8C3D0E
                xor     eax, eax
                mov		eax,1
                jmp     end_func        ; bad_boy
; ---------------------------------------------------------------------------

loc_8C3D0E:                             ; CODE XREF: Calculate_good_boy+198j
                xor     eax, eax
                mov		eax,2             ; good_boy!!
                jmp     end_func
end_func:
				ret
meat endp

end