; LLVM IR from trezor/trezor-crypto :: shamir (shamir_interpolate)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@__const.shamir_interpolate.num = external hidden unnamed_addr constant [8 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @shamir_interpolate(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4, i64 noundef %5) #0 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i8, align 1
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca [8 x i32], align 16
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca [8 x i32], align 16
  %21 = alloca [8 x i32], align 16
  %22 = alloca [8 x i32], align 16
  %23 = alloca [8 x i32], align 16
  %24 = alloca i8, align 1
  %25 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i8 %1, ptr %9, align 1, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i8 %4, ptr %12, align 1, !tbaa !9
  store i64 %5, ptr %13, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #6
  %26 = load i8, ptr %12, align 1, !tbaa !9
  %27 = zext i8 %26 to i64
  %28 = call ptr @llvm.stacksave.p0()
  store ptr %28, ptr %17, align 8
  %29 = alloca [8 x i32], i64 %27, align 16
  store i64 %27, ptr %18, align 8
  %30 = load i8, ptr %12, align 1, !tbaa !9
  %31 = zext i8 %30 to i64
  %32 = alloca [8 x i32], i64 %31, align 16
  store i64 %31, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 @__const.shamir_interpolate.num, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #6
  call void @llvm.memset.p0.i64(ptr align 16 %23, i8 0, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #6
  store i8 1, ptr %24, align 1, !tbaa !12
  %33 = load i64, ptr %13, align 8, !tbaa !10
  %34 = icmp ugt i64 %33, 32
  br i1 %34, label %35, label %36

35:                                               ; preds = %6
  store i1 false, ptr %7, align 1
  store i32 1, ptr %25, align 4
  br label %197

36:                                               ; preds = %6
  store i64 0, ptr %14, align 8, !tbaa !10
  br label %37

37:                                               ; preds = %58, %36
  %38 = load i64, ptr %14, align 8, !tbaa !10
  %39 = load i8, ptr %12, align 1, !tbaa !9
  %40 = zext i8 %39 to i64
  %41 = icmp ult i64 %38, %40
  br i1 %41, label %42, label %61

42:                                               ; preds = %37
  %43 = load i64, ptr %14, align 8, !tbaa !10
  %44 = getelementptr inbounds [8 x i32], ptr %29, i64 %43
  %45 = getelementptr inbounds [8 x i32], ptr %44, i64 0, i64 0
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i64, ptr %14, align 8, !tbaa !10
  %48 = getelementptr inbounds i8, ptr %46, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !9
  call void @bitslice_setall(ptr noundef %45, i8 noundef zeroext %49)
  %50 = load i64, ptr %14, align 8, !tbaa !10
  %51 = getelementptr inbounds [8 x i32], ptr %32, i64 %50
  %52 = getelementptr inbounds [8 x i32], ptr %51, i64 0, i64 0
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = load i64, ptr %14, align 8, !tbaa !10
  %55 = getelementptr inbounds ptr, ptr %53, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = load i64, ptr %13, align 8, !tbaa !10
  call void @bitslice(ptr noundef %52, ptr noundef %56, i64 noundef %57)
  br label %58

58:                                               ; preds = %42
  %59 = load i64, ptr %14, align 8, !tbaa !10
  %60 = add i64 %59, 1
  store i64 %60, ptr %14, align 8, !tbaa !10
  br label %37, !llvm.loop !14

61:                                               ; preds = %37
  %62 = getelementptr inbounds [8 x i32], ptr %16, i64 0, i64 0
  %63 = load i8, ptr %9, align 1, !tbaa !9
  call void @bitslice_setall(ptr noundef %62, i8 noundef zeroext %63)
  store i64 0, ptr %14, align 8, !tbaa !10
  br label %64

64:                                               ; preds = %79, %61
  %65 = load i64, ptr %14, align 8, !tbaa !10
  %66 = load i8, ptr %12, align 1, !tbaa !9
  %67 = zext i8 %66 to i64
  %68 = icmp ult i64 %65, %67
  br i1 %68, label %69, label %82

69:                                               ; preds = %64
  %70 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %71 = getelementptr inbounds [8 x i32], ptr %16, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %70, ptr align 16 %71, i64 32, i1 false)
  %72 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %73 = load i64, ptr %14, align 8, !tbaa !10
  %74 = getelementptr inbounds [8 x i32], ptr %29, i64 %73
  %75 = getelementptr inbounds [8 x i32], ptr %74, i64 0, i64 0
  call void @gf256_add(ptr noundef %72, ptr noundef %75)
  %76 = getelementptr inbounds [8 x i32], ptr %20, i64 0, i64 0
  %77 = getelementptr inbounds [8 x i32], ptr %20, i64 0, i64 0
  %78 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  call void @gf256_mul(ptr noundef %76, ptr noundef %77, ptr noundef %78)
  br label %79

79:                                               ; preds = %69
  %80 = load i64, ptr %14, align 8, !tbaa !10
  %81 = add i64 %80, 1
  store i64 %81, ptr %14, align 8, !tbaa !10
  br label %64, !llvm.loop !16

82:                                               ; preds = %64
  store i64 0, ptr %14, align 8, !tbaa !10
  br label %83

83:                                               ; preds = %175, %82
  %84 = load i64, ptr %14, align 8, !tbaa !10
  %85 = load i8, ptr %12, align 1, !tbaa !9
  %86 = zext i8 %85 to i64
  %87 = icmp ult i64 %84, %86
  br i1 %87, label %88, label %178

88:                                               ; preds = %83
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = load i64, ptr %14, align 8, !tbaa !10
  %91 = getelementptr inbounds i8, ptr %89, i64 %90
  %92 = load i8, ptr %91, align 1, !tbaa !9
  %93 = zext i8 %92 to i32
  %94 = load i8, ptr %9, align 1, !tbaa !9
  %95 = zext i8 %94 to i32
  %96 = icmp ne i32 %93, %95
  br i1 %96, label %97, label %104

97:                                               ; preds = %88
  %98 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  %99 = getelementptr inbounds [8 x i32], ptr %16, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %98, ptr align 16 %99, i64 32, i1 false)
  %100 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  %101 = load i64, ptr %14, align 8, !tbaa !10
  %102 = getelementptr inbounds [8 x i32], ptr %29, i64 %101
  %103 = getelementptr inbounds [8 x i32], ptr %102, i64 0, i64 0
  call void @gf256_add(ptr noundef %100, ptr noundef %103)
  br label %110

104:                                              ; preds = %88
  %105 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  call void @bitslice_setall(ptr noundef %105, i8 noundef zeroext 1)
  %106 = getelementptr inbounds [8 x i32], ptr %23, i64 0, i64 0
  %107 = load i64, ptr %14, align 8, !tbaa !10
  %108 = getelementptr inbounds [8 x i32], ptr %32, i64 %107
  %109 = getelementptr inbounds [8 x i32], ptr %108, i64 0, i64 0
  call void @gf256_add(ptr noundef %106, ptr noundef %109)
  br label %110

110:                                              ; preds = %104, %97
  store i64 0, ptr %15, align 8, !tbaa !10
  br label %111

111:                                              ; preds = %133, %110
  %112 = load i64, ptr %15, align 8, !tbaa !10
  %113 = load i8, ptr %12, align 1, !tbaa !9
  %114 = zext i8 %113 to i64
  %115 = icmp ult i64 %112, %114
  br i1 %115, label %116, label %136

116:                                              ; preds = %111
  %117 = load i64, ptr %14, align 8, !tbaa !10
  %118 = load i64, ptr %15, align 8, !tbaa !10
  %119 = icmp eq i64 %117, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %116
  br label %133

121:                                              ; preds = %116
  %122 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %123 = load i64, ptr %14, align 8, !tbaa !10
  %124 = getelementptr inbounds [8 x i32], ptr %29, i64 %123
  %125 = getelementptr inbounds [8 x i32], ptr %124, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %122, ptr align 16 %125, i64 32, i1 false)
  %126 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %127 = load i64, ptr %15, align 8, !tbaa !10
  %128 = getelementptr inbounds [8 x i32], ptr %29, i64 %127
  %129 = getelementptr inbounds [8 x i32], ptr %128, i64 0, i64 0
  call void @gf256_add(ptr noundef %126, ptr noundef %129)
  %130 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  %131 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  %132 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  call void @gf256_mul(ptr noundef %130, ptr noundef %131, ptr noundef %132)
  br label %133

133:                                              ; preds = %121, %120
  %134 = load i64, ptr %15, align 8, !tbaa !10
  %135 = add i64 %134, 1
  store i64 %135, ptr %15, align 8, !tbaa !10
  br label %111, !llvm.loop !17

136:                                              ; preds = %111
  %137 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  %138 = load i32, ptr %137, align 16, !tbaa !18
  %139 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 1
  %140 = load i32, ptr %139, align 4, !tbaa !18
  %141 = or i32 %138, %140
  %142 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 2
  %143 = load i32, ptr %142, align 8, !tbaa !18
  %144 = or i32 %141, %143
  %145 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 3
  %146 = load i32, ptr %145, align 4, !tbaa !18
  %147 = or i32 %144, %146
  %148 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 4
  %149 = load i32, ptr %148, align 16, !tbaa !18
  %150 = or i32 %147, %149
  %151 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 5
  %152 = load i32, ptr %151, align 4, !tbaa !18
  %153 = or i32 %150, %152
  %154 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 6
  %155 = load i32, ptr %154, align 8, !tbaa !18
  %156 = or i32 %153, %155
  %157 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 7
  %158 = load i32, ptr %157, align 4, !tbaa !18
  %159 = or i32 %156, %158
  %160 = icmp eq i32 %159, 0
  br i1 %160, label %161, label %162

161:                                              ; preds = %136
  store i8 0, ptr %24, align 1, !tbaa !12
  br label %178

162:                                              ; preds = %136
  %163 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %164 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  call void @gf256_inv(ptr noundef %163, ptr noundef %164)
  %165 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %166 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %167 = getelementptr inbounds [8 x i32], ptr %20, i64 0, i64 0
  call void @gf256_mul(ptr noundef %165, ptr noundef %166, ptr noundef %167)
  %168 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %169 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  %170 = load i64, ptr %14, align 8, !tbaa !10
  %171 = getelementptr inbounds [8 x i32], ptr %32, i64 %170
  %172 = getelementptr inbounds [8 x i32], ptr %171, i64 0, i64 0
  call void @gf256_mul(ptr noundef %168, ptr noundef %169, ptr noundef %172)
  %173 = getelementptr inbounds [8 x i32], ptr %23, i64 0, i64 0
  %174 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  call void @gf256_add(ptr noundef %173, ptr noundef %174)
  br label %175

175:                                              ; preds = %162
  %176 = load i64, ptr %14, align 8, !tbaa !10
  %177 = add i64 %176, 1
  store i64 %177, ptr %14, align 8, !tbaa !10
  br label %83, !llvm.loop !20

178:                                              ; preds = %161, %83
  %179 = load i8, ptr %24, align 1, !tbaa !12, !range !21, !noundef !22
  %180 = trunc i8 %179 to i1
  %181 = zext i1 %180 to i32
  %182 = icmp eq i32 %181, 1
  br i1 %182, label %183, label %187

183:                                              ; preds = %178
  %184 = load ptr, ptr %8, align 8, !tbaa !5
  %185 = getelementptr inbounds [8 x i32], ptr %23, i64 0, i64 0
  %186 = load i64, ptr %13, align 8, !tbaa !10
  call void @unbitslice(ptr noundef %184, ptr noundef %185, i64 noundef %186)
  br label %187

187:                                              ; preds = %183, %178
  %188 = getelementptr inbounds [8 x i32], ptr %16, i64 0, i64 0
  call void @memzero(ptr noundef %188, i64 noundef 32)
  %189 = mul nuw i64 32, %27
  call void @memzero(ptr noundef %29, i64 noundef %189)
  %190 = mul nuw i64 32, %31
  call void @memzero(ptr noundef %32, i64 noundef %190)
  %191 = getelementptr inbounds [8 x i32], ptr %20, i64 0, i64 0
  call void @memzero(ptr noundef %191, i64 noundef 32)
  %192 = getelementptr inbounds [8 x i32], ptr %21, i64 0, i64 0
  call void @memzero(ptr noundef %192, i64 noundef 32)
  %193 = getelementptr inbounds [8 x i32], ptr %22, i64 0, i64 0
  call void @memzero(ptr noundef %193, i64 noundef 32)
  %194 = getelementptr inbounds [8 x i32], ptr %23, i64 0, i64 0
  call void @memzero(ptr noundef %194, i64 noundef 32)
  %195 = load i8, ptr %24, align 1, !tbaa !12, !range !21, !noundef !22
  %196 = trunc i8 %195 to i1
  store i1 %196, ptr %7, align 1
  store i32 1, ptr %25, align 4
  br label %197

197:                                              ; preds = %187, %35
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #6
  %198 = load ptr, ptr %17, align 8
  call void @llvm.stackrestore.p0(ptr %198)
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %199 = load i1, ptr %7, align 1
  ret i1 %199
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
declare hidden void @bitslice_setall(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare hidden void @bitslice(ptr noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @gf256_add(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @gf256_mul(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @gf256_inv(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @unbitslice(ptr noundef, ptr noundef, i64 noundef) #0

declare void @memzero(ptr noundef, i64 noundef) #5

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = distinct !{!20, !15}
!21 = !{i8 0, i8 2}
!22 = !{}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@__const.shamir_interpolate.num = external hidden unnamed_addr constant [8 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @shamir_interpolate(ptr noundef %0, i8 noundef zeroext %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, i8 noundef zeroext %4, i64 noundef %5) local_unnamed_addr #0 {
  %7 = alloca [8 x i32], align 16
  %8 = alloca [8 x i32], align 16
  %9 = alloca [8 x i32], align 16
  %10 = alloca [8 x i32], align 16
  %11 = alloca [8 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  %12 = zext i8 %4 to i64
  %13 = tail call ptr @llvm.stacksave.p0()
  %14 = alloca [8 x i32], i64 %12, align 16
  %15 = alloca [8 x i32], i64 %12, align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %8, ptr noundef nonnull align 16 dereferenceable(32) @__const.shamir_interpolate.num, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %11, i8 0, i64 32, i1 false)
  %16 = icmp ugt i64 %5, 32
  br i1 %16, label %50, label %.preheader44

.preheader44:                                     ; preds = %6
  %.not53 = icmp eq i8 %4, 0
  br i1 %.not53, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %.preheader44
  call void @bitslice_setall(ptr noundef nonnull %7, i8 noundef zeroext %1)
  br label %.critedge

.lr.ph:                                           ; preds = %.preheader44, %.lr.ph
  %.04046 = phi i64 [ %23, %.lr.ph ], [ 0, %.preheader44 ]
  %17 = getelementptr inbounds [8 x i32], ptr %14, i64 %.04046
  %18 = getelementptr inbounds i8, ptr %2, i64 %.04046
  %19 = load i8, ptr %18, align 1, !tbaa !5
  call void @bitslice_setall(ptr noundef nonnull %17, i8 noundef zeroext %19)
  %20 = getelementptr inbounds [8 x i32], ptr %15, i64 %.04046
  %21 = getelementptr inbounds ptr, ptr %3, i64 %.04046
  %22 = load ptr, ptr %21, align 8, !tbaa !8
  call void @bitslice(ptr noundef nonnull %20, ptr noundef %22, i64 noundef %5)
  %23 = add nuw nsw i64 %.04046, 1
  %exitcond.not = icmp eq i64 %23, %12
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

._crit_edge:                                      ; preds = %.lr.ph
  call void @bitslice_setall(ptr noundef nonnull %7, i8 noundef zeroext %1)
  br i1 %.not53, label %.critedge, label %.lr.ph49

.preheader:                                       ; preds = %.lr.ph49
  br i1 %.not53, label %.critedge, label %.lr.ph52

.lr.ph49:                                         ; preds = %._crit_edge, %.lr.ph49
  %.147 = phi i64 [ %25, %.lr.ph49 ], [ 0, %._crit_edge ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %10, ptr noundef nonnull align 16 dereferenceable(32) %7, i64 32, i1 false)
  %24 = getelementptr inbounds [8 x i32], ptr %14, i64 %.147
  call void @gf256_add(ptr noundef nonnull %10, ptr noundef nonnull %24)
  call void @gf256_mul(ptr noundef nonnull %8, ptr noundef nonnull %8, ptr noundef nonnull %10)
  %25 = add nuw nsw i64 %.147, 1
  %exitcond58.not = icmp eq i64 %25, %12
  br i1 %exitcond58.not, label %.preheader, label %.lr.ph49, !llvm.loop !12

.lr.ph52:                                         ; preds = %.preheader, %44
  %26 = phi i1 [ %47, %44 ], [ false, %.preheader ]
  %.251 = phi i64 [ %46, %44 ], [ 0, %.preheader ]
  %27 = getelementptr inbounds i8, ptr %2, i64 %.251
  %28 = load i8, ptr %27, align 1, !tbaa !5
  %.not = icmp eq i8 %28, %1
  br i1 %.not, label %30, label %29

29:                                               ; preds = %.lr.ph52
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %9, ptr noundef nonnull align 16 dereferenceable(32) %7, i64 32, i1 false)
  br label %31

30:                                               ; preds = %.lr.ph52
  call void @bitslice_setall(ptr noundef nonnull %9, i8 noundef zeroext 1)
  br label %31

31:                                               ; preds = %30, %29
  %.sink65 = phi ptr [ %15, %30 ], [ %14, %29 ]
  %.sink = phi ptr [ %11, %30 ], [ %9, %29 ]
  %32 = getelementptr inbounds [8 x i32], ptr %.sink65, i64 %.251
  call void @gf256_add(ptr noundef nonnull %.sink, ptr noundef nonnull %32)
  %33 = getelementptr inbounds [8 x i32], ptr %14, i64 %.251
  br label %34

34:                                               ; preds = %31, %38
  %.04150 = phi i64 [ 0, %31 ], [ %39, %38 ]
  %35 = icmp eq i64 %.251, %.04150
  br i1 %35, label %38, label %36

36:                                               ; preds = %34
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %10, ptr noundef nonnull align 16 dereferenceable(32) %33, i64 32, i1 false)
  %37 = getelementptr inbounds [8 x i32], ptr %14, i64 %.04150
  call void @gf256_add(ptr noundef nonnull %10, ptr noundef nonnull %37)
  call void @gf256_mul(ptr noundef nonnull %9, ptr noundef nonnull %9, ptr noundef nonnull %10)
  br label %38

38:                                               ; preds = %34, %36
  %39 = add nuw nsw i64 %.04150, 1
  %exitcond59.not = icmp eq i64 %39, %12
  br i1 %exitcond59.not, label %40, label %34, !llvm.loop !13

40:                                               ; preds = %38
  %41 = load <8 x i32>, ptr %9, align 16, !tbaa !14
  %42 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> %41)
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %.loopexit, label %44

44:                                               ; preds = %40
  call void @gf256_inv(ptr noundef nonnull %10, ptr noundef nonnull %9)
  call void @gf256_mul(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %8)
  %45 = getelementptr inbounds [8 x i32], ptr %15, i64 %.251
  call void @gf256_mul(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %45)
  call void @gf256_add(ptr noundef nonnull %11, ptr noundef nonnull %10)
  %46 = add nuw nsw i64 %.251, 1
  %47 = icmp uge i64 %46, %12
  %exitcond60 = icmp eq i64 %46, %12
  br i1 %exitcond60, label %.critedge, label %.lr.ph52, !llvm.loop !16

.critedge:                                        ; preds = %44, %._crit_edge, %._crit_edge.thread, %.preheader
  %.lcssa = phi i1 [ true, %.preheader ], [ true, %._crit_edge.thread ], [ true, %._crit_edge ], [ %47, %44 ]
  call void @unbitslice(ptr noundef %0, ptr noundef nonnull %11, i64 noundef %5)
  br label %.loopexit

.loopexit:                                        ; preds = %40, %.critedge
  %48 = phi i1 [ %.lcssa, %.critedge ], [ %26, %40 ]
  call void @memzero(ptr noundef nonnull %7, i64 noundef 32) #7
  %49 = shl nuw nsw i64 %12, 5
  call void @memzero(ptr noundef nonnull %14, i64 noundef %49) #7
  call void @memzero(ptr noundef nonnull %15, i64 noundef %49) #7
  call void @memzero(ptr noundef nonnull %8, i64 noundef 32) #7
  call void @memzero(ptr noundef nonnull %9, i64 noundef 32) #7
  call void @memzero(ptr noundef nonnull %10, i64 noundef 32) #7
  call void @memzero(ptr noundef nonnull %11, i64 noundef 32) #7
  br label %50

50:                                               ; preds = %6, %.loopexit
  %.039 = phi i1 [ %48, %.loopexit ], [ false, %6 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  call void @llvm.stackrestore.p0(ptr %13)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  ret i1 %.039
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
declare hidden void @bitslice_setall(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @bitslice(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @gf256_add(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @gf256_mul(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @gf256_inv(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @unbitslice(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare void @memzero(ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.or.v8i32(<8 x i32>) #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !6, i64 0}
!16 = distinct !{!16, !11}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass