; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmext (mec_mr3_dict)

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

%struct.mec_mr3_dict = type { i8, i32, i32, ptr }

@dict = external hidden constant [796 x %struct.mec_mr3_dict], align 16
@.str.1 = external hidden unnamed_addr constant [129 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.check_mec_mr3_info = external hidden unnamed_addr constant [72 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; 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 zeroext i1 @check_mec_mr3_info(i8 noundef zeroext %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store i8 %0, ptr %4, align 1, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !8
  store i32 %2, ptr %6, align 4, !tbaa !8
  %11 = load i8, ptr %4, align 1, !tbaa !5
  %12 = zext i8 %11 to i32
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %14, label %19

14:                                               ; preds = %3
  %15 = load i8, ptr %4, align 1, !tbaa !5
  %16 = zext i8 %15 to i32
  %17 = icmp slt i32 %16, 9
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  br label %20

19:                                               ; preds = %14, %3
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 843, ptr noundef @__PRETTY_FUNCTION__.check_mec_mr3_info) #3
  unreachable

20:                                               ; preds = %18
  %21 = load i32, ptr %5, align 4, !tbaa !8
  %22 = and i32 %21, -1048576
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %20
  br label %26

25:                                               ; preds = %20
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 844, ptr noundef @__PRETTY_FUNCTION__.check_mec_mr3_info) #3
  unreachable

26:                                               ; preds = %24
  %27 = load i32, ptr %6, align 4, !tbaa !8
  %28 = and i32 %27, 255
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  br label %32

31:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 845, ptr noundef @__PRETTY_FUNCTION__.check_mec_mr3_info) #3
  unreachable

32:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %33 = load i32, ptr %6, align 4, !tbaa !8
  %34 = lshr i32 %33, 24
  store i32 %34, ptr %7, align 4, !tbaa !8
  %35 = load i32, ptr %7, align 4, !tbaa !8
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %40, label %37

37:                                               ; preds = %32
  %38 = load i32, ptr %7, align 4, !tbaa !8
  %39 = icmp eq i32 %38, 255
  br i1 %39, label %40, label %41

40:                                               ; preds = %37, %32
  br label %42

41:                                               ; preds = %37
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 847, ptr noundef @__PRETTY_FUNCTION__.check_mec_mr3_info) #3
  unreachable

42:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 0, ptr %8, align 1, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %43

43:                                               ; preds = %74, %42
  %44 = load i32, ptr %9, align 4, !tbaa !8
  %45 = icmp ult i32 %44, 796
  br i1 %45, label %47, label %46

46:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %77

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %48 = load i32, ptr %9, align 4, !tbaa !8
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds %struct.mec_mr3_dict, ptr @dict, i64 %49
  store ptr %50, ptr %10, align 8, !tbaa !12
  %51 = load i8, ptr %4, align 1, !tbaa !5
  %52 = zext i8 %51 to i32
  %53 = load ptr, ptr %10, align 8, !tbaa !12
  %54 = getelementptr inbounds %struct.mec_mr3_dict, ptr %53, i32 0, i32 0
  %55 = load i8, ptr %54, align 8, !tbaa !14
  %56 = zext i8 %55 to i32
  %57 = icmp eq i32 %52, %56
  br i1 %57, label %58, label %73

58:                                               ; preds = %47
  %59 = load i32, ptr %5, align 4, !tbaa !8
  %60 = load ptr, ptr %10, align 8, !tbaa !12
  %61 = getelementptr inbounds %struct.mec_mr3_dict, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !16
  %63 = icmp eq i32 %59, %62
  br i1 %63, label %64, label %73

64:                                               ; preds = %58
  %65 = load ptr, ptr %10, align 8, !tbaa !12
  %66 = getelementptr inbounds %struct.mec_mr3_dict, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8, !tbaa !17
  %68 = load i32, ptr %6, align 4, !tbaa !8
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %70, label %71

70:                                               ; preds = %64
  br label %72

71:                                               ; preds = %64
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 852, ptr noundef @__PRETTY_FUNCTION__.check_mec_mr3_info) #3
  unreachable

72:                                               ; preds = %70
  store i8 1, ptr %8, align 1, !tbaa !10
  br label %73

73:                                               ; preds = %72, %58, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %9, align 4, !tbaa !8
  %76 = add i32 %75, 1
  store i32 %76, ptr %9, align 4, !tbaa !8
  br label %43, !llvm.loop !18

77:                                               ; preds = %46
  %78 = load i8, ptr %8, align 1, !tbaa !10, !range !20, !noundef !21
  %79 = trunc i8 %78 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i1 %79
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { noreturn nounwind }
attributes #4 = { 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 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"_Bool", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !6, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"mec_mr3_dict", !6, i64 0, !9, i64 4, !9, i64 8, !13, i64 16}
!16 = !{!15, !9, i64 4}
!17 = !{!15, !9, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{i8 0, i8 2}
!21 = !{}


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

%struct.mec_mr3_dict = type { i8, i32, i32, ptr }

@dict = external hidden local_unnamed_addr constant [796 x %struct.mec_mr3_dict], align 16
@.str.1 = external hidden unnamed_addr constant [129 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.check_mec_mr3_info = external hidden unnamed_addr constant [72 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @check_mec_mr3_info(i8 noundef zeroext %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = add i8 %0, -1
  %or.cond = icmp ult i8 %4, 8
  br i1 %or.cond, label %6, label %5

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 843, ptr noundef nonnull @__PRETTY_FUNCTION__.check_mec_mr3_info) #2
  unreachable

6:                                                ; preds = %3
  %7 = icmp ult i32 %1, 1048576
  br i1 %7, label %9, label %8

8:                                                ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 844, ptr noundef nonnull @__PRETTY_FUNCTION__.check_mec_mr3_info) #2
  unreachable

9:                                                ; preds = %6
  %10 = and i32 %2, 255
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 845, ptr noundef nonnull @__PRETTY_FUNCTION__.check_mec_mr3_info) #2
  unreachable

13:                                               ; preds = %9
  %14 = add i32 %2, 16777216
  %or.cond4 = icmp ult i32 %14, 33554432
  br i1 %or.cond4, label %.preheader, label %15

15:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 847, ptr noundef nonnull @__PRETTY_FUNCTION__.check_mec_mr3_info) #2
  unreachable

16:                                               ; preds = %40
  ret i1 %.1.1

.preheader:                                       ; preds = %13, %40
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %40 ], [ 0, %13 ]
  %.024 = phi i1 [ %.1.1, %40 ], [ false, %13 ]
  %17 = getelementptr inbounds %struct.mec_mr3_dict, ptr @dict, i64 %indvars.iv
  %18 = load i8, ptr %17, align 16, !tbaa !5
  %19 = icmp eq i8 %18, %0
  br i1 %19, label %20, label %.preheader.1

20:                                               ; preds = %.preheader
  %21 = getelementptr inbounds i8, ptr %17, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = icmp eq i32 %22, %1
  br i1 %23, label %24, label %.preheader.1

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %17, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !12
  %27 = icmp eq i32 %26, %2
  br i1 %27, label %.preheader.1, label %28

28:                                               ; preds = %36, %24
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 852, ptr noundef nonnull @__PRETTY_FUNCTION__.check_mec_mr3_info) #2
  unreachable

.preheader.1:                                     ; preds = %24, %20, %.preheader
  %.1 = phi i1 [ %.024, %20 ], [ %.024, %.preheader ], [ true, %24 ]
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %29 = getelementptr inbounds %struct.mec_mr3_dict, ptr @dict, i64 %indvars.iv.next
  %30 = load i8, ptr %29, align 8, !tbaa !5
  %31 = icmp eq i8 %30, %0
  br i1 %31, label %32, label %40

32:                                               ; preds = %.preheader.1
  %33 = getelementptr inbounds i8, ptr %29, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = icmp eq i32 %34, %1
  br i1 %35, label %36, label %40

36:                                               ; preds = %32
  %37 = getelementptr inbounds i8, ptr %29, i64 8
  %38 = load i32, ptr %37, align 16, !tbaa !12
  %39 = icmp eq i32 %38, %2
  br i1 %39, label %40, label %28

40:                                               ; preds = %36, %32, %.preheader.1
  %.1.1 = phi i1 [ %.1, %32 ], [ %.1, %.preheader.1 ], [ true, %36 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 796
  br i1 %exitcond.not.1, label %16, label %.preheader, !llvm.loop !13
}

attributes #0 = { 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 #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 = { noreturn 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, !7, i64 0}
!6 = !{!"mec_mr3_dict", !7, i64 0, !9, i64 4, !9, i64 8, !10, i64 16}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!6, !9, i64 4}
!12 = !{!6, !9, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass