Skip to content

Instantly share code, notes, and snippets.

@jafingerhut
Created November 9, 2012 16:40
Show Gist options
  • Save jafingerhut/4046744 to your computer and use it in GitHub Desktop.
Save jafingerhut/4046744 to your computer and use it in GitHub Desktop.
AndroChef Java decompiler output of class file compiled from Cedric Greevey's Clojure code
package perf;
import clojure.lang.AFunction;
import clojure.lang.IFn;
import clojure.lang.Indexed;
import clojure.lang.Numbers;
import clojure.lang.RT;
import clojure.lang.Var;
import java.awt.image.BufferedImage;
import perf.core.foo.fn__14;
public final class core$foo extends AFunction {
public static final Var const__0 = (Var)RT.var("clojure.core", "double");
public static final Var const__1 = (Var)RT.var("clojure.core", "/");
public static final Object const__2 = Double.valueOf(2.0D);
public static final Object const__3 = Double.valueOf(2.0D);
public static final Var const__4 = (Var)RT.var("clojure.core", "-");
public static final Var const__5 = (Var)RT.var("clojure.core", "*");
public static final Object const__6 = Double.valueOf(0.1D);
public static final Var const__7 = (Var)RT.var("clojure.core", "inc");
public static final Var const__8 = (Var)RT.var("clojure.core", "+");
public static final Object const__9 = Long.valueOf(2L);
public static final Object const__10 = Double.valueOf(2.0D);
public static final Object const__11 = Double.valueOf(0.1D);
public static final Object const__12 = Double.valueOf(0.5D);
public static final Object const__13 = Long.valueOf(360L);
public static final Var const__14 = (Var)RT.var("clojure.core", "str");
public static final Var const__15 = (Var)RT.var("clojure.core", "seq");
public static final Var const__16 = (Var)RT.var("clojure.core", "range");
public static final Object const__17 = Long.valueOf(0L);
public static final Var const__18 = (Var)RT.var("clojure.core", "<");
public static final Var const__19 = (Var)RT.var("clojure.core", "int");
public static final Var const__20 = (Var)RT.var("clojure.core", "dec");
public static final Var const__21 = (Var)RT.var("clojure.core", "==");
public static final Object const__22 = Long.valueOf(256L);
public static final Object const__23 = Long.valueOf(65536L);
public static final Var const__24 = (Var)RT.var("clojure.core", "zero?");
public static final Var const__25 = (Var)RT.var("clojure.core", "rand");
public static final Var const__26 = (Var)RT.var("clojure.core", "rem");
public static final Var const__27 = (Var)RT.var("clojure.core", "bit-and");
public static final Object const__28 = Long.valueOf(16711680L);
public static final Object const__29 = Long.valueOf(65536L);
public static final Object const__30 = Long.valueOf(65280L);
public static final Object const__31 = Long.valueOf(256L);
public static final Object const__32 = Long.valueOf(255L);
public static final Var const__33 = (Var)RT.var("clojure.core", "unchecked-inc");
public static final Var const__34 = (Var)RT.var("clojure.core", "chunked-seq?");
public static final Var const__35 = (Var)RT.var("clojure.core", "chunk-first");
public static final Var const__36 = (Var)RT.var("clojure.core", "chunk-rest");
public static final Var const__37 = (Var)RT.var("clojure.core", "count");
public static final Var const__38 = (Var)RT.var("clojure.core", "first");
public static final Var const__39 = (Var)RT.var("clojure.core", "next");
public Object invoke(Object width, Object height, Object l10_mag, Object chunk_width, Object chunk_base_mag, Object deg_rot, Object chunk_name_digits, Object cached_objects, Object maybe_load_image, Object chunk_name_base, Object samples, Object chunk_height) {
BufferedImage out = new BufferedImage(RT.intCast((Number)width), RT.intCast((Number)height), BufferedImage.TYPE_INT_BGR);
double half_w = Numbers.divide(width, 2.0D);
double half_h = Numbers.divide(height, 2.0D);
double var10000 = Math.log(0.1D);
Object var10001 = l10_mag;
l10_mag = null;
double lnk = Numbers.multiply(var10000, Numbers.inc(var10001)) - Numbers.divide(Math.log(half_w * half_w + half_h * half_h), 2L);
double cconv = Numbers.divide(chunk_width, 2.0D * Math.PI);
Object var141 = chunk_base_mag;
chunk_base_mag = null;
double c_base_ln = Numbers.multiply(var141, Math.log(0.1D));
Object var10002 = deg_rot;
deg_rot = null;
double x_offset = Numbers.multiply(chunk_width, Numbers.add(0.5D, Numbers.divide(var10002, 360L)));
IFn var142 = (IFn)const__14.getRawRoot();
var10002 = chunk_name_digits;
chunk_name_digits = null;
Object fmtstr = var142.invoke("%0", var10002, "d");
var141 = cached_objects;
cached_objects = null;
var142 = (IFn)var141;
fn__14 var140 = new fn__14;
Object var10003 = fmtstr;
fmtstr = null;
Object var10004 = maybe_load_image;
maybe_load_image = null;
Object var10005 = chunk_name_base;
chunk_name_base = null;
var140.<init>(var10003, var10004, var10005);
Object cached_load_chunk = var142.invoke(var140);
var142 = (IFn)const__15.getRawRoot();
IFn var136 = (IFn)const__16.getRawRoot();
var10002 = height;
height = null;
Object seq_16 = var142.invoke(var136.invoke(var10002));
Object chunk_17 = null;
long count_18 = 0L;
long i_19 = 0L;
while(true) {
Object temp__3974__auto__38;
Object seq_161;
Object oy;
int oy1;
double ix1;
double samples1;
double sx;
double sy1;
double ix3;
double g;
double b;
double iy3;
double iy2;
double ix4;
double r1;
int chunk_num;
int chunk_num1;
int smo;
double ns;
int seq_20;
double iy4;
int ox;
double argz_P;
boolean and__3822__auto__34;
double lnz_P;
int nsx2;
int nsy1;
double r2;
double r3;
int chunk_y;
double g2;
Object chunk_x2;
long var137;
Object var139;
double var143;
long var133;
double var135;
long var134;
int var152;
long var144;
long var145;
while(i_19 < count_18) {
temp__3974__auto__38 = ((Indexed)chunk_17).nth(RT.intCast(i_19));
seq_161 = ((IFn)const__15.getRawRoot()).invoke(((IFn)const__16.getRawRoot()).invoke(width));
oy = null;
long count_26 = 0L;
long i_27 = 0L;
while(true) {
Object temp__3974__auto__32;
while(i_27 < count_26) {
temp__3974__auto__32 = ((Indexed)oy).nth(RT.intCast(i_27));
var141 = temp__3974__auto__32;
temp__3974__auto__32 = null;
int seq_24 = RT.intCast(var141);
int temp__3974__auto__37 = RT.intCast(temp__3974__auto__38);
double ix = Numbers.minus((long)seq_24, half_w);
double iy = Numbers.minus((long)temp__3974__auto__37, half_h);
ix1 = RT.doubleCast(samples);
oy1 = RT.intCast(ix1 - 1.0D);
long ix2 = (long)RT.intCast(0L);
long iy1 = (long)RT.intCast(0L);
samples1 = (double)0L;
double sy = (double)0L;
sx = (double)0L;
sy1 = (double)0L;
while(!Numbers.equiv(iy1, ix1)) {
int nsx = RT.intCast(ix2 == (long)oy1?0L:Numbers.inc(ix2));
int nsy = RT.intCast((long)nsx == 0L?Numbers.inc(iy1):iy1);
g = ix + Numbers.divide(Numbers.add(ix2, ((IFn)const__25.getRawRoot()).invoke()), ix1);
b = iy + Numbers.divide(Numbers.add(iy1, ((IFn)const__25.getRawRoot()).invoke()), ix1);
boolean nsx1 = Numbers.equiv(g, 0L);
if(nsx1?Numbers.equiv(b, 0L):nsx1) {
var133 = (long)nsx;
var137 = (long)nsy;
sy1 = sy1;
sx = sx;
sy = sy;
samples1 = samples1;
iy1 = var137;
ix2 = var133;
} else {
label190: {
ix3 = lnk + Numbers.divide(Math.log(g * g + b * b), 2L);
iy2 = Math.PI + Math.atan2(b, g);
ix4 = iy2 * cconv;
iy3 = (c_base_ln - ix3) * cconv;
int and__3822__auto__36 = RT.intCast(Numbers.divide(iy3, chunk_height));
int chunk_x = RT.intCast(Numbers.remainder((long)RT.intCast(ix4 + x_offset), chunk_width));
chunk_num = RT.intCast(Numbers.minus(iy3, Numbers.multiply(chunk_height, (long)and__3822__auto__36)));
Object chunk_x1 = ((IFn)cached_load_chunk).invoke(Integer.valueOf(and__3822__auto__36));
if(chunk_x1 != null) {
if(chunk_x1 != Boolean.FALSE) {
var141 = chunk_x1;
chunk_x1 = null;
var141 = Integer.valueOf(((BufferedImage)var141).getRGB(chunk_x, chunk_num));
break label190;
}
}
var141 = const__17;
}
chunk_num1 = RT.intCast(var141);
double r = Numbers.add(sy, Numbers.divide((long)chunk_num1 & 16711680L, 65536L));
double g1 = Numbers.add(sx, Numbers.divide((long)chunk_num1 & 65280L, 256L));
r1 = Numbers.add(sy1, (long)chunk_num1 & 255L);
var133 = (long)nsx;
var137 = (long)nsy;
var135 = samples1 + 1.0D;
sy1 = r1;
sx = g1;
sy = r;
samples1 = var135;
iy1 = var137;
ix2 = var133;
}
}
((BufferedImage)out).setRGB(seq_24, temp__3974__auto__37, RT.intCast(Numbers.add((long)RT.intCast(sy1 / samples1), Numbers.add(Numbers.multiply(256L, (long)RT.intCast(sx / samples1)), Numbers.multiply(65536L, (long)RT.intCast(sy / samples1))))));
var141 = null;
++i_27;
count_26 = count_26;
oy = oy;
seq_161 = seq_161;
}
temp__3974__auto__32 = ((IFn)const__15.getRawRoot()).invoke(seq_161);
if(temp__3974__auto__32 == null) {
break;
}
if(temp__3974__auto__32 == Boolean.FALSE) {
break;
}
var141 = temp__3974__auto__32;
temp__3974__auto__32 = null;
Object var138 = var141;
var141 = ((IFn)const__34.getRawRoot()).invoke(var138);
if(var141 != null) {
if(var141 != Boolean.FALSE) {
var139 = ((IFn)const__35.getRawRoot()).invoke(var138);
var142 = (IFn)const__36.getRawRoot();
var10001 = var138;
var138 = null;
var141 = var142.invoke(var10001);
var10001 = var139;
var10002 = var139;
var139 = null;
var134 = (long)RT.intCast(RT.count(var10002));
i_27 = (long)RT.intCast(0L);
count_26 = var134;
oy = var10001;
seq_161 = var141;
continue;
}
}
var139 = ((IFn)const__38.getRawRoot()).invoke(var138);
var141 = var139;
var139 = null;
seq_20 = RT.intCast(var141);
ox = RT.intCast(temp__3974__auto__38);
ix1 = Numbers.minus((long)seq_20, half_w);
iy4 = Numbers.minus((long)ox, half_h);
var143 = RT.doubleCast(samples);
smo = RT.intCast(var143 - 1.0D);
var144 = (long)RT.intCast(0L);
var145 = (long)RT.intCast(0L);
sx = (double)0L;
sy1 = (double)0L;
ns = (double)0L;
r2 = (double)0L;
while(!Numbers.equiv(var145, var143)) {
nsx2 = RT.intCast(var144 == (long)smo?0L:Numbers.inc(var144));
nsy1 = RT.intCast((long)nsx2 == 0L?Numbers.inc(var145):var145);
ix3 = ix1 + Numbers.divide(Numbers.add(var144, ((IFn)const__25.getRawRoot()).invoke()), var143);
iy2 = iy4 + Numbers.divide(Numbers.add(var145, ((IFn)const__25.getRawRoot()).invoke()), var143);
and__3822__auto__34 = Numbers.equiv(ix3, 0L);
if(and__3822__auto__34?Numbers.equiv(iy2, 0L):and__3822__auto__34) {
var133 = (long)nsx2;
var137 = (long)nsy1;
r2 = r2;
ns = ns;
sy1 = sy1;
sx = sx;
var145 = var137;
var144 = var133;
} else {
label214: {
ix4 = lnk + Numbers.divide(Math.log(ix3 * ix3 + iy2 * iy2), 2L);
iy3 = Math.PI + Math.atan2(iy2, ix3);
lnz_P = iy3 * cconv;
argz_P = (c_base_ln - ix4) * cconv;
chunk_num = RT.intCast(Numbers.divide(argz_P, chunk_height));
var152 = RT.intCast(Numbers.remainder((long)RT.intCast(lnz_P + x_offset), chunk_width));
chunk_num1 = RT.intCast(Numbers.minus(argz_P, Numbers.multiply(chunk_height, (long)chunk_num)));
chunk_x2 = ((IFn)cached_load_chunk).invoke(Integer.valueOf(chunk_num));
if(chunk_x2 != null) {
if(chunk_x2 != Boolean.FALSE) {
var141 = chunk_x2;
chunk_x2 = null;
var141 = Integer.valueOf(((BufferedImage)var141).getRGB(var152, chunk_num1));
break label214;
}
}
var141 = const__17;
}
chunk_y = RT.intCast(var141);
r1 = Numbers.add(sy1, Numbers.divide((long)chunk_y & 16711680L, 65536L));
g2 = Numbers.add(ns, Numbers.divide((long)chunk_y & 65280L, 256L));
r3 = Numbers.add(r2, (long)chunk_y & 255L);
var133 = (long)nsx2;
var137 = (long)nsy1;
var135 = sx + 1.0D;
r2 = r3;
ns = g2;
sy1 = r1;
sx = var135;
var145 = var137;
var144 = var133;
}
}
((BufferedImage)out).setRGB(seq_20, ox, RT.intCast(Numbers.add((long)RT.intCast(r2 / sx), Numbers.add(Numbers.multiply(256L, (long)RT.intCast(ns / sx)), Numbers.multiply(65536L, (long)RT.intCast(sy1 / sx))))));
var141 = null;
var142 = (IFn)const__39.getRawRoot();
var10001 = var138;
var138 = null;
var141 = var142.invoke(var10001);
i_27 = 0L;
count_26 = 0L;
oy = null;
seq_161 = var141;
}
var141 = null;
++i_19;
count_18 = count_18;
chunk_17 = chunk_17;
seq_16 = seq_16;
}
temp__3974__auto__38 = ((IFn)const__15.getRawRoot()).invoke(seq_16);
if(temp__3974__auto__38 == null) {
break;
}
if(temp__3974__auto__38 == Boolean.FALSE) {
break;
}
var141 = temp__3974__auto__38;
temp__3974__auto__38 = null;
seq_161 = var141;
var141 = ((IFn)const__34.getRawRoot()).invoke(seq_161);
if(var141 != null) {
if(var141 != Boolean.FALSE) {
oy = ((IFn)const__35.getRawRoot()).invoke(seq_161);
var142 = (IFn)const__36.getRawRoot();
var10001 = seq_161;
seq_161 = null;
var141 = var142.invoke(var10001);
var10001 = oy;
var10002 = oy;
oy = null;
var134 = (long)RT.intCast(RT.count(var10002));
i_19 = (long)RT.intCast(0L);
count_18 = var134;
chunk_17 = var10001;
seq_16 = var141;
continue;
}
}
oy = ((IFn)const__38.getRawRoot()).invoke(seq_161);
Object seq_201 = ((IFn)const__15.getRawRoot()).invoke(((IFn)const__16.getRawRoot()).invoke(width));
Object chunk_21 = null;
long count_22 = 0L;
long i_23 = 0L;
while(true) {
while(i_23 < count_22) {
var139 = ((Indexed)chunk_21).nth(RT.intCast(i_23));
var141 = var139;
var139 = null;
seq_20 = RT.intCast(var141);
ox = RT.intCast(oy);
ix1 = Numbers.minus((long)seq_20, half_w);
iy4 = Numbers.minus((long)ox, half_h);
var143 = RT.doubleCast(samples);
smo = RT.intCast(var143 - 1.0D);
var144 = (long)RT.intCast(0L);
var145 = (long)RT.intCast(0L);
sx = (double)0L;
sy1 = (double)0L;
ns = (double)0L;
r2 = (double)0L;
while(!Numbers.equiv(var145, var143)) {
nsx2 = RT.intCast(var144 == (long)smo?0L:Numbers.inc(var144));
nsy1 = RT.intCast((long)nsx2 == 0L?Numbers.inc(var145):var145);
ix3 = ix1 + Numbers.divide(Numbers.add(var144, ((IFn)const__25.getRawRoot()).invoke()), var143);
iy2 = iy4 + Numbers.divide(Numbers.add(var145, ((IFn)const__25.getRawRoot()).invoke()), var143);
and__3822__auto__34 = Numbers.equiv(ix3, 0L);
if(and__3822__auto__34?Numbers.equiv(iy2, 0L):and__3822__auto__34) {
var133 = (long)nsx2;
var137 = (long)nsy1;
r2 = r2;
ns = ns;
sy1 = sy1;
sx = sx;
var145 = var137;
var144 = var133;
} else {
label244: {
ix4 = lnk + Numbers.divide(Math.log(ix3 * ix3 + iy2 * iy2), 2L);
iy3 = Math.PI + Math.atan2(iy2, ix3);
lnz_P = iy3 * cconv;
argz_P = (c_base_ln - ix4) * cconv;
chunk_num = RT.intCast(Numbers.divide(argz_P, chunk_height));
var152 = RT.intCast(Numbers.remainder((long)RT.intCast(lnz_P + x_offset), chunk_width));
chunk_num1 = RT.intCast(Numbers.minus(argz_P, Numbers.multiply(chunk_height, (long)chunk_num)));
chunk_x2 = ((IFn)cached_load_chunk).invoke(Integer.valueOf(chunk_num));
if(chunk_x2 != null) {
if(chunk_x2 != Boolean.FALSE) {
var141 = chunk_x2;
chunk_x2 = null;
var141 = Integer.valueOf(((BufferedImage)var141).getRGB(var152, chunk_num1));
break label244;
}
}
var141 = const__17;
}
chunk_y = RT.intCast(var141);
r1 = Numbers.add(sy1, Numbers.divide((long)chunk_y & 16711680L, 65536L));
g2 = Numbers.add(ns, Numbers.divide((long)chunk_y & 65280L, 256L));
r3 = Numbers.add(r2, (long)chunk_y & 255L);
var133 = (long)nsx2;
var137 = (long)nsy1;
var135 = sx + 1.0D;
r2 = r3;
ns = g2;
sy1 = r1;
sx = var135;
var145 = var137;
var144 = var133;
}
}
((BufferedImage)out).setRGB(seq_20, ox, RT.intCast(Numbers.add((long)RT.intCast(r2 / sx), Numbers.add(Numbers.multiply(256L, (long)RT.intCast(ns / sx)), Numbers.multiply(65536L, (long)RT.intCast(sy1 / sx))))));
var141 = null;
++i_23;
count_22 = count_22;
chunk_21 = chunk_21;
seq_201 = seq_201;
}
var139 = ((IFn)const__15.getRawRoot()).invoke(seq_201);
if(var139 == null) {
break;
}
if(var139 == Boolean.FALSE) {
break;
}
var141 = var139;
var139 = null;
Object var131 = var141;
var141 = ((IFn)const__34.getRawRoot()).invoke(var131);
Object var130;
if(var141 != null) {
if(var141 != Boolean.FALSE) {
var130 = ((IFn)const__35.getRawRoot()).invoke(var131);
var142 = (IFn)const__36.getRawRoot();
var10001 = var131;
var131 = null;
var141 = var142.invoke(var10001);
var10001 = var130;
var10002 = var130;
var130 = null;
var134 = (long)RT.intCast(RT.count(var10002));
i_23 = (long)RT.intCast(0L);
count_22 = var134;
chunk_21 = var10001;
seq_201 = var141;
continue;
}
}
var130 = ((IFn)const__38.getRawRoot()).invoke(var131);
var141 = var130;
var130 = null;
int ox1 = RT.intCast(var141);
oy1 = RT.intCast(oy);
var143 = Numbers.minus((long)ox1, half_w);
double var146 = Numbers.minus((long)oy1, half_h);
samples1 = RT.doubleCast(samples);
int smo1 = RT.intCast(samples1 - 1.0D);
long var147 = (long)RT.intCast(0L);
long var148 = (long)RT.intCast(0L);
ns = (double)0L;
r2 = (double)0L;
g = (double)0L;
b = (double)0L;
while(!Numbers.equiv(var148, samples1)) {
int var150 = RT.intCast(var147 == (long)smo1?0L:Numbers.inc(var147));
int nsy2 = RT.intCast((long)var150 == 0L?Numbers.inc(var148):var148);
ix4 = var143 + Numbers.divide(Numbers.add(var147, ((IFn)const__25.getRawRoot()).invoke()), samples1);
iy3 = var146 + Numbers.divide(Numbers.add(var148, ((IFn)const__25.getRawRoot()).invoke()), samples1);
boolean var151 = Numbers.equiv(ix4, 0L);
if(var151?Numbers.equiv(iy3, 0L):var151) {
var133 = (long)var150;
var137 = (long)nsy2;
b = b;
g = g;
r2 = r2;
ns = ns;
var148 = var137;
var147 = var133;
} else {
label268: {
lnz_P = lnk + Numbers.divide(Math.log(ix4 * ix4 + iy3 * iy3), 2L);
argz_P = Math.PI + Math.atan2(iy3, ix4);
double x = argz_P * cconv;
double y = (c_base_ln - lnz_P) * cconv;
chunk_num1 = RT.intCast(Numbers.divide(y, chunk_height));
int var132 = RT.intCast(Numbers.remainder((long)RT.intCast(x + x_offset), chunk_width));
chunk_y = RT.intCast(Numbers.minus(y, Numbers.multiply(chunk_height, (long)chunk_num1)));
Object chunk = ((IFn)cached_load_chunk).invoke(Integer.valueOf(chunk_num1));
if(chunk != null) {
if(chunk != Boolean.FALSE) {
var141 = chunk;
chunk = null;
var141 = Integer.valueOf(((BufferedImage)var141).getRGB(var132, chunk_y));
break label268;
}
}
var141 = const__17;
}
int pixel = RT.intCast(var141);
r3 = Numbers.add(r2, Numbers.divide((long)pixel & 16711680L, 65536L));
double g3 = Numbers.add(g, Numbers.divide((long)pixel & 65280L, 256L));
double b1 = Numbers.add(b, (long)pixel & 255L);
var133 = (long)var150;
var137 = (long)nsy2;
var135 = ns + 1.0D;
b = b1;
g = g3;
r2 = r3;
ns = var135;
var148 = var137;
var147 = var133;
}
}
((BufferedImage)out).setRGB(ox1, oy1, RT.intCast(Numbers.add((long)RT.intCast(b / ns), Numbers.add(Numbers.multiply(256L, (long)RT.intCast(g / ns)), Numbers.multiply(65536L, (long)RT.intCast(r2 / ns))))));
var141 = null;
var142 = (IFn)const__39.getRawRoot();
var10001 = var131;
var131 = null;
var141 = var142.invoke(var10001);
i_23 = 0L;
count_22 = 0L;
chunk_21 = null;
seq_201 = var141;
}
var141 = null;
var142 = (IFn)const__39.getRawRoot();
var10001 = seq_161;
seq_161 = null;
var141 = var142.invoke(var10001);
i_19 = 0L;
count_18 = 0L;
chunk_17 = null;
seq_16 = var141;
}
var141 = null;
BufferedImage var149 = out;
out = null;
return var149;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment