     _ (init-gc)
     _ (mark-stack)
 
-    _ (<-b (llvm/BuildRetVoid))]
+    [val blk] (add-block "loop"
+                         (gen-plan
+                          [val (alloc-amc ::cons_t)
+                           this-blk (get-block)
+                           _ (<-b (llvm/BuildBr this-blk))]
+                          nil))
+
+    _ (<-b (llvm/BuildBr blk))
+
+
+    #_ _ #_(<-b (llvm/BuildRetVoid))]
    nil))
 
 (defn do-it2 []

   [casted (<-b (llvm/BuildBitCast x (llvm/PointerType size-t 0) "casted"))
    val (<-b (llvm/BuildLoad casted "loaded"))]
   val))


(defllvmstruct mps_ss_t [size-t _zs

    _ (<-b (llvm/BuildCondBr small? small not-small))]
   nil))

(defn alloc-amc [type-sym]
  (gen-plan
   [klass (llvm-type-by-sym type-sym)
    type-id (type-id-by-sym type-sym)
    size (<- (llvm/SizeOf klass))
    size (ALIGN-VAL size)
    data (<-b (llvm/BuildAlloca i8* "alloced"))

    f (fn-by-sym :cm_pool_amc_reserve)

    continue-blk (add-block "continue")



    [val retry-blk] (add-block "retry"
                               (gen-plan
                      [this-blk (get-block)
                       _ (<-b (llvm/BuildCall f
                                              (into-array Pointer [data size])
                                              2
                                              "reserve"))

                       *data (<-b (llvm/BuildLoad data "*data"))
                       _ (TYPEID= *data (const-size-t type-id))

                       f (fn-by-sym :cm_pool_amc_commit)

                       result (<-b (llvm/BuildCall f
                                                  (into-array Pointer [data size])
                                                  2
                                                  "commit"))
                       retry? (<-b (llvm/BuildICmp llvm/LLVMIntEQ result (const-size-t 0) "retry?"))
                       _ (<-b (llvm/BuildCondBr retry? this-blk continue-blk))]
                      nil #_*data))

   _ (<-b (llvm/BuildBr retry-blk))

    _ (set-block continue-blk)
    ]
   val))

(defn add-externals []
  (gen-plan
