; LLVM IR from Angold-4/chainsaw :: src/debug/editor.ll (ZN6Editor4OpenEPc)

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

%class.Editor = type { i8, ptr, ptr, %struct.buffer, ptr, ptr, %struct.editorConfig, %struct.editorConfig }
%struct.buffer = type { ptr, i64, i8, i32 }
%struct.editorConfig = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, ptr, [80 x i8], %"class.std::__cxx11::basic_string", i8, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str.30 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [29 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6Editor4OpenEPc(ptr noundef nonnull align 8 dereferenceable(448) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #10
  %13 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %14 = getelementptr inbounds %struct.editorConfig, ptr %13, i32 0, i32 11
  store i32 0, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #10
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call i64 @strlen(ptr noundef %15) #11
  %17 = add i64 %16, 1
  store i64 %17, ptr %7, align 8, !tbaa !18
  %18 = load i64, ptr %7, align 8, !tbaa !18
  %19 = call noalias ptr @malloc(i64 noundef %18) #12
  %20 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %21 = getelementptr inbounds %struct.editorConfig, ptr %20, i32 0, i32 12
  store ptr %19, ptr %21, align 8, !tbaa !19
  %22 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %23 = getelementptr inbounds %struct.editorConfig, ptr %22, i32 0, i32 12
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load i64, ptr %7, align 8, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %24, ptr align 1 %25, i64 %26, i1 false)
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call noalias ptr @fopen(ptr noundef %27, ptr noundef @.str.30)
  store ptr %28, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %37, label %31

31:                                               ; preds = %2
  %32 = call ptr @__errno_location() #13
  %33 = load i32, ptr %32, align 4, !tbaa !20
  %34 = icmp ne i32 %33, 2
  br i1 %34, label %35, label %36

35:                                               ; preds = %31
  call void @perror(ptr noundef @.str.31)
  call void @_ZN6Editor4ExitEi(ptr noundef nonnull align 8 dereferenceable(448) %12, i32 noundef 1)
  br label %36

36:                                               ; preds = %35, %31
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %99

37:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #10
  store i64 0, ptr %10, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #10
  %38 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %39 = getelementptr inbounds %struct.editorConfig, ptr %38, i32 0, i32 11
  %40 = load i32, ptr %39, align 8, !tbaa !9
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %48

42:                                               ; preds = %37
  %43 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %44 = getelementptr inbounds %struct.editorConfig, ptr %43, i32 0, i32 12
  %45 = load ptr, ptr %44, align 8, !tbaa !19
  call void (ptr, ptr, ...) @_ZN6Editor16SetStatusMessageEPKcz(ptr noundef nonnull align 8 dereferenceable(448) %12, ptr noundef @.str.32, ptr noundef %45)
  %46 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %47 = call noundef i32 @_ZN6Editor4saveER12editorConfig(ptr noundef nonnull align 8 dereferenceable(448) %12, ptr noundef nonnull align 8 dereferenceable(192) %46)
  br label %48

48:                                               ; preds = %42, %37
  %49 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %50 = getelementptr inbounds %struct.editorConfig, ptr %49, i32 0, i32 10
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  %52 = icmp eq ptr %51, null
  br i1 %52, label %54, label %53

53:                                               ; preds = %48
  call void @_ZdlPvm(ptr noundef %51, i64 noundef 32) #14
  br label %54

54:                                               ; preds = %53, %48
  %55 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %56 = getelementptr inbounds %struct.editorConfig, ptr %55, i32 0, i32 10
  store ptr null, ptr %56, align 8, !tbaa !21
  %57 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %58 = getelementptr inbounds %struct.editorConfig, ptr %57, i32 0, i32 8
  store i32 0, ptr %58, align 8, !tbaa !22
  %59 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %60 = getelementptr inbounds %struct.editorConfig, ptr %59, i32 0, i32 1
  store i32 0, ptr %60, align 4, !tbaa !23
  %61 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %62 = getelementptr inbounds %struct.editorConfig, ptr %61, i32 0, i32 0
  store i32 0, ptr %62, align 8, !tbaa !24
  br label %63

63:                                               ; preds = %91, %54
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = call i64 @getline(ptr noundef %9, ptr noundef %10, ptr noundef %64)
  store i64 %65, ptr %11, align 8, !tbaa !18
  %66 = icmp ne i64 %65, -1
  br i1 %66, label %67, label %98

67:                                               ; preds = %63
  %68 = load i64, ptr %11, align 8, !tbaa !18
  %69 = icmp ne i64 %68, 0
  br i1 %69, label %70, label %91

70:                                               ; preds = %67
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = load i64, ptr %11, align 8, !tbaa !18
  %73 = sub nsw i64 %72, 1
  %74 = getelementptr inbounds i8, ptr %71, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !25
  %76 = sext i8 %75 to i32
  %77 = icmp eq i32 %76, 10
  br i1 %77, label %86, label %78

78:                                               ; preds = %70
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load i64, ptr %11, align 8, !tbaa !18
  %81 = sub nsw i64 %80, 1
  %82 = getelementptr inbounds i8, ptr %79, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !25
  %84 = sext i8 %83 to i32
  %85 = icmp eq i32 %84, 13
  br i1 %85, label %86, label %91

86:                                               ; preds = %78, %70
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = load i64, ptr %11, align 8, !tbaa !18
  %89 = add nsw i64 %88, -1
  store i64 %89, ptr %11, align 8, !tbaa !18
  %90 = getelementptr inbounds i8, ptr %87, i64 %89
  store i8 0, ptr %90, align 1, !tbaa !25
  br label %91

91:                                               ; preds = %86, %78, %67
  %92 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  %93 = getelementptr inbounds %struct.editorConfig, ptr %92, i32 0, i32 8
  %94 = load i32, ptr %93, align 8, !tbaa !22
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = load i64, ptr %11, align 8, !tbaa !18
  %97 = getelementptr inbounds %class.Editor, ptr %12, i32 0, i32 6
  call void @_ZN6Editor9InsertRowEiPcmR12editorConfig(ptr noundef nonnull align 8 dereferenceable(448) %12, i32 noundef %94, ptr noundef %95, i64 noundef %96, ptr noundef nonnull align 8 dereferenceable(192) %97)
  br label %63, !llvm.loop !26

98:                                               ; preds = %63
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  br label %99

99:                                               ; preds = %98, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  %100 = load i32, ptr %3, align 4
  ret i32 %100
}

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

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

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

declare void @perror(ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Editor4ExitEi(ptr noundef nonnull align 8 dereferenceable(448), i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Editor16SetStatusMessageEPKcz(ptr noundef nonnull align 8 dereferenceable(448), ptr noundef, ...) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6Editor4saveER12editorConfig(ptr noundef nonnull align 8 dereferenceable(448), ptr noundef nonnull align 8 dereferenceable(192)) #3 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #8

; Function Attrs: inlinehint mustprogress uwtable
declare i64 @getline(ptr noundef, ptr noundef, ptr noundef) #9

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Editor9InsertRowEiPcmR12editorConfig(ptr noundef nonnull align 8 dereferenceable(448), i32 noundef, ptr noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(192)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress 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 = { 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 #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 = { 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 = { mustprogress 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 = { nobuiltin 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 #9 = { inlinehint mustprogress 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 allocsize(0) }
attributes #13 = { nounwind willreturn memory(none) }
attributes #14 = { builtin 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++ TBAA"}
!9 = !{!10, !14, i64 112}
!10 = !{!"_ZTS6Editor", !11, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !6, i64 48, !6, i64 56, !15, i64 64, !15, i64 256}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTS6buffer", !6, i64 0, !13, i64 8, !11, i64 16, !14, i64 20}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS12editorConfig", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !6, i64 40, !14, i64 48, !6, i64 56, !7, i64 64, !16, i64 144, !11, i64 176, !13, i64 184}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !13, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!13, !13, i64 0}
!19 = !{!10, !6, i64 120}
!20 = !{!14, !14, i64 0}
!21 = !{!10, !6, i64 104}
!22 = !{!10, !14, i64 96}
!23 = !{!10, !14, i64 68}
!24 = !{!10, !14, i64 64}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"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"

@.str.30 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [29 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN6Editor4OpenEPc(ptr noundef nonnull align 8 dereferenceable(448) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 0, ptr %6, align 8, !tbaa !5
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #10
  %8 = add i64 %7, 1
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #11
  %10 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr %9, ptr %10, align 8, !tbaa !17
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %9, ptr align 1 %1, i64 %8, i1 false)
  %11 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.30)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %16

12:                                               ; preds = %2
  %13 = tail call ptr @__errno_location() #12
  %14 = load i32, ptr %13, align 4, !tbaa !18
  %.not18 = icmp eq i32 %14, 2
  br i1 %.not18, label %43, label %15

15:                                               ; preds = %12
  tail call void @perror(ptr noundef nonnull @.str.31) #13
  tail call void @_ZN6Editor4ExitEi(ptr noundef nonnull align 8 dereferenceable(448) %0, i32 noundef 1)
  br label %43

16:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #14
  store ptr null, ptr %3, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #14
  store i64 0, ptr %4, align 8, !tbaa !20
  %17 = load i32, ptr %6, align 8, !tbaa !5
  %.not19 = icmp eq i32 %17, 0
  br i1 %.not19, label %21, label %18

18:                                               ; preds = %16
  %19 = load ptr, ptr %10, align 8, !tbaa !17
  tail call void (ptr, ptr, ...) @_ZN6Editor16SetStatusMessageEPKcz(ptr noundef nonnull align 8 dereferenceable(448) %0, ptr noundef nonnull @.str.32, ptr noundef %19)
  %20 = tail call noundef i32 @_ZN6Editor4saveER12editorConfig(ptr noundef nonnull align 8 dereferenceable(448) %0, ptr noundef nonnull align 8 dereferenceable(192) %5)
  br label %21

21:                                               ; preds = %18, %16
  %22 = getelementptr inbounds i8, ptr %0, i64 104
  %23 = load ptr, ptr %22, align 8, !tbaa !21
  %24 = icmp eq ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  tail call void @_ZdlPvm(ptr noundef nonnull %23, i64 noundef 32) #15
  br label %26

26:                                               ; preds = %25, %21
  store ptr null, ptr %22, align 8, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %0, i64 96
  store i32 0, ptr %27, align 8, !tbaa !22
  %28 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 0, ptr %28, align 4, !tbaa !23
  store i32 0, ptr %5, align 8, !tbaa !24
  br label %29

29:                                               ; preds = %39, %26
  %30 = call i64 @getline(ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %11)
  switch i64 %30, label %31 [
    i64 -1, label %42
    i64 0, label %39
  ]

31:                                               ; preds = %29
  %32 = load ptr, ptr %3, align 8, !tbaa !19
  %33 = getelementptr i8, ptr %32, i64 %30
  %34 = getelementptr i8, ptr %33, i64 -1
  %35 = load i8, ptr %34, align 1, !tbaa !25
  switch i8 %35, label %39 [
    i8 10, label %36
    i8 13, label %36
  ]

36:                                               ; preds = %31, %31
  %37 = add nsw i64 %30, -1
  %38 = getelementptr inbounds i8, ptr %32, i64 %37
  store i8 0, ptr %38, align 1, !tbaa !25
  br label %39

39:                                               ; preds = %31, %29, %36
  %.0 = phi i64 [ %37, %36 ], [ %30, %29 ], [ %30, %31 ]
  %40 = load i32, ptr %27, align 8, !tbaa !22
  %41 = load ptr, ptr %3, align 8, !tbaa !19
  call void @_ZN6Editor9InsertRowEiPcmR12editorConfig(ptr noundef nonnull align 8 dereferenceable(448) %0, i32 noundef %40, ptr noundef %41, i64 noundef %.0, ptr noundef nonnull align 8 dereferenceable(192) %5)
  br label %29, !llvm.loop !26

42:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #14
  br label %43

43:                                               ; preds = %12, %15, %42
  %.013 = phi i32 [ 0, %42 ], [ 1, %15 ], [ 1, %12 ]
  ret i32 %.013
}

; 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: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) 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 void @perror(ptr nocapture noundef readonly) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Editor4ExitEi(ptr noundef nonnull align 8 dereferenceable(448), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Editor16SetStatusMessageEPKcz(ptr noundef nonnull align 8 dereferenceable(448), ptr noundef, ...) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6Editor4saveER12editorConfig(ptr noundef nonnull align 8 dereferenceable(448), ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #3 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #8

; Function Attrs: inlinehint mustprogress uwtable
declare i64 @getline(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #9

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Editor9InsertRowEiPcmR12editorConfig(ptr noundef nonnull align 8 dereferenceable(448), i32 noundef, ptr noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress 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 = { 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = { mustprogress 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 = { nobuiltin 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 #9 = { inlinehint mustprogress 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 willreturn memory(read) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { cold }
attributes #14 = { nounwind }
attributes #15 = { builtin 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, !13, i64 112}
!6 = !{!"_ZTS6Editor", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !10, i64 48, !10, i64 56, !14, i64 64, !14, i64 256}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS6buffer", !10, i64 0, !12, i64 8, !7, i64 16, !13, i64 20}
!12 = !{!"long", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTS12editorConfig", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !10, i64 40, !13, i64 48, !10, i64 56, !8, i64 64, !15, i64 144, !7, i64 176, !12, i64 184}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !12, i64 8, !8, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!17 = !{!6, !10, i64 120}
!18 = !{!13, !13, i64 0}
!19 = !{!10, !10, i64 0}
!20 = !{!12, !12, i64 0}
!21 = !{!6, !10, i64 104}
!22 = !{!6, !13, i64 96}
!23 = !{!6, !13, i64 68}
!24 = !{!6, !13, i64 64}
!25 = !{!8, !8, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass