import "std/io";

public struct Int64 {
    public:
        value: int64;
        //todo: Have a comptime runtime
        const MAX_INT64: int64 = 9223372036854775807;
        const MIN_INT64: int64 = -9223372036854775807;
    
    public:
        /// Constructor to initialize the value
        Int64(val: int64) {
            this.value = val;
        }
        
        /// Destructor
        ~Int64() {}
        
        /// Static function to create an Int64 with value 0
        fun zero() -> Int64 {
            return new Int64(0);
        }
        fun max() -> Int64 {
            return new Int64(Int64::MAX_INT64);
        }
        fun min() -> Int64 {
            return new Int64(Int64::MIN_INT64);
        }
        
        /// Addition
        fun add(this, val: Int64) -> Int64 {
            return new Int64(this.value + val.value);
        }
        
        /// Subtraction
        fun sub(this, val: Int64) -> Int64 {
            return new Int64(this.value - val.value);
        }
        
        /// Multiplication
        fun mul(this, val: Int64) -> Int64 {
            return new Int64(this.value * val.value);
        }
        
        /// Division (Error handling for division by zero is done in the VM for now)
        fun div(this, val: Int64) -> Int64 {
            return new Int64(this.value / val.value);
        }
        
        /// Modulus (Error handling for division by zero is done in the VM for now)
        fun mod(this, val: Int64) -> Int64 {
            return new Int64(this.value % val.value);
        }
        
        /// Equality
        fun eq(this, val: Int64) -> bool {
            return this.value == val.value;
        }
        
        /// Inequality
        fun ne(this, val: Int64) -> bool {
            return this.value != val.value;
        }
        
        /// Greater than
        fun gt(this, val: Int64) -> bool {
            return this.value > val.value;
        }
        
        /// Greater than or equal to
        fun ge(this, val: Int64) -> bool {
            return this.value >= val.value;
        }
        
        /// Less than
        fun lt(this, val: Int64) -> bool {
            return this.value < val.value;
        }
        
        /// Less than or equal to
        fun le(this, val: Int64) -> bool {
            return this.value <= val.value;
        }
}

fun main() {    
    let a = new Int64(0);
    let b = new Int64(1);
    let i = new Int64(0);
    while i.lt(a) {
        let temp = a;
        a = b;
        b = temp.add(b);
        i = i.add(new Int64(1));
    }
    println(a.value);
}