We establish dichotomy results concerning the structure of Baire class 1 functions. We consider decompositions of Baire class 1 functions into continuous functions and into continuous functions with closed domains. Dichotomy results for both of them are proved: a Baire class 1 function decomposes into countably many countinuous functions, or else contains a function which turns out to be as complicated with respect to the decomposition as any other Baire class 1 function; similarly for decompositions into continuous functions with closed domains. These results strengthen a theorem of Jayne and Rogers and answer some questions of Steprāns. Their proofs use effective descriptive set theory as well as infinite Borel games on the integers. An important role in the proofs is played by what we call, in analogy with being Wadge complete, complete semicontinuous functions. As another application of our study of complete semicontinuous functions, we generalize some recent theorems of Jackson and Mauldin, and van Mill and Pol concerning measures viewed as examples of complicated semicontinuous functions. We also prove that a Borel set
A
A
is either
Σ
α
0
\boldsymbol \Sigma ^{0}_{\alpha }
or there is a continuous injection
ϕ
:
ω
ω
→
A
\phi :\; \omega ^{\omega }\to A
such that for any
Σ
α
0
\boldsymbol \Sigma ^{0}_{\alpha }
set
B
⊂
A
B\subset A
,
ϕ
−
1
(
B
)
\phi ^{-1}(B)
is meager. We show analogous results for Borel functions. These theorems give a new proof of a result of Stern, strengthen some results of Laczkovich, and improve the estimates for cardinal coefficients studied by Cichoń, Morayne, Pawlikowski, and the author.