; LLVM IR from venumb/ZSPACE :: cpp/depends/lodePNG/lodepng_unittest.ll (Z10fromBase64i)

; 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: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z10fromBase64i(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp sge i32 %4, 65
  br i1 %5, label %6, label %12

6:                                                ; preds = %1
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = icmp sle i32 %7, 90
  br i1 %8, label %9, label %12

9:                                                ; preds = %6
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = sub nsw i32 %10, 65
  store i32 %11, ptr %2, align 4
  br label %41

12:                                               ; preds = %6, %1
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = icmp sge i32 %13, 97
  br i1 %14, label %15, label %22

15:                                               ; preds = %12
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = icmp sle i32 %16, 122
  br i1 %17, label %18, label %22

18:                                               ; preds = %15
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sub nsw i32 %19, 97
  %21 = add nsw i32 %20, 26
  store i32 %21, ptr %2, align 4
  br label %41

22:                                               ; preds = %15, %12
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = icmp sge i32 %23, 48
  br i1 %24, label %25, label %32

25:                                               ; preds = %22
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = icmp sle i32 %26, 57
  br i1 %27, label %28, label %32

28:                                               ; preds = %25
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sub nsw i32 %29, 48
  %31 = add nsw i32 %30, 52
  store i32 %31, ptr %2, align 4
  br label %41

32:                                               ; preds = %25, %22
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = icmp eq i32 %33, 43
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  store i32 62, ptr %2, align 4
  br label %41

36:                                               ; preds = %32
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = icmp eq i32 %37, 47
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 63, ptr %2, align 4
  br label %41

40:                                               ; preds = %36
  store i32 0, ptr %2, align 4
  br label %41

41:                                               ; preds = %40, %39, %35, %28, %18, %9
  %42 = load i32, ptr %2, align 4
  ret i32 %42
}

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

!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++ TBAA"}


; 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 nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef range(i32 0, 64) i32 @_Z10fromBase64i(i32 noundef %0) local_unnamed_addr #0 {
  %2 = add i32 %0, -65
  %or.cond = icmp ult i32 %2, 26
  br i1 %or.cond, label %12, label %3

3:                                                ; preds = %1
  %4 = add i32 %0, -97
  %or.cond3 = icmp ult i32 %4, 26
  br i1 %or.cond3, label %5, label %7

5:                                                ; preds = %3
  %6 = add nsw i32 %0, -71
  br label %12

7:                                                ; preds = %3
  %8 = add i32 %0, -48
  %or.cond5 = icmp ult i32 %8, 10
  br i1 %or.cond5, label %9, label %11

9:                                                ; preds = %7
  %10 = add nuw nsw i32 %0, 4
  br label %12

11:                                               ; preds = %7
  %switch.selectcmp = icmp eq i32 %0, 47
  %switch.select = select i1 %switch.selectcmp, i32 63, i32 0
  %switch.selectcmp18 = icmp eq i32 %0, 43
  %switch.select19 = select i1 %switch.selectcmp18, i32 62, i32 %switch.select
  br label %12

12:                                               ; preds = %1, %11, %9, %5
  %.0 = phi i32 [ %6, %5 ], [ %10, %9 ], [ %switch.select19, %11 ], [ %2, %1 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass