I have this simple C program.

```
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>

bool foo (unsigned int a) {
    return (a > -2L);
}

bool bar (unsigned long a) {
    return (a > -2L);
}

int main() {
    printf("foo returned = %d\n", foo(99));
    printf("bar returned = %d\n", bar(99));
    return 0;
}

```

Output when I run this -

```
foo returned = 1
bar returned = 0

```

Recreated in godbolt [here](https://godbolt.org/z/hrYaW5Gbz)

My question is why does `foo(99)` return true but `bar(99)` return false.

To me it makes sense that `bar` would return false. For simplicity lets say longs are 8 bits, then (using twos complement for signed value):

```
99 == 0110 0011
-2 == unsigned 254 == 1111 1110

```

So clearly the CMP instruction will see that 1111 1110 is bigger and return false.

But I dont understand what is going on behind the scenes in the `foo` function. The assembly for `foo` seems to hardcode to always return `mov eax,0x1`. I would have expected `foo` to do something similar to `bar`. What is going on here?