; LLVM IR from interpretml/interpret :: shared/libebm/unzoned (unzoned)

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

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@__func__.IsStringEqualsCaseInsensitive = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [58 x i8], align 1
@__PRETTY_FUNCTION__.IsStringEqualsCaseInsensitive = external hidden unnamed_addr constant [70 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @LogAssertFailure(i64 noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local ptr @IsStringEqualsCaseInsensitive(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = load i8, ptr %9, align 1, !tbaa !9
  store i8 %10, ptr %6, align 1, !tbaa !9
  %11 = load i8, ptr %6, align 1, !tbaa !9
  %12 = sext i8 %11 to i32
  %13 = icmp ne i32 32, %12
  br i1 %13, label %14, label %22

14:                                               ; preds = %2
  %15 = load i8, ptr %6, align 1, !tbaa !9
  %16 = sext i8 %15 to i32
  %17 = icmp slt i32 %16, 9
  br i1 %17, label %24, label %18

18:                                               ; preds = %14
  %19 = load i8, ptr %6, align 1, !tbaa !9
  %20 = sext i8 %19 to i32
  %21 = icmp slt i32 13, %20
  br i1 %21, label %24, label %22

22:                                               ; preds = %18, %2
  call void @LogAssertFailure(i64 noundef 53, ptr noundef @.str, ptr noundef @__func__.IsStringEqualsCaseInsensitive, ptr noundef @.str.5)
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str, i32 noundef 53, ptr noundef @__PRETTY_FUNCTION__.IsStringEqualsCaseInsensitive) #5
  unreachable

23:                                               ; No predecessors!
  br label %24

24:                                               ; preds = %23, %18, %14
  %25 = phi i1 [ true, %18 ], [ true, %14 ], [ false, %23 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i8, ptr %26, align 1, !tbaa !9
  store i8 %27, ptr %7, align 1, !tbaa !9
  br label %28

28:                                               ; preds = %65, %24
  %29 = load i8, ptr %7, align 1, !tbaa !9
  %30 = sext i8 %29 to i32
  %31 = icmp ne i32 0, %30
  br i1 %31, label %32, label %74

32:                                               ; preds = %28
  %33 = load i8, ptr %6, align 1, !tbaa !9
  %34 = sext i8 %33 to i32
  %35 = icmp sle i32 65, %34
  br i1 %35, label %36, label %45

36:                                               ; preds = %32
  %37 = load i8, ptr %6, align 1, !tbaa !9
  %38 = sext i8 %37 to i32
  %39 = icmp sle i32 %38, 90
  br i1 %39, label %40, label %45

40:                                               ; preds = %36
  %41 = load i8, ptr %6, align 1, !tbaa !9
  %42 = sext i8 %41 to i32
  %43 = add nsw i32 %42, 32
  %44 = trunc i32 %43 to i8
  store i8 %44, ptr %6, align 1, !tbaa !9
  br label %45

45:                                               ; preds = %40, %36, %32
  %46 = load i8, ptr %7, align 1, !tbaa !9
  %47 = sext i8 %46 to i32
  %48 = icmp sle i32 65, %47
  br i1 %48, label %49, label %58

49:                                               ; preds = %45
  %50 = load i8, ptr %7, align 1, !tbaa !9
  %51 = sext i8 %50 to i32
  %52 = icmp sle i32 %51, 90
  br i1 %52, label %53, label %58

53:                                               ; preds = %49
  %54 = load i8, ptr %7, align 1, !tbaa !9
  %55 = sext i8 %54 to i32
  %56 = add nsw i32 %55, 32
  %57 = trunc i32 %56 to i8
  store i8 %57, ptr %7, align 1, !tbaa !9
  br label %58

58:                                               ; preds = %53, %49, %45
  %59 = load i8, ptr %6, align 1, !tbaa !9
  %60 = sext i8 %59 to i32
  %61 = load i8, ptr %7, align 1, !tbaa !9
  %62 = sext i8 %61 to i32
  %63 = icmp ne i32 %60, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %58
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %98

65:                                               ; preds = %58
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i32 1
  store ptr %67, ptr %4, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i32 1
  store ptr %69, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load i8, ptr %70, align 1, !tbaa !9
  store i8 %71, ptr %6, align 1, !tbaa !9
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load i8, ptr %72, align 1, !tbaa !9
  store i8 %73, ptr %7, align 1, !tbaa !9
  br label %28, !llvm.loop !10

74:                                               ; preds = %28
  br label %75

75:                                               ; preds = %91, %74
  %76 = load i8, ptr %6, align 1, !tbaa !9
  %77 = sext i8 %76 to i32
  %78 = icmp eq i32 32, %77
  br i1 %78, label %89, label %79

79:                                               ; preds = %75
  %80 = load i8, ptr %6, align 1, !tbaa !9
  %81 = sext i8 %80 to i32
  %82 = icmp sle i32 9, %81
  br i1 %82, label %83, label %87

83:                                               ; preds = %79
  %84 = load i8, ptr %6, align 1, !tbaa !9
  %85 = sext i8 %84 to i32
  %86 = icmp sle i32 %85, 13
  br label %87

87:                                               ; preds = %83, %79
  %88 = phi i1 [ false, %79 ], [ %86, %83 ]
  br label %89

89:                                               ; preds = %87, %75
  %90 = phi i1 [ true, %75 ], [ %88, %87 ]
  br i1 %90, label %91, label %96

91:                                               ; preds = %89
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %92, i32 1
  store ptr %93, ptr %4, align 8, !tbaa !5
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = load i8, ptr %94, align 1, !tbaa !9
  store i8 %95, ptr %6, align 1, !tbaa !9
  br label %75, !llvm.loop !12

96:                                               ; preds = %89
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %97, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %98

98:                                               ; preds = %96, %64
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  %99 = load ptr, ptr %3, align 8
  ret ptr %99
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { mustprogress 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 #4 = { nounwind }
attributes #5 = { 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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


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

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@__func__.IsStringEqualsCaseInsensitive = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [58 x i8], align 1
@__PRETTY_FUNCTION__.IsStringEqualsCaseInsensitive = external hidden unnamed_addr constant [70 x i8], align 1

declare void @LogAssertFailure(i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @IsStringEqualsCaseInsensitive(ptr noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = load i8, ptr %0, align 1, !tbaa !5
  switch i8 %3, label %.preheader47 [
    i8 32, label %4
    i8 13, label %4
    i8 12, label %4
    i8 11, label %4
    i8 10, label %4
    i8 9, label %4
  ]

.preheader47:                                     ; preds = %2
  %.051 = load i8, ptr %1, align 1, !tbaa !5
  %.not4252 = icmp eq i8 %.051, 0
  br i1 %.not4252, label %.preheader.preheader, label %.lr.ph

4:                                                ; preds = %2, %2, %2, %2, %2, %2
  tail call void @LogAssertFailure(i64 noundef 53, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.IsStringEqualsCaseInsensitive, ptr noundef nonnull @.str.5)
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str, i32 noundef 53, ptr noundef nonnull @__PRETTY_FUNCTION__.IsStringEqualsCaseInsensitive) #3
  unreachable

.lr.ph:                                           ; preds = %.preheader47, %9
  %.056 = phi i8 [ %.0, %9 ], [ %.051, %.preheader47 ]
  %.03255 = phi i8 [ %12, %9 ], [ %3, %.preheader47 ]
  %.03454 = phi ptr [ %11, %9 ], [ %1, %.preheader47 ]
  %.03553 = phi ptr [ %10, %9 ], [ %0, %.preheader47 ]
  %5 = add i8 %.03255, -65
  %or.cond5 = icmp ult i8 %5, 26
  %6 = or disjoint i8 %.03255, 32
  %spec.select = select i1 %or.cond5, i8 %6, i8 %.03255
  %7 = add i8 %.056, -65
  %or.cond8 = icmp ult i8 %7, 26
  %8 = or disjoint i8 %.056, 32
  %.1 = select i1 %or.cond8, i8 %8, i8 %.056
  %.not43 = icmp eq i8 %spec.select, %.1
  br i1 %.not43, label %9, label %.loopexit

9:                                                ; preds = %.lr.ph
  %10 = getelementptr inbounds i8, ptr %.03553, i64 1
  %11 = getelementptr inbounds i8, ptr %.03454, i64 1
  %12 = load i8, ptr %10, align 1, !tbaa !5
  %.0 = load i8, ptr %11, align 1, !tbaa !5
  %.not42 = icmp eq i8 %.0, 0
  br i1 %.not42, label %.preheader.preheader, label %.lr.ph, !llvm.loop !8

.preheader.preheader:                             ; preds = %9, %.preheader47
  %.136.ph = phi ptr [ %0, %.preheader47 ], [ %10, %9 ]
  %.2.ph = phi i8 [ %3, %.preheader47 ], [ %12, %9 ]
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.critedge
  %.136 = phi ptr [ %13, %.critedge ], [ %.136.ph, %.preheader.preheader ]
  %.2 = phi i8 [ %14, %.critedge ], [ %.2.ph, %.preheader.preheader ]
  switch i8 %.2, label %.loopexit [
    i8 32, label %.critedge
    i8 13, label %.critedge
    i8 12, label %.critedge
    i8 11, label %.critedge
    i8 10, label %.critedge
    i8 9, label %.critedge
  ]

.critedge:                                        ; preds = %.preheader, %.preheader, %.preheader, %.preheader, %.preheader, %.preheader
  %13 = getelementptr inbounds i8, ptr %.136, i64 1
  %14 = load i8, ptr %13, align 1, !tbaa !5
  br label %.preheader, !llvm.loop !10

.loopexit:                                        ; preds = %.lr.ph, %.preheader
  %.037 = phi ptr [ %.136, %.preheader ], [ null, %.lr.ph ]
  ret ptr %.037
}

attributes #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 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass