From 3ec21c64b3682465ca8e159a187689b207c71de4 Mon Sep 17 00:00:00 2001 From: Andres Erbsen Date: Tue, 8 Jan 2019 01:59:52 -0500 Subject: move src/Experiments/NewPipeline/ to src/ --- src/fancy_with_casts_rewrite_head.out | 10062 ++++++++++++++++++++++++++++++++ 1 file changed, 10062 insertions(+) create mode 100644 src/fancy_with_casts_rewrite_head.out (limited to 'src/fancy_with_casts_rewrite_head.out') diff --git a/src/fancy_with_casts_rewrite_head.out b/src/fancy_with_casts_rewrite_head.out new file mode 100644 index 000000000..c35ff8a01 --- /dev/null +++ b/src/fancy_with_casts_rewrite_head.out @@ -0,0 +1,10062 @@ +fancy_with_casts_rewrite_head = +match idc in (Compilers.ident t) return (Compile.value' true t) with +| @Literal t v => Base (##v)%expr +| Nat_succ => fun x : expr ℕ => Base (#(Nat_succ)%expr @ x)%expr_pat +| Nat_pred => fun x : expr ℕ => Base (#(Nat_pred)%expr @ x)%expr_pat +| Nat_max => fun x x0 : expr ℕ => Base (#(Nat_max)%expr @ x @ x0)%expr_pat +| Nat_mul => fun x x0 : expr ℕ => Base (#(Nat_mul)%expr @ x @ x0)%expr_pat +| Nat_add => fun x x0 : expr ℕ => Base (#(Nat_add)%expr @ x @ x0)%expr_pat +| Nat_sub => fun x x0 : expr ℕ => Base (#(Nat_sub)%expr @ x @ x0)%expr_pat +| @nil t => Base []%expr_pat +| @cons t => fun (x : expr t) (x0 : expr (list t)) => Base (x :: x0)%expr_pat +| @pair A B => fun (x : expr A) (x0 : expr B) => Base (x, x0)%expr_pat +| @fst A B => fun x : expr (A * B)%etype => Base (#(fst)%expr @ x)%expr_pat +| @snd A B => fun x : expr (A * B)%etype => Base (#(snd)%expr @ x)%expr_pat +| @prod_rect A B T => + fun (x : expr A -> expr B -> UnderLets (expr T)) + (x0 : expr (A * B)%etype) => + Base + (#(prod_rect)%expr @ + (λ (x1 : var A)(x2 : var B), + to_expr (x ($x1) ($x2)))%expr @ x0)%expr_pat +| @bool_rect T => + fun (x x0 : expr unit -> UnderLets (expr T)) (x1 : expr bool) => + Base + (#(bool_rect)%expr @ (λ x2 : var unit, + to_expr (x ($x2)))%expr @ + (λ x2 : var unit, + to_expr (x0 ($x2)))%expr @ x1)%expr_pat +| @nat_rect P => + fun (x : expr unit -> UnderLets (expr P)) + (x0 : expr ℕ -> expr P -> UnderLets (expr P)) (x1 : expr ℕ) => + Base + (#(nat_rect)%expr @ (λ x2 : var unit, + to_expr (x ($x2)))%expr @ + (λ (x2 : var ℕ)(x3 : var P), + to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat +| @nat_rect_arrow P Q => + fun (x : expr P -> UnderLets (expr Q)) + (x0 : expr ℕ -> + (expr P -> UnderLets (expr Q)) -> expr P -> UnderLets (expr Q)) + (x1 : expr ℕ) (x2 : expr P) => + Base + (#(nat_rect_arrow)%expr @ (λ x3 : var P, + to_expr (x ($x3)))%expr @ + (λ (x3 : var ℕ)(x4 : var (P -> Q)%ptype)(x5 : var P), + to_expr + (x0 ($x3) (fun x6 : expr P => Base ($x4 @ x6)%expr_pat) ($x5)))%expr @ + x1 @ x2)%expr_pat +| @list_rect A P => + fun (x : expr unit -> UnderLets (expr P)) + (x0 : expr A -> expr (list A) -> expr P -> UnderLets (expr P)) + (x1 : expr (list A)) => + Base + (#(list_rect)%expr @ (λ x2 : var unit, + to_expr (x ($x2)))%expr @ + (λ (x2 : var A)(x3 : var (list A))(x4 : var P), + to_expr (x0 ($x2) ($x3) ($x4)))%expr @ x1)%expr_pat +| @list_case A P => + fun (x : expr unit -> UnderLets (expr P)) + (x0 : expr A -> expr (list A) -> UnderLets (expr P)) + (x1 : expr (list A)) => + Base + (#(list_case)%expr @ (λ x2 : var unit, + to_expr (x ($x2)))%expr @ + (λ (x2 : var A)(x3 : var (list A)), + to_expr (x0 ($x2) ($x3)))%expr @ x1)%expr_pat +| @List_length T => + fun x : expr (list T) => Base (#(List_length)%expr @ x)%expr_pat +| List_seq => fun x x0 : expr ℕ => Base (#(List_seq)%expr @ x @ x0)%expr_pat +| @List_firstn A => + fun (x : expr ℕ) (x0 : expr (list A)) => + Base (#(List_firstn)%expr @ x @ x0)%expr_pat +| @List_skipn A => + fun (x : expr ℕ) (x0 : expr (list A)) => + Base (#(List_skipn)%expr @ x @ x0)%expr_pat +| @List_repeat A => + fun (x : expr A) (x0 : expr ℕ) => + Base (#(List_repeat)%expr @ x @ x0)%expr_pat +| @List_combine A B => + fun (x : expr (list A)) (x0 : expr (list B)) => + Base (#(List_combine)%expr @ x @ x0)%expr_pat +| @List_map A B => + fun (x : expr A -> UnderLets (expr B)) (x0 : expr (list A)) => + Base + (#(List_map)%expr @ (λ x1 : var A, + to_expr (x ($x1)))%expr @ x0)%expr_pat +| @List_app A => fun x x0 : expr (list A) => Base (x ++ x0)%expr +| @List_rev A => + fun x : expr (list A) => Base (#(List_rev)%expr @ x)%expr_pat +| @List_flat_map A B => + fun (x : expr A -> UnderLets (expr (list B))) (x0 : expr (list A)) => + Base + (#(List_flat_map)%expr @ (λ x1 : var A, + to_expr (x ($x1)))%expr @ x0)%expr_pat +| @List_partition A => + fun (x : expr A -> UnderLets (expr bool)) (x0 : expr (list A)) => + Base + (#(List_partition)%expr @ (λ x1 : var A, + to_expr (x ($x1)))%expr @ x0)%expr_pat +| @List_fold_right A B => + fun (x : expr B -> expr A -> UnderLets (expr A)) (x0 : expr A) + (x1 : expr (list B)) => + Base + (#(List_fold_right)%expr @ + (λ (x2 : var B)(x3 : var A), + to_expr (x ($x2) ($x3)))%expr @ x0 @ x1)%expr_pat +| @List_update_nth T => + fun (x : expr ℕ) (x0 : expr T -> UnderLets (expr T)) (x1 : expr (list T)) + => + Base + (#(List_update_nth)%expr @ x @ (λ x2 : var T, + to_expr (x0 ($x2)))%expr @ x1)%expr_pat +| @List_nth_default T => + fun (x : expr T) (x0 : expr (list T)) (x1 : expr ℕ) => + Base (#(List_nth_default)%expr @ x @ x0 @ x1)%expr_pat +| Z_add => fun x x0 : expr ℤ => Base (x + x0)%expr +| Z_mul => fun x x0 : expr ℤ => Base (x * x0)%expr +| Z_pow => fun x x0 : expr ℤ => Base (#(Z_pow)%expr @ x @ x0)%expr_pat +| Z_sub => fun x x0 : expr ℤ => Base (x - x0)%expr +| Z_opp => fun x : expr ℤ => Base (- x)%expr +| Z_div => fun x x0 : expr ℤ => Base (x / x0)%expr +| Z_modulo => fun x x0 : expr ℤ => Base (x mod x0)%expr +| Z_log2 => fun x : expr ℤ => Base (#(Z_log2)%expr @ x)%expr_pat +| Z_log2_up => fun x : expr ℤ => Base (#(Z_log2_up)%expr @ x)%expr_pat +| Z_eqb => fun x x0 : expr ℤ => Base (#(Z_eqb)%expr @ x @ x0)%expr_pat +| Z_leb => fun x x0 : expr ℤ => Base (#(Z_leb)%expr @ x @ x0)%expr_pat +| Z_geb => fun x x0 : expr ℤ => Base (#(Z_geb)%expr @ x @ x0)%expr_pat +| Z_of_nat => fun x : expr ℕ => Base (#(Z_of_nat)%expr @ x)%expr_pat +| Z_to_nat => fun x : expr ℤ => Base (#(Z_to_nat)%expr @ x)%expr_pat +| Z_shiftr => fun x x0 : expr ℤ => Base (x >> x0)%expr +| Z_shiftl => fun x x0 : expr ℤ => Base (x << x0)%expr +| Z_land => fun x x0 : expr ℤ => Base (x &' x0)%expr +| Z_lor => fun x x0 : expr ℤ => Base (x || x0)%expr +| Z_bneg => fun x : expr ℤ => Base (#(Z_bneg)%expr @ x)%expr_pat +| Z_lnot_modulo => + fun x x0 : expr ℤ => Base (#(Z_lnot_modulo)%expr @ x @ x0)%expr_pat +| Z_mul_split => + fun x x0 x1 : expr ℤ => Base (#(Z_mul_split)%expr @ x @ x0 @ x1)%expr_pat +| Z_add_get_carry => + fun x x0 x1 : expr ℤ => + Base (#(Z_add_get_carry)%expr @ x @ x0 @ x1)%expr_pat +| Z_add_with_carry => + fun x x0 x1 : expr ℤ => + Base (#(Z_add_with_carry)%expr @ x @ x0 @ x1)%expr_pat +| Z_add_with_get_carry => + fun x x0 x1 x2 : expr ℤ => + Base (#(Z_add_with_get_carry)%expr @ x @ x0 @ x1 @ x2)%expr_pat +| Z_sub_get_borrow => + fun x x0 x1 : expr ℤ => + Base (#(Z_sub_get_borrow)%expr @ x @ x0 @ x1)%expr_pat +| Z_sub_with_get_borrow => + fun x x0 x1 x2 : expr ℤ => + Base (#(Z_sub_with_get_borrow)%expr @ x @ x0 @ x1 @ x2)%expr_pat +| Z_zselect => + fun x x0 x1 : expr ℤ => Base (#(Z_zselect)%expr @ x @ x0 @ x1)%expr_pat +| Z_add_modulo => + fun x x0 x1 : expr ℤ => + (match + pattern.type.unify_extracted_cps ((ℤ -> ℤ) -> ℤ)%ptype + ((ℤ -> ℤ) -> ℤ)%ptype option (fun x2 : option => x2) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq ((ℤ -> ℤ) -> ℤ)%ptype + ((ℤ -> ℤ) -> ℤ)%ptype + then Some (Base (#(fancy_addm)%expr @ (x, x0, x1))%expr_pat) + else None + | None => None + end;;; + Base (#(Z_add_modulo)%expr @ x @ x0 @ x1)%expr_pat)%option +| Z_rshi => + fun x x0 x1 x2 : expr ℤ => + Base (#(Z_rshi)%expr @ x @ x0 @ x1 @ x2)%expr_pat +| Z_cc_m => fun x x0 : expr ℤ => Base (#(Z_cc_m)%expr @ x @ x0)%expr_pat +| Z_cast range => + fun x : expr ℤ => + ((match x with + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (@expr.Ident _ _ _ t2 idc2 @ x4 @ x3))%expr_pat => + match x4 with + | @expr.Ident _ _ _ t3 idc3 => + match x3 with + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t4 idc4) x5 => + (args <- invert_bind_args idc4 Raw.ident.Z_cast; + args0 <- invert_bind_args idc3 Raw.ident.Literal; + _ <- invert_bind_args idc2 Raw.ident.Z_land; + args2 <- invert_bind_args idc1 Raw.ident.Z_cast; + args3 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> (projT1 args0) -> s4)%ptype option + (fun x6 : option => x6) + with + | Some (_, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> (projT1 args0) -> s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v <- type.try_make_transport_cps s4 ℤ; + fv <- (x6 <- (if + ((let (x6, _) := xv0 in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv0 in x6) / 2) - + 1) && + (ZRange.normalize + (ZRange.constant + (let (x6, _) := xv0 in x6)) &' + ZRange.normalize args <=? + ZRange.normalize args2)%zrange + then + x6 <- invert_low + (2 * + Z.log2_up + (let (x6, _) := xv0 in x6)) + (let (x6, _) := xv in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let (x7, _) := xv0 in x7)))%expr @ + ((##x6)%expr, + #(Z_cast args)%expr @ + v (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);; + args <- invert_bind_args idc4 Raw.ident.Z_cast; + args0 <- invert_bind_args idc3 Raw.ident.Literal; + _ <- invert_bind_args idc2 Raw.ident.Z_land; + args2 <- invert_bind_args idc1 Raw.ident.Z_cast; + args3 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> (projT1 args0) -> s4)%ptype option + (fun x6 : option => x6) + with + | Some (_, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> (projT1 args0) -> s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v <- type.try_make_transport_cps s4 ℤ; + fv <- (x6 <- (if + ((let (x6, _) := xv0 in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv0 in x6) / 2) - + 1) && + (ZRange.normalize + (ZRange.constant + (let (x6, _) := xv0 in x6)) &' + ZRange.normalize args <=? + ZRange.normalize args2)%zrange + then + x6 <- invert_high + (2 * + Z.log2_up + (let (x6, _) := xv0 in x6)) + (let (x6, _) := xv in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhl + (2 * + Z.log2_up + (let (x7, _) := xv0 in x7)))%expr @ + ((##x6)%expr, + #(Z_cast args)%expr @ + v (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) x5 => + match x3 with + | @expr.Ident _ _ _ t4 idc4 => + (args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Z_cast; + _ <- invert_bind_args idc2 Raw.ident.Z_land; + args2 <- invert_bind_args idc1 Raw.ident.Z_cast; + args3 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + ((let (x6, _) := xv0 in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv0 in x6) / 2) - + 1) && + (ZRange.normalize args0 &' + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv0 in x6)) <=? + ZRange.normalize args2)%zrange + then + x6 <- invert_low + (2 * + Z.log2_up + (let (x6, _) := xv0 in x6)) + (let (x6, _) := xv in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let (x7, _) := xv0 in x7)))%expr @ + ((##x6)%expr, + #(Z_cast args0)%expr @ + v (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);; + args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Z_cast; + _ <- invert_bind_args idc2 Raw.ident.Z_land; + args2 <- invert_bind_args idc1 Raw.ident.Z_cast; + args3 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + ((let (x6, _) := xv0 in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv0 in x6) / 2) - + 1) && + (ZRange.normalize args0 &' + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv0 in x6)) <=? + ZRange.normalize args2)%zrange + then + x6 <- invert_high + (2 * + Z.log2_up + (let (x6, _) := xv0 in x6)) + (let (x6, _) := xv in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhl + (2 * + Z.log2_up + (let (x7, _) := xv0 in x7)))%expr @ + ((##x6)%expr, + #(Z_cast args0)%expr @ + v (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ (_ @ _)%expr_pat + _ | @expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end;; + match x4 with + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) x5 => + match x3 with + | @expr.Ident _ _ _ t4 idc4 => + (args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Z_cast; + _ <- invert_bind_args idc2 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc1 Raw.ident.Z_cast; + args3 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + (ZRange.normalize args0 >> + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv0 in x6)) <=? + ZRange.normalize args2)%zrange + then + x6 <- invert_low + (2 * + (let (x6, _) := xv0 in x6)) + (let (x6, _) := xv in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mullh + (2 * + (let (x7, _) := xv0 in x7)))%expr @ + ((##x6)%expr, + #(Z_cast args0)%expr @ + v (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);; + args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Z_cast; + _ <- invert_bind_args idc2 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc1 Raw.ident.Z_cast; + args3 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (ℤ -> ℤ -> ℤ)%ptype + ((projT1 args3) -> s4 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + (ZRange.normalize args0 >> + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv0 in x6)) <=? + ZRange.normalize args2)%zrange + then + x6 <- invert_high + (2 * (let (x6, _) := xv0 in x6)) + (let (x6, _) := xv in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhh + (2 * (let (x7, _) := xv0 in x7)))%expr @ + ((##x6)%expr, + #(Z_cast args0)%expr @ + v (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ (_ @ _)%expr_pat + _ | @expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ #(_))%expr_pat | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ ($_)%expr)%expr_pat | @expr.App _ _ _ s + _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ @expr.Abs _ _ _ _ _ _)%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (#(_) @ _))%expr_pat | @expr.App _ _ _ s + _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (($_)%expr @ _))%expr_pat | @expr.App _ + _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (($_)%expr @ _ @ _))%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (_ @ _ @ _ @ _))%expr_pat | @expr.App _ + _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.Ident _ _ _ t1 idc1 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (@expr.Ident _ _ _ t1 idc1 @ x4 @ x3))%expr_pat) + x0 => + match x4 with + | @expr.Ident _ _ _ t2 idc2 => + match x3 with + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) x5 => + match x0 with + | @expr.Ident _ _ _ t4 idc4 => + (args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Z_cast; + args1 <- invert_bind_args idc2 Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args3 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s4) -> (projT1 args))%ptype + option (fun x6 : option => x6) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s4) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + ((let (x6, _) := xv in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv in x6) / + 2) - 1) && + (ZRange.normalize + (ZRange.constant + (let (x6, _) := xv in x6)) &' + ZRange.normalize args0 <=? + ZRange.normalize args3)%zrange + then + y <- invert_low + (2 * + Z.log2_up + (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let (x6, _) := xv in + x6)))%expr @ + (#(Z_cast args0)%expr @ + v (Compile.reflect x5), + (##y)%expr)))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);; + args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Z_cast; + args1 <- invert_bind_args idc2 Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args3 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s4) -> (projT1 args))%ptype + option (fun x6 : option => x6) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s4) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + ((let (x6, _) := xv in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv in x6) / 2) - + 1) && + (ZRange.normalize + (ZRange.constant + (let (x6, _) := xv in x6)) &' + ZRange.normalize args0 <=? + ZRange.normalize args3)%zrange + then + y <- invert_high + (2 * + Z.log2_up + (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mullh + (2 * + Z.log2_up + (let (x6, _) := xv in x6)))%expr @ + (#(Z_cast args0)%expr @ + v (Compile.reflect x5), + (##y)%expr)))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ x8 @ x7))%expr_pat => + match x8 with + | @expr.Ident _ _ _ t6 idc6 => + match x7 with + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t7 idc7) + x9 => + args <- invert_bind_args idc7 Raw.ident.Z_cast; + args0 <- invert_bind_args idc6 + Raw.ident.Literal; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 Raw.ident.Z_cast; + args4 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s4) -> + (projT1 args0) -> s8)%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s4) -> + (projT1 args0) -> s8)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s4 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s8 + ℤ; + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + ((let (x10, _) := xv0 in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + (ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) &' + ZRange.normalize args3 <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) &' + ZRange.normalize args <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let + (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args3)%expr @ + v + (Compile.reflect x5), + #(Z_cast args)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ + _ s8 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s8 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6) + x9 => + match x7 with + | @expr.Ident _ _ _ t7 idc7 => + args <- invert_bind_args idc7 Raw.ident.Literal; + args0 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 Raw.ident.Z_cast; + args4 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s4) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s4) -> + s8 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s4 + ℤ; + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + ((let (x10, _) := xv0 in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + (ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) &' + ZRange.normalize args3 <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize args0 &' + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let + (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args3)%expr @ + v + (Compile.reflect x5), + #(Z_cast args0)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s8 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end;; + match x8 with + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6) + x9 => + match x7 with + | @expr.Ident _ _ _ t7 idc7 => + args <- invert_bind_args idc7 Raw.ident.Literal; + args0 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 Raw.ident.Z_cast; + args4 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s4) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s4) -> + s8 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s4 + ℤ; + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + 2 + ^ (2 * + (let (x10, _) := + xv0 in + x10) / 2) - 1) && + (ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) &' + ZRange.normalize args3 <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize args0 >> + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mullh + (2 * + (let (x10, _) := + xv0 in + x10)))%expr @ + (#(Z_cast args3)%expr @ + v + (Compile.reflect x5), + #(Z_cast args0)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s8 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 => + match x3 with + | @expr.Ident _ _ _ t3 idc3 => + match x0 with + | @expr.Ident _ _ _ t4 idc4 => + (args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Literal; + args1 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args3 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x6 : option => x6) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + ((let (x6, _) := xv in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv in x6) / + 2) - 1) && + (ZRange.normalize args1 &' + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv in x6)) <=? + ZRange.normalize args3)%zrange + then + y <- invert_low + (2 * + Z.log2_up + (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let (x6, _) := xv in + x6)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x5), + (##y)%expr)))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);; + args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Literal; + args1 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args3 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x6 : option => x6) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + ((let (x6, _) := xv in x6) =? + 2 + ^ (2 * + Z.log2_up + (let (x6, _) := xv in x6) / 2) - + 1) && + (ZRange.normalize args1 &' + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv in x6)) <=? + ZRange.normalize args3)%zrange + then + y <- invert_high + (2 * + Z.log2_up + (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mullh + (2 * + Z.log2_up + (let (x6, _) := xv in x6)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x5), + (##y)%expr)))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ x8 @ x7))%expr_pat => + match x8 with + | @expr.Ident _ _ _ t6 idc6 => + match x7 with + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t7 idc7) + x9 => + args <- invert_bind_args idc7 Raw.ident.Z_cast; + args0 <- invert_bind_args idc6 + Raw.ident.Literal; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 + Raw.ident.Literal; + args4 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + (projT1 args0) -> s8)%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + (projT1 args0) -> s8)%ptype + then + v <- type.try_make_transport_cps s4 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s8 + ℤ; + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + ((let (x10, _) := xv0 in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + (ZRange.normalize args4 &' + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) &' + ZRange.normalize args <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let + (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args4)%expr @ + v + (Compile.reflect x5), + #(Z_cast args)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ + _ s8 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s8 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6) + x9 => + match x7 with + | @expr.Ident _ _ _ t7 idc7 => + args <- invert_bind_args idc7 Raw.ident.Literal; + args0 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 + Raw.ident.Literal; + args4 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + ((let (x10, _) := xv0 in + x10) =? + 2 + ^ (2 * + Z.log2_up + (let (x10, _) := + xv in + x10) / 2) - 1) && + (ZRange.normalize args4 &' + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize args0 &' + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulll + (2 * + Z.log2_up + (let + (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args4)%expr @ + v + (Compile.reflect x5), + #(Z_cast args0)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s8 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end;; + match x8 with + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6) + x9 => + match x7 with + | @expr.Ident _ _ _ t7 idc7 => + args <- invert_bind_args idc7 Raw.ident.Literal; + args0 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 + Raw.ident.Literal; + args4 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + 2 + ^ (2 * + (let (x10, _) := + xv0 in + x10) / 2) - 1) && + (ZRange.normalize args4 &' + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize args0 >> + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mullh + (2 * + (let (x10, _) := + xv0 in + x10)))%expr @ + (#(Z_cast args4)%expr @ + v + (Compile.reflect x5), + #(Z_cast args0)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s8 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | _ => None + end + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ (_ @ _)%expr_pat + _ | @expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end;; + match x4 with + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 => + match x3 with + | @expr.Ident _ _ _ t3 idc3 => + match x0 with + | @expr.Ident _ _ _ t4 idc4 => + (args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Literal; + args1 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_shiftr; + args3 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x6 : option => x6) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + (ZRange.normalize args1 >> + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv in x6)) <=? + ZRange.normalize args3)%zrange + then + y <- invert_low + (2 * + (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhl + (2 * + (let (x6, _) := xv in x6)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x5), + (##y)%expr)))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);; + args <- invert_bind_args idc4 Raw.ident.Literal; + args0 <- invert_bind_args idc3 Raw.ident.Literal; + args1 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_shiftr; + args3 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x6 : option => x6) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + ((s4 -> (projT1 args0)) -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (if + (ZRange.normalize args1 >> + ZRange.normalize + (ZRange.constant + (let (x6, _) := xv in x6)) <=? + ZRange.normalize args3)%zrange + then + y <- invert_high + (2 * + (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6); + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhh + (2 * + (let (x6, _) := xv in x6)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x5), + (##y)%expr)))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ x8 @ x7))%expr_pat => + match x8 with + | @expr.Ident _ _ _ t6 idc6 => + match x7 with + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t7 idc7) + x9 => + args <- invert_bind_args idc7 Raw.ident.Z_cast; + args0 <- invert_bind_args idc6 + Raw.ident.Literal; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 + Raw.ident.Literal; + args4 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_shiftr; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + (projT1 args0) -> s8)%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + (projT1 args0) -> s8)%ptype + then + v <- type.try_make_transport_cps s4 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s8 + ℤ; + fv <- (x10 <- (if + ((let (x10, _) := xv0 in + x10) =? + 2 + ^ (2 * + (let (x10, _) := xv in + x10) / 2) - 1) && + (ZRange.normalize args4 >> + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) &' + ZRange.normalize args <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhl + (2 * + (let (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args4)%expr @ + v + (Compile.reflect x5), + #(Z_cast args)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ + _ s8 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s8 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6) + x9 => + match x7 with + | @expr.Ident _ _ _ t7 idc7 => + args <- invert_bind_args idc7 Raw.ident.Literal; + args0 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 + Raw.ident.Literal; + args4 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_shiftr; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (if + ((let (x10, _) := xv0 in + x10) =? + 2 + ^ (2 * + (let (x10, _) := xv in + x10) / 2) - 1) && + (ZRange.normalize args4 >> + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize args0 &' + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhl + (2 * + (let (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args4)%expr @ + v + (Compile.reflect x5), + #(Z_cast args0)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s8 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end;; + match x8 with + | @expr.App _ _ _ s8 _ (@expr.Ident _ _ _ t6 idc6) + x9 => + match x7 with + | @expr.Ident _ _ _ t7 idc7 => + args <- invert_bind_args idc7 Raw.ident.Literal; + args0 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc4 Raw.ident.Z_cast; + args3 <- invert_bind_args idc3 + Raw.ident.Literal; + args4 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_shiftr; + args6 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_mul; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + ((s4 -> (projT1 args3)) -> + s8 -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s4 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args3); + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (if + ((let (x10, _) := xv in + x10) =? + (let (x10, _) := xv0 in + x10)) && + (ZRange.normalize args4 >> + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv in + x10)) <=? + ZRange.normalize args6)%zrange && + (ZRange.normalize args0 >> + ZRange.normalize + (ZRange.constant + (let (x10, _) := + xv0 in + x10)) <=? + ZRange.normalize args2)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_mulhh + (2 * + (let (x10, _) := + xv in + x10)))%expr @ + (#(Z_cast args4)%expr @ + v + (Compile.reflect x5), + #(Z_cast args0)%expr @ + v0 + (Compile.reflect x9))))%expr_pat + else None); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s8 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | _ => None + end + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ (_ @ _)%expr_pat + _ | @expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) #(_)%expr_pat | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) ($_)%expr | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) (@expr.Abs _ _ _ _ _ _) | @expr.App _ _ + _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) (($_)%expr @ _)%expr_pat | @expr.App _ + _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) (_ @ _ @ _)%expr_pat | @expr.App _ _ _ + s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0)) (@expr.LetIn _ _ _ _ _ _ _) | @expr.App + _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ #(_))%expr_pat) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat) _ | @expr.App _ _ + _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (#(_) @ _))%expr_pat) _ | @expr.App _ _ + _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _))%expr_pat) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _ @ _))%expr_pat) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (_ @ _ @ _ @ _))%expr_pat) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat) + _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) ($_)%expr) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Abs _ _ _ _ _ _)) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (($_)%expr @ _)%expr_pat) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) (_ @ _ @ _)%expr_pat) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.Ident _ _ _ t idc) + (@expr.LetIn _ _ _ _ _ _ _)) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc) x2) x1) x0 => + match x2 with + | (@expr.Ident _ _ _ t0 idc0 @ + (@expr.Ident _ _ _ t1 idc1 @ x5 @ x4))%expr_pat => + match x5 with + | @expr.Ident _ _ _ t2 idc2 => + match x4 with + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6 => + match x1 with + | @expr.Ident _ _ _ t4 idc4 => + match x0 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Literal; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_cc_m; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x7 : option => x7) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> + (projT1 args0)) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x7 <- (if + ((let (x7, _) := xv in x7) =? + 2 + ^ Z.log2 + (let (x7, _) := xv in + x7)) && + ((ZRange.cc_m + (let (x7, _) := xv in + x7)) + (ZRange.normalize args1) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_selm + (Z.log2 + (let (x7, _) := + xv in + x7)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + (##(let (x7, _) := + xv0 in + x7))%expr, + (##(let (x7, _) := + xv1 in + x7))%expr)))%expr_pat + else None); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t5 idc5) + x7 => + args <- invert_bind_args idc5 Raw.ident.Z_cast; + args0 <- invert_bind_args idc4 + Raw.ident.Literal; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_cc_m; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> (projT1 args0)) -> + s6)%ptype option (fun x8 : option => x8) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> + (projT1 args0)) -> s6)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s6 + ℤ; + fv <- (x8 <- (if + ((let (x8, _) := xv in x8) =? + 2 + ^ Z.log2 + (let (x8, _) := xv in + x8)) && + ((ZRange.cc_m + (let (x8, _) := xv in + x8)) + (ZRange.normalize args1) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_selm + (Z.log2 + (let (x8, _) := + xv in + x8)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + (##(let (x8, _) := + xv0 in + x8))%expr, + #(Z_cast args)%expr @ + v0 (Compile.reflect x7))))%expr_pat + else None); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ + _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s6 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4) + x7 => + match x0 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_cc_m; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> + (projT1 args))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + v0 <- type.try_make_transport_cps s6 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (if + ((let (x8, _) := xv in x8) =? + 2 + ^ Z.log2 + (let (x8, _) := xv in + x8)) && + ((ZRange.cc_m + (let (x8, _) := xv in + x8)) + (ZRange.normalize args1) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_selm + (Z.log2 + (let (x8, _) := + xv in + x8)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x7), + (##(let (x8, _) := + xv0 in + x8))%expr)))%expr_pat + else None); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5) + x8 => + args <- invert_bind_args idc5 Raw.ident.Z_cast; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_cc_m; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> s7)%ptype + option (fun x9 : option => x9) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> s7)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + v0 <- type.try_make_transport_cps s6 + ℤ; + v1 <- type.try_make_transport_cps s7 + ℤ; + fv <- (x9 <- (if + ((let (x9, _) := xv in x9) =? + 2 + ^ Z.log2 + (let (x9, _) := xv in + x9)) && + ((ZRange.cc_m + (let (x9, _) := xv in + x9)) + (ZRange.normalize args1) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_selm + (Z.log2 + (let (x9, _) := + xv in + x9)))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x7), + #(Z_cast args)%expr @ + v1 (Compile.reflect x8))))%expr_pat + else None); + Some (Base x9)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _ + _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s7 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + match x5 with + | @expr.Ident _ _ _ t2 idc2 => + match x4 with + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) x6 => + match x1 with + | @expr.Ident _ _ _ t4 idc4 => + match x0 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Literal; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x7 : option => x7) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> + (projT1 args0)) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x7 <- (if + ((let (x7, _) := xv in x7) =? + 1) && + (ZRange.normalize + (ZRange.constant + (let (x7, _) := xv in + x7)) &' + ZRange.normalize args1 <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + (##(let (x7, _) := + xv0 in + x7))%expr, + (##(let (x7, _) := + xv1 in + x7))%expr)))%expr_pat + else None); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t5 idc5) + x7 => + args <- invert_bind_args idc5 Raw.ident.Z_cast; + args0 <- invert_bind_args idc4 + Raw.ident.Literal; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> (projT1 args0)) -> + s6)%ptype option (fun x8 : option => x8) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> + (projT1 args0)) -> s6)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s6 + ℤ; + fv <- (x8 <- (if + ((let (x8, _) := xv in x8) =? + 1) && + (ZRange.normalize + (ZRange.constant + (let (x8, _) := xv in + x8)) &' + ZRange.normalize args1 <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + (##(let (x8, _) := + xv0 in + x8))%expr, + #(Z_cast args)%expr @ + v0 (Compile.reflect x7))))%expr_pat + else None); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ + _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s6 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4) + x7 => + match x0 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> + (projT1 args))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + v0 <- type.try_make_transport_cps s6 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (if + ((let (x8, _) := xv in x8) =? + 1) && + (ZRange.normalize + (ZRange.constant + (let (x8, _) := xv in + x8)) &' + ZRange.normalize args1 <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x7), + (##(let (x8, _) := + xv0 in + x8))%expr)))%expr_pat + else None); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5) + x8 => + args <- invert_bind_args idc5 Raw.ident.Z_cast; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + args1 <- invert_bind_args idc3 Raw.ident.Z_cast; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> s7)%ptype + option (fun x9 : option => x9) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s5) -> s6) -> s7)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s5 + ℤ; + v0 <- type.try_make_transport_cps s6 + ℤ; + v1 <- type.try_make_transport_cps s7 + ℤ; + fv <- (x9 <- (if + ((let (x9, _) := xv in x9) =? + 1) && + (ZRange.normalize + (ZRange.constant + (let (x9, _) := xv in + x9)) &' + ZRange.normalize args1 <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x6), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x7), + #(Z_cast args)%expr @ + v1 (Compile.reflect x8))))%expr_pat + else None); + Some (Base x9)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _ + _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s7 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t2 idc2) x6 => + match x4 with + | @expr.Ident _ _ _ t3 idc3 => + match x1 with + | @expr.Ident _ _ _ t4 idc4 => + match x0 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Literal; + args1 <- invert_bind_args idc3 + Raw.ident.Literal; + args2 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x7 : option => x7) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> + (projT1 args0)) -> (projT1 args))%ptype + then + v <- type.try_make_transport_cps s5 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x7 <- (if + ((let (x7, _) := xv in x7) =? + 1) && + (ZRange.normalize args2 &' + ZRange.normalize + (ZRange.constant + (let (x7, _) := xv in + x7)) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args2)%expr @ + v (Compile.reflect x6), + (##(let (x7, _) := + xv0 in + x7))%expr, + (##(let (x7, _) := + xv1 in + x7))%expr)))%expr_pat + else None); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t5 idc5) + x7 => + args <- invert_bind_args idc5 Raw.ident.Z_cast; + args0 <- invert_bind_args idc4 + Raw.ident.Literal; + args1 <- invert_bind_args idc3 + Raw.ident.Literal; + args2 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> (projT1 args0)) -> + s6)%ptype option (fun x8 : option => x8) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> + (projT1 args0)) -> s6)%ptype + then + v <- type.try_make_transport_cps s5 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s6 + ℤ; + fv <- (x8 <- (if + ((let (x8, _) := xv in x8) =? + 1) && + (ZRange.normalize args2 &' + ZRange.normalize + (ZRange.constant + (let (x8, _) := xv in + x8)) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args2)%expr @ + v (Compile.reflect x6), + (##(let (x8, _) := + xv0 in + x8))%expr, + #(Z_cast args)%expr @ + v0 (Compile.reflect x7))))%expr_pat + else None); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ + _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s6 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4) + x7 => + match x0 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + args1 <- invert_bind_args idc3 + Raw.ident.Literal; + args2 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> s6) -> + (projT1 args))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> s6) -> + (projT1 args))%ptype + then + v <- type.try_make_transport_cps s5 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v0 <- type.try_make_transport_cps s6 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (if + ((let (x8, _) := xv in x8) =? + 1) && + (ZRange.normalize args2 &' + ZRange.normalize + (ZRange.constant + (let (x8, _) := xv in + x8)) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args2)%expr @ + v (Compile.reflect x6), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x7), + (##(let (x8, _) := + xv0 in + x8))%expr)))%expr_pat + else None); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s7 _ (@expr.Ident _ _ _ t5 idc5) + x8 => + args <- invert_bind_args idc5 Raw.ident.Z_cast; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + args1 <- invert_bind_args idc3 + Raw.ident.Literal; + args2 <- invert_bind_args idc2 Raw.ident.Z_cast; + _ <- invert_bind_args idc1 Raw.ident.Z_land; + args4 <- invert_bind_args idc0 Raw.ident.Z_cast; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> s6) -> s7)%ptype + option (fun x9 : option => x9) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((s5 -> (projT1 args1)) -> s6) -> s7)%ptype + then + v <- type.try_make_transport_cps s5 + ℤ; + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v0 <- type.try_make_transport_cps s6 + ℤ; + v1 <- type.try_make_transport_cps s7 + ℤ; + fv <- (x9 <- (if + ((let (x9, _) := xv in x9) =? + 1) && + (ZRange.normalize args2 &' + ZRange.normalize + (ZRange.constant + (let (x9, _) := xv in + x9)) <=? + ZRange.normalize args4)%zrange + then + Some + (#(Z_cast range)%expr @ + (#(fancy_sell)%expr @ + (#(Z_cast args2)%expr @ + v (Compile.reflect x6), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x7), + #(Z_cast args)%expr @ + v1 (Compile.reflect x8))))%expr_pat + else None); + Some (Base x9)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App _ _ + _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s7 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ _ s6 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s6 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | (@expr.Ident _ _ _ t0 idc0 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ @expr.Abs _ _ _ _ _ _)%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t0 idc0 @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | _ => None + end;; + _ <- invert_bind_args idc Raw.ident.Z_zselect; + match + pattern.type.unify_extracted_cps ((ℤ -> ℤ) -> ℤ)%ptype + ((s1 -> s0) -> s)%ptype option (fun x3 : option => x3) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype ((s1 -> s0) -> s)%ptype + then + v <- type.try_make_transport_cps s1 ℤ; + v0 <- type.try_make_transport_cps s0 ℤ; + v1 <- type.try_make_transport_cps s ℤ; + Some + (Base + (#(Z_cast range)%expr @ + (#(fancy_selc)%expr @ + (v (Compile.reflect x2), v0 (Compile.reflect x1), + v1 (Compile.reflect x0))))%expr_pat) + else None + | None => None + end + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4)) + (@expr.Ident _ _ _ t3 idc3) => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_rshi; + match + pattern.type.unify_extracted_cps (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> (projT1 args))%ptype + option (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal ##(projT2 args1); + v <- type.try_make_transport_cps s3 ℤ; + xv1 <- ident.unify pattern.ident.Literal ##(projT2 args); + fv <- (x5 <- (if + (let (x5, _) := xv in x5) =? + 2 ^ Z.log2 (let (x5, _) := xv in x5) + then + Some + (#(Z_cast range)%expr @ + (#(fancy_rshi + (Z.log2 (let (x5, _) := xv in x5)) + (let (x5, _) := xv1 in x5))%expr @ + ((##(let (x5, _) := xv0 in x5))%expr, + #(Z_cast args0)%expr @ + v (Compile.reflect x4))))%expr_pat + else None); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) (@expr.App _ _ _ s3 _ ($_)%expr _)) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _)) _ | @expr.App _ _ + _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (_ @ _)%expr_pat _)) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _)) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) #(_)%expr_pat) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) ($_)%expr) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) (@expr.Abs _ _ _ _ _ _)) _ | @expr.App + _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) (@expr.LetIn _ _ _ _ _ _ _)) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.Ident _ _ _ t2 idc2)) (@expr.Ident _ _ _ t3 idc3) => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_rshi; + match + pattern.type.unify_extracted_cps (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + xv0 <- ident.unify pattern.ident.Literal ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal ##(projT2 args); + fv <- (x5 <- (if + (let (x5, _) := xv in x5) =? + 2 ^ Z.log2 (let (x5, _) := xv in x5) + then + Some + (#(Z_cast range)%expr @ + (#(fancy_rshi + (Z.log2 (let (x5, _) := xv in x5)) + (let (x5, _) := xv1 in x5))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x4), + (##(let (x5, _) := xv0 in x5))%expr)))%expr_pat + else None); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4)) ($_)%expr | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4)) + (@expr.Abs _ _ _ _ _ _) | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4)) + (_ @ _)%expr_pat | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Ident _ _ _ t1 idc1)) + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4)) + (@expr.LetIn _ _ _ _ _ _ _) | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.Ident _ _ _ t2 idc2)) ($_)%expr | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.Ident _ _ _ t2 idc2)) (@expr.Abs _ _ _ _ _ _) | @expr.App _ _ + _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.Ident _ _ _ t2 idc2)) (_ @ _)%expr_pat | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.Ident _ _ _ t2 idc2)) (@expr.LetIn _ _ _ _ _ _ _) => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5)) + (@expr.Ident _ _ _ t3 idc3) => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_rshi; + match + pattern.type.unify_extracted_cps (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal ##(projT2 args); + fv <- (x6 <- (if + (let (x6, _) := xv in x6) =? + 2 ^ Z.log2 (let (x6, _) := xv in x6) + then + Some + (#(Z_cast range)%expr @ + (#(fancy_rshi + (Z.log2 (let (x6, _) := xv in x6)) + (let (x6, _) := xv0 in x6))%expr @ + (#(Z_cast args1)%expr @ + v (Compile.reflect x4), + #(Z_cast args0)%expr @ + v0 (Compile.reflect x5))))%expr_pat + else None); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5)) ($_)%expr | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5)) + (@expr.Abs _ _ _ _ _ _) | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5)) + (_ @ _)%expr_pat | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5)) + (@expr.LetIn _ _ _ _ _ _ _) => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ ($_)%expr _)) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.Abs _ _ _ _ _ _) _)) _ | @expr.App _ _ + _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (_ @ _)%expr_pat _)) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.App _ _ _ s4 _ (@expr.LetIn _ _ _ _ _ _ _) _)) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) ($_)%expr) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.Abs _ _ _ _ _ _)) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4)) + (@expr.LetIn _ _ _ _ _ _ _)) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ ($_)%expr _)) _) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.Abs _ _ _ _ _ _) _)) _) _ | @expr.App + _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (_ @ _)%expr_pat _)) _) _ | @expr.App _ _ _ s + _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.App _ _ _ s3 _ (@expr.LetIn _ _ _ _ _ _ _) _)) _) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + ($_)%expr) _) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.Abs _ _ _ _ _ _)) _) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Ident _ _ _ t0 idc0)%expr_pat + (@expr.LetIn _ _ _ _ _ _ _)) _) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc @ ($_)%expr)%expr_pat + _) _) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.Abs _ _ _ _ _ _)%expr_pat _) _) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.Ident _ _ _ t idc @ (_ @ _))%expr_pat + _) _) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ + (@expr.Ident _ _ _ t idc @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat _) + _) _ => None + | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ ($_)%expr _) _) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _) _) _) _ | @expr.App _ + _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (($_)%expr @ _)%expr_pat _) _) _ | @expr.App _ + _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.Abs _ _ _ _ _ _ @ _)%expr_pat _) _) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.App _ _ _ s1 _ (_ @ _ @ _)%expr_pat _) + _) _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _ @ _)%expr_pat _) _) + _ | @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ + (@expr.App _ _ _ s1 _ (@expr.LetIn _ _ _ _ _ _ _) _) _) _ => None + | @expr.App _ _ _ s _ (@expr.App _ _ _ s0 _ ($_)%expr _) _ | @expr.App + _ _ _ s _ (@expr.App _ _ _ s0 _ (@expr.Abs _ _ _ _ _ _) _) _ | + @expr.App _ _ _ s _ + (@expr.App _ _ _ s0 _ (@expr.LetIn _ _ _ _ _ _ _) _) _ => None + | @expr.App _ _ _ s _ #(_)%expr_pat _ | @expr.App _ _ _ s _ ($_)%expr + _ | @expr.App _ _ _ s _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s + _ (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end;; + match + pattern.type.unify_extracted_cps ℤ ℤ option (fun x0 : option => x0) + with + | Some _ => + if type.type_beq base.type base.type.type_beq ℤ ℤ + then + fv <- (x0 <- (if + (range <=? value_range)%zrange + || (range <=? flag_range)%zrange + then Some (#(Z_cast range)%expr @ x)%expr_pat + else None); + Some (Base x0)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end);;; + Base (#(Z_cast range)%expr @ x)%expr_pat)%option +| Z_cast2 range => + fun x : expr (ℤ * ℤ)%etype => + ((match x with + | (@expr.Ident _ _ _ t idc @ x2 @ x1 @ x0)%expr_pat => + match x2 with + | @expr.Ident _ _ _ t0 idc0 => + match x1 with + | @expr.Ident _ _ _ t1 idc1 => + match x0 with + | @expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t2 idc2) x3 => + match x3 with + | (@expr.Ident _ _ _ t3 idc3 @ x5 @ x4)%expr_pat => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.Ident + _ _ _ t7 idc7))%expr_pat => + match x4 with + | @expr.Ident _ _ _ t8 idc8 => + args <- invert_bind_args idc8 + Raw.ident.Literal; + args0 <- invert_bind_args idc7 + Raw.ident.Literal; + args1 <- invert_bind_args idc6 + Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args3 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc1 + Raw.ident.Literal; + args7 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> (projT1 args6)) -> + (s8 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> (projT1 args6)) -> + (s8 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args6); + v <- type.try_make_transport_cps s8 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (let + '(r1, r2)%zrange := + range in + fun (s9 xx : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) => + if + (s9 =? 2 ^ Z.log2 s9) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s9 - 1])%zrange && + (mask =? + Z.ones + (Z.log2 s9 - + offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s9) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add + (Z.log2 s9) + offset)%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x10, _) := xv in + x10) + (let (x10, _) := + xv0 in + x10) args5 args3 + args1 + (v + (Compile.reflect x9)) + (let (x10, _) := + xv1 in + x10) + (let (x10, _) := + xv2 in + x10); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.Abs _ + _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.LetIn + _ _ _ _ _ _ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _)%expr_pat => None + | _ => None + end;; + match x5 with + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t4 idc4) + x6 => + match x4 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 + Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc1 + Raw.ident.Literal; + args4 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> (projT1 args3)) -> + s5 -> (projT1 args))%ptype option + (fun x7 : option => x7) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> (projT1 args3)) -> + s5 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s5 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x7 <- (let + '(r1, r2)%zrange := + range in + fun (s6 xx : Z) + (rshiftr ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s6 =? 2 ^ Z.log2 s6) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s6 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add + (Z.log2 s6) + (- offset))%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x7, _) := xv in + x7) + (let (x7, _) := xv0 in + x7) args2 args0 + (v (Compile.reflect x6)) + (let (x7, _) := xv1 in + x7); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ + _ s5 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s5 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc2 Raw.ident.Z_cast; + args0 <- invert_bind_args idc1 Raw.ident.Literal; + args1 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> (projT1 args0)) -> s2)%ptype + option (fun x4 : option => x4) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> (projT1 args0)) -> s2)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v <- type.try_make_transport_cps s2 ℤ; + fv <- (x4 <- (let + '(r1, r2)%zrange := range in + fun (s3 xx : Z) (ry : zrange) + (y : expr ℤ) => + if + (s3 =? 2 ^ Z.log2 s3) && + (ZRange.normalize ry <=? + r[0 ~> s3 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s3) 0)%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x4, _) := xv in x4) + (let (x4, _) := xv0 in x4) args + (v (Compile.reflect x3)); + Some (Base x4)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x3 => + match x0 with + | @expr.Ident _ _ _ t2 idc2 => + match x3 with + | (@expr.Ident _ _ _ t3 idc3 @ x5 @ x4)%expr_pat => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.Ident + _ _ _ t7 idc7))%expr_pat => + match x4 with + | @expr.Ident _ _ _ t8 idc8 => + args <- invert_bind_args idc8 + Raw.ident.Literal; + args0 <- invert_bind_args idc7 + Raw.ident.Literal; + args1 <- invert_bind_args idc6 + Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args3 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc2 + Raw.ident.Literal; + args6 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args7 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> + (s8 -> (projT1 args0)) -> + (projT1 args)) -> (projT1 args5))%ptype + option (fun x10 : option => x10) + with + | Some (_, (_, _, _), _)%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> + (s8 -> (projT1 args0)) -> + (projT1 args)) -> (projT1 args5))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + fv <- (x10 <- (let + '(r1, r2)%zrange := + range in + fun (s9 : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset xx : Z) + => + if + (s9 =? 2 ^ Z.log2 s9) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s9 - 1])%zrange && + (mask =? + Z.ones + (Z.log2 s9 - + offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s9) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add + (Z.log2 s9) + offset)%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x10, _) := xv in + x10) args6 args3 + args1 + (v + (Compile.reflect x9)) + (let (x10, _) := + xv0 in + x10) + (let (x10, _) := + xv1 in + x10) + (let (x10, _) := + xv2 in + x10); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.Abs _ + _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.LetIn + _ _ _ _ _ _ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _)%expr_pat => None + | _ => None + end;; + match x5 with + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t4 idc4) + x6 => + match x4 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 + Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc2 + Raw.ident.Literal; + args3 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args4 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args4) -> s5 -> (projT1 args)) -> + (projT1 args2))%ptype option + (fun x7 : option => x7) + with + | Some (_, (_, _), _)%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args4) -> + s5 -> (projT1 args)) -> + (projT1 args2))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s5 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args2); + fv <- (x7 <- (let + '(r1, r2)%zrange := + range in + fun (s6 : Z) + (rshiftr ry : zrange) + (y : expr ℤ) + (offset xx : Z) => + if + (s6 =? 2 ^ Z.log2 s6) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s6 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add + (Z.log2 s6) + (- offset))%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x7, _) := xv in + x7) args3 args0 + (v (Compile.reflect x6)) + (let (x7, _) := xv0 in + x7) + (let (x7, _) := xv1 in + x7); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ + _ s5 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s5 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc2 Raw.ident.Literal; + args0 <- invert_bind_args idc1 Raw.ident.Z_cast; + args1 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> (projT1 args))%ptype + option (fun x4 : option => x4) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s2 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x4 <- (let + '(r1, r2)%zrange := range in + fun (s3 : Z) (rx : zrange) + (x4 : expr ℤ) (yy : Z) => + if + (s3 =? 2 ^ Z.log2 s3) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s3 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s3) 0)%expr @ + (#(Z_cast rx)%expr @ x4, + (##yy)%expr)))%expr_pat + else None) + (let (x4, _) := xv in x4) args0 + (v (Compile.reflect x3)) + (let (x4, _) := xv0 in x4); + Some (Base x4)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4 => + match x4 with + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ @expr.Ident _ _ _ t8 idc8)%expr_pat => + args <- invert_bind_args idc8 Raw.ident.Literal; + args0 <- invert_bind_args idc7 Raw.ident.Literal; + args1 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args3 <- invert_bind_args idc4 Raw.ident.Z_cast; + _ <- invert_bind_args idc3 Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc2 Raw.ident.Z_cast; + args6 <- invert_bind_args idc1 Raw.ident.Z_cast; + args7 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> s2) -> + (s9 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x11 : option => x11) + with + | Some (_, _, (_, _, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> s2) -> + (s9 -> (projT1 args0)) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s2 ℤ; + v0 <- type.try_make_transport_cps s9 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x11 <- (let + '(r1, r2)%zrange := range in + fun (s10 : Z) (rx : zrange) + (x11 : expr ℤ) + (rshiftl rland ry : zrange) + (y : expr ℤ) + (mask offset : Z) => + if + (s10 =? 2 ^ Z.log2 s10) && + (ZRange.normalize rland << + ZRange.normalize + (ZRange.constant offset) <=? + ZRange.normalize rshiftl)%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant mask) <=? + ZRange.normalize rland)%zrange && + (ZRange.normalize rshiftl <=? + r[0 ~> s10 - 1])%zrange && + (mask =? + Z.ones (Z.log2 s10 - offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s10) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s10) + offset)%expr @ + (#(Z_cast rx)%expr @ x11, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x11, _) := xv in x11) + args6 (v (Compile.reflect x3)) + args5 args3 args1 + (v0 (Compile.reflect x10)) + (let (x11, _) := xv0 in x11) + (let (x11, _) := xv1 in x11); + Some (Base x11)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ @expr.Abs _ _ _ _ _ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ ($_)%expr)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Abs _ _ _ + _ _ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ (_ @ _))) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.LetIn _ _ + _ _ _ _ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + ($_)%expr _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (_ @ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _ @ + _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ + _ _ @ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ #(_)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _) @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ + _) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _ @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ (($_)%expr @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ (_ @ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ + _ @ _)%expr_pat => None + | _ => None + end;; + match x3 with + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ @expr.Ident _ _ _ t8 idc8)%expr_pat => + args <- invert_bind_args idc8 Raw.ident.Literal; + args0 <- invert_bind_args idc7 Raw.ident.Literal; + args1 <- invert_bind_args idc6 Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args3 <- invert_bind_args idc4 Raw.ident.Z_cast; + _ <- invert_bind_args idc3 Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc2 Raw.ident.Z_cast; + args6 <- invert_bind_args idc1 Raw.ident.Z_cast; + args7 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> + (s9 -> (projT1 args0)) -> (projT1 args)) -> + s3)%ptype option (fun x11 : option => x11) + with + | Some (_, (_, _, _), _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> + (s9 -> (projT1 args0)) -> (projT1 args)) -> + s3)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s9 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + v0 <- type.try_make_transport_cps s3 ℤ; + fv <- (x11 <- (let + '(r1, r2)%zrange := range in + fun (s10 : Z) + (rshiftl rland ry : zrange) + (y : expr ℤ) + (mask offset : Z) + (rx : zrange) (x11 : expr ℤ) + => + if + (s10 =? 2 ^ Z.log2 s10) && + (ZRange.normalize rland << + ZRange.normalize + (ZRange.constant offset) <=? + ZRange.normalize rshiftl)%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant mask) <=? + ZRange.normalize rland)%zrange && + (ZRange.normalize rshiftl <=? + r[0 ~> s10 - 1])%zrange && + (mask =? + Z.ones (Z.log2 s10 - offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s10) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s10) + offset)%expr @ + (#(Z_cast rx)%expr @ x11, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x11, _) := xv in x11) + args6 args3 args1 + (v (Compile.reflect x10)) + (let (x11, _) := xv0 in x11) + (let (x11, _) := xv1 in x11) + args5 + (v0 (Compile.reflect x4)); + Some (Base x11)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ @expr.Abs _ _ _ _ _ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident _ _ + _ t7 idc7)) @ @expr.LetIn _ _ _ _ _ _ _)%expr_pat => + None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ ($_)%expr)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Abs _ _ _ + _ _ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ (_ @ _))) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.LetIn _ _ + _ _ _ _ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + ($_)%expr _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (_ @ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ _ @ + _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ _ + _ _ @ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ #(_)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ _) @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ _ _ + _) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _ @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ (($_)%expr @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ (_ @ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ + _ @ _)%expr_pat => None + | _ => None + end;; + match x4 with + | (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ @expr.Ident _ _ _ + t5 idc5)%expr_pat => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + _ <- invert_bind_args idc3 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc2 Raw.ident.Z_cast; + args3 <- invert_bind_args idc1 Raw.ident.Z_cast; + args4 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s2) -> s6 -> (projT1 args))%ptype + option (fun x8 : option => x8) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s2) -> + s6 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s2 ℤ; + v0 <- type.try_make_transport_cps s6 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (let + '(r1, r2)%zrange := range in + fun (s7 : Z) (rx : zrange) + (x8 : expr ℤ) + (rshiftr ry : zrange) + (y : expr ℤ) (offset : Z) => + if + (s7 =? 2 ^ Z.log2 s7) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant offset) <=? + ZRange.normalize rshiftr)%zrange && + (ZRange.normalize rshiftr <=? + r[0 ~> s7 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s7) + (- offset))%expr @ + (#(Z_cast rx)%expr @ x8, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x8, _) := xv in x8) args3 + (v (Compile.reflect x3)) args2 + args0 (v0 (Compile.reflect x7)) + (let (x8, _) := xv0 in x8); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ @expr.Abs _ _ _ _ _ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ @expr.LetIn _ _ _ _ + _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _ @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ + _ @ _)%expr_pat => None + | _ => None + end;; + match x3 with + | (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ @expr.Ident _ _ _ + t5 idc5)%expr_pat => + args <- invert_bind_args idc5 Raw.ident.Literal; + args0 <- invert_bind_args idc4 Raw.ident.Z_cast; + _ <- invert_bind_args idc3 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc2 Raw.ident.Z_cast; + args3 <- invert_bind_args idc1 Raw.ident.Z_cast; + args4 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args4) -> s6 -> (projT1 args)) -> s3)%ptype + option (fun x8 : option => x8) + with + | Some (_, (_, _), _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args4) -> s6 -> (projT1 args)) -> + s3)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s6 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + v0 <- type.try_make_transport_cps s3 ℤ; + fv <- (x8 <- (let + '(r1, r2)%zrange := range in + fun (s7 : Z) + (rshiftr ry : zrange) + (y : expr ℤ) (offset : Z) + (rx : zrange) (x8 : expr ℤ) + => + if + (s7 =? 2 ^ Z.log2 s7) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant offset) <=? + ZRange.normalize rshiftr)%zrange && + (ZRange.normalize rshiftr <=? + r[0 ~> s7 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s7) + (- offset))%expr @ + (#(Z_cast rx)%expr @ x8, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x8, _) := xv in x8) args3 + args0 (v (Compile.reflect x7)) + (let (x8, _) := xv0 in x8) + args2 (v0 (Compile.reflect x4)); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ @expr.Abs _ _ _ _ _ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t4 idc4) x7 @ @expr.LetIn _ _ _ _ + _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => None + | (@expr.Ident _ _ _ t3 idc3 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.Abs _ _ _ _ _ _ @ + _)%expr_pat | + (@expr.Ident _ _ _ t3 idc3 @ @expr.LetIn _ _ _ _ _ _ + _ @ _)%expr_pat => None + | _ => None + end;; + args <- invert_bind_args idc2 Raw.ident.Z_cast; + args0 <- invert_bind_args idc1 Raw.ident.Z_cast; + args1 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_add_get_carry; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> s3)%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> s3)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s2 ℤ; + v0 <- type.try_make_transport_cps s3 ℤ; + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 : Z) (rx : zrange) + (x5 : expr ℤ) (ry : zrange) + (y : expr ℤ) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize ry <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_add (Z.log2 s4) 0)%expr @ + (#(Z_cast rx)%expr @ x5, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x5, _) := xv in x5) args0 + (v (Compile.reflect x3)) args + (v0 (Compile.reflect x4)); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + match x2 with + | @expr.Ident _ _ _ t0 idc0 => + match x1 with + | @expr.Ident _ _ _ t1 idc1 => + match x0 with + | @expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t2 idc2) x3 => + match x3 with + | (@expr.Ident _ _ _ t3 idc3 @ x5 @ x4)%expr_pat => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.Ident + _ _ _ t7 idc7))%expr_pat => + match x4 with + | @expr.Ident _ _ _ t8 idc8 => + args <- invert_bind_args idc8 + Raw.ident.Literal; + args0 <- invert_bind_args idc7 + Raw.ident.Literal; + args1 <- invert_bind_args idc6 + Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args3 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc1 + Raw.ident.Literal; + args7 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> (projT1 args6)) -> + (s8 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> (projT1 args6)) -> + (s8 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args6); + v <- type.try_make_transport_cps s8 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (let + '(r1, r2)%zrange := + range in + fun (s9 xx : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) => + if + (s9 =? 2 ^ Z.log2 s9) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s9 - 1])%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s9 - + offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s9) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub + (Z.log2 s9) + offset)%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x10, _) := xv in + x10) + (let (x10, _) := + xv0 in + x10) args5 args3 + args1 + (v + (Compile.reflect x9)) + (let (x10, _) := + xv1 in + x10) + (let (x10, _) := + xv2 in + x10); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.Abs _ + _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Ident _ _ _ t6 idc6) x9 @ @expr.LetIn + _ _ _ _ _ _ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s8 + _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _)%expr_pat => None + | _ => None + end;; + match x5 with + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t4 idc4) + x6 => + match x4 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 + Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc1 + Raw.ident.Literal; + args4 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> (projT1 args3)) -> + s5 -> (projT1 args))%ptype option + (fun x7 : option => x7) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> (projT1 args3)) -> + s5 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s5 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x7 <- (let + '(r1, r2)%zrange := + range in + fun (s6 xx : Z) + (rshiftr ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s6 =? 2 ^ Z.log2 s6) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s6 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub + (Z.log2 s6) + (- offset))%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x7, _) := xv in + x7) + (let (x7, _) := xv0 in + x7) args2 args0 + (v (Compile.reflect x6)) + (let (x7, _) := xv1 in + x7); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ + _ s5 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s5 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc2 Raw.ident.Z_cast; + args0 <- invert_bind_args idc1 Raw.ident.Literal; + args1 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> (projT1 args0)) -> s2)%ptype + option (fun x4 : option => x4) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> (projT1 args0)) -> s2)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v <- type.try_make_transport_cps s2 ℤ; + fv <- (x4 <- (let + '(r1, r2)%zrange := range in + fun (s3 xx : Z) (ry : zrange) + (y : expr ℤ) => + if + (s3 =? 2 ^ Z.log2 s3) && + (ZRange.normalize ry <=? + r[0 ~> s3 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub (Z.log2 s3) 0)%expr @ + ((##xx)%expr, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x4, _) := xv in x4) + (let (x4, _) := xv0 in x4) args + (v (Compile.reflect x3)); + Some (Base x4)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s2 _ (@expr.Ident _ _ _ t1 idc1) x3 => + match x0 with + | @expr.Ident _ _ _ t2 idc2 => + args <- invert_bind_args idc2 Raw.ident.Literal; + args0 <- invert_bind_args idc1 Raw.ident.Z_cast; + args1 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> (projT1 args))%ptype + option (fun x4 : option => x4) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s2 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x4 <- (let + '(r1, r2)%zrange := range in + fun (s3 : Z) (rx : zrange) + (x4 : expr ℤ) (yy : Z) => + if + (s3 =? 2 ^ Z.log2 s3) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s3 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub (Z.log2 s3) 0)%expr @ + (#(Z_cast rx)%expr @ x4, + (##yy)%expr)))%expr_pat + else None) + (let (x4, _) := xv in x4) args0 + (v (Compile.reflect x3)) + (let (x4, _) := xv0 in x4); + Some (Base x4)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4 => + match x4 with + | (@expr.Ident _ _ _ t3 idc3 @ x6 @ x5)%expr_pat => + match x6 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Ident + _ _ _ t7 idc7))%expr_pat => + match x5 with + | @expr.Ident _ _ _ t8 idc8 => + args <- invert_bind_args idc8 + Raw.ident.Literal; + args0 <- invert_bind_args idc7 + Raw.ident.Literal; + args1 <- invert_bind_args idc6 + Raw.ident.Z_cast; + _ <- invert_bind_args idc5 Raw.ident.Z_land; + args3 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args7 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> s2) -> + (s9 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x11 : option => x11) + with + | Some (_, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args7) -> s2) -> + (s9 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s2 + ℤ; + v0 <- type.try_make_transport_cps s9 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x11 <- (let + '(r1, r2)%zrange := + range in + fun (s10 : Z) + (rx : zrange) + (x11 : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) => + if + (s10 =? + 2 ^ Z.log2 s10) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s10 - 1])%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s10 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s10) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub + (Z.log2 s10) + offset)%expr @ + (#(Z_cast rx)%expr @ + x11, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x11, _) := xv in + x11) args6 + (v + (Compile.reflect x3)) + args5 args3 args1 + (v0 + (Compile.reflect + x10)) + (let (x11, _) := + xv0 in + x11) + (let (x11, _) := + xv1 in + x11); + Some (Base x11)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.Ident _ _ _ t6 idc6) x10 @ ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.Abs _ + _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.Ident _ _ _ t6 idc6) x10 @ (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.Ident _ _ _ t6 idc6) x10 @ @expr.LetIn + _ _ _ _ _ _ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.App _ _ _ s9 + _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _)%expr_pat => None + | _ => None + end;; + match x6 with + | @expr.App _ _ _ s6 _ (@expr.Ident _ _ _ t4 idc4) + x7 => + match x5 with + | @expr.Ident _ _ _ t5 idc5 => + args <- invert_bind_args idc5 + Raw.ident.Literal; + args0 <- invert_bind_args idc4 + Raw.ident.Z_cast; + _ <- invert_bind_args idc3 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args4 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s2) -> + s6 -> (projT1 args))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + ((ℤ -> ℤ) -> ℤ -> ℤ)%ptype + (((projT1 args4) -> s2) -> + s6 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s2 + ℤ; + v0 <- type.try_make_transport_cps s6 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (let + '(r1, r2)%zrange := + range in + fun (s7 : Z) + (rx : zrange) + (x8 : expr ℤ) + (rshiftr ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s7 =? 2 ^ Z.log2 s7) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s7 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub + (Z.log2 s7) + (- offset))%expr @ + (#(Z_cast rx)%expr @ + x8, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x8, _) := xv in + x8) args3 + (v (Compile.reflect x3)) + args2 args0 + (v0 + (Compile.reflect x7)) + (let (x8, _) := xv0 in + x8); + Some (Base x8)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App _ _ + _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ + _ s6 _ (_ @ _)%expr_pat _ | @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc2 Raw.ident.Z_cast; + args0 <- invert_bind_args idc1 Raw.ident.Z_cast; + args1 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc Raw.ident.Z_sub_get_borrow; + match + pattern.type.unify_extracted_cps + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> s3)%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + ((ℤ -> ℤ) -> ℤ)%ptype + (((projT1 args1) -> s2) -> s3)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s2 ℤ; + v0 <- type.try_make_transport_cps s3 ℤ; + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 : Z) (rx : zrange) + (x5 : expr ℤ) (ry : zrange) + (y : expr ℤ) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize ry <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_sub (Z.log2 s4) 0)%expr @ + (#(Z_cast rx)%expr @ x5, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x5, _) := xv in x5) args0 + (v (Compile.reflect x3)) args + (v0 (Compile.reflect x4)); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s2 _ ($_)%expr _ | @expr.App _ _ _ s2 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s2 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s2 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end + | (@expr.Ident _ _ _ t idc @ x3 @ x2 @ x1 @ x0)%expr_pat => + match x3 with + | @expr.Ident _ _ _ t0 idc0 => + match x2 with + | @expr.Ident _ _ _ t1 idc1 => + match x1 with + | @expr.Ident _ _ _ t2 idc2 => + match x0 with + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t3 idc3) + x4 => + match x4 with + | (@expr.Ident _ _ _ t4 idc4 @ x6 @ x5)%expr_pat => + match x6 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x5 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 + Raw.ident.Literal; + args7 <- invert_bind_args idc1 + Raw.ident.Literal; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + (projT1 args6)) -> + (s9 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x11 : option => x11) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> + (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> + (projT1 args7)) -> + (projT1 args6)) -> + (s9 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args6); + v <- type.try_make_transport_cps s9 + ℤ; + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv3 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x11 <- (let + '(r1, r2)%zrange := + range in + fun + (s10 cc xx : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask + offset : Z) => + if + (s10 =? + 2 ^ Z.log2 s10) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s10 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s10 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s10) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 + s10) + offset)%expr @ + ((##cc)%expr, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x11, _) := + xv in + x11) + (let (x11, _) := + xv0 in + x11) + (let (x11, _) := + xv1 in + x11) args5 args3 + args1 + (v + (Compile.reflect + x10)) + (let (x11, _) := + xv2 in + x11) + (let (x11, _) := + xv3 in + x11); + Some (Base x11)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x6 with + | @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t5 idc5) x7 => + match x5 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 + Raw.ident.Literal; + args4 <- invert_bind_args idc1 + Raw.ident.Literal; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + (projT1 args3)) -> + s6 -> (projT1 args))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> + (projT1 args4)) -> + (projT1 args3)) -> + s6 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s6 + ℤ; + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (let + '(r1, r2)%zrange := + range in + fun (s7 cc xx : Z) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s7 =? + 2 ^ Z.log2 s7) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s7 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s7) + (- offset))%expr @ + ((##cc)%expr, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x8, _) := + xv in + x8) + (let (x8, _) := + xv0 in + x8) + (let (x8, _) := + xv1 in + x8) args2 args0 + (v + (Compile.reflect + x7)) + (let (x8, _) := + xv2 in + x8); + Some (Base x8)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App + _ _ _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s6 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> + (projT1 args0)) -> s3)%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> + (projT1 args0)) -> s3)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args1); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v <- type.try_make_transport_cps s3 ℤ; + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 cc xx : Z) + (ry : zrange) (y : expr ℤ) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize ry <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s4) 0)%expr @ + ((##cc)%expr, (##xx)%expr, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x5, _) := xv in x5) + (let (x5, _) := xv0 in x5) + (let (x5, _) := xv1 in x5) args + (v (Compile.reflect x4)); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4 => + match x0 with + | @expr.Ident _ _ _ t3 idc3 => + match x4 with + | (@expr.Ident _ _ _ t4 idc4 @ x6 @ x5)%expr_pat => + match x6 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x5 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Literal; + args6 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 + Raw.ident.Literal; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + (s9 -> (projT1 args0)) -> + (projT1 args)) -> (projT1 args5))%ptype + option (fun x11 : option => x11) + with + | Some (_, _, (_, _, _), _)%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> + ℤ)%ptype + ((((projT1 args8) -> + (projT1 args7)) -> + (s9 -> (projT1 args0)) -> + (projT1 args)) -> + (projT1 args5))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s9 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + xv3 <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + fv <- (x11 <- (let + '(r1, r2)%zrange := + range in + fun (s10 cc : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset + xx : Z) => + if + (s10 =? + 2 ^ Z.log2 s10) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s10 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s10 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s10) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 + s10) + offset)%expr @ + ((##cc)%expr, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x11, _) := + xv in + x11) + (let (x11, _) := + xv0 in + x11) args6 args3 + args1 + (v + (Compile.reflect + x10)) + (let (x11, _) := + xv1 in + x11) + (let (x11, _) := + xv2 in + x11) + (let (x11, _) := + xv3 in + x11); + Some (Base x11)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x6 with + | @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t5 idc5) x7 => + match x5 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Literal; + args3 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 + Raw.ident.Literal; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + s6 -> (projT1 args)) -> + (projT1 args2))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, (_, _), _)%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> + (projT1 args4)) -> + s6 -> (projT1 args)) -> + (projT1 args2))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s6 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args2); + fv <- (x8 <- (let + '(r1, r2)%zrange := + range in + fun (s7 cc : Z) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset xx : Z) + => + if + (s7 =? + 2 ^ Z.log2 s7) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s7 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s7) + (- offset))%expr @ + ((##cc)%expr, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x8, _) := + xv in + x8) + (let (x8, _) := + xv0 in + x8) args3 args0 + (v + (Compile.reflect + x7)) + (let (x8, _) := + xv1 in + x8) + (let (x8, _) := + xv2 in + x8); + Some (Base x8)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App + _ _ _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s6 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + (projT1 args))%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s3 ℤ; + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 cc : Z) (rx : zrange) + (x5 : expr ℤ) (yy : Z) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s4) 0)%expr @ + ((##cc)%expr, + #(Z_cast rx)%expr @ x5, + (##yy)%expr)))%expr_pat + else None) + (let (x5, _) := xv in x5) + (let (x5, _) := xv0 in x5) + args0 (v (Compile.reflect x4)) + (let (x5, _) := xv1 in x5); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) + x5 => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Ident _ _ + _ t9 idc9)%expr_pat => + args <- invert_bind_args idc9 Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 Raw.ident.Z_cast; + _ <- invert_bind_args idc6 Raw.ident.Z_land; + args3 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 + Raw.ident.Literal; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> s3) -> + (s10 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x12 : option => x12) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + s3) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args8); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s10 + ℤ; + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x12 <- (let + '(r1, r2)%zrange := range + in + fun (s11 cc : Z) + (rx : zrange) + (x12 : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) => + if + (s11 =? 2 ^ Z.log2 s11) && + (ZRange.normalize rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize rshiftl)%zrange && + (ZRange.normalize rshiftl <=? + r[0 ~> s11 - 1])%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant mask) <=? + ZRange.normalize rland)%zrange && + (mask =? + Z.ones + (Z.log2 s11 - offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s11) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s11) + offset)%expr @ + ((##cc)%expr, + #(Z_cast rx)%expr @ + x12, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x12, _) := xv in x12) + (let (x12, _) := xv0 in + x12) args6 + (v (Compile.reflect x4)) + args5 args3 args1 + (v0 (Compile.reflect x11)) + (let (x12, _) := xv1 in + x12) + (let (x12, _) := xv2 in + x12); + Some (Base x12)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + ($_)%expr)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Abs _ _ _ _ _ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + (_ @ _))) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.LetIn _ _ _ _ _ _ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ ($_)%expr _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (_ @ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ + _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ + _ _ _ _ @ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + match x4 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Ident _ _ + _ t9 idc9)%expr_pat => + args <- invert_bind_args idc9 Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 Raw.ident.Z_cast; + _ <- invert_bind_args idc6 Raw.ident.Z_land; + args3 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 + Raw.ident.Literal; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + (s10 -> (projT1 args0)) -> (projT1 args)) -> + s4)%ptype option (fun x12 : option => x12) + with + | Some (_, _, (_, _, _), _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + (s10 -> (projT1 args0)) -> + (projT1 args)) -> s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args8); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s10 + ℤ; + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify pattern.ident.Literal + ##(projT2 args); + v0 <- type.try_make_transport_cps s4 + ℤ; + fv <- (x12 <- (let + '(r1, r2)%zrange := range + in + fun (s11 cc : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) + (rx : zrange) + (x12 : expr ℤ) => + if + (s11 =? 2 ^ Z.log2 s11) && + (ZRange.normalize rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize rshiftl)%zrange && + (ZRange.normalize rshiftl <=? + r[0 ~> s11 - 1])%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant mask) <=? + ZRange.normalize rland)%zrange && + (mask =? + Z.ones + (Z.log2 s11 - offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s11) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s11) + offset)%expr @ + ((##cc)%expr, + #(Z_cast rx)%expr @ + x12, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x12, _) := xv in x12) + (let (x12, _) := xv0 in + x12) args6 args3 args1 + (v (Compile.reflect x11)) + (let (x12, _) := xv1 in + x12) + (let (x12, _) := xv2 in + x12) args5 + (v0 (Compile.reflect x5)); + Some (Base x12)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + ($_)%expr)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Abs _ _ _ _ _ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + (_ @ _))) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.LetIn _ _ _ _ _ _ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ ($_)%expr _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (_ @ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ + _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ + _ _ _ _ @ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.Ident _ _ + _ t6 idc6)%expr_pat => + args <- invert_bind_args idc6 Raw.ident.Literal; + args0 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 + Raw.ident.Literal; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> s3) -> + s7 -> (projT1 args))%ptype option + (fun x9 : option => x9) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + s3) -> s7 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args5); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s7 + ℤ; + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x9 <- (let + '(r1, r2)%zrange := range in + fun (s8 cc : Z) + (rx : zrange) + (x9 : expr ℤ) + (rshiftr ry : zrange) + (y : expr ℤ) (offset : Z) + => + if + (s8 =? 2 ^ Z.log2 s8) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant offset) <=? + ZRange.normalize rshiftr)%zrange && + (ZRange.normalize rshiftr <=? + r[0 ~> s8 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s8) + (- offset))%expr @ + ((##cc)%expr, + #(Z_cast rx)%expr @ x9, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x9, _) := xv in x9) + (let (x9, _) := xv0 in x9) + args3 + (v (Compile.reflect x4)) + args2 args0 + (v0 (Compile.reflect x8)) + (let (x9, _) := xv1 in x9); + Some (Base x9)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + match x4 with + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.Ident _ _ + _ t6 idc6)%expr_pat => + args <- invert_bind_args idc6 Raw.ident.Literal; + args0 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 + Raw.ident.Literal; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + s7 -> (projT1 args)) -> s4)%ptype option + (fun x9 : option => x9) + with + | Some (_, _, (_, _), _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + s7 -> (projT1 args)) -> s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args5); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s7 + ℤ; + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + v0 <- type.try_make_transport_cps s4 + ℤ; + fv <- (x9 <- (let + '(r1, r2)%zrange := range in + fun (s8 cc : Z) + (rshiftr ry : zrange) + (y : expr ℤ) (offset : Z) + (rx : zrange) + (x9 : expr ℤ) => + if + (s8 =? 2 ^ Z.log2 s8) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant offset) <=? + ZRange.normalize rshiftr)%zrange && + (ZRange.normalize rshiftr <=? + r[0 ~> s8 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s8) + (- offset))%expr @ + ((##cc)%expr, + #(Z_cast rx)%expr @ x9, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x9, _) := xv in x9) + (let (x9, _) := xv0 in x9) + args3 args0 + (v (Compile.reflect x8)) + (let (x9, _) := xv1 in x9) + args2 + (v0 (Compile.reflect x5)); + Some (Base x9)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + s4)%ptype option (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + fv <- (x6 <- (let + '(r1, r2)%zrange := range in + fun (s5 cc : Z) (rx : zrange) + (x6 : expr ℤ) (ry : zrange) + (y : expr ℤ) => + if + (s5 =? 2 ^ Z.log2 s5) && + (ZRange.normalize ry <=? + r[0 ~> s5 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s5) 0)%expr @ + ((##cc)%expr, + #(Z_cast rx)%expr @ x6, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x6, _) := xv in x6) + (let (x6, _) := xv0 in x6) + args0 (v (Compile.reflect x4)) + args (v0 (Compile.reflect x5)); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4 => + match x1 with + | @expr.Ident _ _ _ t2 idc2 => + match x0 with + | @expr.Ident _ _ _ t3 idc3 => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 : Z) (rc : zrange) + (c : expr ℤ) (xx yy : Z) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s4) 0)%expr @ + (#(Z_cast rc)%expr @ c, + (##xx)%expr, (##yy)%expr)))%expr_pat + else None) + (let (x5, _) := xv in x5) args1 + (v (Compile.reflect x4)) + (let (x5, _) := xv0 in x5) + (let (x5, _) := xv1 in x5); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) + x5 => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ x7 @ x6)%expr_pat => + match x7 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x6 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 + Raw.ident.Literal; + args7 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (projT1 args6)) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x12 : option => x12) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> + (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (projT1 args6)) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + v <- type.try_make_transport_cps s3 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args6); + v0 <- type.try_make_transport_cps s10 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x12 <- (let + '(r1, r2)%zrange := + range in + fun (s11 : Z) + (rc : zrange) + (c : expr ℤ) + (xx : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask + offset : Z) => + if + (s11 =? + 2 ^ Z.log2 s11) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s11 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s11 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s11) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 + s11) + offset)%expr @ + (#(Z_cast rc)%expr @ + c, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x12, _) := + xv in + x12) args7 + (v + (Compile.reflect + x4)) + (let (x12, _) := + xv0 in + x12) args5 args3 + args1 + (v0 + (Compile.reflect + x11)) + (let (x12, _) := + xv1 in + x12) + (let (x12, _) := + xv2 in + x12); + Some (Base x12)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x7 with + | @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 => + match x6 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 + Raw.ident.Literal; + args4 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + (projT1 args3)) -> + s7 -> (projT1 args))%ptype option + (fun x9 : option => x9) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + (projT1 args3)) -> + s7 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + v <- type.try_make_transport_cps s3 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args3); + v0 <- type.try_make_transport_cps s7 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x9 <- (let + '(r1, r2)%zrange := + range in + fun (s8 : Z) + (rc : zrange) + (c : expr ℤ) + (xx : Z) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s8 =? + 2 ^ Z.log2 s8) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s8 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s8) + (- offset))%expr @ + (#(Z_cast rc)%expr @ + c, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x9, _) := + xv in + x9) args4 + (v + (Compile.reflect + x4)) + (let (x9, _) := + xv0 in + x9) args2 args0 + (v0 + (Compile.reflect + x8)) + (let (x9, _) := + xv1 in + x9); + Some (Base x9)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App + _ _ _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s7 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + s4)%ptype option (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s4 ℤ; + fv <- (x6 <- (let + '(r1, r2)%zrange := range in + fun (s5 : Z) (rc : zrange) + (c : expr ℤ) (xx : Z) + (ry : zrange) (y : expr ℤ) => + if + (s5 =? 2 ^ Z.log2 s5) && + (ZRange.normalize ry <=? + r[0 ~> s5 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s5) 0)%expr @ + (#(Z_cast rc)%expr @ c, + (##xx)%expr, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x6, _) := xv in x6) args1 + (v (Compile.reflect x4)) + (let (x6, _) := xv0 in x6) args + (v0 (Compile.reflect x5)); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 => + match x0 with + | @expr.Ident _ _ _ t3 idc3 => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ x7 @ x6)%expr_pat => + match x7 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x6 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Literal; + args6 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (s10 -> (projT1 args0)) -> + (projT1 args)) -> (projT1 args5))%ptype + option (fun x12 : option => x12) + with + | Some (_, _, (_, _, _), _)%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> + ℤ)%ptype + ((((projT1 args8) -> s3) -> + (s10 -> (projT1 args0)) -> + (projT1 args)) -> + (projT1 args5))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s10 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + fv <- (x12 <- (let + '(r1, r2)%zrange := + range in + fun (s11 : Z) + (rc : zrange) + (c : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset + xx : Z) => + if + (s11 =? + 2 ^ Z.log2 s11) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s11 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s11 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s11) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 + s11) + offset)%expr @ + (#(Z_cast rc)%expr @ + c, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x12, _) := + xv in + x12) args7 + (v + (Compile.reflect + x4)) args6 + args3 args1 + (v0 + (Compile.reflect + x11)) + (let (x12, _) := + xv0 in + x12) + (let (x12, _) := + xv1 in + x12) + (let (x12, _) := + xv2 in + x12); + Some (Base x12)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x7 with + | @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 => + match x6 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Literal; + args3 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + s7 -> (projT1 args)) -> + (projT1 args2))%ptype option + (fun x9 : option => x9) + with + | Some (_, _, (_, _), _)%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + s7 -> (projT1 args)) -> + (projT1 args2))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s7 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args2); + fv <- (x9 <- (let + '(r1, r2)%zrange := + range in + fun (s8 : Z) + (rc : zrange) + (c : expr ℤ) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset xx : Z) + => + if + (s8 =? + 2 ^ Z.log2 s8) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s8 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s8) + (- offset))%expr @ + (#(Z_cast rc)%expr @ + c, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x9, _) := + xv in + x9) args4 + (v + (Compile.reflect + x4)) args3 + args0 + (v0 + (Compile.reflect + x8)) + (let (x9, _) := + xv0 in + x9) + (let (x9, _) := + xv1 in + x9); + Some (Base x9)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App + _ _ _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s7 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> + (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (let + '(r1, r2)%zrange := range in + fun (s5 : Z) (rc : zrange) + (c : expr ℤ) (rx : zrange) + (x6 : expr ℤ) (yy : Z) => + if + (s5 =? 2 ^ Z.log2 s5) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s5 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s5) 0)%expr @ + (#(Z_cast rc)%expr @ c, + #(Z_cast rx)%expr @ x6, + (##yy)%expr)))%expr_pat + else None) + (let (x6, _) := xv in x6) args1 + (v (Compile.reflect x4)) args0 + (v0 (Compile.reflect x5)) + (let (x6, _) := xv0 in x6); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) + x6 => + match x6 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Ident _ _ + _ t9 idc9)%expr_pat => + args <- invert_bind_args idc9 Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 Raw.ident.Z_cast; + _ <- invert_bind_args idc6 Raw.ident.Z_land; + args3 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 Raw.ident.Z_cast; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> s4) -> + (s11 -> (projT1 args0)) -> (projT1 args))%ptype + option (fun x13 : option => x13) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> s4) -> + (s11 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args8); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s4 + ℤ; + v1 <- type.try_make_transport_cps s11 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x13 <- (let + '(r1, r2)%zrange := range + in + fun (s12 : Z) + (rc : zrange) + (c : expr ℤ) + (rx : zrange) + (x13 : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) => + if + (s12 =? 2 ^ Z.log2 s12) && + (ZRange.normalize rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize rshiftl)%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant mask) <=? + ZRange.normalize rland)%zrange && + (ZRange.normalize rshiftl <=? + r[0 ~> s12 - 1])%zrange && + (mask =? + Z.ones + (Z.log2 s12 - offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s12) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s12) + offset)%expr @ + (#(Z_cast rc)%expr @ + c, + #(Z_cast rx)%expr @ + x13, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x13, _) := xv in x13) + args7 + (v (Compile.reflect x4)) + args6 + (v0 (Compile.reflect x5)) + args5 args3 args1 + (v1 (Compile.reflect x12)) + (let (x13, _) := xv0 in + x13) + (let (x13, _) := xv1 in + x13); + Some (Base x13)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + ($_)%expr)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Abs _ _ _ _ _ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + (_ @ _))) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.LetIn _ _ _ _ _ _ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ ($_)%expr _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (_ @ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ + _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ + _ _ _ _ @ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Ident _ _ + _ t9 idc9)%expr_pat => + args <- invert_bind_args idc9 Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 Raw.ident.Z_cast; + _ <- invert_bind_args idc6 Raw.ident.Z_land; + args3 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 Raw.ident.Z_cast; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (s11 -> (projT1 args0)) -> (projT1 args)) -> + s5)%ptype option (fun x13 : option => x13) + with + | Some (_, _, (_, _, _), _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> (ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (s11 -> (projT1 args0)) -> + (projT1 args)) -> s5)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args8); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s11 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + v1 <- type.try_make_transport_cps s5 + ℤ; + fv <- (x13 <- (let + '(r1, r2)%zrange := range + in + fun (s12 : Z) + (rc : zrange) + (c : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask offset : Z) + (rx : zrange) + (x13 : expr ℤ) => + if + (s12 =? 2 ^ Z.log2 s12) && + (ZRange.normalize rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize rshiftl)%zrange && + (ZRange.normalize rshiftl <=? + r[0 ~> s12 - 1])%zrange && + (ZRange.normalize ry &' + ZRange.normalize + (ZRange.constant mask) <=? + ZRange.normalize rland)%zrange && + (mask =? + Z.ones + (Z.log2 s12 - offset)) && + (0 <=? offset) && + (offset <=? Z.log2 s12) + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s12) + offset)%expr @ + (#(Z_cast rc)%expr @ + c, + #(Z_cast rx)%expr @ + x13, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x13, _) := xv in x13) + args7 + (v (Compile.reflect x4)) + args6 args3 args1 + (v0 (Compile.reflect x12)) + (let (x13, _) := xv0 in + x13) + (let (x13, _) := xv1 in + x13) args5 + (v1 (Compile.reflect x6)); + Some (Base x13)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8)) @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + ($_)%expr)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Abs _ _ _ _ _ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + (_ @ _))) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.LetIn _ _ _ _ _ _ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ ($_)%expr _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Abs _ _ _ _ _ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (_ @ _) _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _)) @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ _ + _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ _ + _ _ _ _ @ _)) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ #(_)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ _ _ + _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _)) @ + _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _)) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ _ _ + _ _ _) @ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (($_)%expr @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.Abs _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ (_ @ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + match x6 with + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ @expr.Ident _ _ + _ t6 idc6)%expr_pat => + args <- invert_bind_args idc6 Raw.ident.Literal; + args0 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 Raw.ident.Z_cast; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> s4) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> s4) -> + s8 -> (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args5); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s4 + ℤ; + v1 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (let + '(r1, r2)%zrange := range + in + fun (s9 : Z) (rc : zrange) + (c : expr ℤ) + (rx : zrange) + (x10 : expr ℤ) + (rshiftr ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s9 =? 2 ^ Z.log2 s9) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize rshiftr)%zrange && + (ZRange.normalize rshiftr <=? + r[0 ~> s9 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s9) + (- offset))%expr @ + (#(Z_cast rc)%expr @ + c, + #(Z_cast rx)%expr @ + x10, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x10, _) := xv in x10) + args4 + (v (Compile.reflect x4)) + args3 + (v0 (Compile.reflect x5)) + args2 args0 + (v1 (Compile.reflect x9)) + (let (x10, _) := xv0 in + x10); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ @expr.Ident _ _ + _ t6 idc6)%expr_pat => + args <- invert_bind_args idc6 Raw.ident.Literal; + args0 <- invert_bind_args idc5 Raw.ident.Z_cast; + _ <- invert_bind_args idc4 Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 Raw.ident.Z_cast; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + s8 -> (projT1 args)) -> s5)%ptype option + (fun x10 : option => x10) + with + | Some (_, _, (_, _), _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + s8 -> (projT1 args)) -> s5)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args5); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + v1 <- type.try_make_transport_cps s5 + ℤ; + fv <- (x10 <- (let + '(r1, r2)%zrange := range + in + fun (s9 : Z) (rc : zrange) + (c : expr ℤ) + (rshiftr ry : zrange) + (y : expr ℤ) + (offset : Z) + (rx : zrange) + (x10 : expr ℤ) => + if + (s9 =? 2 ^ Z.log2 s9) && + (ZRange.normalize ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize rshiftr)%zrange && + (ZRange.normalize rshiftr <=? + r[0 ~> s9 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc + (Z.log2 s9) + (- offset))%expr @ + (#(Z_cast rc)%expr @ + c, + #(Z_cast rx)%expr @ + x10, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x10, _) := xv in x10) + args4 + (v (Compile.reflect x4)) + args3 args0 + (v0 (Compile.reflect x9)) + (let (x10, _) := xv0 in + x10) args2 + (v1 (Compile.reflect x6)); + Some (Base x10)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ (_ @ _))%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + ($_)%expr _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.Abs _ _ _ _ _ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (_ @ _) _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ @ _)%expr_pat => + None + | (@expr.Ident _ _ _ t4 idc4 @ #(_) @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ ($_)%expr @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.Abs _ _ _ _ _ + _ @ _)%expr_pat | + (@expr.Ident _ _ _ t4 idc4 @ @expr.LetIn _ _ _ _ + _ _ _ @ _)%expr_pat => None + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_add_with_get_carry; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> s5)%ptype + option (fun x7 : option => x7) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> s5)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + v1 <- type.try_make_transport_cps s5 ℤ; + fv <- (x7 <- (let + '(r1, r2)%zrange := range in + fun (s6 : Z) (rc : zrange) + (c : expr ℤ) (rx : zrange) + (x7 : expr ℤ) (ry : zrange) + (y : expr ℤ) => + if + (s6 =? 2 ^ Z.log2 s6) && + (ZRange.normalize ry <=? + r[0 ~> s6 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_addc (Z.log2 s6) 0)%expr @ + (#(Z_cast rc)%expr @ c, + #(Z_cast rx)%expr @ x7, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x7, _) := xv in x7) args1 + (v (Compile.reflect x4)) args0 + (v0 (Compile.reflect x5)) args + (v1 (Compile.reflect x6)); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + match x3 with + | @expr.Ident _ _ _ t0 idc0 => + match x2 with + | @expr.Ident _ _ _ t1 idc1 => + match x1 with + | @expr.Ident _ _ _ t2 idc2 => + match x0 with + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t3 idc3) + x4 => + match x4 with + | (@expr.Ident _ _ _ t4 idc4 @ x6 @ x5)%expr_pat => + match x6 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x5 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 + Raw.ident.Literal; + args7 <- invert_bind_args idc1 + Raw.ident.Literal; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + (projT1 args6)) -> + (s9 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x11 : option => x11) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> + (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> + (projT1 args7)) -> + (projT1 args6)) -> + (s9 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args6); + v <- type.try_make_transport_cps s9 + ℤ; + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv3 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x11 <- (let + '(r1, r2)%zrange := + range in + fun + (s10 bb xx : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask + offset : Z) => + if + (s10 =? + 2 ^ Z.log2 s10) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s10 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s10 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s10) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 + s10) + offset)%expr @ + ((##bb)%expr, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x11, _) := + xv in + x11) + (let (x11, _) := + xv0 in + x11) + (let (x11, _) := + xv1 in + x11) args5 args3 + args1 + (v + (Compile.reflect + x10)) + (let (x11, _) := + xv2 in + x11) + (let (x11, _) := + xv3 in + x11); + Some (Base x11)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Ident _ _ _ t7 idc7) x10 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s9 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x6 with + | @expr.App _ _ _ s6 _ + (@expr.Ident _ _ _ t5 idc5) x7 => + match x5 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 + Raw.ident.Literal; + args4 <- invert_bind_args idc1 + Raw.ident.Literal; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + (projT1 args3)) -> + s6 -> (projT1 args))%ptype option + (fun x8 : option => x8) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> + (projT1 args4)) -> + (projT1 args3)) -> + s6 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args3); + v <- type.try_make_transport_cps s6 + ℤ; + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x8 <- (let + '(r1, r2)%zrange := + range in + fun (s7 bb xx : Z) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s7 =? + 2 ^ Z.log2 s7) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s7 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 s7) + (- offset))%expr @ + ((##bb)%expr, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x8, _) := + xv in + x8) + (let (x8, _) := + xv0 in + x8) + (let (x8, _) := + xv1 in + x8) args2 args0 + (v + (Compile.reflect + x7)) + (let (x8, _) := + xv2 in + x8); + Some (Base x8)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s6 _ ($_)%expr _ | @expr.App + _ _ _ s6 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s6 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s6 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> + (projT1 args0)) -> s3)%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> + (projT1 args0)) -> s3)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args1); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v <- type.try_make_transport_cps s3 ℤ; + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 bb xx : Z) + (ry : zrange) (y : expr ℤ) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize ry <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s4) 0)%expr @ + ((##bb)%expr, (##xx)%expr, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x5, _) := xv in x5) + (let (x5, _) := xv0 in x5) + (let (x5, _) := xv1 in x5) args + (v (Compile.reflect x4)); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t2 idc2) x4 => + match x0 with + | @expr.Ident _ _ _ t3 idc3 => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + (projT1 args))%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s3 ℤ; + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 bb : Z) (rx : zrange) + (x5 : expr ℤ) (yy : Z) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s4) 0)%expr @ + ((##bb)%expr, + #(Z_cast rx)%expr @ x5, + (##yy)%expr)))%expr_pat + else None) + (let (x5, _) := xv in x5) + (let (x5, _) := xv0 in x5) + args0 (v (Compile.reflect x4)) + (let (x5, _) := xv1 in x5); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) + x5 => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ x7 @ x6)%expr_pat => + match x7 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x6 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 + Raw.ident.Literal; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> (projT1 args7)) -> + s3) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x12 : option => x12) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> + (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> + (projT1 args7)) -> s3) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args7); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s10 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x12 <- (let + '(r1, r2)%zrange := + range in + fun (s11 bb : Z) + (rx : zrange) + (x12 : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask + offset : Z) => + if + (s11 =? + 2 ^ Z.log2 s11) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s11 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s11 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s11) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 + s11) + offset)%expr @ + ((##bb)%expr, + #(Z_cast rx)%expr @ + x12, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x12, _) := + xv in + x12) + (let (x12, _) := + xv0 in + x12) args6 + (v + (Compile.reflect + x4)) args5 + args3 args1 + (v0 + (Compile.reflect + x11)) + (let (x12, _) := + xv1 in + x12) + (let (x12, _) := + xv2 in + x12); + Some (Base x12)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x7 with + | @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 => + match x6 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 + Raw.ident.Literal; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> (projT1 args4)) -> + s3) -> s7 -> (projT1 args))%ptype + option (fun x9 : option => x9) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> + (projT1 args4)) -> s3) -> + s7 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args4); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s7 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x9 <- (let + '(r1, r2)%zrange := + range in + fun (s8 bb : Z) + (rx : zrange) + (x9 : expr ℤ) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s8 =? + 2 ^ Z.log2 s8) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s8 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 s8) + (- offset))%expr @ + ((##bb)%expr, + #(Z_cast rx)%expr @ + x9, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x9, _) := + xv in + x9) + (let (x9, _) := + xv0 in + x9) args3 + (v + (Compile.reflect + x4)) args2 + args0 + (v0 + (Compile.reflect + x8)) + (let (x9, _) := + xv1 in + x9); + Some (Base x9)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App + _ _ _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s7 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Literal; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + s4)%ptype option (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> (projT1 args1)) -> s3) -> + s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args1); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + fv <- (x6 <- (let + '(r1, r2)%zrange := range in + fun (s5 bb : Z) (rx : zrange) + (x6 : expr ℤ) (ry : zrange) + (y : expr ℤ) => + if + (s5 =? 2 ^ Z.log2 s5) && + (ZRange.normalize ry <=? + r[0 ~> s5 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s5) 0)%expr @ + ((##bb)%expr, + #(Z_cast rx)%expr @ x6, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x6, _) := xv in x6) + (let (x6, _) := xv0 in x6) + args0 (v (Compile.reflect x4)) + args (v0 (Compile.reflect x5)); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ (@expr.Ident _ _ _ t1 idc1) x4 => + match x1 with + | @expr.Ident _ _ _ t2 idc2 => + match x0 with + | @expr.Ident _ _ _ t3 idc3 => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x5 : option => x5) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x5 <- (let + '(r1, r2)%zrange := range in + fun (s4 : Z) (rb : zrange) + (b2 : expr ℤ) (xx yy : Z) => + if + (s4 =? 2 ^ Z.log2 s4) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s4 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s4) 0)%expr @ + (#(Z_cast rb)%expr @ b2, + (##xx)%expr, (##yy)%expr)))%expr_pat + else None) + (let (x5, _) := xv in x5) args1 + (v (Compile.reflect x4)) + (let (x5, _) := xv0 in x5) + (let (x5, _) := xv1 in x5); + Some (Base x5)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t3 idc3) + x5 => + match x5 with + | (@expr.Ident _ _ _ t4 idc4 @ x7 @ x6)%expr_pat => + match x7 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x6 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 + Raw.ident.Literal; + args7 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (projT1 args6)) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x12 : option => x12) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> + (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> + (projT1 args6)) -> + (s10 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + v <- type.try_make_transport_cps s3 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args6); + v0 <- type.try_make_transport_cps s10 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv2 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x12 <- (let + '(r1, r2)%zrange := + range in + fun (s11 : Z) + (rb : zrange) + (b4 : expr ℤ) + (xx : Z) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask + offset : Z) => + if + (s11 =? + 2 ^ Z.log2 s11) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s11 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s11 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s11) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 + s11) + offset)%expr @ + (#(Z_cast rb)%expr @ + b4, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x12, _) := + xv in + x12) args7 + (v + (Compile.reflect + x4)) + (let (x12, _) := + xv0 in + x12) args5 args3 + args1 + (v0 + (Compile.reflect + x11)) + (let (x12, _) := + xv1 in + x12) + (let (x12, _) := + xv2 in + x12); + Some (Base x12)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Ident _ _ _ t7 idc7) x11 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s10 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x7 with + | @expr.App _ _ _ s7 _ + (@expr.Ident _ _ _ t5 idc5) x8 => + match x6 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 + Raw.ident.Literal; + args4 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + (projT1 args3)) -> + s7 -> (projT1 args))%ptype option + (fun x9 : option => x9) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> + (projT1 args3)) -> + s7 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + v <- type.try_make_transport_cps s3 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args3); + v0 <- type.try_make_transport_cps s7 + ℤ; + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x9 <- (let + '(r1, r2)%zrange := + range in + fun (s8 : Z) + (rb : zrange) + (b3 : expr ℤ) + (xx : Z) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s8 =? + 2 ^ Z.log2 s8) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s8 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 s8) + (- offset))%expr @ + (#(Z_cast rb)%expr @ + b3, + (##xx)%expr, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x9, _) := + xv in + x9) args4 + (v + (Compile.reflect + x4)) + (let (x9, _) := + xv0 in + x9) args2 args0 + (v0 + (Compile.reflect + x8)) + (let (x9, _) := + xv1 in + x9); + Some (Base x9)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s7 _ ($_)%expr _ | @expr.App + _ _ _ s7 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s7 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s7 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Literal; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + s4)%ptype option (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> (projT1 args0)) -> + s4)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args0); + v0 <- type.try_make_transport_cps s4 ℤ; + fv <- (x6 <- (let + '(r1, r2)%zrange := range in + fun (s5 : Z) (rb : zrange) + (b2 : expr ℤ) (xx : Z) + (ry : zrange) (y : expr ℤ) => + if + (s5 =? 2 ^ Z.log2 s5) && + (ZRange.normalize ry <=? + r[0 ~> s5 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s5) 0)%expr @ + (#(Z_cast rb)%expr @ b2, + (##xx)%expr, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x6, _) := xv in x6) args1 + (v (Compile.reflect x4)) + (let (x6, _) := xv0 in x6) args + (v0 (Compile.reflect x5)); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s4 _ (@expr.Ident _ _ _ t2 idc2) x5 => + match x0 with + | @expr.Ident _ _ _ t3 idc3 => + args <- invert_bind_args idc3 Raw.ident.Literal; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> + (projT1 args))%ptype option + (fun x6 : option => x6) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> + (projT1 args))%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + xv0 <- ident.unify pattern.ident.Literal + ##(projT2 args); + fv <- (x6 <- (let + '(r1, r2)%zrange := range in + fun (s5 : Z) (rb : zrange) + (b2 : expr ℤ) (rx : zrange) + (x6 : expr ℤ) (yy : Z) => + if + (s5 =? 2 ^ Z.log2 s5) && + (ZRange.normalize + (ZRange.constant yy) <=? + r[0 ~> s5 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s5) 0)%expr @ + (#(Z_cast rb)%expr @ b2, + #(Z_cast rx)%expr @ x6, + (##yy)%expr)))%expr_pat + else None) + (let (x6, _) := xv in x6) args1 + (v (Compile.reflect x4)) args0 + (v0 (Compile.reflect x5)) + (let (x6, _) := xv0 in x6); + Some (Base x6)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s5 _ (@expr.Ident _ _ _ t3 idc3) + x6 => + match x6 with + | (@expr.Ident _ _ _ t4 idc4 @ x8 @ x7)%expr_pat => + match x8 with + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Ident _ _ _ t8 idc8))%expr_pat => + match x7 with + | @expr.Ident _ _ _ t9 idc9 => + args <- invert_bind_args idc9 + Raw.ident.Literal; + args0 <- invert_bind_args idc8 + Raw.ident.Literal; + args1 <- invert_bind_args idc7 + Raw.ident.Z_cast; + _ <- invert_bind_args idc6 + Raw.ident.Z_land; + args3 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftl; + args5 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args6 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args7 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args8 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> s4) -> + (s11 -> (projT1 args0)) -> + (projT1 args))%ptype option + (fun x13 : option => x13) + with + | Some (_, _, _, (_, _, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> + (ℤ -> ℤ) -> ℤ)%ptype + ((((projT1 args8) -> s3) -> s4) -> + (s11 -> (projT1 args0)) -> + (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args8); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s4 + ℤ; + v1 <- type.try_make_transport_cps s11 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args0); + xv1 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x13 <- (let + '(r1, r2)%zrange := + range in + fun (s12 : Z) + (rb : zrange) + (b4 : expr ℤ) + (rx : zrange) + (x13 : expr ℤ) + (rshiftl rland + ry : zrange) + (y : expr ℤ) + (mask + offset : Z) => + if + (s12 =? + 2 ^ Z.log2 s12) && + (ZRange.normalize + rland << + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftl)%zrange && + (ZRange.normalize + rshiftl <=? + r[0 ~> s12 - 1])%zrange && + (ZRange.normalize + ry &' + ZRange.normalize + (ZRange.constant + mask) <=? + ZRange.normalize + rland)%zrange && + (mask =? + Z.ones + (Z.log2 s12 - + offset)) && + (0 <=? offset) && + (offset <=? + Z.log2 s12) + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 + s12) + offset)%expr @ + (#(Z_cast rb)%expr @ + b4, + #(Z_cast rx)%expr @ + x13, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x13, _) := + xv in + x13) args7 + (v + (Compile.reflect + x4)) args6 + (v0 + (Compile.reflect + x5)) args5 + args3 args1 + (v1 + (Compile.reflect + x12)) + (let (x13, _) := + xv0 in + x13) + (let (x13, _) := + xv1 in + x13); + Some (Base x13)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + ($_)%expr))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.Abs _ _ _ _ _ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + (_ @ _)))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Ident _ _ _ t7 idc7) x12 @ + @expr.LetIn _ _ _ _ _ _ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ ($_)%expr _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.Abs _ _ _ _ _ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (_ @ _) _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.App _ _ _ + s11 _ (@expr.LetIn _ _ _ _ _ _ _) _ @ _))%expr_pat => + None + | (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ #(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ ($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.Abs _ _ _ + _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Ident _ _ _ t6 idc6 @ @expr.LetIn _ _ + _ _ _ _ _ @ _))%expr_pat => None + | (@expr.Ident _ _ _ t5 idc5 @ #(_))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ ($_)%expr)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.Abs _ _ _ + _ _ _)%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (#(_) @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (($_)%expr @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (($_)%expr @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.Abs _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ (_ @ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ + (@expr.LetIn _ _ _ _ _ _ _ @ _))%expr_pat | + (@expr.Ident _ _ _ t5 idc5 @ @expr.LetIn _ _ + _ _ _ _ _)%expr_pat => None + | _ => None + end;; + match x8 with + | @expr.App _ _ _ s8 _ + (@expr.Ident _ _ _ t5 idc5) x9 => + match x7 with + | @expr.Ident _ _ _ t6 idc6 => + args <- invert_bind_args idc6 + Raw.ident.Literal; + args0 <- invert_bind_args idc5 + Raw.ident.Z_cast; + _ <- invert_bind_args idc4 + Raw.ident.Z_shiftr; + args2 <- invert_bind_args idc3 + Raw.ident.Z_cast; + args3 <- invert_bind_args idc2 + Raw.ident.Z_cast; + args4 <- invert_bind_args idc1 + Raw.ident.Z_cast; + args5 <- invert_bind_args idc0 + Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> s4) -> + s8 -> (projT1 args))%ptype option + (fun x10 : option => x10) + with + | Some (_, _, _, (_, _))%zrange => + if + type.type_beq base.type + base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ -> ℤ)%ptype + ((((projT1 args5) -> s3) -> s4) -> + s8 -> (projT1 args))%ptype + then + xv <- ident.unify + pattern.ident.Literal + ##(projT2 args5); + v <- type.try_make_transport_cps s3 + ℤ; + v0 <- type.try_make_transport_cps s4 + ℤ; + v1 <- type.try_make_transport_cps s8 + ℤ; + xv0 <- ident.unify + pattern.ident.Literal + ##(projT2 args); + fv <- (x10 <- (let + '(r1, r2)%zrange := + range in + fun (s9 : Z) + (rb : zrange) + (b3 : expr ℤ) + (rx : zrange) + (x10 : expr ℤ) + (rshiftr + ry : zrange) + (y : expr ℤ) + (offset : Z) => + if + (s9 =? + 2 ^ Z.log2 s9) && + (ZRange.normalize + ry >> + ZRange.normalize + (ZRange.constant + offset) <=? + ZRange.normalize + rshiftr)%zrange && + (ZRange.normalize + rshiftr <=? + r[0 ~> s9 - 1])%zrange + then + Some + (#(Z_cast2 + (r1, r2))%expr @ + (#(fancy_subb + (Z.log2 + s9) + (- offset))%expr @ + (#(Z_cast rb)%expr @ + b3, + #(Z_cast rx)%expr @ + x10, + #(Z_cast ry)%expr @ + y)))%expr_pat + else None) + (let (x10, _) := + xv in + x10) args4 + (v + (Compile.reflect + x4)) args3 + (v0 + (Compile.reflect + x5)) args2 + args0 + (v1 + (Compile.reflect + x9)) + (let (x10, _) := + xv0 in + x10); + Some (Base x10)); + Some + (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | _ => None + end + | @expr.App _ _ _ s8 _ ($_)%expr _ | @expr.App + _ _ _ s8 _ (@expr.Abs _ _ _ _ _ _) _ | + @expr.App _ _ _ s8 _ (_ @ _)%expr_pat _ | + @expr.App _ _ _ s8 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end;; + args <- invert_bind_args idc3 Raw.ident.Z_cast; + args0 <- invert_bind_args idc2 Raw.ident.Z_cast; + args1 <- invert_bind_args idc1 Raw.ident.Z_cast; + args2 <- invert_bind_args idc0 Raw.ident.Literal; + _ <- invert_bind_args idc + Raw.ident.Z_sub_with_get_borrow; + match + pattern.type.unify_extracted_cps + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> s5)%ptype + option (fun x7 : option => x7) + with + | Some (_, _, _, _)%zrange => + if + type.type_beq base.type base.type.type_beq + (((ℤ -> ℤ) -> ℤ) -> ℤ)%ptype + ((((projT1 args2) -> s3) -> s4) -> s5)%ptype + then + xv <- ident.unify pattern.ident.Literal + ##(projT2 args2); + v <- type.try_make_transport_cps s3 ℤ; + v0 <- type.try_make_transport_cps s4 ℤ; + v1 <- type.try_make_transport_cps s5 ℤ; + fv <- (x7 <- (let + '(r1, r2)%zrange := range in + fun (s6 : Z) (rb : zrange) + (b2 : expr ℤ) (rx : zrange) + (x7 : expr ℤ) (ry : zrange) + (y : expr ℤ) => + if + (s6 =? 2 ^ Z.log2 s6) && + (ZRange.normalize ry <=? + r[0 ~> s6 - 1])%zrange + then + Some + (#(Z_cast2 (r1, r2))%expr @ + (#(fancy_subb (Z.log2 s6) 0)%expr @ + (#(Z_cast rb)%expr @ b2, + #(Z_cast rx)%expr @ x7, + #(Z_cast ry)%expr @ y)))%expr_pat + else None) + (let (x7, _) := xv in x7) args1 + (v (Compile.reflect x4)) args0 + (v0 (Compile.reflect x5)) args + (v1 (Compile.reflect x6)); + Some (Base x7)); + Some (fv0 <-- fv; + Base fv0)%under_lets + else None + | None => None + end + | @expr.App _ _ _ s5 _ ($_)%expr _ | @expr.App _ _ _ s5 + _ (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s5 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s5 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s4 _ ($_)%expr _ | @expr.App _ _ _ s4 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s4 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s4 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | @expr.App _ _ _ s3 _ ($_)%expr _ | @expr.App _ _ _ s3 _ + (@expr.Abs _ _ _ _ _ _) _ | @expr.App _ _ _ s3 _ + (_ @ _)%expr_pat _ | @expr.App _ _ _ s3 _ + (@expr.LetIn _ _ _ _ _ _ _) _ => None + | _ => None + end + | _ => None + end + | _ => None + end;; + None);;; + Base (#(Z_cast2 range)%expr @ x)%expr_pat)%option +| fancy_add log2wordmax imm => + fun x : expr (ℤ * ℤ)%etype => + Base (#(fancy_add log2wordmax imm)%expr @ x)%expr_pat +| fancy_addc log2wordmax imm => + fun x : expr (ℤ * ℤ * ℤ)%etype => + Base (#(fancy_addc log2wordmax imm)%expr @ x)%expr_pat +| fancy_sub log2wordmax imm => + fun x : expr (ℤ * ℤ)%etype => + Base (#(fancy_sub log2wordmax imm)%expr @ x)%expr_pat +| fancy_subb log2wordmax imm => + fun x : expr (ℤ * ℤ * ℤ)%etype => + Base (#(fancy_subb log2wordmax imm)%expr @ x)%expr_pat +| fancy_mulll log2wordmax => + fun x : expr (ℤ * ℤ)%etype => + Base (#(fancy_mulll log2wordmax)%expr @ x)%expr_pat +| fancy_mullh log2wordmax => + fun x : expr (ℤ * ℤ)%etype => + Base (#(fancy_mullh log2wordmax)%expr @ x)%expr_pat +| fancy_mulhl log2wordmax => + fun x : expr (ℤ * ℤ)%etype => + Base (#(fancy_mulhl log2wordmax)%expr @ x)%expr_pat +| fancy_mulhh log2wordmax => + fun x : expr (ℤ * ℤ)%etype => + Base (#(fancy_mulhh log2wordmax)%expr @ x)%expr_pat +| fancy_rshi log2wordmax x => + fun x0 : expr (ℤ * ℤ)%etype => + Base (#(fancy_rshi log2wordmax x)%expr @ x0)%expr_pat +| fancy_selc => + fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_selc)%expr @ x)%expr_pat +| fancy_selm log2wordmax => + fun x : expr (ℤ * ℤ * ℤ)%etype => + Base (#(fancy_selm log2wordmax)%expr @ x)%expr_pat +| fancy_sell => + fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_sell)%expr @ x)%expr_pat +| fancy_addm => + fun x : expr (ℤ * ℤ * ℤ)%etype => Base (#(fancy_addm)%expr @ x)%expr_pat +end + : Compile.value' true t -- cgit v1.2.3