; LLVM IR from tezc/sc :: sc (sc)

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

; 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 uwtable
define dso_local i64 @sc_size_to_bytes(ptr noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 1024, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 1048576, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 1073741824, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 1099511627776, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 1125899906842624, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 1152921504606846976, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = call i64 @strlen(ptr noundef %20) #6
  %22 = getelementptr inbounds i8, ptr %19, i64 %21
  store ptr %22, ptr %13, align 8, !tbaa !5
  %23 = call ptr @__errno_location() #7
  store i32 0, ptr %23, align 4, !tbaa !11
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call i64 @strtoll(ptr noundef %24, ptr noundef %12, i32 noundef 10) #5
  store i64 %25, ptr %11, align 8, !tbaa !9
  %26 = call ptr @__errno_location() #7
  %27 = load i32, ptr %26, align 4, !tbaa !11
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %33, label %29

29:                                               ; preds = %1
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = icmp eq ptr %30, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %29, %1
  store i64 -1, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %129

34:                                               ; preds = %29
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = ptrtoint ptr %35 to i64
  %38 = ptrtoint ptr %36 to i64
  %39 = sub i64 %37, %38
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr %10, align 4, !tbaa !11
  %41 = load i32, ptr %10, align 4, !tbaa !11
  switch i32 %41, label %59 [
    i32 0, label %42
    i32 1, label %60
    i32 2, label %44
  ]

42:                                               ; preds = %34
  %43 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %43, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %129

44:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %45 = call ptr @__ctype_tolower_loc() #7
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 1
  %49 = load i8, ptr %48, align 1, !tbaa !13
  %50 = sext i8 %49 to i32
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %46, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !11
  store i32 %53, ptr %15, align 4, !tbaa !11
  %54 = load i32, ptr %15, align 4, !tbaa !11
  store i32 %54, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %55 = load i32, ptr %16, align 4, !tbaa !11
  %56 = icmp ne i32 %55, 98
  br i1 %56, label %57, label %58

57:                                               ; preds = %44
  store i64 -1, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %129

58:                                               ; preds = %44
  br label %60

59:                                               ; preds = %34
  store i64 -1, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %129

60:                                               ; preds = %58, %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %61 = call ptr @__ctype_tolower_loc() #7
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i64 0
  %65 = load i8, ptr %64, align 1, !tbaa !13
  %66 = sext i8 %65 to i32
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i32, ptr %62, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !11
  store i32 %69, ptr %17, align 4, !tbaa !11
  %70 = load i32, ptr %17, align 4, !tbaa !11
  store i32 %70, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  %71 = load i32, ptr %18, align 4, !tbaa !11
  switch i32 %71, label %126 [
    i32 98, label %127
    i32 107, label %72
    i32 109, label %81
    i32 103, label %90
    i32 116, label %99
    i32 112, label %108
    i32 101, label %117
  ]

72:                                               ; preds = %60
  %73 = load i64, ptr %11, align 8, !tbaa !9
  %74 = icmp sgt i64 %73, 9007199254740991
  br i1 %74, label %75, label %76

75:                                               ; preds = %72
  br label %79

76:                                               ; preds = %72
  %77 = load i64, ptr %11, align 8, !tbaa !9
  %78 = mul nsw i64 %77, 1024
  br label %79

79:                                               ; preds = %76, %75
  %80 = phi i64 [ -1, %75 ], [ %78, %76 ]
  store i64 %80, ptr %11, align 8, !tbaa !9
  br label %127

81:                                               ; preds = %60
  %82 = load i64, ptr %11, align 8, !tbaa !9
  %83 = icmp sgt i64 %82, 8796093022207
  br i1 %83, label %84, label %85

84:                                               ; preds = %81
  br label %88

85:                                               ; preds = %81
  %86 = load i64, ptr %11, align 8, !tbaa !9
  %87 = mul nsw i64 %86, 1048576
  br label %88

88:                                               ; preds = %85, %84
  %89 = phi i64 [ -1, %84 ], [ %87, %85 ]
  store i64 %89, ptr %11, align 8, !tbaa !9
  br label %127

90:                                               ; preds = %60
  %91 = load i64, ptr %11, align 8, !tbaa !9
  %92 = icmp sgt i64 %91, 8589934591
  br i1 %92, label %93, label %94

93:                                               ; preds = %90
  br label %97

94:                                               ; preds = %90
  %95 = load i64, ptr %11, align 8, !tbaa !9
  %96 = mul nsw i64 %95, 1073741824
  br label %97

97:                                               ; preds = %94, %93
  %98 = phi i64 [ -1, %93 ], [ %96, %94 ]
  store i64 %98, ptr %11, align 8, !tbaa !9
  br label %127

99:                                               ; preds = %60
  %100 = load i64, ptr %11, align 8, !tbaa !9
  %101 = icmp sgt i64 %100, 8388607
  br i1 %101, label %102, label %103

102:                                              ; preds = %99
  br label %106

103:                                              ; preds = %99
  %104 = load i64, ptr %11, align 8, !tbaa !9
  %105 = mul nsw i64 %104, 1099511627776
  br label %106

106:                                              ; preds = %103, %102
  %107 = phi i64 [ -1, %102 ], [ %105, %103 ]
  store i64 %107, ptr %11, align 8, !tbaa !9
  br label %127

108:                                              ; preds = %60
  %109 = load i64, ptr %11, align 8, !tbaa !9
  %110 = icmp sgt i64 %109, 8191
  br i1 %110, label %111, label %112

111:                                              ; preds = %108
  br label %115

112:                                              ; preds = %108
  %113 = load i64, ptr %11, align 8, !tbaa !9
  %114 = mul nsw i64 %113, 1125899906842624
  br label %115

115:                                              ; preds = %112, %111
  %116 = phi i64 [ -1, %111 ], [ %114, %112 ]
  store i64 %116, ptr %11, align 8, !tbaa !9
  br label %127

117:                                              ; preds = %60
  %118 = load i64, ptr %11, align 8, !tbaa !9
  %119 = icmp sgt i64 %118, 7
  br i1 %119, label %120, label %121

120:                                              ; preds = %117
  br label %124

121:                                              ; preds = %117
  %122 = load i64, ptr %11, align 8, !tbaa !9
  %123 = mul nsw i64 %122, 1152921504606846976
  br label %124

124:                                              ; preds = %121, %120
  %125 = phi i64 [ -1, %120 ], [ %123, %121 ]
  store i64 %125, ptr %11, align 8, !tbaa !9
  br label %127

126:                                              ; preds = %60
  store i64 -1, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %129

127:                                              ; preds = %124, %115, %106, %97, %88, %79, %60
  %128 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %128, ptr %2, align 8
  store i32 1, ptr %14, align 4
  br label %129

129:                                              ; preds = %127, %126, %59, %57, %42, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %130 = load i64, ptr %2, align 8
  ret i64 %130
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

; Function Attrs: nounwind
declare i64 @strtoll(ptr noundef, ptr noundef, i32 noundef) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}


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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i64 @sc_size_to_bytes(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %3 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #6
  %4 = getelementptr inbounds i8, ptr %0, i64 %3
  %5 = tail call ptr @__errno_location() #7
  store i32 0, ptr %5, align 4, !tbaa !5
  %6 = call i64 @strtoll(ptr noundef %0, ptr noundef nonnull %2, i32 noundef 10) #5
  %7 = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %56

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !9
  %10 = icmp eq ptr %9, %0
  br i1 %10, label %56, label %11

11:                                               ; preds = %8
  %12 = ptrtoint ptr %4 to i64
  %13 = ptrtoint ptr %9 to i64
  %14 = sub i64 %12, %13
  %15 = trunc i64 %14 to i32
  switch i32 %15, label %24 [
    i32 0, label %56
    i32 1, label %._crit_edge
    i32 2, label %16
  ]

._crit_edge:                                      ; preds = %11
  %.pre = tail call ptr @__ctype_tolower_loc() #7
  br label %25

16:                                               ; preds = %11
  %17 = tail call ptr @__ctype_tolower_loc() #7
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %9, i64 1
  %20 = load i8, ptr %19, align 1, !tbaa !11
  %21 = sext i8 %20 to i64
  %22 = getelementptr inbounds i32, ptr %18, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %.not26 = icmp eq i32 %23, 98
  br i1 %.not26, label %25, label %56

24:                                               ; preds = %11
  br label %56

25:                                               ; preds = %._crit_edge, %16
  %.pre-phi = phi ptr [ %.pre, %._crit_edge ], [ %17, %16 ]
  %26 = load ptr, ptr %.pre-phi, align 8, !tbaa !9
  %27 = load i8, ptr %9, align 1, !tbaa !11
  %28 = sext i8 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  switch i32 %30, label %56 [
    i32 98, label %55
    i32 107, label %31
    i32 109, label %35
    i32 103, label %39
    i32 116, label %43
    i32 112, label %47
    i32 101, label %51
  ]

31:                                               ; preds = %25
  %32 = icmp sgt i64 %6, 9007199254740991
  %33 = shl nsw i64 %6, 10
  %34 = select i1 %32, i64 -1, i64 %33
  br label %56

35:                                               ; preds = %25
  %36 = icmp sgt i64 %6, 8796093022207
  %37 = shl nsw i64 %6, 20
  %38 = select i1 %36, i64 -1, i64 %37
  br label %56

39:                                               ; preds = %25
  %40 = icmp sgt i64 %6, 8589934591
  %41 = shl nsw i64 %6, 30
  %42 = select i1 %40, i64 -1, i64 %41
  br label %56

43:                                               ; preds = %25
  %44 = icmp sgt i64 %6, 8388607
  %45 = shl nsw i64 %6, 40
  %46 = select i1 %44, i64 -1, i64 %45
  br label %56

47:                                               ; preds = %25
  %48 = icmp sgt i64 %6, 8191
  %49 = shl nsw i64 %6, 50
  %50 = select i1 %48, i64 -1, i64 %49
  br label %56

51:                                               ; preds = %25
  %52 = icmp sgt i64 %6, 7
  %53 = shl nsw i64 %6, 60
  %54 = select i1 %52, i64 -1, i64 %53
  br label %56

55:                                               ; preds = %25
  br label %56

56:                                               ; preds = %31, %35, %39, %43, %47, %51, %25, %16, %11, %1, %8, %55, %24
  %.0 = phi i64 [ -1, %24 ], [ -1, %8 ], [ -1, %1 ], [ %6, %11 ], [ -1, %16 ], [ -1, %25 ], [ %54, %51 ], [ %50, %47 ], [ %46, %43 ], [ %42, %39 ], [ %38, %35 ], [ %34, %31 ], [ %6, %55 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  ret i64 %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtoll(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn 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 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn "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(read) }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass