Recursive Function
binary: recurse.bin (elf64)

Simplified code in C looks like:
int main(void)
{
undefined8 var1;
int a;
int b;
setup();
printf("Enter your initial values: ");
scanf("%d %d",&a,&b);
if ((a == 0) || (b == 0)) {
puts("Values must both be non-zero!");
var1 = 1;
}
else {
var1 = recurse(a,b,0,1);
if ((int)var1 == 0) {
puts("Nope!");
}
else {
puts("Correct!");
print_flag();
}
var1 = 0;
}
return var1;
}
The application takes 2 numbers as input
If the evaluation of recurse() is non-zero, the flag is printed
Inspecting the recurse function:

Simplified version:
Now what is c_goal and sum_goal? Based on that I'll revise this code again

And then there is one more function used in the recurse code:

So, a lot of math is involved. I applied all these functions and replaced values and figured out some ranges of data that could fit the answer. Basically,
Range of input is between 1 and 50.
Enough, I can't do so much math for this.
I'll brute force :)
Takes input like this:

I can create a BASH one-liner to bruteforce this.
for i in {1..50}; do for j in {1..50}; do echo $i $j; echo $i $j | ./recurse.bin; done; done > output

So, correct values are 13 and 37
Last updated
Was this helpful?