; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/MINC/src/libminc/nifti (nifti1_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.nifti_global_options = type { i32, i32, i32 }
%struct.nifti_image = type { i32, i32, i32, i32, i32, i32, i32, i32, [8 x i32], i64, i32, i32, float, float, float, float, float, float, float, [8 x float], float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, %struct.mat44, %struct.mat44, %struct.mat44, %struct.mat44, float, i32, i32, i32, i32, float, float, float, [16 x i8], [80 x i8], [24 x i8], ptr, ptr, i32, i32, i32, ptr, i32, ptr, i32 }
%struct.mat44 = type { [4 x [4 x float]] }
%struct.nifti_brick_list = type { i32, i64, ptr }

@stderr = external global ptr, align 8
@g_opts = external hidden global %struct.nifti_global_options, align 4
@.str.213 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.214 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.215 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.216 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.217 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.218 = external hidden unnamed_addr constant [49 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_short_order() #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @nifti_write_buffer(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @nifti_write_all_data(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %68, label %13

13:                                               ; preds = %3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.nifti_image, ptr %14, i32 0, i32 60
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %13
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.213) #3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %157

21:                                               ; preds = %13
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.nifti_image, ptr %23, i32 0, i32 60
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.nifti_image, ptr %26, i32 0, i32 10
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %29 = sext i32 %28 to i64
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.nifti_image, ptr %30, i32 0, i32 9
  %32 = load i64, ptr %31, align 8, !tbaa !16
  %33 = mul i64 %29, %32
  %34 = call i64 @nifti_write_buffer(ptr noundef %22, ptr noundef %25, i64 noundef %33)
  store i64 %34, ptr %8, align 8, !tbaa !17
  %35 = load i64, ptr %8, align 8, !tbaa !17
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.nifti_image, ptr %36, i32 0, i32 10
  %38 = load i32, ptr %37, align 8, !tbaa !15
  %39 = sext i32 %38 to i64
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.nifti_image, ptr %40, i32 0, i32 9
  %42 = load i64, ptr %41, align 8, !tbaa !16
  %43 = mul i64 %39, %42
  %44 = icmp ult i64 %35, %43
  br i1 %44, label %45, label %59

45:                                               ; preds = %21
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = load i64, ptr %8, align 8, !tbaa !17
  %48 = trunc i64 %47 to i32
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.nifti_image, ptr %49, i32 0, i32 10
  %51 = load i32, ptr %50, align 8, !tbaa !15
  %52 = sext i32 %51 to i64
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.nifti_image, ptr %53, i32 0, i32 9
  %55 = load i64, ptr %54, align 8, !tbaa !16
  %56 = mul i64 %52, %55
  %57 = trunc i64 %56 to i32
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.214, i32 noundef %48, i32 noundef %57) #3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %157

59:                                               ; preds = %21
  %60 = load i32, ptr @g_opts, align 4, !tbaa !18
  %61 = icmp sgt i32 %60, 1
  br i1 %61, label %62, label %67

62:                                               ; preds = %59
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = load i64, ptr %8, align 8, !tbaa !17
  %65 = trunc i64 %64 to i32
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.215, i32 noundef %65) #3
  br label %67

67:                                               ; preds = %62, %59
  br label %153

68:                                               ; preds = %3
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.nifti_brick_list, ptr %69, i32 0, i32 2
  %71 = load ptr, ptr %70, align 8, !tbaa !20
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %83

73:                                               ; preds = %68
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.nifti_brick_list, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !22
  %77 = icmp sle i32 %76, 0
  br i1 %77, label %83, label %78

78:                                               ; preds = %73
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.nifti_brick_list, ptr %79, i32 0, i32 1
  %81 = load i64, ptr %80, align 8, !tbaa !23
  %82 = icmp ule i64 %81, 0
  br i1 %82, label %83, label %96

83:                                               ; preds = %78, %73, %68
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.nifti_brick_list, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.nifti_brick_list, ptr %88, i32 0, i32 0
  %90 = load i32, ptr %89, align 8, !tbaa !22
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.nifti_brick_list, ptr %91, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !23
  %94 = trunc i64 %93 to i32
  %95 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.216, ptr noundef %87, i32 noundef %90, i32 noundef %94) #3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %157

96:                                               ; preds = %78
  store i32 0, ptr %9, align 4, !tbaa !24
  br label %97

97:                                               ; preds = %136, %96
  %98 = load i32, ptr %9, align 4, !tbaa !24
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.nifti_brick_list, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !22
  %102 = icmp slt i32 %98, %101
  br i1 %102, label %103, label %139

103:                                              ; preds = %97
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.nifti_brick_list, ptr %105, i32 0, i32 2
  %107 = load ptr, ptr %106, align 8, !tbaa !20
  %108 = load i32, ptr %9, align 4, !tbaa !24
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds ptr, ptr %107, i64 %109
  %111 = load ptr, ptr %110, align 8, !tbaa !5
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.nifti_brick_list, ptr %112, i32 0, i32 1
  %114 = load i64, ptr %113, align 8, !tbaa !23
  %115 = call i64 @nifti_write_buffer(ptr noundef %104, ptr noundef %111, i64 noundef %114)
  store i64 %115, ptr %8, align 8, !tbaa !17
  %116 = load i64, ptr %8, align 8, !tbaa !17
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.nifti_brick_list, ptr %117, i32 0, i32 1
  %119 = load i64, ptr %118, align 8, !tbaa !23
  %120 = icmp ult i64 %116, %119
  br i1 %120, label %121, label %135

121:                                              ; preds = %103
  %122 = load ptr, ptr @stderr, align 8, !tbaa !5
  %123 = load i64, ptr %8, align 8, !tbaa !17
  %124 = trunc i64 %123 to i32
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.nifti_brick_list, ptr %125, i32 0, i32 1
  %127 = load i64, ptr %126, align 8, !tbaa !23
  %128 = trunc i64 %127 to i32
  %129 = load i32, ptr %9, align 4, !tbaa !24
  %130 = add nsw i32 %129, 1
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.nifti_brick_list, ptr %131, i32 0, i32 0
  %133 = load i32, ptr %132, align 8, !tbaa !22
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.217, i32 noundef %124, i32 noundef %128, i32 noundef %130, i32 noundef %133) #3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %157

135:                                              ; preds = %103
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %9, align 4, !tbaa !24
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %9, align 4, !tbaa !24
  br label %97, !llvm.loop !25

139:                                              ; preds = %97
  %140 = load i32, ptr @g_opts, align 4, !tbaa !18
  %141 = icmp sgt i32 %140, 1
  br i1 %141, label %142, label %152

142:                                              ; preds = %139
  %143 = load ptr, ptr @stderr, align 8, !tbaa !5
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.nifti_brick_list, ptr %144, i32 0, i32 0
  %146 = load i32, ptr %145, align 8, !tbaa !22
  %147 = load ptr, ptr %7, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.nifti_brick_list, ptr %147, i32 0, i32 1
  %149 = load i64, ptr %148, align 8, !tbaa !23
  %150 = trunc i64 %149 to i32
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %143, ptr noundef @.str.218, i32 noundef %146, i32 noundef %150) #3
  br label %152

152:                                              ; preds = %142, %139
  br label %153

153:                                              ; preds = %152, %67
  %154 = call i32 @nifti_short_order()
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.nifti_image, ptr %155, i32 0, i32 59
  store i32 %154, ptr %156, align 8, !tbaa !27
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %157

157:                                              ; preds = %153, %121, %83, %45, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %158 = load i32, ptr %4, align 4
  ret i32 %158
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !6, i64 664}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !7, i64 32, !12, i64 64, !11, i64 72, !11, i64 76, !13, i64 80, !13, i64 84, !13, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !13, i64 104, !7, i64 108, !13, i64 140, !13, i64 144, !13, i64 148, !13, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !13, i64 188, !13, i64 192, !13, i64 196, !13, i64 200, !13, i64 204, !13, i64 208, !13, i64 212, !13, i64 216, !14, i64 220, !14, i64 284, !14, i64 348, !14, i64 412, !13, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !13, i64 496, !13, i64 500, !13, i64 504, !7, i64 508, !7, i64 524, !7, i64 604, !6, i64 632, !6, i64 640, !11, i64 648, !11, i64 652, !11, i64 656, !6, i64 664, !11, i64 672, !6, i64 680, !11, i64 688}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"", !7, i64 0}
!15 = !{!10, !11, i64 72}
!16 = !{!10, !12, i64 64}
!17 = !{!12, !12, i64 0}
!18 = !{!19, !11, i64 0}
!19 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!20 = !{!21, !6, i64 16}
!21 = !{!"", !11, i64 0, !12, i64 8, !6, i64 16}
!22 = !{!21, !11, i64 0}
!23 = !{!21, !12, i64 8}
!24 = !{!11, !11, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!10, !11, i64 656}


; 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.nifti_global_options = type { i32, i32, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@g_opts = external hidden local_unnamed_addr global %struct.nifti_global_options, align 4
@.str.213 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.214 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.215 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.216 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.217 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.218 = external hidden unnamed_addr constant [49 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_short_order() local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @nifti_write_all_data(ptr noundef %0, ptr nocapture noundef %1, ptr noundef readonly %2) local_unnamed_addr #1 {
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %4, label %36

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %1, i64 664
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %11

8:                                                ; preds = %4
  %9 = load ptr, ptr @stderr, align 8, !tbaa !14
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.213) #2
  br label %78

11:                                               ; preds = %4
  %12 = getelementptr inbounds i8, ptr %1, i64 72
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i8, ptr %1, i64 64
  %16 = load i64, ptr %15, align 8, !tbaa !16
  %17 = mul i64 %16, %14
  %18 = tail call i64 @nifti_write_buffer(ptr noundef %0, ptr noundef nonnull %6, i64 noundef %17)
  %19 = load i32, ptr %12, align 8, !tbaa !15
  %20 = sext i32 %19 to i64
  %21 = load i64, ptr %15, align 8, !tbaa !16
  %22 = mul i64 %21, %20
  %23 = icmp ult i64 %18, %22
  br i1 %23, label %24, label %29

24:                                               ; preds = %11
  %25 = load ptr, ptr @stderr, align 8, !tbaa !14
  %26 = trunc i64 %18 to i32
  %27 = trunc i64 %22 to i32
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.214, i32 noundef %26, i32 noundef %27) #2
  br label %78

29:                                               ; preds = %11
  %30 = load i32, ptr @g_opts, align 4, !tbaa !17
  %31 = icmp sgt i32 %30, 1
  br i1 %31, label %32, label %75

32:                                               ; preds = %29
  %33 = load ptr, ptr @stderr, align 8, !tbaa !14
  %34 = trunc i64 %18 to i32
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.215, i32 noundef %34) #2
  br label %75

36:                                               ; preds = %3
  %37 = getelementptr inbounds i8, ptr %2, i64 16
  %38 = load ptr, ptr %37, align 8, !tbaa !19
  %.not43 = icmp eq ptr %38, null
  %.pre = load i32, ptr %2, align 8, !tbaa !21
  %39 = icmp slt i32 %.pre, 1
  %or.cond = select i1 %.not43, i1 true, i1 %39
  br i1 %or.cond, label %44, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %2, i64 8
  %42 = load i64, ptr %41, align 8, !tbaa !22
  %43 = icmp eq i64 %42, 0
  br i1 %43, label %44, label %.lr.ph

44:                                               ; preds = %40, %36
  %45 = load ptr, ptr @stderr, align 8, !tbaa !14
  %46 = getelementptr inbounds i8, ptr %2, i64 8
  %47 = load i64, ptr %46, align 8, !tbaa !22
  %48 = trunc i64 %47 to i32
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.216, ptr noundef %38, i32 noundef %.pre, i32 noundef %48) #2
  br label %78

.lr.ph:                                           ; preds = %40, %65
  %50 = phi i64 [ %55, %65 ], [ %42, %40 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %65 ], [ 0, %40 ]
  %51 = load ptr, ptr %37, align 8, !tbaa !19
  %52 = getelementptr inbounds ptr, ptr %51, i64 %indvars.iv
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = tail call i64 @nifti_write_buffer(ptr noundef %0, ptr noundef %53, i64 noundef %50)
  %55 = load i64, ptr %41, align 8, !tbaa !22
  %56 = icmp ult i64 %54, %55
  br i1 %56, label %57, label %65

57:                                               ; preds = %.lr.ph
  %58 = trunc nuw nsw i64 %indvars.iv to i32
  %59 = load ptr, ptr @stderr, align 8, !tbaa !14
  %60 = trunc i64 %54 to i32
  %61 = trunc i64 %55 to i32
  %62 = add nuw nsw i32 %58, 1
  %63 = load i32, ptr %2, align 8, !tbaa !21
  %64 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.217, i32 noundef %60, i32 noundef %61, i32 noundef %62, i32 noundef %63) #2
  br label %78

65:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %66 = load i32, ptr %2, align 8, !tbaa !21
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next, %67
  br i1 %68, label %.lr.ph, label %._crit_edge, !llvm.loop !23

._crit_edge:                                      ; preds = %65
  %69 = load i32, ptr @g_opts, align 4, !tbaa !17
  %70 = icmp sgt i32 %69, 1
  br i1 %70, label %71, label %75

71:                                               ; preds = %._crit_edge
  %72 = trunc i64 %55 to i32
  %73 = load ptr, ptr @stderr, align 8, !tbaa !14
  %74 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef nonnull @.str.218, i32 noundef %66, i32 noundef %72) #2
  br label %75

75:                                               ; preds = %._crit_edge, %71, %29, %32
  %76 = tail call i32 @nifti_short_order()
  %77 = getelementptr inbounds i8, ptr %1, i64 656
  store i32 %76, ptr %77, align 8, !tbaa !25
  br label %78

78:                                               ; preds = %75, %57, %44, %24, %8
  %.035 = phi i32 [ -1, %44 ], [ -1, %57 ], [ 0, %75 ], [ -1, %8 ], [ -1, %24 ]
  ret i32 %.035
}

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 = { cold 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, !13, i64 664}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !8, i64 32, !10, i64 64, !7, i64 72, !7, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !8, i64 108, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !7, i64 156, !7, i64 160, !7, i64 164, !7, i64 168, !7, i64 172, !7, i64 176, !7, i64 180, !7, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !12, i64 220, !12, i64 284, !12, i64 348, !12, i64 412, !11, i64 476, !7, i64 480, !7, i64 484, !7, i64 488, !7, i64 492, !11, i64 496, !11, i64 500, !11, i64 504, !8, i64 508, !8, i64 524, !8, i64 604, !13, i64 632, !13, i64 640, !7, i64 648, !7, i64 652, !7, i64 656, !13, i64 664, !7, i64 672, !13, i64 680, !7, i64 688}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"", !8, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!6, !7, i64 72}
!16 = !{!6, !10, i64 64}
!17 = !{!18, !7, i64 0}
!18 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!19 = !{!20, !13, i64 16}
!20 = !{!"", !7, i64 0, !10, i64 8, !13, i64 16}
!21 = !{!20, !7, i64 0}
!22 = !{!20, !10, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!6, !7, i64 656}


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