; LLVM IR from gburlet/dbn-guitar-transcribe :: lbfgsb/program.ll (ZN7Program9runSolverEv)

; 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.Program = type { ptr, i32, ptr, ptr, ptr, ptr, i8, double, ptr, i32, i32, i32, double, double, i32, i32, i32, i32, ptr, ptr, [60 x i8], [60 x i8], [4 x i8], [44 x i32], [29 x double] }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7Program9runSolverEv(ptr noundef nonnull align 8 dereferenceable(672) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 1, ptr %4, align 4, !tbaa !9
  call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %3, ptr noundef @.str)
  %5 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 16
  store i32 0, ptr %5, align 8, !tbaa !15
  %6 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 15
  store i32 0, ptr %6, align 4, !tbaa !16
  br label %7

7:                                                ; preds = %93, %1
  %8 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %9 = getelementptr inbounds [60 x i8], ptr %8, i64 0, i64 0
  %10 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %9, ptr noundef @.str.1)
  br i1 %10, label %11, label %34

11:                                               ; preds = %7
  %12 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 1
  %13 = load i32, ptr %12, align 8, !tbaa !17
  %14 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 2
  %15 = load ptr, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 8
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %18 = load ptr, ptr %3, align 8, !tbaa !20
  %19 = getelementptr inbounds ptr, ptr %18, i64 2
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef double %20(ptr noundef nonnull align 8 dereferenceable(672) %3, i32 noundef %13, ptr noundef %15, ptr noundef %17)
  %22 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 7
  store double %21, ptr %22, align 8, !tbaa !22
  %23 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 16
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %23, align 8, !tbaa !15
  %26 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 16
  %27 = load i32, ptr %26, align 8, !tbaa !15
  %28 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 11
  %29 = load i32, ptr %28, align 8, !tbaa !23
  %30 = icmp eq i32 %27, %29
  br i1 %30, label %31, label %33

31:                                               ; preds = %11
  call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %3, ptr noundef @.str.2)
  %32 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 4, ptr %32, align 4, !tbaa !9
  br label %94

33:                                               ; preds = %11
  br label %93

34:                                               ; preds = %7
  %35 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %36 = getelementptr inbounds [60 x i8], ptr %35, i64 0, i64 0
  %37 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %36, ptr noundef @.str.3)
  br i1 %37, label %38, label %59

38:                                               ; preds = %34
  %39 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 15
  %40 = load i32, ptr %39, align 4, !tbaa !16
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !16
  %42 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 15
  %43 = load i32, ptr %42, align 4, !tbaa !16
  %44 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 2
  %45 = load ptr, ptr %44, align 8, !tbaa !18
  %46 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 7
  %47 = load double, ptr %46, align 8, !tbaa !22
  %48 = load ptr, ptr %3, align 8, !tbaa !20
  %49 = getelementptr inbounds ptr, ptr %48, i64 3
  %50 = load ptr, ptr %49, align 8
  call void %50(ptr noundef nonnull align 8 dereferenceable(672) %3, i32 noundef %43, ptr noundef %45, double noundef %47)
  %51 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 15
  %52 = load i32, ptr %51, align 4, !tbaa !16
  %53 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 10
  %54 = load i32, ptr %53, align 4, !tbaa !24
  %55 = icmp eq i32 %52, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %38
  call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %3, ptr noundef @.str.2)
  %57 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 5, ptr %57, align 4, !tbaa !9
  br label %94

58:                                               ; preds = %38
  br label %92

59:                                               ; preds = %34
  %60 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %61 = getelementptr inbounds [60 x i8], ptr %60, i64 0, i64 0
  %62 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %61, ptr noundef @.str.4)
  br i1 %62, label %63, label %77

63:                                               ; preds = %59
  %64 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %65 = getelementptr inbounds [60 x i8], ptr %64, i64 0, i64 0
  %66 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %65, ptr noundef @.str.5)
  br i1 %66, label %67, label %69

67:                                               ; preds = %63
  %68 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 3, ptr %68, align 4, !tbaa !9
  br label %76

69:                                               ; preds = %63
  %70 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %71 = getelementptr inbounds [60 x i8], ptr %70, i64 0, i64 0
  %72 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %71, ptr noundef @.str.6)
  br i1 %72, label %73, label %75

73:                                               ; preds = %69
  %74 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 2, ptr %74, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %73, %69
  br label %76

76:                                               ; preds = %75, %67
  br label %94

77:                                               ; preds = %59
  %78 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %79 = getelementptr inbounds [60 x i8], ptr %78, i64 0, i64 0
  %80 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %79, ptr noundef @.str.7)
  br i1 %80, label %81, label %83

81:                                               ; preds = %77
  %82 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 -2, ptr %82, align 4, !tbaa !9
  br label %94

83:                                               ; preds = %77
  %84 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 20
  %85 = getelementptr inbounds [60 x i8], ptr %84, i64 0, i64 0
  %86 = call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef %85, ptr noundef @.str.8)
  br i1 %86, label %87, label %89

87:                                               ; preds = %83
  %88 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  store i32 -1, ptr %88, align 4, !tbaa !9
  br label %94

89:                                               ; preds = %83
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91, %58
  br label %93

93:                                               ; preds = %92, %33
  call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %3, ptr noundef null)
  br label %7, !llvm.loop !25

94:                                               ; preds = %87, %81, %76, %56, %31
  %95 = getelementptr inbounds %class.Program, ptr %3, i32 0, i32 17
  %96 = load i32, ptr %95, align 4, !tbaa !9
  ret i32 %96
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672), ptr noundef) #1 align 2

attributes #0 = { 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 #1 = { 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" }

!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 116}
!10 = !{!"_ZTS7Program", !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !13, i64 56, !6, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !13, i64 88, !13, i64 96, !11, i64 104, !11, i64 108, !11, i64 112, !14, i64 116, !6, i64 120, !6, i64 128, !7, i64 136, !7, i64 196, !7, i64 256, !7, i64 260, !7, i64 440}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_ZTS16SolverExitStatus", !7, i64 0}
!15 = !{!10, !11, i64 112}
!16 = !{!10, !11, i64 108}
!17 = !{!10, !11, i64 8}
!18 = !{!10, !6, i64 16}
!19 = !{!10, !6, i64 64}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !8, i64 0}
!22 = !{!10, !13, i64 56}
!23 = !{!10, !11, i64 80}
!24 = !{!10, !11, i64 76}
!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"

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7Program9runSolverEv(ptr noundef nonnull align 8 dereferenceable(672) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 116
  store i32 1, ptr %2, align 4, !tbaa !5
  tail call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %0, ptr noundef nonnull @.str)
  %3 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 0, ptr %3, align 8, !tbaa !14
  %4 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 0, ptr %4, align 4, !tbaa !15
  %5 = getelementptr inbounds i8, ptr %0, i64 136
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  %8 = getelementptr inbounds i8, ptr %0, i64 76
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  br label %12

12:                                               ; preds = %55, %1
  %13 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.1)
  br i1 %13, label %14, label %27

14:                                               ; preds = %12
  %15 = load i32, ptr %9, align 8, !tbaa !16
  %16 = load ptr, ptr %6, align 8, !tbaa !17
  %17 = load ptr, ptr %10, align 8, !tbaa !18
  %18 = load ptr, ptr %0, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %20 = load ptr, ptr %19, align 8
  %21 = tail call noundef double %20(ptr noundef nonnull align 8 dereferenceable(672) %0, i32 noundef %15, ptr noundef %16, ptr noundef %17)
  store double %21, ptr %7, align 8, !tbaa !21
  %22 = load i32, ptr %3, align 8, !tbaa !14
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %3, align 8, !tbaa !14
  %24 = load i32, ptr %11, align 8, !tbaa !22
  %25 = icmp eq i32 %23, %24
  br i1 %25, label %26, label %55

26:                                               ; preds = %14
  tail call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %0, ptr noundef nonnull @.str.2)
  store i32 4, ptr %2, align 4, !tbaa !5
  br label %56

27:                                               ; preds = %12
  %28 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.3)
  br i1 %28, label %29, label %41

29:                                               ; preds = %27
  %30 = load i32, ptr %4, align 4, !tbaa !15
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !15
  %32 = load ptr, ptr %6, align 8, !tbaa !17
  %33 = load double, ptr %7, align 8, !tbaa !21
  %34 = load ptr, ptr %0, align 8, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %34, i64 24
  %36 = load ptr, ptr %35, align 8
  tail call void %36(ptr noundef nonnull align 8 dereferenceable(672) %0, i32 noundef %31, ptr noundef %32, double noundef %33)
  %37 = load i32, ptr %4, align 4, !tbaa !15
  %38 = load i32, ptr %8, align 4, !tbaa !23
  %39 = icmp eq i32 %37, %38
  br i1 %39, label %40, label %55

40:                                               ; preds = %29
  tail call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %0, ptr noundef nonnull @.str.2)
  store i32 5, ptr %2, align 4, !tbaa !5
  br label %56

41:                                               ; preds = %27
  %42 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.4)
  br i1 %42, label %43, label %49

43:                                               ; preds = %41
  %44 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.5)
  br i1 %44, label %45, label %46

45:                                               ; preds = %43
  store i32 3, ptr %2, align 4, !tbaa !5
  br label %56

46:                                               ; preds = %43
  %47 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.6)
  br i1 %47, label %48, label %._crit_edge

._crit_edge:                                      ; preds = %46
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %56

48:                                               ; preds = %46
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %56

49:                                               ; preds = %41
  %50 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.7)
  br i1 %50, label %51, label %52

51:                                               ; preds = %49
  store i32 -2, ptr %2, align 4, !tbaa !5
  br label %56

52:                                               ; preds = %49
  %53 = tail call noundef zeroext i1 @_Z16strIsEqualToCStrPKcS0_(ptr noundef nonnull %5, ptr noundef nonnull @.str.8)
  br i1 %53, label %54, label %55

54:                                               ; preds = %52
  store i32 -1, ptr %2, align 4, !tbaa !5
  br label %56

55:                                               ; preds = %29, %52, %14
  tail call void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672) %0, ptr noundef null)
  br label %12, !llvm.loop !24

56:                                               ; preds = %._crit_edge, %45, %48, %54, %51, %40, %26
  %57 = phi i32 [ %.pre, %._crit_edge ], [ 3, %45 ], [ 2, %48 ], [ -1, %54 ], [ -2, %51 ], [ 5, %40 ], [ 4, %26 ]
  ret i32 %57
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Program9callLBFGSEPKc(ptr noundef nonnull align 8 dereferenceable(672), ptr noundef) local_unnamed_addr #1 align 2

attributes #0 = { 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 #1 = { 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" }

!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 116}
!6 = !{!"_ZTS7Program", !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !12, i64 56, !10, i64 64, !7, i64 72, !7, i64 76, !7, i64 80, !12, i64 88, !12, i64 96, !7, i64 104, !7, i64 108, !7, i64 112, !13, i64 116, !10, i64 120, !10, i64 128, !8, i64 136, !8, i64 196, !8, i64 256, !8, i64 260, !8, i64 440}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTS16SolverExitStatus", !8, i64 0}
!14 = !{!6, !7, i64 112}
!15 = !{!6, !7, i64 108}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !10, i64 16}
!18 = !{!6, !10, i64 64}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !9, i64 0}
!21 = !{!6, !12, i64 56}
!22 = !{!6, !7, i64 80}
!23 = !{!6, !7, i64 76}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,LCSSAPass,LICMPass,SROAPass,SimplifyCFGPass,TailCallElimPass