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

;; name: eye.gc
;; name in dgo: eye
;; dgos: ENGINE, GAME

;; DECOMP BEGINS

(define *eye-work* (new 'static 'eye-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)
                         )
                       :gif0 (new 'static 'gif-tag64
                         :nloop #x1
                         :eop #x1
                         :pre #x1
                         :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :fst #x1)
                         :nreg #x5
                         )
                       :gif1 (new 'static 'gif-tag-regs
                         :regs0 (gif-reg-id rgbaq)
                         :regs1 (gif-reg-id uv)
                         :regs2 (gif-reg-id xyz2)
                         :regs3 (gif-reg-id uv)
                         :regs4 (gif-reg-id xyz2)
                         )
                       )
                     :sprite-tmpl2 (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)
                         )
                       :gif0 (new 'static 'gif-tag64
                         :nloop #x1
                         :eop #x1
                         :pre #x1
                         :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :abe #x1 :fst #x1)
                         :nreg #x5
                         )
                       :gif1 (new 'static 'gif-tag-regs
                         :regs0 (gif-reg-id rgbaq)
                         :regs1 (gif-reg-id uv)
                         :regs2 (gif-reg-id xyz2)
                         :regs3 (gif-reg-id uv)
                         :regs4 (gif-reg-id xyz2)
                         )
                       )
                     :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)
                         )
                       :gif0 (new 'static 'gif-tag64 :nloop #x5 :eop #x1 :nreg #x1)
                       :gif1 (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))
                       )
                     :blink-table (new 'static 'array float 10 0.0 0.667 0.9 1.0 1.0 1.0 1.0 0.333 0.1 0.0)
                     )
        )

(defun render-eyes-32 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int))
  (local-vars (sv-16 float))
  (let ((s4-0 32)
        (s3-0 (+ (* arg2 32) 32))
        (s2-0 (* arg2 32))
        )
    (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x)))))
          (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y)))))
          (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x)))))
          )
      (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y)))))
      (let ((s1-0 (-> arg1 shaders 0)))
        (let ((v1-14 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-14) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-0 (the-as adgif-shader (&+ (the-as pointer v1-14) 32))))
            (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5)
            (set! (-> s0-0 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                  )
            (set! (-> s0-0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-0 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)))
        (let ((v1-23 (the-as object (-> arg0 base))))
          (set! (-> (the-as (inline-array vector4w) v1-23) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) v1-23) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 2) 128 128 128 128)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 4) (* s4-0 16) (* s3-0 16) #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 5) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 6) (* (+ s4-0 64) 16) (* (+ s3-0 32) 16) #xffffff 0)
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-28 (ash 16 (-> s1-0 tex0 tw)))
              (a0-30 (ash 16 (-> s1-0 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0)))
          (let* ((f0-6 (* 256.0 (-> arg1 left iris-scale)))
                 (a1-26 (the-as object (-> arg0 base)))
                 (a2-13 (the int (- f28-0 f0-6)))
                 (t0-5 (the int (- f26-0 f0-6)))
                 (a3-9 (the int (+ f28-0 f0-6)))
                 (t1-0 (the int (+ f26-0 f0-6)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-26) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-26) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 4) a2-13 t0-5 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 5) v1-28 a0-30 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 6) a3-9 t1-0 #xffffff 0)
            )
          (&+! (-> arg0 base) 112)
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))
                                 )
          (let* ((f0-10 (* 256.0 (-> arg1 right iris-scale)))
                 (a1-34 (the-as object (-> arg0 base)))
                 (a2-23 (the int (- f30-0 f0-10)))
                 (t0-11 (the int (- sv-16 f0-10)))
                 (a3-20 (the int (+ f30-0 f0-10)))
                 (t1-2 (the int (+ sv-16 f0-10)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-34) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-34) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 4) a2-23 t0-11 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 5) v1-28 a0-30 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 6) a3-20 t1-2 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (dma-buffer-add-gs-set arg0
                             (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
                             )
      (let ((s1-1 (-> arg1 shaders 1)))
        (let ((v1-36 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-36) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-36) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-1 (the-as adgif-shader (&+ (the-as pointer v1-36) 32))))
            (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5)
            (set! (-> s0-1 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                  )
            (set! (-> s0-1 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-1 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-43 (ash 16 (-> s1-1 tex0 tw)))
              (a0-48 (ash 16 (-> s1-1 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0)))
          (let* ((f0-14 (* 256.0 (-> arg1 left pupil-scale)))
                 (a1-51 (the-as object (-> arg0 base)))
                 (a2-33 (the int (- f28-0 f0-14)))
                 (t0-17 (the int (- f26-0 f0-14)))
                 (a3-30 (the int (+ f28-0 f0-14)))
                 (t1-3 (the int (+ f26-0 f0-14)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-51) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-51) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 4) a2-33 t0-17 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 5) v1-43 a0-48 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 6) a3-30 t1-3 #xffffff 0)
            )
          (&+! (-> arg0 base) 112)
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))
                                 )
          (let* ((f0-18 (* 256.0 (-> arg1 right pupil-scale)))
                 (a1-59 (the-as object (-> arg0 base)))
                 (a2-43 (the int (- f30-0 f0-18)))
                 (t0-23 (the int (- sv-16 f0-18)))
                 (a3-41 (the int (+ f30-0 f0-18)))
                 (t1-5 (the int (+ sv-16 f0-18)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-59) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-59) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 4) a2-43 t0-23 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 5) v1-43 a0-48 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 6) a3-41 t1-5 #xffffff 0)
            )
          )
        )
      )
    (&+! (-> arg0 base) 112)
    (dma-buffer-add-gs-set arg0
                           (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
                           )
    (let ((s1-2 (-> arg1 shaders 2)))
      (let ((v1-51 (the-as object (-> arg0 base))))
        (set! (-> (the-as dma-gif-packet v1-51) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
        (set! (-> (the-as dma-gif-packet v1-51) quad 1) (-> *eye-work* adgif-tmpl quad 1))
        (let ((s0-2 (the-as object (&+ (the-as pointer v1-51) 32))))
          (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5)
          (set! (-> (the-as adgif-shader s0-2) clamp)
                (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                )
          (set! (-> (the-as adgif-shader s0-2) alpha) (new 'static 'gs-alpha :a #x1))
          (set! (-> (the-as adgif-shader s0-2) prims 9) (gs-reg64 alpha-1))
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((v1-58 (ash 16 (-> s1-2 tex0 tw)))
            (a0-66 (ash 16 (-> s1-2 tex0 th)))
            )
        (when (< (-> arg1 left lid) 0.0)
          (let ((f0-23 (+ 1.0 (-> arg1 left lid))))
            (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0)))
        (let* ((f0-27 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 left lid))))
               (a1-81 (the-as object (-> arg0 base)))
               (a2-53 (* s4-0 16))
               (t0-29 (the int (* 16.0 f0-27)))
               (a3-53 (* (+ s4-0 32) 16))
               (t1-8 (the int (* 16.0 (+ f0-27 (* 32.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-81) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-81) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 4) a2-53 t0-29 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 5) v1-58 a0-66 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 6) a3-53 t1-8 #xffffff 0)
          )
        (&+! (-> arg0 base) 112)
        (when (< (-> arg1 right lid) 0.0)
          (let ((f0-33 (+ 1.0 (-> arg1 right lid))))
            (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0
                               (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))
                               )
        (let* ((f0-37 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 right lid))))
               (a1-94 (the-as object (-> arg0 base)))
               (a2-64 (* (+ s4-0 64) 16))
               (t0-35 (the int (* 16.0 f0-37)))
               (a3-65 (* (+ s4-0 32) 16))
               (t1-11 (the int (* 16.0 (+ f0-37 (* 32.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-94) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-94) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 4) a2-64 t0-35 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 5) v1-58 a0-66 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 6) a3-65 t1-11 #xffffff 0)
          )
        )
      )
    )
  (let ((v0-3 (&+ (-> arg0 base) 112)))
    (set! (-> arg0 base) v0-3)
    v0-3
    )
  )

(defun render-eyes-32-different ((arg0 dma-buffer) (arg1 eye-control) (arg2 int))
  (local-vars (sv-16 float))
  (let ((s4-0 32)
        (s3-0 (+ (* arg2 32) 32))
        (s2-0 (* arg2 32))
        )
    (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x)))))
          (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y)))))
          (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x)))))
          )
      (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y)))))
      (let ((s1-0 (-> arg1 shaders 0)))
        (let ((v1-14 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-14) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-0 (the-as adgif-shader (&+ (the-as pointer v1-14) 32))))
            (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5)
            (set! (-> s0-0 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                  )
            (set! (-> s0-0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-0 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)))
        (let ((v1-23 (the-as object (-> arg0 base))))
          (set! (-> (the-as (inline-array vector4w) v1-23) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) v1-23) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 2) 128 128 128 128)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 4) (* s4-0 16) (* s3-0 16) #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 5) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 6) (* (+ s4-0 64) 16) (* (+ s3-0 32) 16) #xffffff 0)
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-28 (ash 16 (-> s1-0 tex0 tw)))
              (a0-30 (ash 16 (-> s1-0 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0)))
          (let* ((f0-6 (* 256.0 (-> arg1 left iris-scale)))
                 (a1-26 (the-as object (-> arg0 base)))
                 (a2-13 (the int (- f28-0 f0-6)))
                 (t0-5 (the int (- f26-0 f0-6)))
                 (a3-9 (the int (+ f28-0 f0-6)))
                 (t1-0 (the int (+ f26-0 f0-6)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-26) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-26) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 4) a2-13 t0-5 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 5) v1-28 a0-30 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 6) a3-9 t1-0 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((s1-1 (-> arg1 shaders 3)))
        (let ((v1-33 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-33) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-33) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-1 (the-as adgif-shader (&+ (the-as pointer v1-33) 32))))
            (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5)
            (set! (-> s0-1 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                  )
            (set! (-> s0-1 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-1 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-40 (ash 16 (-> s1-1 tex0 tw)))
              (a0-42 (ash 16 (-> s1-1 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))
                                 )
          (let* ((f0-10 (* 256.0 (-> arg1 right iris-scale)))
                 (a1-36 (the-as object (-> arg0 base)))
                 (a2-23 (the int (- f30-0 f0-10)))
                 (t0-11 (the int (- sv-16 f0-10)))
                 (a3-20 (the int (+ f30-0 f0-10)))
                 (t1-2 (the int (+ sv-16 f0-10)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-36) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-36) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 4) a2-23 t0-11 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 5) v1-40 a0-42 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 6) a3-20 t1-2 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (dma-buffer-add-gs-set arg0
                             (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
                             )
      (let ((s1-2 (-> arg1 shaders 1)))
        (let ((v1-48 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-48) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-48) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-2 (the-as adgif-shader (&+ (the-as pointer v1-48) 32))))
            (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5)
            (set! (-> s0-2 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                  )
            (set! (-> s0-2 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-2 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-55 (ash 16 (-> s1-2 tex0 tw)))
              (a0-60 (ash 16 (-> s1-2 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0)))
          (let* ((f0-14 (* 256.0 (-> arg1 left pupil-scale)))
                 (a1-53 (the-as object (-> arg0 base)))
                 (a2-33 (the int (- f28-0 f0-14)))
                 (t0-17 (the int (- f26-0 f0-14)))
                 (a3-30 (the int (+ f28-0 f0-14)))
                 (t1-3 (the int (+ f26-0 f0-14)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-53) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-53) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 4) a2-33 t0-17 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 5) v1-55 a0-60 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 6) a3-30 t1-3 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((s1-3 (-> arg1 shaders 4)))
        (let ((v1-60 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-60) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-60) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-3 (the-as adgif-shader (&+ (the-as pointer v1-60) 32))))
            (quad-copy! (the-as pointer s0-3) (the-as pointer s1-3) 5)
            (set! (-> s0-3 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                  )
            (set! (-> s0-3 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-3 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-67 (ash 16 (-> s1-3 tex0 tw)))
              (a0-72 (ash 16 (-> s1-3 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))
                                 )
          (let* ((f0-18 (* 256.0 (-> arg1 right pupil-scale)))
                 (a1-63 (the-as object (-> arg0 base)))
                 (a2-43 (the int (- f30-0 f0-18)))
                 (t0-23 (the int (- sv-16 f0-18)))
                 (a3-41 (the int (+ f30-0 f0-18)))
                 (t1-5 (the int (+ sv-16 f0-18)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-63) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-63) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 4) a2-43 t0-23 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 5) v1-67 a0-72 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 6) a3-41 t1-5 #xffffff 0)
            )
          )
        )
      )
    (&+! (-> arg0 base) 112)
    (dma-buffer-add-gs-set arg0
                           (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
                           )
    (let ((s1-4 (-> arg1 shaders 2)))
      (let ((v1-75 (the-as object (-> arg0 base))))
        (set! (-> (the-as dma-gif-packet v1-75) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
        (set! (-> (the-as dma-gif-packet v1-75) quad 1) (-> *eye-work* adgif-tmpl quad 1))
        (let ((s0-4 (the-as adgif-shader (&+ (the-as pointer v1-75) 32))))
          (quad-copy! (the-as pointer s0-4) (the-as pointer s1-4) 5)
          (set! (-> s0-4 clamp)
                (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                )
          (set! (-> s0-4 alpha) (new 'static 'gs-alpha :a #x1))
          (set! (-> s0-4 prims 9) (gs-reg64 alpha-1))
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((v1-82 (ash 16 (-> s1-4 tex0 tw)))
            (a0-90 (ash 16 (-> s1-4 tex0 th)))
            )
        (when (< (-> arg1 left lid) 0.0)
          (let ((f0-23 (+ 1.0 (-> arg1 left lid))))
            (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0)))
        (let* ((f0-27 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 left lid))))
               (a1-85 (the-as object (-> arg0 base)))
               (a2-53 (* s4-0 16))
               (t0-29 (the int (* 16.0 f0-27)))
               (a3-53 (* (+ s4-0 32) 16))
               (t1-8 (the int (* 16.0 (+ f0-27 (* 32.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-85) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-85) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 4) a2-53 t0-29 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 5) v1-82 a0-90 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 6) a3-53 t1-8 #xffffff 0)
          )
        )
      )
    (&+! (-> arg0 base) 112)
    (let ((s1-5 (-> arg1 shaders 5)))
      (let ((v1-87 (the-as object (-> arg0 base))))
        (set! (-> (the-as dma-gif-packet v1-87) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
        (set! (-> (the-as dma-gif-packet v1-87) quad 1) (-> *eye-work* adgif-tmpl quad 1))
        (let ((s0-5 (the-as adgif-shader (&+ (the-as pointer v1-87) 32))))
          (quad-copy! (the-as pointer s0-5) (the-as pointer s1-5) 5)
          (set! (-> s0-5 clamp)
                (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
                )
          (set! (-> s0-5 alpha) (new 'static 'gs-alpha :a #x1))
          (set! (-> s0-5 prims 9) (gs-reg64 alpha-1))
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((v1-94 (ash 16 (-> s1-5 tex0 tw)))
            (a0-102 (ash 16 (-> s1-5 tex0 th)))
            )
        (when (< (-> arg1 right lid) 0.0)
          (let ((f0-33 (+ 1.0 (-> arg1 right lid))))
            (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0
                               (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))
                               )
        (let* ((f0-37 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 right lid))))
               (a1-100 (the-as object (-> arg0 base)))
               (a2-64 (* (+ s4-0 64) 16))
               (t0-35 (the int (* 16.0 f0-37)))
               (a3-65 (* (+ s4-0 32) 16))
               (t1-11 (the int (* 16.0 (+ f0-37 (* 32.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-100) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-100) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 4) a2-64 t0-35 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 5) v1-94 a0-102 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 6) a3-65 t1-11 #xffffff 0)
          )
        )
      )
    )
  (let ((v0-6 (&+ (-> arg0 base) 112)))
    (set! (-> arg0 base) v0-6)
    v0-6
    )
  )

(defun render-eyes-64 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int))
  (local-vars (sv-16 float))
  (let ((s4-0 64)
        (s3-0 (+ (* arg2 64) 64))
        (s2-0 (* arg2 64))
        )
    (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x)))))
          (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y)))))
          (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x)))))
          )
      (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y)))))
      (let ((s1-0 (-> arg1 shaders 0)))
        (let ((v1-14 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-14) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-0 (the-as object (&+ (the-as pointer v1-14) 32))))
            (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5)
            (set! (-> (the-as adgif-shader s0-0) clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                  )
            (set! (-> (the-as adgif-shader s0-0) alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> (the-as adgif-shader s0-0) prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)))
        (let ((v1-23 (the-as object (-> arg0 base))))
          (set! (-> (the-as (inline-array vector4w) v1-23) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) v1-23) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 2) 128 128 128 128)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 4) (* s4-0 16) (* s3-0 16) #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 5) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 6) (* (+ s4-0 128) 16) (* (+ s3-0 64) 16) #xffffff 0)
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-28 (ash 16 (-> s1-0 tex0 tw)))
              (a0-30 (ash 16 (-> s1-0 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0)))
          (let* ((f0-6 (* 512.0 (-> arg1 left iris-scale)))
                 (a1-26 (the-as object (-> arg0 base)))
                 (a2-13 (the int (- f28-0 f0-6)))
                 (t0-5 (the int (- f26-0 f0-6)))
                 (a3-9 (the int (+ f28-0 f0-6)))
                 (t1-0 (the int (+ f26-0 f0-6)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-26) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-26) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 4) a2-13 t0-5 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 5) v1-28 a0-30 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 6) a3-9 t1-0 #xffffff 0)
            )
          (&+! (-> arg0 base) 112)
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))
                                 )
          (let* ((f0-10 (* 512.0 (-> arg1 right iris-scale)))
                 (a1-34 (the-as object (-> arg0 base)))
                 (a2-23 (the int (- f30-0 f0-10)))
                 (t0-11 (the int (- sv-16 f0-10)))
                 (a3-20 (the int (+ f30-0 f0-10)))
                 (t1-2 (the int (+ sv-16 f0-10)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-34) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-34) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 4) a2-23 t0-11 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 5) v1-28 a0-30 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-34) 6) a3-20 t1-2 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (dma-buffer-add-gs-set arg0
                             (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
                             )
      (let ((s1-1 (-> arg1 shaders 1)))
        (let ((v1-36 (the-as object (-> arg0 base))))
          (set! (-> (the-as (inline-array vector4w) v1-36) 0 quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) v1-36) 1 quad) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-1 (the-as object (&+ (the-as pointer v1-36) 32))))
            (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5)
            (set! (-> (the-as adgif-shader s0-1) clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                  )
            (set! (-> (the-as adgif-shader s0-1) alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> (the-as adgif-shader s0-1) prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-43 (ash 16 (-> s1-1 tex0 tw)))
              (a0-48 (ash 16 (-> s1-1 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0)))
          (let* ((f0-14 (* 512.0 (-> arg1 left pupil-scale)))
                 (a1-51 (the-as object (-> arg0 base)))
                 (a2-33 (the int (- f28-0 f0-14)))
                 (t0-17 (the int (- f26-0 f0-14)))
                 (a3-30 (the int (+ f28-0 f0-14)))
                 (t1-3 (the int (+ f26-0 f0-14)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-51) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-51) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 4) a2-33 t0-17 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 5) v1-43 a0-48 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-51) 6) a3-30 t1-3 #xffffff 0)
            )
          (&+! (-> arg0 base) 112)
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))
                                 )
          (let* ((f0-18 (* 512.0 (-> arg1 right pupil-scale)))
                 (a1-59 (the-as object (-> arg0 base)))
                 (a2-43 (the int (- f30-0 f0-18)))
                 (t0-23 (the int (- sv-16 f0-18)))
                 (a3-41 (the int (+ f30-0 f0-18)))
                 (t1-5 (the int (+ sv-16 f0-18)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-59) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-59) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 4) a2-43 t0-23 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 5) v1-43 a0-48 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-59) 6) a3-41 t1-5 #xffffff 0)
            )
          )
        )
      )
    (&+! (-> arg0 base) 112)
    (dma-buffer-add-gs-set arg0
                           (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
                           )
    (let ((s1-2 (-> arg1 shaders 2)))
      (let ((v1-51 (the-as object (-> arg0 base))))
        (set! (-> (the-as dma-gif-packet v1-51) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
        (set! (-> (the-as dma-gif-packet v1-51) quad 1) (-> *eye-work* adgif-tmpl quad 1))
        (let ((s0-2 (the-as object (&+ (the-as pointer v1-51) 32))))
          (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5)
          (set! (-> (the-as adgif-shader s0-2) clamp)
                (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                )
          (set! (-> (the-as adgif-shader s0-2) alpha) (new 'static 'gs-alpha :a #x1))
          (set! (-> (the-as adgif-shader s0-2) prims 9) (gs-reg64 alpha-1))
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((v1-58 (ash 16 (-> s1-2 tex0 tw)))
            (a0-66 (ash 16 (-> s1-2 tex0 th)))
            )
        (when (< (-> arg1 left lid) 0.0)
          (let ((f0-23 (+ 1.0 (-> arg1 left lid))))
            (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0)))
        (let* ((f0-27 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 left lid))))
               (a1-81 (the-as object (-> arg0 base)))
               (a2-53 (* s4-0 16))
               (t0-29 (the int (* 16.0 f0-27)))
               (a3-53 (* (+ s4-0 64) 16))
               (t1-8 (the int (* 16.0 (+ f0-27 (* 64.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-81) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-81) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 4) a2-53 t0-29 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 5) v1-58 a0-66 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-81) 6) a3-53 t1-8 #xffffff 0)
          )
        (&+! (-> arg0 base) 112)
        (when (< (-> arg1 right lid) 0.0)
          (let ((f0-33 (+ 1.0 (-> arg1 right lid))))
            (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0
                               (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))
                               )
        (let* ((f0-37 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 right lid))))
               (a1-94 (the-as object (-> arg0 base)))
               (a2-64 (* (+ s4-0 128) 16))
               (t0-35 (the int (* 16.0 f0-37)))
               (a3-65 (* (+ s4-0 64) 16))
               (t1-11 (the int (* 16.0 (+ f0-37 (* 64.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-94) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-94) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 4) a2-64 t0-35 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 5) v1-58 a0-66 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-94) 6) a3-65 t1-11 #xffffff 0)
          )
        )
      )
    )
  (let ((v0-3 (&+ (-> arg0 base) 112)))
    (set! (-> arg0 base) v0-3)
    v0-3
    )
  )

(defun render-eyes-64-different ((arg0 dma-buffer) (arg1 eye-control) (arg2 int))
  (local-vars (sv-16 float))
  (let ((s4-0 64)
        (s3-0 (+ (* arg2 64) 64))
        (s2-0 (* arg2 64))
        )
    (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x)))))
          (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y)))))
          (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x)))))
          )
      (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y)))))
      (let ((s1-0 (-> arg1 shaders 0)))
        (let ((v1-14 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-14) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-0 (the-as adgif-shader (&+ (the-as pointer v1-14) 32))))
            (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5)
            (set! (-> s0-0 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                  )
            (set! (-> s0-0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-0 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)))
        (let ((v1-23 (the-as object (-> arg0 base))))
          (set! (-> (the-as (inline-array vector4w) v1-23) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) v1-23) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 2) 128 128 128 128)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 4) (* s4-0 16) (* s3-0 16) #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 5) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) v1-23) 6) (* (+ s4-0 128) 16) (* (+ s3-0 64) 16) #xffffff 0)
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-28 (ash 16 (-> s1-0 tex0 tw)))
              (a0-30 (ash 16 (-> s1-0 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0)))
          (let* ((f0-6 (* 512.0 (-> arg1 left iris-scale)))
                 (a1-26 (the-as object (-> arg0 base)))
                 (a2-13 (the int (- f28-0 f0-6)))
                 (t0-5 (the int (- f26-0 f0-6)))
                 (a3-9 (the int (+ f28-0 f0-6)))
                 (t1-0 (the int (+ f26-0 f0-6)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-26) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-26) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 4) a2-13 t0-5 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 5) v1-28 a0-30 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-26) 6) a3-9 t1-0 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((s1-1 (-> arg1 shaders 3)))
        (let ((v1-33 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-33) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-33) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-1 (the-as adgif-shader (&+ (the-as pointer v1-33) 32))))
            (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5)
            (set! (-> s0-1 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                  )
            (set! (-> s0-1 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-1 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-40 (ash 16 (-> s1-1 tex0 tw)))
              (a0-42 (ash 16 (-> s1-1 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))
                                 )
          (let* ((f0-10 (* 512.0 (-> arg1 right iris-scale)))
                 (a1-36 (the-as object (-> arg0 base)))
                 (a2-23 (the int (- f30-0 f0-10)))
                 (t0-11 (the int (- sv-16 f0-10)))
                 (a3-20 (the int (+ f30-0 f0-10)))
                 (t1-2 (the int (+ sv-16 f0-10)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-36) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-36) 1 quad) (-> *eye-work* sprite-tmpl quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 4) a2-23 t0-11 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 5) v1-40 a0-42 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-36) 6) a3-20 t1-2 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (dma-buffer-add-gs-set arg0
                             (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
                             )
      (let ((s1-2 (-> arg1 shaders 1)))
        (let ((v1-48 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-48) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-48) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-2 (the-as adgif-shader (&+ (the-as pointer v1-48) 32))))
            (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5)
            (set! (-> s0-2 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                  )
            (set! (-> s0-2 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-2 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-55 (ash 16 (-> s1-2 tex0 tw)))
              (a0-60 (ash 16 (-> s1-2 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0)))
          (let* ((f0-14 (* 512.0 (-> arg1 left pupil-scale)))
                 (a1-53 (the-as object (-> arg0 base)))
                 (a2-33 (the int (- f28-0 f0-14)))
                 (t0-17 (the int (- f26-0 f0-14)))
                 (a3-30 (the int (+ f28-0 f0-14)))
                 (t1-3 (the int (+ f26-0 f0-14)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-53) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-53) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 4) a2-33 t0-17 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 5) v1-55 a0-60 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-53) 6) a3-30 t1-3 #xffffff 0)
            )
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((s1-3 (-> arg1 shaders 4)))
        (let ((v1-60 (the-as object (-> arg0 base))))
          (set! (-> (the-as dma-gif-packet v1-60) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
          (set! (-> (the-as dma-gif-packet v1-60) quad 1) (-> *eye-work* adgif-tmpl quad 1))
          (let ((s0-3 (the-as adgif-shader (&+ (the-as pointer v1-60) 32))))
            (quad-copy! (the-as pointer s0-3) (the-as pointer s1-3) 5)
            (set! (-> s0-3 clamp)
                  (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                  )
            (set! (-> s0-3 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
            (set! (-> s0-3 prims 9) (gs-reg64 alpha-1))
            )
          )
        (&+! (-> arg0 base) 112)
        (let ((v1-67 (ash 16 (-> s1-3 tex0 tw)))
              (a0-72 (ash 16 (-> s1-3 tex0 th)))
              )
          (dma-buffer-add-gs-set arg0
                                 (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))
                                 )
          (let* ((f0-18 (* 512.0 (-> arg1 right pupil-scale)))
                 (a1-63 (the-as object (-> arg0 base)))
                 (a2-43 (the int (- f30-0 f0-18)))
                 (t0-23 (the int (- sv-16 f0-18)))
                 (a3-41 (the int (+ f30-0 f0-18)))
                 (t1-5 (the int (+ sv-16 f0-18)))
                 )
            (set! (-> (the-as (inline-array vector4w) a1-63) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
            (set! (-> (the-as (inline-array vector4w) a1-63) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 2) 128 128 128 128)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 3) 0 0 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 4) a2-43 t0-23 #xffffff 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 5) v1-67 a0-72 0 0)
            (set-vector! (-> (the-as (inline-array vector4w) a1-63) 6) a3-41 t1-5 #xffffff 0)
            )
          )
        )
      )
    (&+! (-> arg0 base) 112)
    (dma-buffer-add-gs-set arg0
                           (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
                           )
    (let ((s1-4 (-> arg1 shaders 2)))
      (let ((v1-75 (the-as object (-> arg0 base))))
        (set! (-> (the-as dma-gif-packet v1-75) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
        (set! (-> (the-as dma-gif-packet v1-75) quad 1) (-> *eye-work* adgif-tmpl quad 1))
        (let ((s0-4 (the-as adgif-shader (&+ (the-as pointer v1-75) 32))))
          (quad-copy! (the-as pointer s0-4) (the-as pointer s1-4) 5)
          (set! (-> s0-4 clamp)
                (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                )
          (set! (-> s0-4 alpha) (new 'static 'gs-alpha :a #x1))
          (set! (-> s0-4 prims 9) (gs-reg64 alpha-1))
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((v1-82 (ash 16 (-> s1-4 tex0 tw)))
            (a0-90 (ash 16 (-> s1-4 tex0 th)))
            )
        (when (< (-> arg1 left lid) 0.0)
          (let ((f0-23 (+ 1.0 (-> arg1 left lid))))
            (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0)))
        (let* ((f0-27 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 left lid))))
               (a1-85 (the-as object (-> arg0 base)))
               (a2-53 (* s4-0 16))
               (t0-29 (the int (* 16.0 f0-27)))
               (a3-53 (* (+ s4-0 64) 16))
               (t1-8 (the int (* 16.0 (+ f0-27 (* 64.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-85) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-85) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 4) a2-53 t0-29 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 5) v1-82 a0-90 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-85) 6) a3-53 t1-8 #xffffff 0)
          )
        )
      )
    (&+! (-> arg0 base) 112)
    (let ((s1-5 (-> arg1 shaders 5)))
      (let ((v1-87 (the-as object (-> arg0 base))))
        (set! (-> (the-as dma-gif-packet v1-87) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad))
        (set! (-> (the-as dma-gif-packet v1-87) quad 1) (-> *eye-work* adgif-tmpl quad 1))
        (let ((s0-5 (the-as adgif-shader (&+ (the-as pointer v1-87) 32))))
          (quad-copy! (the-as pointer s0-5) (the-as pointer s1-5) 5)
          (set! (-> s0-5 clamp)
                (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
                )
          (set! (-> s0-5 alpha) (new 'static 'gs-alpha :a #x1))
          (set! (-> s0-5 prims 9) (gs-reg64 alpha-1))
          )
        )
      (&+! (-> arg0 base) 112)
      (let ((v1-94 (ash 16 (-> s1-5 tex0 tw)))
            (a0-102 (ash 16 (-> s1-5 tex0 th)))
            )
        (when (< (-> arg1 right lid) 0.0)
          (let ((f0-33 (+ 1.0 (-> arg1 right lid))))
            (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink))))
            )
          )
        (dma-buffer-add-gs-set arg0
                               (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))
                               )
        (let* ((f0-37 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 right lid))))
               (a1-100 (the-as object (-> arg0 base)))
               (a2-64 (* (+ s4-0 128) 16))
               (t0-35 (the int (* 16.0 f0-37)))
               (a3-65 (* (+ s4-0 64) 16))
               (t1-11 (the int (* 16.0 (+ f0-37 (* 64.0 (-> arg1 left lid-scale))))))
               )
          (set! (-> (the-as (inline-array vector4w) a1-100) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad))
          (set! (-> (the-as (inline-array vector4w) a1-100) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1))
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 2) 128 128 128 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 3) 0 0 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 4) a2-64 t0-35 #xffffff 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 5) v1-94 a0-102 0 0)
          (set-vector! (-> (the-as (inline-array vector4w) a1-100) 6) a3-65 t1-11 #xffffff 0)
          )
        )
      )
    )
  (let ((v0-6 (&+ (-> arg0 base) 112)))
    (set! (-> arg0 base) v0-6)
    v0-6
    )
  )

(defun update-eyes ()
  (when (not (-> *blit-displays-work* screen-copied))
    (dotimes (gp-0 6)
      (dotimes (s5-0 16)
        (let* ((s4-0 (the-as eye-control (+ (+ (* 96 s5-0) 28 (* 1552 gp-0)) (the-as int *eye-control-arrays*))))
               (v1-8 (handle->process (-> s4-0 process)))
               )
          (when (and v1-8
                     (logtest? (-> (the-as process-drawable v1-8) skel status) (joint-control-status eye-anim))
                     (logtest? (-> (the-as process-drawable v1-8) draw status) (draw-control-status on-screen))
                     )
            (when (-> s4-0 shaders)
              (when (not (paused?))
                (cond
                  ((and (>= (-> s4-0 left lid) 0.0) (>= (-> s4-0 right lid) 0.0))
                   (set! (-> s4-0 random-time) (the-as uint 60))
                   (set! (-> s4-0 blink) 0.0)
                   )
                  (else
                    (+! (-> s4-0 random-time) -1)
                    (let ((v1-22 (-> s4-0 random-time)))
                      (when (< v1-22 (the-as uint 10))
                        (set! (-> s4-0 blink) (-> *eye-work* blink-table v1-22))
                        (if (zero? v1-22)
                            (set! (-> s4-0 random-time) (the-as uint (the int (rand-vu-float-range 60.0 240.0))))
                            )
                        )
                      )
                    )
                  )
                )
              (when (-> s4-0 draw-flag)
                (cond
                  ((and (>= gp-0 3)
                        (or (movie?)
                            (and (not (-> (the-as eye-control-arrays (+ (the-as uint *eye-control-arrays*) (* 1552 (+ gp-0 -3)) (* 96 s5-0)))
                                          data
                                          0
                                          data
                                          0
                                          process
                                          )
                                      )
                                 (not (-> (the-as eye-control-arrays (+ (the-as uint *eye-control-arrays*) (* 1552 (+ gp-0 -3)) (* 96 (+ s5-0 1))))
                                          data
                                          0
                                          data
                                          0
                                          process
                                          )
                                      )
                                 (not (-> (the-as eye-control-arrays (+ (the-as uint *eye-control-arrays*) (* 1552 (+ gp-0 -3)) (* 96 (+ s5-0 2))))
                                          data
                                          0
                                          data
                                          0
                                          process
                                          )
                                      )
                                 (not (-> (the-as eye-control-arrays (+ (the-as uint *eye-control-arrays*) (* 1552 (+ gp-0 -3)) (* 96 (+ s5-0 3))))
                                          data
                                          0
                                          data
                                          0
                                          process
                                          )
                                      )
                                 )
                            )
                        )
                   (with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf))
                                                (the-as bucket-id (-> s4-0 bucket))
                                                )
                     (set-display-gs-state-offset s2-0 (the-as int (-> *eyes-texture-base* vram-page)) 128 256 0 0 64 64)
                     (dma-buffer-add-gs-set s2-0
                                            (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
                                            )
                     (if (-> s4-0 different-eyes)
                         (render-eyes-64-different s2-0 s4-0 (/ s5-0 4))
                         (render-eyes-64 s2-0 s4-0 (/ s5-0 4))
                         )
                     (reset-display-gs-state *display* s2-0)
                     (dma-buffer-add-gs-set s2-0 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)))
                     )
                   )
                  ((and (< gp-0 3)
                        (or (not (movie?))
                            (not (-> (the-as eye-control-arrays (+ (the-as uint *eye-control-arrays*) (* 1552 (+ gp-0 3)) (* 96 (* (/ s5-0 4) 4))))
                                     data
                                     0
                                     data
                                     0
                                     process
                                     )
                                 )
                            )
                        )
                   (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf))
                                                (the-as bucket-id (-> s4-0 bucket))
                                                )
                     (set-display-gs-state-offset s2-1 (the-as int (-> *eyes-texture-base* vram-page)) 64 512 0 0 32 32)
                     (dma-buffer-add-gs-set s2-1
                                            (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
                                            )
                     (if (-> s4-0 different-eyes)
                         (render-eyes-32-different s2-1 s4-0 s5-0)
                         (render-eyes-32 s2-1 s4-0 s5-0)
                         )
                     (reset-display-gs-state *display* s2-1)
                     (dma-buffer-add-gs-set s2-1 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)))
                     )
                   )
                  )
                )
              )
            )
          )
        )
      )
    )
  0
  (none)
  )

;; WARN: Return type mismatch uint vs int.
(defun get-eye-block ((arg0 int) (arg1 int))
  (let ((v1-0 arg0)
        (a0-4 (-> ct32-24-block-table (* arg1 4)))
        )
    (the-as int (+ (-> *eyes-texture-base* vram-block) (* v1-0 32) a0-4))
    )
  )

(defun convert-eye-data ((arg0 eye) (arg1 uint))
  (local-vars
    (v0-0 float)
    (v1-0 uint128)
    (v1-1 uint128)
    (v1-2 uint128)
    (v1-3 uint128)
    (v1-4 uint128)
    (v1-5 uint128)
    )
  (rlet ((vf1 :class vf)
         (vf2 :class vf)
         )
    (.pextlb v1-0 arg1 0)
    (.pextlh v1-1 v1-0 0)
    (.pw.sra v1-2 v1-1 16)
    (.mov vf1 v1-2)
    (.pextlb v1-3 0 arg1)
    (.pextuh v1-4 0 v1-3)
    (.pw.sll v1-5 v1-4 6)
    (.mov vf2 v1-5)
    (vitof15.xyzw vf1 vf1)
    (vitof12.xyzw vf2 vf2)
    (.svf (&-> arg0 data 0 quad) vf1)
    (.svf (&-> arg0 data 1 quad) vf2)
    (.mov v0-0 vf2)
    v0-0
    )
  )

(defun merc-eye-anim ((arg0 process-drawable))
  (let* ((v1-2 (-> arg0 draw mgeo header eye-ctrl))
         (a0-2 (-> arg0 skel float-channels))
         (s3-0 (cond
                 ((> a0-2 0)
                  (-> arg0 skel channel (+ a0-2 -1 (-> arg0 skel active-channels)))
                  )
                 (else
                   (let ((a0-8 (-> arg0 skel root-channel))
                         (a1-4 (-> arg0 skel effect))
                         )
                     (-> a0-8 (if a1-4
                                  (-> a1-4 channel-offset)
                                  0
                                  )
                         )
                     )
                   )
                 )
               )
         (s5-0 (-> s3-0 frame-group))
         )
    (when (and (logtest? (-> arg0 skel status) (joint-control-status eye-anim))
               (and (nonzero? v1-2) (> (-> arg0 skel active-channels) 0) s5-0)
               )
      (cond
        ((and (-> arg0 skel override) (!= (-> arg0 skel override 41) 0.0))
         (let ((v1-7 (-> *eye-control-arrays* data (/ (-> v1-2 eye-slot) 20) data (mod (-> v1-2 eye-slot) 20)))
               (a0-26 (-> arg0 skel override))
               )
           (set! (-> v1-7 left x) (-> a0-26 42))
           (set! (-> v1-7 left y) (-> a0-26 43))
           (set! (-> v1-7 left lid) (-> a0-26 44))
           (set! (-> v1-7 left iris-scale) (-> a0-26 45))
           (set! (-> v1-7 left pupil-scale) (-> a0-26 46))
           (set! (-> v1-7 left lid-scale) (-> a0-26 47))
           (set! (-> v1-7 right x) (-> a0-26 48))
           (set! (-> v1-7 right y) (-> a0-26 49))
           (set! (-> v1-7 right lid) (-> a0-26 50))
           (set! (-> v1-7 right iris-scale) (-> a0-26 51))
           (set! (-> v1-7 right pupil-scale) (-> a0-26 52))
           (set! (-> v1-7 right lid-scale) (-> a0-26 53))
           )
         (logior! (-> arg0 skel status) (joint-control-status eye-anim-valid))
         )
        (else
          (let* ((s4-0 (-> *eye-control-arrays* data (/ (-> v1-2 eye-slot) 20) data (mod (-> v1-2 eye-slot) 20)))
                 (f0-13 (-> s3-0 frame-num))
                 (f30-0 (- f0-13 (* (the float (the int (/ f0-13 1.0))) 1.0)))
                 )
            (set! (-> s4-0 process) (process->handle arg0))
            (if (< 3 (-> v1-2 shader-count))
                (set! (-> s4-0 different-eyes) #t)
                (set! (-> s4-0 different-eyes) #f)
                )
            (set! (-> s4-0 shaders) (the-as (inline-array adgif-shader) (-> v1-2 left-iris-shader)))
            (let ((a0-40 *level*)
                  (v1-12 (-> arg0 draw))
                  )
              (set! (-> s4-0 bucket) (the-as uint (vu1-bucket-map
                                                    (the-as int (-> a0-40 draw-index-map (-> v1-12 level-index)))
                                                    (the-as int (-> v1-12 default-texture-page))
                                                    (merc-mode eye)
                                                    )
                                             )
                    )
              )
            (let ((s2-0 (new 'stack-no-clear 'eye))
                  (s1-0 (new 'stack-no-clear 'eye))
                  )
              (cond
                ((-> s5-0 eye-anim)
                 (let ((s0-1 (min (the int (-> s3-0 frame-num)) (-> s5-0 eye-anim max-frame)))
                       (s3-2 (min (+ (the int (-> s3-0 frame-num)) 1) (-> s5-0 eye-anim max-frame)))
                       )
                   (convert-eye-data s2-0 (-> s5-0 eye-anim data (* s0-1 2) dword))
                   (convert-eye-data s1-0 (-> s5-0 eye-anim data (* s3-2 2) dword))
                   (vector4-lerp!
                     (the-as vector (-> s4-0 left))
                     (the-as vector (-> s2-0 data))
                     (the-as vector (-> s1-0 data))
                     f30-0
                     )
                   (vector4-lerp!
                     (the-as vector (&-> s4-0 left iris-scale))
                     (the-as vector (&-> s2-0 iris-scale))
                     (the-as vector (&-> s1-0 iris-scale))
                     f30-0
                     )
                   (convert-eye-data s2-0 (-> s5-0 eye-anim data (+ (* s0-1 2) 1) dword))
                   (convert-eye-data s1-0 (-> s5-0 eye-anim data (+ (* s3-2 2) 1) dword))
                   )
                 (vector4-lerp!
                   (the-as vector (-> s4-0 right))
                   (the-as vector (-> s2-0 data))
                   (the-as vector (-> s1-0 data))
                   f30-0
                   )
                 (vector4-lerp!
                   (the-as vector (&-> s4-0 right iris-scale))
                   (the-as vector (&-> s2-0 iris-scale))
                   (the-as vector (&-> s1-0 iris-scale))
                   f30-0
                   )
                 )
                (else
                  (format *stdcon* "no eye anim data for ~s~%" (-> arg0 name))
                  (set! (-> s4-0 left x) 0.0)
                  (set! (-> s4-0 left y) 0.0)
                  (set! (-> s4-0 left lid) -1.0)
                  (set! (-> s4-0 left iris-scale) 0.55)
                  (set! (-> s4-0 left pupil-scale) 0.45)
                  (set! (-> s4-0 left lid-scale) 1.0)
                  (set! (-> s4-0 right x) 0.0)
                  (set! (-> s4-0 right y) 0.0)
                  (set! (-> s4-0 right lid) -1.0)
                  (set! (-> s4-0 right iris-scale) 0.55)
                  (set! (-> s4-0 right pupil-scale) 0.45)
                  (set! (-> s4-0 right lid-scale) 1.0)
                  )
                )
              )
            )
          (logior! (-> arg0 skel status) (joint-control-status eye-anim-valid))
          )
        )
      )
    )
  (if (logtest? (-> arg0 skel status) (joint-control-status eye-anim-valid))
      (logclear! (-> arg0 skel status) (joint-control-status eye-anim-valid))
      )
  0
  (none)
  )

(defun set-eye-draw-flag ((arg0 symbol) (arg1 int))
  (let ((s5-0 (-> *eye-control-arrays* data (/ arg1 20) data (mod arg1 20)))
        )
    (format 0 "flag: ~a eye-slot: ~d ~%" arg0 arg1)
    (set! (-> (the-as eye-control s5-0) draw-flag) arg0)
    )
  0
  (none)
  )
