VARS VAR i CODE st 0,[i] ENDCODE VAR up CODE mov 15,%t2 cmp %t2,0 bge L0 mov 0,%t2 L0: mov 1,%t0 add %t0,%t2,%t0 st %t0,[$a0] call PCAT$alloc add %o0,%t0,%t1 sub %t1,%t2,%t3 L1: cmp %t1,%t3 ble L2 dec %t1 st 1,[%t1] ba L1 L2: dec %t0 st %t0,[%o0] st %t1,[up] ENDCODE VAR down CODE mov 15,%t6 cmp %t6,0 bge L3 mov 0,%t6 L3: mov 1,%t4 add %t4,%t6,%t4 st %t4,[$a0] call PCAT$alloc add %o0,%t4,%t5 sub %t5,%t6,%t7 L4: cmp %t5,%t7 ble L5 dec %t5 st 1,[%t5] ba L4 L5: dec %t4 st %t4,[%o0] st %t5,[down] ENDCODE VAR rows CODE mov 15,%t10 cmp %t10,0 bge L6 mov 0,%t10 L6: mov 1,%t8 add %t8,%t10,%t8 st %t8,[$a0] call PCAT$alloc add %o0,%t8,%t9 sub %t9,%t10,%t11 L7: cmp %t9,%t11 ble L8 dec %t9 st 1,[%t9] ba L7 L8: dec %t8 st %t8,[%o0] st %t9,[rows] ENDCODE VAR x CODE mov 8,%t14 cmp %t14,0 bge L9 mov 0,%t14 L9: neg 1,%t15 mov 1,%t12 add %t12,%t14,%t12 st %t12,[$a0] call PCAT$alloc add %o0,%t12,%t13 sub %t13,%t14,%t16 L10: cmp %t13,%t16 ble L11 dec %t13 st %t15,[%t13] ba L10 L11: dec %t12 st %t12,[%o0] st %t13,[x] ENDCODE PROCS PROC print ( ) CODE cmp 0,0 bge L0 call PCAT$bounds_error L0: ld [x],%t1 sub %t1,1,%t2 ld [%t2],%t2 cmp 0,%t2 bl L1 call PCAT$bounds_error L1: add %t1,0,%t1 ld [%t1],%t0 st %t0,[$a0] call PCAT$write_int cmp 1,0 bge L2 call PCAT$bounds_error L2: ld [x],%t4 sub %t4,1,%t5 ld [%t5],%t5 cmp 1,%t5 bl L3 call PCAT$bounds_error L3: add %t4,1,%t4 ld [%t4],%t3 st %t3,[$a0] call PCAT$write_int cmp 2,0 bge L4 call PCAT$bounds_error L4: ld [x],%t7 sub %t7,1,%t8 ld [%t8],%t8 cmp 2,%t8 bl L5 call PCAT$bounds_error L5: add %t7,2,%t7 ld [%t7],%t6 st %t6,[$a0] call PCAT$write_int cmp 3,0 bge L6 call PCAT$bounds_error L6: ld [x],%t10 sub %t10,1,%t11 ld [%t11],%t11 cmp 3,%t11 bl L7 call PCAT$bounds_error L7: add %t10,3,%t10 ld [%t10],%t9 st %t9,[$a0] call PCAT$write_int cmp 4,0 bge L8 call PCAT$bounds_error L8: ld [x],%t13 sub %t13,1,%t14 ld [%t14],%t14 cmp 4,%t14 bl L9 call PCAT$bounds_error L9: add %t13,4,%t13 ld [%t13],%t12 st %t12,[$a0] call PCAT$write_int cmp 5,0 bge L10 call PCAT$bounds_error L10: ld [x],%t16 sub %t16,1,%t17 ld [%t17],%t17 cmp 5,%t17 bl L11 call PCAT$bounds_error L11: add %t16,5,%t16 ld [%t16],%t15 st %t15,[$a0] call PCAT$write_int cmp 6,0 bge L12 call PCAT$bounds_error L12: ld [x],%t19 sub %t19,1,%t20 ld [%t20],%t20 cmp 6,%t20 bl L13 call PCAT$bounds_error L13: add %t19,6,%t19 ld [%t19],%t18 st %t18,[$a0] call PCAT$write_int cmp 7,0 bge L14 call PCAT$bounds_error L14: ld [x],%t22 sub %t22,1,%t23 ld [%t23],%t23 cmp 7,%t23 bl L15 call PCAT$bounds_error L15: add %t22,7,%t22 ld [%t22],%t21 st %t21,[$a0] call PCAT$write_int call PCAT$write_newline return ENDCODE PROCS PROC queens ( c ) VARS VAR r CODE st 0,[r] ENDCODE CODE L0: ld [r],%t0 cmp %t0,8 bl L1 ba L2 L1: ld [r],%t2 cmp %t2,0 bge L8 call PCAT$bounds_error L8: ld [rows],%t3 sub %t3,1,%t4 ld [%t4],%t4 cmp %t2,%t4 bl L9 call PCAT$bounds_error L9: add %t3,%t2,%t3 ld [%t3],%t1 cmp %t1,0 be L4 ba L7 L7: ld [r],%t6 ld [c],%t7 sub %t6,%t7,%t8 add %t8,7,%t9 cmp %t9,0 bge L10 call PCAT$bounds_error L10: ld [up],%t10 sub %t10,1,%t11 ld [%t11],%t11 cmp %t9,%t11 bl L11 call PCAT$bounds_error L11: add %t10,%t9,%t10 ld [%t10],%t5 cmp %t5,0 be L4 ba L6 L6: ld [r],%t13 ld [c],%t14 add %t13,%t14,%t15 cmp %t15,0 bge L12 call PCAT$bounds_error L12: ld [down],%t16 sub %t16,1,%t17 ld [%t17],%t17 cmp %t15,%t17 bl L13 call PCAT$bounds_error L13: add %t16,%t15,%t16 ld [%t16],%t12 cmp %t12,0 be L4 ba L3 L3: ld [r],%t18 cmp %t18,0 bge L14 call PCAT$bounds_error L14: ld [rows],%t19 sub %t19,1,%t20 ld [%t20],%t20 cmp %t18,%t20 bl L15 call PCAT$bounds_error L15: add %t19,%t18,%t19 st 0,[%t19] ld [r],%t21 ld [c],%t22 sub %t21,%t22,%t23 add %t23,7,%t24 cmp %t24,0 bge L16 call PCAT$bounds_error L16: ld [up],%t25 sub %t25,1,%t26 ld [%t26],%t26 cmp %t24,%t26 bl L17 call PCAT$bounds_error L17: add %t25,%t24,%t25 st 0,[%t25] ld [r],%t27 ld [c],%t28 add %t27,%t28,%t29 cmp %t29,0 bge L18 call PCAT$bounds_error L18: ld [down],%t30 sub %t30,1,%t31 ld [%t31],%t31 cmp %t29,%t31 bl L19 call PCAT$bounds_error L19: add %t30,%t29,%t30 st 0,[%t30] ld [c],%t32 cmp %t32,0 bge L20 call PCAT$bounds_error L20: ld [x],%t33 sub %t33,1,%t34 ld [%t34],%t34 cmp %t32,%t34 bl L21 call PCAT$bounds_error L21: add %t33,%t32,%t33 ld [r],%t35 st %t35,[%t33] ld [c],%t36 cmp %t36,7 be L22 ba L23 L22: call print ba L24 L23: ld [c],%t37 add %t37,1,%t38 st %t38,[$a0] call queens L24: ld [r],%t39 cmp %t39,0 bge L25 call PCAT$bounds_error L25: ld [rows],%t40 sub %t40,1,%t41 ld [%t41],%t41 cmp %t39,%t41 bl L26 call PCAT$bounds_error L26: add %t40,%t39,%t40 st 1,[%t40] ld [r],%t42 ld [c],%t43 sub %t42,%t43,%t44 add %t44,7,%t45 cmp %t45,0 bge L27 call PCAT$bounds_error L27: ld [up],%t46 sub %t46,1,%t47 ld [%t47],%t47 cmp %t45,%t47 bl L28 call PCAT$bounds_error L28: add %t46,%t45,%t46 st 1,[%t46] ld [r],%t48 ld [c],%t49 add %t48,%t49,%t50 cmp %t50,0 bge L29 call PCAT$bounds_error L29: ld [down],%t51 sub %t51,1,%t52 ld [%t52],%t52 cmp %t50,%t52 bl L30 call PCAT$bounds_error L30: add %t51,%t50,%t51 st 1,[%t51] ba L5 L4: L5: ld [r],%t53 add %t53,1,%t54 st %t54,[r] ba L0 L2: return ENDCODE CODE st 0,[$a0] call queens return ENDCODE