; LLVM IR from mncoppola/rpef :: utilities_src/squashfs4.1/squashfs-tools (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 }

@mkisofs_style = external dso_local global i32, align 4
@stderr = external global ptr, align 8
@sort_info_list = external dso_local global [65536 x ptr], align 16
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [102 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [41 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 i32, align 4
  %12 = alloca [4096 x i8], align 16
  %13 = alloca %struct.stat, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %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) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4096, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 144, ptr %13) #6
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = call i64 @strlen(ptr noundef %19) #7
  %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) #7
  %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.1) #7
  %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) #7
  %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
  br label %37

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

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

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

51:                                               ; preds = %47
  %52 = load i32, ptr @mkisofs_style, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %97

54:                                               ; preds = %51, %47, %43, %37
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = call i32 @lstat(ptr noundef %55, ptr noundef %13) #6
  %57 = icmp eq i32 %56, -1
  br i1 %57, label %58, label %59

58:                                               ; preds = %54
  br label %230

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %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 %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %64 = call noalias ptr @malloc(i64 noundef 32) #8
  store ptr %64, ptr %15, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %72

66:                                               ; preds = %59
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.4) #6
  br label %70

70:                                               ; preds = %67
  br label %71

71:                                               ; preds = %70
  store i32 0, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %94

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

94:                                               ; preds = %72, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %95 = load i32, ptr %16, align 4
  switch i32 %95, label %247 [
    i32 0, label %96
  ]

96:                                               ; preds = %94
  store i32 1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %247

97:                                               ; preds = %51
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %166, %97
  %99 = load i32, ptr %10, align 4, !tbaa !9
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %169

102:                                              ; preds = %98
  %103 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = load i32, ptr %10, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds ptr, ptr %104, i64 %106
  %108 = load ptr, ptr %107, align 8, !tbaa !5
  %109 = call ptr @strcpy(ptr noundef %103, ptr noundef %108) #6
  %110 = call ptr @strcat(ptr noundef %109, ptr noundef @.str.5) #6
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = call ptr @strcat(ptr noundef %110, ptr noundef %111) #6
  %113 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %114 = call i32 @lstat(ptr noundef %113, ptr noundef %13) #6
  %115 = icmp eq i32 %114, -1
  br i1 %115, label %116, label %126

116:                                              ; preds = %102
  %117 = call ptr @__errno_location() #9
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = icmp eq i32 %118, 2
  br i1 %119, label %125, label %120

120:                                              ; preds = %116
  %121 = call ptr @__errno_location() #9
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = icmp eq i32 %122, 20
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  br label %230

125:                                              ; preds = %120, %116
  br label %166

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

133:                                              ; preds = %126
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.4) #6
  br label %137

137:                                              ; preds = %134
  br label %138

138:                                              ; preds = %137
  store i32 0, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %161

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

161:                                              ; preds = %139, %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  %162 = load i32, ptr %16, align 4
  switch i32 %162, label %247 [
    i32 0, label %163
  ]

163:                                              ; preds = %161
  %164 = load i32, ptr %11, align 4, !tbaa !9
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %11, align 4, !tbaa !9
  br label %166

166:                                              ; preds = %163, %125
  %167 = load i32, ptr %10, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %10, align 4, !tbaa !9
  br label %98, !llvm.loop !22

169:                                              ; preds = %98
  %170 = load i32, ptr %11, align 4, !tbaa !9
  %171 = icmp eq i32 %170, 0
  br i1 %171, label %172, label %215

172:                                              ; preds = %169
  %173 = load i32, ptr @mkisofs_style, align 4, !tbaa !9
  %174 = icmp eq i32 %173, -1
  br i1 %174, label %175, label %215

175:                                              ; preds = %172
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = call i32 @lstat(ptr noundef %176, ptr noundef %13) #6
  %178 = icmp ne i32 %177, -1
  br i1 %178, label %179, label %215

179:                                              ; preds = %175
  br label %180

180:                                              ; preds = %179
  %181 = load ptr, ptr @stderr, align 8, !tbaa !5
  %182 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %181, ptr noundef @.str.6) #6
  br label %183

183:                                              ; preds = %180
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  %186 = load ptr, ptr @stderr, align 8, !tbaa !5
  %187 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %186, ptr noundef @.str.7) #6
  br label %188

188:                                              ; preds = %185
  br label %189

189:                                              ; preds = %188
  br label %190

190:                                              ; preds = %189
  %191 = load ptr, ptr @stderr, align 8, !tbaa !5
  %192 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %191, ptr noundef @.str.8) #6
  br label %193

193:                                              ; preds = %190
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr @stderr, align 8, !tbaa !5
  %197 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %196, ptr noundef @.str.9) #6
  br label %198

198:                                              ; preds = %195
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = load ptr, ptr @stderr, align 8, !tbaa !5
  %202 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %201, ptr noundef @.str.10) #6
  br label %203

203:                                              ; preds = %200
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  %206 = load ptr, ptr @stderr, align 8, !tbaa !5
  %207 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %206, ptr noundef @.str.11) #6
  br label %208

208:                                              ; preds = %205
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  %211 = load ptr, ptr @stderr, align 8, !tbaa !5
  %212 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %211, ptr noundef @.str.12) #6
  br label %213

213:                                              ; preds = %210
  br label %214

214:                                              ; preds = %213
  store i32 1, ptr @mkisofs_style, align 4, !tbaa !9
  br label %37

215:                                              ; preds = %175, %172, %169
  store i32 0, ptr @mkisofs_style, align 4, !tbaa !9
  %216 = load i32, ptr %11, align 4, !tbaa !9
  %217 = icmp eq i32 %216, 1
  br i1 %217, label %218, label %219

218:                                              ; preds = %215
  store i32 1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %247

219:                                              ; preds = %215
  %220 = load i32, ptr %11, align 4, !tbaa !9
  %221 = icmp sgt i32 %220, 1
  br i1 %221, label %222, label %229

222:                                              ; preds = %219
  br label %223

223:                                              ; preds = %222
  %224 = load ptr, ptr @stderr, align 8, !tbaa !5
  %225 = load ptr, ptr %6, align 8, !tbaa !5
  %226 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %224, ptr noundef @.str.13, ptr noundef %225) #6
  br label %227

227:                                              ; preds = %223
  br label %228

228:                                              ; preds = %227
  store i32 0, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %247

229:                                              ; preds = %219
  br label %230

230:                                              ; preds = %229, %124, %58
  br label %231

231:                                              ; preds = %230
  %232 = load ptr, ptr @stderr, align 8, !tbaa !5
  %233 = load ptr, ptr %6, align 8, !tbaa !5
  %234 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %232, ptr noundef @.str.14, ptr noundef %233) #6
  br label %235

235:                                              ; preds = %231
  br label %236

236:                                              ; preds = %235
  br label %237

237:                                              ; preds = %236
  %238 = load ptr, ptr @stderr, align 8, !tbaa !5
  %239 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %238, ptr noundef @.str.15) #6
  br label %240

240:                                              ; preds = %237
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241
  %243 = load ptr, ptr @stderr, align 8, !tbaa !5
  %244 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %243, ptr noundef @.str.16) #6
  br label %245

245:                                              ; preds = %242
  br label %246

246:                                              ; preds = %245
  store i32 1, ptr %5, align 4
  store i32 1, ptr %16, align 4
  br label %247

247:                                              ; preds = %246, %228, %218, %161, %96, %94
  call void @llvm.lifetime.end.p0(i64 144, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %248 = load i32, ptr %5, align 4
  ret i32 %248
}

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

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 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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 }

@mkisofs_style = external dso_local local_unnamed_addr global i32, align 4
@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.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [102 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [41 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 %struct.stat, align 8
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %6) #7
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #8
  %8 = icmp ugt i64 %7, 1
  br i1 %8, label %9, label %15

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

14:                                               ; preds = %9
  store i8 0, ptr %11, align 1, !tbaa !5
  br label %15

15:                                               ; preds = %14, %9, %4
  %16 = load i8, ptr %0, align 1, !tbaa !5
  %17 = icmp eq i8 %16, 47
  br i1 %17, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %15
  %18 = icmp sgt i32 %2, 0
  %19 = getelementptr inbounds i8, ptr %6, i64 8
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %20

20:                                               ; preds = %.lr.ph63, %76
  %21 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef 2) #8
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %._crit_edge64, label %23

23:                                               ; preds = %20
  %24 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef 3) #8
  %25 = icmp eq i32 %24, 0
  %26 = load i32, ptr @mkisofs_style, align 4
  %27 = icmp eq i32 %26, 1
  %or.cond = select i1 %25, i1 true, i1 %27
  br i1 %or.cond, label %._crit_edge64, label %.preheader

.preheader:                                       ; preds = %23
  br i1 %18, label %.lr.ph, label %._crit_edge.thread

._crit_edge64:                                    ; preds = %76, %20, %23, %15
  %28 = call i32 @lstat(ptr noundef nonnull %0, ptr noundef nonnull %6) #7
  %29 = icmp eq i32 %28, -1
  br i1 %29, label %.loopexit, label %30

30:                                               ; preds = %._crit_edge64
  %31 = getelementptr inbounds i8, ptr %6, i64 8
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
  %.not54 = icmp ne ptr %33, null
  br i1 %.not54, label %37, label %34

34:                                               ; preds = %30
  %35 = load ptr, ptr @stderr, align 8, !tbaa !13
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.4) #10
  br label %45

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

45:                                               ; preds = %37, %34
  %spec.select = zext i1 %.not54 to i32
  br label %106

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

53:                                               ; preds = %.lr.ph
  %54 = tail call ptr @__errno_location() #11
  %55 = load i32, ptr %54, align 4, !tbaa !21
  switch i32 %55, label %.loopexit [
    i32 2, label %70
    i32 20, label %70
  ]

56:                                               ; preds = %.lr.ph
  %57 = load i64, ptr %19, align 8, !tbaa !8
  %58 = call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #9
  %.not53 = icmp eq ptr %58, null
  br i1 %.not53, label %.thread, label %61

.thread:                                          ; preds = %56
  %59 = load ptr, ptr @stderr, align 8, !tbaa !13
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.4) #10
  br label %106

61:                                               ; preds = %56
  %62 = and i64 %57, 65535
  %63 = load i64, ptr %6, align 8, !tbaa !15
  store i64 %63, ptr %58, align 8, !tbaa !16
  %64 = getelementptr inbounds i8, ptr %58, i64 8
  store i64 %57, ptr %64, align 8, !tbaa !18
  %65 = getelementptr inbounds i8, ptr %58, i64 16
  store i32 %1, ptr %65, align 8, !tbaa !19
  %66 = getelementptr inbounds [65536 x ptr], ptr @sort_info_list, i64 0, i64 %62
  %67 = load ptr, ptr %66, align 8, !tbaa !13
  %68 = getelementptr inbounds i8, ptr %58, i64 24
  store ptr %67, ptr %68, align 8, !tbaa !20
  store ptr %58, ptr %66, align 8, !tbaa !13
  %69 = add nsw i32 %.04760, 1
  br label %70

70:                                               ; preds = %53, %53, %61
  %.148 = phi i32 [ %.04760, %53 ], [ %69, %61 ], [ %.04760, %53 ]
  %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 %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %70
  %.pre = load i32, ptr @mkisofs_style, align 4
  %71 = icmp eq i32 %.148, 0
  %72 = icmp eq i32 %.pre, -1
  %or.cond4 = select i1 %71, i1 %72, i1 false
  br i1 %or.cond4, label %74, label %93

._crit_edge.thread:                               ; preds = %.preheader
  %73 = icmp eq i32 %26, -1
  br i1 %73, label %74, label %.loopexit.sink.split

74:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %75 = call i32 @lstat(ptr noundef nonnull %0, ptr noundef nonnull %6) #7
  %.not = icmp eq i32 %75, -1
  br i1 %.not, label %.loopexit.sink.split, label %76

76:                                               ; preds = %74
  %77 = load ptr, ptr @stderr, align 8, !tbaa !13
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.6) #10
  %79 = load ptr, ptr @stderr, align 8, !tbaa !13
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.7) #10
  %81 = load ptr, ptr @stderr, align 8, !tbaa !13
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.8) #10
  %83 = load ptr, ptr @stderr, align 8, !tbaa !13
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef nonnull @.str.9) #10
  %85 = load ptr, ptr @stderr, align 8, !tbaa !13
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef nonnull @.str.10) #10
  %87 = load ptr, ptr @stderr, align 8, !tbaa !13
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef nonnull @.str.11) #10
  %89 = load ptr, ptr @stderr, align 8, !tbaa !13
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.12) #10
  store i32 1, ptr @mkisofs_style, align 4, !tbaa !21
  %91 = load i8, ptr %0, align 1, !tbaa !5
  %92 = icmp eq i8 %91, 47
  br i1 %92, label %._crit_edge64, label %20

93:                                               ; preds = %._crit_edge
  store i32 0, ptr @mkisofs_style, align 4, !tbaa !21
  %94 = icmp eq i32 %.148, 1
  br i1 %94, label %106, label %95

95:                                               ; preds = %93
  %96 = icmp sgt i32 %.148, 1
  br i1 %96, label %97, label %.loopexit

97:                                               ; preds = %95
  %98 = load ptr, ptr @stderr, align 8, !tbaa !13
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef nonnull @.str.13, ptr noundef nonnull %0) #10
  br label %106

.loopexit.sink.split:                             ; preds = %74, %._crit_edge.thread
  store i32 0, ptr @mkisofs_style, align 4, !tbaa !21
  br label %.loopexit

.loopexit:                                        ; preds = %53, %.loopexit.sink.split, %._crit_edge64, %95
  %100 = load ptr, ptr @stderr, align 8, !tbaa !13
  %101 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %100, ptr noundef nonnull @.str.14, ptr noundef nonnull %0) #10
  %102 = load ptr, ptr @stderr, align 8, !tbaa !13
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef nonnull @.str.15) #10
  %104 = load ptr, ptr @stderr, align 8, !tbaa !13
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef nonnull @.str.16) #10
  br label %106

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

; 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: 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 = { nounwind allocsize(0) }
attributes #10 = { cold nounwind }
attributes #11 = { 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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass