; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/NIFTI/src/nifti/niftilib (nifti1_tool)

; 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_1_header = type { i32, [10 x i8], [18 x i8], i32, i16, i8, i8, [8 x i16], float, float, float, i16, i16, i16, i16, [8 x float], float, float, float, i16, i8, i8, float, float, float, float, i32, i32, [80 x i8], [24 x i8], i16, i16, float, float, float, float, float, float, [4 x float], [4 x float], [4 x float], [16 x i8], [4 x i8] }
%struct.nt_opts = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [8 x i32], [8 x i32], i32, i32, i32, i32, ptr, %struct.str_list, %struct.int_list, %struct.str_list, %struct.str_list, %struct.str_list, [2048 x i8] }
%struct.int_list = type { i32, ptr }
%struct.str_list = type { i32, ptr }

@stderr = external global ptr, align 8
@g_debug = external hidden global i32, align 4
@stdout = external global ptr, align 8
@.str.262 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.263 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.264 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.265 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.266 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.267 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.268 = external hidden unnamed_addr constant [33 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 uwtable
define dso_local i32 @act_check_hdrs(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.nifti_1_header, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %8 = load i32, ptr @g_debug, align 4, !tbaa !9
  %9 = icmp sgt i32 %8, 2
  br i1 %9, label %10, label %17

10:                                               ; preds = %1
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.nt_opts, ptr %12, i32 0, i32 33
  %14 = getelementptr inbounds %struct.str_list, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef @.str.262, i32 noundef %15) #5
  br label %17

17:                                               ; preds = %10, %1
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %160, %17
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.nt_opts, ptr %20, i32 0, i32 33
  %22 = getelementptr inbounds %struct.str_list, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !11
  %24 = icmp slt i32 %19, %23
  br i1 %24, label %25, label %163

25:                                               ; preds = %18
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.nt_opts, ptr %27, i32 0, i32 33
  %29 = getelementptr inbounds %struct.str_list, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds ptr, ptr %30, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = call ptr @nt_read_header(ptr noundef %26, ptr noundef %34, ptr noundef null, i32 noundef 0)
  store ptr %35, ptr %3, align 8, !tbaa !5
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %39, label %38

38:                                               ; preds = %25
  br label %160

39:                                               ; preds = %25
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.nt_opts, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !15
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %91

44:                                               ; preds = %39
  %45 = load i32, ptr @g_debug, align 4, !tbaa !9
  %46 = icmp sgt i32 %45, 1
  br i1 %46, label %47, label %58

47:                                               ; preds = %44
  %48 = load ptr, ptr @stdout, align 8, !tbaa !5
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.nt_opts, ptr %49, i32 0, i32 33
  %51 = getelementptr inbounds %struct.str_list, ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !14
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds ptr, ptr %52, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.263, ptr noundef %56) #5
  br label %58

58:                                               ; preds = %47, %44
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = call i32 @nifti_hdr_looks_good(ptr noundef %59)
  store i32 %60, ptr %6, align 4, !tbaa !9
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %76

63:                                               ; preds = %58
  %64 = load i32, ptr @g_debug, align 4, !tbaa !9
  %65 = icmp sgt i32 %64, 0
  br i1 %65, label %66, label %76

66:                                               ; preds = %63
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.nt_opts, ptr %67, i32 0, i32 33
  %69 = getelementptr inbounds %struct.str_list, ptr %68, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !14
  %71 = load i32, ptr %5, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds ptr, ptr %70, i64 %72
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.264, ptr noundef %74)
  br label %90

76:                                               ; preds = %63, %58
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %89, label %79

79:                                               ; preds = %76
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.nt_opts, ptr %80, i32 0, i32 33
  %82 = getelementptr inbounds %struct.str_list, ptr %81, i32 0, i32 1
  %83 = load ptr, ptr %82, align 8, !tbaa !14
  %84 = load i32, ptr %5, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds ptr, ptr %83, i64 %85
  %87 = load ptr, ptr %86, align 8, !tbaa !5
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.265, ptr noundef %87)
  br label %89

89:                                               ; preds = %79, %76
  br label %90

90:                                               ; preds = %89, %66
  br label %91

91:                                               ; preds = %90, %39
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.nt_opts, ptr %92, i32 0, i32 1
  %94 = load i32, ptr %93, align 4, !tbaa !16
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %158

96:                                               ; preds = %91
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.nt_opts, ptr %98, i32 0, i32 33
  %100 = getelementptr inbounds %struct.str_list, ptr %99, i32 0, i32 1
  %101 = load ptr, ptr %100, align 8, !tbaa !14
  %102 = load i32, ptr %5, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds ptr, ptr %101, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 348, ptr %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 4 %97, i64 348, i1 false), !tbaa.struct !17
  %106 = call ptr @nifti_convert_nhdr2nim(ptr noundef byval(%struct.nifti_1_header) align 8 %7, ptr noundef %105)
  call void @llvm.lifetime.end.p0(i64 348, ptr %7) #5
  store ptr %106, ptr %4, align 8, !tbaa !5
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = icmp ne ptr %107, null
  br i1 %108, label %110, label %109

109:                                              ; preds = %96
  br label %160

110:                                              ; preds = %96
  %111 = load i32, ptr @g_debug, align 4, !tbaa !9
  %112 = icmp sgt i32 %111, 1
  br i1 %112, label %113, label %124

113:                                              ; preds = %110
  %114 = load ptr, ptr @stdout, align 8, !tbaa !5
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.nt_opts, ptr %115, i32 0, i32 33
  %117 = getelementptr inbounds %struct.str_list, ptr %116, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !14
  %119 = load i32, ptr %5, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds ptr, ptr %118, i64 %120
  %122 = load ptr, ptr %121, align 8, !tbaa !5
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str.266, ptr noundef %122) #5
  br label %124

124:                                              ; preds = %113, %110
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = call i32 @nifti_nim_is_valid(ptr noundef %125, i32 noundef 1)
  store i32 %126, ptr %6, align 4, !tbaa !9
  %127 = load i32, ptr %6, align 4, !tbaa !9
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %142

129:                                              ; preds = %124
  %130 = load i32, ptr @g_debug, align 4, !tbaa !9
  %131 = icmp sgt i32 %130, 0
  br i1 %131, label %132, label %142

132:                                              ; preds = %129
  %133 = load ptr, ptr %2, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.nt_opts, ptr %133, i32 0, i32 33
  %135 = getelementptr inbounds %struct.str_list, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !14
  %137 = load i32, ptr %5, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds ptr, ptr %136, i64 %138
  %140 = load ptr, ptr %139, align 8, !tbaa !5
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.267, ptr noundef %140)
  br label %156

142:                                              ; preds = %129, %124
  %143 = load i32, ptr %6, align 4, !tbaa !9
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %155, label %145

145:                                              ; preds = %142
  %146 = load ptr, ptr %2, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.nt_opts, ptr %146, i32 0, i32 33
  %148 = getelementptr inbounds %struct.str_list, ptr %147, i32 0, i32 1
  %149 = load ptr, ptr %148, align 8, !tbaa !14
  %150 = load i32, ptr %5, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds ptr, ptr %149, i64 %151
  %153 = load ptr, ptr %152, align 8, !tbaa !5
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.268, ptr noundef %153)
  br label %155

155:                                              ; preds = %145, %142
  br label %156

156:                                              ; preds = %155, %132
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %157)
  br label %158

158:                                              ; preds = %156, %91
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %159) #5
  br label %160

160:                                              ; preds = %158, %109, %38
  %161 = load i32, ptr %5, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %5, align 4, !tbaa !9
  br label %18, !llvm.loop !23

163:                                              ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret i32 0
}

declare i32 @printf(ptr noundef, ...) #2

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

declare void @nifti_image_free(ptr noundef) #2

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

; 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) #4

; Function Attrs: nounwind uwtable
declare dso_local ptr @nt_read_header(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare i32 @nifti_hdr_looks_good(ptr noundef) #2

declare ptr @nifti_convert_nhdr2nim(ptr noundef byval(%struct.nifti_1_header) align 8, ptr noundef) #2

declare i32 @nifti_nim_is_valid(ptr noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 240}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 120, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !6, i64 168, !13, i64 176, !13, i64 192, !13, i64 208, !13, i64 224, !13, i64 240, !7, i64 256}
!13 = !{!"", !10, i64 0, !6, i64 8}
!14 = !{!12, !6, i64 248}
!15 = !{!12, !10, i64 0}
!16 = !{!12, !10, i64 4}
!17 = !{i64 0, i64 4, !9, i64 4, i64 10, !18, i64 14, i64 18, !18, i64 32, i64 4, !9, i64 36, i64 2, !19, i64 38, i64 1, !18, i64 39, i64 1, !18, i64 40, i64 16, !18, i64 56, i64 4, !21, i64 60, i64 4, !21, i64 64, i64 4, !21, i64 68, i64 2, !19, i64 70, i64 2, !19, i64 72, i64 2, !19, i64 74, i64 2, !19, i64 76, i64 32, !18, i64 108, i64 4, !21, i64 112, i64 4, !21, i64 116, i64 4, !21, i64 120, i64 2, !19, i64 122, i64 1, !18, i64 123, i64 1, !18, i64 124, i64 4, !21, i64 128, i64 4, !21, i64 132, i64 4, !21, i64 136, i64 4, !21, i64 140, i64 4, !9, i64 144, i64 4, !9, i64 148, i64 80, !18, i64 228, i64 24, !18, i64 252, i64 2, !19, i64 254, i64 2, !19, i64 256, i64 4, !21, i64 260, i64 4, !21, i64 264, i64 4, !21, i64 268, i64 4, !21, i64 272, i64 4, !21, i64 276, i64 4, !21, i64 280, i64 16, !18, i64 296, i64 16, !18, i64 312, i64 16, !18, i64 328, i64 16, !18, i64 344, i64 4, !18}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"short", !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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_1_header = type { i32, [10 x i8], [18 x i8], i32, i16, i8, i8, [8 x i16], float, float, float, i16, i16, i16, i16, [8 x float], float, float, float, i16, i8, i8, float, float, float, float, i32, i32, [80 x i8], [24 x i8], i16, i16, float, float, float, float, float, float, [4 x float], [4 x float], [4 x float], [16 x i8], [4 x i8] }

@stderr = external local_unnamed_addr global ptr, align 8
@g_debug = external hidden local_unnamed_addr global i32, align 4
@stdout = external local_unnamed_addr global ptr, align 8
@.str.262 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.263 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.264 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.265 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.266 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.267 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.268 = external hidden unnamed_addr constant [33 x i8], align 1

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

; Function Attrs: mustprogress 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 noundef i32 @act_check_hdrs(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca %struct.nifti_1_header, align 8
  %3 = load i32, ptr @g_debug, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 2
  br i1 %4, label %5, label %10

5:                                                ; preds = %1
  %6 = load ptr, ptr @stderr, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %0, i64 240
  %8 = load i32, ptr %7, align 8, !tbaa !11
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.262, i32 noundef %8) #6
  br label %10

10:                                               ; preds = %5, %1
  %11 = getelementptr inbounds i8, ptr %0, i64 240
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 248
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  br label %16

16:                                               ; preds = %.lr.ph, %68
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %68 ]
  %17 = load ptr, ptr %14, align 8, !tbaa !14
  %18 = getelementptr inbounds ptr, ptr %17, i64 %indvars.iv
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = tail call ptr @nt_read_header(ptr noundef nonnull %0, ptr noundef %19, ptr noundef null, i32 noundef 0)
  %.not = icmp eq ptr %20, null
  br i1 %.not, label %68, label %21

21:                                               ; preds = %16
  %22 = load i32, ptr %0, align 8, !tbaa !15
  %.not38 = icmp eq i32 %22, 0
  br i1 %.not38, label %41, label %23

23:                                               ; preds = %21
  %24 = load i32, ptr @g_debug, align 4, !tbaa !5
  %25 = icmp sgt i32 %24, 1
  br i1 %25, label %26, label %32

26:                                               ; preds = %23
  %27 = load ptr, ptr @stdout, align 8, !tbaa !9
  %28 = load ptr, ptr %14, align 8, !tbaa !14
  %29 = getelementptr inbounds ptr, ptr %28, i64 %indvars.iv
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.263, ptr noundef %30) #7
  br label %32

32:                                               ; preds = %26, %23
  %33 = tail call i32 @nifti_hdr_looks_good(ptr noundef nonnull %20) #7
  %34 = icmp ne i32 %33, 0
  %35 = load i32, ptr @g_debug, align 4
  %36 = icmp sgt i32 %35, 0
  %.not46 = xor i1 %34, true
  %brmerge = select i1 %.not46, i1 true, i1 %36
  br i1 %brmerge, label %.sink.split, label %41

.sink.split:                                      ; preds = %32
  %or.cond = select i1 %34, i1 %36, i1 false
  %.str.264.mux = select i1 %or.cond, ptr @.str.264, ptr @.str.265
  %37 = load ptr, ptr %14, align 8, !tbaa !14
  %38 = getelementptr inbounds ptr, ptr %37, i64 %indvars.iv
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.264.mux, ptr noundef %39)
  br label %41

41:                                               ; preds = %32, %.sink.split, %21
  %42 = load i32, ptr %15, align 4, !tbaa !16
  %.not39 = icmp eq i32 %42, 0
  br i1 %.not39, label %67, label %43

43:                                               ; preds = %41
  %44 = load ptr, ptr %14, align 8, !tbaa !14
  %45 = getelementptr inbounds ptr, ptr %44, i64 %indvars.iv
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 348, ptr nonnull %2) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(348) %2, ptr noundef nonnull align 4 dereferenceable(348) %20, i64 348, i1 false), !tbaa.struct !17
  %47 = tail call ptr @nifti_convert_nhdr2nim(ptr noundef nonnull byval(%struct.nifti_1_header) align 8 %2, ptr noundef %46) #7
  call void @llvm.lifetime.end.p0(i64 348, ptr nonnull %2) #7
  %.not40 = icmp eq ptr %47, null
  br i1 %.not40, label %68, label %48

48:                                               ; preds = %43
  %49 = load i32, ptr @g_debug, align 4, !tbaa !5
  %50 = icmp sgt i32 %49, 1
  br i1 %50, label %51, label %57

51:                                               ; preds = %48
  %52 = load ptr, ptr @stdout, align 8, !tbaa !9
  %53 = load ptr, ptr %14, align 8, !tbaa !14
  %54 = getelementptr inbounds ptr, ptr %53, i64 %indvars.iv
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef nonnull @.str.266, ptr noundef %55) #7
  br label %57

57:                                               ; preds = %51, %48
  %58 = tail call i32 @nifti_nim_is_valid(ptr noundef nonnull %47, i32 noundef 1) #7
  %59 = icmp ne i32 %58, 0
  %60 = load i32, ptr @g_debug, align 4
  %61 = icmp sgt i32 %60, 0
  %.not47 = xor i1 %59, true
  %brmerge48 = select i1 %.not47, i1 true, i1 %61
  br i1 %brmerge48, label %.sink.split44, label %66

.sink.split44:                                    ; preds = %57
  %or.cond3 = select i1 %59, i1 %61, i1 false
  %.str.267.mux = select i1 %or.cond3, ptr @.str.267, ptr @.str.268
  %62 = load ptr, ptr %14, align 8, !tbaa !14
  %63 = getelementptr inbounds ptr, ptr %62, i64 %indvars.iv
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.267.mux, ptr noundef %64)
  br label %66

66:                                               ; preds = %57, %.sink.split44
  tail call void @nifti_image_free(ptr noundef nonnull %47) #7
  br label %67

67:                                               ; preds = %66, %41
  tail call void @free(ptr noundef nonnull %20) #7
  br label %68

68:                                               ; preds = %43, %16, %67
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %69 = load i32, ptr %11, align 8, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next, %70
  br i1 %71, label %16, label %._crit_edge, !llvm.loop !23

._crit_edge:                                      ; preds = %68, %10
  ret i32 0
}

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

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

declare void @nifti_image_free(ptr noundef) local_unnamed_addr #3

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

; 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) #5

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

declare i32 @nifti_hdr_looks_good(ptr noundef) local_unnamed_addr #3

declare ptr @nifti_convert_nhdr2nim(ptr noundef byval(%struct.nifti_1_header) align 8, ptr noundef) local_unnamed_addr #3

declare i32 @nifti_nim_is_valid(ptr noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { "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 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { cold nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 240}
!12 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !6, i64 84, !7, i64 88, !7, i64 120, !6, i64 152, !6, i64 156, !6, i64 160, !6, i64 164, !10, i64 168, !13, i64 176, !13, i64 192, !13, i64 208, !13, i64 224, !13, i64 240, !7, i64 256}
!13 = !{!"", !6, i64 0, !10, i64 8}
!14 = !{!12, !10, i64 248}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 4}
!17 = !{i64 0, i64 4, !5, i64 4, i64 10, !18, i64 14, i64 18, !18, i64 32, i64 4, !5, i64 36, i64 2, !19, i64 38, i64 1, !18, i64 39, i64 1, !18, i64 40, i64 16, !18, i64 56, i64 4, !21, i64 60, i64 4, !21, i64 64, i64 4, !21, i64 68, i64 2, !19, i64 70, i64 2, !19, i64 72, i64 2, !19, i64 74, i64 2, !19, i64 76, i64 32, !18, i64 108, i64 4, !21, i64 112, i64 4, !21, i64 116, i64 4, !21, i64 120, i64 2, !19, i64 122, i64 1, !18, i64 123, i64 1, !18, i64 124, i64 4, !21, i64 128, i64 4, !21, i64 132, i64 4, !21, i64 136, i64 4, !21, i64 140, i64 4, !5, i64 144, i64 4, !5, i64 148, i64 80, !18, i64 228, i64 24, !18, i64 252, i64 2, !19, i64 254, i64 2, !19, i64 256, i64 4, !21, i64 260, i64 4, !21, i64 264, i64 4, !21, i64 268, i64 4, !21, i64 272, i64 4, !21, i64 276, i64 4, !21, i64 280, i64 16, !18, i64 296, i64 16, !18, i64 312, i64 16, !18, i64 328, i64 16, !18, i64 344, i64 4, !18}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"short", !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass