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

@stderr = external global ptr, align 8
@g_opts = external hidden global %struct.nifti_global_options, align 4
@.str.229 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.230 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.231 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.232 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.233 = external hidden unnamed_addr constant [43 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
declare void @free(ptr noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @nifti_copy_extensions(ptr noundef %0, ptr noundef %1) #5 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.nifti_image, ptr %12, i32 0, i32 61
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %21, label %16

16:                                               ; preds = %2
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nifti_image, ptr %17, i32 0, i32 62
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %24

21:                                               ; preds = %16, %2
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.229) #6
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %165

24:                                               ; preds = %16
  %25 = load i32, ptr @g_opts, align 4, !tbaa !16
  %26 = icmp sgt i32 %25, 1
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.nifti_image, ptr %29, i32 0, i32 61
  %31 = load i32, ptr %30, align 8, !tbaa !9
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.230, i32 noundef %31) #6
  br label %33

33:                                               ; preds = %27, %24
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.nifti_image, ptr %34, i32 0, i32 61
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = icmp sle i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %33
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %165

39:                                               ; preds = %33
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.nifti_image, ptr %40, i32 0, i32 61
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = mul i64 %43, 16
  store i64 %44, ptr %7, align 8, !tbaa !18
  %45 = load i64, ptr %7, align 8, !tbaa !18
  %46 = call noalias ptr @malloc(i64 noundef %45) #7
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.nifti_image, ptr %47, i32 0, i32 62
  store ptr %46, ptr %48, align 8, !tbaa !15
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.nifti_image, ptr %49, i32 0, i32 62
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = icmp ne ptr %51, null
  br i1 %52, label %59, label %53

53:                                               ; preds = %39
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.nifti_image, ptr %55, i32 0, i32 61
  %57 = load i32, ptr %56, align 8, !tbaa !9
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.231, i32 noundef %57) #6
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %165

59:                                               ; preds = %39
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.nifti_image, ptr %60, i32 0, i32 61
  store i32 0, ptr %61, align 8, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !19
  br label %62

62:                                               ; preds = %161, %59
  %63 = load i32, ptr %8, align 4, !tbaa !19
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.nifti_image, ptr %64, i32 0, i32 61
  %66 = load i32, ptr %65, align 8, !tbaa !9
  %67 = icmp slt i32 %63, %66
  br i1 %67, label %68, label %164

68:                                               ; preds = %62
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.nifti_image, ptr %69, i32 0, i32 62
  %71 = load ptr, ptr %70, align 8, !tbaa !15
  %72 = load i32, ptr %8, align 4, !tbaa !19
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %struct.nifti1_extension, ptr %71, i64 %73
  %75 = getelementptr inbounds %struct.nifti1_extension, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !20
  store i32 %76, ptr %10, align 4, !tbaa !19
  store i32 %76, ptr %9, align 4, !tbaa !19
  %77 = load i32, ptr %9, align 4, !tbaa !19
  %78 = and i32 %77, 15
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %84

80:                                               ; preds = %68
  %81 = load i32, ptr %9, align 4, !tbaa !19
  %82 = add nsw i32 %81, 15
  %83 = and i32 %82, -16
  store i32 %83, ptr %9, align 4, !tbaa !19
  br label %84

84:                                               ; preds = %80, %68
  %85 = load i32, ptr @g_opts, align 4, !tbaa !16
  %86 = icmp sgt i32 %85, 2
  br i1 %86, label %87, label %93

87:                                               ; preds = %84
  %88 = load ptr, ptr @stderr, align 8, !tbaa !5
  %89 = load i32, ptr %8, align 4, !tbaa !19
  %90 = load i32, ptr %9, align 4, !tbaa !19
  %91 = load i32, ptr %10, align 4, !tbaa !19
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef @.str.232, i32 noundef %89, i32 noundef %90, i32 noundef %91) #6
  br label %93

93:                                               ; preds = %87, %84
  %94 = load i32, ptr %9, align 4, !tbaa !19
  %95 = sub nsw i32 %94, 8
  %96 = sext i32 %95 to i64
  %97 = call noalias ptr @calloc(i64 noundef %96, i64 noundef 1) #8
  store ptr %97, ptr %6, align 8, !tbaa !5
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %113, label %100

100:                                              ; preds = %93
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = load i32, ptr %9, align 4, !tbaa !19
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef @.str.233, i32 noundef %102) #6
  %104 = load i32, ptr %8, align 4, !tbaa !19
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %112

106:                                              ; preds = %100
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.nifti_image, ptr %107, i32 0, i32 62
  %109 = load ptr, ptr %108, align 8, !tbaa !15
  call void @free(ptr noundef %109) #6
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.nifti_image, ptr %110, i32 0, i32 62
  store ptr null, ptr %111, align 8, !tbaa !15
  br label %112

112:                                              ; preds = %106, %100
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %165

113:                                              ; preds = %93
  %114 = load i32, ptr %9, align 4, !tbaa !19
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.nifti_image, ptr %115, i32 0, i32 62
  %117 = load ptr, ptr %116, align 8, !tbaa !15
  %118 = load i32, ptr %8, align 4, !tbaa !19
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds %struct.nifti1_extension, ptr %117, i64 %119
  %121 = getelementptr inbounds %struct.nifti1_extension, ptr %120, i32 0, i32 0
  store i32 %114, ptr %121, align 8, !tbaa !20
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.nifti_image, ptr %122, i32 0, i32 62
  %124 = load ptr, ptr %123, align 8, !tbaa !15
  %125 = load i32, ptr %8, align 4, !tbaa !19
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds %struct.nifti1_extension, ptr %124, i64 %126
  %128 = getelementptr inbounds %struct.nifti1_extension, ptr %127, i32 0, i32 1
  %129 = load i32, ptr %128, align 4, !tbaa !22
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.nifti_image, ptr %130, i32 0, i32 62
  %132 = load ptr, ptr %131, align 8, !tbaa !15
  %133 = load i32, ptr %8, align 4, !tbaa !19
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds %struct.nifti1_extension, ptr %132, i64 %134
  %136 = getelementptr inbounds %struct.nifti1_extension, ptr %135, i32 0, i32 1
  store i32 %129, ptr %136, align 4, !tbaa !22
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.nifti_image, ptr %138, i32 0, i32 62
  %140 = load ptr, ptr %139, align 8, !tbaa !15
  %141 = load i32, ptr %8, align 4, !tbaa !19
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds %struct.nifti1_extension, ptr %140, i64 %142
  %144 = getelementptr inbounds %struct.nifti1_extension, ptr %143, i32 0, i32 2
  store ptr %137, ptr %144, align 8, !tbaa !23
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.nifti_image, ptr %146, i32 0, i32 62
  %148 = load ptr, ptr %147, align 8, !tbaa !15
  %149 = load i32, ptr %8, align 4, !tbaa !19
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %struct.nifti1_extension, ptr %148, i64 %150
  %152 = getelementptr inbounds %struct.nifti1_extension, ptr %151, i32 0, i32 2
  %153 = load ptr, ptr %152, align 8, !tbaa !23
  %154 = load i32, ptr %10, align 4, !tbaa !19
  %155 = sub nsw i32 %154, 8
  %156 = sext i32 %155 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %145, ptr align 1 %153, i64 %156, i1 false)
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.nifti_image, ptr %157, i32 0, i32 61
  %159 = load i32, ptr %158, align 8, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %158, align 8, !tbaa !9
  br label %161

161:                                              ; preds = %113
  %162 = load i32, ptr %8, align 4, !tbaa !19
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %8, align 4, !tbaa !19
  br label %62, !llvm.loop !24

164:                                              ; preds = %62
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %165

165:                                              ; preds = %164, %112, %53, %38, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %166 = load i32, ptr %3, align 4
  ret i32 %166
}

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 allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind allocsize(0,1) "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 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(0,1) }

!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, !11, i64 672}
!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, !6, i64 680}
!16 = !{!17, !11, i64 0}
!17 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!18 = !{!12, !12, i64 0}
!19 = !{!11, !11, i64 0}
!20 = !{!21, !11, i64 0}
!21 = !{!"nifti1_extension", !11, i64 0, !11, i64 4, !6, i64 8}
!22 = !{!21, !11, i64 4}
!23 = !{!21, !6, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; 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 }
%struct.nifti1_extension = type { i32, i32, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@g_opts = external hidden local_unnamed_addr global %struct.nifti_global_options, align 4
@.str.229 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.230 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.231 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.232 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.233 = external hidden unnamed_addr constant [43 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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @nifti_copy_extensions(ptr nocapture noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #5 {
  %3 = getelementptr inbounds i8, ptr %0, i64 672
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %9, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 680
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %12, label %9

9:                                                ; preds = %6, %2
  %10 = load ptr, ptr @stderr, align 8, !tbaa !15
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.229) #6
  br label %.loopexit

12:                                               ; preds = %6
  %13 = load i32, ptr @g_opts, align 4, !tbaa !16
  %14 = icmp sgt i32 %13, 1
  br i1 %14, label %15, label %20

15:                                               ; preds = %12
  %16 = load ptr, ptr @stderr, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %1, i64 672
  %18 = load i32, ptr %17, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.230, i32 noundef %18) #6
  br label %20

20:                                               ; preds = %15, %12
  %21 = getelementptr inbounds i8, ptr %1, i64 672
  %22 = load i32, ptr %21, align 8, !tbaa !5
  %23 = icmp slt i32 %22, 1
  br i1 %23, label %.loopexit, label %24

24:                                               ; preds = %20
  %25 = zext nneg i32 %22 to i64
  %26 = shl nuw nsw i64 %25, 4
  %27 = tail call noalias ptr @malloc(i64 noundef %26) #7
  store ptr %27, ptr %7, align 8, !tbaa !14
  %.not45 = icmp eq ptr %27, null
  br i1 %.not45, label %28, label %31

28:                                               ; preds = %24
  %29 = load ptr, ptr @stderr, align 8, !tbaa !15
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.231, i32 noundef %22) #6
  br label %.loopexit

31:                                               ; preds = %24
  store i32 0, ptr %3, align 8, !tbaa !5
  %32 = load i32, ptr %21, align 8, !tbaa !5
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %31
  %34 = getelementptr inbounds i8, ptr %1, i64 680
  %35 = load i32, ptr @g_opts, align 4, !tbaa !16
  %36 = icmp sgt i32 %35, 2
  %.pre = load ptr, ptr %34, align 8, !tbaa !14
  br i1 %36, label %.lr.ph.split, label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph, %43
  %37 = phi i32 [ %53, %43 ], [ 0, %.lr.ph ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %43 ], [ 0, %.lr.ph ]
  %38 = getelementptr inbounds %struct.nifti1_extension, ptr %.pre, i64 %indvars.iv
  %39 = load i32, ptr %38, align 8, !tbaa !18
  %.biased.us = add i32 %39, 15
  %.041.us = and i32 %.biased.us, -16
  %40 = add nsw i32 %.041.us, -8
  %41 = sext i32 %40 to i64
  %42 = tail call noalias ptr @calloc(i64 noundef %41, i64 noundef 1) #8
  %.not47.us = icmp eq ptr %42, null
  br i1 %.not47.us, label %.split.us, label %43

43:                                               ; preds = %.lr.ph.split.us
  %44 = getelementptr inbounds %struct.nifti1_extension, ptr %27, i64 %indvars.iv
  store i32 %.041.us, ptr %44, align 8, !tbaa !18
  %45 = getelementptr inbounds %struct.nifti1_extension, ptr %.pre, i64 %indvars.iv, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !20
  %47 = getelementptr inbounds %struct.nifti1_extension, ptr %27, i64 %indvars.iv, i32 1
  store i32 %46, ptr %47, align 4, !tbaa !20
  %48 = getelementptr inbounds %struct.nifti1_extension, ptr %27, i64 %indvars.iv, i32 2
  store ptr %42, ptr %48, align 8, !tbaa !21
  %49 = getelementptr inbounds %struct.nifti1_extension, ptr %.pre, i64 %indvars.iv, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  %51 = add nsw i32 %39, -8
  %52 = sext i32 %51 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %42, ptr align 1 %50, i64 %52, i1 false)
  %53 = add nuw nsw i32 %37, 1
  store i32 %53, ptr %3, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = load i32, ptr %21, align 8, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next, %55
  br i1 %56, label %.lr.ph.split.us, label %.loopexit, !llvm.loop !22

.lr.ph.split:                                     ; preds = %.lr.ph, %77
  %57 = phi i32 [ %67, %77 ], [ %35, %.lr.ph ]
  %58 = phi ptr [ %80, %77 ], [ %.pre, %.lr.ph ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %77 ], [ 0, %.lr.ph ]
  %59 = getelementptr inbounds %struct.nifti1_extension, ptr %58, i64 %indvars.iv58
  %60 = load i32, ptr %59, align 8, !tbaa !18
  %.biased = add i32 %60, 15
  %.041 = and i32 %.biased, -16
  %61 = icmp sgt i32 %57, 2
  br i1 %61, label %62, label %66

62:                                               ; preds = %.lr.ph.split
  %63 = load ptr, ptr @stderr, align 8, !tbaa !15
  %64 = trunc nuw nsw i64 %indvars.iv58 to i32
  %65 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.232, i32 noundef %64, i32 noundef %.041, i32 noundef %60) #6
  %.pre61 = load i32, ptr @g_opts, align 4, !tbaa !16
  br label %66

66:                                               ; preds = %62, %.lr.ph.split
  %67 = phi i32 [ %.pre61, %62 ], [ %57, %.lr.ph.split ]
  %68 = add nsw i32 %.041, -8
  %69 = sext i32 %68 to i64
  %70 = tail call noalias ptr @calloc(i64 noundef %69, i64 noundef 1) #8
  %.not47 = icmp eq ptr %70, null
  br i1 %.not47, label %.split.us, label %77

.split.us:                                        ; preds = %.lr.ph.split.us, %66
  %.us-phi = phi i32 [ %.041, %66 ], [ %.041.us, %.lr.ph.split.us ]
  %.us-phi50.in = phi i64 [ %indvars.iv58, %66 ], [ %indvars.iv, %.lr.ph.split.us ]
  %71 = load ptr, ptr @stderr, align 8, !tbaa !15
  %72 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str.233, i32 noundef %.us-phi) #6
  %73 = and i64 %.us-phi50.in, 4294967295
  %74 = icmp eq i64 %73, 0
  br i1 %74, label %75, label %.loopexit

75:                                               ; preds = %.split.us
  %76 = load ptr, ptr %7, align 8, !tbaa !14
  tail call void @free(ptr noundef %76) #9
  store ptr null, ptr %7, align 8, !tbaa !14
  br label %.loopexit

77:                                               ; preds = %66
  %78 = load ptr, ptr %7, align 8, !tbaa !14
  %79 = getelementptr inbounds %struct.nifti1_extension, ptr %78, i64 %indvars.iv58
  store i32 %.041, ptr %79, align 8, !tbaa !18
  %80 = load ptr, ptr %34, align 8, !tbaa !14
  %81 = getelementptr inbounds %struct.nifti1_extension, ptr %80, i64 %indvars.iv58, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !20
  %83 = getelementptr inbounds %struct.nifti1_extension, ptr %78, i64 %indvars.iv58, i32 1
  store i32 %82, ptr %83, align 4, !tbaa !20
  %84 = getelementptr inbounds %struct.nifti1_extension, ptr %78, i64 %indvars.iv58, i32 2
  store ptr %70, ptr %84, align 8, !tbaa !21
  %85 = getelementptr inbounds %struct.nifti1_extension, ptr %80, i64 %indvars.iv58, i32 2
  %86 = load ptr, ptr %85, align 8, !tbaa !21
  %87 = add nsw i32 %60, -8
  %88 = sext i32 %87 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %70, ptr align 1 %86, i64 %88, i1 false)
  %89 = load i32, ptr %3, align 8, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %3, align 8, !tbaa !5
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %91 = load i32, ptr %21, align 8, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = icmp slt i64 %indvars.iv.next59, %92
  br i1 %93, label %.lr.ph.split, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %43, %77, %31, %.split.us, %75, %20, %28, %9
  %.0 = phi i32 [ -1, %9 ], [ -1, %28 ], [ 0, %20 ], [ -1, %75 ], [ -1, %.split.us ], [ 0, %31 ], [ 0, %77 ], [ 0, %43 ]
  ret i32 %.0
}

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 = { 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 #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 #5 = { 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 #6 = { cold nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { 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 672}
!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 = !{!6, !13, i64 680}
!15 = !{!13, !13, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!18 = !{!19, !7, i64 0}
!19 = !{!"nifti1_extension", !7, i64 0, !7, i64 4, !13, i64 8}
!20 = !{!19, !7, i64 4}
!21 = !{!19, !13, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23, !25}
!25 = !{!"llvm.loop.unswitch.partial.disable"}


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