Задачи по ассемблеру
1)short M[12][18];
short* px;
short a, b;
struct s{
char ss[20];
double x[4];
short n;
float z;
};
s s1;
short m;
int i, j;
m = M[i][j+1]*a + (*px)/b — s1.n;
asm{
imul edi, i, 18
add edi, j
inc edi
mov bx, word ptr M[edi*2]
imul bx, a
mov ecx, px
mov ax, word ptr [ecx]
cwd
idiv b
add ax, bx
sbb ax, word ptr s1[20*1+4*8]
mov m, ax
}
2)short N[4][20];
short* pj;
short f, g;
struct s{
double y[8];
short d;
char c[8];
};
s s2;
short n;
int j, k;
n = f*s2.d/(*pj) + g*N[j][k*2]
asm{
mov ax, f
imul word ptr s2[8*8]
mov ecx, pj
mov bx, word ptr [ecx]
idiv bx
imul edi, j, 20
imul esi, k, 2
add edi, esi
mov bx, word ptr N[edi*2]
imul bx, g
add ax, bx
mov n, ax
}
3)short R[8][14];
short r, t;
short *pi;
struct s{
int u;
char w[4];
short v;
double y;
};
s s3;
short p;
int i, k;
p = r/s3.v + t*R[k+2][i] — *pi;
asm{
mov ax, r
cwd
idiv word ptr s3[4+1*4]
imul edi, k, 14
add edi, i
add edi, 2*14
mov bx, word ptr R[edi*2]
imul bx, word ptr t
add ax, bx
mov ecx, pi
mov bx, word ptr [ecx]
sbb ax, bx
mov p, ax
}
4)short K[6][8];
short m, n;
short *pk;
short r;
struct s{
float x[3];
char cc[10];
short z;
double g;
};
s s4;
int i, j;
r = s4.z*K[i][j-2]/m + n/(*pk);
asm{
imul edi, i, 8
add edi, j
sub edi, 2
mov ax, word ptr K[edi*2]
imul word ptr s4[4*3+1*10]
idiv m
mov bx, ax
mov ecx, pk
mov cx, word ptr [ecx]
mov ax, n
cwd
idiv cx
add ax, bx
mov r, ax
}
5)short D[9][10];
short e, f;
short *pl;
struct s{
char x[6];
short t;
float y[8];
};
s s5;
short q;
int i, j;
q = *pl + D[2*i][j]/e + f*s5.t;
asm{
imul edi, i, 10*2
add edi, j
mov ax, word ptr D[edi*2]
cwd
idiv word ptr e
mov bx, f
imul bx, word ptr s5[6*1]
mov ecx, pl
mov cx, word ptr [ecx]
add ax, bx
add ax, cx
mov q, ax
}
6)short Y[3][6];
short p, q;
short *pm;
struct s{
char d[12];
float r;
unsigned short g;
};
s s6;
short w;
int i, j,k;
w = s6.g*p/q + (*pm)/Y[i+k][j];
asm{
mov eax, i
add eax, k
imul edi, eax, 6
add edi, j
mov bx, word ptr Y[edi*2]
mov ecx, pm
mov ax, word ptr [ecx]
cwd
idiv bx
mov w, ax
mov ax, word ptr s6[12*1+1*4]
imul word ptr p
idiv word ptr q
add w, ax
}
7)unsigned short G[12][8];
unsigned short k, l;
unsigned short u;
unsigned short *pg;
struct s{
float r;
int a;
short k;
unsigned short g;
};
s s7;
int i, j;
u = k/G[i+2][j]*(*pg) — s7.g/l;
asm{
mov eax, i
add eax, 2
mov edi, 8
imul edi, eax
add edi, j
mov ax, word ptr k
cwd
div word ptr G[edi*2]
mov ecx, pg
mul ax, word ptr [ecx]
mov u, ax
mov ax, word ptr s7[4+4+2]
cwd
div word ptr l
sub u, ax
}
8)unsigned short H[6][8];
unsigned short u, v;
unsigned short *ph;
unsigned short t;
struct s{
int b[2];
char c[20];
unsigned short d;
float f;
};
s s8;
int j, k;
t = s8.d/(*ph) + H[k][j-2]*u + v;
asm{
mov ecx, ph
mov ax, word ptr s8[2*4+20*1]
cwd
div word ptr [ecx]
mov t, ax
mov di, word ptr k
mov ax, 8
mul di
add ax, word ptr j
sub ax, 2
movzx edi, ax
mov ax, word ptr H[edi*2]
mul ax, word ptr u
add t, ax
mov ax, word ptr v
add t, ax
}
9)unsigned short B[6][8];
unsigned short z, x;
unsigned short *pj;
unsigned short u;
struct s{
double x[2];
unsigned short d;
char w[10];
}
s s9;
int j, k;
u = z/x + B[k][j-1]*s9.d — *pj;
asm{
mov ax, word ptr k
mov bx, 8
mul ax, bx
movzx edi, ax
add edi, j
dec edi
mov ax, word ptr B[edi*2]
mul ax, word ptr s9[2*8]
mov u, ax
mov ax, word ptr z
cwd
div word ptr x
add u, ax mov ecx, pj
mov cx, word ptr [ecx]
sub u, cx
}
10)unsigned short Z[6][24];
unsigned short g, t;
unsigned short *pr;
unsigned short e;
struct s{
float w[10];
int id;
unsigned short y;
};
s s10;
int j, k;
e = t/(*pr) + Z[k+2][j]*q — s10.y;
asm{
mov ax, word ptr k
add ax, 2
mov bx, word ptr 24
mul ax, bx
add ax, word ptr j
movzx edi, ax
mov ax, word ptr Z[edi*2]
mul ax, word ptr q
mov e, ax
mov ecx, pr
mov cx, word ptr [ecx]
mov ax, word ptr t
cwd
div cx
add e, ax
mov ax, word ptr s10[10*4+4]
sub e, ax
}
11)unsigned short U[80][120];
unsigned short d, a;
unsigned short u;
unsigned short *pu;
struct s{
int m;
char c[24];
unsigned short w;
double z;
};
s s11;
int i, k;
u = d*U[k-2][i]/(*pu) + a — s11.w;
asm{
mov ax, word ptr k
sub ax, 2
mov bx, word ptr 120
mul ax, bx
add ax, word ptr i
movzx edi, ax
mov ax, word ptr U[edi*2]
mul ax, word ptr d
mov ecx, pu
cwd
div word ptr [ecx]
add ax, word ptr a
sbb ax, word ptr s11[1*4+24*1]
mov u, ax
}
12)unsigned short A[40][60];
unsigned short n, b;
unsigned short x;
struct s{
char p[36];
double f[4];
unsigned short h;
int u;
};
s s12;
unsigned short *pf;
int i, k;
x = n*b/s12.h + *pf — A[k+2][i];
asm{
mov ax, word ptr n
mul ax, word ptr b
cwd
div word ptr s12[36*1+4*8]
mov ecx, pf
add ax, word ptr [ecx]
mov x, ax
mov ax, word ptr k
add ax, 2
mov bx, word ptr 60
mul ax, bx
add ax, word ptr i
movzx edi, ax
mov ax, word ptr A[edi*2]
sub x, ax
}
13)int K[6][8];
int u, m;
int h;
int *pf;
struct s
{
char f[16];
int w;
float d;
int t;
};
s s13;
int k, j;
h = K[k+2][j]*u/m + *pf — s13.t;
asm{
mov ebx, k
add ebx, 2
imul edi, ebx, 8
add edi, j
mov eax, dword ptr K[edi*4]
imul u
idiv m
mov ecx, pf
add eax, [ecx]
sub eax, dword ptr s13[16+4+4]
mov h, eax
}
14)int H[10][80];
int g, k;
int r;
int *pf;
struct s
{
double e[4];
char u[26];
int f;
};
s s14;
int j, i;
r = (g*s14.f — *pf)/H[j][i+1] + k;
asm{
imul edi, j, 80
add edi, i
inc edi
mov ebx, dword ptr H[edi*4]
mov eax, dword ptr g
imul dword ptr s14[4*8+26]
mov ecx, pf
sub eax, [ecx]
cdq
idiv ebx
add eax, k
mov r, eax
}
15)int H[20][50];
int r, t;
int e;
int *pq;
struct s
{
int m;
float b[5];
int x;
};
s s15;
int k, j;
e = (t/s15.x + r)*H[k-2][j] — *pq;
asm{
mov eax, dword ptr t
cdq
idiv dword ptr s15[4+5*4]
add eax, r
mov ebx, k
sub ebx, 2
imul edi, ebx, 50
add edi, j
imul dword ptr H[edi*4]
mov ecx, pq
sub eax, [ecx]
mov e, eax
}
16)int R[24][72];
int f, g;
int a;
int *pc;
struct s
{
double d[4];
int k[4];
char c[4];
int e;
};
s s16;
int i, j;
f + *pc — (R[i][j+1] + g)/s16.e;
asm{
mov eax, g
imul edi, i, 72
add edi, j
inc edi
add eax, dword ptr R[edi*4]
cdq
idiv dword ptr s16[4*8+4*4+4]
mov ebx, dword ptr f
sub ebx, eax
mov ecx, pc
add ebx, [ecx]
mov a, ebx
}
17)double X[12][18];
int r, t;
double e;
float *q;
struct s
{
int i;
float b[5];
int j;
};
s sA;
int m, n;
e = t*sA. b[3]/r + X[m][n+2] — *q;
asm{
fild t
fld dword ptr sA[4+4*3]
fmulp st(1), st(0)
fild r
fdivp
imul edi, m, 18
add edi, n
add edi, 2
fld qword ptr X[edi*8]
faddp
mov edx, q
fld [edx]
fsub
fstp e
}
18)float Z[24][72];
float f, g;
int a;
double *p;
struct s
{
double d[4];
int k[4];
char c[4];
short e;
};
s sB;
int i, j;
q = a + *p — Z[2*i][j+1]*g/sB. e;
asm{
imul edi, i, 72*2
add edi, j
inc edi
fld dword ptr Z[edi*4]
fld g
fmulp st(1), st(0)
fild word ptr sB[4*8+4*4+1*4]
fdivp
mov ecx, p
fld qword ptr [ecx]
fsubrp
fild dword ptr a
faddp st(1), st(0)
fstp f
}
19)int M[20][64];
int* q;
int u, v,m;
struct s{
double z[8];
int n;
char ss[20];
float z;
};
s s1;
int i, j;
m = M[i][j]/u + (*q)*v — s1.n;
asm{
imul edi, i, 64
add edi, j
mov eax, dword ptr M[edi*4]
cdq
idiv dword ptr u
mov m, eax
mov ecx, q
mov eax, [ecx]
imul eax, v
add m, eax
mov eax, dword ptr s1[8*8]
sbb m, eax
}
20)short N[4][20];
short* pj;
short f, g,n;
struct s{
double y[8];
short d;
char c[8];
};
s s2;
short n;
int i, j,k;
n = f * s2.d / *pj + g*N[j][k*2]
asm{
mov ecx, pj
mov ax, word ptr f
imul word ptr s2[8*8]
idiv word ptr [ecx]
mov n, ax
imul edi, j, 20
imul esi, k, 2
add edi, esi
mov ax, word ptr N[2*edi]
imul ax, word ptr g
add n, ax
}
21)int Z[8][14];
int r, t,p;
int *px;
struct s{
int m;
float w[4];
int v;
double y;
};
s s3;
int i, k;
p = r*s3.v — t/Z[k+2][i] + *px;
asm{
mov eax, r
imul eax, dword ptr s3[4+4*4]
mov p, eax
mov ebx, k
add ebx, 2
imul edi, ebx, 14
add edi, i
mov ebx, dword ptr Z[edi*4]
mov eax, t
cdq
idiv dword ptr Z[edi*4]
sub p, eax
mov edx, px
mov eax, [edx]
add p, eax
}
22)short B[60][80];
short m, n,r;
short *qx;
short r;
struct s{
float x[2];
char c[40];
short z;
double g;
};
s s4;
int i, j;
r = s4.z * B[i][j-2] + m – n/(*qx);
asm{
imul edi, i, 80
add edi, j
sub edi, 2
mov ax, word ptr B[2*edi]
imul ax, word ptr s4[2*4+40]
add ax, m
mov r, ax
mov ecx, qx
mov ax, n
cwd
idiv word ptr [ecx]
sub r, ax
}
23)short F[12][40];
short e, f,q;
short *p;
struct s{
char x[60];
short t;
float y[8];
};
s s5;
int i, j;
q = *p — F[i][j*2] / e + f * s5.t;
asm{
imul edi, i, 40
imul esi, j, 2
add edi, esi
mov ax, word ptr F[edi*2]
cwd
idiv word ptr e
mov edx, p
mov cx, word ptr [edx]
sub cx, ax
mov ax, f
imul ax, word ptr s5[60]
add ax, cx
mov q, ax
}
24)unsigned short C[30][16];
unsigned short p, q,w;
unsigned short *pn;
struct s{
char c[24];
float x[8];
unsigned short g;
};
s s6;
int i, j,k;
w = s6.g*p/q — (*pn)*C[i+k][j+k];
asm{
mov ax, word ptr s6[24+8*4]
mul ax, word ptr p
cwd
div word ptr q
mov w, ax
mov edx, pn
mov ax, word ptr [edx]
mov edx, i
add edx, k
imul edi, edx, 16
add edi, j
add edi, k
mul ax, word ptr C[edi*2]
sub w, ax
}
25)unsigned short H[12][8];
unsigned short k, l,u;
unsigned short *pg;
struct s{
float r;
int a;
double k;
unsigned short g;
};
s s7;
int i, j;
u = k/H[i+2][j]*(*pg) — s7.g/l;
asm{
mov eax, i
add eax, 2
imul edi, eax, 8
add edi, j
mov ax, k
cwd
div word ptr H[edi*2]
mov ecx, pg
mul ax, word ptr [ecx]
mov u, ax
mov ax, word ptr s7[4+4+8]
cwd
div l
sub u, ax
}
26)unsigned short G[16][80];
unsigned short u, v,t;
unsigned short *ph;
struct s{
int b;
char c[20];
unsigned short d;
float f;
};
s s8;
int j, k;
t = s8.d*(*ph) — G[k][j-2]/u + v;
asm{
mov ecx, ph
mov ax, word ptr s8[4+20]
mul ax, word ptr [ecx]
mov t, ax
imul edi, k, 80
add edi, j
sub edi, 2
mov ax, word ptr G[edi*2]
cwd
div u
sub t, ax
mov ax, v
add t, ax
}
27)unsigned short F[16][12];
unsigned short z, x,u;
unsigned short *pj;
unsigned short u;
struct s{
double z;
unsigned short d;
char s[10];
}
s s9;
int j, k;
u = z*x + F[k+1][j]/s9.d — *pj;
asm{
mov ax, z
mul ax, x
mov u, ax
mov eax, k
inc eax
imul edi, eax, 12
mov ax, word ptr F[edi*2]
cwd
div word ptr s9[8]
add u, ax
mov ecx, pj
mov ax, word ptr [ecx]
sub u, ax
}
28)unsigned short U[16][44];
unsigned short g, t,e;
unsigned short *pr;
struct s{
float w[20];
int id[10];
unsigned short y;
};
s s10;
int j, k;
e = t*(*pr) + U[k][j+2]/q — s10.y;
asm{
mov ecx, pr
mov ax, word ptr [ecx]
mul ax, t
mov e, ax
imul edi, k, 44
add edi, j
add edi, 2
mov ax, word ptr U[edi*2]
cwd
div q
sub ax, word ptr s10[20*4+10*4]
add e, ax
}
29)unsigned short W[8][12];
unsigned short d, a,u;
unsigned short *pu;
struct s{
double z;
char c[40];
unsigned short w;
double z;
};
s s11;
int i, k;
u = d + W[k-2][i]/(*pu) + a*s11.w;
asm{
mov eax, k
sub eax, 2
imul edi, eax, 12
add edi, i
mov ax, word ptr W[edi*2]
cwd
mov ecx, pu
div word ptr [ecx]
add ax, d
mov u, ax
mov ax, a
mul ax, word ptr s11[8+40]
add u, ax
}
30)unsigned short D[4][16];
unsigned short n, b,x;
struct s{
char p[64];
double v[4];
unsigned short h;
int u;
};
s s12;
unsigned short *pf;
int i, k;
x = n/b*s12.h — *pf + D[k+2][i+1];
asm{
mov ax, n
cwd
div word ptr b
mul ax, word ptr s12[64+4*8]
mov ecx, pf
add ax, word ptr [ecx]
mov ebx, k
add ebx, 2
imul edi, ebx, 16
add edi, i
inc edi
add ax, word ptr D[edi*2]
}
31)int R[16][80];
int u, m,h;
int *pf;
struct s
{
char c[64];
int w;
float d[10];
int t;
};
s s13;
int k, j;
h = R[k+2][j]/u*m + *pf — s13.t;
asm{
mov eax, k
add eax, 2
imul edi, eax, 80
add edi, j
mov eax, dword ptr R[edi*4]
cdq
idiv u
imul eax, m
mov ecx, pf
add eax, [ecx]
sub eax, dword ptr s13[64+4+10*4]
mov h, eax
}
32)int M[20][8];
int g, k,r;
int *pf;
struct s
{
double e[4];
char u[26];
int f;
};
s s14;
int j, i;
r = (g + s14.f — *pf)/M[j+1][i+1] — k;
asm{
mov eax, g
add eax, dword ptr s14[4*8+26]
mov ecx, pf
sub eax, [ecx]
cdq
mov ecx, j
inc ecx
imul edi, ecx, 8
add edi, i
inc edi
idiv dword ptr M[edi*4]
sub eax, k
mov r, eax
}
33)int R[12][24];
int r, t,e;
int *pq;
struct s
{
int m[20];
float b[16];
int x;
};
s s15;
int k, j;
e = (t*s15.x — r)/R[k+2][j] + *pq;
asm{
mov eax, t
imul eax, dword ptr s15[20*4+16*4]
sub eax, r
cdq
mov ecx, k
add ecx, 2
imul edi, ecx, 24
add edi, j
idiv dword ptr R[4*edi]
mov ecx, pq
add eax, [ecx]
mov e, eax
}
34)int D[24][20];
int f, g,a;
int *pc;
struct s
{
double d;
int k;
char c[40];
int e;
};
s s16;
int i, j;
f/(*pc) — (D[i+2][j+1] + g)*s16.e;
asm{
mov ecx, pc
mov eax, f
cdq
idiv [ecx]
mov a, eax
mov ecx, i
add ecx, 2
imul edi, ecx, 20
add edi, j
inc edi
mov eax, dword ptr D[edi*4]
add eax, g
imul eax, dword ptr s16[8+4+40]
sub a, eax
}