1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15declare function print(arg:any, arg1?:any):string;
16
17class cpu {
18    public mode: number = 1;
19    constructor() {
20        this.mode = 4;
21    }
22    public static add(a: string):number {
23        let i : number = 3;
24        let b : string = a.substring(3);
25        print(b);
26        let d : number = b.charCodeAt(4);
27        print(a[i]);
28        print(b[i]);
29        return d;
30    }
31}
32
33function foo(a: string):number {
34	let b : string = a.substring(1);
35    let d : number = b.charCodeAt(1);
36    return d;
37}
38
39function foo1(a: string):number {
40    let i : number = 2;
41	let b : string = a.substring(1);
42    let d : number = b.charCodeAt(1);
43    print(a[i]);
44    print(b[i]);
45    return d;
46}
47var a : string = "12345678901234567890"
48var b : string = a.substring(1);
49print(foo(b));
50print(foo1(b));
51print(cpu.add(b));
52
53//this is a case from a fuzz test
54let v0 = 2 >= 1;
55let v1 = "hello"
56let v2 = v1.substring(v0, v1);
57print(v2)
58
59