Snippets

7shi n nanoMIPS and MIPS

Created by 7shi n last modified
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509

mips.x:     ファイル形式 elf32-bigmips


セクション .text の逆アセンブル:

00400020 <null>:
void null()
{
  return;
}
  400020:	03e00008 	jr	ra
  400024:	00000000 	nop

00400028 <return_zero>:

int return_zero()
{
  return 0;
}
  400028:	03e00008 	jr	ra
  40002c:	00001021 	move	v0,zero

00400030 <return_one>:

int return_one()
{
  return 1;
}
  400030:	03e00008 	jr	ra
  400034:	24020001 	li	v0,1

00400038 <return_int_size>:

int return_int_size()
{
  return sizeof(int);
}
  400038:	03e00008 	jr	ra
  40003c:	24020004 	li	v0,4

00400040 <return_pointer_size>:

int return_pointer_size()
{
  return sizeof(int *);
}
  400040:	03e00008 	jr	ra
  400044:	24020004 	li	v0,4

00400048 <return_short_size>:

int return_short_size()
{
  return sizeof(short);
}
  400048:	03e00008 	jr	ra
  40004c:	24020002 	li	v0,2

00400050 <return_long_size>:

int return_long_size()
{
  return sizeof(long);
}
  400050:	03e00008 	jr	ra
  400054:	24020004 	li	v0,4

00400058 <return_short>:

short return_short()
{
  return 0x7788;
}
  400058:	03e00008 	jr	ra
  40005c:	24027788 	li	v0,30600

00400060 <return_long>:

long return_long()
{
  return 0x778899aa;
}
  400060:	3c027788 	lui	v0,0x7788
  400064:	03e00008 	jr	ra
  400068:	344299aa 	ori	v0,v0,0x99aa

0040006c <return_short_upper>:

short return_short_upper()
{
  return 0xffee;
}
  40006c:	03e00008 	jr	ra
  400070:	2402ffee 	li	v0,-18

00400074 <return_long_upper>:

long return_long_upper()
{
  return 0xffeeddcc;
}
  400074:	3c02ffee 	lui	v0,0xffee
  400078:	03e00008 	jr	ra
  40007c:	3442ddcc 	ori	v0,v0,0xddcc

00400080 <return_arg1>:

int return_arg1(int a)
{
  return a;
}
  400080:	03e00008 	jr	ra
  400084:	00801021 	move	v0,a0

00400088 <return_arg2>:

int return_arg2(int a, int b)
{
  return b;
}
  400088:	03e00008 	jr	ra
  40008c:	00a01021 	move	v0,a1

00400090 <add>:

int add(int a, int b)
{
  return a + b;
}
  400090:	03e00008 	jr	ra
  400094:	00851021 	addu	v0,a0,a1

00400098 <add3>:

int add3(int a, int b, int c)
{
  return a + b + c;
  400098:	00851021 	addu	v0,a0,a1
}
  40009c:	03e00008 	jr	ra
  4000a0:	00461021 	addu	v0,v0,a2

004000a4 <add_two>:

int add_two(int a)
{
  return a + 2;
}
  4000a4:	03e00008 	jr	ra
  4000a8:	24820002 	addiu	v0,a0,2

004000ac <inc>:

int inc(int a)
{
  return ++a;
}
  4000ac:	03e00008 	jr	ra
  4000b0:	24820001 	addiu	v0,a0,1

004000b4 <or>:

int or(int a, int b)
{
  return a | b;
}
  4000b4:	03e00008 	jr	ra
  4000b8:	00a41025 	or	v0,a1,a0

004000bc <or_one>:

int or_one(int a)
{
  return a | 1;
}
  4000bc:	03e00008 	jr	ra
  4000c0:	34820001 	ori	v0,a0,0x1

004000c4 <load>:

int load(volatile int *p)
{
  return *p;
  4000c4:	8c820000 	lw	v0,0(a0)
}
  4000c8:	03e00008 	jr	ra
  4000cc:	00000000 	nop

004000d0 <store>:

void store(volatile int *p)
{
  *p = 0xff;
  4000d0:	240200ff 	li	v0,255
  4000d4:	ac820000 	sw	v0,0(a0)
}
  4000d8:	03e00008 	jr	ra
  4000dc:	00000000 	nop

004000e0 <load_long>:

long load_long(volatile long *p)
{
  return *p;
  4000e0:	8c820000 	lw	v0,0(a0)
}
  4000e4:	03e00008 	jr	ra
  4000e8:	00000000 	nop

004000ec <store_long>:

void store_long(volatile long *p)
{
  *p = 0x11223344;
  4000ec:	3c021122 	lui	v0,0x1122
  4000f0:	24423344 	addiu	v0,v0,13124
  4000f4:	ac820000 	sw	v0,0(a0)
}
  4000f8:	03e00008 	jr	ra
  4000fc:	00000000 	nop

00400100 <member>:
  int c;
};

int member(struct structure *p)
{
  p->b = 1;
  400100:	24020001 	li	v0,1
  400104:	ac820004 	sw	v0,4(a0)
  return p->c;
}
  400108:	8c820008 	lw	v0,8(a0)
  40010c:	03e00008 	jr	ra
  400110:	00000000 	nop

00400114 <get_static_value_addr>:
long static_long = 0x12345678;

int *get_static_value_addr()
{
  return &static_value;
}
  400114:	03e00008 	jr	ra
  400118:	27828014 	addiu	v0,gp,-32748

0040011c <get_static_value>:

int get_static_value()
{
  return static_value;
}
  40011c:	8f828014 	lw	v0,-32748(gp)
  400120:	03e00008 	jr	ra
  400124:	00000000 	nop

00400128 <set_static_value>:

void set_static_value(int a)
{
  static_value = a;
}
  400128:	03e00008 	jr	ra
  40012c:	af848014 	sw	a0,-32748(gp)

00400130 <set_stack>:

#define UNUSED __attribute__((unused)) 

void set_stack()
{
  400130:	27bdfff8 	addiu	sp,sp,-8
  UNUSED volatile int a = 0xfe;
  400134:	240200fe 	li	v0,254
  400138:	afa20000 	sw	v0,0(sp)
  UNUSED volatile int b = 0xff;
  40013c:	240200ff 	li	v0,255
  400140:	afa20004 	sw	v0,4(sp)
}
  400144:	03e00008 	jr	ra
  400148:	27bd0008 	addiu	sp,sp,8

0040014c <use_stack>:

int use_stack()
{
  40014c:	27bdfff8 	addiu	sp,sp,-8
  volatile int a = 0xfe;
  400150:	240200fe 	li	v0,254
  400154:	afa20000 	sw	v0,0(sp)
  volatile int b = 0xff;
  400158:	240200ff 	li	v0,255
  40015c:	afa20004 	sw	v0,4(sp)
  return a + b;
  400160:	8fa30000 	lw	v1,0(sp)
  400164:	8fa20004 	lw	v0,4(sp)
  400168:	00000000 	nop
}
  40016c:	00621021 	addu	v0,v1,v0
  400170:	03e00008 	jr	ra
  400174:	27bd0008 	addiu	sp,sp,8

00400178 <call_self>:

void call_self()
{
  400178:	27bdffe8 	addiu	sp,sp,-24
  40017c:	afbf0014 	sw	ra,20(sp)
  call_self();
  400180:	0c10005e 	jal	400178 <call_self>
  400184:	00000000 	nop
}
  400188:	8fbf0014 	lw	ra,20(sp)
  40018c:	00000000 	nop
  400190:	03e00008 	jr	ra
  400194:	27bd0018 	addiu	sp,sp,24

00400198 <call_simple>:

int call_simple(int a)
{
  400198:	27bdffe8 	addiu	sp,sp,-24
  40019c:	afbf0014 	sw	ra,20(sp)
  return return_arg1(a);
  4001a0:	0c100020 	jal	400080 <return_arg1>
  4001a4:	00000000 	nop
}
  4001a8:	8fbf0014 	lw	ra,20(sp)
  4001ac:	00000000 	nop
  4001b0:	03e00008 	jr	ra
  4001b4:	27bd0018 	addiu	sp,sp,24

004001b8 <call_complex1>:

int call_complex1()
{
  4001b8:	27bdffe8 	addiu	sp,sp,-24
  4001bc:	afbf0014 	sw	ra,20(sp)
  return return_arg1(0xfe) + 1;
  4001c0:	0c100020 	jal	400080 <return_arg1>
  4001c4:	240400fe 	li	a0,254
}
  4001c8:	24420001 	addiu	v0,v0,1
  4001cc:	8fbf0014 	lw	ra,20(sp)
  4001d0:	00000000 	nop
  4001d4:	03e00008 	jr	ra
  4001d8:	27bd0018 	addiu	sp,sp,24

004001dc <call_complex2>:

int call_complex2(int a, int b)
{
  4001dc:	27bdffe8 	addiu	sp,sp,-24
  4001e0:	afbf0014 	sw	ra,20(sp)
  4001e4:	afb00010 	sw	s0,16(sp)
  4001e8:	00a08021 	move	s0,a1
  static_value = return_arg1(b);
  4001ec:	0c100020 	jal	400080 <return_arg1>
  4001f0:	00a02021 	move	a0,a1
  4001f4:	af828014 	sw	v0,-32748(gp)
  return b;
}
  4001f8:	02001021 	move	v0,s0
  4001fc:	8fbf0014 	lw	ra,20(sp)
  400200:	8fb00010 	lw	s0,16(sp)
  400204:	03e00008 	jr	ra
  400208:	27bd0018 	addiu	sp,sp,24

0040020c <call_pointer>:

void call_pointer(int (*f)(void))
{
  40020c:	27bdffe8 	addiu	sp,sp,-24
  400210:	afbf0014 	sw	ra,20(sp)
  f();
  400214:	0080f809 	jalr	a0
  400218:	00000000 	nop
}
  40021c:	8fbf0014 	lw	ra,20(sp)
  400220:	00000000 	nop
  400224:	03e00008 	jr	ra
  400228:	27bd0018 	addiu	sp,sp,24

0040022c <condition>:

int condition(int a, int b)
{
  if (a == b)
  40022c:	14850002 	bne	a0,a1,400238 <condition+0xc>
  400230:	00000000 	nop
    b = 1;
  400234:	24050001 	li	a1,1
  return b + 1;
}
  400238:	03e00008 	jr	ra
  40023c:	24a20001 	addiu	v0,a1,1

00400240 <loop>:

int loop(int n)
{
  int i, sum = 0;
  for (i = 0; i < n; i++)
  400240:	18800008 	blez	a0,400264 <loop+0x24>
  400244:	00001821 	move	v1,zero
  return b + 1;
}

int loop(int n)
{
  int i, sum = 0;
  400248:	00001021 	move	v0,zero
  for (i = 0; i < n; i++)
    sum += i;
  40024c:	00431021 	addu	v0,v0,v1
}

int loop(int n)
{
  int i, sum = 0;
  for (i = 0; i < n; i++)
  400250:	24630001 	addiu	v1,v1,1
  400254:	1464fffe 	bne	v1,a0,400250 <loop+0x10>
  400258:	00431021 	addu	v0,v0,v1
  40025c:	03e00008 	jr	ra
  400260:	00431023 	subu	v0,v0,v1
    sum += i;
  return sum;
}
  400264:	03e00008 	jr	ra
  400268:	00001021 	move	v0,zero

0040026c <many_args>:

int many_args(int a0, int a1, int a2, int a3,
              int a4, int a5, int a6, int a7)
{
  return a0 + a3 + a5 + a7;
  40026c:	00872021 	addu	a0,a0,a3
  400270:	8fa20014 	lw	v0,20(sp)
  400274:	00000000 	nop
  400278:	00821021 	addu	v0,a0,v0
}
  40027c:	8fa3001c 	lw	v1,28(sp)
  400280:	03e00008 	jr	ra
  400284:	00431021 	addu	v0,v0,v1

00400288 <call_many_args>:

int call_many_args()
{
  400288:	27bdffd8 	addiu	sp,sp,-40
  40028c:	afbf0024 	sw	ra,36(sp)
  return many_args(0, 1, 2, 3, 4, 5, 6, 7);
  400290:	24020004 	li	v0,4
  400294:	afa20010 	sw	v0,16(sp)
  400298:	24020005 	li	v0,5
  40029c:	afa20014 	sw	v0,20(sp)
  4002a0:	24020006 	li	v0,6
  4002a4:	afa20018 	sw	v0,24(sp)
  4002a8:	24020007 	li	v0,7
  4002ac:	afa2001c 	sw	v0,28(sp)
  4002b0:	00002021 	move	a0,zero
  4002b4:	24050001 	li	a1,1
  4002b8:	24060002 	li	a2,2
  4002bc:	0c10009b 	jal	40026c <many_args>
  4002c0:	24070003 	li	a3,3
}
  4002c4:	8fbf0024 	lw	ra,36(sp)
  4002c8:	00000000 	nop
  4002cc:	03e00008 	jr	ra
  4002d0:	27bd0028 	addiu	sp,sp,40

004002d4 <direct>:

#ifndef NO_DIRECT
void direct()
{
  asm volatile ("nop");
  4002d4:	00000000 	nop
  return;
}
  4002d8:	03e00008 	jr	ra
  4002dc:	00000000 	nop

004002e0 <binary>:

#ifndef NO_BINARY
void binary()
{
  asm volatile (".align 4");
  asm volatile (".int 0x0");
  4002e0:	00000000 	nop
  return;
}
  4002e4:	03e00008 	jr	ra
  4002e8:	00000000 	nop

004002ec <main>:
#endif

int main()
{
  return 0;
}
  4002ec:	03e00008 	jr	ra
  4002f0:	00001021 	move	v0,zero
	...
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492

nanomips.x:     file format elf32-littlenanomips


Disassembly of section .text:

004000c0 <null>:
void null()
{
  4000c0:	dbe0      	jrc	ra

004000c2 <return_zero>:
}

int return_zero()
{
  return 0;
}
  4000c2:	1080      	move	a0,zero
  4000c4:	dbe0      	jrc	ra

004000c6 <return_one>:

int return_one()
{
  return 1;
}
  4000c6:	d201      	li	a0,1
  4000c8:	dbe0      	jrc	ra

004000ca <return_int_size>:

int return_int_size()
{
  return sizeof(int);
}
  4000ca:	d204      	li	a0,4
  4000cc:	dbe0      	jrc	ra

004000ce <return_pointer_size>:

int return_pointer_size()
{
  return sizeof(int *);
}
  4000ce:	d204      	li	a0,4
  4000d0:	dbe0      	jrc	ra

004000d2 <return_short_size>:

int return_short_size()
{
  return sizeof(short);
}
  4000d2:	d202      	li	a0,2
  4000d4:	dbe0      	jrc	ra

004000d6 <return_long_size>:

int return_long_size()
{
  return sizeof(long);
}
  4000d6:	d204      	li	a0,4
  4000d8:	dbe0      	jrc	ra

004000da <return_short>:

short return_short()
{
  return 0x7788;
}
  4000da:	0080 7788 	li	a0,30600
  4000de:	dbe0      	jrc	ra

004000e0 <return_long>:

long return_long()
{
  return 0x778899aa;
}
  4000e0:	6080 99aa 	li	a0,0x778899aa
  4000e4:	7788 
  4000e6:	dbe0      	jrc	ra

004000e8 <return_short_upper>:

short return_short_upper()
{
  return 0xffee;
}
  4000e8:	8080 8012 	li	a0,-18
  4000ec:	dbe0      	jrc	ra

004000ee <return_long_upper>:

long return_long_upper()
{
  return 0xffeeddcc;
}
  4000ee:	6080 ddcc 	li	a0,0xffeeddcc
  4000f2:	ffee 
  4000f4:	dbe0      	jrc	ra

004000f6 <return_arg1>:

int return_arg1(int a)
{
  return a;
}
  4000f6:	dbe0      	jrc	ra

004000f8 <return_arg2>:

int return_arg2(int a, int b)
{
  return b;
}
  4000f8:	1085      	move	a0,a1

004000fa <$LVL2>:
  4000fa:	dbe0      	jrc	ra

004000fc <add>:

int add(int a, int b)
{
  return a + b;
}
  4000fc:	b2c8      	addu	a0,a0,a1

004000fe <$LVL4>:
  4000fe:	dbe0      	jrc	ra

00400100 <add3>:

int add3(int a, int b, int c)
{
  return a + b + c;
  400100:	b2c8      	addu	a0,a0,a1

00400102 <$LVL6>:
}
  400102:	b348      	addu	a0,a0,a2
  400104:	dbe0      	jrc	ra

00400106 <add_two>:

int add_two(int a)
{
  return a + 2;
}
  400106:	908a      	addiu	a0,a0,2

00400108 <$LVL8>:
  400108:	dbe0      	jrc	ra

0040010a <inc>:

int inc(int a)
{
  return ++a;
}
  40010a:	9089      	addiu	a0,a0,1

0040010c <$LVL10>:
  40010c:	dbe0      	jrc	ra

0040010e <or>:

int or(int a, int b)
{
  return a | b;
}
  40010e:	525c      	or	a0,a0,a1

00400110 <$LVL12>:
  400110:	dbe0      	jrc	ra

00400112 <or_one>:

int or_one(int a)
{
  return a | 1;
}
  400112:	8084 0001 	ori	a0,a0,0x1

00400116 <$LVL14>:
  400116:	dbe0      	jrc	ra

00400118 <load>:

int load(volatile int *p)
{
  return *p;
  400118:	1640      	lw	a0,0(a0)

0040011a <$LVL16>:
}
  40011a:	dbe0      	jrc	ra

0040011c <store>:

void store(volatile int *p)
{
  *p = 0xff;
  40011c:	00e0 00ff 	li	a3,255
  400120:	97c0      	sw	a3,0(a0)
  400122:	dbe0      	jrc	ra

00400124 <load_long>:
}

long load_long(volatile long *p)
{
  return *p;
  400124:	1640      	lw	a0,0(a0)

00400126 <$LVL19>:
}
  400126:	dbe0      	jrc	ra

00400128 <store_long>:

void store_long(volatile long *p)
{
  *p = 0x11223344;
  400128:	60e0 3344 	li	a3,0x11223344
  40012c:	1122 
  40012e:	97c0      	sw	a3,0(a0)
  400130:	dbe0      	jrc	ra

00400132 <member>:
  int c;
};

int member(struct structure *p)
{
  p->b = 1;
  400132:	d381      	li	a3,1
  400134:	97c1      	sw	a3,4(a0)

00400136 <.Loc.126.1>:
  return p->c;
}
  400136:	1642      	lw	a0,8(a0)

00400138 <$LVL22>:
  400138:	dbe0      	jrc	ra

0040013a <get_static_value_addr>:
long static_long = 0x12345678;

int *get_static_value_addr()
{
  return &static_value;
}
  40013a:	4080 0004 	addiu	a0,gp,4
  40013e:	dbe0      	jrc	ra

00400140 <get_static_value>:

int get_static_value()
{
  return static_value;
}
  400140:	4080 0006 	lw	a0,4(gp)
  400144:	dbe0      	jrc	ra

00400146 <set_static_value>:

void set_static_value(int a)
{
  static_value = a;
  400146:	4080 0007 	sw	a0,4(gp)
  40014a:	dbe0      	jrc	ra

0040014c <set_stack>:
}

#define UNUSED __attribute__((unused)) 

void set_stack()
{
  40014c:	83bd 8010 	addiu	sp,sp,-16
  UNUSED volatile int a = 0xfe;
  400150:	00e0 00fe 	li	a3,254
  400154:	b4e3      	sw	a3,12(sp)
  UNUSED volatile int b = 0xff;
  400156:	00e0 00ff 	li	a3,255
  40015a:	b4e2      	sw	a3,8(sp)

0040015c <.Loc.152.1>:
}
  40015c:	1d10      	restore.jrc	16

0040015e <use_stack>:

int use_stack()
{
  40015e:	83bd 8010 	addiu	sp,sp,-16
  volatile int a = 0xfe;
  400162:	00e0 00fe 	li	a3,254
  400166:	b4e3      	sw	a3,12(sp)
  volatile int b = 0xff;
  400168:	00e0 00ff 	li	a3,255
  40016c:	b4e2      	sw	a3,8(sp)
  return a + b;
  40016e:	3483      	lw	a0,12(sp)
  400170:	34e2      	lw	a3,8(sp)

00400172 <.Loc.159.1>:
}
  400172:	b3c8      	addu	a0,a0,a3
  400174:	1d10      	restore.jrc	16

00400176 <call_self>:

void call_self()
{
  400176:	1e11      	save	16,ra

00400178 <.Loc.163.1>:
  call_self();
  400178:	3bfd      	balc	400176 <call_self>

0040017a <$LVL24>:
  40017a:	1f11      	restore.jrc	16,ra

0040017c <call_simple>:
}

int call_simple(int a)
{
  return return_arg1(a);
}
  40017c:	dbe0      	jrc	ra

0040017e <call_complex1>:

int call_complex1()
{
  return return_arg1(0xfe) + 1;
}
  40017e:	0080 00ff 	li	a0,255
  400182:	dbe0      	jrc	ra

00400184 <call_complex2>:

int call_complex2(int a, int b)
{
  static_value = return_arg1(b);
  400184:	40a0 0007 	sw	a1,4(gp)

00400188 <.Loc.180.1>:
  return b;
}
  400188:	1085      	move	a0,a1

0040018a <$LVL27>:
  40018a:	dbe0      	jrc	ra

0040018c <call_pointer>:

void call_pointer(int (*f)(void))
{
  40018c:	1e11      	save	16,ra

0040018e <.Loc.184.1>:
  f();
  40018e:	d890      	jalrc	a0

00400190 <$LVL29>:
  400190:	1f11      	restore.jrc	16,ra

00400192 <condition>:
}

int condition(int a, int b)
{
  if (a == b)
    b = 1;
  400192:	5254      	xor	a0,a0,a1

00400194 <$LVL31>:
  400194:	d381      	li	a3,1
  400196:	2087 2a10 	movz	a1,a3,a0

0040019a <$LVL32>:
  return b + 1;
}
  40019a:	0085 0001 	addiu	a0,a1,1
  40019e:	dbe0      	jrc	ra

004001a0 <loop>:

int loop(int n)
{
  int i, sum = 0;
  for (i = 0; i < n; i++)
  4001a0:	8880 8010 	blezc	a0,4001b4 <$LVL39>
  4001a4:	10c0      	move	a2,zero
  4001a6:	10e0      	move	a3,zero

004001a8 <$LVL34>:
    sum += i;
  4001a8:	b3ec      	addu	a2,a2,a3
  for (i = 0; i < n; i++)
  4001aa:	90e9      	addiu	a3,a3,1
  4001ac:	a887 3ff9 	bnec	a3,a0,4001a8 <$LVL34>

004001b0 <$LVL37>:
  return sum;
}
  4001b0:	1086      	move	a0,a2

004001b2 <$LVL38>:
  4001b2:	dbe0      	jrc	ra

004001b4 <$LVL39>:
  int i, sum = 0;
  4001b4:	10c0      	move	a2,zero

004001b6 <.Loc.199.1>:
  return sum;
  4001b6:	1bf9      	bc	4001b0 <$LVL37>

004001b8 <many_args>:

int many_args(int a0, int a1, int a2, int a3,
              int a4, int a5, int a6, int a7)
{
  return a0 + a3 + a5 + a7;
  4001b8:	b3c8      	addu	a0,a0,a3

004001ba <$LVL41>:
  4001ba:	3c81      	addu	a0,a0,a5

004001bc <.Loc.206.1>:
}
  4001bc:	3c83      	addu	a0,a0,a7
  4001be:	dbe0      	jrc	ra

004001c0 <call_many_args>:

int call_many_args()
{
  return many_args(0, 1, 2, 3, 4, 5, 6, 7);
}
  4001c0:	d20f      	li	a0,15
  4001c2:	dbe0      	jrc	ra

004001c4 <direct>:

#ifndef NO_DIRECT
void direct()
{
  asm volatile ("nop");
  4001c4:	9008      	nop
  4001c6:	dbe0      	jrc	ra

004001c8 <$LFB39>:
}
#endif

#ifndef NO_BINARY
void binary()
{
  4001c8:	8000 c000 	nop
  4001cc:	8000 c000 	nop

004001d0 <binary>:
  asm volatile (".align 4");
  4001d0:	0000 0000 	sigrie	0x0

004001d4 <.Loc.225.1>:
  asm volatile (".int 0x0");
  4001d4:	dbe0      	jrc	ra

004001d6 <main>:
#endif

int main()
{
  return 0;
}
  4001d6:	1080      	move	a0,zero
  4001d8:	dbe0      	jrc	ra

004001da <$Letext0>:
  4001da:	9008      	nop
  4001dc:	8000 c000 	nop

Comments (0)