Paste: newclay output

Author: kssreeram
Mode: c
Date: Thu, 9 Dec 2010 12:12:25
Plain Text |
#include <stdio.h>
#include <stdlib.h>
typedef int Int;
typedef char Bool;
void clay_lesser_(Int* a, Int* b, Bool* returned);
void clay_subtract(Int* a, Int* b, Int* returned);
void clay_multiply(Int* a, Int* b, Int* returned);
void clay_factorial(Int* n, Int* returned2);
void clay_main(Int* returned);
void clay_lesser_(Int* a, Int* b, Bool* returned) {
    *returned = *a < *b;
}
void clay_subtract(Int* a, Int* b, Int* returned) {
    *returned = *a - *b;
}
void clay_multiply(Int* a, Int* b, Int* returned) {
    *returned = *a * *b;
}
void clay_factorial(Int* n, Int* returned2) {
    Bool temp2;
    int temp3 = 2;
    clay_lesser_(n, &temp3, &temp2);
    if (temp2) {
        *returned2 = 1;
    }
    else {
        Int temp22;
        int temp4 = 1;
        clay_subtract(n, &temp4, &temp22);
        Int temp32;
        clay_factorial(&temp22, &temp32);
        clay_multiply(n, &temp32, returned2);
    }
}
void clay_main(Int* returned) {
    int temp = 5;
    clay_factorial(&temp, returned);
}
int main() {
    int result;
    clay_main(&result);
    printf("result = %d\n", result);
    return 0;
}

Annotation: use clay types for IR literals too

Author: kssreeram
Mode: c
Date: Thu, 9 Dec 2010 12:41:36
Plain Text |
#include <stdio.h>
#include <stdlib.h>
typedef int Int;
typedef char Bool;
void clay_lesser_(Int* a, Int* b, Bool* returned);
void clay_subtract(Int* a, Int* b, Int* returned);
void clay_multiply(Int* a, Int* b, Int* returned);
void clay_factorial(Int* n, Int* returned2);
void clay_main(Int* returned);
void clay_lesser_(Int* a, Int* b, Bool* returned) {
    *returned = *a < *b;
}
void clay_subtract(Int* a, Int* b, Int* returned) {
    *returned = *a - *b;
}
void clay_multiply(Int* a, Int* b, Int* returned) {
    *returned = *a * *b;
}
void clay_factorial(Int* n, Int* returned2) {
    Bool temp2;
    Int temp3 = 2;
    clay_lesser_(n, &temp3, &temp2);
    if (temp2) {
        *returned2 = 1;
    }
    else {
        Int temp22;
        Int temp4 = 1;
        clay_subtract(n, &temp4, &temp22);
        Int temp32;
        clay_factorial(&temp22, &temp32);
        clay_multiply(n, &temp32, returned2);
    }
}
void clay_main(Int* returned) {
    Int temp = 5;
    clay_factorial(&temp, returned);
}
int main() {
    Int result;
    clay_main(&result);
    printf("result = %d\n", result);
    return 0;
}

New Annotation

Summary:
Author:
Mode:
Body: