; LLVM IR from clausecker/24puzzle :: cmd (pdbsearch)

; 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.fsm = type { [25 x i32], [25 x ptr], [25 x ptr] }
%struct.path = type { i64, [256 x i8] }
%struct.puzzle = type { [25 x i8], [7 x i8], [25 x i8], [7 x i8] }

@fsm_simple = external constant %struct.fsm, align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@optarg = external global ptr, align 8
@pdb_jobs = external global i32, align 4
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@optind = external global i32, align 4
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@stdin = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 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 %struct.path, align 8
  %9 = alloca %struct.puzzle, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca [1024 x i8], align 16
  %16 = alloca [768 x i8], align 16
  %17 = alloca ptr, align 8
  %18 = 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) #5
  store ptr @fsm_simple, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 264, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 2, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 768, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store ptr null, ptr %17, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %71, %2
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = call i32 @__posix_getopt(i32 noundef %20, ptr noundef %21, ptr noundef @.str) #5
  store i32 %22, ptr %11, align 4, !tbaa !5
  %23 = load i32, ptr %11, align 4, !tbaa !5
  %24 = icmp ne i32 %23, -1
  br i1 %24, label %25, label %72

25:                                               ; preds = %19
  %26 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %26, label %67 [
    i32 70, label %27
    i32 100, label %30
    i32 105, label %32
    i32 106, label %35
    i32 109, label %47
    i32 116, label %66
  ]

27:                                               ; preds = %25
  %28 = load i32, ptr %13, align 4, !tbaa !5
  %29 = or i32 %28, 1
  store i32 %29, ptr %13, align 4, !tbaa !5
  br label %71

30:                                               ; preds = %25
  %31 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %31, ptr %17, align 8, !tbaa !9
  br label %71

32:                                               ; preds = %25
  %33 = load i32, ptr %12, align 4, !tbaa !5
  %34 = or i32 %33, 1
  store i32 %34, ptr %12, align 4, !tbaa !5
  br label %71

35:                                               ; preds = %25
  %36 = load ptr, ptr @optarg, align 8, !tbaa !9
  %37 = call i32 @atoi(ptr noundef %36) #6
  store i32 %37, ptr @pdb_jobs, align 4, !tbaa !5
  %38 = load i32, ptr @pdb_jobs, align 4, !tbaa !5
  %39 = icmp slt i32 %38, 1
  br i1 %39, label %43, label %40

40:                                               ; preds = %35
  %41 = load i32, ptr @pdb_jobs, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 256
  br i1 %42, label %43, label %46

43:                                               ; preds = %40, %35
  %44 = load ptr, ptr @stderr, align 8, !tbaa !9
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.1, i32 noundef 256) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %137

46:                                               ; preds = %40
  br label %71

47:                                               ; preds = %25
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = load ptr, ptr @optarg, align 8, !tbaa !9
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.2, ptr noundef %49) #5
  %51 = load ptr, ptr @optarg, align 8, !tbaa !9
  %52 = call noalias ptr @fopen(ptr noundef %51, ptr noundef @.str.3)
  store ptr %52, ptr %10, align 8, !tbaa !9
  %53 = load ptr, ptr %10, align 8, !tbaa !9
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %57

55:                                               ; preds = %47
  %56 = load ptr, ptr @optarg, align 8, !tbaa !9
  call void @perror(ptr noundef %56)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %137

57:                                               ; preds = %47
  %58 = load ptr, ptr %10, align 8, !tbaa !9
  %59 = call ptr @fsm_load(ptr noundef %58)
  store ptr %59, ptr %6, align 8, !tbaa !9
  %60 = load ptr, ptr %6, align 8, !tbaa !9
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %63

62:                                               ; preds = %57
  call void @perror(ptr noundef @.str.4)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %137

63:                                               ; preds = %57
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = call i32 @fclose(ptr noundef %64)
  br label %71

66:                                               ; preds = %25
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %71

67:                                               ; preds = %25
  %68 = load ptr, ptr %5, align 8, !tbaa !9
  %69 = getelementptr inbounds ptr, ptr %68, i64 0
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  call void @usage(ptr noundef %70)
  br label %71

71:                                               ; preds = %67, %66, %63, %46, %32, %30, %27
  br label %19, !llvm.loop !11

72:                                               ; preds = %19
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = load i32, ptr @optind, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  %76 = icmp ne i32 %73, %75
  br i1 %76, label %77, label %81

77:                                               ; preds = %72
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = getelementptr inbounds ptr, ptr %78, i64 0
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  call void @usage(ptr noundef %80)
  br label %81

81:                                               ; preds = %77, %72
  %82 = load ptr, ptr %5, align 8, !tbaa !9
  %83 = load i32, ptr @optind, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds ptr, ptr %82, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  %87 = load ptr, ptr %17, align 8, !tbaa !9
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = load ptr, ptr @stderr, align 8, !tbaa !9
  %90 = call ptr @catalogue_load(ptr noundef %86, ptr noundef %87, i32 noundef %88, ptr noundef %89)
  store ptr %90, ptr %7, align 8, !tbaa !9
  %91 = load ptr, ptr %7, align 8, !tbaa !9
  %92 = icmp eq ptr %91, null
  br i1 %92, label %93, label %94

93:                                               ; preds = %81
  call void @perror(ptr noundef @.str.5)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %137

94:                                               ; preds = %81
  %95 = load i32, ptr %14, align 4, !tbaa !5
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %104

97:                                               ; preds = %94
  %98 = load ptr, ptr %7, align 8, !tbaa !9
  %99 = call i32 @catalogue_add_transpositions(ptr noundef %98)
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %97
  call void @perror(ptr noundef @.str.6)
  %102 = load ptr, ptr @stderr, align 8, !tbaa !9
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef @.str.7) #5
  br label %104

104:                                              ; preds = %101, %97, %94
  br label %105

105:                                              ; preds = %127, %125, %121, %104
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %107 = getelementptr inbounds [1024 x i8], ptr %15, i64 0, i64 0
  %108 = load ptr, ptr @stdin, align 8, !tbaa !9
  %109 = call ptr @fgets(ptr noundef %107, i32 noundef 1024, ptr noundef %108)
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %117

111:                                              ; preds = %105
  %112 = load ptr, ptr @stdin, align 8, !tbaa !9
  %113 = call i32 @ferror(ptr noundef %112) #5
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %111
  call void @perror(ptr noundef @.str.9)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %137

116:                                              ; preds = %111
  store i32 0, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %137

117:                                              ; preds = %105
  %118 = getelementptr inbounds [1024 x i8], ptr %15, i64 0, i64 0
  %119 = call i32 @puzzle_parse(ptr noundef %9, ptr noundef %118)
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %122

121:                                              ; preds = %117
  br label %105

122:                                              ; preds = %117
  %123 = call i32 @puzzle_parity(ptr noundef %9)
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %122
  %126 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %105

127:                                              ; preds = %122
  %128 = load ptr, ptr @stderr, align 8, !tbaa !9
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str.11) #5
  %130 = load ptr, ptr %7, align 8, !tbaa !9
  %131 = load ptr, ptr %6, align 8, !tbaa !9
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = call i64 @search_ida(ptr noundef %130, ptr noundef %131, ptr noundef %9, ptr noundef %8, ptr noundef null, ptr noundef null, i32 noundef %132)
  %134 = getelementptr inbounds [768 x i8], ptr %16, i64 0, i64 0
  call void @path_string(ptr noundef %134, ptr noundef %8)
  %135 = getelementptr inbounds [768 x i8], ptr %16, i64 0, i64 0
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %135)
  br label %105

137:                                              ; preds = %116, %115, %93, %62, %55, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 768, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 264, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %138 = load i32, ptr %3, align 4
  ret i32 %138
}

; 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: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

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

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

declare void @perror(ptr noundef) #4

declare ptr @fsm_load(ptr noundef) #4

declare i32 @fclose(ptr noundef) #4

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

declare ptr @catalogue_load(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare i32 @catalogue_add_transpositions(ptr noundef) #4

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

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #4

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

declare i32 @puzzle_parse(ptr noundef, ptr noundef) #4

declare i32 @puzzle_parity(ptr noundef) #4

declare i64 @search_ida(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

declare void @path_string(ptr noundef, ptr noundef) #4

; 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 = { 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 #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 = { nounwind }
attributes #6 = { 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 = distinct !{!11, !12}
!12 = !{!"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.fsm = type { [25 x i32], [25 x ptr], [25 x ptr] }
%struct.path = type { i64, [256 x i8] }
%struct.puzzle = type { [25 x i8], [7 x i8], [25 x i8], [7 x i8] }

@fsm_simple = external constant %struct.fsm, align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@pdb_jobs = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 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 %struct.path, align 8
  %4 = alloca %struct.puzzle, align 8
  %5 = alloca [1024 x i8], align 16
  %6 = alloca [768 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 264, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %6) #7
  br label %.outer

.outer:                                           ; preds = %32, %2
  %.030.ph = phi ptr [ %29, %32 ], [ @fsm_simple, %2 ]
  %.027.ph = phi i32 [ %.027.ph103, %32 ], [ 0, %2 ]
  %.025.ph = phi i32 [ %.025.ph108, %32 ], [ 2, %2 ]
  %.023.ph = phi i32 [ %.023.ph112, %32 ], [ 0, %2 ]
  %.0.ph = phi ptr [ %.0.ph115, %32 ], [ null, %2 ]
  br label %.outer102

.outer102:                                        ; preds = %.outer, %11
  %.027.ph103 = phi i32 [ %.027.ph, %.outer ], [ 1, %11 ]
  %.025.ph104 = phi i32 [ %.025.ph, %.outer ], [ %.025.ph108, %11 ]
  %.023.ph105 = phi i32 [ %.023.ph, %.outer ], [ %.023.ph112, %11 ]
  %.0.ph106 = phi ptr [ %.0.ph, %.outer ], [ %.0.ph115, %11 ]
  br label %.outer107

.outer107:                                        ; preds = %7, %.outer102
  %.025.ph108 = phi i32 [ %.025.ph104, %.outer102 ], [ 3, %7 ]
  %.023.ph109 = phi i32 [ %.023.ph105, %.outer102 ], [ %.023.ph112, %7 ]
  %.0.ph110 = phi ptr [ %.0.ph106, %.outer102 ], [ %.0.ph115, %7 ]
  br label %.outer111

.outer111:                                        ; preds = %.outer107, %34
  %.023.ph112 = phi i32 [ %.023.ph109, %.outer107 ], [ 1, %34 ]
  %.0.ph113 = phi ptr [ %.0.ph110, %.outer107 ], [ %.0.ph115, %34 ]
  br label %.outer114

.outer114:                                        ; preds = %.outer111, %9
  %.0.ph115 = phi ptr [ %.0.ph113, %.outer111 ], [ %10, %9 ]
  br label %7

7:                                                ; preds = %.backedge116, %.outer114
  %8 = tail call i32 @__posix_getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #7
  switch i32 %8, label %35 [
    i32 -1, label %37
    i32 70, label %.outer107
    i32 100, label %9
    i32 105, label %11
    i32 106, label %12
    i32 109, label %19
    i32 116, label %34
  ], !llvm.loop !5

9:                                                ; preds = %7
  %10 = load ptr, ptr @optarg, align 8, !tbaa !7
  br label %.outer114, !llvm.loop !5

11:                                               ; preds = %7
  br label %.outer102, !llvm.loop !5

12:                                               ; preds = %7
  %13 = load ptr, ptr @optarg, align 8, !tbaa !7
  %14 = tail call i32 @atoi(ptr nocapture noundef %13) #8
  store i32 %14, ptr @pdb_jobs, align 4, !tbaa !11
  %15 = add i32 %14, -257
  %or.cond = icmp ult i32 %15, -256
  br i1 %or.cond, label %16, label %.backedge116

.backedge116:                                     ; preds = %12, %35
  br label %7, !llvm.loop !5

16:                                               ; preds = %12
  %17 = load ptr, ptr @stderr, align 8, !tbaa !7
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.1, i32 noundef 256) #9
  br label %79

19:                                               ; preds = %7
  %20 = load ptr, ptr @stderr, align 8, !tbaa !7
  %21 = load ptr, ptr @optarg, align 8, !tbaa !7
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.2, ptr noundef %21) #9
  %23 = load ptr, ptr @optarg, align 8, !tbaa !7
  %24 = tail call noalias ptr @fopen(ptr noundef %23, ptr noundef nonnull @.str.3)
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %28

26:                                               ; preds = %19
  %27 = load ptr, ptr @optarg, align 8, !tbaa !7
  tail call void @perror(ptr noundef %27) #10
  br label %79

28:                                               ; preds = %19
  %29 = tail call ptr @fsm_load(ptr noundef nonnull %24) #7
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  tail call void @perror(ptr noundef nonnull @.str.4) #10
  br label %79

32:                                               ; preds = %28
  %33 = tail call i32 @fclose(ptr noundef nonnull %24)
  br label %.outer, !llvm.loop !5

34:                                               ; preds = %7
  br label %.outer111, !llvm.loop !5

35:                                               ; preds = %7
  %36 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %36)
  br label %.backedge116

37:                                               ; preds = %7
  %38 = load i32, ptr @optind, align 4, !tbaa !11
  %39 = add nsw i32 %38, 1
  %.not36 = icmp eq i32 %39, %0
  br i1 %.not36, label %42, label %40

40:                                               ; preds = %37
  %41 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %41)
  %.pre = load i32, ptr @optind, align 4, !tbaa !11
  br label %42

42:                                               ; preds = %40, %37
  %43 = phi i32 [ %.pre, %40 ], [ %38, %37 ]
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds ptr, ptr %1, i64 %44
  %46 = load ptr, ptr %45, align 8, !tbaa !7
  %47 = load ptr, ptr @stderr, align 8, !tbaa !7
  %48 = tail call ptr @catalogue_load(ptr noundef %46, ptr noundef %.0.ph115, i32 noundef %.027.ph103, ptr noundef %47) #7
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  tail call void @perror(ptr noundef nonnull @.str.5) #10
  br label %79

51:                                               ; preds = %42
  %.not37 = icmp eq i32 %.023.ph112, 0
  br i1 %.not37, label %57, label %52

52:                                               ; preds = %51
  %53 = tail call i32 @catalogue_add_transpositions(ptr noundef nonnull %48) #7
  %.not38 = icmp eq i32 %53, 0
  br i1 %.not38, label %57, label %54

54:                                               ; preds = %52
  tail call void @perror(ptr noundef nonnull @.str.6) #10
  %55 = load ptr, ptr @stderr, align 8, !tbaa !7
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.7) #9
  br label %57

57:                                               ; preds = %54, %52, %51
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %59 = load ptr, ptr @stdin, align 8, !tbaa !7
  %60 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 1024, ptr noundef %59)
  %61 = icmp eq ptr %60, null
  br i1 %61, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.backedge, %57
  %62 = load ptr, ptr @stdin, align 8, !tbaa !7
  %63 = call i32 @ferror(ptr noundef %62) #7
  %.not41 = icmp eq i32 %63, 0
  br i1 %.not41, label %79, label %64

64:                                               ; preds = %._crit_edge
  call void @perror(ptr noundef nonnull @.str.9) #10
  br label %79

.lr.ph:                                           ; preds = %57, %.backedge
  %65 = call i32 @puzzle_parse(ptr noundef nonnull %4, ptr noundef nonnull %5) #7
  %.not39 = icmp eq i32 %65, 0
  br i1 %.not39, label %66, label %.backedge

66:                                               ; preds = %.lr.ph
  %67 = call i32 @puzzle_parity(ptr noundef nonnull %4) #7
  %.not40 = icmp eq i32 %67, 0
  br i1 %.not40, label %74, label %68

68:                                               ; preds = %66
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %.backedge

.backedge:                                        ; preds = %68, %74, %.lr.ph
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %71 = load ptr, ptr @stdin, align 8, !tbaa !7
  %72 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 1024, ptr noundef %71)
  %73 = icmp eq ptr %72, null
  br i1 %73, label %._crit_edge, label %.lr.ph

74:                                               ; preds = %66
  %75 = load ptr, ptr @stderr, align 8, !tbaa !7
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str.11) #9
  %77 = call i64 @search_ida(ptr noundef nonnull %48, ptr noundef nonnull %.030.ph, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef null, ptr noundef null, i32 noundef %.025.ph108) #7
  call void @path_string(ptr noundef nonnull %6, ptr noundef nonnull %3) #7
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef nonnull %6)
  br label %.backedge

79:                                               ; preds = %._crit_edge, %64, %50, %31, %26, %16
  %.029 = phi i32 [ 1, %26 ], [ 1, %31 ], [ 1, %16 ], [ 1, %50 ], [ 1, %64 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 264, ptr nonnull %3) #7
  ret i32 %.029
}

; 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: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

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

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

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

declare ptr @fsm_load(ptr noundef) local_unnamed_addr #5

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

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

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

declare i32 @catalogue_add_transpositions(ptr noundef) local_unnamed_addr #5

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

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4

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

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

declare i32 @puzzle_parity(ptr noundef) local_unnamed_addr #5

declare i64 @search_ida(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare void @path_string(ptr noundef, ptr noundef) local_unnamed_addr #5

; 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 = { 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 #4 = { 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 #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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { cold nounwind }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}


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