iff :: Exp Bool -> Action () -> Action () -> Action ()
iff test true false = do
    thn <- newLabel
    els <- newLabel
    end <- newLabel
    Value t <- test
    emit $ StrCmpS t (lit "") thn els
    label thn
    scope false
    goto end
    label els
    scope true
    label end


-- | A version of 'iff' where there is no else action.
iff :: Exp Bool -> Action () -> Action () -> Action ()
iff test true false = do
    thn <- newLabel
    els <- newLabel
    end <- newLabel
    Value t <- test
    emit $ StrCmpS t (lit "") thn els
    label thn
    scope false
    goto end
    label els
    scope true
    label end


-- | A version of 'iff' where there is no else action.
iff test true false = do
    thn <- newLabel
    els <- newLabel
    end <- newLabel
    Value t <- test
    emit $ StrCmpS t (lit "") thn els
    label thn
    scope false
    goto end
    label els
    scope true
    label end


-- | A version of 'iff' where there is no else action.