"merging" code is best done by starting from the largest from the two and add the functionality of (2) as new code. step by step.
If you just want to reuse your code the pattern below is a good start.
Major problem will be the scope (& duplication etc) of the variables, you might start with making them as global as possible.
void setup()
{
setup1();
setup2();
}
void loop()
{
// declare all local vars of loop1 and loop2 here
loop1();
loop2();
}
void setup1()
{
}
void loop1()
{
}
void setup2()
{
}
void loop2()
{
}
advice: use method 1.