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

; 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.stream = type { ptr, ptr, ptr, ptr }
%struct.app = type { ptr, ptr, ptr }
%struct.mec_mr3_info = type { i32, i32 }
%struct.mec_mr3_item_data = type { i32, ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [127 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1
@__PRETTY_FUNCTION__.mec_mr3_print = external hidden unnamed_addr constant [42 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @mec_mr3_print(ptr noundef %0, i64 noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca %struct.stream, align 8
  %7 = alloca %struct.app, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca %struct.mec_mr3_info, align 4
  %11 = alloca %struct.mec_mr3_item_data, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %155

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %23 = call ptr @create_app(ptr noundef %7, ptr noundef %6)
  store ptr %23, ptr %8, align 8, !tbaa !5
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i64, ptr %5, align 8, !tbaa !9
  call void @setup_buffer(ptr noundef %24, ptr noundef %25, i64 noundef %26)
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  store i8 1, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  %27 = getelementptr inbounds %struct.mec_mr3_item_data, ptr %11, i32 0, i32 0
  store i32 0, ptr %27, align 8, !tbaa !13
  %28 = getelementptr inbounds %struct.mec_mr3_item_data, ptr %11, i32 0, i32 2
  store i64 0, ptr %28, align 8, !tbaa !16
  %29 = getelementptr inbounds %struct.mec_mr3_item_data, ptr %11, i32 0, i32 1
  store ptr null, ptr %29, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  store i8 0, ptr %14, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #5
  store i8 0, ptr %15, align 1, !tbaa !19
  br label %30

30:                                               ; preds = %74, %22
  %31 = load i8, ptr %14, align 1, !tbaa !11, !range !20, !noundef !21
  %32 = trunc i8 %31 to i1
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %35 = trunc i8 %34 to i1
  br label %36

36:                                               ; preds = %33, %30
  %37 = phi i1 [ false, %30 ], [ %35, %33 ]
  br i1 %37, label %38, label %77

38:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = call i64 @fread_mirror(ptr noundef %16, i64 noundef 4, i64 noundef 1, ptr noundef %39)
  store i64 %40, ptr %13, align 8, !tbaa !9
  %41 = load i64, ptr %13, align 8, !tbaa !9
  %42 = icmp ne i64 %41, 1
  br i1 %42, label %46, label %43

43:                                               ; preds = %38
  %44 = load i32, ptr %16, align 4, !tbaa !18
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %43, %38
  store i8 0, ptr %9, align 1, !tbaa !11
  br label %47

47:                                               ; preds = %46, %43
  %48 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %64

50:                                               ; preds = %47
  %51 = load i32, ptr %16, align 4, !tbaa !18
  %52 = icmp ule i32 %51, 5
  br i1 %52, label %53, label %64

53:                                               ; preds = %50
  %54 = load i32, ptr %16, align 4, !tbaa !18
  store i32 %54, ptr %12, align 4, !tbaa !18
  store i8 1, ptr %14, align 1, !tbaa !11
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = call i64 @fread_mirror(ptr noundef %16, i64 noundef 4, i64 noundef 1, ptr noundef %55)
  store i64 %56, ptr %13, align 8, !tbaa !9
  %57 = load i64, ptr %13, align 8, !tbaa !9
  %58 = icmp ne i64 %57, 1
  br i1 %58, label %62, label %59

59:                                               ; preds = %53
  %60 = load i32, ptr %16, align 4, !tbaa !18
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %59, %53
  store i8 0, ptr %9, align 1, !tbaa !11
  br label %63

63:                                               ; preds = %62, %59
  br label %64

64:                                               ; preds = %63, %50, %47
  %65 = load i8, ptr %15, align 1, !tbaa !19
  %66 = add i8 %65, 1
  store i8 %66, ptr %15, align 1, !tbaa !19
  %67 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %74

69:                                               ; preds = %64
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = load i8, ptr %15, align 1, !tbaa !19
  %72 = load i32, ptr %16, align 4, !tbaa !18
  %73 = call zeroext i1 @read_group(ptr noundef %70, i8 noundef zeroext %71, i32 noundef %72, ptr noundef %10, ptr noundef %11)
  br label %74

74:                                               ; preds = %69, %64
  %75 = phi i1 [ false, %64 ], [ %73, %69 ]
  %76 = zext i1 %75 to i8
  store i8 %76, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %30, !llvm.loop !22

77:                                               ; preds = %36
  br label %78

78:                                               ; preds = %106, %77
  %79 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %80 = trunc i8 %79 to i1
  br i1 %80, label %81, label %85

81:                                               ; preds = %78
  %82 = load i32, ptr %12, align 4, !tbaa !18
  %83 = add i32 %82, -1
  store i32 %83, ptr %12, align 4, !tbaa !18
  %84 = icmp ne i32 %83, 0
  br label %85

85:                                               ; preds = %81, %78
  %86 = phi i1 [ false, %78 ], [ %84, %81 ]
  br i1 %86, label %87, label %109

87:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = call i64 @fread_mirror(ptr noundef %17, i64 noundef 4, i64 noundef 1, ptr noundef %88)
  store i64 %89, ptr %13, align 8, !tbaa !9
  %90 = load i64, ptr %13, align 8, !tbaa !9
  %91 = icmp ne i64 %90, 1
  br i1 %91, label %95, label %92

92:                                               ; preds = %87
  %93 = load i32, ptr %17, align 4, !tbaa !18
  %94 = icmp ule i32 %93, 5
  br i1 %94, label %95, label %96

95:                                               ; preds = %92, %87
  store i8 0, ptr %9, align 1, !tbaa !11
  br label %96

96:                                               ; preds = %95, %92
  %97 = load i8, ptr %15, align 1, !tbaa !19
  %98 = add i8 %97, 1
  store i8 %98, ptr %15, align 1, !tbaa !19
  %99 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %100 = trunc i8 %99 to i1
  br i1 %100, label %101, label %106

101:                                              ; preds = %96
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = load i8, ptr %15, align 1, !tbaa !19
  %104 = load i32, ptr %17, align 4, !tbaa !18
  %105 = call zeroext i1 @read_group(ptr noundef %102, i8 noundef zeroext %103, i32 noundef %104, ptr noundef %10, ptr noundef %11)
  br label %106

106:                                              ; preds = %101, %96
  %107 = phi i1 [ false, %96 ], [ %105, %101 ]
  %108 = zext i1 %107 to i8
  store i8 %108, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %78, !llvm.loop !24

109:                                              ; preds = %85
  %110 = getelementptr inbounds %struct.mec_mr3_item_data, ptr %11, i32 0, i32 1
  %111 = load ptr, ptr %110, align 8, !tbaa !17
  call void @free(ptr noundef %111) #5
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.app, ptr %112, i32 0, i32 1
  %114 = load ptr, ptr %113, align 8, !tbaa !25
  %115 = call i32 @iconv_close(ptr noundef %114)
  %116 = load ptr, ptr %8, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.app, ptr %116, i32 0, i32 2
  %118 = load ptr, ptr %117, align 8, !tbaa !27
  call void @free(ptr noundef %118) #5
  %119 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %120 = trunc i8 %119 to i1
  br i1 %120, label %122, label %121

121:                                              ; preds = %109
  store i1 false, ptr %3, align 1
  store i32 1, ptr %18, align 4
  br label %154

122:                                              ; preds = %109
  %123 = load ptr, ptr %8, align 8, !tbaa !5
  %124 = call zeroext i1 @write_trailer(ptr noundef %123)
  br i1 %124, label %126, label %125

125:                                              ; preds = %122
  store i1 false, ptr %3, align 1
  store i32 1, ptr %18, align 4
  br label %154

126:                                              ; preds = %122
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.app, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !28
  %130 = getelementptr inbounds %struct.stream, ptr %129, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !29
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.app, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !28
  %135 = getelementptr inbounds %struct.stream, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !31
  %137 = icmp ule ptr %131, %136
  br i1 %137, label %138, label %139

138:                                              ; preds = %126
  br label %140

139:                                              ; preds = %126
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 863, ptr noundef @__PRETTY_FUNCTION__.mec_mr3_print) #6
  unreachable

140:                                              ; preds = %138
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.app, ptr %141, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !28
  %144 = getelementptr inbounds %struct.stream, ptr %143, i32 0, i32 2
  %145 = load ptr, ptr %144, align 8, !tbaa !29
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.app, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !28
  %149 = getelementptr inbounds %struct.stream, ptr %148, i32 0, i32 1
  %150 = load ptr, ptr %149, align 8, !tbaa !31
  %151 = icmp ult ptr %145, %150
  br i1 %151, label %152, label %153

152:                                              ; preds = %140
  store i1 false, ptr %3, align 1
  store i32 1, ptr %18, align 4
  br label %154

153:                                              ; preds = %140
  store i1 true, ptr %3, align 1
  store i32 1, ptr %18, align 4
  br label %154

154:                                              ; preds = %153, %152, %125, %121
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #5
  br label %155

155:                                              ; preds = %154, %21
  %156 = load i1, ptr %3, align 1
  ret i1 %156
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @create_app(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @setup_buffer(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i64 @fread_mirror(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @read_group(ptr noundef, i8 noundef zeroext, i32 noundef, ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

declare i32 @iconv_close(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @write_trailer(ptr noundef) #1

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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, !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 = !{!"_Bool", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"mec_mr3_item_data", !15, i64 0, !6, i64 8, !10, i64 16}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !6, i64 8}
!18 = !{!15, !15, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!26, !6, i64 8}
!26 = !{!"app", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!26, !6, i64 16}
!28 = !{!26, !6, i64 0}
!29 = !{!30, !6, i64 16}
!30 = !{!"stream", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!31 = !{!30, !6, i64 8}


; 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.stream = type { ptr, ptr, ptr, ptr }
%struct.app = type { ptr, ptr, ptr }
%struct.mec_mr3_info = type { i32, i32 }
%struct.mec_mr3_item_data = type { i32, ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [127 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1
@__PRETTY_FUNCTION__.mec_mr3_print = external hidden unnamed_addr constant [42 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 @mec_mr3_print(ptr noundef %0, i64 noundef %1) local_unnamed_addr #1 {
  %3 = alloca %struct.stream, align 8
  %4 = alloca %struct.app, align 8
  %5 = alloca %struct.mec_mr3_info, align 4
  %6 = alloca %struct.mec_mr3_item_data, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %65, label %9

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %10 = call ptr @create_app(ptr noundef nonnull %4, ptr noundef nonnull %3)
  call void @setup_buffer(ptr noundef %10, ptr noundef nonnull %0, i64 noundef %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  store i32 0, ptr %6, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %6, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %11, i8 0, i64 16, i1 false)
  br label %12

.preheader:                                       ; preds = %27
  br i1 %29, label %.lr.ph, label %.critedge56

12:                                               ; preds = %9, %27
  %.063 = phi i8 [ 0, %9 ], [ %28, %27 ]
  %.03862 = phi i1 [ false, %9 ], [ %.139, %27 ]
  %.04061 = phi i32 [ 1, %9 ], [ %.141, %27 ]
  %.04260 = phi i8 [ 1, %9 ], [ %30, %27 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %13 = call i64 @fread_mirror(ptr noundef nonnull %7, i64 noundef 4, i64 noundef 1, ptr noundef %10)
  %14 = icmp ne i64 %13, 1
  %15 = load i32, ptr %7, align 4
  %16 = icmp eq i32 %15, 0
  %or.cond = select i1 %14, i1 true, i1 %16
  %spec.select = select i1 %or.cond, i8 0, i8 %.04260
  %17 = trunc nuw i8 %spec.select to i1
  %18 = icmp ult i32 %15, 6
  %or.cond3 = select i1 %17, i1 %18, i1 false
  br i1 %or.cond3, label %19, label %24

19:                                               ; preds = %12
  %20 = call i64 @fread_mirror(ptr noundef nonnull %7, i64 noundef 4, i64 noundef 1, ptr noundef %10)
  %21 = icmp ne i64 %20, 1
  %22 = load i32, ptr %7, align 4
  %23 = icmp eq i32 %22, 0
  %or.cond5 = select i1 %21, i1 true, i1 %23
  %spec.select54 = select i1 %or.cond5, i8 0, i8 %spec.select
  br label %24

24:                                               ; preds = %19, %12
  %25 = phi i32 [ %15, %12 ], [ %22, %19 ]
  %.244 = phi i8 [ %spec.select, %12 ], [ %spec.select54, %19 ]
  %.141 = phi i32 [ %.04061, %12 ], [ %15, %19 ]
  %.139 = phi i1 [ %.03862, %12 ], [ true, %19 ]
  %26 = trunc nuw i8 %.244 to i1
  br i1 %26, label %27, label %.preheader.thread

27:                                               ; preds = %24
  %28 = add i8 %.063, 1
  %29 = call zeroext i1 @read_group(ptr noundef %10, i8 noundef zeroext %28, i32 noundef %25, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %30 = zext i1 %29 to i8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %not. = xor i1 %.139, true
  %31 = select i1 %not., i1 %29, i1 false
  br i1 %31, label %12, label %.preheader, !llvm.loop !12

.preheader.thread:                                ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  br label %.critedge56

.lr.ph:                                           ; preds = %.preheader, %38
  %.166 = phi i8 [ %39, %38 ], [ %28, %.preheader ]
  %.265 = phi i32 [ %32, %38 ], [ %.141, %.preheader ]
  %32 = add i32 %.265, -1
  %.not52 = icmp eq i32 %32, 0
  br i1 %.not52, label %47, label %33

33:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %34 = call i64 @fread_mirror(ptr noundef nonnull %8, i64 noundef 4, i64 noundef 1, ptr noundef %10)
  %35 = icmp eq i64 %34, 1
  %36 = load i32, ptr %8, align 4
  %37 = icmp ugt i32 %36, 5
  %or.cond7.not = select i1 %35, i1 %37, i1 false
  br i1 %or.cond7.not, label %38, label %.thread69

.thread69:                                        ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %.critedge56

38:                                               ; preds = %33
  %39 = add i8 %.166, 1
  %40 = call zeroext i1 @read_group(ptr noundef %10, i8 noundef zeroext %39, i32 noundef %36, ptr noundef nonnull %5, ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br i1 %40, label %.lr.ph, label %.critedge56, !llvm.loop !14

.critedge56:                                      ; preds = %38, %.thread69, %.preheader.thread, %.preheader
  %41 = load ptr, ptr %11, align 8, !tbaa !15
  call void @free(ptr noundef %41) #6
  %42 = getelementptr inbounds i8, ptr %10, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  %44 = call i32 @iconv_close(ptr noundef %43) #6
  %45 = getelementptr inbounds i8, ptr %10, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  call void @free(ptr noundef %46) #6
  br label %64

47:                                               ; preds = %.lr.ph
  %48 = load ptr, ptr %11, align 8, !tbaa !15
  call void @free(ptr noundef %48) #6
  %49 = getelementptr inbounds i8, ptr %10, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !16
  %51 = call i32 @iconv_close(ptr noundef %50) #6
  %52 = getelementptr inbounds i8, ptr %10, i64 16
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  call void @free(ptr noundef %53) #6
  %54 = call zeroext i1 @write_trailer(ptr noundef %10)
  br i1 %54, label %55, label %64

55:                                               ; preds = %47
  %56 = load ptr, ptr %10, align 8, !tbaa !19
  %57 = getelementptr inbounds i8, ptr %56, i64 16
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = getelementptr inbounds i8, ptr %56, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  %.not53 = icmp ugt ptr %58, %60
  br i1 %.not53, label %61, label %62

61:                                               ; preds = %55
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 863, ptr noundef nonnull @__PRETTY_FUNCTION__.mec_mr3_print) #7
  unreachable

62:                                               ; preds = %55
  %63 = icmp uge ptr %58, %60
  br label %64

64:                                               ; preds = %62, %47, %.critedge56
  %.045 = phi i1 [ false, %.critedge56 ], [ false, %47 ], [ %63, %62 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br label %65

65:                                               ; preds = %2, %64
  %.146 = phi i1 [ %.045, %64 ], [ false, %2 ]
  ret i1 %.146
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @create_app(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @setup_buffer(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @fread_mirror(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @read_group(ptr noundef, i8 noundef zeroext, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

declare i32 @iconv_close(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @write_trailer(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { 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_item_data", !7, i64 0, !10, i64 8, !11, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!6, !10, i64 8}
!16 = !{!17, !10, i64 8}
!17 = !{!"app", !10, i64 0, !10, i64 8, !10, i64 16}
!18 = !{!17, !10, i64 16}
!19 = !{!17, !10, i64 0}
!20 = !{!21, !10, i64 16}
!21 = !{!"stream", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!22 = !{!21, !10, i64 8}


; Effective O3 passes: ADCEPass,AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass