ag.smali

.class public final Lcom/google/obf/ag;
.super Ljava/lang/Object;
.source "IMASDK"

# interfaces
.implements Lcom/google/obf/ak;


# static fields
.field private static final a:[B


# instance fields
.field private final b:Lcom/google/obf/da;

.field private final c:J

.field private d:J

.field private e:[B

.field private f:I

.field private g:I


# direct methods
.method static constructor <clinit>()V
    .registers 1

    const/16 v0, 0x1000

    new-array v0, v0, [B

    .line 84
    sput-object v0, Lcom/google/obf/ag;->a:[B

    return-void
.end method

.method public constructor <init>(Lcom/google/obf/da;JJ)V
    .registers 6

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p1, p0, Lcom/google/obf/ag;->b:Lcom/google/obf/da;

    .line 3
    iput-wide p2, p0, Lcom/google/obf/ag;->d:J

    .line 4
    iput-wide p4, p0, Lcom/google/obf/ag;->c:J

    const/16 p1, 0x2000

    new-array p1, p1, [B

    .line 5
    iput-object p1, p0, Lcom/google/obf/ag;->e:[B

    return-void
.end method

.method private a([BIIIZ)I
    .registers 7
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/InterruptedException;,
            Ljava/io/IOException;
        }
    .end annotation

    .line 73
    invoke-static {}, Ljava/lang/Thread;->interrupted()Z

    move-result v0

    if-nez v0, :cond_1e

    .line 75
    iget-object v0, p0, Lcom/google/obf/ag;->b:Lcom/google/obf/da;

    add-int/2addr p2, p4

    sub-int/2addr p3, p4

    invoke-interface {v0, p1, p2, p3}, Lcom/google/obf/da;->a([BII)I

    move-result p1

    const/4 p2, -0x1

    if-ne p1, p2, :cond_1c

    if-nez p4, :cond_16

    if-eqz p5, :cond_16

    return p2

    .line 79
    :cond_16
    new-instance p1, Ljava/io/EOFException;

    invoke-direct {p1}, Ljava/io/EOFException;-><init>()V

    throw p1

    :cond_1c
    add-int/2addr p4, p1

    return p4

    .line 74
    :cond_1e
    new-instance p1, Ljava/lang/InterruptedException;

    invoke-direct {p1}, Ljava/lang/InterruptedException;-><init>()V

    throw p1
.end method

.method private d([BII)I
    .registers 6

    .line 63
    iget v0, p0, Lcom/google/obf/ag;->g:I

    const/4 v1, 0x0

    if-nez v0, :cond_6

    return v1

    .line 65
    :cond_6
    invoke-static {v0, p3}, Ljava/lang/Math;->min(II)I

    move-result p3

    .line 66
    iget-object v0, p0, Lcom/google/obf/ag;->e:[B

    invoke-static {v0, v1, p1, p2, p3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 67
    invoke-direct {p0, p3}, Lcom/google/obf/ag;->f(I)V

    return p3
.end method

.method private d(I)V
    .registers 4

    .line 56
    iget v0, p0, Lcom/google/obf/ag;->f:I

    add-int/2addr v0, p1

    .line 57
    iget-object p1, p0, Lcom/google/obf/ag;->e:[B

    array-length v1, p1

    if-le v0, v1, :cond_15

    .line 58
    array-length v1, p1

    mul-int/lit8 v1, v1, 0x2

    invoke-static {v1, v0}, Ljava/lang/Math;->max(II)I

    move-result v0

    invoke-static {p1, v0}, Ljava/util/Arrays;->copyOf([BI)[B

    move-result-object p1

    iput-object p1, p0, Lcom/google/obf/ag;->e:[B

    :cond_15
    return-void
.end method

.method private e(I)I
    .registers 3

    .line 60
    iget v0, p0, Lcom/google/obf/ag;->g:I

    invoke-static {v0, p1}, Ljava/lang/Math;->min(II)I

    move-result p1

    .line 61
    invoke-direct {p0, p1}, Lcom/google/obf/ag;->f(I)V

    return p1
.end method

.method private f(I)V
    .registers 5

    .line 69
    iget v0, p0, Lcom/google/obf/ag;->g:I

    sub-int/2addr v0, p1

    iput v0, p0, Lcom/google/obf/ag;->g:I

    const/4 v1, 0x0

    .line 70
    iput v1, p0, Lcom/google/obf/ag;->f:I

    .line 71
    iget-object v2, p0, Lcom/google/obf/ag;->e:[B

    invoke-static {v2, p1, v2, v1, v0}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    return-void
.end method

.method private g(I)V
    .registers 6

    const/4 v0, -0x1

    if-eq p1, v0, :cond_9

    .line 82
    iget-wide v0, p0, Lcom/google/obf/ag;->d:J

    int-to-long v2, p1

    add-long/2addr v0, v2

    iput-wide v0, p0, Lcom/google/obf/ag;->d:J

    :cond_9
    return-void
.end method


# virtual methods
.method public a(I)I
    .registers 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 19
    invoke-direct {p0, p1}, Lcom/google/obf/ag;->e(I)I

    move-result v0

    if-nez v0, :cond_15

    .line 21
    sget-object v2, Lcom/google/obf/ag;->a:[B

    const/4 v3, 0x0

    array-length v0, v2

    .line 22
    invoke-static {p1, v0}, Ljava/lang/Math;->min(II)I

    move-result v4

    const/4 v5, 0x0

    const/4 v6, 0x1

    move-object v1, p0

    invoke-direct/range {v1 .. v6}, Lcom/google/obf/ag;->a([BIIIZ)I

    move-result v0

    .line 23
    :cond_15
    invoke-direct {p0, v0}, Lcom/google/obf/ag;->g(I)V

    return v0
.end method

.method public a([BII)I
    .registers 11
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 7
    invoke-direct {p0, p1, p2, p3}, Lcom/google/obf/ag;->d([BII)I

    move-result v0

    if-nez v0, :cond_10

    const/4 v5, 0x0

    const/4 v6, 0x1

    move-object v1, p0

    move-object v2, p1

    move v3, p2

    move v4, p3

    .line 9
    invoke-direct/range {v1 .. v6}, Lcom/google/obf/ag;->a([BIIIZ)I

    move-result v0

    .line 10
    :cond_10
    invoke-direct {p0, v0}, Lcom/google/obf/ag;->g(I)V

    return v0
.end method

.method public a()V
    .registers 2

    const/4 v0, 0x0

    .line 51
    iput v0, p0, Lcom/google/obf/ag;->f:I

    return-void
.end method

.method public a(IZ)Z
    .registers 10
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 25
    invoke-direct {p0, p1}, Lcom/google/obf/ag;->e(I)I

    move-result v0

    move v5, v0

    :goto_5
    const/4 v0, -0x1

    if-ge v5, p1, :cond_1a

    if-eq v5, v0, :cond_1a

    .line 27
    sget-object v2, Lcom/google/obf/ag;->a:[B

    neg-int v3, v5

    array-length v0, v2

    add-int/2addr v0, v5

    .line 28
    invoke-static {p1, v0}, Ljava/lang/Math;->min(II)I

    move-result v4

    move-object v1, p0

    move v6, p2

    .line 29
    invoke-direct/range {v1 .. v6}, Lcom/google/obf/ag;->a([BIIIZ)I

    move-result v5

    goto :goto_5

    .line 30
    :cond_1a
    invoke-direct {p0, v5}, Lcom/google/obf/ag;->g(I)V

    if-eq v5, v0, :cond_21

    const/4 p1, 0x1

    goto :goto_22

    :cond_21
    const/4 p1, 0x0

    :goto_22
    return p1
.end method

.method public a([BIIZ)Z
    .registers 12
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 12
    invoke-direct {p0, p1, p2, p3}, Lcom/google/obf/ag;->d([BII)I

    move-result v0

    move v5, v0

    :goto_5
    const/4 v0, -0x1

    if-ge v5, p3, :cond_14

    if-eq v5, v0, :cond_14

    move-object v1, p0

    move-object v2, p1

    move v3, p2

    move v4, p3

    move v6, p4

    .line 14
    invoke-direct/range {v1 .. v6}, Lcom/google/obf/ag;->a([BIIIZ)I

    move-result v5

    goto :goto_5

    .line 15
    :cond_14
    invoke-direct {p0, v5}, Lcom/google/obf/ag;->g(I)V

    if-eq v5, v0, :cond_1b

    const/4 p1, 0x1

    goto :goto_1c

    :cond_1b
    const/4 p1, 0x0

    :goto_1c
    return p1
.end method

.method public b()J
    .registers 5

    .line 53
    iget-wide v0, p0, Lcom/google/obf/ag;->d:J

    iget v2, p0, Lcom/google/obf/ag;->f:I

    int-to-long v2, v2

    add-long/2addr v0, v2

    return-wide v0
.end method

.method public b(I)V
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 32
    invoke-virtual {p0, p1, v0}, Lcom/google/obf/ag;->a(IZ)Z

    return-void
.end method

.method public b([BII)V
    .registers 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 17
    invoke-virtual {p0, p1, p2, p3, v0}, Lcom/google/obf/ag;->a([BIIZ)Z

    return-void
.end method

.method public b(IZ)Z
    .registers 10
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 40
    invoke-direct {p0, p1}, Lcom/google/obf/ag;->d(I)V

    .line 41
    iget v0, p0, Lcom/google/obf/ag;->g:I

    iget v1, p0, Lcom/google/obf/ag;->f:I

    sub-int/2addr v0, v1

    invoke-static {v0, p1}, Ljava/lang/Math;->min(II)I

    move-result v0

    move v5, v0

    :cond_d
    if-ge v5, p1, :cond_1f

    .line 43
    iget-object v2, p0, Lcom/google/obf/ag;->e:[B

    iget v3, p0, Lcom/google/obf/ag;->f:I

    move-object v1, p0

    move v4, p1

    move v6, p2

    invoke-direct/range {v1 .. v6}, Lcom/google/obf/ag;->a([BIIIZ)I

    move-result v5

    const/4 v0, -0x1

    if-ne v5, v0, :cond_d

    const/4 p1, 0x0

    return p1

    .line 46
    :cond_1f
    iget p2, p0, Lcom/google/obf/ag;->f:I

    add-int/2addr p2, p1

    iput p2, p0, Lcom/google/obf/ag;->f:I

    .line 47
    iget p1, p0, Lcom/google/obf/ag;->g:I

    invoke-static {p1, p2}, Ljava/lang/Math;->max(II)I

    move-result p1

    iput p1, p0, Lcom/google/obf/ag;->g:I

    const/4 p1, 0x1

    return p1
.end method

.method public b([BIIZ)Z
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    .line 34
    invoke-virtual {p0, p3, p4}, Lcom/google/obf/ag;->b(IZ)Z

    move-result p4

    if-nez p4, :cond_8

    const/4 p1, 0x0

    return p1

    .line 36
    :cond_8
    iget-object p4, p0, Lcom/google/obf/ag;->e:[B

    iget v0, p0, Lcom/google/obf/ag;->f:I

    sub-int/2addr v0, p3

    invoke-static {p4, v0, p1, p2, p3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    const/4 p1, 0x1

    return p1
.end method

.method public c()J
    .registers 3

    .line 54
    iget-wide v0, p0, Lcom/google/obf/ag;->d:J

    return-wide v0
.end method

.method public c(I)V
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 49
    invoke-virtual {p0, p1, v0}, Lcom/google/obf/ag;->b(IZ)Z

    return-void
.end method

.method public c([BII)V
    .registers 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/InterruptedException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 38
    invoke-virtual {p0, p1, p2, p3, v0}, Lcom/google/obf/ag;->b([BIIZ)Z

    return-void
.end method

.method public d()J
    .registers 3

    .line 55
    iget-wide v0, p0, Lcom/google/obf/ag;->c:J

    return-wide v0
.end method