A head to head comparison of the Alabama 2012 General Election gives us an idea of the break down of the voters.    

Mitt Romney received 1,252,450 (61%) votes, beating Barack Obama who gained 793,620 (39%) by 458,830 votes in Alabama.

Mitt Romney won 52 counties whereas Barack Obama won 15 counties in the total of the 67 counties in the State of Alabama.

Presidential General Elections

During the 2012 General elections, over 122M total number of votes were cast. Barack Obama got 62,614,654 (62.6 Million) over Mitt Romney's 59,141,654 (59.1 Million). He won the popular vote by 3,472,979 (3.4 Million). Even though he lost to Mitt Romney in the State of Alabama, his 793,620 gained votes represents 1.3% of his popular vote victory. The remaining 49 states contributed to the remaining 98.7% popular votes victory.

Top 15 Counties in Primary Elections vs General Elections

All Candidates (General Elections)

These 15 counties play an important role in these Primary elections. If a candidate, can get a sizable majority in the larger counties (Jefferson, Mobile, Madison), it becomes very difficult to win majorities in the smaller counties without voter outreach and increased voter participation in them.

Top 15 Counties Comparison in Primary Elections vs General Elections

General Elections
Barack Obama

General Elections
Mitt Romney

Jefferson, the largest county, voted in favor of Obama giving him a 18k vote advantage. Mobile and Madison, another larger counties voted in favor of Romney giving him a 45k voter advantage in those counties. This combined with Romney's steady win in the less dense counties was enough to catch up, making him gain an upper hand in the State of Alabama.

Related References: 2016 Alabama Primary Election Story, 2016 Alabama General Election Story,  2020 Alabama Primary Election Story, 2020 Alabama General Election Story