; LLVM IR from jspd-group/pegit :: src (checkout)

; 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.revert_opts = type { i32, i32, %struct.strbuf_list, i32, i32, i8, i32, i32, i32 }
%struct.strbuf_list = type { ptr, ptr, i64 }
%struct.strbuf = type { i64, i64, ptr }
%struct.pack_file_cache = type { ptr, %struct.strbuf }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external global ptr, align 8
@rev_opts = external dso_local global %struct.revert_opts, align 8
@__const.revert_parse_options.peg_path = external hidden unnamed_addr constant %struct.strbuf, align 8
@.str.33 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.revert_parse_options.cache = external hidden unnamed_addr constant %struct.pack_file_cache, align 8

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

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #0

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind
declare i32 @stat(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #5

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

; Function Attrs: nounwind uwtable
declare dso_local void @revert_files_hard() #7

declare i64 @make_commit_list(ptr noundef) #8

; Function Attrs: nounwind uwtable
declare dso_local ptr @get_nth_commit(ptr noundef, i64 noundef) #7

declare void @make_index_list_from_commit(ptr noundef, ptr noundef) #8

; Function Attrs: nounwind uwtable
declare dso_local void @revert_directory(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #7

; Function Attrs: nounwind uwtable
define dso_local i32 @revert_parse_options(i32 noundef %0, ptr noundef %1) #7 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.strbuf, align 8
  %7 = alloca %struct.stat, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.pack_file_cache, align 8
  %13 = alloca ptr, align 8
  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 24, ptr %6) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 @__const.revert_parse_options.peg_path, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 144, ptr %7) #10
  %14 = call i32 @strbuf_list_init(ptr noundef getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 2))
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 2
  br i1 %16, label %17, label %20

17:                                               ; preds = %2
  %18 = load ptr, ptr @stdout, align 8, !tbaa !9
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.33) #10
  store i32 0, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 1), align 4, !tbaa !11
  store i32 1, ptr @rev_opts, align 8, !tbaa !15
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %141

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %135, %20
  %22 = load i32, ptr %9, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %8, align 4
  br label %138

26:                                               ; preds = %21
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = load i32, ptr %9, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds ptr, ptr %27, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = call i32 @strncmp(ptr noundef %31, ptr noundef @.str.34, i64 noundef 1) #11
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %42, label %34

34:                                               ; preds = %26
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds ptr, ptr %35, i64 %37
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  %41 = call i32 @atoi(ptr noundef %40) #11
  store i32 %41, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 1), align 4, !tbaa !11
  br label %134

42:                                               ; preds = %26
  %43 = load ptr, ptr %5, align 8, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %43, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = call i32 @strcmp(ptr noundef %47, ptr noundef @.str.35) #11
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %58

50:                                               ; preds = %42
  %51 = load ptr, ptr %5, align 8, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds ptr, ptr %51, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = call i32 @strcmp(ptr noundef %55, ptr noundef @.str.36) #11
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %50, %42
  store i32 1, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 3), align 8, !tbaa !16
  call void @revert_files_hard()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %138

59:                                               ; preds = %50
  %60 = load ptr, ptr %5, align 8, !tbaa !9
  %61 = load i32, ptr %9, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  call void @get_peg_path_buf(ptr noundef %6, ptr noundef %64)
  %65 = getelementptr inbounds %struct.strbuf, ptr %6, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  %67 = call i32 @stat(ptr noundef %66, ptr noundef %7) #10
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %69, label %96

69:                                               ; preds = %59
  %70 = call ptr @__errno_location() #12
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 2
  br i1 %72, label %73, label %95

73:                                               ; preds = %69
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr @stderr, align 8, !tbaa !9
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str) #10
  %77 = load ptr, ptr @stderr, align 8, !tbaa !9
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.1) #10
  %79 = load ptr, ptr @stderr, align 8, !tbaa !9
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.2) #10
  %81 = load ptr, ptr @stderr, align 8, !tbaa !9
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef @.str.3) #10
  %83 = load ptr, ptr @stderr, align 8, !tbaa !9
  %84 = load ptr, ptr %5, align 8, !tbaa !9
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds ptr, ptr %84, i64 %86
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = call ptr @__errno_location() #12
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = call ptr @strerror(i32 noundef %90) #10
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef @.str.37, ptr noundef %88, ptr noundef %91) #10
  call void @exit(i32 noundef 1) #13
  unreachable

93:                                               ; No predecessors!
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94, %69
  br label %96

96:                                               ; preds = %95, %59
  %97 = getelementptr inbounds %struct.stat, ptr %7, i32 0, i32 3
  %98 = load i32, ptr %97, align 8, !tbaa !19
  %99 = and i32 %98, 61440
  %100 = icmp eq i32 %99, 16384
  br i1 %100, label %101, label %120

101:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 @__const.revert_parse_options.cache, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  %102 = load ptr, ptr %5, align 8, !tbaa !9
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds ptr, ptr %102, i64 %104
  %106 = load ptr, ptr %105, align 8, !tbaa !9
  %107 = call i32 @status(ptr noundef %106)
  %108 = call i64 @make_commit_list(ptr noundef %10)
  %109 = load ptr, ptr %10, align 8, !tbaa !9
  %110 = load i32, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 1), align 4, !tbaa !11
  %111 = sext i32 %110 to i64
  %112 = call ptr @get_nth_commit(ptr noundef %109, i64 noundef %111)
  store ptr %112, ptr %11, align 8, !tbaa !9
  %113 = call i32 @cache_pack_file(ptr noundef %12)
  %114 = load ptr, ptr %11, align 8, !tbaa !9
  call void @make_index_list_from_commit(ptr noundef %114, ptr noundef %13)
  %115 = load ptr, ptr %13, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct.strbuf, ptr %6, i32 0, i32 2
  %117 = load ptr, ptr %116, align 8, !tbaa !17
  %118 = load i32, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 1), align 4, !tbaa !11
  %119 = sext i32 %118 to i64
  call void @revert_directory(ptr noundef %12, ptr noundef %115, ptr noundef %117, i64 noundef %119)
  call void @invalidate_cache(ptr noundef %12)
  call void @commit_list_del(ptr noundef %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #10
  br label %132

120:                                              ; preds = %96
  %121 = getelementptr inbounds %struct.stat, ptr %7, i32 0, i32 3
  %122 = load i32, ptr %121, align 8, !tbaa !19
  %123 = and i32 %122, 61440
  %124 = icmp eq i32 %123, 32768
  br i1 %124, label %125, label %131

125:                                              ; preds = %120
  %126 = getelementptr inbounds %struct.strbuf, ptr %6, i32 0, i32 2
  %127 = load ptr, ptr %126, align 8, !tbaa !17
  %128 = getelementptr inbounds %struct.strbuf, ptr %6, i32 0, i32 1
  %129 = load i64, ptr %128, align 8, !tbaa !22
  %130 = call i32 @strbuf_list_add(ptr noundef getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 2), ptr noundef %127, i64 noundef %129, i8 noundef signext 0, i64 noundef 0)
  store i32 1, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 4), align 4, !tbaa !23
  br label %131

131:                                              ; preds = %125, %120
  br label %132

132:                                              ; preds = %131, %101
  store i32 0, ptr getelementptr inbounds (%struct.revert_opts, ptr @rev_opts, i32 0, i32 6), align 4, !tbaa !24
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133, %34
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %9, align 4, !tbaa !5
  br label %21, !llvm.loop !25

138:                                              ; preds = %58, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  %139 = load i32, ptr %8, align 4
  switch i32 %139, label %141 [
    i32 2, label %140
  ]

140:                                              ; preds = %138
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %141

141:                                              ; preds = %140, %138, %17
  call void @llvm.lifetime.end.p0(i64 144, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #10
  %142 = load i32, ptr %3, align 4
  ret i32 %142
}

; Function Attrs: nounwind uwtable
declare hidden i32 @strbuf_list_init(ptr noundef) #7

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

declare void @get_peg_path_buf(ptr noundef, ptr noundef) #8

declare i32 @status(ptr noundef) #8

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @invalidate_cache(ptr noundef) #6

declare void @commit_list_del(ptr noundef) #8

; Function Attrs: nounwind uwtable
declare hidden i32 @strbuf_list_add(ptr noundef, ptr noundef, i64 noundef, i8 noundef signext, i64 noundef) #7

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !6, i64 4}
!12 = !{!"revert_opts", !6, i64 0, !6, i64 4, !13, i64 8, !6, i64 32, !6, i64 36, !7, i64 40, !6, i64 44, !6, i64 48, !6, i64 52}
!13 = !{!"strbuf_list", !10, i64 0, !10, i64 8, !14, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 32}
!17 = !{!18, !10, i64 16}
!18 = !{!"strbuf", !14, i64 0, !14, i64 8, !10, i64 16}
!19 = !{!20, !6, i64 24}
!20 = !{!"stat", !14, i64 0, !14, i64 8, !14, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !21, i64 72, !21, i64 88, !21, i64 104, !7, i64 120}
!21 = !{!"timespec", !14, i64 0, !14, i64 8}
!22 = !{!18, !14, i64 8}
!23 = !{!12, !6, i64 36}
!24 = !{!12, !6, i64 44}
!25 = distinct !{!25, !26}
!26 = !{!"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.revert_opts = type { i32, i32, %struct.strbuf_list, i32, i32, i8, i32, i32, i32 }
%struct.strbuf_list = type { ptr, ptr, i64 }
%struct.strbuf = type { i64, i64, ptr }
%struct.pack_file_cache = type { ptr, %struct.strbuf }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@rev_opts = external dso_local global %struct.revert_opts, align 8
@__const.revert_parse_options.peg_path = external hidden unnamed_addr constant %struct.strbuf, align 8
@.str.33 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.revert_parse_options.cache = external hidden unnamed_addr constant %struct.pack_file_cache, align 8

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

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @stat(ptr nocapture noundef readonly, ptr nocapture 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) #4

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

; Function Attrs: nounwind uwtable
declare dso_local void @revert_files_hard() local_unnamed_addr #8

declare i64 @make_commit_list(ptr noundef) local_unnamed_addr #9

; Function Attrs: nounwind uwtable
declare dso_local ptr @get_nth_commit(ptr noundef, i64 noundef) local_unnamed_addr #8

declare void @make_index_list_from_commit(ptr noundef, ptr noundef) local_unnamed_addr #9

; Function Attrs: nounwind uwtable
declare dso_local void @revert_directory(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #8

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @revert_parse_options(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #8 {
  %3 = alloca %struct.strbuf, align 8
  %4 = alloca %struct.stat, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.pack_file_cache, align 8
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #11
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) @__const.revert_parse_options.peg_path, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %4) #11
  %8 = tail call i32 @strbuf_list_init(ptr noundef nonnull getelementptr inbounds (i8, ptr @rev_opts, i64 8))
  %9 = icmp slt i32 %0, 2
  br i1 %9, label %13, label %.preheader

.preheader:                                       ; preds = %2
  %rhsc = load i8, ptr @.str.34, align 1
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  %11 = getelementptr inbounds i8, ptr %4, i64 24
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %16

13:                                               ; preds = %2
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.33) #11
  store i32 0, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 4), align 4, !tbaa !9
  store i32 1, ptr @rev_opts, align 8, !tbaa !14
  br label %.critedge

16:                                               ; preds = %.preheader, %69
  %indvars.iv = phi i64 [ 1, %.preheader ], [ %indvars.iv.next, %69 ]
  %17 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %lhsc = load i8, ptr %18, align 1
  %.not = icmp eq i8 %lhsc, %rhsc
  br i1 %.not, label %19, label %22

19:                                               ; preds = %16
  %20 = getelementptr inbounds i8, ptr %18, i64 1
  %21 = call i32 @atoi(ptr nocapture noundef %20) #12
  store i32 %21, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 4), align 4, !tbaa !9
  br label %69

22:                                               ; preds = %16
  %23 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.35) #12
  %.not23 = icmp eq i32 %23, 0
  br i1 %.not23, label %26, label %24

24:                                               ; preds = %22
  %25 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.36) #12
  %.not24 = icmp eq i32 %25, 0
  br i1 %.not24, label %26, label %27

26:                                               ; preds = %24, %22
  store i32 1, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 32), align 8, !tbaa !15
  call void @revert_files_hard()
  br label %.critedge

27:                                               ; preds = %24
  call void @get_peg_path_buf(ptr noundef nonnull %3, ptr noundef nonnull %18) #11
  %28 = load ptr, ptr %10, align 8, !tbaa !16
  %29 = call i32 @stat(ptr noundef %28, ptr noundef nonnull %4) #11
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %31, label %48

31:                                               ; preds = %27
  %32 = tail call ptr @__errno_location() #13
  %33 = load i32, ptr %32, align 4, !tbaa !18
  %.not26 = icmp eq i32 %33, 2
  br i1 %.not26, label %48, label %34

34:                                               ; preds = %31
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str) #14
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.1) #14
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.2) #14
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.3) #14
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = load ptr, ptr %17, align 8, !tbaa !5
  %45 = load i32, ptr %32, align 4, !tbaa !18
  %46 = call ptr @strerror(i32 noundef %45) #11
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.37, ptr noundef %44, ptr noundef %46) #14
  call void @exit(i32 noundef 1) #15
  unreachable

48:                                               ; preds = %31, %27
  %49 = load i32, ptr %11, align 8, !tbaa !19
  %50 = trunc i32 %49 to i16
  %trunc = and i16 %50, -4096
  switch i16 %trunc, label %68 [
    i16 16384, label %51
    i16 -32768, label %64
  ]

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #11
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #11
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) @__const.revert_parse_options.cache, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #11
  %52 = load ptr, ptr %17, align 8, !tbaa !5
  %53 = call i32 @status(ptr noundef %52) #11
  %54 = call i64 @make_commit_list(ptr noundef nonnull %5) #11
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 4), align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = call ptr @get_nth_commit(ptr noundef %55, i64 noundef %57)
  %59 = call i32 @cache_pack_file(ptr noundef nonnull %6)
  call void @make_index_list_from_commit(ptr noundef %58, ptr noundef nonnull %7) #11
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load ptr, ptr %10, align 8, !tbaa !16
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 4), align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  call void @revert_directory(ptr noundef nonnull %6, ptr noundef %60, ptr noundef %61, i64 noundef %63)
  call void @invalidate_cache(ptr noundef nonnull %6)
  call void @commit_list_del(ptr noundef nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #11
  br label %68

64:                                               ; preds = %48
  %65 = load ptr, ptr %10, align 8, !tbaa !16
  %66 = load i64, ptr %12, align 8, !tbaa !22
  %67 = call i32 @strbuf_list_add(ptr noundef nonnull getelementptr inbounds (i8, ptr @rev_opts, i64 8), ptr noundef %65, i64 noundef %66, i8 noundef signext 0, i64 noundef 0)
  store i32 1, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 36), align 4, !tbaa !23
  br label %68

68:                                               ; preds = %48, %64, %51
  store i32 0, ptr getelementptr inbounds (i8, ptr @rev_opts, i64 44), align 4, !tbaa !24
  br label %69

69:                                               ; preds = %19, %68
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %16, !llvm.loop !25

.critedge:                                        ; preds = %69, %26, %13
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #11
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @strbuf_list_init(ptr noundef) local_unnamed_addr #8

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

declare void @get_peg_path_buf(ptr noundef, ptr noundef) local_unnamed_addr #9

declare i32 @status(ptr noundef) local_unnamed_addr #9

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @invalidate_cache(ptr noundef) local_unnamed_addr #7

declare void @commit_list_del(ptr noundef) local_unnamed_addr #9

; Function Attrs: nounwind uwtable
declare hidden i32 @strbuf_list_add(ptr noundef, ptr noundef, i64 noundef, i8 noundef signext, i64 noundef) local_unnamed_addr #8

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"revert_opts", !11, i64 0, !11, i64 4, !12, i64 8, !11, i64 32, !11, i64 36, !7, i64 40, !11, i64 44, !11, i64 48, !11, i64 52}
!11 = !{!"int", !7, i64 0}
!12 = !{!"strbuf_list", !6, i64 0, !6, i64 8, !13, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !11, i64 0}
!15 = !{!10, !11, i64 32}
!16 = !{!17, !6, i64 16}
!17 = !{!"strbuf", !13, i64 0, !13, i64 8, !6, i64 16}
!18 = !{!11, !11, i64 0}
!19 = !{!20, !11, i64 24}
!20 = !{!"stat", !13, i64 0, !13, i64 8, !13, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !21, i64 72, !21, i64 88, !21, i64 104, !7, i64 120}
!21 = !{!"timespec", !13, i64 0, !13, i64 8}
!22 = !{!17, !13, i64 8}
!23 = !{!10, !11, i64 36}
!24 = !{!10, !11, i64 44}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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