diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2025-08-04 19:53:58 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2025-08-04 19:53:58 (GMT) |
commit | 1c7c6cdeae20e824ad8447daec4dc12b3b286def (patch) | |
tree | 41e2a3e9e4fa5b10306bae6d565f0f2db5980982 /valid/code-0016.smali |
Initial version.
Diffstat (limited to 'valid/code-0016.smali')
-rw-r--r-- | valid/code-0016.smali | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/valid/code-0016.smali b/valid/code-0016.smali new file mode 100644 index 0000000..6b2b66e --- /dev/null +++ b/valid/code-0016.smali @@ -0,0 +1,83 @@ + +.class public Lcom/example/BytecodeDemo; + +.super Ljava/lang/Object; + +.method public constructor <init>()V + .registers 1 + + # Data handling + sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; + const-string v1, "Hello, World!" + invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V + return-void +.end method + +.method public static add(I I)I + .registers 2 + + # Arithmetic and logic operations + add-int v0, p0, p1 + return v0 +.end method + +.method public static multiply(I I)I + .registers 3 + + # Arithmetic and logic operations + mul-int v0, p0, p1 + return v0 +.end method + +.method public static compare(I I)Z + .registers 3 + + # Arithmetic and logic operations + cmp-long v0, p0, p1 + if-nez v0, :cond_0 + const/4 v0, 0x1 + return v0 + + :cond_0 + const/4 v0, 0x0 + return v0 +.end method + +.method public static loop(I)V + .registers 3 + + # Control flow operations + const/16 v0, 0x0 + :goto_0 + if-gez p0, :cond_0 + invoke-static {p0}, Lcom/example/BytecodeDemo;->add(I)I + move-result p0 + add-int/lit8 v0, v0, 1 + goto :goto_0 + + :cond_0 + return-void +.end method + +.method public static printArray([Ljava/lang/String;)V + .registers 3 + + # Control flow operations + const/4 v0, 0x0 + array-length v1, p0 + if-gez p0, :cond_0 + goto :goto_1 + + :loop_0 + aget-object v2, p0, v0 + sget-object v3, Ljava/lang/System;->out:Ljava/io/PrintStream; + invoke-virtual {v3, v2}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V + add-int/lit8 v0, v0, 1 + goto :loop_0 + + :cond_0 + return-void + + :goto_1 + return-void +.end method |