package secs

@(private)
Work1 :: proc(world: ^World, p: proc(_: Entity, _: ^$C)) {
	components := cast(^[dynamic]Container(C))world.components[typeid_of(C)]
	if components == nil do return
	for c, e in components {
		if auto_cast e >= world.next_id do break
		if c != nil {
			p(Entity(e), &c.(C))
		}
	}
}

@(private)
Work1Cancellable :: proc(world: ^World, p: proc(done: ^bool, _: Entity, _: ^$C)) {
	components := cast(^[dynamic]Container(C))world.components[typeid_of(C)]
	if components == nil do return
	done := false
	for c, e in components {
		if auto_cast e >= world.next_id do break
		if c != nil {
			p(&done, Entity(e), &c.(C))
			if done do break
		}
	}
}

@(private)
Work2 :: proc(world: ^World, p: proc(_: Entity, _: ^$C1, _: ^$C2)) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	if cs1 == nil do return
	if cs2 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		c2 := cs2[e]
		if c1 != nil && c2 != nil {
			p(Entity(e), &c1.(C1), &c2.(C2))
		}
	}
}

@(private)
Work2Cancellable :: proc(world: ^World, p: proc(done: ^bool, _: Entity, _: ^$C1, _: ^$C2)) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	if cs1 == nil do return
	if cs2 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		c2 := cs2[e]
		if c1 != nil && c2 != nil {
			p(&done, Entity(e), &c1.(C1), &c2.(C2))
			if done do break
		}
	}
}

@(private)
Work3 :: proc(world: ^World, p: proc(_: Entity, _: ^$C1, _: ^$C2, _: ^$C3)) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		c2 := cs2[e]
		c3 := cs3[e]
		if c1 != nil && c2 != nil && c3 != nil {
			p(Entity(e), &c1.(C1), &c2.(C2), &c3.(C3))
		}
	}
}

@(private)
Work3Cancellable :: proc(
	world: ^World,
	p: proc(done: ^bool, _: Entity, _: ^$C1, _: ^$C2, _: ^$C3),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		c2 := cs2[e]
		c3 := cs3[e]
		if c1 != nil && c2 != nil && c3 != nil {
			p(&done, Entity(e), &c1.(C1), &c2.(C2), &c3.(C3))
			if done do break
		}
	}
}

@(private)
Work4 :: proc(world: ^World, p: proc(_: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4)) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		if c1 != nil && c2 != nil && c3 != nil && c4 != nil {
			p(Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4))
		}
	}
}

@(private)
Work4Cancellable :: proc(
	world: ^World,
	p: proc(done: ^bool, _: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		if c1 != nil && c2 != nil && c3 != nil && c4 != nil {
			p(&done, Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4))
			if done do break
		}
	}
}

@(private)
Work5 :: proc(world: ^World, p: proc(_: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5)) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		if c1 != nil && c2 != nil && c3 != nil && c4 != nil && c5 != nil {
			p(Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4), &c5.(C5))
		}
	}
}

@(private)
Work5Cancellable :: proc(
	world: ^World,
	p: proc(done: ^bool, _: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		if c1 != nil && c2 != nil && c3 != nil && c4 != nil && c5 != nil {
			p(&done, Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4), &c5.(C5))
			if done do break
		}
	}
}

@(private)
Work6 :: proc(
	world: ^World,
	p: proc(_: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5, _: ^$C6),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		if c1 != nil && c2 != nil && c3 != nil && c4 != nil && c5 != nil && c6 != nil {
			p(Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4), &c5.(C5), &c6.(C6))
		}
	}
}

@(private)
Work6Cancellable :: proc(
	world: ^World,
	p: proc(done: ^bool, _: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5, _: ^$C6),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		if c1 != nil && c2 != nil && c3 != nil && c4 != nil && c5 != nil && c6 != nil {
			p(&done, Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4), &c5.(C5), &c6.(C6))
			if done do break
		}
	}
}

@(private)
Work7 :: proc(
	world: ^World,
	p: proc(_: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5, _: ^$C6, _: ^$C7),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil {
			p(Entity(e), &c1.(C1), &c2.(C2), &c3.(C3), &c4.(C4), &c5.(C5), &c6.(C6), &c7.(C7))
		}
	}
}

@(private)
Work7Cancellable :: proc(
	world: ^World,
	p: proc(done: ^bool, _: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5, _: ^$C6, _: ^$C7),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil {
			p(
				&done,
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
			)
			if done do break
		}
	}
}

@(private)
Work8 :: proc(
	world: ^World,
	p: proc(_: Entity, _: ^$C1, _: ^$C2, _: ^$C3, _: ^$C4, _: ^$C5, _: ^$C6, _: ^$C7, _: ^$C8),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	cs8 := cast(^[dynamic]Container(C8))world.components[typeid_of(C8)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	if cs8 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		if auto_cast e >= len(cs8) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		c8 := cs8[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil &&
		   c8 != nil {
			p(
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
				&c8.(C8),
			)
		}
	}
}

@(private)
Work8Cancellable :: proc(
	world: ^World,
	p: proc(
		done: ^bool,
		_: Entity,
		_: ^$C1,
		_: ^$C2,
		_: ^$C3,
		_: ^$C4,
		_: ^$C5,
		_: ^$C6,
		_: ^$C7,
		_: ^$C8,
	),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	cs8 := cast(^[dynamic]Container(C8))world.components[typeid_of(C8)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	if cs8 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		if auto_cast e >= len(cs8) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		c8 := cs8[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil &&
		   c8 != nil {
			p(
				&done,
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
				&c8.(C8),
			)
			if done do break
		}
	}
}

@(private)
Work9 :: proc(
	world: ^World,
	p: proc(
		_: Entity,
		_: ^$C1,
		_: ^$C2,
		_: ^$C3,
		_: ^$C4,
		_: ^$C5,
		_: ^$C6,
		_: ^$C7,
		_: ^$C8,
		_: ^$C9,
	),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	cs8 := cast(^[dynamic]Container(C8))world.components[typeid_of(C8)]
	cs9 := cast(^[dynamic]Container(C9))world.components[typeid_of(C9)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	if cs8 == nil do return
	if cs9 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		if auto_cast e >= len(cs8) do break
		if auto_cast e >= len(cs9) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		c8 := cs8[e]
		c9 := cs9[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil &&
		   c8 != nil &&
		   c9 != nil {
			p(
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
				&c8.(C8),
				&c9.(C9),
			)
		}
	}
}

@(private)
Work9Cancellable :: proc(
	world: ^World,
	p: proc(
		done: ^bool,
		_: Entity,
		_: ^$C1,
		_: ^$C2,
		_: ^$C3,
		_: ^$C4,
		_: ^$C5,
		_: ^$C6,
		_: ^$C7,
		_: ^$C8,
		_: ^$C9,
	),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	cs8 := cast(^[dynamic]Container(C8))world.components[typeid_of(C8)]
	cs9 := cast(^[dynamic]Container(C9))world.components[typeid_of(C9)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	if cs8 == nil do return
	if cs9 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		if auto_cast e >= len(cs8) do break
		if auto_cast e >= len(cs9) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		c8 := cs8[e]
		c9 := cs9[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil &&
		   c8 != nil &&
		   c9 != nil {
			p(
				&done,
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
				&c8.(C8),
				&c9.(C9),
			)
			if done do break
		}
	}
}

@(private)
Work10 :: proc(
	world: ^World,
	p: proc(
		_: Entity,
		_: ^$C1,
		_: ^$C2,
		_: ^$C3,
		_: ^$C4,
		_: ^$C5,
		_: ^$C6,
		_: ^$C7,
		_: ^$C8,
		_: ^$C9,
		_: ^$C10,
	),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	cs8 := cast(^[dynamic]Container(C8))world.components[typeid_of(C8)]
	cs9 := cast(^[dynamic]Container(C9))world.components[typeid_of(C9)]
	cs10 := cast(^[dynamic]Container(C10))world.components[typeid_of(C10)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	if cs8 == nil do return
	if cs9 == nil do return
	if cs10 == nil do return
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		if auto_cast e >= len(cs8) do break
		if auto_cast e >= len(cs9) do break
		if auto_cast e >= len(cs10) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		c8 := cs8[e]
		c9 := cs9[e]
		c10 := cs10[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil &&
		   c8 != nil &&
		   c9 != nil &&
		   c10 != nil {
			p(
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
				&c8.(C8),
				&c9.(C9),
				&c10.(C10),
			)
		}
	}
}

@(private)
Work10Cancellable :: proc(
	world: ^World,
	p: proc(
		done: ^bool,
		_: Entity,
		_: ^$C1,
		_: ^$C2,
		_: ^$C3,
		_: ^$C4,
		_: ^$C5,
		_: ^$C6,
		_: ^$C7,
		_: ^$C8,
		_: ^$C9,
		_: ^$C10,
	),
) {
	cs1 := cast(^[dynamic]Container(C1))world.components[typeid_of(C1)]
	cs2 := cast(^[dynamic]Container(C2))world.components[typeid_of(C2)]
	cs3 := cast(^[dynamic]Container(C3))world.components[typeid_of(C3)]
	cs4 := cast(^[dynamic]Container(C4))world.components[typeid_of(C4)]
	cs5 := cast(^[dynamic]Container(C5))world.components[typeid_of(C5)]
	cs6 := cast(^[dynamic]Container(C6))world.components[typeid_of(C6)]
	cs7 := cast(^[dynamic]Container(C7))world.components[typeid_of(C7)]
	cs8 := cast(^[dynamic]Container(C8))world.components[typeid_of(C8)]
	cs9 := cast(^[dynamic]Container(C9))world.components[typeid_of(C9)]
	cs10 := cast(^[dynamic]Container(C10))world.components[typeid_of(C10)]
	if cs1 == nil do return
	if cs2 == nil do return
	if cs3 == nil do return
	if cs4 == nil do return
	if cs5 == nil do return
	if cs6 == nil do return
	if cs7 == nil do return
	if cs8 == nil do return
	if cs9 == nil do return
	if cs10 == nil do return
	done := false
	for c1, e in cs1 {
		if auto_cast e >= world.next_id do break
		if auto_cast e >= len(cs2) do break
		if auto_cast e >= len(cs3) do break
		if auto_cast e >= len(cs4) do break
		if auto_cast e >= len(cs5) do break
		if auto_cast e >= len(cs6) do break
		if auto_cast e >= len(cs7) do break
		if auto_cast e >= len(cs8) do break
		if auto_cast e >= len(cs9) do break
		if auto_cast e >= len(cs10) do break
		c2 := cs2[e]
		c3 := cs3[e]
		c4 := cs4[e]
		c5 := cs5[e]
		c6 := cs6[e]
		c7 := cs7[e]
		c8 := cs8[e]
		c9 := cs9[e]
		c10 := cs10[e]
		if c1 != nil &&
		   c2 != nil &&
		   c3 != nil &&
		   c4 != nil &&
		   c5 != nil &&
		   c6 != nil &&
		   c7 != nil &&
		   c8 != nil &&
		   c9 != nil &&
		   c10 != nil {
			p(
				&done,
				Entity(e),
				&c1.(C1),
				&c2.(C2),
				&c3.(C3),
				&c4.(C4),
				&c5.(C5),
				&c6.(C6),
				&c7.(C7),
				&c8.(C8),
				&c9.(C9),
				&c10.(C10),
			)
			if done do break
		}
	}
}


Work :: proc {
	Work1,
	Work1Cancellable,
	Work2,
	Work2Cancellable,
	Work3,
	Work3Cancellable,
	Work4,
	Work4Cancellable,
	Work5,
	Work5Cancellable,
	Work6,
	Work6Cancellable,
	Work7,
	Work7Cancellable,
	Work8,
	Work8Cancellable,
	Work9,
	Work9Cancellable,
	Work10,
	Work10Cancellable,
}