; LLVM IR from clausecker/24puzzle :: match (qualities_load)

; 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.quality = type { i64, double }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__.qualities_load = external hidden unnamed_addr constant [45 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @qualities_load(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca double, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca [100 x i8], align 16
  %15 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 100, ptr %14) #8
  %16 = call noalias ptr @malloc(i64 noundef 2153536) #9
  store ptr %16, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %149

20:                                               ; preds = %1
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %33, %20
  %22 = load i64, ptr %8, align 8, !tbaa !9
  %23 = icmp ult i64 %22, 134596
  br i1 %23, label %24, label %36

24:                                               ; preds = %21
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load i64, ptr %8, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.quality, ptr %25, i64 %26
  %28 = getelementptr inbounds %struct.quality, ptr %27, i32 0, i32 0
  store i64 -1, ptr %28, align 8, !tbaa !11
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i64, ptr %8, align 8, !tbaa !9
  %31 = getelementptr inbounds %struct.quality, ptr %29, i64 %30
  %32 = getelementptr inbounds %struct.quality, ptr %31, i32 0, i32 1
  store double -1.000000e+00, ptr %32, align 8, !tbaa !15
  br label %33

33:                                               ; preds = %24
  %34 = load i64, ptr %8, align 8, !tbaa !9
  %35 = add i64 %34, 1
  store i64 %35, ptr %8, align 8, !tbaa !9
  br label %21, !llvm.loop !16

36:                                               ; preds = %21
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = call noalias ptr @fopen(ptr noundef %37, ptr noundef @.str)
  store ptr %38, ptr %4, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %44

41:                                               ; preds = %36
  %42 = call ptr @__errno_location() #10
  %43 = load i32, ptr %42, align 4, !tbaa !18
  store i32 %43, ptr %9, align 4, !tbaa !18
  br label %145

44:                                               ; preds = %36
  br label %45

45:                                               ; preds = %124, %44
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds [100 x i8], ptr %14, i64 0, i64 0
  %48 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %46, ptr noundef @.str.1, ptr noundef %6, ptr noundef %7, ptr noundef %47)
  store i32 %48, ptr %10, align 4, !tbaa !18
  %49 = load i32, ptr %10, align 4, !tbaa !18
  %50 = icmp eq i32 %49, 3
  br i1 %50, label %51, label %125

51:                                               ; preds = %45
  %52 = getelementptr inbounds [100 x i8], ptr %14, i64 0, i64 0
  %53 = call i32 @tileset_parse(ptr noundef %12, ptr noundef %52)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %51
  store i32 22, ptr %9, align 4, !tbaa !18
  br label %142

56:                                               ; preds = %51
  %57 = load i32, ptr %12, align 4, !tbaa !18
  %58 = call i32 @tileset_remove(i32 noundef %57, i32 noundef 0)
  %59 = call i32 @tileset_count(i32 noundef %58)
  %60 = icmp eq i32 %59, 6
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  br label %63

62:                                               ; preds = %56
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 103, ptr noundef @__PRETTY_FUNCTION__.qualities_load) #11
  unreachable

63:                                               ; preds = %61
  %64 = load i32, ptr %12, align 4, !tbaa !18
  %65 = call i32 @tileset_ranknz(i32 noundef %64)
  store i32 %65, ptr %13, align 4, !tbaa !18
  %66 = load i32, ptr %13, align 4, !tbaa !18
  %67 = icmp ule i32 0, %66
  br i1 %67, label %68, label %72

68:                                               ; preds = %63
  %69 = load i32, ptr %13, align 4, !tbaa !18
  %70 = icmp ult i32 %69, 134596
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  br label %73

72:                                               ; preds = %68, %63
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.3, i32 noundef 105, ptr noundef @__PRETTY_FUNCTION__.qualities_load) #11
  unreachable

73:                                               ; preds = %71
  %74 = load i64, ptr %6, align 8, !tbaa !20
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = load i32, ptr %13, align 4, !tbaa !18
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds %struct.quality, ptr %75, i64 %77
  %79 = getelementptr inbounds %struct.quality, ptr %78, i32 0, i32 0
  store i64 %74, ptr %79, align 8, !tbaa !11
  %80 = load double, ptr %7, align 8, !tbaa !21
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = load i32, ptr %13, align 4, !tbaa !18
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds %struct.quality, ptr %81, i64 %83
  %85 = getelementptr inbounds %struct.quality, ptr %84, i32 0, i32 1
  store double %80, ptr %85, align 8, !tbaa !15
  store i32 1, ptr %11, align 4, !tbaa !18
  br label %86

86:                                               ; preds = %121, %73
  %87 = load i32, ptr %11, align 4, !tbaa !18
  %88 = icmp slt i32 %87, 8
  br i1 %88, label %89, label %124

89:                                               ; preds = %86
  %90 = load i32, ptr %12, align 4, !tbaa !18
  %91 = load i32, ptr %11, align 4, !tbaa !18
  %92 = call i32 @is_admissible_morphism(i32 noundef %90, i32 noundef %91)
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %95, label %94

94:                                               ; preds = %89
  br label %121

95:                                               ; preds = %89
  %96 = load i32, ptr %12, align 4, !tbaa !18
  %97 = call i32 @tileset_remove(i32 noundef %96, i32 noundef 0)
  %98 = load i32, ptr %11, align 4, !tbaa !18
  %99 = call i32 @tileset_morph(i32 noundef %97, i32 noundef %98)
  %100 = call i32 @tileset_ranknz(i32 noundef %99)
  store i32 %100, ptr %13, align 4, !tbaa !18
  %101 = load i32, ptr %13, align 4, !tbaa !18
  %102 = icmp ule i32 0, %101
  br i1 %102, label %103, label %107

103:                                              ; preds = %95
  %104 = load i32, ptr %13, align 4, !tbaa !18
  %105 = icmp ult i32 %104, 134596
  br i1 %105, label %106, label %107

106:                                              ; preds = %103
  br label %108

107:                                              ; preds = %103, %95
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.3, i32 noundef 114, ptr noundef @__PRETTY_FUNCTION__.qualities_load) #11
  unreachable

108:                                              ; preds = %106
  %109 = load i64, ptr %6, align 8, !tbaa !20
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = load i32, ptr %13, align 4, !tbaa !18
  %112 = zext i32 %111 to i64
  %113 = getelementptr inbounds %struct.quality, ptr %110, i64 %112
  %114 = getelementptr inbounds %struct.quality, ptr %113, i32 0, i32 0
  store i64 %109, ptr %114, align 8, !tbaa !11
  %115 = load double, ptr %7, align 8, !tbaa !21
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = load i32, ptr %13, align 4, !tbaa !18
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds %struct.quality, ptr %116, i64 %118
  %120 = getelementptr inbounds %struct.quality, ptr %119, i32 0, i32 1
  store double %115, ptr %120, align 8, !tbaa !15
  br label %121

121:                                              ; preds = %108, %94
  %122 = load i32, ptr %11, align 4, !tbaa !18
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %11, align 4, !tbaa !18
  br label %86, !llvm.loop !22

124:                                              ; preds = %86
  br label %45, !llvm.loop !23

125:                                              ; preds = %45
  %126 = load i32, ptr %10, align 4, !tbaa !18
  %127 = icmp ne i32 %126, -1
  br i1 %127, label %128, label %129

128:                                              ; preds = %125
  store i32 22, ptr %9, align 4, !tbaa !18
  br label %142

129:                                              ; preds = %125
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = call i32 @ferror(ptr noundef %130) #8
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %129
  br label %139

134:                                              ; preds = %129
  br label %135

135:                                              ; preds = %134
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = call i32 @fclose(ptr noundef %136)
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %138, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %149

139:                                              ; preds = %133
  %140 = call ptr @__errno_location() #10
  %141 = load i32, ptr %140, align 4, !tbaa !18
  store i32 %141, ptr %9, align 4, !tbaa !18
  br label %142

142:                                              ; preds = %139, %128, %55
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = call i32 @fclose(ptr noundef %143)
  br label %145

145:                                              ; preds = %142, %41
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %146) #8
  %147 = load i32, ptr %9, align 4, !tbaa !18
  %148 = call ptr @__errno_location() #10
  store i32 %147, ptr %148, align 4, !tbaa !18
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %149

149:                                              ; preds = %145, %135, %19
  call void @llvm.lifetime.end.p0(i64 100, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  %150 = load ptr, ptr %2, align 8
  ret ptr %150
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

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

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) #3

declare i32 @tileset_parse(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @tileset_count(i32 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @tileset_remove(i32 noundef, i32 noundef) #5

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @tileset_ranknz(i32 noundef) #5

declare i32 @is_admissible_morphism(i32 noundef, i32 noundef) #3

declare i32 @tileset_morph(i32 noundef, i32 noundef) #3

; Function Attrs: nounwind
declare i32 @ferror(ptr noundef) #7

declare i32 @fclose(ptr noundef) #3

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { inlinehint 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 #6 = { noreturn 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"quality", !13, i64 0, !14, i64 8}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!12, !14, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!13, !13, i64 0}
!21 = !{!14, !14, i64 0}
!22 = distinct !{!22, !17}
!23 = distinct !{!23, !17}


; 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.quality = type { i64, double }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [61 x i8], align 1
@__PRETTY_FUNCTION__.qualities_load = external hidden unnamed_addr constant [45 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @qualities_load(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca i64, align 8
  %3 = alloca double, align 8
  %4 = alloca i32, align 4
  %5 = alloca [100 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #10
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %5) #10
  %6 = tail call noalias dereferenceable_or_null(2153536) ptr @malloc(i64 noundef 2153536) #11
  %7 = icmp eq ptr %6, null
  br i1 %7, label %160, label %.preheader48

.preheader48:                                     ; preds = %1, %.preheader48
  %.03949 = phi i64 [ %19, %.preheader48 ], [ 0, %1 ]
  %8 = getelementptr inbounds %struct.quality, ptr %6, i64 %.03949
  store i64 -1, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  store double -1.000000e+00, ptr %9, align 8, !tbaa !11
  %10 = or disjoint i64 %.03949, 1
  %11 = getelementptr inbounds %struct.quality, ptr %6, i64 %10
  store i64 -1, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  store double -1.000000e+00, ptr %12, align 8, !tbaa !11
  %13 = or disjoint i64 %.03949, 2
  %14 = getelementptr inbounds %struct.quality, ptr %6, i64 %13
  store i64 -1, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  store double -1.000000e+00, ptr %15, align 8, !tbaa !11
  %16 = or disjoint i64 %.03949, 3
  %17 = getelementptr inbounds %struct.quality, ptr %6, i64 %16
  store i64 -1, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  store double -1.000000e+00, ptr %18, align 8, !tbaa !11
  %19 = add nuw nsw i64 %.03949, 4
  %exitcond.not.3 = icmp eq i64 %19, 134596
  br i1 %exitcond.not.3, label %20, label %.preheader48, !llvm.loop !12

20:                                               ; preds = %.preheader48
  %21 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %.preheader

23:                                               ; preds = %20
  %24 = tail call ptr @__errno_location() #12
  %25 = load i32, ptr %24, align 4, !tbaa !14
  br label %159

.preheader:                                       ; preds = %20, %.preheader.backedge
  %26 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %21, ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %5) #10
  switch i32 %26, label %.loopexit47 [
    i32 3, label %27
    i32 -1, label %151
  ]

27:                                               ; preds = %.preheader
  %28 = call i32 @tileset_parse(ptr noundef nonnull %4, ptr noundef nonnull %5) #10
  %.not45 = icmp eq i32 %28, 0
  br i1 %.not45, label %29, label %.loopexit47

29:                                               ; preds = %27
  %30 = load i32, ptr %4, align 4, !tbaa !14
  %31 = call i32 @tileset_remove(i32 noundef %30, i32 noundef 0)
  %32 = call i32 @tileset_count(i32 noundef %31)
  %33 = icmp eq i32 %32, 6
  br i1 %33, label %35, label %34

34:                                               ; preds = %29
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 103, ptr noundef nonnull @__PRETTY_FUNCTION__.qualities_load) #13
  unreachable

35:                                               ; preds = %29
  %36 = load i32, ptr %4, align 4, !tbaa !14
  %37 = call i32 @tileset_ranknz(i32 noundef %36)
  %38 = icmp ult i32 %37, 134596
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.3, i32 noundef 105, ptr noundef nonnull @__PRETTY_FUNCTION__.qualities_load) #13
  unreachable

40:                                               ; preds = %35
  %41 = load i64, ptr %2, align 8, !tbaa !16
  %42 = zext nneg i32 %37 to i64
  %43 = getelementptr inbounds %struct.quality, ptr %6, i64 %42
  store i64 %41, ptr %43, align 8, !tbaa !5
  %44 = load double, ptr %3, align 8, !tbaa !17
  %45 = getelementptr inbounds i8, ptr %43, i64 8
  store double %44, ptr %45, align 8, !tbaa !11
  %46 = load i32, ptr %4, align 4, !tbaa !14
  %47 = call i32 @is_admissible_morphism(i32 noundef %46, i32 noundef 1) #10
  %.not46 = icmp eq i32 %47, 0
  br i1 %.not46, label %61, label %48

48:                                               ; preds = %40
  %49 = load i32, ptr %4, align 4, !tbaa !14
  %50 = call i32 @tileset_remove(i32 noundef %49, i32 noundef 0)
  %51 = call i32 @tileset_morph(i32 noundef %50, i32 noundef 1) #10
  %52 = call i32 @tileset_ranknz(i32 noundef %51)
  %53 = icmp ult i32 %52, 134596
  br i1 %53, label %55, label %54

54:                                               ; preds = %139, %124, %109, %94, %79, %64, %48
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.3, i32 noundef 114, ptr noundef nonnull @__PRETTY_FUNCTION__.qualities_load) #13
  unreachable

55:                                               ; preds = %48
  %56 = load i64, ptr %2, align 8, !tbaa !16
  %57 = zext nneg i32 %52 to i64
  %58 = getelementptr inbounds %struct.quality, ptr %6, i64 %57
  store i64 %56, ptr %58, align 8, !tbaa !5
  %59 = load double, ptr %3, align 8, !tbaa !17
  %60 = getelementptr inbounds i8, ptr %58, i64 8
  store double %59, ptr %60, align 8, !tbaa !11
  br label %61

61:                                               ; preds = %40, %55
  %62 = load i32, ptr %4, align 4, !tbaa !14
  %63 = call i32 @is_admissible_morphism(i32 noundef %62, i32 noundef 2) #10
  %.not46.1 = icmp eq i32 %63, 0
  br i1 %.not46.1, label %76, label %64

64:                                               ; preds = %61
  %65 = load i32, ptr %4, align 4, !tbaa !14
  %66 = call i32 @tileset_remove(i32 noundef %65, i32 noundef 0)
  %67 = call i32 @tileset_morph(i32 noundef %66, i32 noundef 2) #10
  %68 = call i32 @tileset_ranknz(i32 noundef %67)
  %69 = icmp ult i32 %68, 134596
  br i1 %69, label %70, label %54

70:                                               ; preds = %64
  %71 = load i64, ptr %2, align 8, !tbaa !16
  %72 = zext nneg i32 %68 to i64
  %73 = getelementptr inbounds %struct.quality, ptr %6, i64 %72
  store i64 %71, ptr %73, align 8, !tbaa !5
  %74 = load double, ptr %3, align 8, !tbaa !17
  %75 = getelementptr inbounds i8, ptr %73, i64 8
  store double %74, ptr %75, align 8, !tbaa !11
  br label %76

76:                                               ; preds = %70, %61
  %77 = load i32, ptr %4, align 4, !tbaa !14
  %78 = call i32 @is_admissible_morphism(i32 noundef %77, i32 noundef 3) #10
  %.not46.2 = icmp eq i32 %78, 0
  br i1 %.not46.2, label %91, label %79

79:                                               ; preds = %76
  %80 = load i32, ptr %4, align 4, !tbaa !14
  %81 = call i32 @tileset_remove(i32 noundef %80, i32 noundef 0)
  %82 = call i32 @tileset_morph(i32 noundef %81, i32 noundef 3) #10
  %83 = call i32 @tileset_ranknz(i32 noundef %82)
  %84 = icmp ult i32 %83, 134596
  br i1 %84, label %85, label %54

85:                                               ; preds = %79
  %86 = load i64, ptr %2, align 8, !tbaa !16
  %87 = zext nneg i32 %83 to i64
  %88 = getelementptr inbounds %struct.quality, ptr %6, i64 %87
  store i64 %86, ptr %88, align 8, !tbaa !5
  %89 = load double, ptr %3, align 8, !tbaa !17
  %90 = getelementptr inbounds i8, ptr %88, i64 8
  store double %89, ptr %90, align 8, !tbaa !11
  br label %91

91:                                               ; preds = %85, %76
  %92 = load i32, ptr %4, align 4, !tbaa !14
  %93 = call i32 @is_admissible_morphism(i32 noundef %92, i32 noundef 4) #10
  %.not46.3 = icmp eq i32 %93, 0
  br i1 %.not46.3, label %106, label %94

94:                                               ; preds = %91
  %95 = load i32, ptr %4, align 4, !tbaa !14
  %96 = call i32 @tileset_remove(i32 noundef %95, i32 noundef 0)
  %97 = call i32 @tileset_morph(i32 noundef %96, i32 noundef 4) #10
  %98 = call i32 @tileset_ranknz(i32 noundef %97)
  %99 = icmp ult i32 %98, 134596
  br i1 %99, label %100, label %54

100:                                              ; preds = %94
  %101 = load i64, ptr %2, align 8, !tbaa !16
  %102 = zext nneg i32 %98 to i64
  %103 = getelementptr inbounds %struct.quality, ptr %6, i64 %102
  store i64 %101, ptr %103, align 8, !tbaa !5
  %104 = load double, ptr %3, align 8, !tbaa !17
  %105 = getelementptr inbounds i8, ptr %103, i64 8
  store double %104, ptr %105, align 8, !tbaa !11
  br label %106

106:                                              ; preds = %100, %91
  %107 = load i32, ptr %4, align 4, !tbaa !14
  %108 = call i32 @is_admissible_morphism(i32 noundef %107, i32 noundef 5) #10
  %.not46.4 = icmp eq i32 %108, 0
  br i1 %.not46.4, label %121, label %109

109:                                              ; preds = %106
  %110 = load i32, ptr %4, align 4, !tbaa !14
  %111 = call i32 @tileset_remove(i32 noundef %110, i32 noundef 0)
  %112 = call i32 @tileset_morph(i32 noundef %111, i32 noundef 5) #10
  %113 = call i32 @tileset_ranknz(i32 noundef %112)
  %114 = icmp ult i32 %113, 134596
  br i1 %114, label %115, label %54

115:                                              ; preds = %109
  %116 = load i64, ptr %2, align 8, !tbaa !16
  %117 = zext nneg i32 %113 to i64
  %118 = getelementptr inbounds %struct.quality, ptr %6, i64 %117
  store i64 %116, ptr %118, align 8, !tbaa !5
  %119 = load double, ptr %3, align 8, !tbaa !17
  %120 = getelementptr inbounds i8, ptr %118, i64 8
  store double %119, ptr %120, align 8, !tbaa !11
  br label %121

121:                                              ; preds = %115, %106
  %122 = load i32, ptr %4, align 4, !tbaa !14
  %123 = call i32 @is_admissible_morphism(i32 noundef %122, i32 noundef 6) #10
  %.not46.5 = icmp eq i32 %123, 0
  br i1 %.not46.5, label %136, label %124

124:                                              ; preds = %121
  %125 = load i32, ptr %4, align 4, !tbaa !14
  %126 = call i32 @tileset_remove(i32 noundef %125, i32 noundef 0)
  %127 = call i32 @tileset_morph(i32 noundef %126, i32 noundef 6) #10
  %128 = call i32 @tileset_ranknz(i32 noundef %127)
  %129 = icmp ult i32 %128, 134596
  br i1 %129, label %130, label %54

130:                                              ; preds = %124
  %131 = load i64, ptr %2, align 8, !tbaa !16
  %132 = zext nneg i32 %128 to i64
  %133 = getelementptr inbounds %struct.quality, ptr %6, i64 %132
  store i64 %131, ptr %133, align 8, !tbaa !5
  %134 = load double, ptr %3, align 8, !tbaa !17
  %135 = getelementptr inbounds i8, ptr %133, i64 8
  store double %134, ptr %135, align 8, !tbaa !11
  br label %136

136:                                              ; preds = %130, %121
  %137 = load i32, ptr %4, align 4, !tbaa !14
  %138 = call i32 @is_admissible_morphism(i32 noundef %137, i32 noundef 7) #10
  %.not46.6 = icmp eq i32 %138, 0
  br i1 %.not46.6, label %.preheader.backedge, label %139

139:                                              ; preds = %136
  %140 = load i32, ptr %4, align 4, !tbaa !14
  %141 = call i32 @tileset_remove(i32 noundef %140, i32 noundef 0)
  %142 = call i32 @tileset_morph(i32 noundef %141, i32 noundef 7) #10
  %143 = call i32 @tileset_ranknz(i32 noundef %142)
  %144 = icmp ult i32 %143, 134596
  br i1 %144, label %145, label %54

145:                                              ; preds = %139
  %146 = load i64, ptr %2, align 8, !tbaa !16
  %147 = zext nneg i32 %143 to i64
  %148 = getelementptr inbounds %struct.quality, ptr %6, i64 %147
  store i64 %146, ptr %148, align 8, !tbaa !5
  %149 = load double, ptr %3, align 8, !tbaa !17
  %150 = getelementptr inbounds i8, ptr %148, i64 8
  store double %149, ptr %150, align 8, !tbaa !11
  br label %.preheader.backedge

.preheader.backedge:                              ; preds = %145, %136
  br label %.preheader, !llvm.loop !18

151:                                              ; preds = %.preheader
  %152 = call i32 @ferror(ptr noundef nonnull %21) #10
  %.not44 = icmp eq i32 %152, 0
  br i1 %.not44, label %153, label %155

153:                                              ; preds = %151
  %154 = call i32 @fclose(ptr noundef nonnull %21)
  br label %160

155:                                              ; preds = %151
  %156 = tail call ptr @__errno_location() #12
  %157 = load i32, ptr %156, align 4, !tbaa !14
  br label %.loopexit47

.loopexit47:                                      ; preds = %.preheader, %27, %155
  %.038 = phi i32 [ %157, %155 ], [ 22, %27 ], [ 22, %.preheader ]
  %158 = call i32 @fclose(ptr noundef nonnull %21)
  %.pre = tail call ptr @__errno_location() #12
  br label %159

159:                                              ; preds = %.loopexit47, %23
  %.pre-phi = phi ptr [ %.pre, %.loopexit47 ], [ %24, %23 ]
  %.1 = phi i32 [ %.038, %.loopexit47 ], [ %25, %23 ]
  call void @free(ptr noundef %6) #10
  store i32 %.1, ptr %.pre-phi, align 4, !tbaa !14
  br label %160

160:                                              ; preds = %1, %159, %153
  %.037 = phi ptr [ null, %159 ], [ %6, %153 ], [ null, %1 ]
  call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %5) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #10
  ret ptr %.037
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

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

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #5

declare i32 @tileset_parse(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @tileset_remove(i32 noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #7

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

declare i32 @is_admissible_morphism(i32 noundef, i32 noundef) local_unnamed_addr #5

declare i32 @tileset_morph(i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind memory(read)
declare noundef i32 @ferror(ptr nocapture noundef) local_unnamed_addr #8

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #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 = { inlinehint 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 = { noreturn 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 #8 = { nofree nounwind 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 #9 = { 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 #10 = { nounwind }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { noreturn 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, !7, i64 0}
!6 = !{!"quality", !7, i64 0, !10, i64 8}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !8, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!10, !10, i64 0}
!18 = distinct !{!18, !13}


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