; 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 }

@stderr = external global ptr, align 8
@g_opts = external hidden global %struct.nifti_global_options, align 4
@__const.nifti_makehdrname.extnii = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.exthdr = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.extimg = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.extnia = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.extgz = external hidden unnamed_addr constant [5 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [30 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 willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #1

; 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 uwtable
declare dso_local ptr @nifti_find_file_extension(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_validfilename(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @is_uppercase(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @nifti_fileexists(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @make_uppercase(ptr noundef) #4

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

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @nifti_makehdrname(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca [5 x i8], align 1
  %13 = alloca [5 x i8], align 1
  %14 = alloca [5 x i8], align 1
  %15 = alloca [5 x i8], align 1
  %16 = alloca [5 x i8], align 1
  %17 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 5, ptr %12) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %12, ptr align 1 @__const.nifti_makehdrname.extnii, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr %13) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %13, ptr align 1 @__const.nifti_makehdrname.exthdr, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr %14) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %14, ptr align 1 @__const.nifti_makehdrname.extimg, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr %15) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %15, ptr align 1 @__const.nifti_makehdrname.extnia, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr %16) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %16, ptr align 1 @__const.nifti_makehdrname.extgz, i64 5, i1 false)
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call i32 @nifti_validfilename(ptr noundef %18)
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %22, label %21

21:                                               ; preds = %4
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %111

22:                                               ; preds = %4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call i64 @strlen(ptr noundef %23) #7
  %25 = add i64 %24, 7
  %26 = add i64 %25, 1
  %27 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %26) #8
  store ptr %27, ptr %10, align 8, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %33, label %30

30:                                               ; preds = %22
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.108) #6
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %111

33:                                               ; preds = %22
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call ptr @strcpy(ptr noundef %34, ptr noundef %35) #6
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = call ptr @nifti_find_file_extension(ptr noundef %37)
  store ptr %38, ptr %11, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %70

40:                                               ; preds = %33
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = call i32 @is_uppercase(ptr noundef %41)
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %55

44:                                               ; preds = %40
  %45 = getelementptr inbounds [5 x i8], ptr %12, i64 0, i64 0
  %46 = call i32 @make_uppercase(ptr noundef %45)
  %47 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 0
  %48 = call i32 @make_uppercase(ptr noundef %47)
  %49 = getelementptr inbounds [5 x i8], ptr %14, i64 0, i64 0
  %50 = call i32 @make_uppercase(ptr noundef %49)
  %51 = getelementptr inbounds [5 x i8], ptr %15, i64 0, i64 0
  %52 = call i32 @make_uppercase(ptr noundef %51)
  %53 = getelementptr inbounds [5 x i8], ptr %16, i64 0, i64 0
  %54 = call i32 @make_uppercase(ptr noundef %53)
  br label %55

55:                                               ; preds = %44, %40
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = getelementptr inbounds [5 x i8], ptr %14, i64 0, i64 0
  %58 = call i32 @strncmp(ptr noundef %56, ptr noundef %57, i64 noundef 4) #7
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %69

60:                                               ; preds = %55
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = ptrtoint ptr %62 to i64
  %65 = ptrtoint ptr %63 to i64
  %66 = sub i64 %64, %65
  %67 = getelementptr inbounds i8, ptr %61, i64 %66
  %68 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %67, ptr align 1 %68, i64 4, i1 false)
  br label %69

69:                                               ; preds = %60, %55
  br label %90

70:                                               ; preds = %33
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = icmp eq i32 %71, 1
  br i1 %72, label %73, label %77

73:                                               ; preds = %70
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = getelementptr inbounds [5 x i8], ptr %12, i64 0, i64 0
  %76 = call ptr @strcat(ptr noundef %74, ptr noundef %75) #6
  br label %89

77:                                               ; preds = %70
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = icmp eq i32 %78, 3
  br i1 %79, label %80, label %84

80:                                               ; preds = %77
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds [5 x i8], ptr %15, i64 0, i64 0
  %83 = call ptr @strcat(ptr noundef %81, ptr noundef %82) #6
  br label %88

84:                                               ; preds = %77
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 0
  %87 = call ptr @strcat(ptr noundef %85, ptr noundef %86) #6
  br label %88

88:                                               ; preds = %84, %80
  br label %89

89:                                               ; preds = %88, %73
  br label %90

90:                                               ; preds = %89, %69
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %102

93:                                               ; preds = %90
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = call i32 @nifti_fileexists(ptr noundef %94)
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %102

97:                                               ; preds = %93
  %98 = load ptr, ptr @stderr, align 8, !tbaa !5
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef @.str.109, ptr noundef %99) #6
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %101) #6
  store ptr null, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %111

102:                                              ; preds = %93, %90
  %103 = load i32, ptr @g_opts, align 4, !tbaa !11
  %104 = icmp sgt i32 %103, 2
  br i1 %104, label %105, label %109

105:                                              ; preds = %102
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.110, ptr noundef %107) #6
  br label %109

109:                                              ; preds = %105, %102
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %110, ptr %5, align 8
  store i32 1, ptr %17, align 4
  br label %111

111:                                              ; preds = %109, %97, %30, %21
  call void @llvm.lifetime.end.p0(i64 5, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 5, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 5, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 5, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 5, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %112 = load ptr, ptr %5, align 8
  ret ptr %112
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #2

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 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.nifti_global_options = type { i32, i32, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@g_opts = external hidden local_unnamed_addr global %struct.nifti_global_options, align 4
@__const.nifti_makehdrname.extnii = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.exthdr = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.extimg = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.extnia = external hidden unnamed_addr constant [5 x i8], align 1
@__const.nifti_makehdrname.extgz = external hidden unnamed_addr constant [5 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [30 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) 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 @nifti_find_file_extension(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare dso_local i32 @nifti_validfilename(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare hidden i32 @is_uppercase(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare hidden i32 @nifti_fileexists(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare hidden i32 @make_uppercase(ptr noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @nifti_makehdrname(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #6 {
  %5 = alloca [5 x i8], align 1
  %6 = alloca [5 x i8], align 4
  %7 = alloca [5 x i8], align 1
  %8 = alloca [5 x i8], align 1
  %9 = alloca [5 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %5) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %5, ptr noundef nonnull align 1 dereferenceable(5) @__const.nifti_makehdrname.extnii, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %6) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(5) %6, ptr noundef nonnull align 1 dereferenceable(5) @__const.nifti_makehdrname.exthdr, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %7) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %7, ptr noundef nonnull align 1 dereferenceable(5) @__const.nifti_makehdrname.extimg, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %8) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %8, ptr noundef nonnull align 1 dereferenceable(5) @__const.nifti_makehdrname.extnia, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %9) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %9, ptr noundef nonnull align 1 dereferenceable(5) @__const.nifti_makehdrname.extgz, i64 5, i1 false)
  %10 = tail call i32 @nifti_validfilename(ptr noundef %0)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %57, label %11

11:                                               ; preds = %4
  %12 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #9
  %13 = add i64 %12, 8
  %14 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %13) #10
  %.not25 = icmp eq ptr %14, null
  br i1 %.not25, label %15, label %18

15:                                               ; preds = %11
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.108) #11
  br label %57

18:                                               ; preds = %11
  %19 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) %0) #8
  %20 = tail call ptr @nifti_find_file_extension(ptr noundef nonnull %14)
  %.not26 = icmp eq ptr %20, null
  br i1 %.not26, label %38, label %21

21:                                               ; preds = %18
  %22 = tail call i32 @is_uppercase(ptr noundef nonnull %20)
  %.not27 = icmp eq i32 %22, 0
  br i1 %.not27, label %29, label %23

23:                                               ; preds = %21
  %24 = call i32 @make_uppercase(ptr noundef nonnull %5)
  %25 = call i32 @make_uppercase(ptr noundef nonnull %6)
  %26 = call i32 @make_uppercase(ptr noundef nonnull %7)
  %27 = call i32 @make_uppercase(ptr noundef nonnull %8)
  %28 = call i32 @make_uppercase(ptr noundef nonnull %9)
  br label %29

29:                                               ; preds = %23, %21
  %30 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) %7, i64 noundef 4) #9
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %45

32:                                               ; preds = %29
  %33 = ptrtoint ptr %20 to i64
  %34 = ptrtoint ptr %14 to i64
  %35 = sub i64 %33, %34
  %36 = getelementptr inbounds i8, ptr %14, i64 %35
  %37 = load i32, ptr %6, align 4
  store i32 %37, ptr %36, align 1
  br label %45

38:                                               ; preds = %18
  switch i32 %1, label %43 [
    i32 1, label %39
    i32 3, label %41
  ]

39:                                               ; preds = %38
  %40 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @__const.nifti_makehdrname.extnii) #8
  br label %45

41:                                               ; preds = %38
  %42 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @__const.nifti_makehdrname.extnia) #8
  br label %45

43:                                               ; preds = %38
  %44 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @__const.nifti_makehdrname.exthdr) #8
  br label %45

45:                                               ; preds = %39, %43, %41, %29, %32
  %.not28 = icmp eq i32 %2, 0
  br i1 %.not28, label %51, label %46

46:                                               ; preds = %45
  %47 = call i32 @nifti_fileexists(ptr noundef nonnull %14)
  %.not29 = icmp eq i32 %47, 0
  br i1 %.not29, label %51, label %48

48:                                               ; preds = %46
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.109, ptr noundef nonnull %14) #11
  call void @free(ptr noundef nonnull %14) #8
  br label %57

51:                                               ; preds = %46, %45
  %52 = load i32, ptr @g_opts, align 4, !tbaa !9
  %53 = icmp sgt i32 %52, 2
  br i1 %53, label %54, label %57

54:                                               ; preds = %51
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.110, ptr noundef nonnull %14) #11
  br label %57

57:                                               ; preds = %51, %54, %4, %48, %15
  %.0 = phi ptr [ null, %48 ], [ null, %15 ], [ null, %4 ], [ %14, %54 ], [ %14, %51 ]
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %5) #8
  ret ptr %.0
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind allocsize(0,1) }
attributes #11 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass