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

; 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.fsmfile = type { [25 x i64], [25 x i32] }

@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@optind = external global i32, align 4
@stdout = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.fsm, align 8
  %8 = alloca %struct.fsmfile, 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
  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) #7
  call void @llvm.lifetime.start.p0(i64 504, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 304, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %33, %2
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = call i32 @__posix_getopt(i32 noundef %15, ptr noundef %16, ptr noundef @.str.2) #7
  store i32 %17, ptr %10, align 4, !tbaa !5
  %18 = load i32, ptr %10, align 4, !tbaa !5
  %19 = icmp ne i32 %18, -1
  br i1 %19, label %20, label %34

20:                                               ; preds = %14
  %21 = load i32, ptr %10, align 4, !tbaa !5
  switch i32 %21, label %29 [
    i32 97, label %22
    i32 109, label %23
    i32 118, label %26
  ]

22:                                               ; preds = %20
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %33

23:                                               ; preds = %20
  %24 = load i32, ptr %11, align 4, !tbaa !5
  %25 = or i32 %24, 2
  store i32 %25, ptr %11, align 4, !tbaa !5
  br label %33

26:                                               ; preds = %20
  %27 = load i32, ptr %11, align 4, !tbaa !5
  %28 = or i32 %27, 1
  store i32 %28, ptr %11, align 4, !tbaa !5
  br label %33

29:                                               ; preds = %20
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 0
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  call void @usage(ptr noundef %32) #8
  unreachable

33:                                               ; preds = %26, %23, %22
  br label %14, !llvm.loop !11

34:                                               ; preds = %14
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = load i32, ptr @optind, align 4, !tbaa !5
  %37 = sub nsw i32 %35, %36
  switch i32 %37, label %56 [
    i32 0, label %38
    i32 1, label %40
  ]

38:                                               ; preds = %34
  %39 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %39, ptr %6, align 8, !tbaa !9
  br label %60

40:                                               ; preds = %34
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = load i32, ptr @optind, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds ptr, ptr %41, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = call noalias ptr @fopen(ptr noundef %45, ptr noundef @.str.3)
  store ptr %46, ptr %6, align 8, !tbaa !9
  %47 = load ptr, ptr %6, align 8, !tbaa !9
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %55

49:                                               ; preds = %40
  %50 = load ptr, ptr %5, align 8, !tbaa !9
  %51 = load i32, ptr @optind, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds ptr, ptr %50, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  call void @perror(ptr noundef %54)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %117

55:                                               ; preds = %40
  br label %60

56:                                               ; preds = %34
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = getelementptr inbounds ptr, ptr %57, i64 0
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  call void @usage(ptr noundef %59) #8
  unreachable

60:                                               ; preds = %55, %38
  call void @initfsm(ptr noundef %7, ptr noundef %8)
  %61 = load ptr, ptr @stdin, align 8, !tbaa !9
  %62 = load i32, ptr %12, align 4, !tbaa !5
  call void @readloops(ptr noundef %7, ptr noundef %8, ptr noundef %61, i32 noundef %62)
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = and i32 %63, 1
  call void @addbackedges(ptr noundef %7, i32 noundef %64)
  %65 = load i32, ptr %11, align 4, !tbaa !5
  %66 = and i32 %65, 2
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %110

68:                                               ; preds = %60
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %105, %68
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = icmp slt i32 %70, 25
  br i1 %71, label %72, label %108

72:                                               ; preds = %69
  %73 = getelementptr inbounds %struct.fsm, ptr %7, i32 0, i32 0
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [25 x i32], ptr %73, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = zext i32 %77 to i64
  %79 = mul i64 %78, 1
  %80 = call noalias ptr @malloc(i64 noundef %79) #9
  %81 = getelementptr inbounds %struct.fsm, ptr %7, i32 0, i32 2
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [25 x ptr], ptr %81, i64 0, i64 %83
  store ptr %80, ptr %84, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.fsm, ptr %7, i32 0, i32 2
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [25 x ptr], ptr %85, i64 0, i64 %87
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %92

91:                                               ; preds = %72
  call void @perror(ptr noundef @.str.4)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %117

92:                                               ; preds = %72
  %93 = getelementptr inbounds %struct.fsm, ptr %7, i32 0, i32 2
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [25 x ptr], ptr %93, i64 0, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.fsm, ptr %7, i32 0, i32 0
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [25 x i32], ptr %98, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = zext i32 %102 to i64
  %104 = mul i64 %103, 1
  call void @llvm.memset.p0.i64(ptr align 1 %97, i8 -1, i64 %104, i1 false)
  br label %105

105:                                              ; preds = %92
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %9, align 4, !tbaa !5
  br label %69, !llvm.loop !13

108:                                              ; preds = %69
  %109 = load i32, ptr %11, align 4, !tbaa !5
  call void @fsm_add_moribund(ptr noundef %7, i32 noundef %109)
  br label %110

110:                                              ; preds = %108, %60
  %111 = load ptr, ptr %6, align 8, !tbaa !9
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = call i32 @fsm_write(ptr noundef %111, ptr noundef %7, i32 noundef %112)
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %116

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

116:                                              ; preds = %110
  store i32 0, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %117

117:                                              ; preds = %116, %115, %91, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 304, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 504, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %118 = load i32, ptr %3, align 4
  ret i32 %118
}

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

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

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

declare void @perror(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden void @initfsm(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @readloops(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @addbackedges(ptr noundef, i32 noundef) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare void @fsm_add_moribund(ptr noundef, i32 noundef) #4

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

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

!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}


; 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.fsmfile = type { [25 x i64], [25 x i32] }

@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@stdout = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca %struct.fsm, align 8
  %4 = alloca %struct.fsmfile, align 8
  call void @llvm.lifetime.start.p0(i64 504, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 304, ptr nonnull %4) #8
  br label %.outer

.outer:                                           ; preds = %.outer.backedge, %2
  %.025.ph = phi i32 [ 0, %2 ], [ %.025.ph.be, %.outer.backedge ]
  %.0.ph = phi i32 [ 0, %2 ], [ %.048, %.outer.backedge ]
  %5 = tail call i32 @__posix_getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.2) #8
  switch i32 %5, label %.loopexit [
    i32 -1, label %.loopexit51
    i32 97, label %.outer.peel.newph
    i32 109, label %.loopexit52
    i32 118, label %.loopexit53
  ]

.outer.peel.newph:                                ; preds = %.outer, %.outer.peel.newph
  %6 = tail call i32 @__posix_getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.2) #8
  switch i32 %6, label %.loopexit [
    i32 -1, label %.loopexit51
    i32 97, label %.outer.peel.newph
    i32 109, label %.loopexit52
    i32 118, label %.loopexit53
  ], !llvm.loop !5

.loopexit52:                                      ; preds = %.outer.peel.newph, %.outer
  %.0.lcssa46 = phi i32 [ %.0.ph, %.outer ], [ 1, %.outer.peel.newph ]
  %7 = or i32 %.025.ph, 2
  br label %.outer.backedge

.loopexit53:                                      ; preds = %.outer.peel.newph, %.outer
  %.0.lcssa47 = phi i32 [ %.0.ph, %.outer ], [ 1, %.outer.peel.newph ]
  %8 = or i32 %.025.ph, 1
  br label %.outer.backedge

.outer.backedge:                                  ; preds = %.loopexit53, %.loopexit52
  %.048 = phi i32 [ %.0.lcssa46, %.loopexit52 ], [ %.0.lcssa47, %.loopexit53 ]
  %.025.ph.be = phi i32 [ %7, %.loopexit52 ], [ %8, %.loopexit53 ]
  br label %.outer, !llvm.loop !8

.loopexit:                                        ; preds = %.outer, %.outer.peel.newph
  %9 = load ptr, ptr %1, align 8, !tbaa !9
  tail call void @usage(ptr noundef %9) #9
  unreachable

.loopexit51:                                      ; preds = %.outer, %.outer.peel.newph
  %.0.lcssa45 = phi i32 [ 1, %.outer.peel.newph ], [ %.0.ph, %.outer ]
  %10 = load i32, ptr @optind, align 4, !tbaa !13
  %11 = sub nsw i32 %0, %10
  switch i32 %11, label %25 [
    i32 0, label %12
    i32 1, label %14
  ]

12:                                               ; preds = %.loopexit51
  %13 = load ptr, ptr @stdout, align 8, !tbaa !9
  br label %27

14:                                               ; preds = %.loopexit51
  %15 = sext i32 %10 to i64
  %16 = getelementptr inbounds ptr, ptr %1, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = tail call noalias ptr @fopen(ptr noundef %17, ptr noundef nonnull @.str.3)
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %27

20:                                               ; preds = %14
  %21 = load i32, ptr @optind, align 4, !tbaa !13
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds ptr, ptr %1, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  tail call void @perror(ptr noundef %24) #10
  br label %209

25:                                               ; preds = %.loopexit51
  %26 = load ptr, ptr %1, align 8, !tbaa !9
  tail call void @usage(ptr noundef %26) #9
  unreachable

27:                                               ; preds = %14, %12
  %.029 = phi ptr [ %18, %14 ], [ %13, %12 ]
  call void @initfsm(ptr noundef nonnull %3, ptr noundef nonnull %4)
  %28 = load ptr, ptr @stdin, align 8, !tbaa !9
  call void @readloops(ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %28, i32 noundef %.0.lcssa45)
  %29 = and i32 %.025.ph, 1
  call void @addbackedges(ptr noundef nonnull %3, i32 noundef %29)
  %30 = and i32 %.025.ph, 2
  %.not33 = icmp eq i32 %30, 0
  br i1 %.not33, label %206, label %.preheader

.preheader:                                       ; preds = %27
  %31 = getelementptr inbounds i8, ptr %3, i64 304
  %32 = load i32, ptr %3, align 8, !tbaa !13
  %33 = zext i32 %32 to i64
  %34 = call noalias ptr @malloc(i64 noundef %33) #11
  store ptr %34, ptr %31, align 8, !tbaa !9
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %37

36:                                               ; preds = %198, %191, %184, %177, %170, %163, %156, %149, %142, %135, %128, %121, %114, %107, %100, %93, %86, %79, %72, %65, %58, %51, %44, %37, %.preheader
  call void @perror(ptr noundef nonnull @.str.4) #10
  br label %209

37:                                               ; preds = %.preheader
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %34, i8 -1, i64 %33, i1 false)
  %38 = getelementptr inbounds i8, ptr %3, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !13
  %40 = zext i32 %39 to i64
  %41 = call noalias ptr @malloc(i64 noundef %40) #11
  %42 = getelementptr inbounds i8, ptr %3, i64 312
  store ptr %41, ptr %42, align 8, !tbaa !9
  %43 = icmp eq ptr %41, null
  br i1 %43, label %36, label %44

44:                                               ; preds = %37
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %41, i8 -1, i64 %40, i1 false)
  %45 = getelementptr inbounds i8, ptr %3, i64 8
  %46 = load i32, ptr %45, align 8, !tbaa !13
  %47 = zext i32 %46 to i64
  %48 = call noalias ptr @malloc(i64 noundef %47) #11
  %49 = getelementptr inbounds i8, ptr %3, i64 320
  store ptr %48, ptr %49, align 8, !tbaa !9
  %50 = icmp eq ptr %48, null
  br i1 %50, label %36, label %51

51:                                               ; preds = %44
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %48, i8 -1, i64 %47, i1 false)
  %52 = getelementptr inbounds i8, ptr %3, i64 12
  %53 = load i32, ptr %52, align 4, !tbaa !13
  %54 = zext i32 %53 to i64
  %55 = call noalias ptr @malloc(i64 noundef %54) #11
  %56 = getelementptr inbounds i8, ptr %3, i64 328
  store ptr %55, ptr %56, align 8, !tbaa !9
  %57 = icmp eq ptr %55, null
  br i1 %57, label %36, label %58

58:                                               ; preds = %51
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %55, i8 -1, i64 %54, i1 false)
  %59 = getelementptr inbounds i8, ptr %3, i64 16
  %60 = load i32, ptr %59, align 8, !tbaa !13
  %61 = zext i32 %60 to i64
  %62 = call noalias ptr @malloc(i64 noundef %61) #11
  %63 = getelementptr inbounds i8, ptr %3, i64 336
  store ptr %62, ptr %63, align 8, !tbaa !9
  %64 = icmp eq ptr %62, null
  br i1 %64, label %36, label %65

65:                                               ; preds = %58
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %62, i8 -1, i64 %61, i1 false)
  %66 = getelementptr inbounds i8, ptr %3, i64 20
  %67 = load i32, ptr %66, align 4, !tbaa !13
  %68 = zext i32 %67 to i64
  %69 = call noalias ptr @malloc(i64 noundef %68) #11
  %70 = getelementptr inbounds i8, ptr %3, i64 344
  store ptr %69, ptr %70, align 8, !tbaa !9
  %71 = icmp eq ptr %69, null
  br i1 %71, label %36, label %72

72:                                               ; preds = %65
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %69, i8 -1, i64 %68, i1 false)
  %73 = getelementptr inbounds i8, ptr %3, i64 24
  %74 = load i32, ptr %73, align 8, !tbaa !13
  %75 = zext i32 %74 to i64
  %76 = call noalias ptr @malloc(i64 noundef %75) #11
  %77 = getelementptr inbounds i8, ptr %3, i64 352
  store ptr %76, ptr %77, align 8, !tbaa !9
  %78 = icmp eq ptr %76, null
  br i1 %78, label %36, label %79

79:                                               ; preds = %72
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %76, i8 -1, i64 %75, i1 false)
  %80 = getelementptr inbounds i8, ptr %3, i64 28
  %81 = load i32, ptr %80, align 4, !tbaa !13
  %82 = zext i32 %81 to i64
  %83 = call noalias ptr @malloc(i64 noundef %82) #11
  %84 = getelementptr inbounds i8, ptr %3, i64 360
  store ptr %83, ptr %84, align 8, !tbaa !9
  %85 = icmp eq ptr %83, null
  br i1 %85, label %36, label %86

86:                                               ; preds = %79
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %83, i8 -1, i64 %82, i1 false)
  %87 = getelementptr inbounds i8, ptr %3, i64 32
  %88 = load i32, ptr %87, align 8, !tbaa !13
  %89 = zext i32 %88 to i64
  %90 = call noalias ptr @malloc(i64 noundef %89) #11
  %91 = getelementptr inbounds i8, ptr %3, i64 368
  store ptr %90, ptr %91, align 8, !tbaa !9
  %92 = icmp eq ptr %90, null
  br i1 %92, label %36, label %93

93:                                               ; preds = %86
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %90, i8 -1, i64 %89, i1 false)
  %94 = getelementptr inbounds i8, ptr %3, i64 36
  %95 = load i32, ptr %94, align 4, !tbaa !13
  %96 = zext i32 %95 to i64
  %97 = call noalias ptr @malloc(i64 noundef %96) #11
  %98 = getelementptr inbounds i8, ptr %3, i64 376
  store ptr %97, ptr %98, align 8, !tbaa !9
  %99 = icmp eq ptr %97, null
  br i1 %99, label %36, label %100

100:                                              ; preds = %93
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %97, i8 -1, i64 %96, i1 false)
  %101 = getelementptr inbounds i8, ptr %3, i64 40
  %102 = load i32, ptr %101, align 8, !tbaa !13
  %103 = zext i32 %102 to i64
  %104 = call noalias ptr @malloc(i64 noundef %103) #11
  %105 = getelementptr inbounds i8, ptr %3, i64 384
  store ptr %104, ptr %105, align 8, !tbaa !9
  %106 = icmp eq ptr %104, null
  br i1 %106, label %36, label %107

107:                                              ; preds = %100
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %104, i8 -1, i64 %103, i1 false)
  %108 = getelementptr inbounds i8, ptr %3, i64 44
  %109 = load i32, ptr %108, align 4, !tbaa !13
  %110 = zext i32 %109 to i64
  %111 = call noalias ptr @malloc(i64 noundef %110) #11
  %112 = getelementptr inbounds i8, ptr %3, i64 392
  store ptr %111, ptr %112, align 8, !tbaa !9
  %113 = icmp eq ptr %111, null
  br i1 %113, label %36, label %114

114:                                              ; preds = %107
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %111, i8 -1, i64 %110, i1 false)
  %115 = getelementptr inbounds i8, ptr %3, i64 48
  %116 = load i32, ptr %115, align 8, !tbaa !13
  %117 = zext i32 %116 to i64
  %118 = call noalias ptr @malloc(i64 noundef %117) #11
  %119 = getelementptr inbounds i8, ptr %3, i64 400
  store ptr %118, ptr %119, align 8, !tbaa !9
  %120 = icmp eq ptr %118, null
  br i1 %120, label %36, label %121

121:                                              ; preds = %114
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %118, i8 -1, i64 %117, i1 false)
  %122 = getelementptr inbounds i8, ptr %3, i64 52
  %123 = load i32, ptr %122, align 4, !tbaa !13
  %124 = zext i32 %123 to i64
  %125 = call noalias ptr @malloc(i64 noundef %124) #11
  %126 = getelementptr inbounds i8, ptr %3, i64 408
  store ptr %125, ptr %126, align 8, !tbaa !9
  %127 = icmp eq ptr %125, null
  br i1 %127, label %36, label %128

128:                                              ; preds = %121
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %125, i8 -1, i64 %124, i1 false)
  %129 = getelementptr inbounds i8, ptr %3, i64 56
  %130 = load i32, ptr %129, align 8, !tbaa !13
  %131 = zext i32 %130 to i64
  %132 = call noalias ptr @malloc(i64 noundef %131) #11
  %133 = getelementptr inbounds i8, ptr %3, i64 416
  store ptr %132, ptr %133, align 8, !tbaa !9
  %134 = icmp eq ptr %132, null
  br i1 %134, label %36, label %135

135:                                              ; preds = %128
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %132, i8 -1, i64 %131, i1 false)
  %136 = getelementptr inbounds i8, ptr %3, i64 60
  %137 = load i32, ptr %136, align 4, !tbaa !13
  %138 = zext i32 %137 to i64
  %139 = call noalias ptr @malloc(i64 noundef %138) #11
  %140 = getelementptr inbounds i8, ptr %3, i64 424
  store ptr %139, ptr %140, align 8, !tbaa !9
  %141 = icmp eq ptr %139, null
  br i1 %141, label %36, label %142

142:                                              ; preds = %135
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %139, i8 -1, i64 %138, i1 false)
  %143 = getelementptr inbounds i8, ptr %3, i64 64
  %144 = load i32, ptr %143, align 8, !tbaa !13
  %145 = zext i32 %144 to i64
  %146 = call noalias ptr @malloc(i64 noundef %145) #11
  %147 = getelementptr inbounds i8, ptr %3, i64 432
  store ptr %146, ptr %147, align 8, !tbaa !9
  %148 = icmp eq ptr %146, null
  br i1 %148, label %36, label %149

149:                                              ; preds = %142
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %146, i8 -1, i64 %145, i1 false)
  %150 = getelementptr inbounds i8, ptr %3, i64 68
  %151 = load i32, ptr %150, align 4, !tbaa !13
  %152 = zext i32 %151 to i64
  %153 = call noalias ptr @malloc(i64 noundef %152) #11
  %154 = getelementptr inbounds i8, ptr %3, i64 440
  store ptr %153, ptr %154, align 8, !tbaa !9
  %155 = icmp eq ptr %153, null
  br i1 %155, label %36, label %156

156:                                              ; preds = %149
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %153, i8 -1, i64 %152, i1 false)
  %157 = getelementptr inbounds i8, ptr %3, i64 72
  %158 = load i32, ptr %157, align 8, !tbaa !13
  %159 = zext i32 %158 to i64
  %160 = call noalias ptr @malloc(i64 noundef %159) #11
  %161 = getelementptr inbounds i8, ptr %3, i64 448
  store ptr %160, ptr %161, align 8, !tbaa !9
  %162 = icmp eq ptr %160, null
  br i1 %162, label %36, label %163

163:                                              ; preds = %156
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %160, i8 -1, i64 %159, i1 false)
  %164 = getelementptr inbounds i8, ptr %3, i64 76
  %165 = load i32, ptr %164, align 4, !tbaa !13
  %166 = zext i32 %165 to i64
  %167 = call noalias ptr @malloc(i64 noundef %166) #11
  %168 = getelementptr inbounds i8, ptr %3, i64 456
  store ptr %167, ptr %168, align 8, !tbaa !9
  %169 = icmp eq ptr %167, null
  br i1 %169, label %36, label %170

170:                                              ; preds = %163
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %167, i8 -1, i64 %166, i1 false)
  %171 = getelementptr inbounds i8, ptr %3, i64 80
  %172 = load i32, ptr %171, align 8, !tbaa !13
  %173 = zext i32 %172 to i64
  %174 = call noalias ptr @malloc(i64 noundef %173) #11
  %175 = getelementptr inbounds i8, ptr %3, i64 464
  store ptr %174, ptr %175, align 8, !tbaa !9
  %176 = icmp eq ptr %174, null
  br i1 %176, label %36, label %177

177:                                              ; preds = %170
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %174, i8 -1, i64 %173, i1 false)
  %178 = getelementptr inbounds i8, ptr %3, i64 84
  %179 = load i32, ptr %178, align 4, !tbaa !13
  %180 = zext i32 %179 to i64
  %181 = call noalias ptr @malloc(i64 noundef %180) #11
  %182 = getelementptr inbounds i8, ptr %3, i64 472
  store ptr %181, ptr %182, align 8, !tbaa !9
  %183 = icmp eq ptr %181, null
  br i1 %183, label %36, label %184

184:                                              ; preds = %177
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %181, i8 -1, i64 %180, i1 false)
  %185 = getelementptr inbounds i8, ptr %3, i64 88
  %186 = load i32, ptr %185, align 8, !tbaa !13
  %187 = zext i32 %186 to i64
  %188 = call noalias ptr @malloc(i64 noundef %187) #11
  %189 = getelementptr inbounds i8, ptr %3, i64 480
  store ptr %188, ptr %189, align 8, !tbaa !9
  %190 = icmp eq ptr %188, null
  br i1 %190, label %36, label %191

191:                                              ; preds = %184
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %188, i8 -1, i64 %187, i1 false)
  %192 = getelementptr inbounds i8, ptr %3, i64 92
  %193 = load i32, ptr %192, align 4, !tbaa !13
  %194 = zext i32 %193 to i64
  %195 = call noalias ptr @malloc(i64 noundef %194) #11
  %196 = getelementptr inbounds i8, ptr %3, i64 488
  store ptr %195, ptr %196, align 8, !tbaa !9
  %197 = icmp eq ptr %195, null
  br i1 %197, label %36, label %198

198:                                              ; preds = %191
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %195, i8 -1, i64 %194, i1 false)
  %199 = getelementptr inbounds i8, ptr %3, i64 96
  %200 = load i32, ptr %199, align 8, !tbaa !13
  %201 = zext i32 %200 to i64
  %202 = call noalias ptr @malloc(i64 noundef %201) #11
  %203 = getelementptr inbounds i8, ptr %3, i64 496
  store ptr %202, ptr %203, align 8, !tbaa !9
  %204 = icmp eq ptr %202, null
  br i1 %204, label %36, label %205

205:                                              ; preds = %198
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %202, i8 -1, i64 %201, i1 false)
  call void @fsm_add_moribund(ptr noundef nonnull %3, i32 noundef %.025.ph) #8
  br label %206

206:                                              ; preds = %205, %27
  %207 = call i32 @fsm_write(ptr noundef %.029, ptr noundef nonnull %3, i32 noundef %.025.ph) #8
  %.not34 = icmp eq i32 %207, 0
  br i1 %.not34, label %209, label %208

208:                                              ; preds = %206
  call void @perror(ptr noundef nonnull @.str.5) #10
  br label %209

209:                                              ; preds = %206, %208, %36, %20
  %.027 = phi i32 [ 1, %20 ], [ 1, %36 ], [ 1, %208 ], [ 0, %206 ]
  call void @llvm.lifetime.end.p0(i64 304, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 504, ptr nonnull %3) #8
  ret i32 %.027
}

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

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

; 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

; Function Attrs: nounwind uwtable
declare hidden void @initfsm(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @readloops(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @addbackedges(ptr noundef, i32 noundef) local_unnamed_addr #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 #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare void @fsm_add_moribund(ptr noundef, i32 noundef) local_unnamed_addr #7

declare i32 @fsm_write(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #7

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

!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, !7}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.peeled.count", i32 1}
!8 = distinct !{!8, !6}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !11, i64 0}


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