; LLVM IR from clausecker/24puzzle :: test (morphtest)

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@optarg = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@optind = external global i32, align 4
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca [4096 x i8], align 16
  %19 = alloca [66 x i8], align 16
  %20 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 1, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 231, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store ptr @.str, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4096, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 66, ptr %19) #6
  br label %21

21:                                               ; preds = %52, %2
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = call i32 @__posix_getopt(i32 noundef %22, ptr noundef %23, ptr noundef @.str.1) #6
  store i32 %24, ptr %12, align 4, !tbaa !5
  %25 = load i32, ptr %12, align 4, !tbaa !5
  %26 = icmp ne i32 %25, -1
  br i1 %26, label %27, label %53

27:                                               ; preds = %21
  %28 = load i32, ptr %12, align 4, !tbaa !5
  switch i32 %28, label %48 [
    i32 100, label %29
    i32 110, label %31
    i32 115, label %34
    i32 116, label %37
  ]

29:                                               ; preds = %27
  %30 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %30, ptr %17, align 8, !tbaa !9
  br label %52

31:                                               ; preds = %27
  %32 = load ptr, ptr @optarg, align 8, !tbaa !9
  %33 = call i64 @strtol(ptr noundef %32, ptr noundef null, i32 noundef 0) #6
  store i64 %33, ptr %11, align 8, !tbaa !11
  br label %52

34:                                               ; preds = %27
  %35 = load ptr, ptr @optarg, align 8, !tbaa !9
  %36 = call i64 @strtoll(ptr noundef %35, ptr noundef null, i32 noundef 0) #6
  call void @set_seed(i64 noundef %36)
  br label %52

37:                                               ; preds = %27
  %38 = load ptr, ptr @optarg, align 8, !tbaa !9
  %39 = call i32 @tileset_parse(ptr noundef %14, ptr noundef %38)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %47

41:                                               ; preds = %37
  %42 = load ptr, ptr @optarg, align 8, !tbaa !9
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %42)
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 0
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  call void @usage(ptr noundef %46)
  br label %47

47:                                               ; preds = %41, %37
  br label %52

48:                                               ; preds = %27
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = getelementptr inbounds ptr, ptr %49, i64 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  call void @usage(ptr noundef %51)
  br label %52

52:                                               ; preds = %48, %47, %34, %31, %29
  br label %21, !llvm.loop !13

53:                                               ; preds = %21
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr @optind, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = icmp ne i32 %54, %56
  br i1 %57, label %58, label %62

58:                                               ; preds = %53
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds ptr, ptr %59, i64 0
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  call void @usage(ptr noundef %61)
  br label %62

62:                                               ; preds = %58, %53
  %63 = load ptr, ptr %5, align 8, !tbaa !9
  %64 = load i32, ptr @optind, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds ptr, ptr %63, i64 %65
  %67 = load ptr, ptr %66, align 8, !tbaa !9
  %68 = call i32 @atoi(ptr noundef %67) #7
  store i32 %68, ptr %13, align 4, !tbaa !5
  %69 = load i32, ptr %14, align 4, !tbaa !5
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = call i32 @is_admissible_morphism(i32 noundef %69, i32 noundef %70)
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %76, label %73

73:                                               ; preds = %62
  %74 = load i32, ptr %13, align 4, !tbaa !5
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %74)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

76:                                               ; preds = %62
  %77 = load i32, ptr %14, align 4, !tbaa !5
  %78 = call i32 @tileset_has(i32 noundef %77, i32 noundef 0)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %85

80:                                               ; preds = %76
  %81 = load i32, ptr %16, align 4, !tbaa !5
  %82 = call i32 @tileset_add(i32 noundef %81, i32 noundef 0)
  store i32 %82, ptr %16, align 4, !tbaa !5
  %83 = load i32, ptr %14, align 4, !tbaa !5
  %84 = call i32 @tileset_remove(i32 noundef %83, i32 noundef 0)
  store i32 %84, ptr %14, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %80, %76
  %86 = load i32, ptr %14, align 4, !tbaa !5
  %87 = load i32, ptr %13, align 4, !tbaa !5
  %88 = call i32 @tileset_morph(i32 noundef %86, i32 noundef %87)
  %89 = call i32 @tileset_remove(i32 noundef %88, i32 noundef 0)
  store i32 %89, ptr %15, align 4, !tbaa !5
  %90 = load i32, ptr %14, align 4, !tbaa !5
  %91 = load i32, ptr %16, align 4, !tbaa !5
  %92 = call i32 @tileset_union(i32 noundef %90, i32 noundef %91)
  store i32 %92, ptr %14, align 4, !tbaa !5
  %93 = load i32, ptr %15, align 4, !tbaa !5
  %94 = load i32, ptr %16, align 4, !tbaa !5
  %95 = call i32 @tileset_union(i32 noundef %93, i32 noundef %94)
  store i32 %95, ptr %15, align 4, !tbaa !5
  %96 = getelementptr inbounds [66 x i8], ptr %19, i64 0, i64 0
  %97 = load i32, ptr %14, align 4, !tbaa !5
  call void @tileset_list_string(ptr noundef %96, i32 noundef %97)
  %98 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %99 = load ptr, ptr %17, align 8, !tbaa !9
  %100 = getelementptr inbounds [66 x i8], ptr %19, i64 0, i64 0
  %101 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %98, i64 noundef 4096, ptr noundef @.str.4, ptr noundef %99, ptr noundef %100) #6
  %102 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %103 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %102)
  %104 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %105 = call noalias ptr @fopen(ptr noundef %104, ptr noundef @.str.6)
  store ptr %105, ptr %8, align 8, !tbaa !9
  %106 = load ptr, ptr %8, align 8, !tbaa !9
  %107 = icmp eq ptr %106, null
  br i1 %107, label %108, label %110

108:                                              ; preds = %85
  %109 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  call void @perror(ptr noundef %109)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

110:                                              ; preds = %85
  %111 = load i32, ptr %14, align 4, !tbaa !5
  %112 = load ptr, ptr %8, align 8, !tbaa !9
  %113 = call i32 @fileno(ptr noundef %112) #6
  %114 = call ptr @pdb_mmap(i32 noundef %111, i32 noundef %113, i32 noundef 0)
  store ptr %114, ptr %6, align 8, !tbaa !9
  %115 = load ptr, ptr %6, align 8, !tbaa !9
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %118

117:                                              ; preds = %110
  call void @perror(ptr noundef @.str.7)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

118:                                              ; preds = %110
  %119 = load ptr, ptr %8, align 8, !tbaa !9
  %120 = call i32 @fclose(ptr noundef %119)
  %121 = getelementptr inbounds [66 x i8], ptr %19, i64 0, i64 0
  %122 = load i32, ptr %15, align 4, !tbaa !5
  call void @tileset_list_string(ptr noundef %121, i32 noundef %122)
  %123 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %124 = load ptr, ptr %17, align 8, !tbaa !9
  %125 = getelementptr inbounds [66 x i8], ptr %19, i64 0, i64 0
  %126 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %123, i64 noundef 4096, ptr noundef @.str.4, ptr noundef %124, ptr noundef %125) #6
  %127 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %127)
  %129 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  %130 = call noalias ptr @fopen(ptr noundef %129, ptr noundef @.str.6)
  store ptr %130, ptr %9, align 8, !tbaa !9
  %131 = load ptr, ptr %9, align 8, !tbaa !9
  %132 = icmp eq ptr %131, null
  br i1 %132, label %133, label %135

133:                                              ; preds = %118
  %134 = getelementptr inbounds [4096 x i8], ptr %18, i64 0, i64 0
  call void @perror(ptr noundef %134)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

135:                                              ; preds = %118
  %136 = load i32, ptr %15, align 4, !tbaa !5
  %137 = load ptr, ptr %9, align 8, !tbaa !9
  %138 = call i32 @fileno(ptr noundef %137) #6
  %139 = call ptr @pdb_mmap(i32 noundef %136, i32 noundef %138, i32 noundef 0)
  store ptr %139, ptr %7, align 8, !tbaa !9
  %140 = load ptr, ptr %7, align 8, !tbaa !9
  %141 = icmp eq ptr %140, null
  br i1 %141, label %142, label %143

142:                                              ; preds = %135
  call void @perror(ptr noundef @.str.7)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

143:                                              ; preds = %135
  %144 = load ptr, ptr %9, align 8, !tbaa !9
  %145 = call i32 @fclose(ptr noundef %144)
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %146

146:                                              ; preds = %158, %143
  %147 = load i64, ptr %10, align 8, !tbaa !11
  %148 = load i64, ptr %11, align 8, !tbaa !11
  %149 = icmp slt i64 %147, %148
  br i1 %149, label %150, label %161

150:                                              ; preds = %146
  %151 = load ptr, ptr %6, align 8, !tbaa !9
  %152 = load ptr, ptr %7, align 8, !tbaa !9
  %153 = load i32, ptr %13, align 4, !tbaa !5
  %154 = call i32 @morphtest(ptr noundef %151, ptr noundef %152, i32 noundef %153)
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %156, label %157

156:                                              ; preds = %150
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

157:                                              ; preds = %150
  br label %158

158:                                              ; preds = %157
  %159 = load i64, ptr %10, align 8, !tbaa !11
  %160 = add nsw i64 %159, 1
  store i64 %160, ptr %10, align 8, !tbaa !11
  br label %146, !llvm.loop !15

161:                                              ; preds = %146
  store i32 0, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %162

162:                                              ; preds = %161, %156, %142, %133, %117, %108, %73
  call void @llvm.lifetime.end.p0(i64 66, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %163 = load i32, ptr %3, align 4
  ret i32 %163
}

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

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

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

declare void @set_seed(i64 noundef) #3

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @usage(ptr noundef) #0

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

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

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

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

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

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

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

declare void @tileset_list_string(ptr noundef, i32 noundef) #3

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

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

declare void @perror(ptr noundef) #3

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

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

declare i32 @fclose(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @morphtest(ptr noundef, ptr noundef, i32 noundef) #0

; 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 "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 = { inlinehint nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

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

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


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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca [4096 x i8], align 16
  %5 = alloca [66 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 231, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 66, ptr nonnull %5) #8
  br label %.outer

.outer:                                           ; preds = %10, %2
  %.037.ph = phi i64 [ %12, %10 ], [ 1, %2 ]
  %.0.ph = phi ptr [ %.0.ph54, %10 ], [ @.str, %2 ]
  br label %.outer53

.outer53:                                         ; preds = %.outer, %8
  %.0.ph54 = phi ptr [ %.0.ph, %.outer ], [ %9, %8 ]
  br label %6

6:                                                ; preds = %.backedge, %.outer53
  %7 = call i32 @__posix_getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.1) #8
  switch i32 %7, label %23 [
    i32 -1, label %25
    i32 100, label %8
    i32 110, label %10
    i32 115, label %13
    i32 116, label %16
  ]

8:                                                ; preds = %6
  %9 = load ptr, ptr @optarg, align 8, !tbaa !9
  br label %.outer53, !llvm.loop !11

10:                                               ; preds = %6
  %11 = load ptr, ptr @optarg, align 8, !tbaa !9
  %12 = call i64 @strtol(ptr nocapture noundef %11, ptr noundef null, i32 noundef 0) #8
  br label %.outer, !llvm.loop !11

13:                                               ; preds = %6
  %14 = load ptr, ptr @optarg, align 8, !tbaa !9
  %15 = call i64 @strtoll(ptr nocapture noundef %14, ptr noundef null, i32 noundef 0) #8
  call void @set_seed(i64 noundef %15) #8
  br label %.backedge

16:                                               ; preds = %6
  %17 = load ptr, ptr @optarg, align 8, !tbaa !9
  %18 = call i32 @tileset_parse(ptr noundef nonnull %3, ptr noundef %17) #8
  %.not48 = icmp eq i32 %18, 0
  br i1 %.not48, label %.backedge, label %19

.backedge:                                        ; preds = %16, %19, %23, %13
  br label %6, !llvm.loop !11

19:                                               ; preds = %16
  %20 = load ptr, ptr @optarg, align 8, !tbaa !9
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %20)
  %22 = load ptr, ptr %1, align 8, !tbaa !9
  call void @usage(ptr noundef %22)
  br label %.backedge

23:                                               ; preds = %6
  %24 = load ptr, ptr %1, align 8, !tbaa !9
  call void @usage(ptr noundef %24)
  br label %.backedge

25:                                               ; preds = %6
  %26 = load i32, ptr @optind, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %.not44 = icmp eq i32 %27, %0
  br i1 %.not44, label %30, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %1, align 8, !tbaa !9
  call void @usage(ptr noundef %29)
  %.pre = load i32, ptr @optind, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %28, %25
  %31 = phi i32 [ %.pre, %28 ], [ %26, %25 ]
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds ptr, ptr %1, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = call i32 @atoi(ptr nocapture noundef %34) #9
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = call i32 @is_admissible_morphism(i32 noundef %36, i32 noundef %35) #8
  %.not45 = icmp eq i32 %37, 0
  br i1 %.not45, label %38, label %40

38:                                               ; preds = %30
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %35)
  br label %.loopexit

40:                                               ; preds = %30
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = call i32 @tileset_has(i32 noundef %41, i32 noundef 0)
  %.not46 = icmp eq i32 %42, 0
  br i1 %.not46, label %._crit_edge, label %43

._crit_edge:                                      ; preds = %40
  %.pre52 = load i32, ptr %3, align 4, !tbaa !5
  br label %47

43:                                               ; preds = %40
  %44 = call i32 @tileset_add(i32 noundef 0, i32 noundef 0)
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = call i32 @tileset_remove(i32 noundef %45, i32 noundef 0)
  store i32 %46, ptr %3, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %._crit_edge, %43
  %48 = phi i32 [ %46, %43 ], [ %.pre52, %._crit_edge ]
  %.034 = phi i32 [ %44, %43 ], [ 0, %._crit_edge ]
  %49 = call i32 @tileset_morph(i32 noundef %48, i32 noundef %35) #8
  %50 = call i32 @tileset_remove(i32 noundef %49, i32 noundef 0)
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = call i32 @tileset_union(i32 noundef %51, i32 noundef %.034)
  store i32 %52, ptr %3, align 4, !tbaa !5
  %53 = call i32 @tileset_union(i32 noundef %50, i32 noundef %.034)
  %54 = load i32, ptr %3, align 4, !tbaa !5
  call void @tileset_list_string(ptr noundef nonnull %5, i32 noundef %54) #8
  %55 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 4096, ptr noundef nonnull @.str.4, ptr noundef %.0.ph54, ptr noundef nonnull %5) #8
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef nonnull %4)
  %57 = call noalias ptr @fopen(ptr noundef nonnull %4, ptr noundef nonnull @.str.6)
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %47
  call void @perror(ptr noundef nonnull %4) #10
  br label %.loopexit

60:                                               ; preds = %47
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = call i32 @fileno(ptr noundef nonnull %57) #8
  %63 = call ptr @pdb_mmap(i32 noundef %61, i32 noundef %62, i32 noundef 0) #8
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %66

65:                                               ; preds = %60
  call void @perror(ptr noundef nonnull @.str.7) #10
  br label %.loopexit

66:                                               ; preds = %60
  %67 = call i32 @fclose(ptr noundef nonnull %57)
  call void @tileset_list_string(ptr noundef nonnull %5, i32 noundef %53) #8
  %68 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 4096, ptr noundef nonnull @.str.4, ptr noundef %.0.ph54, ptr noundef nonnull %5) #8
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %4)
  %70 = call noalias ptr @fopen(ptr noundef nonnull %4, ptr noundef nonnull @.str.6)
  %71 = icmp eq ptr %70, null
  br i1 %71, label %72, label %73

72:                                               ; preds = %66
  call void @perror(ptr noundef nonnull %4) #10
  br label %.loopexit

73:                                               ; preds = %66
  %74 = call i32 @fileno(ptr noundef nonnull %70) #8
  %75 = call ptr @pdb_mmap(i32 noundef %53, i32 noundef %74, i32 noundef 0) #8
  %76 = icmp eq ptr %75, null
  br i1 %76, label %77, label %78

77:                                               ; preds = %73
  call void @perror(ptr noundef nonnull @.str.7) #10
  br label %.loopexit

78:                                               ; preds = %73
  %79 = call i32 @fclose(ptr noundef nonnull %70)
  %80 = icmp sgt i64 %.037.ph, 0
  br i1 %80, label %.lr.ph, label %.loopexit

81:                                               ; preds = %.lr.ph
  %82 = add nuw nsw i64 %.03649, 1
  %exitcond.not = icmp eq i64 %82, %.037.ph
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !13

.lr.ph:                                           ; preds = %78, %81
  %.03649 = phi i64 [ %82, %81 ], [ 0, %78 ]
  %83 = call i32 @morphtest(ptr noundef nonnull %63, ptr noundef nonnull %75, i32 noundef %35)
  %.not47 = icmp eq i32 %83, 0
  br i1 %.not47, label %81, label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %81, %78, %77, %72, %65, %59, %38
  %.035 = phi i32 [ 1, %59 ], [ 1, %65 ], [ 1, %72 ], [ 1, %77 ], [ 1, %38 ], [ 0, %78 ], [ 1, %.lr.ph ], [ 0, %81 ]
  call void @llvm.lifetime.end.p0(i64 66, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  ret i32 %.035
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3

declare void @set_seed(i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtoll(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
declare hidden void @usage(ptr noundef) local_unnamed_addr #0

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

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

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

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

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

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

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

declare void @tileset_list_string(ptr noundef, i32 noundef) local_unnamed_addr #4

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

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

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

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

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

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

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

; 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 = { 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { cold }

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

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


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