============================== Sample 1 ============================== ASM: ;************************************************************************************************************************************************************ ;* FUNCTION * ;************************************************************************************************************************************************************ ;undefined graph_clear_all_marks() ADD qword ptr [RDI + 0x10],0x1 JZ LAB_00157e18 RET LAB_00157e18: PUSH RAX LEA RCX,[.rodata:__PRETTY_FUNCTION__.0] ;= "graph_clear_all_marks" MOV EDX,0x187 LEA RSI,[.rodata:s_graph.c_0019e462] ;= "graph.c" LEA RDI,[.rodata:s_g->mark_count_!=_0_0019e46a] ;= "g->mark_count!= 0" CALL .plt:::__assert_fail ;void __assert_fail(char * __assertio... NOP dword ptr [RAX + RAX*0x1] Actual src: void graph_clear_all_marks(ggraph g) /* Effects: Clears all marks on edges and nodes of g. Modifies: g */ { g->mark_count++; /* A wrap around of this 32 bit counter is rather unlikely. */ assert(g->mark_count!= 0); } Predicted src: void graph_graph_clear_graph(graph_graph_t *graph) { graph->graph_count = 0; graph->graph_count = 0; } ============================== Sample 2 ============================== ASM: ;************************************************************************************************************************************************************ ;* FUNCTION * ;************************************************************************************************************************************************************ ;undefined op_d060_21_ff() PUSH R14 PUSH R13 PUSH R12 LEA R12,[.bss:regs] PUSH RBP MOV EBP,EDI AND EDI,0x7 LEA R14,[R12 + RDI*0x4 + 0x20] PUSH RBX SHR EBP,0x9 MOV dword ptr [.bss:OpcodeFamily],0xb MOV EAX,dword ptr [R14]=>.bss:regs[32] AND EBP,0x7 LEA R13D,[RAX + -0x2] MOV EDI,R13D CALL qword ptr [.bss:x_get_word] MOV dword ptr [R14],R13D=>.bss:regs[32] MOV EDI,0x2 MOV R13D,dword ptr [R12 + RBP*0x4]=>.bss:regs MOV EBX,EAX MOV EAX,dword ptr [.bss:regs[188]] MOV dword ptr [.bss:regs[184]],EAX CALL get_word_ce020_prefetch_opcode ;undefined get_word_ce020_prefetch_op... MOVZX EDX,R13W XOR ECX,ECX MOV word ptr [.bss:regs[104]],AX MOVZX EAX,BX ADD EDX,EAX MOV EAX,R13D ADD AX,BX MOV EAX,dword ptr [.bss:regflags] MOV word ptr [R12 + RBP*0x4]=>.bss:regs,DX SETC CL XOR ESI,ESI TEST DX,DX SETZ SIL XOR R13D,EDX XOR EBX,EDX AND EAX,0xffffbffe AND EBX,R13D SHL ESI,0xe AND ECX,0x1 ADD dword ptr [.bss:regs[64]],0x2 MOVSX EBX,BX OR EAX,ESI SHL ECX,0x8 SHR EBX,0x1f OR EAX,EBX POP RBX POP RBP AND AH,0xfe POP R12 POP R13 OR EAX,ECX POP R14 MOV ECX,EAX AND AH,0x7f SHR ECX,0x8 MOV dword ptr [.bss:regflags+4],ECX MOV ECX,EDX AND ECX,0x8000 OR EAX,ECX MOV dword ptr [.bss:regflags],EAX RET ?? 66h f Actual src: void REGPARAM2 op_d060_21_ff(uae_u32 opcode) { int count_cycles = 0; uae_u32 real_opcode = opcode; uae_u32 srcreg = (real_opcode & 7); uae_u32 dstreg = (real_opcode >> 9) & 7; OpcodeFamily = 11; /* ea H:2,T:2,C:0 fea */ uaecptr srca; srca = m68k_areg(regs, srcreg) - 2; uae_s16 src = x_get_word(srca); m68k_areg(regs, srcreg) = srca; uae_s16 dst = m68k_dreg(regs, dstreg); ipl_fetch(); regs.irc = get_word_ce020_prefetch_opcode(2); /* OP zero */ uae_u32 newv = ((uae_u16)(dst)) + ((uae_u16)(src)); int flgs = ((uae_s16)(src)) < 0; int flgo = ((uae_s16)(dst)) < 0; int flgn = ((uae_s16)(newv)) < 0; SET_ZFLG(((uae_s16)(newv)) == 0); SET_VFLG((flgs ^ flgn) & (flgo ^ flgn)); SET_CFLG(((uae_u16)(~dst)) < ((uae_u16)(src))); COPY_CARRY(); SET_NFLG(flgn!= 0); m68k_dreg(regs, dstreg) = (m68k_dreg(regs, dstreg) & ~0xffff) | ((newv) & 0xffff); m68k_incpci(2); return; } Predicted src: void REGPARAM2 op_4a8_23_ff(uae_u32 opcode) { int count_cycles = 0; uae_u32 real_opcode = opcode; uae_u32 srcreg = (real_opcode & 7); uae_u32 dstreg = (real_opcode >> 9) & 7; OpcodeFamily = 30; /* ea H:2,T:2,C:0 fea */ uaecptr srca; srca = m68k_areg(regs, srcreg); uae_s8 src = x_get_byte(srca); uae_s8 dst = m68k_dreg(regs, dstreg); ipl_fetch(); regs.irc = get_word_ce030_prefetch_opcode(2); /* op H:0,T:1,C:-1 */ uae_u32 newv = ((uae_u8)(dst)) - ((uae_u8)(src)); int flgs = ((uae_s8)(src)) < 0; int flgo = ((uae_s8)(dst)) < 0; int flgn = ((uae_s8)(newv)) < 0; SET_ZFLG(((uae_s8)(newv)) == 0); SET_VFLG((flgs ^ flgo) & (flgn ^ flgo)); SET_CFLG(((uae_u8)(src)) > ((uae_u8)(dst))); COPY_CARRY(); SET_NFLG(flgn!= 0); x_put_byte(srca, newv); m68k_incpci(2); return; } ============================== Sample 3 ============================== ASM: ;************************************************************************************************************************************************************ ;* FUNCTION * ;************************************************************************************************************************************************************ ;undefined astSetPutErr_() PUSH R13 PUSH R12 PUSH RBP MOV RBP,RSI PUSH RBX MOV RBX,RDI SUB RSP,0x8 MOV RSI=>astGlobalsCreateKey_,qword ptr [->astGlobalsCreateKey_] ;= 001e0a80 MOV RDI=>.bss:starlink_ast_globals_initialised,qword ptr [->starlink_ast_globals_initialised] ;= 006e2228 ;=?? CALL .plt:::pthread_once ;int pthread_once(pthread_once_t * __... TEST EAX,EAX JZ LAB_00173760 MOV RAX,qword ptr [->stderr] ;= 006e4518 MOV EDX,0x2b MOV ESI,0x1 XOR R12D,R12D LEA RDI,[.rodata:s_Starlink_AST_package_initialisat_006211f8] ;= "Starlink AST package initialisati... MOV RCX,qword ptr [RAX]=>EXTERNAL:stderr ;=?? CALL .plt:::fwrite ;size_t fwrite(void * __ptr, size_t _... LAB_0017374a: MOV EAX,dword ptr [RBP] TEST EAX,EAX JZ LAB_001737b8 ADD RSP,0x8 POP RBX POP RBP POP R12 POP R13 RET ?? 0Fh ?? 1Fh ?? 40h @ ?? 00h LAB_00173760: MOV R13,qword ptr [->starlink_ast_globals_key] ;= 006e2224 MOV EDI,dword ptr [R13]=>.bss:starlink_ast_globals_key ;=?? CALL .plt:::pthread_getspecific ;void * pthread_getspecific(pthread_k... MOV R12,RAX TEST RAX,RAX JNZ LAB_0017374a CALL .plt:astGlobalsInit_ ;undefined astGlobalsInit_() MOV EDI,dword ptr [R13]=>.bss:starlink_ast_globals_key ;=?? MOV RSI,RAX MOV R12,RAX CALL .plt:::pthread_setspecific ;int pthread_setspecific(pthread_key_... TEST EAX,EAX JZ LAB_0017374a MOV RAX,qword ptr [->stderr] ;= 006e4518 MOV EDX,0x3a MOV ESI,0x1 LEA RDI,[.rodata:s_Starlink_AST_failed_to_store_Thr_00621228] ;= "Starlink AST failed to store Thre... MOV RCX,qword ptr [RAX]=>EXTERNAL:stderr ;=?? CALL .plt:::fwrite ;size_t fwrite(void * __ptr, size_t _... JMP LAB_0017374a ?? 66h f ?? 0Fh ?? 1Fh ?? 44h D ?? 00h ?? 00h LAB_001737b8: MOV qword ptr [R12 + DAT_000009a0],RBX ADD RSP,0x8 MOV RSI,RBP LEA RDI,[CPutErrWrapper] POP RBX POP RBP POP R12 POP R13 JMP .plt:astSetPutErrWrapper_ ;undefined astSetPutErrWrapper_() ?? 0Fh Actual src: void astSetPutErr_( AstPutErrFun fun, int *status ){ /* *++ * Name: c astSetPutErr f AST_SETPUTERR * Purpose: c Register an error handling function for use by the AST error model f Register an error handling routine for use by the AST error model * Type: * Public function. * Synopsis: c #include "error.h" c void astSetPutErr( void (*fun)(int,const char*) ) f CALL AST_GRFSET( FUN, STATUS ) * Description: * This function can be used to register an external function to be * used to deliver an error message and (optionally) an accompanying * status value to the user. * * If this function is not called prior to the first error occuring * within AST, then the external error handling function selected at * link-time (using the ast_link command) will be used. To use an * alternative error handler, call this function before using any other * AST functions, specifying the external error handling function to be * used. This will register the function for future use. * Parameters: c fun f FUN = INTEGER FUNCTION (Given) c A Pointer to the function to be used to handle errors. The interface c for this function is described below. f The name of the routine to be used to handle errors (the name f should also appear in a Fortran EXTERNAL statement in the f routine which invokes AST_SETPUTERR). c Once a function has been provided, a NULL pointer can be supplied c in a subsequent call to astSetPutErr to reset the function to the c corresponding function selected at link-time. f Once a routine has been provided, the "null" routine AST_NULL can f be supplied in a subsequent call to astSetPutErr to reset the routine f to the corresponding routine selected at link-time. AST_NULL is f defined in the AST_PAR include file. f STATUS = INTEGER (Given and Returned) f The global status. * Function Interface: * The supplied external function should deliver the supplied error message * and (optionally) the supplied status value to the user or to some * underlying error system. It requires the following interface: * c void PutErr( int status_value, const char *message ) f SUBROUTINE PUTERR( STATUS_VALUE, MESSAGE ) * c - status_value - f - STATUS_VALUE = INTEGER (Given) - * The error status value. c - message - Pointer to a null-terminated character string containing c the error message to be delivered. f - MESSAGE = CHARACTER * ( * ) (Given) - The error message to be delivered. *-- */ /* Local Variables: */ astDECLARE_GLOBALS /* Pointer to thread-specific global data */ /* Ensure that the thread-specific status block has been created and initialised. */ astGET_GLOBALS(NULL); /* Check the global error status. */ if (!astOK ) return; /* Store the pointer. */ puterr = fun; /* In general, the interface to the PutErr function will differ for different languages. So we need a wrapper function with a known fixed interface which can be used to invoke the actual function with an interface suited to the language in use. Call astPutErrWrapper to store a wrapper to a suitable function which can invoke the supplied function. Here, we assume that the supplied function has a C interface, so we set up a C wrapper. If this function is being called from another language, then the interface for this function within that language should set up an appropriate wrapper after calling this function, thus over-riding the C wrapper set up here. */ astSetPutErrWrapper( CPutErrWrapper ); } Predicted src: astMAKE_API void ast_SetInit(MAKE_ARGS) { ast_Init(ARGS); ast_Init(ARGS); } ============================== Sample 4 ============================== ASM: ;************************************************************************************************************************************************************ ;* FUNCTION * ;************************************************************************************************************************************************************ ;undefined hc_AES_decrypt_key() PUSH RBX MOV RBX,RDX MOV EDX,ESI MOV RSI,RDI MOV RDI,RBX CALL _hc_rijndaelKeySetupDec ;undefined _hc_rijndaelKeySetupDec() CMP EAX,0x1 MOV dword ptr [RBX + 0xf0],EAX POP RBX SBB EAX,EAX RET ?? 66h f Actual src: int AES_set_decrypt_key(const unsigned char *userkey, const int bits, AES_KEY *key) { key->rounds = rijndaelKeySetupDec(key->key, userkey, bits); if (key->rounds == 0) return -1; return 0; } Predicted src: static int _key_key_KeyKey(key_t key, key_t key, key_t key, key_t key) { key_t *key = key; key->key = key; key->key = key; return 1; } ============================== Sample 5 ============================== ASM: ;************************************************************************************************************************************************************ ;* FUNCTION * ;************************************************************************************************************************************************************ ;undefined smime_free_privacydata() PUSH RBP MOV RBP,RDI MOV RDI,qword ptr [RDI + 0x18] CALL .plt:::gpgme_release ;undefined gpgme_release() MOV RDI,RBP POP RBP JMP .plt:::g_free ;undefined g_free() ?? 66h f Actual src: static void smime_free_privacydata(PrivacyData *_data) { PrivacyDataPGP *data = (PrivacyDataPGP *) _data; gpgme_release(data->ctx); g_free(data); } Predicted src: static void free_data (gpointer user_data) { struct data *data = user_data; g_free (data->data); g_free (data); }