Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • theo.putegnat/infosec-ecomp
  • damien.armillon/infosec-ecomp
  • mouhamed.sougou/infosec-ecomp
  • cidre-public/compilation/infosec-ecomp
4 results
Show changes
Showing
with 601 additions and 124 deletions
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(10)
SYM_RBRACKET
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_WHILE
SYM_LPARENTHESIS
SYM_IDENTIFIER(i)
SYM_LT
SYM_INTEGER(10)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_SEMICOLON
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_PLUS
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_RBRACE
SYM_INT
SYM_IDENTIFIER(sum)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_WHILE
SYM_LPARENTHESIS
SYM_IDENTIFIER(i)
SYM_LT
SYM_INTEGER(10)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_IDENTIFIER(sum)
SYM_ASSIGN
SYM_IDENTIFIER(sum)
SYM_PLUS
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_IDENTIFIER(i)
SYM_RBRACKET
SYM_SEMICOLON
SYM_IDENTIFIER(i)
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_PLUS
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_RBRACE
SYM_RETURN
SYM_IDENTIFIER(sum)
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
int main(int argc,char* argv[]){
int t[10];
int s[10];
t[10] = 3;
return s[0];
}
int main(int argc,char* argv[]){
int t[3];
int x = f(t,5);
return t[1];
}
int f(int* a, int i){
a[1] = i;
return 0;
}
int main(){
int t[3];
int x = f(t,5);
return t[1];
}
{"output": "", "error": null, "retval": 5}
\ No newline at end of file
{"output": "", "error": null, "retval": 5}
\ No newline at end of file
SYM_INT
SYM_IDENTIFIER(f)
SYM_LPARENTHESIS
SYM_INT
SYM_ASTERISK
SYM_IDENTIFIER(a)
SYM_COMMA
SYM_INT
SYM_IDENTIFIER(i)
SYM_RPARENTHESIS
SYM_LBRACE
SYM_IDENTIFIER(a)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_ASSIGN
SYM_IDENTIFIER(i)
SYM_SEMICOLON
SYM_RETURN
SYM_INTEGER(0)
SYM_SEMICOLON
SYM_RBRACE
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(3)
SYM_RBRACKET
SYM_SEMICOLON
SYM_INT
SYM_IDENTIFIER(x)
SYM_ASSIGN
SYM_IDENTIFIER(f)
SYM_LPARENTHESIS
SYM_IDENTIFIER(t)
SYM_COMMA
SYM_INTEGER(5)
SYM_RPARENTHESIS
SYM_SEMICOLON
SYM_RETURN
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
int main(int argc,char* argv[]){
int main(){
int t[2];
t[0] = 1;
t[1] = 2;
......
{"output": "", "error": null, "retval": 3}
\ No newline at end of file
{"output": "", "error": null, "retval": 3}
\ No newline at end of file
SYM_INT
SYM_IDENTIFIER(main)
SYM_LPARENTHESIS
SYM_RPARENTHESIS
SYM_LBRACE
SYM_INT
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(2)
SYM_RBRACKET
SYM_SEMICOLON
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_ASSIGN
SYM_INTEGER(1)
SYM_SEMICOLON
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_ASSIGN
SYM_INTEGER(2)
SYM_SEMICOLON
SYM_RETURN
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(0)
SYM_RBRACKET
SYM_PLUS
SYM_IDENTIFIER(t)
SYM_LBRACKET
SYM_INTEGER(1)
SYM_RBRACKET
SYM_SEMICOLON
SYM_RBRACE
SYM_EOF
int main(int argc,char* argv[]){
int a = atoi(argv[1]);
int b = atoi(argv[2]);
int t[10];
t[0] = 5;
t[1] = 7;
t[2] = 3;
t[3] = 8;
t[4] = 11;
t[5] = 1;
t[6] = 4;
t[7] = 7;
t[8] = 2;
t[9] = 9;
sort(t,0,9);
int i = 0;
while(i < 10){
print(t[i]);
i = i + 1;
}
return 0;
}
int sort(int* t, int begin, int end){
if (begin < end){
int pivot = begin;
pivot = partition(t, begin, end, pivot);
sort(t, begin, pivot-1);
sort(t, pivot+1, end);
}
}
int swap(int* t ,int i,int j){
int tmp = t[i];
int tmp = t[i];
t[i] = t[j];
t[j] = tmp;
return 0;
......@@ -49,3 +19,31 @@ int partition(int* t, int begin, int end, int pivot){
swap(t, end, j);
return j;
}
int sort(int* t, int begin, int end){
if (begin < end){
int pivot = begin;
pivot = partition(t, begin, end, pivot);
sort(t, begin, pivot-1);
sort(t, pivot+1, end);
}
}
int main(){
int t[10];
t[0] = 5;
t[1] = 7;
t[2] = 3;
t[3] = 8;
t[4] = 11;
t[5] = 1;
t[6] = 4;
t[7] = 7;
t[8] = 2;
t[9] = 9;
sort(t,0,9);
int i = 0;
while(i < 10){
print(t[i]);
i = i + 1;
}
return 0;
}
{"output": "1\n2\n3\n4\n5\n7\n7\n8\n9\n11\n", "error": null, "retval": 0}
\ No newline at end of file
{"output": "1\n2\n3\n4\n5\n7\n7\n8\n9\n11\n", "error": null, "retval": 0}
\ No newline at end of file
This diff is collapsed.
int main(int argc,char* argv[]){
int a = atoi(argv[1]);
int b = atoi(argv[2]);
int t[10];
t[0] = 5;
t[1] = 7;
t[2] = 3;
t[3] = 8;
t[4] = 12;
t[5] = 1;
t[6] = 4;
t[7] = 7;
t[8] = 2;
t[9] = 9;
sort(t,0,9);
int i = 0;
while(i < 10){
print(5000);
print(i);
print(t[i]);
i = i + 1;
}
return 0;
}
int sort(int* t, int begin, int end){
// print(10000+100*begin+end);
if (begin < end){
int pivot = begin;
pivot = partition(t, begin, end, pivot);
sort(t, begin, pivot-1);
sort(t, pivot+1, end);
}
}
int swap(int* t, int i,int j){
int tmp = t[i];
t[i] = t[j];
t[j] = tmp;
return 0;
}
int partition(int* t, int begin, int end, int pivot){
swap(t, pivot, end);
int j = begin;
int i = begin;
while(i <= end - 1){
//print(4000000+10000*i+end);
if(t[i] <= t[end]){
swap(t, i, j);
j = j + 1;
}
i = i + 1;
}
swap(t, end, j);
return j;
}
struct S {
int t[4];
};
int main(){
struct S s;
(s.t)[0] = 1;
print_int((s.t)[0]);
return (s.t)[0];
}
{"output": "1", "error": null, "retval": 1}
\ No newline at end of file
{"output": "1", "error": null, "retval": 1}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.