; LLVM IR from Discngine/fpocket :: src (pertable)

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

@ST_pte_symbol = external hidden global [112 x ptr], align 16
@ST_pte_mass = external hidden constant [112 x float], align 16

; Function Attrs: nounwind uwtable
define dso_local float @pte_get_mass(ptr noundef %0) #0 {
  %2 = alloca float, align 4
  %3 = alloca ptr, align 8
  %4 = alloca [3 x i8], align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 3, ptr %4) #5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %131

15:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 0
  %18 = load i8, ptr %17, align 1, !tbaa !9
  %19 = sext i8 %18 to i32
  %20 = call i1 @llvm.is.constant.i32(i32 %19)
  br i1 %20, label %21, label %42

21:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 0
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = sext i8 %24 to i32
  store i32 %25, ptr %6, align 4, !tbaa !10
  %26 = load i32, ptr %6, align 4, !tbaa !10
  %27 = icmp slt i32 %26, -128
  br i1 %27, label %31, label %28

28:                                               ; preds = %21
  %29 = load i32, ptr %6, align 4, !tbaa !10
  %30 = icmp sgt i32 %29, 255
  br i1 %30, label %31, label %33

31:                                               ; preds = %28, %21
  %32 = load i32, ptr %6, align 4, !tbaa !10
  br label %40

33:                                               ; preds = %28
  %34 = call ptr @__ctype_toupper_loc() #6
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !10
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %35, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !10
  br label %40

40:                                               ; preds = %33, %31
  %41 = phi i32 [ %32, %31 ], [ %39, %33 ]
  store i32 %41, ptr %5, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %48

42:                                               ; preds = %15
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 0
  %45 = load i8, ptr %44, align 1, !tbaa !9
  %46 = sext i8 %45 to i32
  %47 = call i32 @toupper(i32 noundef %46) #7
  store i32 %47, ptr %5, align 4, !tbaa !10
  br label %48

48:                                               ; preds = %42, %40
  %49 = load i32, ptr %5, align 4, !tbaa !10
  store i32 %49, ptr %7, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %50 = load i32, ptr %7, align 4, !tbaa !10
  %51 = trunc i32 %50 to i8
  %52 = getelementptr inbounds [3 x i8], ptr %4, i64 0, i64 0
  store i8 %51, ptr %52, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 1
  %55 = load i8, ptr %54, align 1, !tbaa !9
  %56 = sext i8 %55 to i32
  %57 = call i1 @llvm.is.constant.i32(i32 %56)
  br i1 %57, label %58, label %79

58:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 1
  %61 = load i8, ptr %60, align 1, !tbaa !9
  %62 = sext i8 %61 to i32
  store i32 %62, ptr %9, align 4, !tbaa !10
  %63 = load i32, ptr %9, align 4, !tbaa !10
  %64 = icmp slt i32 %63, -128
  br i1 %64, label %68, label %65

65:                                               ; preds = %58
  %66 = load i32, ptr %9, align 4, !tbaa !10
  %67 = icmp sgt i32 %66, 255
  br i1 %67, label %68, label %70

68:                                               ; preds = %65, %58
  %69 = load i32, ptr %9, align 4, !tbaa !10
  br label %77

70:                                               ; preds = %65
  %71 = call ptr @__ctype_tolower_loc() #6
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !10
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds i32, ptr %72, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !10
  br label %77

77:                                               ; preds = %70, %68
  %78 = phi i32 [ %69, %68 ], [ %76, %70 ]
  store i32 %78, ptr %8, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %85

79:                                               ; preds = %48
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %80, i64 1
  %82 = load i8, ptr %81, align 1, !tbaa !9
  %83 = sext i8 %82 to i32
  %84 = call i32 @tolower(i32 noundef %83) #7
  store i32 %84, ptr %8, align 4, !tbaa !10
  br label %85

85:                                               ; preds = %79, %77
  %86 = load i32, ptr %8, align 4, !tbaa !10
  store i32 %86, ptr %10, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %87 = load i32, ptr %10, align 4, !tbaa !10
  %88 = trunc i32 %87 to i8
  %89 = getelementptr inbounds [3 x i8], ptr %4, i64 0, i64 1
  store i8 %88, ptr %89, align 1, !tbaa !9
  %90 = getelementptr inbounds [3 x i8], ptr %4, i64 0, i64 2
  store i8 0, ptr %90, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !10
  br label %91

91:                                               ; preds = %124, %85
  %92 = load i32, ptr %11, align 4, !tbaa !10
  %93 = icmp slt i32 %92, 112
  br i1 %93, label %94, label %127

94:                                               ; preds = %91
  %95 = load i32, ptr %11, align 4, !tbaa !10
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [112 x ptr], ptr @ST_pte_symbol, i64 0, i64 %96
  %98 = load ptr, ptr %97, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i64 0
  %100 = load i8, ptr %99, align 1, !tbaa !9
  %101 = sext i8 %100 to i32
  %102 = getelementptr inbounds [3 x i8], ptr %4, i64 0, i64 0
  %103 = load i8, ptr %102, align 1, !tbaa !9
  %104 = sext i8 %103 to i32
  %105 = icmp eq i32 %101, %104
  br i1 %105, label %106, label %123

106:                                              ; preds = %94
  %107 = load i32, ptr %11, align 4, !tbaa !10
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [112 x ptr], ptr @ST_pte_symbol, i64 0, i64 %108
  %110 = load ptr, ptr %109, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i64 1
  %112 = load i8, ptr %111, align 1, !tbaa !9
  %113 = sext i8 %112 to i32
  %114 = getelementptr inbounds [3 x i8], ptr %4, i64 0, i64 1
  %115 = load i8, ptr %114, align 1, !tbaa !9
  %116 = sext i8 %115 to i32
  %117 = icmp eq i32 %113, %116
  br i1 %117, label %118, label %123

118:                                              ; preds = %106
  %119 = load i32, ptr %11, align 4, !tbaa !10
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [112 x float], ptr @ST_pte_mass, i64 0, i64 %120
  %122 = load float, ptr %121, align 4, !tbaa !12
  store float %122, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %128

123:                                              ; preds = %106, %94
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %11, align 4, !tbaa !10
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %11, align 4, !tbaa !10
  br label %91, !llvm.loop !14

127:                                              ; preds = %91
  store i32 0, ptr %12, align 4
  br label %128

128:                                              ; preds = %127, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %129 = load i32, ptr %12, align 4
  switch i32 %129, label %132 [
    i32 0, label %130
  ]

130:                                              ; preds = %128
  br label %131

131:                                              ; preds = %130, %1
  store float -1.000000e+00, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %132

132:                                              ; preds = %131, %128
  call void @llvm.lifetime.end.p0(i64 3, ptr %4) #5
  %133 = load float, ptr %2, align 4
  ret float %133
}

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

; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
declare i1 @llvm.is.constant.i32(i32) #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() #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 willreturn memory(read) uwtable
declare i32 @toupper(i32 noundef) #4

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() #3

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @tolower(i32 noundef) #4

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 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { nounwind willreturn memory(none) "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 willreturn memory(read) 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 }
attributes #6 = { nounwind willreturn memory(none) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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

@ST_pte_symbol = external hidden local_unnamed_addr global [112 x ptr], align 16
@ST_pte_mass = external hidden local_unnamed_addr constant [112 x float], align 16

; Function Attrs: nofree nounwind memory(read) uwtable
define dso_local float @pte_get_mass(ptr noundef readonly %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.thread, label %2

2:                                                ; preds = %1
  %3 = load i8, ptr %0, align 1, !tbaa !5
  %4 = sext i8 %3 to i32
  %5 = tail call i32 @toupper(i32 noundef %4) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 1
  %7 = load i8, ptr %6, align 1, !tbaa !5
  %8 = sext i8 %7 to i32
  %9 = tail call i32 @tolower(i32 noundef %8) #2
  %sext = shl i32 %5, 24
  %10 = ashr exact i32 %sext, 24
  %sext33 = shl i32 %9, 24
  %11 = ashr exact i32 %sext33, 24
  br label %12

12:                                               ; preds = %34, %2
  %indvars.iv = phi i64 [ 0, %2 ], [ %indvars.iv.next.1, %34 ]
  %13 = getelementptr inbounds [112 x ptr], ptr @ST_pte_symbol, i64 0, i64 %indvars.iv
  %14 = load ptr, ptr %13, align 16, !tbaa !8
  %15 = load i8, ptr %14, align 1, !tbaa !5
  %16 = sext i8 %15 to i32
  %17 = icmp eq i32 %10, %16
  br i1 %17, label %18, label %23

18:                                               ; preds = %12
  %19 = getelementptr inbounds i8, ptr %14, i64 1
  %20 = load i8, ptr %19, align 1, !tbaa !5
  %21 = sext i8 %20 to i32
  %22 = icmp eq i32 %11, %21
  br i1 %22, label %35, label %23

23:                                               ; preds = %12, %18
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %24 = getelementptr inbounds [112 x ptr], ptr @ST_pte_symbol, i64 0, i64 %indvars.iv.next
  %25 = load ptr, ptr %24, align 8, !tbaa !8
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %27 = sext i8 %26 to i32
  %28 = icmp eq i32 %10, %27
  br i1 %28, label %29, label %34

29:                                               ; preds = %23
  %30 = getelementptr inbounds i8, ptr %25, i64 1
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %11, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %29, %23
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.1 = icmp eq i64 %indvars.iv.next.1, 112
  br i1 %exitcond.1, label %.thread, label %12, !llvm.loop !10

35:                                               ; preds = %29, %18
  %indvars.iv.lcssa = phi i64 [ %indvars.iv, %18 ], [ %indvars.iv.next, %29 ]
  %36 = getelementptr inbounds [112 x float], ptr @ST_pte_mass, i64 0, i64 %indvars.iv.lcssa
  %37 = load float, ptr %36, align 4, !tbaa !12
  br label %.thread

.thread:                                          ; preds = %34, %1, %35
  %.1 = phi float [ %37, %35 ], [ -1.000000e+00, %1 ], [ -1.000000e+00, %34 ]
  ret float %.1
}

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @toupper(i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @tolower(i32 noundef) local_unnamed_addr #1

attributes #0 = { nofree nounwind memory(read) 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 mustprogress nofree nounwind willreturn memory(read) 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerConstantIntrinsicsPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass