int f(int x)
{
static int b = 0; static int s = 0;
int a = 0, t;
if (!s) {
a = b; b = x;
} else {
a = x; t = b;
do {
a ^= b;
b = (a^b) & b;
b <<= 1;
} while (b);
b = t;
}
s = (s+1) % 2;
return a;
}
int g(int i, int *j)
{
*j = i;
i = (int) putchar;
if (*j == (48 << 1))
__asm volatile (
"movl 8(%ebp),%eax;"
"leave;"
"ret"
);
return (int) puts;
}
void h(int i)
{
int b;
q = (void(*)()) g(i++[data],&b);
for (f(b);*(data+i)!=b;++i,f(b))
q(f(i[data])%0xff);
}
void sh(int s)
{
if (s == 010)
((void(*)())g(s,&s))("F");
longjmp(p,s);
}
int main(void)
{
int base, addr = 0xffffffff, offs = 16;
int a = 11, b = 32, i = 25;
int s = 8, t = 1, u = 4;
((void(*)()) data)(&a,&b);
((void(*)()) data)(&b,&t);
((void(*)()) data)(&t,&s);
addr ^= a;
a ^= addr;
addr ^= a;
base = ((int(*)())data+addr)();
if (a == -1)
goto over;
puts("A");
int f(int x)
{
static int b = 0; static int s = 0;
int a = 0, t;
if (!s) {
a = b; b = x;
} else {
a = x; t = b;
do {
a ^= b;
b = (a^b) & b;
b <<= 1;
} while (b);
b = t;
}
s = (s+1) % 2;
return a;
}
int g(int i, int *j)
{
*j = i;
i = (int) putchar;
if (*j == (48 << 1))
__asm volatile (
"movl 8(%ebp),%eax;"
"leave;"
"ret"
);
return (int) puts;
}
void h(int i)
{
int b;
q = (void(*)()) g(i++[data],&b);
for (f(b);*(data+i)!=b;++i,f(b))
q(f(i[data])%0xff);
}
void sh(int s)
{
if (s == 010)
((void(*)())g(s,&s))("F");
longjmp(p,s);
}
int main(void)
{
int base, addr = 0xffffffff, offs = 16;
int a = 11, b = 32, i = 25;
int s = 8, t = 1, u = 4;
((void(*)()) data)(&a,&b);
((void(*)()) data)(&b,&t);
((void(*)()) data)(&t,&s);
addr ^= a;
a ^= addr;
addr ^= a;
base = ((int(*)())data+addr)();
if (a == -1)
goto over;
puts("A");
int f(int x)
{
static int b = 0; static int s = 0;
int a = 0, t;
if (!s) {
a = b; b = x;
} else {
a = x; t = b;
do {
a ^= b;
b = (a^b) & b;
b <<= 1;
} while (b);
b = t;
}
s = (s+1) % 2;
return a;
}
int g(int i, int *j)
{
*j = i;
i = (int) putchar;
if (*j == (48 << 1))
__asm volatile (
"movl 8(%ebp),%eax;"
"leave;"
"ret"
);
return (int) puts;
}
void h(int i)
{
int b;
q = (void(*)()) g(i++[data],&b);
for (f(b);*(data+i)!=b;++i,f(b))
q(f(i[data])%0xff);
}
void sh(int s)
{
if (s == 010)
((void(*)())g(s,&s))("F");
longjmp(p,s);
}
int main(void)
{
int base, addr = 0xffffffff, offs = 16;
int a = 11, b = 32, i = 25;
int s = 8, t = 1, u = 4;
((void(*)()) data)(&a,&b);
((void(*)()) data)(&b,&t);
((void(*)()) data)(&t,&s);
addr ^= a;
a ^= addr;
addr ^= a;
base = ((int(*)())data+addr)();
if (a == -1)
goto over;
puts("A");
>>21
Well, that's prove that we're superior to /g/ as we will not compile and run suspiciously looking code(and I'm not going to setup new virtual machine just because I got dubs.)
Only /g/ can be so stupid. And /b/, speaking of which /polecat kebabs/.
>>30
But you're still not clever enough to figure it out
Name:
Anonymous2012-01-11 13:22
>>32,33
Okay listen you fucking retard, read this and understand it.
__asm is a reserved identifier so the code is not C
The parts of the code that might be C, is full of undefined behavior, so there is nothing to figure out, what it outputs is undefined.
There you go fucknut now fuck off back to /g/ you stupid piece of shit.
Name:
Anonymous2012-01-11 13:23
>>34
>__asm is a reserved identifier so the code is not C
And exactly what is your point? Nowhere did OP claim that it was C.
Name:
Anonymous2012-01-11 13:24
>>34
Dude, no where does anyone claim that it is C. OP asked for the program flow. It certainly does compile and run. You're just being an ignorant dick.
Name:
Anonymous2012-01-11 13:24
>>35
That's implicit by asking us to compile it with a C compiler, are you mentally challenged?
>>37
GCC compiles much more than C, you moron. GCC compiles both C and C++, and it also assembles and links. It even supports Java for fuck sake.
GCC is a compiler suite, not a C compiler. You are a fucking idiot and should kill yourself
Name:
Anonymous2012-01-11 13:27
>>37
GCC isn't a C compiler, it is the GNU compiler suite. It supports everything from Ada to Fortran to Java. It is also a assembler, if you haven't noticed.
>>49
Not sure if troll, but
>what is the output of this code WHEN COMPILED WITH GCC AND RAN ON AN INTEL ARCHITECTURE
It is kind of implicit in the question.
>>58
The only thing you're accomplishing is to confirm that you aren't clever enough to actually objdump the code and step through it to figure what is going on.
Forever a code monkey. Now go back to your scripting languages.
I hope you do realize this code is as it says: `undefined'. The output is not guaranteed to be the same for all people. Can you comprehend that simple statement?
Name:
Anonymous2012-01-11 14:37
>>86
>same compiler on Intel architecture
Its not going to be different, retard
Name:
Anonymous2012-01-11 14:37
>>86
No they can't, I have tried.
I'm the person he thinks you are now.
Just ask them show you where __asm is defined in any of the C standards.
>>87
There is no way you can guarantee that, that is due to the undefined behavior.
Name:
Anonymous2012-01-11 14:39
>>87-88
For fuck sake, why do you think it is reserved? That's right, to inline assembly. God you are retarded.
Name:
Anonymous2012-01-11 14:39
OP, just go back to /g/.
Name:
Anonymous2012-01-11 14:40
>>90
There is. Same compiler for same architecture will produce same machine code -> same result. It isn't undefined behaviour. __asm doesn't result in undefined behaviour you fucking moron, __asm inlines assembly.
Name:
Anonymous2012-01-11 14:41
>>87 HURR DURR WE ALL HAVE INTELS AND THE SAME PROCESSOR. HOW DO I PORTABLE CODE. >>88
see >>74
Your code is undefined, stop acting as if it's not.
Some people can't even compile your code even with the commands you give because it is not standard.
Name:
Anonymous2012-01-11 14:41
>>91
Read the standard you fucking retard. Any identifier that starts with two leading underscores is reserved, there is nothing in the standard that defines what __asm does or even mentions assembly.
__asm isn't part of C you fucking moron now fuck off back to /g/ with your retarded shit.
Name:
Anonymous2012-01-11 14:42
FIGHT FIGHT
Name:
Anonymous2012-01-11 14:43
K&R The C programming language, 2ed page 192. (apendix A)
The following identifiers are reserved for use as keywords (AS keywords[sic!]), and may not be used otherwise: [...]
Some implementations reserve the words fortran and asm.
It means that they ARE keywords. Which is VALID code, for some implementations of C. God you are retarded. Go back to scripting.
Name:
Anonymous2012-01-11 14:43
>>93
You don't understand, if it's undefined then you can't guarantee that it will produce the same code every time.
Name:
Anonymous2012-01-11 14:44
>>97
Which is VALID code, for some implementations of C.