; LLVM IR from intel/cryptography-primitives :: sources/ippcp/gfpec (pcpgfpx_exp)

; 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"

%struct._gsModEngine = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, i32, i32, ptr }
%struct._gsModMethod = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local ptr @cpGFpxExp(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i64, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %32 = load ptr, ptr %11, align 8, !tbaa !5
  %33 = call ptr @cpGFpBasic(ptr noundef %32)
  store ptr %33, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._gsModEngine, ptr %34, i32 0, i32 6
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct._gsModMethod, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !14
  store ptr %38, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._gsModEngine, ptr %39, i32 0, i32 6
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = getelementptr inbounds %struct._gsModMethod, ptr %41, i32 0, i32 3
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  store ptr %43, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._gsModEngine, ptr %44, i32 0, i32 3
  %46 = load i32, ptr %45, align 8, !tbaa !17
  store i32 %46, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = mul nsw i32 %47, 64
  store i32 %48, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = icmp eq ptr null, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %6
  br label %55

52:                                               ; preds = %6
  %53 = load i32, ptr %19, align 4, !tbaa !9
  %54 = call i32 @cpGFpGetOptimalWinSize(i32 noundef %53)
  br label %55

55:                                               ; preds = %52, %51
  %56 = phi i32 [ 1, %51 ], [ %54, %52 ]
  store i32 %56, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %57 = load i32, ptr %20, align 4, !tbaa !9
  %58 = shl i32 1, %57
  store i32 %58, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._gsModEngine, ptr %59, i32 0, i32 5
  %61 = load i32, ptr %60, align 8, !tbaa !18
  store i32 %61, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = call ptr @gsModPoolAlloc(ptr noundef %62, i32 noundef 1)
  store ptr %63, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = call ptr @gsModPoolAlloc(ptr noundef %64, i32 noundef 1)
  store ptr %65, ptr %24, align 8, !tbaa !5
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = icmp eq ptr null, %66
  br i1 %67, label %68, label %76

68:                                               ; preds = %55
  %69 = load i32, ptr %22, align 4, !tbaa !9
  %70 = mul nsw i32 %69, 8
  %71 = call i32 @div_upper(i32 noundef 64, i32 noundef %70)
  %72 = add nsw i32 2, %71
  store i32 %72, ptr %17, align 4, !tbaa !9
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = load i32, ptr %17, align 4, !tbaa !9
  %75 = call ptr @gsModPoolAlloc(ptr noundef %73, i32 noundef %74)
  store ptr %75, ptr %12, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %68, %55
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = call i64 @IPP_INT_PTR(ptr noundef %78)
  %80 = and i64 %79, 63
  %81 = xor i64 %80, -1
  %82 = add nsw i64 %81, 1
  %83 = and i64 %82, 63
  %84 = getelementptr inbounds i8, ptr %77, i64 %83
  store ptr %84, ptr %16, align 8, !tbaa !5
  %85 = load ptr, ptr %24, align 8, !tbaa !5
  %86 = load i32, ptr %18, align 4, !tbaa !9
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._gsModEngine, ptr %87, i32 0, i32 10
  %89 = load ptr, ptr %88, align 8, !tbaa !19
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._gsModEngine, ptr %90, i32 0, i32 3
  %92 = load i32, ptr %91, align 8, !tbaa !17
  %93 = call ptr @cpGFpElementCopyPad(ptr noundef %85, i32 noundef %86, ptr noundef %89, i32 noundef %92)
  %94 = load ptr, ptr %16, align 8, !tbaa !5
  %95 = load ptr, ptr %24, align 8, !tbaa !5
  %96 = load i32, ptr %18, align 4, !tbaa !9
  %97 = load i32, ptr %20, align 4, !tbaa !9
  call void @gsScramblePut(ptr noundef %94, i32 noundef 0, ptr noundef %95, i32 noundef %96, i32 noundef %97)
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  store i32 1, ptr %25, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %114, %76
  %99 = load i32, ptr %25, align 4, !tbaa !9
  %100 = load i32, ptr %21, align 4, !tbaa !9
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %117

102:                                              ; preds = %98
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = load ptr, ptr %24, align 8, !tbaa !5
  %105 = load ptr, ptr %24, align 8, !tbaa !5
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  %108 = call ptr %103(ptr noundef %104, ptr noundef %105, ptr noundef %106, ptr noundef %107)
  %109 = load ptr, ptr %16, align 8, !tbaa !5
  %110 = load i32, ptr %25, align 4, !tbaa !9
  %111 = load ptr, ptr %24, align 8, !tbaa !5
  %112 = load i32, ptr %18, align 4, !tbaa !9
  %113 = load i32, ptr %20, align 4, !tbaa !9
  call void @gsScramblePut(ptr noundef %109, i32 noundef %110, ptr noundef %111, i32 noundef %112, i32 noundef %113)
  br label %114

114:                                              ; preds = %102
  %115 = load i32, ptr %25, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %25, align 4, !tbaa !9
  br label %98, !llvm.loop !20

117:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  %118 = load ptr, ptr %23, align 8, !tbaa !5
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = load i32, ptr %10, align 4, !tbaa !9
  %121 = call ptr @cpGFpElementCopy(ptr noundef %118, ptr noundef %119, i32 noundef %120)
  %122 = load ptr, ptr %23, align 8, !tbaa !5
  %123 = load i32, ptr %19, align 4, !tbaa !9
  %124 = add nsw i32 %123, 31
  %125 = ashr i32 %124, 5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i32, ptr %122, i64 %126
  store i32 0, ptr %127, align 4, !tbaa !9
  %128 = load i32, ptr %19, align 4, !tbaa !9
  %129 = load i32, ptr %20, align 4, !tbaa !9
  %130 = add nsw i32 %128, %129
  %131 = sub nsw i32 %130, 1
  %132 = load i32, ptr %20, align 4, !tbaa !9
  %133 = sdiv i32 %131, %132
  %134 = load i32, ptr %20, align 4, !tbaa !9
  %135 = mul nsw i32 %133, %134
  store i32 %135, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %136 = load i32, ptr %21, align 4, !tbaa !9
  %137 = sub nsw i32 %136, 1
  %138 = sext i32 %137 to i64
  store i64 %138, ptr %26, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  %139 = load i32, ptr %19, align 4, !tbaa !9
  %140 = load i32, ptr %20, align 4, !tbaa !9
  %141 = sub nsw i32 %139, %140
  store i32 %141, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  %142 = load ptr, ptr %23, align 8, !tbaa !5
  %143 = load i32, ptr %27, align 4, !tbaa !9
  %144 = sdiv i32 %143, 16
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i16, ptr %142, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !9
  store i32 %147, ptr %28, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %148 = load i32, ptr %27, align 4, !tbaa !9
  %149 = and i32 %148, 15
  store i32 %149, ptr %29, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #4
  %150 = load i32, ptr %28, align 4, !tbaa !9
  %151 = load i32, ptr %29, align 4, !tbaa !9
  %152 = lshr i32 %150, %151
  %153 = zext i32 %152 to i64
  %154 = load i64, ptr %26, align 8, !tbaa !22
  %155 = and i64 %153, %154
  %156 = trunc i64 %155 to i32
  store i32 %156, ptr %30, align 4, !tbaa !9
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  %158 = load i32, ptr %18, align 4, !tbaa !9
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = load i32, ptr %30, align 4, !tbaa !9
  %161 = load i32, ptr %20, align 4, !tbaa !9
  call void @gsScrambleGet_sscm(ptr noundef %157, i32 noundef %158, ptr noundef %159, i32 noundef %160, i32 noundef %161)
  %162 = load i32, ptr %20, align 4, !tbaa !9
  %163 = load i32, ptr %27, align 4, !tbaa !9
  %164 = sub nsw i32 %163, %162
  store i32 %164, ptr %27, align 4, !tbaa !9
  br label %165

165:                                              ; preds = %209, %117
  %166 = load i32, ptr %27, align 4, !tbaa !9
  %167 = icmp sge i32 %166, 0
  br i1 %167, label %168, label %213

168:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #4
  store i32 0, ptr %31, align 4, !tbaa !9
  br label %169

169:                                              ; preds = %179, %168
  %170 = load i32, ptr %31, align 4, !tbaa !9
  %171 = load i32, ptr %20, align 4, !tbaa !9
  %172 = icmp slt i32 %170, %171
  br i1 %172, label %173, label %182

173:                                              ; preds = %169
  %174 = load ptr, ptr %15, align 8, !tbaa !5
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = load ptr, ptr %7, align 8, !tbaa !5
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = call ptr %174(ptr noundef %175, ptr noundef %176, ptr noundef %177)
  br label %179

179:                                              ; preds = %173
  %180 = load i32, ptr %31, align 4, !tbaa !9
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %31, align 4, !tbaa !9
  br label %169, !llvm.loop !23

182:                                              ; preds = %169
  %183 = load ptr, ptr %23, align 8, !tbaa !5
  %184 = load i32, ptr %27, align 4, !tbaa !9
  %185 = sdiv i32 %184, 16
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds i16, ptr %183, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !9
  store i32 %188, ptr %28, align 4, !tbaa !9
  %189 = load i32, ptr %27, align 4, !tbaa !9
  %190 = and i32 %189, 15
  store i32 %190, ptr %29, align 4, !tbaa !9
  %191 = load i32, ptr %28, align 4, !tbaa !9
  %192 = load i32, ptr %29, align 4, !tbaa !9
  %193 = lshr i32 %191, %192
  %194 = zext i32 %193 to i64
  %195 = load i64, ptr %26, align 8, !tbaa !22
  %196 = and i64 %194, %195
  %197 = trunc i64 %196 to i32
  store i32 %197, ptr %30, align 4, !tbaa !9
  %198 = load ptr, ptr %24, align 8, !tbaa !5
  %199 = load i32, ptr %18, align 4, !tbaa !9
  %200 = load ptr, ptr %16, align 8, !tbaa !5
  %201 = load i32, ptr %30, align 4, !tbaa !9
  %202 = load i32, ptr %20, align 4, !tbaa !9
  call void @gsScrambleGet_sscm(ptr noundef %198, i32 noundef %199, ptr noundef %200, i32 noundef %201, i32 noundef %202)
  %203 = load ptr, ptr %14, align 8, !tbaa !5
  %204 = load ptr, ptr %7, align 8, !tbaa !5
  %205 = load ptr, ptr %7, align 8, !tbaa !5
  %206 = load ptr, ptr %24, align 8, !tbaa !5
  %207 = load ptr, ptr %11, align 8, !tbaa !5
  %208 = call ptr %203(ptr noundef %204, ptr noundef %205, ptr noundef %206, ptr noundef %207)
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #4
  br label %209

209:                                              ; preds = %182
  %210 = load i32, ptr %20, align 4, !tbaa !9
  %211 = load i32, ptr %27, align 4, !tbaa !9
  %212 = sub nsw i32 %211, %210
  store i32 %212, ptr %27, align 4, !tbaa !9
  br label %165, !llvm.loop !24

213:                                              ; preds = %165
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = load i32, ptr %17, align 4, !tbaa !9
  %216 = add nsw i32 %215, 2
  call void @gsModPoolFree(ptr noundef %214, i32 noundef %216)
  %217 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret ptr %217
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cpGFpBasic(ptr noundef) #2

declare i32 @cpGFpGetOptimalWinSize(i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @gsModPoolAlloc(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @div_upper(i32 noundef, i32 noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @IPP_INT_PTR(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cpGFpElementCopyPad(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

declare void @gsScramblePut(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cpGFpElementCopy(ptr noundef, ptr noundef, i32 noundef) #2

declare void @gsScrambleGet_sscm(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gsModPoolFree(ptr noundef, i32 noundef) #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 = { inlinehint 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 #3 = { "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 #4 = { 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_gsModEngine", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"_gsModMethod", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!16 = !{!15, !6, i64 24}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 24}
!19 = !{!12, !6, i64 64}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!13, !13, i64 0}
!23 = distinct !{!23, !21}
!24 = distinct !{!24, !21}


; 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"

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @cpGFpxExp(ptr noundef returned %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = tail call ptr @cpGFpBasic(ptr noundef %4)
  %8 = getelementptr inbounds i8, ptr %4, i64 32
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %9, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %4, i64 16
  %15 = load i32, ptr %14, align 8, !tbaa !15
  %16 = shl nsw i32 %3, 6
  %17 = icmp eq ptr %5, null
  br i1 %17, label %20, label %18

18:                                               ; preds = %6
  %19 = tail call i32 @cpGFpGetOptimalWinSize(i32 noundef %16) #3
  br label %20

20:                                               ; preds = %6, %18
  %21 = phi i32 [ %19, %18 ], [ 1, %6 ]
  %22 = shl nuw i32 1, %21
  %23 = getelementptr inbounds i8, ptr %4, i64 24
  %24 = load i32, ptr %23, align 8, !tbaa !16
  %25 = tail call ptr @gsModPoolAlloc(ptr noundef nonnull %4, i32 noundef 1)
  %26 = tail call ptr @gsModPoolAlloc(ptr noundef nonnull %4, i32 noundef 1)
  br i1 %17, label %27, label %33

27:                                               ; preds = %20
  %28 = shl nsw i32 %24, 3
  %29 = tail call i32 @div_upper(i32 noundef 64, i32 noundef %28)
  %30 = add nsw i32 %29, 2
  %31 = tail call ptr @gsModPoolAlloc(ptr noundef nonnull %4, i32 noundef %30)
  %32 = add nsw i32 %29, 4
  br label %33

33:                                               ; preds = %27, %20
  %.094 = phi i32 [ %32, %27 ], [ 2, %20 ]
  %.092 = phi ptr [ %31, %27 ], [ %5, %20 ]
  %34 = tail call i64 @IPP_INT_PTR(ptr noundef %.092)
  %35 = sub i64 0, %34
  %36 = and i64 %35, 63
  %37 = getelementptr inbounds i8, ptr %.092, i64 %36
  %38 = getelementptr inbounds i8, ptr %7, i64 64
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  %40 = getelementptr inbounds i8, ptr %7, i64 16
  %41 = load i32, ptr %40, align 8, !tbaa !15
  %42 = tail call ptr @cpGFpElementCopyPad(ptr noundef %26, i32 noundef %15, ptr noundef %39, i32 noundef %41)
  tail call void @gsScramblePut(ptr noundef %37, i32 noundef 0, ptr noundef %26, i32 noundef %15, i32 noundef %21) #3
  %43 = icmp sgt i32 %22, 1
  br i1 %43, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %33, %.lr.ph
  %.093101 = phi i32 [ %45, %.lr.ph ], [ 1, %33 ]
  %44 = tail call ptr %11(ptr noundef %26, ptr noundef %26, ptr noundef %1, ptr noundef %4) #3
  tail call void @gsScramblePut(ptr noundef %37, i32 noundef %.093101, ptr noundef %26, i32 noundef %15, i32 noundef %21) #3
  %45 = add nuw nsw i32 %.093101, 1
  %exitcond.not = icmp eq i32 %45, %22
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph, %33
  %46 = tail call ptr @cpGFpElementCopy(ptr noundef %25, ptr noundef %2, i32 noundef %3)
  %47 = shl nsw i32 %3, 1
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %25, i64 %48
  store i32 0, ptr %49, align 4, !tbaa !20
  %50 = add nsw i32 %21, %16
  %.fr98 = freeze i32 %50
  %51 = add i32 %.fr98, -1
  %52 = srem i32 %51, %21
  %53 = add nsw i32 %22, -1
  %54 = add i32 %21, %52
  %55 = sub i32 %51, %54
  %56 = sdiv i32 %55, 16
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i16, ptr %25, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !20
  %60 = and i32 %55, 15
  %61 = lshr i32 %59, %60
  %62 = and i32 %61, %53
  tail call void @gsScrambleGet_sscm(ptr noundef %0, i32 noundef %15, ptr noundef %37, i32 noundef %62, i32 noundef %21) #3
  %.091105 = sub nsw i32 %55, %21
  %63 = icmp sgt i32 %.091105, -1
  br i1 %63, label %.preheader.lr.ph, label %._crit_edge107

.preheader.lr.ph:                                 ; preds = %._crit_edge
  %64 = icmp sgt i32 %21, 0
  br i1 %64, label %.preheader.us, label %.preheader

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge104.us
  %.091106.us = phi i32 [ %.091.us, %._crit_edge104.us ], [ %.091105, %.preheader.lr.ph ]
  br label %65

65:                                               ; preds = %.preheader.us, %65
  %.0102.us = phi i32 [ 0, %.preheader.us ], [ %67, %65 ]
  %66 = tail call ptr %13(ptr noundef %0, ptr noundef %0, ptr noundef %4) #3
  %67 = add nuw nsw i32 %.0102.us, 1
  %exitcond109.not = icmp eq i32 %67, %21
  br i1 %exitcond109.not, label %._crit_edge104.us, label %65, !llvm.loop !21

._crit_edge104.us:                                ; preds = %65
  %68 = lshr i32 %.091106.us, 4
  %69 = zext nneg i32 %68 to i64
  %70 = getelementptr inbounds i16, ptr %25, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !20
  %72 = and i32 %.091106.us, 15
  %73 = lshr i32 %71, %72
  %74 = and i32 %73, %53
  tail call void @gsScrambleGet_sscm(ptr noundef %26, i32 noundef %15, ptr noundef %37, i32 noundef %74, i32 noundef %21) #3
  %75 = tail call ptr %11(ptr noundef %0, ptr noundef %0, ptr noundef %26, ptr noundef %4) #3
  %.091.us = sub nsw i32 %.091106.us, %21
  %76 = icmp sgt i32 %.091.us, -1
  br i1 %76, label %.preheader.us, label %._crit_edge107, !llvm.loop !22

.preheader:                                       ; preds = %.preheader.lr.ph, %.preheader
  %.091106 = phi i32 [ %.091, %.preheader ], [ %.091105, %.preheader.lr.ph ]
  %77 = lshr i32 %.091106, 4
  %78 = zext nneg i32 %77 to i64
  %79 = getelementptr inbounds i16, ptr %25, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !20
  %81 = and i32 %.091106, 15
  %82 = lshr i32 %80, %81
  %83 = and i32 %82, %53
  tail call void @gsScrambleGet_sscm(ptr noundef %26, i32 noundef %15, ptr noundef %37, i32 noundef %83, i32 noundef %21) #3
  %84 = tail call ptr %11(ptr noundef %0, ptr noundef %0, ptr noundef %26, ptr noundef %4) #3
  %.091 = sub nsw i32 %.091106, %21
  %85 = icmp sgt i32 %.091, -1
  br i1 %85, label %.preheader, label %._crit_edge107, !llvm.loop !22

._crit_edge107:                                   ; preds = %.preheader, %._crit_edge104.us, %._crit_edge
  tail call void @gsModPoolFree(ptr noundef %4, i32 noundef %.094)
  ret ptr %0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cpGFpBasic(ptr noundef) local_unnamed_addr #1

declare i32 @cpGFpGetOptimalWinSize(i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @gsModPoolAlloc(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @div_upper(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @IPP_INT_PTR(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cpGFpElementCopyPad(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @gsScramblePut(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cpGFpElementCopy(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @gsScrambleGet_sscm(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gsModPoolFree(ptr noundef, i32 noundef) local_unnamed_addr #1

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 = { inlinehint 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 #2 = { "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 #3 = { 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, !7, i64 32}
!6 = !{!"_gsModEngine", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !11, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !10, i64 96, !10, i64 100, !7, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long long", !8, i64 0}
!12 = !{!13, !7, i64 16}
!13 = !{!"_gsModMethod", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80}
!14 = !{!13, !7, i64 24}
!15 = !{!6, !10, i64 16}
!16 = !{!6, !10, i64 24}
!17 = !{!6, !7, i64 64}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !10, i64 0}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass