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

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

@stderr = external global ptr, align 8
@.str.18 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [23 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
declare dso_local void @commit_init(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @read_commit_object(ptr noundef, ptr noundef) #1

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @commit_list_init(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @make_commit_list(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %9 = call noalias ptr @fopen(ptr noundef @.str.24, ptr noundef @.str.25)
  store ptr %9, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %8, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %29, label %12

12:                                               ; preds = %1
  br label %13

13:                                               ; preds = %12
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef @.str.18) #7
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef @.str.19) #7
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.20) #7
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str.21) #7
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call ptr @__errno_location() #8
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = call ptr @strerror(i32 noundef %24) #7
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.26, ptr noundef @.str.24, ptr noundef %25) #7
  call void @exit(i32 noundef 1) #9
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28, %1
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = call i64 @fread(ptr noundef %3, i64 noundef 8, i64 noundef 1, ptr noundef %30)
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr null, ptr %32, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %65, %29
  %34 = load i64, ptr %3, align 8, !tbaa !9
  %35 = add i64 %34, -1
  store i64 %35, ptr %3, align 8, !tbaa !9
  %36 = icmp ne i64 %34, 0
  br i1 %36, label %37, label %66

37:                                               ; preds = %33
  %38 = call noalias ptr @malloc(i64 noundef 208) #10
  store ptr %38, ptr %7, align 8, !tbaa !5
  %39 = call noalias ptr @malloc(i64 noundef 24) #10
  store ptr %39, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  call void @commit_init(ptr noundef %40)
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  call void @commit_list_init(ptr noundef %41)
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.commit_list, ptr %43, i32 0, i32 1
  store ptr %42, ptr %44, align 8, !tbaa !13
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = call i32 @read_commit_object(ptr noundef %45, ptr noundef %46)
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %58

51:                                               ; preds = %37
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  call void @commit_list_add(ptr noundef %6, ptr noundef %52)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.commit_list, ptr %54, i32 0, i32 0
  %56 = load i64, ptr %55, align 8, !tbaa !15
  %57 = add i64 %56, 1
  store i64 %57, ptr %55, align 8, !tbaa !15
  br label %65

58:                                               ; preds = %37
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %59, ptr %60, align 8, !tbaa !5
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %61, ptr %6, align 8, !tbaa !5
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.commit_list, ptr %63, i32 0, i32 0
  store i64 1, ptr %64, align 8, !tbaa !15
  br label %65

65:                                               ; preds = %58, %51
  br label %33, !llvm.loop !16

66:                                               ; preds = %33
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = call i32 @fclose(ptr noundef %67)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  ret i64 0
}

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

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

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

declare i32 @fclose(ptr noundef) #2

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 = { "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 = { 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 = { 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 #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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"commit_list", !10, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!14, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.18 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [23 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
declare dso_local void @commit_init(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @read_commit_object(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @commit_list_init(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @make_commit_list(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store ptr null, ptr %3, align 8, !tbaa !9
  %4 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.25)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %19

5:                                                ; preds = %1
  %6 = load ptr, ptr @stderr, align 8, !tbaa !9
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.18) #8
  %8 = load ptr, ptr @stderr, align 8, !tbaa !9
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.19) #8
  %10 = load ptr, ptr @stderr, align 8, !tbaa !9
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.20) #8
  %12 = load ptr, ptr @stderr, align 8, !tbaa !9
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.21) #8
  %14 = load ptr, ptr @stderr, align 8, !tbaa !9
  %15 = tail call ptr @__errno_location() #9
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = tail call ptr @strerror(i32 noundef %16) #7
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.24, ptr noundef %17) #8
  tail call void @exit(i32 noundef 1) #10
  unreachable

19:                                               ; preds = %1
  %20 = call i64 @fread(ptr noundef nonnull %2, i64 noundef 8, i64 noundef 1, ptr noundef nonnull %4)
  store ptr null, ptr %0, align 8, !tbaa !9
  %.promoted = load i64, ptr %2, align 8, !tbaa !5
  %.not1719 = icmp eq i64 %.promoted, 0
  br i1 %.not1719, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %19, %32
  %.in = phi i64 [ %21, %32 ], [ %.promoted, %19 ]
  %21 = add i64 %.in, -1
  %22 = call noalias dereferenceable_or_null(208) ptr @malloc(i64 noundef 208) #11
  %23 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #11
  call void @commit_init(ptr noundef %22)
  call void @commit_list_init(ptr noundef %23)
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  store ptr %22, ptr %24, align 8, !tbaa !13
  %25 = call i32 @read_commit_object(ptr noundef %22, ptr noundef nonnull %4)
  %26 = load ptr, ptr %0, align 8, !tbaa !9
  %.not18 = icmp eq ptr %26, null
  br i1 %.not18, label %31, label %27

27:                                               ; preds = %.lr.ph
  call void @commit_list_add(ptr noundef nonnull %3, ptr noundef nonnull %23)
  %28 = load ptr, ptr %0, align 8, !tbaa !9
  %29 = load i64, ptr %28, align 8, !tbaa !15
  %30 = add i64 %29, 1
  store i64 %30, ptr %28, align 8, !tbaa !15
  br label %32

31:                                               ; preds = %.lr.ph
  store ptr %23, ptr %0, align 8, !tbaa !9
  store ptr %23, ptr %3, align 8, !tbaa !9
  store i64 1, ptr %23, align 8, !tbaa !15
  br label %32

32:                                               ; preds = %31, %27
  %.not17 = icmp eq i64 %21, 0
  br i1 %.not17, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %32, %19
  %33 = call i32 @fclose(ptr noundef nonnull %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  ret i64 0
}

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

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

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

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

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 = { 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 #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 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 #5 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { noreturn nounwind }
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 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"commit_list", !6, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!14, !6, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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