{"name": "Sys_ConsoleInput", "code": "char * Sys_ConsoleInput ( ) { char * @@result@@ ; __int64 v1 ; char * v2 ; char * v3 ; int * @@v4@@ ; int * v5 ; fd_set @@readfds@@ ; struct timeval @@timeout@@ ; char @@buf@@ ; char * @@v9@@ ; int @@v10@@ ; int @@v11@@ ; unsigned int @@v12@@ ; int @@v13@@ ; if ( ! ttycon_on ) { if ( ! com_dedicated || ! * ( _DWORD * ) ( com_dedicated + Number L ) ) return Number L ; if ( ! stdin_active ) return Number L ; memset ( & @@readfds@@ , Number , sizeof ( @@readfds@@ ) ) ; @@v13@@ = Number ; @@v12@@ = ( unsigned int ) & @@timeout@@ ; @@readfds@@ . fds_bits [ Number ] |= Number ; @@timeout@@ . tv_sec = Number L ; @@timeout@@ . tv_usec = Number L ; if ( select ( Number , & @@readfds@@ , Number L , Number L , & @@timeout@@ ) == Number || ( @@readfds@@ . fds_bits [ Number ] & Number ) == Number ) return Number L ; @@v11@@ = read ( Number , text_8197 , Number ) ; if ( @@v11@@ ) { if ( @@v11@@ > Number ) { text_8197 [ @@v11@@ - Number ] = Number ; @@result@@ = text_8197 ; } else { @@result@@ = Number L ; } } else { stdin_active = Number ; @@result@@ = Number L ; } return @@result@@ ; } @@v10@@ = read ( Number , & @@buf@@ , Number ) ; if ( @@v10@@ == Number ) return Number L ; if ( @@buf@@ == tty_erase || @@buf@@ == Number || @@buf@@ == Number ) { if ( tty_con > Number ) { byte_1C0C [ -- tty_con ] = Number ; tty_Back ( ) ; } return Number L ; } if ( ! @@buf@@ || @@buf@@ > Number ) { if ( ( unsigned int ) tty_con > Number ) return Number L ; byte_1C0C [ tty_con ++ ] = @@buf@@ ; write ( Number , & @@buf@@ , Number ) ; return Number L ; } if ( @@buf@@ == Number ) { Hist_Add ( & tty_con ) ; Q_strncpyz ( text_8197 , byte_1C0C , Number L ) ; Field_Clear ( & tty_con ) ; @@buf@@ = Number ; write ( Number , & @@buf@@ , Number ) ; write ( Number , & unk_4FC0 , Number ) ; return text_8197 ; } if ( @@buf@@ == Number ) { tty_Hide ( ) ; Field_AutoComplete ( & tty_con ) ; tty_Show ( & tty_con , & @@buf@@ , v1 ) ; return Number L ; } @@v10@@ = read ( Number , & @@buf@@ , Number ) ; if ( @@v10@@ == Number || @@buf@@ != Number && @@buf@@ != Number ) goto LABEL_32 ; v2 = & @@buf@@ ; @@v10@@ = read ( Number , & @@buf@@ , Number ) ; if ( @@v10@@ == Number || @@buf@@ > Number ) goto LABEL_32 ; if ( @@buf@@ >= Number ) return Number L ; if ( @@buf@@ == Number ) { @@v9@@ = Hist_Prev ( ) ; if ( @@v9@@ ) { tty_Hide ( ) ; qmemcpy ( & tty_con , @@v9@@ , Number ) ; v3 = @@v9@@ + Number ; * ( & tty_con + Number ) = * ( ( _DWORD * ) @@v9@@ + Number ) ; tty_Show ( & tty_con + Number , v3 , & tty_con + Number ) ; } tty_FlushIn ( ) ; @@result@@ = Number L ; } else { if ( @@buf@@ != Number ) { LABEL_32 : Com_DPrintf ( String , ( unsigned int ) @@buf@@ , ( unsigned int ) tty_erase ) ; tty_FlushIn ( ) ; return Number L ; } @@v9@@ = Hist_Next ( ) ; tty_Hide ( ) ; if ( @@v9@@ ) { qmemcpy ( & tty_con , @@v9@@ , Number ) ; v2 = @@v9@@ + Number ; @@v4@@ = & tty_con + Number ; * ( & tty_con + Number ) = * ( ( _DWORD * ) @@v9@@ + Number ) ; v5 = & tty_con + Number ; } else { @@v4@@ = & tty_con ; Field_Clear ( & tty_con ) ; } tty_Show ( @@v4@@ , v2 , v5 ) ; tty_FlushIn ( ) ; @@result@@ = Number L ; } return @@result@@ ; }", "source": [{"n": "v4", "t": {"T": 3, "t": "int"}, "location": "r56"}, {"n": "result", "t": {"T": 3, "t": "char"}, "location": "r8"}, {"n": "v11", "t": {"T": 1, "n": "int", "s": 4}, "location": "s12"}, {"n": "v10", "t": {"T": 1, "n": "int", "s": 4}, "location": "s16"}, {"n": "readfds", "t": {"T": 6, "n": "fd_set", "l": [{"T": 4, "n": "fds_bits", "t": "__fd_mask[16]", "s": 128}]}, "location": "s176"}, {"n": "v9", "t": {"T": 3, "t": "char"}, "location": "s24"}, {"n": "buf", "t": {"T": 1, "n": "char", "s": 1}, "location": "s25"}, {"n": "v13", "t": {"T": 1, "n": "int", "s": 4}, "location": "s4"}, {"n": "timeout", "t": {"T": 6, "n": "struct timeval", "l": [{"T": 4, "n": "tv_sec", "t": "__time_t", "s": 8}, {"T": 4, "n": "tv_usec", "t": "__suseconds_t", "s": 8}]}, "location": "s48"}, {"n": "v12", "t": {"T": 1, "n": "unsigned int", "s": 4}, "location": "s8"}]}
{"name": "tty_FlushIn", "code": "ssize_t tty_FlushIn ( ) { ssize_t @@result@@ ; char @@buf@@ ; do @@result@@ = read ( Number , & @@buf@@ , Number ) ; while ( @@result@@ != Number ) ; return @@result@@ ; }", "source": [{"n": "result", "t": {"T": 1, "n": "ssize_t", "s": 8}, "location": "r8"}, {"n": "buf", "t": {"T": 1, "n": "char", "s": 1}, "location": "s1"}]} {"name": "tty_Back", "code": "ssize_t tty_Back ( ) { char @@buf@@ ; @@buf@@ = Number ; write ( Number , & @@buf@@ , Number ) ; @@buf@@ = Number ; write ( Number , & @@buf@@ , Number ) ; @@buf@@ = Number ; return write ( Number , & @@buf@@ , Number ) ; }", "source": [{"n": "buf", "t": {"T": 1, "n": "char", "s": 1}, "location": "s1"}]} {"name": "tty_Hide", "code": "__int64 tty_Hide ( ) { __int64 @@result@@ ; int @@i@@ ; @@result@@ = ( unsigned int ) ttycon_on ; if ( ttycon_on ) { if ( ttycon_hide ) { @@result@@ = ( unsigned int ) ++ ttycon_hide ; } else { if ( tty_con > Number ) { for ( @@i@@ = Number ; @@i@@ < tty_con ; ++ @@i@@ ) tty_Back ( ) ; } tty_Back ( ) ; @@result@@ = ( unsigned int ) ++ ttycon_hide ; } } return @@result@@ ; }", "source": [{"n": "result", "t": {"T": 1, "n": "__int64", "s": 8}, "location": "r8"}, {"n": "i", "t": {"T": 1, "n": "int", "s": 4}, "location": "s4"}]} {"name": "tty_Show", "code": "__int64 tty_Show ( ) { __int64 @@result@@ ; int @@i@@ ; @@result@@ = ( unsigned int ) ttycon_on ; if ( ttycon_on ) { @@result@@ = ( unsigned int ) -- ttycon_hide ; if ( ! ttycon_hide ) { write ( Number , & unk_4FC0 , Number ) ; @@result@@ = ( unsigned int ) tty_con ; if ( tty_con ) { for ( @@i@@ = Number ; ; ++ @@i@@ ) { @@result@@ = ( unsigned int ) tty_con ; if ( @@i@@ >= tty_con ) break ; write ( Number , & byte_1C0C [ @@i@@ ] , Number ) ; } } } } return @@result@@ ; }", "source": [{"n": "result", "t": {"T": 1, "n": "__int64", "s": 8}, "location": "r8"}, {"n": "i", "t": {"T": 1, "n": "int", "s": 4}, "location": "s4"}]} {"name": "Sys_ConsoleInputShutdown", "code": "int Sys_ConsoleInputShutdown ( ) { unsigned int @@v0@@ ; if ( ttycon_on ) { tty_Back ( ) ; tcsetattr ( Number , Number , & tty_tc ) ; } @@v0@@ = fcntl ( Number , Number , Number L ) ; BYTE1 ( @@v0@@ ) &= Number ; return fcntl ( Number , Number , @@v0@@ ) ; }", "source": [{"n": "v0", "t": {"T": 1, "n": "unsigned int", "s": 4}, "location": "r8"}]} {"name": "Hist_Add", "code": "__int64 __fastcall Hist_Add ( const void * @@a1@@ ) { _QWORD * @@v1@@ ; _QWORD * v2 ; __int64 result ; int @@i@@ ; for ( @@i@@ = Number ; @@i@@ > Number ; -- @@i@@ ) { @@v1@@ = ( _QWORD * ) ( ( char * ) & ttyEditLines + Number * @@i@@ - Number ) ; v2 = ( _QWORD * ) ( ( char * ) & ttyEditLines + Number * @@i@@ ) ; * v2 = * @@v1@@ ; * ( _QWORD * ) ( ( char * ) v2 + Number ) = * ( _QWORD * ) ( ( char * ) @@v1@@ + Number ) ; qmemcpy ( ( void * ) ( ( unsigned __int64 ) ( v2 + Number ) & Number ) , ( const void * ) ( ( char * ) @@v1@@ - ( ( char * ) v2 - ( ( unsigned __int64 ) ( v2 + Number ) & Number ) ) ) , Number L * ( ( ( ( _DWORD ) v2 - ( ( ( _DWORD ) v2 + Number ) & Number ) + Number ) & Number ) >> Number ) ) ; } qmemcpy ( & ttyEditLines , @@a1@@ , Number ) ; result = ( unsigned int ) hist_count ; if ( hist_count <= Number ) result = ( unsigned int ) ++ hist_count ; hist_current = Number ; return result ; }", "source": [{"n": "v1", "t": {"T": 3, "t": "_QWORD"}, "location": "r16"}, {"n": "a1", "t": {"T": 3, "t": "const void"}, "location": "r56"}, {"n": "i", "t": {"T": 1, "n": "int", "s": 4}, "location": "s4"}]} {"name": "Hist_Next", "code": "char * Hist_Next ( ) { char * @@result@@ ; if ( hist_current >= Number ) -- hist_current ; if ( hist_current == Number ) @@result@@ = Number L ; else @@result@@ = ( char * ) & ttyEditLines + Number * hist_current ; return @@result@@ ; }", "source": [{"n": "result", "t": {"T": 3, "t": "char"}, "location": "r8"}]} {"name": "Sys_Exit", "code": "void __fastcall __noreturn Sys_Exit ( int @@a1@@ ) { Sys_ConsoleInputShutdown ( ) ; exit ( @@a1@@ ) ; }", "source": [{"n": "a1", "t": {"T": 1, "n": "int", "s": 4}, "location": "r56"}]} {"name": "Sys_ConsoleInputInit", "code": "__int64 Sys_ConsoleInputInit ( ) { __int64 @@result@@ ; struct termios @@termios_p@@ ; char * @@s1@@ ; signal ( Number , handler ) ; signal ( Number , handler ) ; signal ( Number , ( __sighandler_t ) CON_SigCont ) ; ttycon = Cvar_Get ( String , String , Number L ) ; @@result@@ = ttycon ; if ( ttycon && ( @@result@@ = * ( unsigned int * ) ( ttycon + Number ) , ( _DWORD ) @@result@@ ) ) { @@s1@@ = getenv ( String ) ; if ( isatty ( Number ) == Number && @@s1@@ && strcmp ( @@s1@@ , String ) && strcmp ( @@s1@@ , String ) ) { Com_Printf ( String ) ; Field_Clear ( & tty_con ) ; tcgetattr ( Number , & tty_tc ) ; tty_erase = tty_tc . c_cc [ Number ] ; tty_eof = tty_tc . c_cc [ Number ] ; @@termios_p@@ . c_oflag = tty_tc . c_oflag ; @@termios_p@@ . c_cflag = tty_tc . c_cflag ; * ( _QWORD * ) & @@termios_p@@ . c_line = * ( _QWORD * ) & tty_tc . c_line ; * ( _QWORD * ) & @@termios_p@@ . c_cc [ Number ] = * ( _QWORD * ) & tty_tc . c_cc [ Number ] ; * ( _QWORD * ) & @@termios_p@@ . c_cc [ Number ] = * ( _QWORD * ) & tty_tc . c_cc [ Number ] ; * ( _QWORD * ) & @@termios_p@@ . c_cc [ Number ] = * ( _QWORD * ) & tty_tc . c_cc [ Number ] ; * ( _QWORD * ) & @@termios_p@@ . c_cc [ Number ] = * ( _QWORD * ) & tty_tc . c_cc [ Number ] ; @@termios_p@@ . c_ospeed = tty_tc . c_ospeed ; @@termios_p@@ . c_lflag = tty_tc . c_lflag & Number ; @@termios_p@@ . c_iflag = tty_tc . c_iflag & Number ; @@termios_p@@ . c_cc [ Number ] = Number ; @@termios_p@@ . c_cc [ Number ] = Number ; tcsetattr ( Number , Number , & @@termios_p@@ ) ; ttycon_ansicolor = Cvar_Get ( String , String , Number L ) ; @@result@@ = ttycon_ansicolor ; if ( ttycon_ansicolor ) { @@result@@ = * ( unsigned int * ) ( ttycon_ansicolor + Number ) ; if ( ( _DWORD ) @@result@@ ) ttycon_color_on = Number ; } ttycon_on = Number ; } else { Com_Printf ( String ) ; @@result@@ = Cvar_Set ( String , String ) ; ttycon_on = Number ; stdin_active = Number ; } } else { ttycon_on = Number ; stdin_active = Number ; } return @@result@@ ; }", "source": [{"n": "result", "t": {"T": 1, "n": "__int64", "s": 8}, "location": "r8"}, {"n": "s1", "t": {"T": 3, "t": "char"}, "location": "s8"}, {"n": "termios_p", "t": {"T": 6, "n": "struct termios", "l": [{"T": 4, "n": "c_iflag", "t": "tcflag_t", "s": 4}, {"T": 4, "n": "c_oflag", "t": "tcflag_t", "s": 4}, {"T": 4, "n": "c_cflag", "t": "tcflag_t", "s": 4}, {"T": 4, "n": "c_lflag", "t": "tcflag_t", "s": 4}, {"T": 4, "n": "c_line", "t": "cc_t", "s": 1}, {"T": 4, "n": "c_cc", "t": "cc_t[32]", "s": 32}, {"T": 5, "s": 3}, {"T": 4, "n": "c_ispeed", "t": "speed_t", "s": 4}, {"T": 4, "n": "c_ospeed", "t": "speed_t", "s": 4}]}, "location": "s80"}]} {"name": "Sys_GetEvent", "code": "_QWORD * __fastcall Sys_GetEvent ( _QWORD * @@a1@@ ) { __int64 v1 ; __int64 v2 ; __int64 v3 ; _QWORD * v4 ; __int64 v5 ; __int64 v6 ; __int64 v7 ; __int64 v8 ; __int64 v9 ; __int64 v10 ; __int64 @@v12@@ [ Number ] ; char @@v13@@ [ Number ] ; void * @@src@@ ; int @@v15@@ ; __int64 @@v16@@ [ Number ] ; _QWORD * @@v17@@ ; int @@v18@@ ; char * @@dest@@ ; char * @@s@@ ; int @@v21@@ ; if ( eventHead <= ( unsigned int ) eventTail ) { @@s@@ = Sys_ConsoleInput ( ) ; if ( @@s@@ ) { @@v21@@ = strlen ( @@s@@ ) + Number ; @@dest@@ = ( char * ) Z_Malloc ( ( unsigned int ) @@v21@@ ) ; if ( @@v21@@ > Number && ( * @@s@@ == Number || * @@s@@ == Number ) ) { strcpy ( @@dest@@ , @@s@@ + Number ) ; -- @@v21@@ ; } else { strcpy ( @@dest@@ , @@s@@ ) ; } Sys_QueEvent ( Number , Number , Number , Number , @@v21@@ , ( __int64 ) @@dest@@ ) ; } MSG_Init ( @@v13@@ , sys_packetReceived , Number ) ; if ( ( unsigned int ) Sys_GetPacket ( @@v12@@ , @@v13@@ ) ) { @@v18@@ = @@v15@@ + Number ; v4 = ( _QWORD * ) Z_Malloc ( ( unsigned int ) ( @@v15@@ + Number ) ) ; @@v17@@ = v4 ; v5 = @@v12@@ [ Number ] ; * v4 = @@v12@@ [ Number ] ; v4 [ Number ] = v5 ; v6 = @@v12@@ [ Number ] ; v4 [ Number ] = @@v12@@ [ Number ] ; v4 [ Number ] = v6 ; v4 [ Number ] = @@v12@@ [ Number ] ; memcpy ( @@v17@@ + Number , @@src@@ , @@v15@@ ) ; Sys_QueEvent ( Number , Number , Number , Number , @@v18@@ , ( __int64 ) @@v17@@ ) ; } if ( eventHead <= ( unsigned int ) eventTail ) { memset ( @@v16@@ , Number , sizeof ( @@v16@@ ) ) ; LODWORD ( @@v16@@ [ Number ] ) = Sys_Milliseconds ( ) ; v10 = @@v16@@ [ Number ] ; * @@a1@@ = @@v16@@ [ Number ] ; @@a1@@ [ Number ] = v10 ; v9 = @@v16@@ [ Number ] ; @@a1@@ [ Number ] = @@v16@@ [ Number ] ; } else { v7 = Number L * ( unsigned __int8 ) eventTail ++ ; v8 = * ( _QWORD * ) & eventQue [ v7 + Number ] ; * @@a1@@ = * ( _QWORD * ) & eventQue [ v7 ] ; @@a1@@ [ Number ] = v8 ; v9 = * ( _QWORD * ) & eventQue [ v7 + Number ] ; @@a1@@ [ Number ] = * ( _QWORD * ) & eventQue [ v7 + Number ] ; } @@a1@@ [ Number ] = v9 ; } else { v1 = Number L * ( unsigned __int8 ) eventTail ++ ; v2 = * ( _QWORD * ) & eventQue [ v1 + Number ] ; * @@a1@@ = * ( _QWORD * ) & eventQue [ v1 ] ; @@a1@@ [ Number ] = v2 ; v3 = * ( _QWORD * ) & eventQue [ v1 + Number ] ; @@a1@@ [ Number ] = * ( _QWORD * ) & eventQue [ v1 + Number ] ; @@a1@@ [ Number ] = v3 ; } return @@a1@@ ; }", "source": [{"n": "a1", "t": {"T": 3, "t": "_QWORD"}, "location": "r56"}, {"n": "v15", "t": {"T": 1, "n": "int", "s": 4}, "location": "s116"}, {"n": "src", "t": {"T": 3, "t": "void"}, "location": "s128"}, {"n": "v13", "t": {"T": 2, "n": 16, "s": 1, "t": "char"}, "location": "s144"}, {"n": "v12", "t": {"T": 2, "n": 6, "s": 8, "t": "__int64"}, "location": "s192"}, {"n": "v21", "t": {"T": 1, "n": "int", "s": 4}, "location": "s20"}, {"n": "s", "t": {"T": 3, "t": "char"}, "location": "s32"}, {"n": "dest", "t": {"T": 3, "t": "char"}, "location": "s40"}, {"n": "v18", "t": {"T": 1, "n": "int", "s": 4}, "location": "s44"}, {"n": "v17", "t": {"T": 3, "t": "_QWORD"}, "location": "s56"}, {"n": "v16", "t": {"T": 2, "n": 4, "s": 8, "t": "__int64"}, "location": "s96"}]} {"name": "main", "code": "int __cdecl main ( int @@argc@@ , const char * * @@argv@@ , const char * * @@envp@@ ) { const char * v4 ; unsigned int v5 ; char * @@dest@@ ; int i ; int j ; int @@v9@@ ; if ( ! ( unsigned int ) Sys_ParseArgs ( @@argc@@ , ( __int64 ) @@argv@@ ) ) { @@v9@@ = Number ; for ( i = Number ; i < @@argc@@ ; ++ i ) @@v9@@ += strlen ( @@argv@@ [ i ] ) + Number ; @@dest@@ = ( char * ) malloc ( @@v9@@ ) ; * @@dest@@ = Number ; for ( j = Number ; j < @@argc@@ ; ++ j ) { if ( j > Number ) * ( _WORD * ) & @@dest@@ [ strlen ( @@dest@@ ) ] = Number ; strcat ( @@dest@@ , @@argv@@ [ j ] ) ; } memset ( eventQue , Number , sizeof ( eventQue ) ) ; memset ( sys_packetReceived , Number , sizeof ( sys_packetReceived ) ) ; Sys_Milliseconds ( ) ; Com_Init ( @@dest@@ ) ; NET_Init ( ) ; v4 = ( const char * ) Sys_Pwd ( ) ; Com_Printf ( String , v4 ) ; Sys_ConsoleInputInit ( ) ; if ( ttycon_on ) { v5 = fcntl ( Number , Number , Number L ) ; BYTE1 ( v5 ) |= Number ; fcntl ( Number , Number , v5 ) ; } InitSig ( ) ; while ( Number ) { Sys_ConfigureFPU ( ) ; Com_Frame ( ) ; } } return Number ; }", "source": [{"n": "envp", "t": {"T": 3, "t": "const char *"}, "location": "r16"}, {"n": "argc", "t": {"T": 1, "n": "int", "s": 4}, "location": "r56"}, {"n": "argv", "t": {"T": 3, "t": "const char *"}, "location": "r64"}, {"n": "dest", "t": {"T": 3, "t": "char"}, "location": "s16"}, {"n": "v9", "t": {"T": 1, "n": "int", "s": 4}, "location": "s4"}]}