; 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.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 }
%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]] }

@stderr = external global ptr, align 8
@.str.26 = external hidden unnamed_addr constant [3 x i8], align 1
@g_debug = external hidden global i32, align 4
@.str.61 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.227 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.230 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.232 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.237 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.238 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.239 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.240 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.241 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.242 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.243 = external hidden unnamed_addr constant [2 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_rm_ext(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %9 = load i32, ptr @g_debug, align 4, !tbaa !9
  %10 = icmp sgt i32 %9, 2
  br i1 %10, label %11, label %22

11:                                               ; preds = %1
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.nt_opts, ptr %13, i32 0, i32 29
  %15 = getelementptr inbounds %struct.str_list, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nt_opts, ptr %17, i32 0, i32 33
  %19 = getelementptr inbounds %struct.str_list, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !14
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef @.str.237, i32 noundef %16, i32 noundef %20) #6
  br label %22

22:                                               ; preds = %11, %1
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.nt_opts, ptr %23, i32 0, i32 29
  %25 = getelementptr inbounds %struct.str_list, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !11
  %27 = icmp sle i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  store i32 0, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

29:                                               ; preds = %22
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.nt_opts, ptr %30, i32 0, i32 28
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %47

34:                                               ; preds = %29
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nt_opts, ptr %35, i32 0, i32 33
  %37 = getelementptr inbounds %struct.str_list, ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !14
  %39 = icmp ne i32 %38, 1
  br i1 %39, label %40, label %47

40:                                               ; preds = %34
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.nt_opts, ptr %42, i32 0, i32 33
  %44 = getelementptr inbounds %struct.str_list, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !14
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str.227, i32 noundef %45) #6
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

47:                                               ; preds = %34, %29
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.nt_opts, ptr %48, i32 0, i32 27
  %50 = load i32, ptr %49, align 4, !tbaa !16
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %70

52:                                               ; preds = %47
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.nt_opts, ptr %53, i32 0, i32 33
  %55 = getelementptr inbounds %struct.str_list, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 8, !tbaa !14
  %57 = icmp ne i32 %56, 1
  br i1 %57, label %58, label %70

58:                                               ; preds = %52
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.nt_opts, ptr %59, i32 0, i32 29
  %61 = getelementptr inbounds %struct.str_list, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !17
  %63 = getelementptr inbounds ptr, ptr %62, i64 0
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call i32 @strcmp(ptr noundef %64, ptr noundef @.str.26) #7
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %70

67:                                               ; preds = %58
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.238) #6
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

70:                                               ; preds = %58, %52, %47
  br label %71

71:                                               ; preds = %70
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.nt_opts, ptr %72, i32 0, i32 29
  %74 = getelementptr inbounds %struct.str_list, ptr %73, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %76 = getelementptr inbounds ptr, ptr %75, i64 0
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = call i32 @atoi(ptr noundef %77) #7
  store i32 %78, ptr %6, align 4, !tbaa !9
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = icmp slt i32 %79, -1
  br i1 %80, label %81, label %85

81:                                               ; preds = %71
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.239, i32 noundef %83) #6
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

85:                                               ; preds = %71
  %86 = load i32, ptr @g_debug, align 4, !tbaa !9
  %87 = icmp sgt i32 %86, 1
  br i1 %87, label %88, label %92

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

92:                                               ; preds = %88, %85
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %203, %92
  %94 = load i32, ptr %5, align 4, !tbaa !9
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.nt_opts, ptr %95, i32 0, i32 33
  %97 = getelementptr inbounds %struct.str_list, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 8, !tbaa !14
  %99 = icmp slt i32 %94, %98
  br i1 %99, label %100, label %206

100:                                              ; preds = %93
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.nt_opts, ptr %102, i32 0, i32 33
  %104 = getelementptr inbounds %struct.str_list, ptr %103, i32 0, i32 1
  %105 = load ptr, ptr %104, align 8, !tbaa !18
  %106 = load i32, ptr %5, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds ptr, ptr %105, i64 %107
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  %110 = call ptr @nt_image_read(ptr noundef %101, ptr noundef %109, i32 noundef 1)
  store ptr %110, ptr %4, align 8, !tbaa !5
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %114, label %113

113:                                              ; preds = %100
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

114:                                              ; preds = %100
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.nifti_image, ptr %115, i32 0, i32 61
  %117 = load i32, ptr %116, align 8, !tbaa !19
  store i32 %117, ptr %7, align 4, !tbaa !9
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.nt_opts, ptr %119, i32 0, i32 29
  %121 = getelementptr inbounds %struct.str_list, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.nt_opts, ptr %123, i32 0, i32 29
  %125 = getelementptr inbounds %struct.str_list, ptr %124, i32 0, i32 0
  %126 = load i32, ptr %125, align 8, !tbaa !11
  %127 = call i32 @remove_ext_list(ptr noundef %118, ptr noundef %122, i32 noundef %126)
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %114
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

130:                                              ; preds = %114
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.nt_opts, ptr %131, i32 0, i32 26
  %133 = load i32, ptr %132, align 8, !tbaa !24
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %150

135:                                              ; preds = %130
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.nt_opts, ptr %137, i32 0, i32 34
  %139 = getelementptr inbounds [2048 x i8], ptr %138, i64 0, i64 0
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.nt_opts, ptr %140, i32 0, i32 34
  %142 = getelementptr inbounds [2048 x i8], ptr %141, i64 0, i64 0
  %143 = call i64 @strlen(ptr noundef %142) #7
  %144 = trunc i64 %143 to i32
  %145 = call i32 @nifti_add_extension(ptr noundef %136, ptr noundef %139, i32 noundef %144, i32 noundef 6)
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %150

147:                                              ; preds = %135
  %148 = load ptr, ptr @stderr, align 8, !tbaa !5
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef @.str.230) #6
  br label %150

150:                                              ; preds = %147, %135, %130
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.nt_opts, ptr %151, i32 0, i32 28
  %153 = load ptr, ptr %152, align 8, !tbaa !15
  %154 = icmp ne ptr %153, null
  br i1 %154, label %155, label %170

155:                                              ; preds = %150
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.nt_opts, ptr %157, i32 0, i32 28
  %159 = load ptr, ptr %158, align 8, !tbaa !15
  %160 = load ptr, ptr %3, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.nt_opts, ptr %160, i32 0, i32 27
  %162 = load i32, ptr %161, align 4, !tbaa !16
  %163 = icmp ne i32 %162, 0
  %164 = xor i1 %163, true
  %165 = zext i1 %164 to i32
  %166 = call i32 @nifti_set_filenames(ptr noundef %156, ptr noundef %159, i32 noundef %165, i32 noundef 1)
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %170

168:                                              ; preds = %155
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %169)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

170:                                              ; preds = %155, %150
  %171 = load i32, ptr @g_debug, align 4, !tbaa !9
  %172 = icmp sgt i32 %171, 1
  br i1 %172, label %173, label %190

173:                                              ; preds = %170
  %174 = load ptr, ptr @stderr, align 8, !tbaa !5
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.nifti_image, ptr %175, i32 0, i32 55
  %177 = load ptr, ptr %176, align 8, !tbaa !25
  %178 = load i32, ptr %6, align 4, !tbaa !9
  %179 = icmp eq i32 %178, -1
  br i1 %179, label %180, label %182

180:                                              ; preds = %173
  %181 = load i32, ptr %7, align 4, !tbaa !9
  br label %187

182:                                              ; preds = %173
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.nt_opts, ptr %183, i32 0, i32 29
  %185 = getelementptr inbounds %struct.str_list, ptr %184, i32 0, i32 0
  %186 = load i32, ptr %185, align 8, !tbaa !11
  br label %187

187:                                              ; preds = %182, %180
  %188 = phi i32 [ %181, %180 ], [ %186, %182 ]
  %189 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef @.str.241, ptr noundef %177, i32 noundef %188) #6
  br label %190

190:                                              ; preds = %187, %170
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = call i32 @nifti_image_write_status(ptr noundef %191)
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %201

194:                                              ; preds = %190
  %195 = load ptr, ptr @stderr, align 8, !tbaa !5
  %196 = load ptr, ptr %4, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.nifti_image, ptr %196, i32 0, i32 55
  %198 = load ptr, ptr %197, align 8, !tbaa !25
  %199 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %195, ptr noundef @.str.232, ptr noundef %198) #6
  %200 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %200)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

201:                                              ; preds = %190
  %202 = load ptr, ptr %4, align 8, !tbaa !5
  call void @nifti_image_free(ptr noundef %202)
  br label %203

203:                                              ; preds = %201
  %204 = load i32, ptr %5, align 4, !tbaa !9
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %5, align 4, !tbaa !9
  br label %93, !llvm.loop !26

206:                                              ; preds = %93
  %207 = load i32, ptr @g_debug, align 4, !tbaa !9
  %208 = icmp sgt i32 %207, 0
  br i1 %208, label %209, label %220

209:                                              ; preds = %206
  %210 = load ptr, ptr @stderr, align 8, !tbaa !5
  %211 = load i32, ptr %6, align 4, !tbaa !9
  %212 = icmp eq i32 %211, -1
  %213 = zext i1 %212 to i64
  %214 = select i1 %212, ptr @.str.61, ptr @.str.243
  %215 = load ptr, ptr %3, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.nt_opts, ptr %215, i32 0, i32 33
  %217 = getelementptr inbounds %struct.str_list, ptr %216, i32 0, i32 0
  %218 = load i32, ptr %217, align 8, !tbaa !14
  %219 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %210, ptr noundef @.str.242, ptr noundef %214, i32 noundef %218) #6
  br label %220

220:                                              ; preds = %209, %206
  store i32 0, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %221

221:                                              ; preds = %220, %194, %168, %129, %113, %81, %67, %40, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %222 = load i32, ptr %2, align 4
  ret i32 %222
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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

declare i32 @nifti_add_extension(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #5

declare void @nifti_image_free(ptr noundef) #5

declare i32 @nifti_set_filenames(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #5

declare i32 @nifti_image_write_status(ptr noundef) #5

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

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 = { 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 = { nounwind willreturn memory(read) "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 = { inlinehint nounwind willreturn memory(read) 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 #5 = { "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 willreturn memory(read) }

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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.26 = external hidden unnamed_addr constant [3 x i8], align 1
@g_debug = external hidden local_unnamed_addr global i32, align 4
@.str.61 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.227 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.230 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.232 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.237 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.238 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.239 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.240 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.241 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.242 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.243 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @act_rm_ext(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @g_debug, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 2
  br i1 %3, label %4, label %11

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

11:                                               ; preds = %4, %1
  %12 = getelementptr inbounds i8, ptr %0, i64 176
  %13 = load i32, ptr %12, align 8, !tbaa !11
  %14 = icmp slt i32 %13, 1
  br i1 %14, label %.loopexit, label %15

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 168
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %24, label %18

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 240
  %20 = load i32, ptr %19, align 8, !tbaa !14
  %.not49 = icmp eq i32 %20, 1
  br i1 %.not49, label %24, label %21

21:                                               ; preds = %18
  %22 = load ptr, ptr @stderr, align 8, !tbaa !9
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.227, i32 noundef %20) #5
  br label %.loopexit

24:                                               ; preds = %18, %15
  %25 = getelementptr inbounds i8, ptr %0, i64 164
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %.not50 = icmp eq i32 %26, 0
  br i1 %.not50, label %38, label %27

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %0, i64 240
  %29 = load i32, ptr %28, align 8, !tbaa !14
  %.not51 = icmp eq i32 %29, 1
  br i1 %.not51, label %38, label %30

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %0, i64 184
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.26) #6
  %.not52 = icmp eq i32 %34, 0
  br i1 %.not52, label %38, label %35

35:                                               ; preds = %30
  %36 = load ptr, ptr @stderr, align 8, !tbaa !9
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.238) #5
  br label %.loopexit

38:                                               ; preds = %24, %27, %30
  %39 = getelementptr inbounds i8, ptr %0, i64 184
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = tail call i32 @atoi(ptr nocapture noundef %41) #6
  %43 = icmp slt i32 %42, -1
  br i1 %43, label %44, label %47

44:                                               ; preds = %38
  %45 = load ptr, ptr @stderr, align 8, !tbaa !9
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.239, i32 noundef %42) #5
  br label %.loopexit

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

50:                                               ; preds = %47
  %51 = load ptr, ptr @stderr, align 8, !tbaa !9
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef nonnull @.str.240, i32 noundef %42) #5
  br label %53

53:                                               ; preds = %50, %47
  %54 = getelementptr inbounds i8, ptr %0, i64 240
  %55 = load i32, ptr %54, align 8, !tbaa !14
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %53
  %57 = getelementptr inbounds i8, ptr %0, i64 248
  %58 = getelementptr inbounds i8, ptr %0, i64 160
  %59 = getelementptr inbounds i8, ptr %0, i64 256
  %60 = icmp eq i32 %42, -1
  br label %61

61:                                               ; preds = %.lr.ph, %107
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %107 ]
  %62 = load ptr, ptr %57, align 8, !tbaa !18
  %63 = getelementptr inbounds ptr, ptr %62, i64 %indvars.iv
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = tail call ptr @nt_image_read(ptr noundef nonnull %0, ptr noundef %64, i32 noundef 1)
  %.not53 = icmp eq ptr %65, null
  br i1 %.not53, label %.loopexit, label %66

66:                                               ; preds = %61
  %67 = getelementptr inbounds i8, ptr %65, i64 672
  %68 = load i32, ptr %67, align 8, !tbaa !19
  %69 = load ptr, ptr %39, align 8, !tbaa !17
  %70 = load i32, ptr %12, align 8, !tbaa !11
  %71 = tail call i32 @remove_ext_list(ptr noundef nonnull %65, ptr noundef %69, i32 noundef %70)
  %.not54 = icmp eq i32 %71, 0
  br i1 %.not54, label %72, label %.loopexit

72:                                               ; preds = %66
  %73 = load i32, ptr %58, align 8, !tbaa !24
  %.not55 = icmp eq i32 %73, 0
  br i1 %.not55, label %81, label %74

74:                                               ; preds = %72
  %75 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %59) #6
  %76 = trunc i64 %75 to i32
  %77 = tail call i32 @nifti_add_extension(ptr noundef nonnull %65, ptr noundef nonnull %59, i32 noundef %76, i32 noundef 6) #7
  %.not56 = icmp eq i32 %77, 0
  br i1 %.not56, label %81, label %78

78:                                               ; preds = %74
  %79 = load ptr, ptr @stderr, align 8, !tbaa !9
  %80 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.230) #5
  br label %81

81:                                               ; preds = %78, %74, %72
  %82 = load ptr, ptr %16, align 8, !tbaa !15
  %.not57 = icmp eq ptr %82, null
  br i1 %.not57, label %88, label %83

83:                                               ; preds = %81
  %84 = load i32, ptr %25, align 4, !tbaa !16
  %.not58 = icmp eq i32 %84, 0
  %85 = zext i1 %.not58 to i32
  %86 = tail call i32 @nifti_set_filenames(ptr noundef nonnull %65, ptr noundef nonnull %82, i32 noundef %85, i32 noundef 1) #7
  %.not59 = icmp eq i32 %86, 0
  br i1 %.not59, label %88, label %87

87:                                               ; preds = %83
  tail call void @nifti_image_free(ptr noundef nonnull %65) #7
  br label %.loopexit

88:                                               ; preds = %83, %81
  %89 = load i32, ptr @g_debug, align 4, !tbaa !5
  %90 = icmp sgt i32 %89, 1
  br i1 %90, label %91, label %100

91:                                               ; preds = %88
  %92 = load ptr, ptr @stderr, align 8, !tbaa !9
  %93 = getelementptr inbounds i8, ptr %65, i64 632
  %94 = load ptr, ptr %93, align 8, !tbaa !25
  br i1 %60, label %97, label %95

95:                                               ; preds = %91
  %96 = load i32, ptr %12, align 8, !tbaa !11
  br label %97

97:                                               ; preds = %91, %95
  %98 = phi i32 [ %96, %95 ], [ %68, %91 ]
  %99 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef nonnull @.str.241, ptr noundef %94, i32 noundef %98) #5
  br label %100

100:                                              ; preds = %97, %88
  %101 = tail call i32 @nifti_image_write_status(ptr noundef nonnull %65) #7
  %.not60 = icmp eq i32 %101, 0
  br i1 %.not60, label %107, label %102

102:                                              ; preds = %100
  %103 = load ptr, ptr @stderr, align 8, !tbaa !9
  %104 = getelementptr inbounds i8, ptr %65, i64 632
  %105 = load ptr, ptr %104, align 8, !tbaa !25
  %106 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef nonnull @.str.232, ptr noundef %105) #5
  tail call void @nifti_image_free(ptr noundef nonnull %65) #7
  br label %.loopexit

107:                                              ; preds = %100
  tail call void @nifti_image_free(ptr noundef nonnull %65) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %108 = load i32, ptr %54, align 8, !tbaa !14
  %109 = sext i32 %108 to i64
  %110 = icmp slt i64 %indvars.iv.next, %109
  br i1 %110, label %61, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %107, %53
  %.lcssa = phi i32 [ %55, %53 ], [ %108, %107 ]
  %111 = load i32, ptr @g_debug, align 4, !tbaa !5
  %112 = icmp sgt i32 %111, 0
  br i1 %112, label %113, label %.loopexit

113:                                              ; preds = %._crit_edge
  %114 = load ptr, ptr @stderr, align 8, !tbaa !9
  %115 = icmp eq i32 %42, -1
  %116 = select i1 %115, ptr @.str.61, ptr @.str.243
  %117 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef nonnull @.str.242, ptr noundef nonnull %116, i32 noundef %.lcssa) #5
  br label %.loopexit

.loopexit:                                        ; preds = %66, %61, %._crit_edge, %113, %11, %102, %87, %44, %35, %21
  %.0 = phi i32 [ 1, %21 ], [ 1, %35 ], [ 1, %44 ], [ 1, %87 ], [ 1, %102 ], [ 0, %11 ], [ 0, %113 ], [ 0, %._crit_edge ], [ 1, %61 ], [ 1, %66 ]
  ret i32 %.0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

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

declare i32 @nifti_add_extension(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare void @nifti_image_free(ptr noundef) local_unnamed_addr #4

declare i32 @nifti_set_filenames(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare i32 @nifti_image_write_status(ptr noundef) local_unnamed_addr #4

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

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


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