Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- #include "defines.h"
- #define __CFSHL__(x, y) (x<<y)
- #define __OFSUB__(x, y) (x-y)
- int _strcpy(char *result, char *str, unsigned int size)
- {
- char v3; // t1@7
- int v4; // r0@7
- char *v5; // r1@14
- unsigned int v6; // t1@14
- __int16 v7; // r3@14
- int v8; // r0@14
- char v9; // t1@13
- int v10; // r0@13
- __int16 v11; // t1@17
- int v12; // r0@17
- int v13; // t1@18
- int v14; // r0@18
- char v15; // t1@20
- char *v16; // r1@22
- char v17; // r3@22
- char v18; // t1@22
- char v19; // t1@22
- int v20; // r0@22
- int v21; // r3@23
- unsigned int l; // r2@24
- char *v23; // r1@26
- unsigned int v24; // r4@26
- int v25; // r5@26
- int v26; // r6@26
- int v27; // r7@26
- int v28; // r8@26
- int v29; // r9@26
- int v30; // r10@26
- int v31; // lr@26
- int v32; // r0@26
- int v33; // r4@28
- int v34; // r12@28
- int v35; // lr@28
- int v36; // r4@30
- unsigned int v37; // t1@32
- unsigned __int8 v38; // cf@34
- char v39; // nf@34
- unsigned int v40; // r2@34
- __int16 v41; // t1@35
- int v42; // r12@45
- unsigned __int8 k; // nf@45
- unsigned __int8 v44; // vf@45
- unsigned int v45; // r2@45
- unsigned int v46; // r4@47
- unsigned int v47; // r5@47
- unsigned int v48; // r6@47
- unsigned int v49; // r7@47
- unsigned int v50; // r8@47
- unsigned int v51; // r9@47
- unsigned int v52; // r10@47
- unsigned int v53; // lr@47
- unsigned int v54; // r3@47
- int v55; // r4@47
- unsigned int v56; // r12@47
- int v57; // r5@47
- unsigned int v58; // r3@47
- int v59; // r6@47
- unsigned int v60; // r12@47
- int v61; // r7@47
- unsigned int v62; // r3@47
- int v63; // r8@47
- unsigned int v64; // r12@47
- int v65; // r9@47
- unsigned int v66; // r3@47
- int v67; // r10@47
- int v68; // r2@49
- unsigned __int8 v69; // nf@49
- unsigned __int8 v70; // vf@49
- int v71; // r2@49
- unsigned int v72; // t1@51
- char *v73; // r1@53
- char v74; // r2@53
- int v75; // r12@54
- unsigned __int8 i; // nf@54
- unsigned __int8 v77; // vf@54
- unsigned int v78; // r2@54
- unsigned int v79; // r4@56
- unsigned int v80; // r5@56
- unsigned int v81; // r6@56
- unsigned int v82; // r7@56
- unsigned int v83; // r8@56
- unsigned int v84; // r9@56
- unsigned int v85; // r10@56
- unsigned int v86; // lr@56
- unsigned int v87; // r3@56
- int v88; // r4@56
- unsigned int v89; // r12@56
- int v90; // r5@56
- unsigned int v91; // r3@56
- int v92; // r6@56
- unsigned int v93; // r12@56
- int v94; // r7@56
- unsigned int v95; // r3@56
- int v96; // r8@56
- unsigned int v97; // r12@56
- int v98; // r9@56
- unsigned int v99; // r3@56
- int v100; // r10@56
- int v101; // r2@58
- unsigned __int8 v102; // nf@58
- unsigned __int8 v103; // vf@58
- int v104; // r2@58
- unsigned int v105; // t1@60
- int v106; // r12@63
- unsigned __int8 j; // nf@63
- unsigned __int8 v108; // vf@63
- unsigned int v109; // r2@63
- unsigned int v110; // r4@65
- unsigned int v111; // r5@65
- unsigned int v112; // r6@65
- unsigned int v113; // r7@65
- unsigned int v114; // r8@65
- unsigned int v115; // r9@65
- unsigned int v116; // r10@65
- unsigned int v117; // lr@65
- unsigned int v118; // r3@65
- int v119; // r4@65
- unsigned int v120; // r12@65
- int v121; // r5@65
- unsigned int v122; // r3@65
- int v123; // r6@65
- unsigned int v124; // r12@65
- int v125; // r7@65
- unsigned int v126; // r3@65
- int v127; // r8@65
- unsigned int v128; // r12@65
- int v129; // r9@65
- unsigned int v130; // r3@65
- int v131; // r10@65
- int v132; // r2@67
- unsigned __int8 v133; // nf@67
- unsigned __int8 v134; // vf@67
- int v135; // r2@67
- unsigned int v136; // t1@69
- int v137; // r1@73
- char v138; // r3@73
- char v139; // t1@73
- char v140; // t1@73
- int v141; // r0@73
- char v142; // r3@73
- char v143; // t1@73
- char v144; // t1@73
- int v145; // r1@75
- char v146; // r3@75
- char v147; // t1@75
- char v148; // t1@75
- int v149; // r0@75
- if ( size > 8 )
- {
- if ( (unsigned __int8)str & 1 )
- {
- --size;
- v15 = *str++;
- *(_BYTE *)result++ = v15;
- }
- if ( (unsigned __int8)str & 2 )
- {
- size -= 2;
- v18 = *str;
- v16 = str + 1;
- v17 = v18;
- v19 = *v16;
- str = v16 + 1;
- *(_BYTE *)result = v17;
- v20 = result + 1;
- *(_BYTE *)v20 = v19;
- result = v20 + 1;
- }
- v21 = result & 3;
- if ( result & 3 )
- {
- result &= 0xFFFFFFFC;
- if ( v21 == 2 )
- {
- v75 = *(_DWORD *)result & 0xFFFF;
- v77 = __OFSUB__(size, 32);
- v78 = size - 32;
- for ( i = (v78 & 0x80000000) != 0; !(((v78 & 0x80000000) != 0) ^ v77); i = (v78 & 0x80000000) != 0 )
- {
- if ( i ^ v77 )
- break;
- v79 = *(_DWORD *)str;
- v80 = *((_DWORD *)str + 1);
- v81 = *((_DWORD *)str + 2);
- v82 = *((_DWORD *)str + 3);
- v83 = *((_DWORD *)str + 4);
- v84 = *((_DWORD *)str + 5);
- v85 = *((_DWORD *)str + 6);
- v86 = *((_DWORD *)str + 7);
- str += 32;
- v87 = v79 >> 16;
- v88 = v75 | (v79 << 16);
- v89 = v80 >> 16;
- v90 = v87 | (v80 << 16);
- v91 = v81 >> 16;
- v92 = v89 | (v81 << 16);
- v93 = v82 >> 16;
- v94 = v91 | (v82 << 16);
- v95 = v83 >> 16;
- v96 = v93 | (v83 << 16);
- v97 = v84 >> 16;
- v98 = v95 | (v84 << 16);
- v99 = v85 >> 16;
- v100 = v97 | (v85 << 16);
- v75 = v86 >> 16;
- *(_DWORD *)result = v88;
- *(_DWORD *)(result + 4) = v90;
- *(_DWORD *)(result + 8) = v92;
- *(_DWORD *)(result + 12) = v94;
- *(_DWORD *)(result + 16) = v96;
- *(_DWORD *)(result + 20) = v98;
- *(_DWORD *)(result + 24) = v100;
- *(_DWORD *)(result + 28) = v99 | (v86 << 16);
- result += 32;
- v77 = __OFSUB__(v78, 32);
- v78 -= 32;
- }
- v101 = v78 + 32;
- v103 = __OFSUB__(v101, 4);
- v104 = v101 - 4;
- v102 = v104 < 0;
- do
- {
- if ( v102 ^ v103 )
- break;
- v105 = *(_DWORD *)str;
- str += 4;
- *(_DWORD *)result = v75 | (v105 << 16);
- result += 4;
- v75 = v105 >> 16;
- v103 = __OFSUB__(v104, 4);
- v104 -= 4;
- v102 = v104 < 0;
- }
- while ( !((v104 < 0) ^ v103) );
- v73 = str - 2;
- v74 = v104 + 6;
- }
- else if ( (unsigned int)v21 > 2 )
- {
- v106 = *(_DWORD *)result & 0xFFFFFF;
- v108 = __OFSUB__(size, 32);
- v109 = size - 32;
- for ( j = (v109 & 0x80000000) != 0; !(((v109 & 0x80000000) != 0) ^ v108); j = (v109 & 0x80000000) != 0 )
- {
- if ( j ^ v108 )
- break;
- v110 = *(_DWORD *)str;
- v111 = *((_DWORD *)str + 1);
- v112 = *((_DWORD *)str + 2);
- v113 = *((_DWORD *)str + 3);
- v114 = *((_DWORD *)str + 4);
- v115 = *((_DWORD *)str + 5);
- v116 = *((_DWORD *)str + 6);
- v117 = *((_DWORD *)str + 7);
- str += 32;
- v118 = v110 >> 8;
- v119 = v106 | (v110 << 24);
- v120 = v111 >> 8;
- v121 = v118 | (v111 << 24);
- v122 = v112 >> 8;
- v123 = v120 | (v112 << 24);
- v124 = v113 >> 8;
- v125 = v122 | (v113 << 24);
- v126 = v114 >> 8;
- v127 = v124 | (v114 << 24);
- v128 = v115 >> 8;
- v129 = v126 | (v115 << 24);
- v130 = v116 >> 8;
- v131 = v128 | (v116 << 24);
- v106 = v117 >> 8;
- *(_DWORD *)result = v119;
- *(_DWORD *)(result + 4) = v121;
- *(_DWORD *)(result + 8) = v123;
- *(_DWORD *)(result + 12) = v125;
- *(_DWORD *)(result + 16) = v127;
- *(_DWORD *)(result + 20) = v129;
- *(_DWORD *)(result + 24) = v131;
- *(_DWORD *)(result + 28) = v130 | (v117 << 24);
- result += 32;
- v108 = __OFSUB__(v109, 32);
- v109 -= 32;
- }
- v132 = v109 + 32;
- v134 = __OFSUB__(v132, 4);
- v135 = v132 - 4;
- v133 = v135 < 0;
- do
- {
- if ( v133 ^ v134 )
- break;
- v136 = *(_DWORD *)str;
- str += 4;
- *(_DWORD *)result = v106 | (v136 << 24);
- result += 4;
- v106 = v136 >> 8;
- v134 = __OFSUB__(v135, 4);
- v135 -= 4;
- v133 = v135 < 0;
- }
- while ( !((v135 < 0) ^ v134) );
- v73 = str - 3;
- v74 = v135 + 7;
- }
- else
- {
- v42 = *(_DWORD *)result & 0xFF;
- v44 = __OFSUB__(size, 32);
- v45 = size - 32;
- for ( k = (v45 & 0x80000000) != 0; !(((v45 & 0x80000000) != 0) ^ v44); k = (v45 & 0x80000000) != 0 )
- {
- if ( k ^ v44 )
- break;
- v46 = *(_DWORD *)str;
- v47 = *((_DWORD *)str + 1);
- v48 = *((_DWORD *)str + 2);
- v49 = *((_DWORD *)str + 3);
- v50 = *((_DWORD *)str + 4);
- v51 = *((_DWORD *)str + 5);
- v52 = *((_DWORD *)str + 6);
- v53 = *((_DWORD *)str + 7);
- str += 32;
- v54 = v46 >> 24;
- v55 = v42 | (v46 << 8);
- v56 = v47 >> 24;
- v57 = v54 | (v47 << 8);
- v58 = v48 >> 24;
- v59 = v56 | (v48 << 8);
- v60 = v49 >> 24;
- v61 = v58 | (v49 << 8);
- v62 = v50 >> 24;
- v63 = v60 | (v50 << 8);
- v64 = v51 >> 24;
- v65 = v62 | (v51 << 8);
- v66 = v52 >> 24;
- v67 = v64 | (v52 << 8);
- v42 = v53 >> 24;
- *(_DWORD *)result = v55;
- *(_DWORD *)(result + 4) = v57;
- *(_DWORD *)(result + 8) = v59;
- *(_DWORD *)(result + 12) = v61;
- *(_DWORD *)(result + 16) = v63;
- *(_DWORD *)(result + 20) = v65;
- *(_DWORD *)(result + 24) = v67;
- *(_DWORD *)(result + 28) = v66 | (v53 << 8);
- result += 32;
- v44 = __OFSUB__(v45, 0x20);
- v45 -= 0x20;
- }
- v68 = v45 + 32;
- v70 = __OFSUB__(v68, 4);
- v71 = v68 - 4;
- v69 = v71 < 0;
- do
- {
- if ( v69 ^ v70 )
- break;
- v72 = *(_DWORD *)str;
- str += 4;
- *(_DWORD *)result = v42 | (v72 << 8);
- result += 4;
- v42 = v72 >> 24;
- v70 = __OFSUB__(v71, 4);
- v71 -= 4;
- v69 = v71 < 0;
- }
- while ( !((v71 < 0) ^ v70) );
- v73 = str - 1;
- v74 = v71 + 5;
- }
- if ( v74 & 4 )
- {
- v139 = *v73;
- v137 = (int)(v73 + 1);
- v138 = v139;
- v140 = *(_BYTE *)v137++;
- *(_BYTE *)result = v138;
- v141 = result + 1;
- *(_BYTE *)v141++ = v140;
- v143 = *(_BYTE *)v137++;
- v142 = v143;
- v144 = *(_BYTE *)v137;
- v73 = (char *)(v137 + 1);
- *(_BYTE *)v141++ = v142;
- *(_BYTE *)v141 = v144;
- result = v141 + 1;
- }
- if ( v74 & 2 )
- {
- v147 = *v73;
- v145 = (int)(v73 + 1);
- v146 = v147;
- v148 = *(_BYTE *)v145;
- v73 = (char *)(v145 + 1);
- *(_BYTE *)result = v146;
- v149 = result + 1;
- *(_BYTE *)v149 = v148;
- result = v149 + 1;
- }
- if ( v74 & 1 )
- *(_BYTE *)result++ = *v73;
- }
- else
- {
- v38 = size >= 0x20;
- for ( l = size - 32; v38; result = v32 + 16 )
- {
- v24 = *(_DWORD *)str;
- v25 = *((_DWORD *)str + 1);
- v26 = *((_DWORD *)str + 2);
- v27 = *((_DWORD *)str + 3);
- v23 = str + 16;
- v28 = *(_DWORD *)v23;
- v29 = *((_DWORD *)v23 + 1);
- v30 = *((_DWORD *)v23 + 2);
- v31 = *((_DWORD *)v23 + 3);
- str = v23 + 16;
- //__pld(str + 64);
- v38 = l >= 0x20;
- l -= 32;
- *(_DWORD *)result = v24;
- *(_DWORD *)(result + 4) = v25;
- *(_DWORD *)(result + 8) = v26;
- *(_DWORD *)(result + 12) = v27;
- v32 = result + 16;
- *(_DWORD *)v32 = v28;
- *(_DWORD *)(v32 + 4) = v29;
- *(_DWORD *)(v32 + 8) = v30;
- *(_DWORD *)(v32 + 12) = v31;
- }
- if ( __CFSHL__(l, 28) )
- {
- v21 = *(_DWORD *)str;
- v33 = *((_DWORD *)str + 1);
- v34 = *((_DWORD *)str + 2);
- v35 = *((_DWORD *)str + 3);
- str += 16;
- *(_DWORD *)result = v21;
- *(_DWORD *)(result + 4) = v33;
- *(_DWORD *)(result + 8) = v34;
- *(_DWORD *)(result + 12) = v35;
- result += 16;
- }
- if ( ((l << 28) & 0x80000000) != 0 )
- {
- v21 = *(_DWORD *)str;
- v36 = *((_DWORD *)str + 1);
- str += 8;
- *(_DWORD *)result = v21;
- *(_DWORD *)(result + 4) = v36;
- result += 8;
- }
- if ( __CFSHL__(l, 30) )
- {
- v37 = *(_DWORD *)str;
- str += 4;
- LOWORD(v21) = v37;
- *(_DWORD *)result = v37;
- result += 4;
- }
- if ( l << 30 )
- {
- v38 = __CFSHL__(l, 31);
- v40 = l << 31;
- v39 = (v40 & 0x80000000) != 0;
- if ( v38 )
- {
- v41 = *(_WORD *)str;
- str += 2;
- LOWORD(v21) = v41;
- }
- if ( (v40 & 0x80000000) != 0 )
- LOBYTE(v40) = *str;
- if ( v38 )
- {
- *(_WORD *)result = v21;
- result += 2;
- }
- if ( v39 )
- *(_BYTE *)result++ = v40;
- }
- }
- }
- else if ( size == 8 )
- {
- v13 = *((_DWORD *)str + 1);
- *(_DWORD *)result = *(_DWORD *)str;
- v14 = result + 4;
- *(_DWORD *)v14 = v13;
- result = v14 + 4;
- }
- else if ( size > 4 )
- {
- if ( size == 6 )
- {
- v11 = *((_WORD *)str + 2);
- *(_DWORD *)result = *(_DWORD *)str;
- v12 = result + 4;
- *(_WORD *)v12 = v11;
- result = v12 + 2;
- }
- else if ( size >= 6 )
- {
- v6 = *(_DWORD *)str;
- v5 = str + 4;
- v7 = *(_WORD *)v5;
- *(_DWORD *)result = v6;
- v8 = result + 4;
- LOBYTE(v6) = v5[2];
- *(_WORD *)v8 = v7;
- v8 += 2;
- *(_BYTE *)v8 = v6;
- result = v8 + 1;
- }
- else
- {
- v9 = str[4];
- *(_DWORD *)result = *(_DWORD *)str;
- v10 = result + 4;
- *(_BYTE *)v10 = v9;
- result = v10 + 1;
- }
- }
- else if ( size == 4 )
- {
- *(_DWORD *)result = *(_DWORD *)str;
- result += 4;
- }
- else if ( size < 2 )
- {
- if ( size >= 1 )
- *(_BYTE *)result++ = *str;
- }
- else if ( size == 2 )
- {
- *(_WORD *)result = *(_WORD *)str;
- result += 2;
- }
- else
- {
- v3 = str[2];
- *(_WORD *)result = *(_WORD *)str;
- v4 = result + 2;
- *(_BYTE *)v4 = v3;
- result = v4 + 1;
- }
- return result;
- }
- int main(){
- char buf[12] = "Hello World";
- char temp[12];
- _strcpy(temp, buf, 12);
- printf("buf=%s\ntemp=%s\n", buf, temp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement