; 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.exchange_state_t = type { i32, %struct.key_material_t, [32 x i8], double, i32 }
%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.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [41 x i8], align 1

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

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

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

; Function Attrs: noreturn nounwind
declare void @exit(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: 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) #4

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @simulate_network_exchange(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [32 x i8], align 16
  %7 = 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 8, ptr %5) #7
  %8 = call i32 @qrng_init(ptr noundef %5, ptr noundef @.str.6, i64 noundef 8)
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %13

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

13:                                               ; preds = %2
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %14, i8 0, i64 200, i1 false)
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 200, i1 false)
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.exchange_state_t, ptr %16, i32 0, i32 0
  store i32 0, ptr %17, align 8, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.exchange_state_t, ptr %18, i32 0, i32 0
  store i32 0, ptr %19, align 8, !tbaa !9
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.exchange_state_t, ptr %21, i32 0, i32 1
  call void @generate_key_material(ptr noundef %20, ptr noundef %22)
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.exchange_state_t, ptr %24, i32 0, i32 1
  call void @generate_key_material(ptr noundef %23, ptr noundef %25)
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !14
  br label %26

26:                                               ; preds = %52, %13
  %27 = load i32, ptr %7, align 4, !tbaa !14
  %28 = icmp slt i32 %27, 32
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %55

30:                                               ; preds = %26
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.exchange_state_t, ptr %31, i32 0, i32 1
  %33 = getelementptr inbounds %struct.key_material_t, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %7, align 4, !tbaa !14
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [32 x i8], ptr %33, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !15
  %38 = zext i8 %37 to i32
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.exchange_state_t, ptr %39, i32 0, i32 1
  %41 = getelementptr inbounds %struct.key_material_t, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %7, align 4, !tbaa !14
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [32 x i8], ptr %41, i64 0, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !15
  %46 = zext i8 %45 to i32
  %47 = xor i32 %38, %46
  %48 = trunc i32 %47 to i8
  %49 = load i32, ptr %7, align 4, !tbaa !14
  %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 !15
  br label %52

52:                                               ; preds = %30
  %53 = load i32, ptr %7, align 4, !tbaa !14
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %7, align 4, !tbaa !14
  br label %26, !llvm.loop !16

55:                                               ; preds = %29
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.exchange_state_t, ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds %struct.key_material_t, ptr %57, i32 0, i32 2
  %59 = getelementptr inbounds [32 x i8], ptr %58, i64 0, i64 0
  %60 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %59, ptr align 16 %60, i64 32, i1 false)
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.exchange_state_t, ptr %61, i32 0, i32 1
  %63 = getelementptr inbounds %struct.key_material_t, ptr %62, i32 0, i32 2
  %64 = getelementptr inbounds [32 x i8], ptr %63, i64 0, i64 0
  %65 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %64, ptr align 16 %65, i64 32, i1 false)
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.exchange_state_t, ptr %66, i32 0, i32 2
  %68 = getelementptr inbounds [32 x i8], ptr %67, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %68, i8 0, i64 32, i1 false)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.exchange_state_t, ptr %69, i32 0, i32 2
  %71 = getelementptr inbounds [32 x i8], ptr %70, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %71, i8 0, i64 32, i1 false)
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.exchange_state_t, ptr %72, i32 0, i32 2
  %74 = getelementptr inbounds [32 x i8], ptr %73, i64 0, i64 0
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.exchange_state_t, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds %struct.key_material_t, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds [32 x i8], ptr %77, i64 0, i64 0
  call void @update_transcript_hash(ptr noundef %74, ptr noundef %78, i64 noundef 32)
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.exchange_state_t, ptr %79, i32 0, i32 2
  %81 = getelementptr inbounds [32 x i8], ptr %80, i64 0, i64 0
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.exchange_state_t, ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds %struct.key_material_t, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds [32 x i8], ptr %84, i64 0, i64 0
  call void @update_transcript_hash(ptr noundef %81, ptr noundef %85, i64 noundef 32)
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.exchange_state_t, ptr %86, i32 0, i32 2
  %88 = getelementptr inbounds [32 x i8], ptr %87, i64 0, i64 0
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.exchange_state_t, ptr %89, i32 0, i32 1
  %91 = getelementptr inbounds %struct.key_material_t, ptr %90, i32 0, i32 4
  %92 = getelementptr inbounds [16 x i8], ptr %91, i64 0, i64 0
  call void @update_transcript_hash(ptr noundef %88, ptr noundef %92, i64 noundef 16)
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.exchange_state_t, ptr %93, i32 0, i32 2
  %95 = getelementptr inbounds [32 x i8], ptr %94, i64 0, i64 0
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.exchange_state_t, ptr %96, i32 0, i32 1
  %98 = getelementptr inbounds %struct.key_material_t, ptr %97, i32 0, i32 4
  %99 = getelementptr inbounds [16 x i8], ptr %98, i64 0, i64 0
  call void @update_transcript_hash(ptr noundef %95, ptr noundef %99, i64 noundef 16)
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.exchange_state_t, ptr %100, i32 0, i32 2
  %102 = getelementptr inbounds [32 x i8], ptr %101, i64 0, i64 0
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.exchange_state_t, ptr %103, i32 0, i32 2
  %105 = getelementptr inbounds [32 x i8], ptr %104, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %102, ptr align 4 %105, i64 32, i1 false)
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.exchange_state_t, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.exchange_state_t, ptr %108, i32 0, i32 2
  %110 = getelementptr inbounds [32 x i8], ptr %109, i64 0, i64 0
  call void @derive_session_key(ptr noundef %107, ptr noundef %110, i64 noundef 32)
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.exchange_state_t, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.exchange_state_t, ptr %113, i32 0, i32 2
  %115 = getelementptr inbounds [32 x i8], ptr %114, i64 0, i64 0
  call void @derive_session_key(ptr noundef %112, ptr noundef %115, i64 noundef 32)
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.exchange_state_t, ptr %116, i32 0, i32 1
  %118 = getelementptr inbounds %struct.key_material_t, ptr %117, i32 0, i32 3
  %119 = getelementptr inbounds [32 x i8], ptr %118, i64 0, i64 0
  %120 = call double @estimate_entropy(ptr noundef %119, i64 noundef 32)
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.exchange_state_t, ptr %121, i32 0, i32 3
  store double %120, ptr %122, align 8, !tbaa !18
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.exchange_state_t, ptr %123, i32 0, i32 1
  %125 = getelementptr inbounds %struct.key_material_t, ptr %124, i32 0, i32 3
  %126 = getelementptr inbounds [32 x i8], ptr %125, i64 0, i64 0
  %127 = call double @estimate_entropy(ptr noundef %126, i64 noundef 32)
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.exchange_state_t, ptr %128, i32 0, i32 3
  store double %127, ptr %129, align 8, !tbaa !18
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  call void @qrng_free(ptr noundef %130)
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret void
}

declare i32 @qrng_init(ptr noundef, ptr noundef, i64 noundef) #6

declare void @qrng_free(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #7 = { nounwind }
attributes #8 = { 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 4, !7, i64 148, !13, i64 184, !11, i64 192}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 32, !7, i64 64, !7, i64 96, !7, i64 128}
!13 = !{!"double", !7, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!10, !13, i64 184}


; 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.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [41 x i8], align 1

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

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

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

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

; 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) #4

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @simulate_network_exchange(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %4 = call i32 @qrng_init(ptr noundef nonnull %3, ptr noundef nonnull @.str.6, i64 noundef 8) #7
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %8, label %5

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

8:                                                ; preds = %2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(200) %0, i8 0, i64 200, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(200) %1, i8 0, i64 200, i1 false)
  store i32 0, ptr %0, align 8, !tbaa !9
  store i32 0, ptr %1, align 8, !tbaa !9
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  call void @generate_key_material(ptr noundef %9, ptr noundef nonnull %10)
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 4
  call void @generate_key_material(ptr noundef %11, ptr noundef nonnull %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  %14 = getelementptr inbounds i8, ptr %1, i64 20
  %15 = getelementptr inbounds i8, ptr %0, i64 68
  %16 = load <16 x i8>, ptr %10, align 1, !tbaa !14
  %17 = load <16 x i8>, ptr %12, align 1, !tbaa !14
  %18 = xor <16 x i8> %17, %16
  %.sroa.20.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 84
  %19 = load <16 x i8>, ptr %13, align 1, !tbaa !14
  %20 = load <16 x i8>, ptr %14, align 1, !tbaa !14
  %21 = xor <16 x i8> %20, %19
  store <16 x i8> %18, ptr %15, align 4
  store <16 x i8> %21, ptr %.sroa.20.0..sroa_idx, align 4
  %22 = getelementptr inbounds i8, ptr %1, i64 68
  store <16 x i8> %18, ptr %22, align 4
  %.sroa.20.0..sroa_idx67 = getelementptr inbounds i8, ptr %1, i64 84
  store <16 x i8> %21, ptr %.sroa.20.0..sroa_idx67, align 4
  %23 = getelementptr inbounds i8, ptr %0, i64 148
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %23, i8 0, i64 32, i1 false)
  %24 = getelementptr inbounds i8, ptr %1, i64 148
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %24, i8 0, i64 32, i1 false)
  call void @update_transcript_hash(ptr noundef nonnull %23, ptr noundef nonnull %10, i64 noundef 32)
  call void @update_transcript_hash(ptr noundef nonnull %23, ptr noundef nonnull %12, i64 noundef 32)
  %25 = getelementptr inbounds i8, ptr %0, i64 132
  call void @update_transcript_hash(ptr noundef nonnull %23, ptr noundef nonnull %25, i64 noundef 16)
  %26 = getelementptr inbounds i8, ptr %1, i64 132
  call void @update_transcript_hash(ptr noundef nonnull %23, ptr noundef nonnull %26, i64 noundef 16)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %24, ptr noundef nonnull align 4 dereferenceable(32) %23, i64 32, i1 false)
  call void @derive_session_key(ptr noundef nonnull %10, ptr noundef nonnull %23, i64 noundef 32)
  call void @derive_session_key(ptr noundef nonnull %12, ptr noundef nonnull %24, i64 noundef 32)
  %27 = getelementptr inbounds i8, ptr %0, i64 100
  %28 = call double @estimate_entropy(ptr noundef nonnull %27, i64 noundef 32)
  %29 = getelementptr inbounds i8, ptr %0, i64 184
  store double %28, ptr %29, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %1, i64 100
  %31 = call double @estimate_entropy(ptr noundef nonnull %30, i64 noundef 32)
  %32 = getelementptr inbounds i8, ptr %1, i64 184
  store double %31, ptr %32, align 8, !tbaa !15
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  call void @qrng_free(ptr noundef %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  ret void
}

declare i32 @qrng_init(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

declare void @qrng_free(ptr noundef) local_unnamed_addr #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 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #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 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 4, !7, i64 148, !13, i64 184, !11, i64 192}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 32, !7, i64 64, !7, i64 96, !7, i64 128}
!13 = !{!"double", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !13, i64 184}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass