Skip to content

Instantly share code, notes, and snippets.

@danwatt
Created December 8, 2022 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danwatt/65d598d59a249866ab9f1061352cb6da to your computer and use it in GitHub Desktop.
Save danwatt/65d598d59a249866ab9f1061352cb6da to your computer and use it in GitHub Desktop.
/*
* Decompiled with CFR 0.150.
*
* Could not load the following classes:
* kotlin.Metadata
* kotlin.ResultKt
* kotlin.Unit
* kotlin.coroutines.Continuation
* kotlin.coroutines.intrinsics.IntrinsicsKt
* kotlin.jvm.functions.Function1
* kotlin.jvm.functions.Function2
* kotlin.jvm.internal.Ref$ObjectRef
* kotlin.sequences.SequenceScope
* kotlin.sequences.SequencesKt
* org.jetbrains.annotations.NotNull
* org.jetbrains.annotations.Nullable
*/
package org.danwatt.aoc22;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Ref;
import kotlin.sequences.SequenceScope;
import kotlin.sequences.SequencesKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(mv={1, 7, 1}, k=2, xi=48, d1={"\u0000\u0018\n\u0000\n\u0002\u0010\u001c\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0000\u001a8\u0010\u0000\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00030\u00020\u0001\"\u0004\b\u0000\u0010\u0003*\b\u0012\u0004\u0012\u0002H\u00030\u00012\u0012\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u0002H\u0003\u0012\u0004\u0012\u00020\u00060\u0005H\u0002\u00a8\u0006\u0007"}, d2={"chunkedBy", "", "", "T", "delimiterPredicate", "Lkotlin/Function1;", "", "aoc22"})
public final class Day1Kt {
private static final <T> Iterable<List<T>> chunkedBy(Iterable<? extends T> $this$chunkedBy, Function1<? super T, Boolean> delimiterPredicate) {
Iterator<? extends T> iter = $this$chunkedBy.iterator();
return new Iterable<List<? extends T>>(iter, delimiterPredicate){
final /* synthetic */ Iterator $iter$inlined;
final /* synthetic */ Function1 $delimiterPredicate$inlined;
{
this.$iter$inlined = iterator;
this.$delimiterPredicate$inlined = function1;
}
@NotNull
public Iterator<List<? extends T>> iterator() {
boolean bl = false;
return SequencesKt.iterator((Function2)((Function2)new Function2<SequenceScope<? super List<? extends T>>, Continuation<? super Unit>, Object>(this.$iter$inlined, this.$delimiterPredicate$inlined, null){
Object L$1;
Object L$2;
Object L$3;
int label;
private /* synthetic */ Object L$0;
final /* synthetic */ Iterator<T> $iter;
final /* synthetic */ Function1<T, Boolean> $delimiterPredicate;
{
this.$iter = $iter;
this.$delimiterPredicate = $delimiterPredicate;
super(2, $completion);
}
/*
* Unable to fully structure code
* Enabled aggressive block sorting
* Lifted jumps to return sites
*/
@Nullable
public final Object invokeSuspend(@NotNull Object var1_1) {
var11_2 = IntrinsicsKt.getCOROUTINE_SUSPENDED();
block0 : switch (this.label) {
case 0: {
ResultKt.throwOnFailure((Object)var1_1);
$this$iterator = (SequenceScope)this.L$0;
accumulator = new Ref.ObjectRef();
accumulator.element = new ArrayList<E>();
var4_5 = this.$iter;
var5_6 = this.$delimiterPredicate;
$i$f$forEach = false;
var7_8 = $this$forEach$iv;
break;
}
case 1: {
$i$f$forEach = false;
$i$a$-forEach-Day1Kt$chunkedBy$1$1$1 = false;
var7_8 = (Iterator)this.L$3;
var5_6 = (Function1<T, Boolean>)this.L$2;
accumulator = (Ref.ObjectRef)this.L$1;
$this$iterator = (SequenceScope)this.L$0;
ResultKt.throwOnFailure((Object)$result);
v0 = $result;
lbl22:
// 3 sources
while (true) {
accumulator.element = new ArrayList<E>();
break block0;
break;
}
}
case 2: {
ResultKt.throwOnFailure((Object)$result);
v1 = $result;
return Unit.INSTANCE;
}
default: {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
}
while (var7_8.hasNext()) {
block7: {
it = element$iv = var7_8.next();
$i$a$-forEach-Day1Kt$chunkedBy$1$1$1 = false;
if (!((Boolean)var5_6.invoke(it)).booleanValue()) break block7;
if (!(((Collection)accumulator.element).isEmpty() == false)) ** GOTO lbl22
this.L$0 = $this$iterator;
this.L$1 = accumulator;
this.L$2 = var5_6;
this.L$3 = var7_8;
this.label = 1;
if ((v0 = $this$iterator.yield(accumulator.element, (Continuation)this)) != var11_2) ** continue;
return var11_2;
}
((List)accumulator.element).add(it);
}
if (((Collection)accumulator.element).isEmpty() == false == false) return Unit.INSTANCE;
this.L$0 = null;
this.L$1 = null;
this.L$2 = null;
this.L$3 = null;
this.label = 2;
v2 = $this$iterator.yield(accumulator.element, (Continuation)this);
v1 = v2;
if (v2 != var11_2) return Unit.INSTANCE;
return var11_2;
}
@NotNull
public final Continuation<Unit> create(@Nullable Object value, @NotNull Continuation<?> $completion) {
Function2<SequenceScope<? super List<? extends T>>, Continuation<? super Unit>, Object> function2 = new /* invalid duplicate definition of identical inner class */;
function2.L$0 = value;
return (Continuation)function2;
}
@Nullable
public final Object invoke(@NotNull SequenceScope<? super List<? extends T>> p1, @Nullable Continuation<? super Unit> p2) {
return (this.create(p1, p2)).invokeSuspend((Object)Unit.INSTANCE);
}
}));
}
};
}
public static final /* synthetic */ Iterable access$chunkedBy(Iterable $receiver, Function1 delimiterPredicate) {
return Day1Kt.chunkedBy($receiver, delimiterPredicate);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment