1# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file 2# for details. All rights reserved. Use of this source code is governed by a 3# BSD-style license that can be found in the LICENSE file. 4 5.class public LTest; 6 7.super Ljava/lang/Object; 8 9.method static fibonacci(I)I 10 .locals 2 11 12 if-eqz p0, :return 13 const/4 v0, 0x1 14 if-ne p0, v0, :calc 15 16 :return 17 return p0 18 19 :calc 20 add-int/lit8 v0, p0, -0x1 21 invoke-static {v0}, LTest;->fibonacci(I)I 22 move-result v0 23 add-int/lit8 v1, p0, -0x2 24 invoke-static {v1}, LTest;->fibonacci(I)I 25 move-result v1 26 add-int p0, v0, v1 27 goto :return 28.end method 29 30.method static fibonacciLong(J)J 31 .locals 4 32 33 const-wide/16 v2, 0x1 34 const-wide/16 v0, 0x0 35 cmp-long v0, p0, v0 36 if-eqz v0, :return 37 cmp-long v0, p0, v2 38 if-nez v0, :calc 39 40 :return 41 return-wide p0 42 43 :calc 44 sub-long v0, p0, v2 45 invoke-static {v0, v1}, LTest;->fibonacciLong(J)J 46 move-result-wide v0 47 const-wide/16 v2, 0x2 48 sub-long v2, p0, v2 49 invoke-static {v2, v3}, LTest;->fibonacciLong(J)J 50 move-result-wide v2 51 add-long p0, v0, v2 52 goto :return 53.end method 54 55.method static fibonacciJack(I)I 56 .locals 2 57 58 if-eqz p0, :return 59 const/4 v0, 0x1 60 if-ne p0, v0, :calc 61 62 :return 63 return p0 64 65 :calc 66 add-int/lit8 v0, p0, -0x1 67 invoke-static {v0}, LTest;->fibonacciJack(I)I 68 move-result v0 69 add-int/lit8 v1, p0, -0x2 70 invoke-static {v1}, LTest;->fibonacciJack(I)I 71 move-result v1 72 add-int/2addr v0, v1 73 return v0 74.end method 75 76.method static fibonacciLongJack(J)J 77 .locals 4 78 79 const-wide/16 v2, 0x1 80 const-wide/16 v0, 0x0 81 cmp-long v0, p0, v0 82 if-eqz v0, :return 83 cmp-long v0, p0, v2 84 if-nez v0, :calc 85 86 :return 87 return-wide p0 88 89 :calc 90 sub-long v0, p0, v2 91 invoke-static {v0, v1}, LTest;->fibonacciLongJack(J)J 92 move-result-wide v0 93 const-wide/16 v2, 0x2 94 sub-long v2, p0, v2 95 invoke-static {v2, v3}, LTest;->fibonacciLongJack(J)J 96 move-result-wide v2 97 add-long/2addr v0, v2 98 return-wide v0 99.end method 100 101.method public static main([Ljava/lang/String;)V 102 .registers 5 103 104 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 105 106 const/16 v1, 0xa 107 invoke-static {v1}, LTest;->fibonacci(I)I 108 move-result v1 109 invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(I)V 110 111 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 112 const-wide/16 v2, 0xa 113 invoke-static {v2, v3}, LTest;->fibonacciLong(J)J 114 move-result-wide v2 115 invoke-virtual {v0, v2, v3}, Ljava/io/PrintStream;->println(J)V 116 117 const/16 v1, 0xa 118 invoke-static {v1}, LTest;->fibonacciJack(I)I 119 move-result v1 120 invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(I)V 121 122 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 123 const-wide/16 v2, 0xa 124 invoke-static {v2, v3}, LTest;->fibonacciLongJack(J)J 125 move-result-wide v2 126 invoke-virtual {v0, v2, v3}, Ljava/io/PrintStream;->println(J)V 127 128 return-void 129.end method 130