Here's a stupid simple primer for trying to figure out AVR code:
This is the pinout diagram for the ATMega168. There are others, but this one is a decent starting point. Each AVR microcontroller has a number of PORTS which define up to 8 pins (0 through 7). You don't really directly address pins, you address ports.

The codes immediately next to each pin, PB0, PC2, etc... tell you which PORT (B, C, D) and which PIN (0, 2, 4) it is.
DDRx is the Data Direction Register. It's an 8-bit number that defines the input/output status of an ENTIRE PORT. 1 is output, 0 is input. It's binary, so the c statements:
- Code: Select all | TOGGLE FULL SIZE
DDRB = 0b1111111;
DDRB = 0xFF;
DDRB = 255;
would mean that every single pin on port B (PB0 through PB7) would be OUTPUT pins. All three of these statement do precisely the same thing, though the binary version's a hell of a lot clearer. The same applies, in this case for the '168, for DDRC and DDRD. They do it this way so if you move your code to a different chip it's still compatible, provided you're not attempting to address nonexistent ports.
PORTx is the actual pins of the port. You set a bit to 1 to pull the pin high and the bit to 0 to pull the pin low. So, let's augment our previous code:
- Code: Select all | TOGGLE FULL SIZE
DDRB = 0b1111111; // All pins on port B are output pins.
PORTB = 0b1111111; // All pins on port B are now HIGH.
PORTB = 0b10101010; // Now half the pins on port B are HIGH, the other half, LOW.
Now, most of the time you WON'T want to set an entire port at once. Not only it it cumbersome, but you won't necessarily know what the other pins are supposed to be if you're, say, working inside of an interrupt. So instead you'll want to use bitwise operators.
Changing the previous code, let's start with all the pins LOW and not alternate them.:
- Code: Select all | TOGGLE FULL SIZE
DDRB = 0b1111111; // All pins on port B are output pins.
// PORTB = 0b1111111; We won't do this.
// PORTB = 0b10101010; We won't do this.
PORTB = 0b00000000; // All pins on port B are now LOW.
PORTB |= ( 1 << 1 ); // Turn on the bit in the 2nd position (bit 1, numbered 0-7)
PORTB |= ( 1 << 3 ); // Turn on the bit in the 4th position (bit 3)
PORTB |= ( 1 << 5 ); // Turn on bit 5
PORTB |= ( 1 << 7 ); // Turn on bit 7 (the last bit)
In that code we end up doing the same thing, but now by individually using the OR assignment operator, "|=", which is like +=, -=, *=, only with bitwise arithmetic. The << is the bit shift operator, which takes a 1 (the first argument) and move it X bits down (the second argument.) So:
- Code: Select all | TOGGLE FULL SIZE
1 << 1
0b00000001 << 1
0b00000010
_BV( 1 )
All three of these represent the number 2. The last line is a macro in avr-gcc that makes this simpler, the _BV() macro.
Turning OFF a bit is very similar, only instead of using an OR operator you use an AND operator and you negate a single-bit number. All of these lines of code do the same thing:
- Code: Select all | TOGGLE FULL SIZE
PORTB &= 0b11111101;
PORTB &= ~(1 << 1);
PORTB &= ~_BV(1);
The tilda ~ in the last two lines takes a binary number and negates it. So:
- Code: Select all | TOGGLE FULL SIZE
~(0b00000010) = 0b11111101
I'm sure other people can give you lots of more pointers for how to decipher some of the AVR code, but that was the stuff that threw me for a loop back in the day. (That is to say, about 6 weeks ago ;) )