bcc ((CASE safe r code def):xs) = do
    i <- get
    tell $ indent (level i) ++ "switch(" ++ ctag safe ++ "(" ++ creg r ++ ")) {\n"
    mapM showCase code
    showDef def
    tell $ indent (level i) ++ "}\n"
    bcc xs
  where
    ctag True = "CTAG"
    ctag False = "TAG"

    showCase (t, bc) = do
        w <- getBC bc xs
        is <- get
        let i = level is
        tell $ indent i ++ "case " ++ show t ++ ":\n"
                ++ w ++ indent (i + 1) ++ "break;\n"
    showDef Nothing = return $ ()
    showDef (Just c) = do
        w <- getBC c xs
        is <- get
        let i = level is
        tell $ indent i ++ "default:\n" ++ w ++ indent (i + 1) ++ "break;\n"
bcc ((CASE safe r code def):xs) = do
    i <- get
    tell $ indent (level i) ++ "switch(" ++ ctag safe ++ "(" ++ creg r ++ ")) {\n"
    mapM showCase code
    showDef def
    tell $ indent (level i) ++ "}\n"
    bcc xs
  where
    ctag True = "CTAG"
    ctag False = "TAG"

    showCase (t, bc) = do
        w <- getBC bc xs
        is <- get
        let i = level is
        tell $ indent i ++ "case " ++ show t ++ ":\n"
                ++ w ++ indent (i + 1) ++ "break;\n"
    showDef Nothing = return $ ()
    showDef (Just c) = do
        w <- getBC c xs
        is <- get
        let i = level is
        tell $ indent i ++ "default:\n" ++ w ++ indent (i + 1) ++ "break;\n"
bcc ((CASE safe r code def):xs) = do
    i <- get
    tell $ indent (level i) ++ "switch(" ++ ctag safe ++ "(" ++ creg r ++ ")) {\n"
    mapM showCase code
    showDef def
    tell $ indent (level i) ++ "}\n"
    bcc xs
  where
    ctag True = "CTAG"
    ctag False = "TAG"

    showCase (t, bc) = do
        w <- getBC bc xs
        is <- get
        let i = level is
        tell $ indent i ++ "case " ++ show t ++ ":\n"
                ++ w ++ indent (i + 1) ++ "break;\n"
    showDef Nothing = return $ ()
    showDef (Just c) = do
        w <- getBC c xs
        is <- get
        let i = level is
        tell $ indent i ++ "default:\n" ++ w ++ indent (i + 1) ++ "break;\n"