; 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
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@__func__.CountParams = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__.CountParams = external hidden unnamed_addr constant [52 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @SkipWhitespace(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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @CountParams(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp ne ptr null, %6
  br i1 %7, label %10, label %8

8:                                                ; preds = %2
  call void @LogAssertFailure(i64 noundef 138, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.7)
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str, i32 noundef 138, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

9:                                                ; No predecessors!
  br label %10

10:                                               ; preds = %9, %2
  %11 = phi i1 [ true, %2 ], [ false, %9 ]
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp ne ptr null, %12
  br i1 %13, label %16, label %14

14:                                               ; preds = %10
  call void @LogAssertFailure(i64 noundef 139, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.9)
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str, i32 noundef 139, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %10
  %17 = phi i1 [ true, %10 ], [ false, %15 ]
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = icmp ule ptr %18, %19
  br i1 %20, label %23, label %21

21:                                               ; preds = %16
  call void @LogAssertFailure(i64 noundef 140, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.19)
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str, i32 noundef 140, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

22:                                               ; No predecessors!
  br label %23

23:                                               ; preds = %22, %16
  %24 = phi i1 [ true, %16 ], [ false, %22 ]
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load i8, ptr %25, align 1, !tbaa !9
  %27 = sext i8 %26 to i32
  %28 = icmp eq i32 32, %27
  br i1 %28, label %39, label %29

29:                                               ; preds = %23
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %32 = sext i8 %31 to i32
  %33 = icmp sle i32 9, %32
  br i1 %33, label %34, label %41

34:                                               ; preds = %29
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load i8, ptr %35, align 1, !tbaa !9
  %37 = sext i8 %36 to i32
  %38 = icmp sle i32 %37, 13
  br i1 %38, label %39, label %41

39:                                               ; preds = %34, %23
  call void @LogAssertFailure(i64 noundef 141, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.15)
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str, i32 noundef 141, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %34, %29
  %42 = phi i1 [ true, %34 ], [ true, %29 ], [ false, %40 ]
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = sext i8 %44 to i32
  %46 = icmp eq i32 0, %45
  br i1 %46, label %54, label %47

47:                                               ; preds = %41
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = load i8, ptr %48, align 1, !tbaa !9
  %50 = sext i8 %49 to i32
  %51 = icmp eq i32 44, %50
  br i1 %51, label %54, label %52

52:                                               ; preds = %47
  call void @LogAssertFailure(i64 noundef 142, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.17)
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str, i32 noundef 142, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

53:                                               ; No predecessors!
  br label %54

54:                                               ; preds = %53, %47, %41
  %55 = phi i1 [ true, %47 ], [ true, %41 ], [ false, %53 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !10
  br label %56

56:                                               ; preds = %101, %54
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %74, %57
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = call ptr @SkipWhitespace(ptr noundef %60)
  store ptr %61, ptr %3, align 8, !tbaa !5
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = icmp ule ptr %62, %63
  br i1 %64, label %67, label %65

65:                                               ; preds = %59
  call void @LogAssertFailure(i64 noundef 152, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.19)
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str, i32 noundef 152, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

66:                                               ; No predecessors!
  br label %67

67:                                               ; preds = %66, %59
  %68 = phi i1 [ true, %59 ], [ false, %66 ]
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = load i8, ptr %69, align 1, !tbaa !9
  %71 = sext i8 %70 to i32
  %72 = icmp ne i32 59, %71
  br i1 %72, label %73, label %74

73:                                               ; preds = %67
  br label %77

74:                                               ; preds = %67
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %75, i32 1
  store ptr %76, ptr %3, align 8, !tbaa !5
  br label %58, !llvm.loop !12

77:                                               ; preds = %73
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = icmp ule ptr %78, %79
  br i1 %80, label %83, label %81

81:                                               ; preds = %77
  call void @LogAssertFailure(i64 noundef 158, ptr noundef @.str, ptr noundef @__func__.CountParams, ptr noundef @.str.19)
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str, i32 noundef 158, ptr noundef @__PRETTY_FUNCTION__.CountParams) #6
  unreachable

82:                                               ; No predecessors!
  br label %83

83:                                               ; preds = %82, %77
  %84 = phi i1 [ true, %77 ], [ false, %82 ]
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = icmp eq ptr %85, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %83
  br label %104

89:                                               ; preds = %83
  %90 = load i64, ptr %5, align 8, !tbaa !10
  %91 = add i64 %90, 1
  store i64 %91, ptr %5, align 8, !tbaa !10
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = call noundef ptr @strchr(ptr noundef %92, i32 noundef 59) #8
  store ptr %93, ptr %3, align 8, !tbaa !5
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = icmp eq ptr null, %94
  br i1 %95, label %100, label %96

96:                                               ; preds = %89
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = icmp ule ptr %97, %98
  br i1 %99, label %100, label %101

100:                                              ; preds = %96, %89
  br label %104

101:                                              ; preds = %96
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds i8, ptr %102, i32 1
  store ptr %103, ptr %3, align 8, !tbaa !5
  br label %56, !llvm.loop !14

104:                                              ; preds = %100, %88
  %105 = load i64, ptr %5, align 8, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret i64 %105
}

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

attributes #0 = { mustprogress 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 = { 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 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 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 #6 = { noreturn nounwind }
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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !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"

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@__func__.CountParams = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__.CountParams = external hidden unnamed_addr constant [52 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @SkipWhitespace(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @CountParams(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #3 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %3, label %4

3:                                                ; preds = %2
  tail call void @LogAssertFailure(i64 noundef 138, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.CountParams, ptr noundef nonnull @.str.7)
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str, i32 noundef 138, ptr noundef nonnull @__PRETTY_FUNCTION__.CountParams) #5
  unreachable

4:                                                ; preds = %2
  %.not32 = icmp eq ptr %1, null
  br i1 %.not32, label %5, label %6

5:                                                ; preds = %4
  tail call void @LogAssertFailure(i64 noundef 139, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.CountParams, ptr noundef nonnull @.str.9)
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str, i32 noundef 139, ptr noundef nonnull @__PRETTY_FUNCTION__.CountParams) #5
  unreachable

6:                                                ; preds = %4
  %.not33 = icmp ugt ptr %0, %1
  br i1 %.not33, label %7, label %8

7:                                                ; preds = %6
  tail call void @LogAssertFailure(i64 noundef 140, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.CountParams, ptr noundef nonnull @.str.19)
  tail call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str, i32 noundef 140, ptr noundef nonnull @__PRETTY_FUNCTION__.CountParams) #5
  unreachable

8:                                                ; preds = %6
  %9 = load i8, ptr %0, align 1, !tbaa !5
  switch i8 %9, label %11 [
    i8 32, label %10
    i8 13, label %10
    i8 12, label %10
    i8 11, label %10
    i8 10, label %10
    i8 9, label %10
  ]

10:                                               ; preds = %8, %8, %8, %8, %8, %8
  tail call void @LogAssertFailure(i64 noundef 141, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.CountParams, ptr noundef nonnull @.str.15)
  tail call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str, i32 noundef 141, ptr noundef nonnull @__PRETTY_FUNCTION__.CountParams) #5
  unreachable

11:                                               ; preds = %8
  %12 = load i8, ptr %1, align 1, !tbaa !5
  switch i8 %12, label %13 [
    i8 0, label %14
    i8 44, label %14
  ]

13:                                               ; preds = %11
  tail call void @LogAssertFailure(i64 noundef 142, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.CountParams, ptr noundef nonnull @.str.17)
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str, i32 noundef 142, ptr noundef nonnull @__PRETTY_FUNCTION__.CountParams) #5
  unreachable

14:                                               ; preds = %11, %11
  %15 = tail call ptr @SkipWhitespace(ptr noundef nonnull %0)
  %.not344042 = icmp ugt ptr %15, %1
  br i1 %.not344042, label %._crit_edge, label %.lr.ph

16:                                               ; preds = %28
  %17 = getelementptr inbounds i8, ptr %30, i64 1
  %18 = tail call ptr @SkipWhitespace(ptr noundef nonnull %17)
  %.not3440 = icmp ugt ptr %18, %1
  br i1 %.not3440, label %._crit_edge, label %.lr.ph, !llvm.loop !8

.lr.ph:                                           ; preds = %14, %16
  %19 = phi ptr [ %18, %16 ], [ %15, %14 ]
  %.043 = phi i64 [ %29, %16 ], [ 0, %14 ]
  br label %20

._crit_edge:                                      ; preds = %16, %23, %14
  tail call void @LogAssertFailure(i64 noundef 152, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.CountParams, ptr noundef nonnull @.str.19)
  tail call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str, i32 noundef 152, ptr noundef nonnull @__PRETTY_FUNCTION__.CountParams) #5
  unreachable

20:                                               ; preds = %.lr.ph, %23
  %21 = phi ptr [ %19, %.lr.ph ], [ %25, %23 ]
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %.not35 = icmp eq i8 %22, 59
  br i1 %.not35, label %23, label %26

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %21, i64 1
  %25 = tail call ptr @SkipWhitespace(ptr noundef nonnull %24)
  %.not34 = icmp ugt ptr %25, %1
  br i1 %.not34, label %._crit_edge, label %20, !llvm.loop !10

26:                                               ; preds = %20
  %27 = icmp eq ptr %21, %1
  br i1 %27, label %32, label %28

28:                                               ; preds = %26
  %29 = add i64 %.043, 1
  %30 = tail call noundef ptr @strchr(ptr noundef nonnull dereferenceable(1) %21, i32 noundef 59) #6
  %31 = icmp ne ptr %30, null
  %.not36 = icmp ult ptr %30, %1
  %or.cond37 = and i1 %31, %.not36
  br i1 %or.cond37, label %16, label %32

32:                                               ; preds = %28, %26
  %.1 = phi i64 [ %.043, %26 ], [ %29, %28 ]
  ret i64 %.1
}

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

attributes #0 = { mustprogress 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 = { "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 = { 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 #5 = { noreturn nounwind }
attributes #6 = { 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++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}


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