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

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

@stderr = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [37 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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #2

; Function Attrs: nounwind uwtable
define dso_local i32 @str_is_float(ptr noundef %0, i32 noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %85

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %12, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = load i8, ptr %13, align 1, !tbaa !11
  %15 = sext i8 %14 to i32
  store i32 %15, ptr %8, align 4, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %44

18:                                               ; preds = %11
  %19 = call ptr @__ctype_b_loc() #5
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i16, ptr %20, i64 %22
  %24 = load i16, ptr %23, align 2, !tbaa !12
  %25 = zext i16 %24 to i32
  %26 = and i32 %25, 2048
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %40, label %28

28:                                               ; preds = %18
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 43
  br i1 %30, label %34, label %31

31:                                               ; preds = %28
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = icmp eq i32 %32, 45
  br i1 %33, label %34, label %41

34:                                               ; preds = %31, %28
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !11
  %38 = sext i8 %37 to i32
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %34, %18
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %40, %34, %31
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i32 1
  store ptr %43, ptr %7, align 8, !tbaa !5
  br label %45

44:                                               ; preds = %11
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %44, %41
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %84

48:                                               ; preds = %45
  br label %49

49:                                               ; preds = %80, %48
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = sext i8 %51 to i32
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %83

54:                                               ; preds = %49
  %55 = call ptr @__ctype_b_loc() #5
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = sext i8 %58 to i32
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i16, ptr %56, i64 %60
  %62 = load i16, ptr %61, align 2, !tbaa !12
  %63 = zext i16 %62 to i32
  %64 = and i32 %63, 2048
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %80, label %66

66:                                               ; preds = %54
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = sext i8 %68 to i32
  %70 = icmp eq i32 %69, 46
  br i1 %70, label %71, label %78

71:                                               ; preds = %66
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %6, align 4, !tbaa !9
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = icmp sgt i32 %74, 1
  br i1 %75, label %76, label %77

76:                                               ; preds = %71
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %83

77:                                               ; preds = %71
  br label %79

78:                                               ; preds = %66
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %83

79:                                               ; preds = %77
  br label %80

80:                                               ; preds = %79, %54
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %81, i32 1
  store ptr %82, ptr %7, align 8, !tbaa !5
  br label %49, !llvm.loop !14

83:                                               ; preds = %78, %76, %49
  br label %84

84:                                               ; preds = %83, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %88

85:                                               ; preds = %2
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.6) #4
  br label %88

88:                                               ; preds = %85, %84
  %89 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 %89
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(none) }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [37 x i8], align 1

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #1

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 2) i32 @str_is_float(ptr noundef readonly %0, i32 noundef %1) local_unnamed_addr #2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %33, label %3

3:                                                ; preds = %2
  %4 = load i8, ptr %0, align 1, !tbaa !5
  %.not24 = icmp eq i32 %1, 0
  br i1 %.not24, label %.preheader, label %5

5:                                                ; preds = %3
  %6 = tail call ptr @__ctype_b_loc() #3
  %7 = load ptr, ptr %6, align 8, !tbaa !8
  %8 = sext i8 %4 to i64
  %9 = getelementptr inbounds i16, ptr %7, i64 %8
  %10 = load i16, ptr %9, align 2, !tbaa !10
  %11 = and i16 %10, 2048
  %.not25 = icmp eq i16 %11, 0
  br i1 %.not25, label %12, label %16

12:                                               ; preds = %5
  switch i8 %4, label %.loopexit [
    i8 45, label %13
    i8 43, label %13
  ]

13:                                               ; preds = %12, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 1
  %15 = load i8, ptr %14, align 1, !tbaa !5
  %.not26 = icmp eq i8 %15, 0
  br i1 %.not26, label %.loopexit, label %16

16:                                               ; preds = %5, %13
  %17 = getelementptr inbounds i8, ptr %0, i64 1
  %.pr = load i8, ptr %17, align 1, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %3, %16
  %18 = phi i8 [ %.pr, %16 ], [ %4, %3 ]
  %.01738 = phi ptr [ %17, %16 ], [ %0, %3 ]
  %.not2830 = icmp eq i8 %18, 0
  br i1 %.not2830, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %19 = tail call ptr @__ctype_b_loc() #3
  %20 = load ptr, ptr %19, align 8, !tbaa !8
  br label %21

21:                                               ; preds = %.lr.ph, %30
  %22 = phi i8 [ %18, %.lr.ph ], [ %32, %30 ]
  %.11832 = phi ptr [ %.01738, %.lr.ph ], [ %31, %30 ]
  %.01931 = phi i32 [ 0, %.lr.ph ], [ %.120, %30 ]
  %23 = sext i8 %22 to i64
  %24 = getelementptr inbounds i16, ptr %20, i64 %23
  %25 = load i16, ptr %24, align 2, !tbaa !10
  %26 = and i16 %25, 2048
  %.not29 = icmp eq i16 %26, 0
  br i1 %.not29, label %27, label %30

27:                                               ; preds = %21
  %28 = icmp ne i8 %22, 46
  %29 = icmp sgt i32 %.01931, 0
  %or.cond = select i1 %28, i1 true, i1 %29
  br i1 %or.cond, label %.loopexit, label %30

30:                                               ; preds = %27, %21
  %.120 = phi i32 [ %.01931, %21 ], [ 1, %27 ]
  %31 = getelementptr inbounds i8, ptr %.11832, i64 1
  %32 = load i8, ptr %31, align 1, !tbaa !5
  %.not28 = icmp eq i8 %32, 0
  br i1 %.not28, label %.loopexit, label %21, !llvm.loop !12

33:                                               ; preds = %2
  %34 = load ptr, ptr @stderr, align 8, !tbaa !8
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.6) #4
  br label %.loopexit

.loopexit:                                        ; preds = %27, %30, %12, %13, %.preheader, %33
  %.3 = phi i32 [ 0, %33 ], [ 1, %.preheader ], [ 0, %13 ], [ 0, %12 ], [ 0, %27 ], [ 1, %30 ]
  ret i32 %.3
}

attributes #0 = { 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 #1 = { mustprogress nofree nosync 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 #2 = { nofree 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 #3 = { nounwind willreturn memory(none) }
attributes #4 = { cold 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/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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