;;-*-Lisp-*-
(in-package goal)

;; definition for symbol *ocean-texture-work*, type ocean-texture-work
(define *ocean-texture-work* (new 'static 'ocean-texture-work
                               :sprite-tmpl (new 'static 'dma-gif-packet
                                 :dma-vif (new 'static 'dma-packet
                                   :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
                                   :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
                                   )
                                 :gif (new 'static 'array uint64 2 #x508b400000008001 #x53531)
                                 )
                               :sprite-tmpl2 (new 'static 'dma-gif-packet
                                 :dma-vif (new 'static 'dma-packet
                                   :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt))
                                   :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1)
                                   )
                                 :gif (new 'static 'array uint64 2 #x3023400000008001 #x551)
                                 )
                               :adgif-tmpl (new 'static 'dma-gif-packet
                                 :dma-vif (new 'static 'dma-packet
                                   :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
                                   :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
                                   )
                                 :gif (new 'static 'array uint64 2 #x1000000000008005 #xe)
                                 )
                               )
        )

;; definition for symbol ocean-texture-vu1-block, type vu-function
(define ocean-texture-vu1-block (new 'static 'vu-function :length #x92 :qlength 73))

;; definition for function ocean-texture-setup-constants
;; INFO: Return type mismatch int vs none.
(defun ocean-texture-setup-constants ((arg0 ocean-texture-constants))
  (set! (-> arg0 giftag tag)
        (new 'static 'gif-tag64
          :nloop #x42
          :eop #x1
          :pre #x1
          :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1)
          :nreg #x3
          )
        )
  (set! (-> arg0 giftag regs)
        (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyz2))
        )
  (set-vector! (-> arg0 buffers) 384 583 384 583)
  (set-vector! (-> arg0 dests) 782 881 782 881)
  (set-vector! (-> arg0 start) 0.0 0.0 1048575.94 0.0)
  (set-vector! (-> arg0 offsets) 4.0 8.0 12.0 16.0)
  (set-vector! (-> arg0 constants) 0.5 0.5 0.0 0.0)
  (set! (-> arg0 cam-nrm x) (- (-> *math-camera* inv-camera-rot vector 2 x)))
  (set! (-> arg0 cam-nrm y) (- (-> *math-camera* inv-camera-rot vector 2 y)))
  (set! (-> arg0 cam-nrm z) (- (-> *math-camera* inv-camera-rot vector 2 z)))
  (set! (-> arg0 cam-nrm w) 0.0)
  0
  (none)
  )

;; definition for function ocean-texture-add-constants
(defun ocean-texture-add-constants ((arg0 dma-buffer))
  (let* ((a1-0 7)
         (v1-0 arg0)
         (a0-1 (the-as object (-> v1-0 base)))
         )
    (set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-0))
    (set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
    (set! (-> (the-as dma-packet a0-1) vif1)
          (new 'static 'vif-tag :imm #x3d9 :cmd (vif-cmd unpack-v4-32) :num a1-0)
          )
    (set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
    )
  (ocean-texture-setup-constants (the-as ocean-texture-constants (-> arg0 base)))
  (let ((v0-1 (&+ (-> arg0 base) 112)))
    (set! (-> arg0 base) v0-1)
    v0-1
    )
  )

;; definition for function ocean-texture-add-envmap
;; Used lq/sq
(defun ocean-texture-add-envmap ((arg0 dma-buffer))
  (let ((v1-0 (-> arg0 base)))
    (set! (-> (the-as (pointer uint128) v1-0) 0) (-> *ocean-texture-work* adgif-tmpl dma-vif quad))
    (set! (-> (the-as (pointer uint128) v1-0) 1) (-> *ocean-texture-work* adgif-tmpl quad 1))
    (let ((s4-0 (&+ v1-0 32)))
      (adgif-shader<-texture-simple!
        (the-as adgif-shader s4-0)
        (lookup-texture-by-id (new 'static 'texture-id :index #x1 :page #x100))
        )
      )
    )
  (let ((v0-2 (&+ (-> arg0 base) 112)))
    (set! (-> arg0 base) v0-2)
    v0-2
    )
  )

;; definition for function ocean-texture-add-verts
(defun ocean-texture-add-verts ((arg0 dma-buffer) (arg1 (inline-array vector)))
  (let* ((v1-0 arg0)
         (a0-1 (the-as object (-> v1-0 base)))
         )
    (set! (-> (the-as dma-packet a0-1) dma)
          (new 'static 'dma-tag :qwc #xc0 :id (dma-tag-id ref) :addr (the-as int arg1))
          )
    (set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
    (set! (-> (the-as dma-packet a0-1) vif1)
          (new 'static 'vif-tag :imm #x8000 :num #xc0 :cmd (vif-cmd unpack-v4-32))
          )
    (let ((v0-0 (&+ (the-as pointer a0-1) 16)))
      (set! (-> v1-0 base) v0-0)
      v0-0
      )
    )
  )

;; definition for function ocean-texture-add-verts-last
(defun ocean-texture-add-verts-last ((arg0 dma-buffer) (arg1 (inline-array vector)) (arg2 (inline-array vector)))
  (let* ((v1-0 arg0)
         (a3-0 (the-as object (-> v1-0 base)))
         )
    (set! (-> (the-as dma-packet a3-0) dma)
          (new 'static 'dma-tag :qwc #x80 :id (dma-tag-id ref) :addr (the-as int arg1))
          )
    (set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
    (set! (-> (the-as dma-packet a3-0) vif1)
          (new 'static 'vif-tag :imm #x8000 :num #x80 :cmd (vif-cmd unpack-v4-32))
          )
    (set! (-> v1-0 base) (&+ (the-as pointer a3-0) 16))
    )
  (let* ((v1-1 arg0)
         (a0-1 (the-as object (-> v1-1 base)))
         )
    (set! (-> (the-as dma-packet a0-1) dma)
          (new 'static 'dma-tag :qwc #x40 :id (dma-tag-id ref) :addr (the-as int arg2))
          )
    (set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
    (set! (-> (the-as dma-packet a0-1) vif1)
          (new 'static 'vif-tag :imm #x8080 :num #x40 :cmd (vif-cmd unpack-v4-32))
          )
    (let ((v0-0 (&+ (the-as pointer a0-1) 16)))
      (set! (-> v1-1 base) v0-0)
      v0-0
      )
    )
  )

;; definition for function ocean-texture-add-call-start
;; INFO: Return type mismatch pointer vs none.
(defun ocean-texture-add-call-start ((arg0 dma-buffer))
  (let* ((v1-0 arg0)
         (a0-1 (the-as object (-> v1-0 base)))
         )
    (set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
    (set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1))
    (set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
    (set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
    )
  (none)
  )

;; definition for function ocean-texture-add-call-rest
;; INFO: Return type mismatch pointer vs none.
(defun ocean-texture-add-call-rest ((arg0 dma-buffer))
  (let* ((v1-0 arg0)
         (a0-1 (the-as object (-> v1-0 base)))
         )
    (set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
    (set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd mscalf) :msk #x1))
    (set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
    (set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
    )
  (none)
  )

;; definition for function ocean-texture-add-call-done
;; INFO: Return type mismatch pointer vs none.
(defun ocean-texture-add-call-done ((arg0 dma-buffer))
  (let* ((v1-0 arg0)
         (a0-1 (the-as object (-> v1-0 base)))
         )
    (set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
    (set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd mscalf) :msk #x1))
    (set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
    (set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
    )
  (none)
  )

;; definition for function draw-ocean-texture
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defun draw-ocean-texture ((arg0 dma-buffer) (arg1 (inline-array vector)) (arg2 symbol))
  (local-vars (sv-16 (inline-array vector)) (sv-32 int) (sv-48 vector) (sv-64 (inline-array vector)))
  (set! sv-64 arg1)
  (let* ((s0-0 arg2)
         (a1-1 *ocean-base-page*)
         (s2-0 *ocean-base-block*)
         (s1-0 (+ a1-1 8))
         (s4-0 (* s1-0 32))
         (s3-0 (+ a1-1 10))
         (s5-0 (* s3-0 32))
         )
    (set-display-gs-state arg0 a1-1 128 128 0 0)
    (dma-buffer-add-vu-function arg0 ocean-texture-vu1-block 1)
    (let* ((v1-0 arg0)
           (a0-3 (the-as object (-> v1-0 base)))
           )
      (set! (-> (the-as dma-packet a0-3) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
      (set! (-> (the-as dma-packet a0-3) vif0) (new 'static 'vif-tag :cmd (vif-cmd base)))
      (set! (-> (the-as dma-packet a0-3) vif1) (new 'static 'vif-tag :imm #xc0 :cmd (vif-cmd offset)))
      (set! (-> v1-0 base) (&+ (the-as pointer a0-3) 16))
      )
    (ocean-texture-add-constants arg0)
    (ocean-texture-add-envmap arg0)
    (set! sv-16 sv-64)
    (ocean-texture-add-verts arg0 sv-16)
    (set! sv-48 (-> sv-16 192))
    (ocean-texture-add-call-start arg0)
    (set! sv-32 0)
    (while (< sv-32 9)
      (ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48))
      (set! sv-48 (-> (the-as (inline-array vector) sv-48) 192))
      (ocean-texture-add-call-rest arg0)
      (set! sv-32 (+ sv-32 1))
      )
    (ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64)
    (ocean-texture-add-call-rest arg0)
    (ocean-texture-add-call-done arg0)
    (when s0-0
      (set-display-gs-state arg0 s1-0 64 64 0 0)
      (let* ((v1-13 arg0)
             (a0-15 (the-as object (-> v1-13 base)))
             )
        (set! (-> (the-as dma-packet a0-15) dma) (new 'static 'dma-tag :qwc #x7 :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-15) vif0) (new 'static 'vif-tag))
        (set! (-> (the-as dma-packet a0-15) vif1) (new 'static 'vif-tag :imm #x7 :cmd (vif-cmd direct) :msk #x1))
        (set! (-> v1-13 base) (&+ (the-as pointer a0-15) 16))
        )
      (let* ((v1-14 arg0)
             (a0-17 (the-as object (-> v1-14 base)))
             )
        (set! (-> (the-as gs-gif-tag a0-17) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x6))
        (set! (-> (the-as gs-gif-tag a0-17) regs)
              (new 'static 'gif-tag-regs
                :regs0 (gif-reg-id a+d)
                :regs1 (gif-reg-id a+d)
                :regs2 (gif-reg-id a+d)
                :regs3 (gif-reg-id a+d)
                :regs4 (gif-reg-id a+d)
                :regs5 (gif-reg-id a+d)
                :regs6 (gif-reg-id a+d)
                :regs7 (gif-reg-id a+d)
                :regs8 (gif-reg-id a+d)
                :regs9 (gif-reg-id a+d)
                :regs10 (gif-reg-id a+d)
                :regs11 (gif-reg-id a+d)
                :regs12 (gif-reg-id a+d)
                :regs13 (gif-reg-id a+d)
                :regs14 (gif-reg-id a+d)
                :regs15 (gif-reg-id a+d)
                )
              )
        (set! (-> v1-14 base) (&+ (the-as pointer a0-17) 16))
        )
      (let* ((s1-1 arg0)
             (s0-1 (-> s1-1 base))
             )
        (set! (-> (the-as (pointer gs-test) s0-1) 0)
              (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))
              )
        (set! (-> (the-as (pointer gs-reg64) s0-1) 1) (gs-reg64 test-1))
        (set! (-> (the-as (pointer gs-alpha) s0-1) 2) (new 'static 'gs-alpha :b #x1 :d #x1))
        (set! (-> (the-as (pointer gs-reg64) s0-1) 3) (gs-reg64 alpha-1))
        (set! (-> (the-as (pointer gs-tex0) s0-1) 4)
              (new 'static 'gs-tex0 :tbw #x2 :tcc #x1 :th (log2 128) :tw (log2 128) :tbp0 s2-0)
              )
        (set! (-> (the-as (pointer gs-reg64) s0-1) 5) (gs-reg64 tex0-1))
        (set! (-> (the-as (pointer gs-tex1) s0-1) 6) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1))
        (set! (-> (the-as (pointer gs-reg64) s0-1) 7) (gs-reg64 tex1-1))
        (set! (-> (the-as (pointer gs-clamp) s0-1) 8) (new 'static 'gs-clamp))
        (set! (-> (the-as (pointer gs-reg64) s0-1) 9) (gs-reg64 clamp-1))
        (set! (-> (the-as (pointer uint64) s0-1) 10) (the-as uint 0))
        (set! (-> (the-as (pointer gs-reg64) s0-1) 11) (gs-reg64 texflush))
        (set! (-> s1-1 base) (&+ s0-1 96))
        )
      (let ((v1-31 (-> arg0 base)))
        (set! (-> (the-as (pointer uint128) v1-31) 0) (-> *ocean-texture-work* sprite-tmpl dma-vif quad))
        (set! (-> (the-as (pointer uint128) v1-31) 1) (-> *ocean-texture-work* sprite-tmpl quad 1))
        (set-vector! (the-as vector4w (&+ v1-31 32)) 128 128 128 64)
        (set-vector! (the-as vector4w (&+ v1-31 48)) 0 0 0 0)
        (set-vector! (the-as vector4w (&+ v1-31 64)) 0 0 #xffffff 0)
        (set-vector! (the-as vector4w (&+ v1-31 80)) 2048 2048 0 0)
        (set-vector! (the-as vector4w (&+ v1-31 96)) 1024 1024 #xffffff 0)
        )
      (&+! (-> arg0 base) 112)
      (set-display-gs-state arg0 s3-0 64 32 0 0)
      (let* ((v1-35 arg0)
             (a0-35 (the-as object (-> v1-35 base)))
             )
        (set! (-> (the-as dma-packet a0-35) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-35) vif0) (new 'static 'vif-tag))
        (set! (-> (the-as dma-packet a0-35) vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1))
        (set! (-> v1-35 base) (&+ (the-as pointer a0-35) 16))
        )
      (let* ((v1-36 arg0)
             (a0-37 (the-as object (-> v1-36 base)))
             )
        (set! (-> (the-as gs-gif-tag a0-37) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2))
        (set! (-> (the-as gs-gif-tag a0-37) regs)
              (new 'static 'gif-tag-regs
                :regs0 (gif-reg-id a+d)
                :regs1 (gif-reg-id a+d)
                :regs2 (gif-reg-id a+d)
                :regs3 (gif-reg-id a+d)
                :regs4 (gif-reg-id a+d)
                :regs5 (gif-reg-id a+d)
                :regs6 (gif-reg-id a+d)
                :regs7 (gif-reg-id a+d)
                :regs8 (gif-reg-id a+d)
                :regs9 (gif-reg-id a+d)
                :regs10 (gif-reg-id a+d)
                :regs11 (gif-reg-id a+d)
                :regs12 (gif-reg-id a+d)
                :regs13 (gif-reg-id a+d)
                :regs14 (gif-reg-id a+d)
                :regs15 (gif-reg-id a+d)
                )
              )
        (set! (-> v1-36 base) (&+ (the-as pointer a0-37) 16))
        )
      (let* ((s3-1 arg0)
             (s2-3 (-> s3-1 base))
             )
        (set! (-> (the-as (pointer gs-tex0) s2-3) 0)
              (new 'static 'gs-tex0 :tbw #x1 :tcc #x1 :th (log2 64) :tw (log2 64) :tbp0 s4-0)
              )
        (set! (-> (the-as (pointer gs-reg64) s2-3) 1) (gs-reg64 tex0-1))
        (set! (-> (the-as (pointer uint64) s2-3) 2) (the-as uint 0))
        (set! (-> (the-as (pointer gs-reg64) s2-3) 3) (gs-reg64 texflush))
        (set! (-> s3-1 base) (&+ s2-3 32))
        )
      (let ((v1-46 (-> arg0 base)))
        (set! (-> (the-as (pointer uint128) v1-46)) (-> *ocean-texture-work* sprite-tmpl dma-vif quad))
        (set! (-> (the-as (pointer uint128) v1-46) 1) (-> *ocean-texture-work* sprite-tmpl quad 1))
        (set-vector! (the-as vector4w (&+ v1-46 32)) 128 128 128 0)
        (set-vector! (the-as vector4w (&+ v1-46 48)) 0 0 0 0)
        (set-vector! (the-as vector4w (&+ v1-46 64)) 0 0 #xffffff 0)
        (set-vector! (the-as vector4w (&+ v1-46 80)) 1024 1024 0 0)
        (set-vector! (the-as vector4w (&+ v1-46 96)) 512 512 #xffffff 0)
        )
      (&+! (-> arg0 base) 112)
      (let* ((v1-50 arg0)
             (a0-54 (the-as object (-> v1-50 base)))
             )
        (set! (-> (the-as dma-packet a0-54) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-54) vif0) (new 'static 'vif-tag))
        (set! (-> (the-as dma-packet a0-54) vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1))
        (set! (-> v1-50 base) (&+ (the-as pointer a0-54) 16))
        )
      (let* ((v1-51 arg0)
             (a0-56 (the-as object (-> v1-51 base)))
             )
        (set! (-> (the-as gs-gif-tag a0-56) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2))
        (set! (-> (the-as gs-gif-tag a0-56) regs)
              (new 'static 'gif-tag-regs
                :regs0 (gif-reg-id a+d)
                :regs1 (gif-reg-id a+d)
                :regs2 (gif-reg-id a+d)
                :regs3 (gif-reg-id a+d)
                :regs4 (gif-reg-id a+d)
                :regs5 (gif-reg-id a+d)
                :regs6 (gif-reg-id a+d)
                :regs7 (gif-reg-id a+d)
                :regs8 (gif-reg-id a+d)
                :regs9 (gif-reg-id a+d)
                :regs10 (gif-reg-id a+d)
                :regs11 (gif-reg-id a+d)
                :regs12 (gif-reg-id a+d)
                :regs13 (gif-reg-id a+d)
                :regs14 (gif-reg-id a+d)
                :regs15 (gif-reg-id a+d)
                )
              )
        (set! (-> v1-51 base) (&+ (the-as pointer a0-56) 16))
        )
      (let* ((s4-3 arg0)
             (s3-2 (-> s4-3 base))
             )
        (set! (-> (the-as (pointer gs-tex0) s3-2) 0)
              (new 'static 'gs-tex0 :tbw #x1 :tcc #x1 :th (log2 32) :tw (log2 32) :tbp0 s5-0)
              )
        (set! (-> (the-as (pointer gs-reg64) s3-2) 1) (gs-reg64 tex0-1))
        (set! (-> (the-as (pointer uint64) s3-2) 2) (the-as uint 0))
        (set! (-> (the-as (pointer gs-reg64) s3-2) 3) (gs-reg64 texflush))
        (set! (-> s4-3 base) (&+ s3-2 32))
        )
      (let ((v1-61 (-> arg0 base)))
        (set! (-> (the-as (pointer uint128) v1-61)) (-> *ocean-texture-work* sprite-tmpl dma-vif quad))
        (set! (-> (the-as (pointer uint128) v1-61) 1) (-> *ocean-texture-work* sprite-tmpl quad 1))
        (set-vector! (the-as vector4w (&+ v1-61 32)) 128 128 128 0)
        (set-vector! (the-as vector4w (&+ v1-61 48)) 0 0 0 0)
        (set-vector! (the-as vector4w (&+ v1-61 64)) 512 0 #xffffff 0)
        (set-vector! (the-as vector4w (&+ v1-61 80)) 512 512 0 0)
        (set-vector! (the-as vector4w (&+ v1-61 96)) 768 256 #xffffff 0)
        )
      (&+! (-> arg0 base) 112)
      (let* ((v1-65 arg0)
             (a0-73 (the-as object (-> v1-65 base)))
             )
        (set! (-> (the-as dma-packet a0-73) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-73) vif0) (new 'static 'vif-tag))
        (set! (-> (the-as dma-packet a0-73) vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1))
        (set! (-> v1-65 base) (&+ (the-as pointer a0-73) 16))
        )
      (let* ((v1-66 arg0)
             (a0-75 (the-as object (-> v1-66 base)))
             )
        (set! (-> (the-as gs-gif-tag a0-75) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2))
        (set! (-> (the-as gs-gif-tag a0-75) regs)
              (new 'static 'gif-tag-regs
                :regs0 (gif-reg-id a+d)
                :regs1 (gif-reg-id a+d)
                :regs2 (gif-reg-id a+d)
                :regs3 (gif-reg-id a+d)
                :regs4 (gif-reg-id a+d)
                :regs5 (gif-reg-id a+d)
                :regs6 (gif-reg-id a+d)
                :regs7 (gif-reg-id a+d)
                :regs8 (gif-reg-id a+d)
                :regs9 (gif-reg-id a+d)
                :regs10 (gif-reg-id a+d)
                :regs11 (gif-reg-id a+d)
                :regs12 (gif-reg-id a+d)
                :regs13 (gif-reg-id a+d)
                :regs14 (gif-reg-id a+d)
                :regs15 (gif-reg-id a+d)
                )
              )
        (set! (-> v1-66 base) (&+ (the-as pointer a0-75) 16))
        )
      (let* ((s4-4 arg0)
             (s3-3 (-> s4-4 base))
             )
        (set! (-> (the-as (pointer gs-tex0) s3-3) 0)
              (new 'static 'gs-tex0 :tbw #x1 :tcc #x1 :th (log2 16) :tw (log2 16) :tbp0 (+ s5-0 16))
              )
        (set! (-> (the-as (pointer gs-reg64) s3-3) 1) (gs-reg64 tex0-1))
        (set! (-> (the-as (pointer uint64) s3-3) 2) (the-as uint 0))
        (set! (-> (the-as (pointer gs-reg64) s3-3) 3) (gs-reg64 texflush))
        (set! (-> s4-4 base) (&+ s3-3 32))
        )
      (let ((v1-76 (-> arg0 base)))
        (set! (-> (the-as (pointer uint128) v1-76)) (-> *ocean-texture-work* sprite-tmpl dma-vif quad))
        (set! (-> (the-as (pointer uint128) v1-76) 1) (-> *ocean-texture-work* sprite-tmpl quad 1))
        (set-vector! (the-as vector4w (&+ v1-76 32)) 128 128 128 0)
        (set-vector! (the-as vector4w (&+ v1-76 48)) 0 0 0 0)
        (set-vector! (the-as vector4w (&+ v1-76 64)) 768 0 #xffffff 0)
        (set-vector! (the-as vector4w (&+ v1-76 80)) 256 256 0 0)
        (set-vector! (the-as vector4w (&+ v1-76 96)) 896 128 #xffffff 0)
        )
      (&+! (-> arg0 base) 112)
      (let* ((v1-80 arg0)
             (a0-93 (the-as object (-> v1-80 base)))
             )
        (set! (-> (the-as dma-packet a0-93) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-93) vif0) (new 'static 'vif-tag))
        (set! (-> (the-as dma-packet a0-93) vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1))
        (set! (-> v1-80 base) (&+ (the-as pointer a0-93) 16))
        )
      (let* ((v1-81 arg0)
             (a0-95 (the-as object (-> v1-81 base)))
             )
        (set! (-> (the-as gs-gif-tag a0-95) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2))
        (set! (-> (the-as gs-gif-tag a0-95) regs)
              (new 'static 'gif-tag-regs
                :regs0 (gif-reg-id a+d)
                :regs1 (gif-reg-id a+d)
                :regs2 (gif-reg-id a+d)
                :regs3 (gif-reg-id a+d)
                :regs4 (gif-reg-id a+d)
                :regs5 (gif-reg-id a+d)
                :regs6 (gif-reg-id a+d)
                :regs7 (gif-reg-id a+d)
                :regs8 (gif-reg-id a+d)
                :regs9 (gif-reg-id a+d)
                :regs10 (gif-reg-id a+d)
                :regs11 (gif-reg-id a+d)
                :regs12 (gif-reg-id a+d)
                :regs13 (gif-reg-id a+d)
                :regs14 (gif-reg-id a+d)
                :regs15 (gif-reg-id a+d)
                )
              )
        (set! (-> v1-81 base) (&+ (the-as pointer a0-95) 16))
        )
      (let* ((s4-5 arg0)
             (s3-4 (-> s4-5 base))
             )
        (set! (-> (the-as (pointer gs-tex0) s3-4) 0)
              (new 'static 'gs-tex0 :tbw #x1 :tcc #x1 :th (log2 8) :tw (log2 8) :tbp0 (+ s5-0 20))
              )
        (set! (-> (the-as (pointer gs-reg64) s3-4) 1) (gs-reg64 tex0-1))
        (set! (-> (the-as (pointer uint64) s3-4) 2) (the-as uint 0))
        (set! (-> (the-as (pointer gs-reg64) s3-4) 3) (gs-reg64 texflush))
        (set! (-> s4-5 base) (&+ s3-4 32))
        )
      (let ((v1-91 (-> arg0 base)))
        (set! (-> (the-as (pointer uint128) v1-91)) (-> *ocean-texture-work* sprite-tmpl dma-vif quad))
        (set! (-> (the-as (pointer uint128) v1-91) 1) (-> *ocean-texture-work* sprite-tmpl quad 1))
        (set-vector! (the-as vector4w (&+ v1-91 32)) 128 128 128 0)
        (set-vector! (the-as vector4w (&+ v1-91 48)) 0 0 0 0)
        (set-vector! (the-as vector4w (&+ v1-91 64)) 896 0 #xffffff 0)
        (set-vector! (the-as vector4w (&+ v1-91 80)) 256 256 0 0)
        (set-vector! (the-as vector4w (&+ v1-91 96)) 1024 128 #xffffff 0)
        )
      (&+! (-> arg0 base) 112)
      (let* ((v1-95 arg0)
             (a0-113 (the-as object (-> v1-95 base)))
             )
        (set! (-> (the-as dma-packet a0-113) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-113) vif0) (new 'static 'vif-tag))
        (set! (-> (the-as dma-packet a0-113) vif1) (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1))
        (set! (-> v1-95 base) (&+ (the-as pointer a0-113) 16))
        )
      (let* ((v1-96 arg0)
             (a0-115 (the-as object (-> v1-96 base)))
             )
        (set! (-> (the-as gs-gif-tag a0-115) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2))
        (set! (-> (the-as gs-gif-tag a0-115) regs)
              (new 'static 'gif-tag-regs
                :regs0 (gif-reg-id a+d)
                :regs1 (gif-reg-id a+d)
                :regs2 (gif-reg-id a+d)
                :regs3 (gif-reg-id a+d)
                :regs4 (gif-reg-id a+d)
                :regs5 (gif-reg-id a+d)
                :regs6 (gif-reg-id a+d)
                :regs7 (gif-reg-id a+d)
                :regs8 (gif-reg-id a+d)
                :regs9 (gif-reg-id a+d)
                :regs10 (gif-reg-id a+d)
                :regs11 (gif-reg-id a+d)
                :regs12 (gif-reg-id a+d)
                :regs13 (gif-reg-id a+d)
                :regs14 (gif-reg-id a+d)
                :regs15 (gif-reg-id a+d)
                )
              )
        (set! (-> v1-96 base) (&+ (the-as pointer a0-115) 16))
        )
      (let* ((s4-6 arg0)
             (s3-5 (-> s4-6 base))
             )
        (set! (-> (the-as (pointer gs-tex0) s3-5) 0)
              (new 'static 'gs-tex0 :tbw #x1 :tcc #x1 :th (log2 4) :tw (log2 4) :tbp0 (+ s5-0 21))
              )
        (set! (-> (the-as (pointer gs-reg64) s3-5) 1) (gs-reg64 tex0-1))
        (set! (-> (the-as (pointer uint64) s3-5) 2) (the-as uint 0))
        (set! (-> (the-as (pointer gs-reg64) s3-5) 3) (gs-reg64 texflush))
        (set! (-> s4-6 base) (&+ s3-5 32))
        )
      (let ((v1-106 (-> arg0 base)))
        (set! (-> (the-as (pointer uint128) v1-106)) (-> *ocean-texture-work* sprite-tmpl dma-vif quad))
        (set! (-> (the-as (pointer uint128) v1-106) 1) (-> *ocean-texture-work* sprite-tmpl quad 1))
        (set-vector! (the-as vector4w (&+ v1-106 32)) 128 128 128 0)
        (set-vector! (the-as vector4w (&+ v1-106 48)) 0 0 0 0)
        (set-vector! (the-as vector4w (&+ v1-106 64)) 768 128 #xffffff 0)
        (set-vector! (the-as vector4w (&+ v1-106 80)) 512 512 0 0)
        (set-vector! (the-as vector4w (&+ v1-106 96)) 896 256 #xffffff 0)
        )
      (&+! (-> arg0 base) 112)
      (let* ((v1-110 arg0)
             (a0-133 (the-as object (-> v1-110 base)))
             )
        (set! (-> (the-as dma-packet a0-133) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
        (set! (-> (the-as dma-packet a0-133) vif0) (new 'static 'vif-tag :cmd (vif-cmd flush) :msk #x1))
        (set! (-> (the-as dma-packet a0-133) vif1) (new 'static 'vif-tag))
        (set! (-> v1-110 base) (&+ (the-as pointer a0-133) 16))
        )
      )
    )
  (reset-display-gs-state *display* arg0 *oddeven*)
  0
  (none)
  )
