; LLVM IR from tsotchke/quantum_rng :: examples/crypto (key_exchange)

; 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.key_material_t = type { [32 x i8], [32 x i8], [32 x i8], [32 x i8], [16 x i8] }

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @generate_key_material(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [128 x i8], align 16
  %6 = alloca [32 x i8], align 16
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.key_material_t, ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds [32 x i8], ptr %17, i64 0, i64 0
  %19 = call i32 @qrng_bytes(ptr noundef %15, ptr noundef %18, i64 noundef 32)
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %2
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.1) #6
  call void @exit(i32 noundef 1) #7
  unreachable

24:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %118, %24
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = icmp slt i32 %26, 4
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %121

29:                                               ; preds = %25
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 0
  %32 = call i32 @qrng_bytes(ptr noundef %30, ptr noundef %31, i64 noundef 128)
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %29
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.2) #6
  call void @exit(i32 noundef 1) #7
  unreachable

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %110, %37
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = icmp slt i32 %39, 32
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %113

42:                                               ; preds = %38
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.key_material_t, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [32 x i8], ptr %44, i64 0, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %50
  store i8 %48, ptr %51, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %72, %42
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = icmp slt i32 %53, 4
  br i1 %54, label %56, label %55

55:                                               ; preds = %52
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %75

56:                                               ; preds = %52
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !9
  %59 = mul nsw i32 %58, 32
  %60 = add nsw i32 %57, %59
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !11
  %64 = zext i8 %63 to i32
  %65 = load i32, ptr %10, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = zext i8 %68 to i32
  %70 = xor i32 %69, %64
  %71 = trunc i32 %70 to i8
  store i8 %71, ptr %67, align 1, !tbaa !11
  br label %72

72:                                               ; preds = %56
  %73 = load i32, ptr %11, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %11, align 4, !tbaa !9
  br label %52, !llvm.loop !12

75:                                               ; preds = %55
  %76 = load i32, ptr %10, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !11
  %80 = zext i8 %79 to i32
  %81 = shl i32 %80, 3
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %83
  %85 = load i8, ptr %84, align 1, !tbaa !11
  %86 = zext i8 %85 to i32
  %87 = ashr i32 %86, 5
  %88 = or i32 %81, %87
  %89 = trunc i32 %88 to i8
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %91
  store i8 %89, ptr %92, align 1, !tbaa !11
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %95, label %109

95:                                               ; preds = %75
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !11
  %101 = zext i8 %100 to i32
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !11
  %106 = zext i8 %105 to i32
  %107 = xor i32 %106, %101
  %108 = trunc i32 %107 to i8
  store i8 %108, ptr %104, align 1, !tbaa !11
  br label %109

109:                                              ; preds = %95, %75
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %10, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %10, align 4, !tbaa !9
  br label %38, !llvm.loop !14

113:                                              ; preds = %41
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.key_material_t, ptr %114, i32 0, i32 1
  %116 = getelementptr inbounds [32 x i8], ptr %115, i64 0, i64 0
  %117 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %116, ptr align 16 %117, i64 32, i1 false)
  br label %118

118:                                              ; preds = %113
  %119 = load i32, ptr %8, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %8, align 4, !tbaa !9
  br label %25, !llvm.loop !15

121:                                              ; preds = %28
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.key_material_t, ptr %122, i32 0, i32 1
  %124 = getelementptr inbounds [32 x i8], ptr %123, i64 0, i64 0
  %125 = call double @estimate_entropy(ptr noundef %124, i64 noundef 32)
  store double %125, ptr %7, align 8, !tbaa !16
  %126 = load double, ptr %7, align 8, !tbaa !16
  %127 = fcmp olt double %126, 4.500000e+00
  br i1 %127, label %128, label %219

128:                                              ; preds = %121
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 0
  %131 = call i32 @qrng_bytes(ptr noundef %129, ptr noundef %130, i64 noundef 128)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %136

133:                                              ; preds = %128
  %134 = load ptr, ptr @stderr, align 8, !tbaa !5
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef @.str.2) #6
  call void @exit(i32 noundef 1) #7
  unreachable

136:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %137

137:                                              ; preds = %215, %136
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = icmp slt i32 %138, 32
  br i1 %139, label %141, label %140

140:                                              ; preds = %137
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %218

141:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  store i8 0, ptr %13, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %159, %141
  %143 = load i32, ptr %14, align 4, !tbaa !9
  %144 = icmp slt i32 %143, 4
  br i1 %144, label %146, label %145

145:                                              ; preds = %142
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %162

146:                                              ; preds = %142
  %147 = load i32, ptr %12, align 4, !tbaa !9
  %148 = load i32, ptr %14, align 4, !tbaa !9
  %149 = mul nsw i32 %148, 32
  %150 = add nsw i32 %147, %149
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [128 x i8], ptr %5, i64 0, i64 %151
  %153 = load i8, ptr %152, align 1, !tbaa !11
  %154 = zext i8 %153 to i32
  %155 = load i8, ptr %13, align 1, !tbaa !11
  %156 = zext i8 %155 to i32
  %157 = xor i32 %156, %154
  %158 = trunc i32 %157 to i8
  store i8 %158, ptr %13, align 1, !tbaa !11
  br label %159

159:                                              ; preds = %146
  %160 = load i32, ptr %14, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %14, align 4, !tbaa !9
  br label %142, !llvm.loop !18

162:                                              ; preds = %145
  %163 = load i8, ptr %13, align 1, !tbaa !11
  %164 = zext i8 %163 to i32
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.key_material_t, ptr %165, i32 0, i32 1
  %167 = load i32, ptr %12, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [32 x i8], ptr %166, i64 0, i64 %168
  %170 = load i8, ptr %169, align 1, !tbaa !11
  %171 = zext i8 %170 to i32
  %172 = xor i32 %171, %164
  %173 = trunc i32 %172 to i8
  store i8 %173, ptr %169, align 1, !tbaa !11
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.key_material_t, ptr %174, i32 0, i32 1
  %176 = load i32, ptr %12, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [32 x i8], ptr %175, i64 0, i64 %177
  %179 = load i8, ptr %178, align 1, !tbaa !11
  %180 = zext i8 %179 to i32
  %181 = shl i32 %180, 5
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.key_material_t, ptr %182, i32 0, i32 1
  %184 = load i32, ptr %12, align 4, !tbaa !9
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [32 x i8], ptr %183, i64 0, i64 %185
  %187 = load i8, ptr %186, align 1, !tbaa !11
  %188 = zext i8 %187 to i32
  %189 = ashr i32 %188, 3
  %190 = or i32 %181, %189
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.key_material_t, ptr %191, i32 0, i32 1
  %193 = load i32, ptr %12, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [32 x i8], ptr %192, i64 0, i64 %194
  %196 = load i8, ptr %195, align 1, !tbaa !11
  %197 = zext i8 %196 to i32
  %198 = shl i32 %197, 3
  %199 = load ptr, ptr %4, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.key_material_t, ptr %199, i32 0, i32 1
  %201 = load i32, ptr %12, align 4, !tbaa !9
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [32 x i8], ptr %200, i64 0, i64 %202
  %204 = load i8, ptr %203, align 1, !tbaa !11
  %205 = zext i8 %204 to i32
  %206 = ashr i32 %205, 5
  %207 = or i32 %198, %206
  %208 = xor i32 %190, %207
  %209 = trunc i32 %208 to i8
  %210 = load ptr, ptr %4, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.key_material_t, ptr %210, i32 0, i32 1
  %212 = load i32, ptr %12, align 4, !tbaa !9
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [32 x i8], ptr %211, i64 0, i64 %213
  store i8 %209, ptr %214, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  br label %215

215:                                              ; preds = %162
  %216 = load i32, ptr %12, align 4, !tbaa !9
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %12, align 4, !tbaa !9
  br label %137, !llvm.loop !19

218:                                              ; preds = %140
  br label %219

219:                                              ; preds = %218, %121
  %220 = load ptr, ptr %4, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.key_material_t, ptr %220, i32 0, i32 1
  %222 = getelementptr inbounds [32 x i8], ptr %221, i64 0, i64 0
  %223 = load ptr, ptr %4, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.key_material_t, ptr %223, i32 0, i32 0
  %225 = getelementptr inbounds [32 x i8], ptr %224, i64 0, i64 0
  call void @enhanced_sha256(ptr noundef %222, i64 noundef 32, ptr noundef %225)
  %226 = load ptr, ptr %3, align 8, !tbaa !5
  %227 = load ptr, ptr %4, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.key_material_t, ptr %227, i32 0, i32 4
  %229 = getelementptr inbounds [16 x i8], ptr %228, i64 0, i64 0
  %230 = call i32 @qrng_bytes(ptr noundef %226, ptr noundef %229, i64 noundef 16)
  %231 = icmp ne i32 %230, 0
  br i1 %231, label %232, label %235

232:                                              ; preds = %219
  %233 = load ptr, ptr @stderr, align 8, !tbaa !5
  %234 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %233, ptr noundef @.str.3) #6
  call void @exit(i32 noundef 1) #7
  unreachable

235:                                              ; preds = %219
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %5) #6
  ret void
}

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

declare i32 @qrng_bytes(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind uwtable
declare dso_local double @estimate_entropy(ptr noundef, i64 noundef) #0

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

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 = { "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 "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 = { noreturn nounwind "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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @generate_key_material(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [128 x i8], align 16
  %4 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  %5 = getelementptr inbounds i8, ptr %1, i64 32
  %6 = tail call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 32) #7
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %.preheader59.preheader, label %8

.preheader59.preheader:                           ; preds = %2
  %7 = call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %3, i64 noundef 128) #7
  %.not55 = icmp eq i32 %7, 0
  br i1 %.not55, label %.preheader58.peel.next, label %24

8:                                                ; preds = %2
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.1) #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

.preheader58.peel.next:                           ; preds = %.preheader59.preheader
  %11 = load i8, ptr %5, align 1, !tbaa !9
  %12 = load i8, ptr %3, align 16, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %3, i64 32
  %14 = load i8, ptr %13, align 16, !tbaa !9
  %15 = xor i8 %12, %14
  %16 = getelementptr inbounds i8, ptr %3, i64 64
  %17 = load i8, ptr %16, align 16, !tbaa !9
  %18 = xor i8 %15, %17
  %19 = getelementptr inbounds i8, ptr %3, i64 96
  %20 = load i8, ptr %19, align 16, !tbaa !9
  %21 = xor i8 %18, %20
  %22 = xor i8 %21, %11
  %23 = call i8 @llvm.fshl.i8(i8 %22, i8 %22, i8 3)
  store i8 %23, ptr %4, align 16, !tbaa !9
  br label %128

24:                                               ; preds = %.preheader59.3, %.preheader59.2, %.preheader59.1, %.preheader59.preheader
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.2) #8
  call void @exit(i32 noundef 1) #9
  unreachable

.preheader59.1:                                   ; preds = %128
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %5, ptr noundef nonnull align 16 dereferenceable(32) %4, i64 32, i1 false)
  %27 = call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %3, i64 noundef 128) #7
  %.not55.1 = icmp eq i32 %27, 0
  br i1 %.not55.1, label %.preheader58.peel.next.1, label %24

.preheader58.peel.next.1:                         ; preds = %.preheader59.1
  %28 = load i8, ptr %5, align 1, !tbaa !9
  %29 = load i8, ptr %3, align 16, !tbaa !9
  %30 = load i8, ptr %13, align 16, !tbaa !9
  %31 = xor i8 %29, %30
  %32 = load i8, ptr %16, align 16, !tbaa !9
  %33 = xor i8 %31, %32
  %34 = load i8, ptr %19, align 16, !tbaa !9
  %35 = xor i8 %33, %34
  %36 = xor i8 %35, %28
  %37 = call i8 @llvm.fshl.i8(i8 %36, i8 %36, i8 3)
  store i8 %37, ptr %4, align 16, !tbaa !9
  br label %38

38:                                               ; preds = %38, %.preheader58.peel.next.1
  %39 = phi i8 [ %37, %.preheader58.peel.next.1 ], [ %59, %38 ]
  %indvars.iv.1 = phi i64 [ 1, %.preheader58.peel.next.1 ], [ %indvars.iv.next.1, %38 ]
  %40 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 %indvars.iv.1
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %42 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 %indvars.iv.1
  %43 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %indvars.iv.1
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = add nuw nsw i64 %indvars.iv.1, 32
  %46 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !9
  %48 = xor i8 %44, %47
  %49 = add nuw nsw i64 %indvars.iv.1, 64
  %50 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !9
  %52 = xor i8 %48, %51
  %53 = add nuw nsw i64 %indvars.iv.1, 96
  %54 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !9
  %56 = xor i8 %52, %55
  %57 = xor i8 %56, %41
  %58 = call i8 @llvm.fshl.i8(i8 %57, i8 %57, i8 3)
  %59 = xor i8 %39, %58
  store i8 %59, ptr %42, align 1, !tbaa !9
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 32
  br i1 %exitcond.1.not, label %.preheader59.2, label %38, !llvm.loop !10

.preheader59.2:                                   ; preds = %38
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %5, ptr noundef nonnull align 16 dereferenceable(32) %4, i64 32, i1 false)
  %60 = call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %3, i64 noundef 128) #7
  %.not55.2 = icmp eq i32 %60, 0
  br i1 %.not55.2, label %.preheader58.peel.next.2, label %24

.preheader58.peel.next.2:                         ; preds = %.preheader59.2
  %61 = load i8, ptr %5, align 1, !tbaa !9
  %62 = load i8, ptr %3, align 16, !tbaa !9
  %63 = load i8, ptr %13, align 16, !tbaa !9
  %64 = xor i8 %62, %63
  %65 = load i8, ptr %16, align 16, !tbaa !9
  %66 = xor i8 %64, %65
  %67 = load i8, ptr %19, align 16, !tbaa !9
  %68 = xor i8 %66, %67
  %69 = xor i8 %68, %61
  %70 = call i8 @llvm.fshl.i8(i8 %69, i8 %69, i8 3)
  store i8 %70, ptr %4, align 16, !tbaa !9
  br label %71

71:                                               ; preds = %71, %.preheader58.peel.next.2
  %72 = phi i8 [ %70, %.preheader58.peel.next.2 ], [ %92, %71 ]
  %indvars.iv.2 = phi i64 [ 1, %.preheader58.peel.next.2 ], [ %indvars.iv.next.2, %71 ]
  %73 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 %indvars.iv.2
  %74 = load i8, ptr %73, align 1, !tbaa !9
  %75 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 %indvars.iv.2
  %76 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %indvars.iv.2
  %77 = load i8, ptr %76, align 1, !tbaa !9
  %78 = add nuw nsw i64 %indvars.iv.2, 32
  %79 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %78
  %80 = load i8, ptr %79, align 1, !tbaa !9
  %81 = xor i8 %77, %80
  %82 = add nuw nsw i64 %indvars.iv.2, 64
  %83 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !9
  %85 = xor i8 %81, %84
  %86 = add nuw nsw i64 %indvars.iv.2, 96
  %87 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !9
  %89 = xor i8 %85, %88
  %90 = xor i8 %89, %74
  %91 = call i8 @llvm.fshl.i8(i8 %90, i8 %90, i8 3)
  %92 = xor i8 %72, %91
  store i8 %92, ptr %75, align 1, !tbaa !9
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, 32
  br i1 %exitcond.2.not, label %.preheader59.3, label %71, !llvm.loop !10

.preheader59.3:                                   ; preds = %71
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %5, ptr noundef nonnull align 16 dereferenceable(32) %4, i64 32, i1 false)
  %93 = call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %3, i64 noundef 128) #7
  %.not55.3 = icmp eq i32 %93, 0
  br i1 %.not55.3, label %.preheader58.peel.next.3, label %24

.preheader58.peel.next.3:                         ; preds = %.preheader59.3
  %94 = load i8, ptr %5, align 1, !tbaa !9
  %95 = load i8, ptr %3, align 16, !tbaa !9
  %96 = load i8, ptr %13, align 16, !tbaa !9
  %97 = xor i8 %95, %96
  %98 = load i8, ptr %16, align 16, !tbaa !9
  %99 = xor i8 %97, %98
  %100 = load i8, ptr %19, align 16, !tbaa !9
  %101 = xor i8 %99, %100
  %102 = xor i8 %101, %94
  %103 = call i8 @llvm.fshl.i8(i8 %102, i8 %102, i8 3)
  store i8 %103, ptr %4, align 16, !tbaa !9
  br label %104

104:                                              ; preds = %104, %.preheader58.peel.next.3
  %105 = phi i8 [ %103, %.preheader58.peel.next.3 ], [ %125, %104 ]
  %indvars.iv.3 = phi i64 [ 1, %.preheader58.peel.next.3 ], [ %indvars.iv.next.3, %104 ]
  %106 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 %indvars.iv.3
  %107 = load i8, ptr %106, align 1, !tbaa !9
  %108 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 %indvars.iv.3
  %109 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %indvars.iv.3
  %110 = load i8, ptr %109, align 1, !tbaa !9
  %111 = add nuw nsw i64 %indvars.iv.3, 32
  %112 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !9
  %114 = xor i8 %110, %113
  %115 = add nuw nsw i64 %indvars.iv.3, 64
  %116 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %115
  %117 = load i8, ptr %116, align 1, !tbaa !9
  %118 = xor i8 %114, %117
  %119 = add nuw nsw i64 %indvars.iv.3, 96
  %120 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %119
  %121 = load i8, ptr %120, align 1, !tbaa !9
  %122 = xor i8 %118, %121
  %123 = xor i8 %122, %107
  %124 = call i8 @llvm.fshl.i8(i8 %123, i8 %123, i8 3)
  %125 = xor i8 %105, %124
  store i8 %125, ptr %108, align 1, !tbaa !9
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
  %exitcond.3.not = icmp eq i64 %indvars.iv.next.3, 32
  br i1 %exitcond.3.not, label %.loopexit69.3, label %104, !llvm.loop !10

.loopexit69.3:                                    ; preds = %104
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %5, ptr noundef nonnull align 16 dereferenceable(32) %4, i64 32, i1 false)
  %126 = call double @estimate_entropy(ptr noundef nonnull %5, i64 noundef 32)
  %127 = fcmp olt double %126, 4.500000e+00
  br i1 %127, label %150, label %.loopexit

128:                                              ; preds = %.preheader58.peel.next, %128
  %129 = phi i8 [ %23, %.preheader58.peel.next ], [ %149, %128 ]
  %indvars.iv = phi i64 [ 1, %.preheader58.peel.next ], [ %indvars.iv.next, %128 ]
  %130 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 %indvars.iv
  %131 = load i8, ptr %130, align 1, !tbaa !9
  %132 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 %indvars.iv
  %133 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %indvars.iv
  %134 = load i8, ptr %133, align 1, !tbaa !9
  %135 = add nuw nsw i64 %indvars.iv, 32
  %136 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %135
  %137 = load i8, ptr %136, align 1, !tbaa !9
  %138 = xor i8 %134, %137
  %139 = add nuw nsw i64 %indvars.iv, 64
  %140 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %139
  %141 = load i8, ptr %140, align 1, !tbaa !9
  %142 = xor i8 %138, %141
  %143 = add nuw nsw i64 %indvars.iv, 96
  %144 = getelementptr inbounds [128 x i8], ptr %3, i64 0, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !9
  %146 = xor i8 %142, %145
  %147 = xor i8 %146, %131
  %148 = call i8 @llvm.fshl.i8(i8 %147, i8 %147, i8 3)
  %149 = xor i8 %129, %148
  store i8 %149, ptr %132, align 1, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 32
  br i1 %exitcond.not, label %.preheader59.1, label %128, !llvm.loop !10

150:                                              ; preds = %.loopexit69.3
  %151 = call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %3, i64 noundef 128) #7
  %.not53 = icmp eq i32 %151, 0
  br i1 %.not53, label %vector.body, label %174

vector.body:                                      ; preds = %150
  %wide.load = load <16 x i8>, ptr %3, align 16, !tbaa !9
  %152 = getelementptr inbounds i8, ptr %3, i64 32
  %wide.load78 = load <16 x i8>, ptr %152, align 16, !tbaa !9
  %153 = xor <16 x i8> %wide.load78, %wide.load
  %154 = getelementptr inbounds i8, ptr %3, i64 64
  %wide.load79 = load <16 x i8>, ptr %154, align 16, !tbaa !9
  %155 = xor <16 x i8> %wide.load79, %153
  %156 = getelementptr inbounds i8, ptr %3, i64 96
  %wide.load80 = load <16 x i8>, ptr %156, align 16, !tbaa !9
  %157 = xor <16 x i8> %wide.load80, %155
  %wide.load81 = load <16 x i8>, ptr %5, align 1, !tbaa !9
  %158 = xor <16 x i8> %wide.load81, %157
  %159 = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %158, <16 x i8> %158, <16 x i8> <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>)
  %160 = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %158, <16 x i8> %158, <16 x i8> <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>)
  %161 = xor <16 x i8> %159, %160
  store <16 x i8> %161, ptr %5, align 1, !tbaa !9
  %162 = getelementptr inbounds i8, ptr %3, i64 16
  %wide.load.1 = load <16 x i8>, ptr %162, align 16, !tbaa !9
  %163 = getelementptr inbounds i8, ptr %3, i64 48
  %wide.load78.1 = load <16 x i8>, ptr %163, align 16, !tbaa !9
  %164 = xor <16 x i8> %wide.load78.1, %wide.load.1
  %165 = getelementptr inbounds i8, ptr %3, i64 80
  %wide.load79.1 = load <16 x i8>, ptr %165, align 16, !tbaa !9
  %166 = xor <16 x i8> %wide.load79.1, %164
  %167 = getelementptr inbounds i8, ptr %3, i64 112
  %wide.load80.1 = load <16 x i8>, ptr %167, align 16, !tbaa !9
  %168 = xor <16 x i8> %wide.load80.1, %166
  %169 = getelementptr inbounds i8, ptr %1, i64 48
  %wide.load81.1 = load <16 x i8>, ptr %169, align 1, !tbaa !9
  %170 = xor <16 x i8> %wide.load81.1, %168
  %171 = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %170, <16 x i8> %170, <16 x i8> <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>)
  %172 = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %170, <16 x i8> %170, <16 x i8> <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>)
  %173 = xor <16 x i8> %171, %172
  store <16 x i8> %173, ptr %169, align 1, !tbaa !9
  br label %.loopexit

174:                                              ; preds = %150
  %175 = load ptr, ptr @stderr, align 8, !tbaa !5
  %176 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %175, ptr noundef nonnull @.str.2) #8
  call void @exit(i32 noundef 1) #9
  unreachable

.loopexit:                                        ; preds = %vector.body, %.loopexit69.3
  call void @enhanced_sha256(ptr noundef nonnull %5, i64 noundef 32, ptr noundef nonnull %1)
  %177 = getelementptr inbounds i8, ptr %1, i64 128
  %178 = call i32 @qrng_bytes(ptr noundef %0, ptr noundef nonnull %177, i64 noundef 16) #7
  %.not54 = icmp eq i32 %178, 0
  br i1 %.not54, label %182, label %179

179:                                              ; preds = %.loopexit
  %180 = load ptr, ptr @stderr, align 8, !tbaa !5
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %180, ptr noundef nonnull @.str.3) #8
  call void @exit(i32 noundef 1) #9
  unreachable

182:                                              ; preds = %.loopexit
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #7
  ret void
}

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

declare i32 @qrng_bytes(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind uwtable
declare dso_local double @estimate_entropy(ptr noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <16 x i8> @llvm.fshl.v16i8(<16 x i8>, <16 x i8>, <16 x i8>) #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 = { "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 = { nofree nounwind "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 = { noreturn nounwind "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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { noreturn 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 = distinct !{!10, !11, !12}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass