; LLVM IR from vteromero/VTEnc :: tests/unit (bits_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"

@.str.47 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [55 x i8], align 1

declare i32 @printf(ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @test_bits_len_u64() #1 {
  %1 = alloca i32, align 4
  br label %2

2:                                                ; preds = %0
  %3 = call i32 @bits_len_u64(i64 noundef 0)
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %7, label %5

5:                                                ; preds = %2
  %6 = call i32 (ptr, ...) @printf(ptr noundef @.str.47)
  store i32 0, ptr %1, align 4
  br label %128

7:                                                ; preds = %2
  br label %8

8:                                                ; preds = %7
  br label %9

9:                                                ; preds = %8
  %10 = call i32 @bits_len_u64(i64 noundef 1)
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %14, label %12

12:                                               ; preds = %9
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.48)
  store i32 0, ptr %1, align 4
  br label %128

14:                                               ; preds = %9
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = call i32 @bits_len_u64(i64 noundef 50)
  %18 = icmp eq i32 %17, 6
  br i1 %18, label %21, label %19

19:                                               ; preds = %16
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.49)
  store i32 0, ptr %1, align 4
  br label %128

21:                                               ; preds = %16
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = call i32 @bits_len_u64(i64 noundef 100)
  %25 = icmp eq i32 %24, 7
  br i1 %25, label %28, label %26

26:                                               ; preds = %23
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.50)
  store i32 0, ptr %1, align 4
  br label %128

28:                                               ; preds = %23
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  %31 = call i32 @bits_len_u64(i64 noundef 255)
  %32 = icmp eq i32 %31, 8
  br i1 %32, label %35, label %33

33:                                               ; preds = %30
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.51)
  store i32 0, ptr %1, align 4
  br label %128

35:                                               ; preds = %30
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  %38 = call i32 @bits_len_u64(i64 noundef 256)
  %39 = icmp eq i32 %38, 9
  br i1 %39, label %42, label %40

40:                                               ; preds = %37
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.52)
  store i32 0, ptr %1, align 4
  br label %128

42:                                               ; preds = %37
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = call i32 @bits_len_u64(i64 noundef 10000)
  %46 = icmp eq i32 %45, 14
  br i1 %46, label %49, label %47

47:                                               ; preds = %44
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.53)
  store i32 0, ptr %1, align 4
  br label %128

49:                                               ; preds = %44
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  %52 = call i32 @bits_len_u64(i64 noundef 65535)
  %53 = icmp eq i32 %52, 16
  br i1 %53, label %56, label %54

54:                                               ; preds = %51
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.54)
  store i32 0, ptr %1, align 4
  br label %128

56:                                               ; preds = %51
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = call i32 @bits_len_u64(i64 noundef 65536)
  %60 = icmp eq i32 %59, 17
  br i1 %60, label %63, label %61

61:                                               ; preds = %58
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.55)
  store i32 0, ptr %1, align 4
  br label %128

63:                                               ; preds = %58
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  %66 = call i32 @bits_len_u64(i64 noundef 1000000)
  %67 = icmp eq i32 %66, 20
  br i1 %67, label %70, label %68

68:                                               ; preds = %65
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.56)
  store i32 0, ptr %1, align 4
  br label %128

70:                                               ; preds = %65
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  %73 = call i32 @bits_len_u64(i64 noundef 16777215)
  %74 = icmp eq i32 %73, 24
  br i1 %74, label %77, label %75

75:                                               ; preds = %72
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.57)
  store i32 0, ptr %1, align 4
  br label %128

77:                                               ; preds = %72
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78
  %80 = call i32 @bits_len_u64(i64 noundef 16777216)
  %81 = icmp eq i32 %80, 25
  br i1 %81, label %84, label %82

82:                                               ; preds = %79
  %83 = call i32 (ptr, ...) @printf(ptr noundef @.str.58)
  store i32 0, ptr %1, align 4
  br label %128

84:                                               ; preds = %79
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = call i32 @bits_len_u64(i64 noundef 1000000000)
  %88 = icmp eq i32 %87, 30
  br i1 %88, label %91, label %89

89:                                               ; preds = %86
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.59)
  store i32 0, ptr %1, align 4
  br label %128

91:                                               ; preds = %86
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  %94 = call i32 @bits_len_u64(i64 noundef 4294967295)
  %95 = icmp eq i32 %94, 32
  br i1 %95, label %98, label %96

96:                                               ; preds = %93
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.60)
  store i32 0, ptr %1, align 4
  br label %128

98:                                               ; preds = %93
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = call i32 @bits_len_u64(i64 noundef 1099511627775)
  %102 = icmp eq i32 %101, 40
  br i1 %102, label %105, label %103

103:                                              ; preds = %100
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.61)
  store i32 0, ptr %1, align 4
  br label %128

105:                                              ; preds = %100
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  %108 = call i32 @bits_len_u64(i64 noundef 281474976710655)
  %109 = icmp eq i32 %108, 48
  br i1 %109, label %112, label %110

110:                                              ; preds = %107
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.62)
  store i32 0, ptr %1, align 4
  br label %128

112:                                              ; preds = %107
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  %115 = call i32 @bits_len_u64(i64 noundef 72057594037927935)
  %116 = icmp eq i32 %115, 56
  br i1 %116, label %119, label %117

117:                                              ; preds = %114
  %118 = call i32 (ptr, ...) @printf(ptr noundef @.str.63)
  store i32 0, ptr %1, align 4
  br label %128

119:                                              ; preds = %114
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = call i32 @bits_len_u64(i64 noundef -1)
  %123 = icmp eq i32 %122, 64
  br i1 %123, label %126, label %124

124:                                              ; preds = %121
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.64)
  store i32 0, ptr %1, align 4
  br label %128

126:                                              ; preds = %121
  br label %127

127:                                              ; preds = %126
  store i32 1, ptr %1, align 4
  br label %128

128:                                              ; preds = %127, %124, %117, %110, %103, %96, %89, %82, %75, %68, %61, %54, %47, %40, %33, %26, %19, %12, %5
  %129 = load i32, ptr %1, align 4
  ret i32 %129
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @bits_len_u64(i64 noundef) #2

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 = { 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 #2 = { 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" }

!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)"}


; 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.47 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [55 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @test_bits_len_u64() local_unnamed_addr #1 {
  %1 = tail call i32 @bits_len_u64(i64 noundef 0)
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %3, label %.sink.split

3:                                                ; preds = %0
  %4 = tail call i32 @bits_len_u64(i64 noundef 1)
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %6, label %.sink.split

6:                                                ; preds = %3
  %7 = tail call i32 @bits_len_u64(i64 noundef 50)
  %8 = icmp eq i32 %7, 6
  br i1 %8, label %9, label %.sink.split

9:                                                ; preds = %6
  %10 = tail call i32 @bits_len_u64(i64 noundef 100)
  %11 = icmp eq i32 %10, 7
  br i1 %11, label %12, label %.sink.split

12:                                               ; preds = %9
  %13 = tail call i32 @bits_len_u64(i64 noundef 255)
  %14 = icmp eq i32 %13, 8
  br i1 %14, label %15, label %.sink.split

15:                                               ; preds = %12
  %16 = tail call i32 @bits_len_u64(i64 noundef 256)
  %17 = icmp eq i32 %16, 9
  br i1 %17, label %18, label %.sink.split

18:                                               ; preds = %15
  %19 = tail call i32 @bits_len_u64(i64 noundef 10000)
  %20 = icmp eq i32 %19, 14
  br i1 %20, label %21, label %.sink.split

21:                                               ; preds = %18
  %22 = tail call i32 @bits_len_u64(i64 noundef 65535)
  %23 = icmp eq i32 %22, 16
  br i1 %23, label %24, label %.sink.split

24:                                               ; preds = %21
  %25 = tail call i32 @bits_len_u64(i64 noundef 65536)
  %26 = icmp eq i32 %25, 17
  br i1 %26, label %27, label %.sink.split

27:                                               ; preds = %24
  %28 = tail call i32 @bits_len_u64(i64 noundef 1000000)
  %29 = icmp eq i32 %28, 20
  br i1 %29, label %30, label %.sink.split

30:                                               ; preds = %27
  %31 = tail call i32 @bits_len_u64(i64 noundef 16777215)
  %32 = icmp eq i32 %31, 24
  br i1 %32, label %33, label %.sink.split

33:                                               ; preds = %30
  %34 = tail call i32 @bits_len_u64(i64 noundef 16777216)
  %35 = icmp eq i32 %34, 25
  br i1 %35, label %36, label %.sink.split

36:                                               ; preds = %33
  %37 = tail call i32 @bits_len_u64(i64 noundef 1000000000)
  %38 = icmp eq i32 %37, 30
  br i1 %38, label %39, label %.sink.split

39:                                               ; preds = %36
  %40 = tail call i32 @bits_len_u64(i64 noundef 4294967295)
  %41 = icmp eq i32 %40, 32
  br i1 %41, label %42, label %.sink.split

42:                                               ; preds = %39
  %43 = tail call i32 @bits_len_u64(i64 noundef 1099511627775)
  %44 = icmp eq i32 %43, 40
  br i1 %44, label %45, label %.sink.split

45:                                               ; preds = %42
  %46 = tail call i32 @bits_len_u64(i64 noundef 281474976710655)
  %47 = icmp eq i32 %46, 48
  br i1 %47, label %48, label %.sink.split

48:                                               ; preds = %45
  %49 = tail call i32 @bits_len_u64(i64 noundef 72057594037927935)
  %50 = icmp eq i32 %49, 56
  br i1 %50, label %51, label %.sink.split

51:                                               ; preds = %48
  %52 = tail call i32 @bits_len_u64(i64 noundef -1)
  %53 = icmp eq i32 %52, 64
  br i1 %53, label %55, label %.sink.split

.sink.split:                                      ; preds = %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
  %.str.64.sink = phi ptr [ @.str.47, %0 ], [ @.str.48, %3 ], [ @.str.49, %6 ], [ @.str.50, %9 ], [ @.str.51, %12 ], [ @.str.52, %15 ], [ @.str.53, %18 ], [ @.str.54, %21 ], [ @.str.55, %24 ], [ @.str.56, %27 ], [ @.str.57, %30 ], [ @.str.58, %33 ], [ @.str.59, %36 ], [ @.str.60, %39 ], [ @.str.61, %42 ], [ @.str.62, %45 ], [ @.str.63, %48 ], [ @.str.64, %51 ]
  %54 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.64.sink)
  br label %55

55:                                               ; preds = %.sink.split, %51
  %.0 = phi i32 [ 1, %51 ], [ 0, %.sink.split ]
  ret i32 %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @bits_len_u64(i64 noundef) local_unnamed_addr #2

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 = { 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 #2 = { 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" }

!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)"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass