; LLVM IR from aws/s2n-tls :: tests/unit (s2n_resume_test)

; 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.s2n_debug_info = type { ptr, ptr }
%struct.s2n_ticket_key_weight = type { double, i8 }
%struct.s2n_result = type { i32 }
%struct.s2n_config = type { i32, ptr, ptr, %struct.certs_by_type, %struct.s2n_blob, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i64, ptr, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, %struct.s2n_x509_trust_store, i16, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, i32, %struct.s2n_blob }
%struct.certs_by_type = type { [4 x ptr] }
%struct.s2n_x509_trust_store = type { ptr, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_ticket_key = type { [16 x i8], [32 x i8], [12 x i8], i64 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.27 = external hidden unnamed_addr constant [87 x i8], align 1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strrchr(ptr noundef, i32 noundef) #2

declare i32 @s2n_calculate_stacktrace() #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

declare i32 @s2n_array_get(ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_compute_weight_of_encrypt_decrypt_keys(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i64 noundef %3) #5 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i64, align 8
  %10 = alloca double, align 8
  %11 = alloca [48 x %struct.s2n_ticket_key_weight], align 16
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.s2n_result, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca %struct.s2n_result, align 4
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i8 %2, ptr %8, align 1, !tbaa !9
  store i64 %3, ptr %9, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store double 0.000000e+00, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 768, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !14
  br label %22

22:                                               ; preds = %100, %4
  %23 = load i32, ptr %13, align 4, !tbaa !14
  %24 = load i8, ptr %8, align 1, !tbaa !9
  %25 = zext i8 %24 to i32
  %26 = icmp slt i32 %23, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  store i32 2, ptr %14, align 4
  br label %103

28:                                               ; preds = %22
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.s2n_config, ptr %30, i32 0, i32 15
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load i32, ptr %13, align 4, !tbaa !14
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %33, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !9
  %38 = zext i8 %37 to i32
  %39 = call i32 @s2n_array_get(ptr noundef %32, i32 noundef %38, ptr noundef %12)
  %40 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  store i32 %39, ptr %40, align 4
  %41 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  %42 = load i32, ptr %41, align 4
  %43 = call zeroext i1 @s2n_result_is_ok(i32 %42)
  br i1 %43, label %45, label %44

44:                                               ; preds = %29
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %103

45:                                               ; preds = %29
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.s2n_ticket_key, ptr %48, i32 0, i32 3
  %50 = load i64, ptr %49, align 8, !tbaa !22
  store i64 %50, ptr %16, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %51 = load i64, ptr %16, align 8, !tbaa !10
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.s2n_config, ptr %52, i32 0, i32 16
  %54 = load i64, ptr %53, align 8, !tbaa !24
  %55 = udiv i64 %54, 2
  %56 = add i64 %51, %55
  store i64 %56, ptr %17, align 8, !tbaa !10
  %57 = load i64, ptr %9, align 8, !tbaa !10
  %58 = load i64, ptr %17, align 8, !tbaa !10
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %60, label %69

60:                                               ; preds = %47
  %61 = load i64, ptr %9, align 8, !tbaa !10
  %62 = load i64, ptr %16, align 8, !tbaa !10
  %63 = sub i64 %61, %62
  %64 = uitofp i64 %63 to double
  %65 = load i32, ptr %13, align 4, !tbaa !14
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %66
  %68 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %67, i32 0, i32 0
  store double %64, ptr %68, align 16, !tbaa !25
  br label %83

69:                                               ; preds = %47
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.s2n_config, ptr %70, i32 0, i32 16
  %72 = load i64, ptr %71, align 8, !tbaa !24
  %73 = udiv i64 %72, 2
  %74 = load i64, ptr %9, align 8, !tbaa !10
  %75 = load i64, ptr %17, align 8, !tbaa !10
  %76 = sub i64 %74, %75
  %77 = sub i64 %73, %76
  %78 = uitofp i64 %77 to double
  %79 = load i32, ptr %13, align 4, !tbaa !14
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %80
  %82 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %81, i32 0, i32 0
  store double %78, ptr %82, align 16, !tbaa !25
  br label %83

83:                                               ; preds = %69, %60
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = load i32, ptr %13, align 4, !tbaa !14
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %84, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !9
  %89 = load i32, ptr %13, align 4, !tbaa !14
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %91, i32 0, i32 1
  store i8 %88, ptr %92, align 8, !tbaa !27
  %93 = load i32, ptr %13, align 4, !tbaa !14
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %94
  %96 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %95, i32 0, i32 0
  %97 = load double, ptr %96, align 16, !tbaa !25
  %98 = load double, ptr %10, align 8, !tbaa !12
  %99 = fadd double %98, %97
  store double %99, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %100

100:                                              ; preds = %83
  %101 = load i32, ptr %13, align 4, !tbaa !14
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %13, align 4, !tbaa !14
  br label %22, !llvm.loop !28

103:                                              ; preds = %44, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %104 = load i32, ptr %14, align 4
  switch i32 %104, label %211 [
    i32 2, label %105
  ]

105:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 0, ptr %18, align 8, !tbaa !10
  br label %106

106:                                              ; preds = %105
  %107 = call double @pow(double noundef 2.000000e+00, double noundef 5.300000e+01) #7
  %108 = fptosi double %107 to i64
  %109 = call i32 @s2n_public_random(i64 noundef %108, ptr noundef %18)
  %110 = getelementptr inbounds %struct.s2n_result, ptr %19, i32 0, i32 0
  store i32 %109, ptr %110, align 4
  %111 = getelementptr inbounds %struct.s2n_result, ptr %19, i32 0, i32 0
  %112 = load i32, ptr %111, align 4
  %113 = call zeroext i1 @s2n_result_is_ok(i32 %112)
  br i1 %113, label %115, label %114

114:                                              ; preds = %106
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %210

115:                                              ; preds = %106
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %118 = load i64, ptr %18, align 8, !tbaa !10
  %119 = uitofp i64 %118 to double
  %120 = call double @pow(double noundef 2.000000e+00, double noundef 5.300000e+01) #7
  %121 = fdiv double %119, %120
  store double %121, ptr %20, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !14
  br label %122

122:                                              ; preds = %171, %117
  %123 = load i32, ptr %21, align 4, !tbaa !14
  %124 = load i8, ptr %8, align 1, !tbaa !9
  %125 = zext i8 %124 to i32
  %126 = icmp slt i32 %123, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %122
  store i32 9, ptr %14, align 4
  br label %174

128:                                              ; preds = %122
  %129 = load i32, ptr %21, align 4, !tbaa !14
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %131, i32 0, i32 0
  %133 = load double, ptr %132, align 16, !tbaa !25
  %134 = load double, ptr %10, align 8, !tbaa !12
  %135 = fdiv double %133, %134
  %136 = load i32, ptr %21, align 4, !tbaa !14
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %137
  %139 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %138, i32 0, i32 0
  store double %135, ptr %139, align 16, !tbaa !25
  %140 = load i32, ptr %21, align 4, !tbaa !14
  %141 = icmp sgt i32 %140, 0
  br i1 %141, label %142, label %155

142:                                              ; preds = %128
  %143 = load i32, ptr %21, align 4, !tbaa !14
  %144 = sub nsw i32 %143, 1
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %145
  %147 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %146, i32 0, i32 0
  %148 = load double, ptr %147, align 16, !tbaa !25
  %149 = load i32, ptr %21, align 4, !tbaa !14
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %150
  %152 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %151, i32 0, i32 0
  %153 = load double, ptr %152, align 16, !tbaa !25
  %154 = fadd double %153, %148
  store double %154, ptr %152, align 16, !tbaa !25
  br label %155

155:                                              ; preds = %142, %128
  %156 = load i32, ptr %21, align 4, !tbaa !14
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %157
  %159 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %158, i32 0, i32 0
  %160 = load double, ptr %159, align 16, !tbaa !25
  %161 = load double, ptr %20, align 8, !tbaa !12
  %162 = fcmp ogt double %160, %161
  br i1 %162, label %163, label %170

163:                                              ; preds = %155
  %164 = load i32, ptr %21, align 4, !tbaa !14
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %11, i64 0, i64 %165
  %167 = getelementptr inbounds %struct.s2n_ticket_key_weight, ptr %166, i32 0, i32 1
  %168 = load i8, ptr %167, align 8, !tbaa !27
  %169 = zext i8 %168 to i32
  store i32 %169, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %174

170:                                              ; preds = %155
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %21, align 4, !tbaa !14
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %21, align 4, !tbaa !14
  br label %122, !llvm.loop !30

174:                                              ; preds = %163, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  %175 = load i32, ptr %14, align 4
  switch i32 %175, label %209 [
    i32 9, label %176
  ]

176:                                              ; preds = %174
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177
  %179 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %180 = getelementptr inbounds %struct.s2n_debug_info, ptr %179, i32 0, i32 0
  store ptr @.str.27, ptr %180, align 8, !tbaa !31
  %181 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %182 = getelementptr inbounds %struct.s2n_debug_info, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %182, align 8, !tbaa !31
  %184 = getelementptr inbounds i8, ptr %183, i64 21
  %185 = call ptr @strrchr(ptr noundef %184, i32 noundef 47) #8
  %186 = icmp ne ptr %185, null
  br i1 %186, label %187, label %194

187:                                              ; preds = %178
  %188 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %189 = getelementptr inbounds %struct.s2n_debug_info, ptr %188, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8, !tbaa !31
  %191 = getelementptr inbounds i8, ptr %190, i64 21
  %192 = call ptr @strrchr(ptr noundef %191, i32 noundef 47) #8
  %193 = getelementptr inbounds i8, ptr %192, i64 1
  br label %199

194:                                              ; preds = %178
  %195 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %196 = getelementptr inbounds %struct.s2n_debug_info, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !31
  %198 = getelementptr inbounds i8, ptr %197, i64 21
  br label %199

199:                                              ; preds = %194, %187
  %200 = phi ptr [ %193, %187 ], [ %198, %194 ]
  %201 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %202 = getelementptr inbounds %struct.s2n_debug_info, ptr %201, i32 0, i32 1
  store ptr %200, ptr %202, align 8, !tbaa !33
  %203 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762085, ptr %203, align 4, !tbaa !14
  %204 = call i32 @s2n_calculate_stacktrace()
  br label %205

205:                                              ; preds = %199
  br label %206

206:                                              ; preds = %205
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %209

207:                                              ; No predecessors!
  br label %208

208:                                              ; preds = %207
  store i32 0, ptr %14, align 4
  br label %209

209:                                              ; preds = %208, %206, %174
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %210

210:                                              ; preds = %209, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %211

211:                                              ; preds = %210, %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 768, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  %212 = load i32, ptr %14, align 4
  switch i32 %212, label %215 [
    i32 0, label %213
    i32 1, label %213
  ]

213:                                              ; preds = %211, %211
  %214 = load i32, ptr %5, align 4
  ret i32 %214

215:                                              ; preds = %211
  unreachable
}

declare i32 @s2n_public_random(i64 noundef, ptr noundef) #3

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind willreturn memory(read) "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 = { 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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!"double", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !6, i64 152}
!17 = !{!"s2n_config", !15, i64 0, !15, i64 0, !15, i64 0, !15, i64 0, !15, i64 0, !15, i64 0, !15, i64 0, !15, i64 0, !15, i64 1, !15, i64 1, !15, i64 1, !15, i64 1, !15, i64 1, !15, i64 1, !15, i64 1, !15, i64 1, !15, i64 2, !15, i64 2, !15, i64 2, !15, i64 2, !6, i64 8, !6, i64 16, !18, i64 24, !19, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !15, i64 128, !15, i64 132, !6, i64 136, !11, i64 144, !6, i64 152, !11, i64 160, !11, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !15, i64 224, !7, i64 228, !15, i64 232, !15, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !20, i64 304, !21, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !15, i64 392, !15, i64 396, !15, i64 400, !6, i64 408, !15, i64 416, !15, i64 420, !6, i64 424, !6, i64 432, !15, i64 440, !19, i64 448}
!18 = !{!"certs_by_type", !7, i64 0}
!19 = !{!"s2n_blob", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16}
!20 = !{!"s2n_x509_trust_store", !6, i64 0, !15, i64 8}
!21 = !{!"short", !7, i64 0}
!22 = !{!23, !11, i64 64}
!23 = !{!"s2n_ticket_key", !7, i64 0, !7, i64 16, !7, i64 48, !11, i64 64}
!24 = !{!17, !11, i64 160}
!25 = !{!26, !13, i64 0}
!26 = !{!"s2n_ticket_key_weight", !13, i64 0, !7, i64 8}
!27 = !{!26, !7, i64 8}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}
!31 = !{!32, !6, i64 0}
!32 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!33 = !{!32, !6, i64 8}


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

%struct.s2n_debug_info = type { ptr, ptr }
%struct.s2n_ticket_key_weight = type { double, i8 }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.27 = external hidden unnamed_addr constant [87 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @s2n_calculate_stacktrace() 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) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #4

declare i32 @s2n_array_get(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 256) i32 @s2n_compute_weight_of_encrypt_decrypt_keys(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i8 noundef zeroext %2, i64 noundef %3) local_unnamed_addr #5 {
  %5 = alloca [48 x %struct.s2n_ticket_key_weight], align 16
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store ptr null, ptr %6, align 8, !tbaa !5
  %.not55.not = icmp eq i8 %2, 0
  br i1 %.not55.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 152
  %9 = getelementptr inbounds i8, ptr %0, i64 160
  %wide.trip.count = zext i8 %2 to i64
  br label %10

10:                                               ; preds = %.lr.ph, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %17 ]
  %.03957 = phi double [ 0.000000e+00, %.lr.ph ], [ %30, %17 ]
  %11 = load ptr, ptr %8, align 8, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  %13 = load i8, ptr %12, align 1, !tbaa !17
  %14 = zext i8 %13 to i32
  %15 = call i32 @s2n_array_get(ptr noundef %11, i32 noundef %14, ptr noundef nonnull %6) #6
  %16 = call zeroext i1 @s2n_result_is_ok(i32 %15)
  br i1 %16, label %17, label %.loopexit

17:                                               ; preds = %10
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 64
  %20 = load i64, ptr %19, align 8, !tbaa !18
  %21 = load i64, ptr %9, align 8, !tbaa !20
  %22 = lshr i64 %21, 1
  %23 = add i64 %22, %20
  %24 = icmp ugt i64 %23, %3
  %25 = sub i64 %3, %20
  %.neg = sub i64 %22, %3
  %26 = add i64 %.neg, %23
  %.sink.in = select i1 %24, i64 %25, i64 %26
  %.sink = uitofp i64 %.sink.in to double
  %27 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %5, i64 0, i64 %indvars.iv
  store double %.sink, ptr %27, align 16
  %28 = load i8, ptr %12, align 1, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %27, i64 8
  store i8 %28, ptr %29, align 8, !tbaa !21
  %30 = fadd double %.03957, %.sink
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %10, !llvm.loop !24

.critedge:                                        ; preds = %17, %4
  %.039.lcssa = phi double [ 0.000000e+00, %4 ], [ %30, %17 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store i64 0, ptr %7, align 8, !tbaa !26
  %31 = call i32 @s2n_public_random(i64 noundef 9007199254740992, ptr noundef nonnull %7) #6
  %32 = call zeroext i1 @s2n_result_is_ok(i32 %31)
  br i1 %32, label %33, label %59

33:                                               ; preds = %.critedge
  %34 = load i64, ptr %7, align 8, !tbaa !26
  %35 = uitofp i64 %34 to double
  %36 = fmul double %35, 0x3CA0000000000000
  br i1 %.not55.not, label %._crit_edge, label %37

37:                                               ; preds = %33
  %wide.trip.count68 = zext i8 %2 to i64
  %38 = load double, ptr %5, align 16, !tbaa !27
  %39 = fdiv double %38, %.039.lcssa
  %40 = fcmp ogt double %39, %36
  br i1 %40, label %.thread, label %41

41:                                               ; preds = %37
  %exitcond69.peel.not = icmp eq i8 %2, 1
  br i1 %exitcond69.peel.not, label %._crit_edge, label %.lr.ph61.peel.next

42:                                               ; preds = %.lr.ph61.peel.next
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond69.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count68
  br i1 %exitcond69.not, label %._crit_edge, label %.lr.ph61.peel.next, !llvm.loop !28

.lr.ph61.peel.next:                               ; preds = %41, %42
  %43 = phi double [ %47, %42 ], [ %39, %41 ]
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %42 ], [ 1, %41 ]
  %44 = getelementptr inbounds [48 x %struct.s2n_ticket_key_weight], ptr %5, i64 0, i64 %indvars.iv65
  %45 = load double, ptr %44, align 16, !tbaa !27
  %46 = fdiv double %45, %.039.lcssa
  %47 = fadd double %46, %43
  store double %47, ptr %44, align 16, !tbaa !27
  %48 = fcmp ogt double %47, %36
  br i1 %48, label %.thread, label %42

.thread:                                          ; preds = %.lr.ph61.peel.next, %37
  %.lcssa = phi ptr [ %5, %37 ], [ %44, %.lr.ph61.peel.next ]
  %49 = getelementptr inbounds i8, ptr %.lcssa, i64 8
  %50 = load i8, ptr %49, align 8, !tbaa !21
  %51 = zext i8 %50 to i32
  br label %59

._crit_edge:                                      ; preds = %42, %41, %33
  %52 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.27, ptr %52, align 8, !tbaa !30
  %53 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.27, i64 21), i32 noundef 47) #7
  %.not49 = icmp eq ptr %53, null
  %54 = getelementptr inbounds i8, ptr %53, i64 1
  %55 = select i1 %.not49, ptr getelementptr inbounds (i8, ptr @.str.27, i64 21), ptr %54
  %56 = getelementptr inbounds i8, ptr %52, i64 8
  store ptr %55, ptr %56, align 8, !tbaa !32
  %57 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762085, ptr %57, align 4, !tbaa !33
  %58 = call i32 @s2n_calculate_stacktrace() #6
  br label %59

59:                                               ; preds = %.thread, %._crit_edge, %.critedge
  %.3 = phi i32 [ -1, %.critedge ], [ -1, %._crit_edge ], [ %51, %.thread ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %.loopexit

.loopexit:                                        ; preds = %10, %59
  %.4 = phi i32 [ %.3, %59 ], [ -1, %10 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %5) #6
  ret i32 %.4
}

declare i32 @s2n_public_random(i64 noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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, !6, i64 152}
!10 = !{!"s2n_config", !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !6, i64 8, !6, i64 16, !12, i64 24, !13, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !11, i64 128, !11, i64 132, !6, i64 136, !14, i64 144, !6, i64 152, !14, i64 160, !14, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !11, i64 224, !7, i64 228, !11, i64 232, !11, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !15, i64 304, !16, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !11, i64 392, !11, i64 396, !11, i64 400, !6, i64 408, !11, i64 416, !11, i64 420, !6, i64 424, !6, i64 432, !11, i64 440, !13, i64 448}
!11 = !{!"int", !7, i64 0}
!12 = !{!"certs_by_type", !7, i64 0}
!13 = !{!"s2n_blob", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!"s2n_x509_trust_store", !6, i64 0, !11, i64 8}
!16 = !{!"short", !7, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !14, i64 64}
!19 = !{!"s2n_ticket_key", !7, i64 0, !7, i64 16, !7, i64 48, !14, i64 64}
!20 = !{!10, !14, i64 160}
!21 = !{!22, !7, i64 8}
!22 = !{!"s2n_ticket_key_weight", !23, i64 0, !7, i64 8}
!23 = !{!"double", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!14, !14, i64 0}
!27 = !{!22, !23, i64 0}
!28 = distinct !{!28, !25, !29}
!29 = !{!"llvm.loop.peeled.count", i32 1}
!30 = !{!31, !6, i64 0}
!31 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!32 = !{!31, !6, i64 8}
!33 = !{!11, !11, i64 0}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass