; LLVM IR from mncoppola/rpef :: utilities_src/squashfs2.1/squashfs-2.1-r2 (sort)

; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct.sort_info = type { i64, i64, i32, ptr }

@stderr = external global ptr, align 8
@sort_info_list = external dso_local global [65536 x ptr], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.7 = 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

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

; 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 @add_sort_list(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca [4096 x i8], align 16
  %12 = alloca [4096 x i8], align 16
  %13 = alloca %struct.stat, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  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 ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 144, ptr %13) #7
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = call i64 @strlen(ptr noundef %19) #8
  %21 = icmp ugt i64 %20, 1
  br i1 %21, label %22, label %36

22:                                               ; preds = %4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call i64 @strlen(ptr noundef %24) #8
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 -2
  %28 = call i32 @strcmp(ptr noundef %27, ptr noundef @.str.2) #8
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %36

30:                                               ; preds = %22
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i64 @strlen(ptr noundef %32) #8
  %34 = sub i64 %33, 2
  %35 = getelementptr inbounds i8, ptr %31, i64 %34
  store i8 0, ptr %35, align 1, !tbaa !11
  br label %36

36:                                               ; preds = %30, %22, %4
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 0
  %39 = load i8, ptr %38, align 1, !tbaa !11
  %40 = sext i8 %39 to i32
  %41 = icmp eq i32 %40, 47
  br i1 %41, label %50, label %42

42:                                               ; preds = %36
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call i32 @strncmp(ptr noundef %43, ptr noundef @.str.3, i64 noundef 2) #8
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %50, label %46

46:                                               ; preds = %42
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = call i32 @strncmp(ptr noundef %47, ptr noundef @.str.4, i64 noundef 3) #8
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %94

50:                                               ; preds = %46, %42, %36
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = call i32 @lstat(ptr noundef %51, ptr noundef %13) #7
  %53 = icmp eq i32 %52, -1
  br i1 %53, label %54, label %59

54:                                               ; preds = %50
  %55 = getelementptr inbounds [4096 x i8], ptr %11, i64 0, i64 0
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %55, ptr noundef @.str.5, ptr noundef %56) #7
  %58 = getelementptr inbounds [4096 x i8], ptr %11, i64 0, i64 0
  call void @perror(ptr noundef %58)
  store i32 1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %166

59:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %60 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 1
  %61 = load i64, ptr %60, align 8, !tbaa !12
  %62 = and i64 %61, 65535
  %63 = trunc i64 %62 to i32
  store i32 %63, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %64 = call noalias ptr @malloc(i64 noundef 32) #9
  store ptr %64, ptr %16, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %69

66:                                               ; preds = %59
  %67 = load ptr, ptr @stderr, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef @.str.6) #7
  store i32 0, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %91

69:                                               ; preds = %59
  %70 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 0
  %71 = load i64, ptr %70, align 8, !tbaa !16
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.sort_info, ptr %72, i32 0, i32 0
  store i64 %71, ptr %73, align 8, !tbaa !17
  %74 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 1
  %75 = load i64, ptr %74, align 8, !tbaa !12
  %76 = load ptr, ptr %16, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.sort_info, ptr %76, i32 0, i32 1
  store i64 %75, ptr %77, align 8, !tbaa !19
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.sort_info, ptr %79, i32 0, i32 2
  store i32 %78, ptr %80, align 8, !tbaa !20
  %81 = load i32, ptr %15, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %82
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.sort_info, ptr %85, i32 0, i32 3
  store ptr %84, ptr %86, align 8, !tbaa !21
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = load i32, ptr %15, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %89
  store ptr %87, ptr %90, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %91

91:                                               ; preds = %69, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %92 = load i32, ptr %14, align 4
  switch i32 %92, label %166 [
    i32 0, label %93
  ]

93:                                               ; preds = %91
  store i32 1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %166

94:                                               ; preds = %46
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %162, %94
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = load i32, ptr %8, align 4, !tbaa !9
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %99, label %165

99:                                               ; preds = %95
  %100 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = load i32, ptr %10, 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
  %106 = call ptr @strcpy(ptr noundef %100, ptr noundef %105) #7
  %107 = call ptr @strcat(ptr noundef %106, ptr noundef @.str.7) #7
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = call ptr @strcat(ptr noundef %107, ptr noundef %108) #7
  %110 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %111 = call i32 @lstat(ptr noundef %110, ptr noundef %13) #7
  %112 = icmp eq i32 %111, -1
  br i1 %112, label %113, label %127

113:                                              ; preds = %99
  %114 = call ptr @__errno_location() #10
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = icmp eq i32 %115, 2
  br i1 %116, label %126, label %117

117:                                              ; preds = %113
  %118 = call ptr @__errno_location() #10
  %119 = load i32, ptr %118, align 4, !tbaa !9
  %120 = icmp eq i32 %119, 20
  br i1 %120, label %126, label %121

121:                                              ; preds = %117
  %122 = getelementptr inbounds [4096 x i8], ptr %11, i64 0, i64 0
  %123 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %124 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %122, ptr noundef @.str.5, ptr noundef %123) #7
  %125 = getelementptr inbounds [4096 x i8], ptr %11, i64 0, i64 0
  call void @perror(ptr noundef %125)
  br label %126

126:                                              ; preds = %121, %117, %113
  br label %162

127:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %128 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 1
  %129 = load i64, ptr %128, align 8, !tbaa !12
  %130 = and i64 %129, 65535
  %131 = trunc i64 %130 to i32
  store i32 %131, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %132 = call noalias ptr @malloc(i64 noundef 32) #9
  store ptr %132, ptr %18, align 8, !tbaa !5
  %133 = icmp eq ptr %132, null
  br i1 %133, label %134, label %137

134:                                              ; preds = %127
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.6) #7
  store i32 0, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %159

137:                                              ; preds = %127
  %138 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 0
  %139 = load i64, ptr %138, align 8, !tbaa !16
  %140 = load ptr, ptr %18, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.sort_info, ptr %140, i32 0, i32 0
  store i64 %139, ptr %141, align 8, !tbaa !17
  %142 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 1
  %143 = load i64, ptr %142, align 8, !tbaa !12
  %144 = load ptr, ptr %18, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.sort_info, ptr %144, i32 0, i32 1
  store i64 %143, ptr %145, align 8, !tbaa !19
  %146 = load i32, ptr %7, align 4, !tbaa !9
  %147 = load ptr, ptr %18, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.sort_info, ptr %147, i32 0, i32 2
  store i32 %146, ptr %148, align 8, !tbaa !20
  %149 = load i32, ptr %17, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %150
  %152 = load ptr, ptr %151, align 8, !tbaa !5
  %153 = load ptr, ptr %18, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.sort_info, ptr %153, i32 0, i32 3
  store ptr %152, ptr %154, align 8, !tbaa !21
  %155 = load ptr, ptr %18, align 8, !tbaa !5
  %156 = load i32, ptr %17, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %157
  store ptr %155, ptr %158, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %159

159:                                              ; preds = %137, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  %160 = load i32, ptr %14, align 4
  switch i32 %160, label %166 [
    i32 0, label %161
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161, %126
  %163 = load i32, ptr %10, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %10, align 4, !tbaa !9
  br label %95, !llvm.loop !22

165:                                              ; preds = %95
  store i32 1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %166

166:                                              ; preds = %165, %159, %93, %91, %54
  call void @llvm.lifetime.end.p0(i64 144, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %167 = load i32, ptr %5, align 4
  ret i32 %167
}

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

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

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

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

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

declare void @perror(ptr noundef) #5

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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #6

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

!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 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 8}
!13 = !{!"stat", !14, i64 0, !14, i64 8, !14, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !15, i64 72, !15, i64 88, !15, i64 104, !7, i64 120}
!14 = !{!"long", !7, i64 0}
!15 = !{!"timespec", !14, i64 0, !14, i64 8}
!16 = !{!13, !14, i64 0}
!17 = !{!18, !14, i64 0}
!18 = !{!"sort_info", !14, i64 0, !14, i64 8, !10, i64 16, !6, i64 24}
!19 = !{!18, !14, i64 8}
!20 = !{!18, !10, i64 16}
!21 = !{!18, !6, i64 24}
!22 = distinct !{!22, !23}
!23 = !{!"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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@stderr = external local_unnamed_addr global ptr, align 8
@sort_info_list = external dso_local local_unnamed_addr global [65536 x ptr], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

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

; 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 uwtable
define dso_local noundef i32 @add_sort_list(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #3 {
  %5 = alloca [4096 x i8], align 16
  %6 = alloca [4096 x i8], align 16
  %7 = alloca %struct.stat, align 8
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %7) #7
  %8 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #8
  %9 = icmp ugt i64 %8, 1
  br i1 %9, label %10, label %16

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 %8
  %12 = getelementptr inbounds i8, ptr %11, i64 -2
  %13 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %12, ptr noundef nonnull dereferenceable(1) @.str.2) #8
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %10
  store i8 0, ptr %12, align 1, !tbaa !5
  br label %16

16:                                               ; preds = %15, %10, %4
  %17 = load i8, ptr %0, align 1, !tbaa !5
  %18 = icmp eq i8 %17, 47
  br i1 %18, label %27, label %19

19:                                               ; preds = %16
  %20 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef 2) #8
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %27, label %22

22:                                               ; preds = %19
  %23 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef 3) #8
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %27, label %.preheader

.preheader:                                       ; preds = %22
  %25 = icmp sgt i32 %2, 0
  br i1 %25, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %26 = getelementptr inbounds i8, ptr %7, i64 8
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %48

27:                                               ; preds = %22, %19, %16
  %28 = call i32 @lstat(ptr noundef nonnull %0, ptr noundef nonnull %7) #7
  %29 = icmp eq i32 %28, -1
  br i1 %29, label %30, label %32

30:                                               ; preds = %27
  %31 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef nonnull %0) #7
  call void @perror(ptr noundef nonnull %5) #9
  br label %.loopexit

32:                                               ; preds = %27
  %33 = getelementptr inbounds i8, ptr %7, i64 8
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
  %.not41 = icmp ne ptr %35, null
  br i1 %.not41, label %39, label %36

36:                                               ; preds = %32
  %37 = load ptr, ptr @stderr, align 8, !tbaa !13
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.6) #11
  br label %47

39:                                               ; preds = %32
  %40 = and i64 %34, 65535
  %41 = load i64, ptr %7, align 8, !tbaa !15
  store i64 %41, ptr %35, align 8, !tbaa !16
  %42 = getelementptr inbounds i8, ptr %35, i64 8
  store i64 %34, ptr %42, align 8, !tbaa !18
  %43 = getelementptr inbounds i8, ptr %35, i64 16
  store i32 %1, ptr %43, align 8, !tbaa !19
  %44 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %40
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = getelementptr inbounds i8, ptr %35, i64 24
  store ptr %45, ptr %46, align 8, !tbaa !20
  store ptr %35, ptr %44, align 8, !tbaa !13
  br label %47

47:                                               ; preds = %39, %36
  %spec.select = zext i1 %.not41 to i32
  br label %.loopexit

48:                                               ; preds = %.lr.ph, %74
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %74 ]
  %49 = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) %50) #7
  %52 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.7) #7
  %53 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) %0) #7
  %54 = call i32 @lstat(ptr noundef nonnull %6, ptr noundef nonnull %7) #7
  %55 = icmp eq i32 %54, -1
  br i1 %55, label %56, label %61

56:                                               ; preds = %48
  %57 = tail call ptr @__errno_location() #12
  %58 = load i32, ptr %57, align 4, !tbaa !21
  switch i32 %58, label %59 [
    i32 2, label %74
    i32 20, label %74
  ]

59:                                               ; preds = %56
  %60 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef nonnull %6) #7
  call void @perror(ptr noundef nonnull %5) #9
  br label %74

61:                                               ; preds = %48
  %62 = load i64, ptr %26, align 8, !tbaa !8
  %63 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #10
  %.not = icmp eq ptr %63, null
  br i1 %.not, label %.thread, label %66

.thread:                                          ; preds = %61
  %64 = load ptr, ptr @stderr, align 8, !tbaa !13
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef nonnull @.str.6) #11
  br label %.loopexit

66:                                               ; preds = %61
  %67 = and i64 %62, 65535
  %68 = load i64, ptr %7, align 8, !tbaa !15
  store i64 %68, ptr %63, align 8, !tbaa !16
  %69 = getelementptr inbounds i8, ptr %63, i64 8
  store i64 %62, ptr %69, align 8, !tbaa !18
  %70 = getelementptr inbounds i8, ptr %63, i64 16
  store i32 %1, ptr %70, align 8, !tbaa !19
  %71 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %67
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  %73 = getelementptr inbounds i8, ptr %63, i64 24
  store ptr %72, ptr %73, align 8, !tbaa !20
  store ptr %63, ptr %71, align 8, !tbaa !13
  br label %74

74:                                               ; preds = %66, %56, %56, %59
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %48, !llvm.loop !22

.loopexit:                                        ; preds = %74, %.preheader, %.thread, %47, %30
  %.4 = phi i32 [ 1, %30 ], [ %spec.select, %47 ], [ 0, %.thread ], [ 1, %.preheader ], [ 1, %74 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %5) #7
  ret i32 %.4
}

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

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

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

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

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #6

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"stat", !10, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !12, i64 72, !12, i64 88, !12, i64 104, !6, i64 120}
!10 = !{!"long", !6, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!"timespec", !10, i64 0, !10, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !6, i64 0}
!15 = !{!9, !10, i64 0}
!16 = !{!17, !10, i64 0}
!17 = !{!"sort_info", !10, i64 0, !10, i64 8, !11, i64 16, !14, i64 24}
!18 = !{!17, !10, i64 8}
!19 = !{!17, !11, i64 16}
!20 = !{!17, !14, i64 24}
!21 = !{!11, !11, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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