; LLVM IR from Dev-XYS/Algorithms :: High-Precision(Integer) (main)

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

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 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: mustprogress uwtable
declare dso_local void @_ZN4lint4readEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lintplES_(ptr dead_on_unwind noalias writable sret(%class.lint) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lintmiES_(ptr dead_on_unwind noalias writable sret(%class.lint) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lintmlES_(ptr dead_on_unwind noalias writable sret(%class.lint) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) #1 align 2

; 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) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4lintltES_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) #4 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #5 {
  %1 = alloca i32, align 4
  %2 = alloca %class.lint, align 8
  %3 = alloca %class.lint, align 8
  %4 = alloca [10 x i8], align 1
  %5 = alloca %class.lint, align 8
  %6 = alloca %class.lint, align 8
  %7 = alloca %class.lint, align 8
  %8 = alloca %class.lint, align 8
  %9 = alloca %class.lint, align 8
  %10 = alloca %class.lint, align 8
  %11 = alloca %class.lint, align 8
  %12 = alloca %class.lint, align 8
  %13 = alloca %class.lint, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #6
  call void @_ZN4lintC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 100)
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #6
  call void @_ZN4lintC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef 100)
  call void @llvm.lifetime.start.p0(i64 10, ptr %4) #6
  br label %14

14:                                               ; preds = %31, %0
  br label %15

15:                                               ; preds = %14
  call void @_ZN4lint4readEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %16 = getelementptr inbounds [10 x i8], ptr %4, i64 0, i64 0
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %16)
  call void @_ZN4lint4readEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %18 = getelementptr inbounds [10 x i8], ptr %4, i64 0, i64 0
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %20 = sext i8 %19 to i32
  switch i32 %20, label %29 [
    i32 43, label %21
    i32 45, label %22
    i32 42, label %28
  ]

21:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !8
  call void @_ZN4lintplES_(ptr dead_on_unwind writable sret(%class.lint) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef byval(%class.lint) align 8 %6)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  br label %31

22:                                               ; preds = %15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !8
  %23 = call noundef zeroext i1 @_ZN4lintltES_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef byval(%class.lint) align 8 %7)
  br i1 %23, label %24, label %26

24:                                               ; preds = %22
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %2, i64 24, i1 false), !tbaa.struct !8
  call void @_ZN4lintmiES_(ptr dead_on_unwind writable sret(%class.lint) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef byval(%class.lint) align 8 %9)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #6
  br label %27

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !8
  call void @_ZN4lintmiES_(ptr dead_on_unwind writable sret(%class.lint) align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef byval(%class.lint) align 8 %11)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #6
  br label %27

27:                                               ; preds = %26, %24
  br label %31

28:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !8
  call void @_ZN4lintmlES_(ptr dead_on_unwind writable sret(%class.lint) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef byval(%class.lint) align 8 %13)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  br label %31

29:                                               ; preds = %15
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %31

31:                                               ; preds = %29, %28, %27, %21
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %14, !llvm.loop !13
}

declare void @_ZN4lintC1Ei(ptr, i32)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress norecurse 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 #6 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 8, !11, i64 16, i64 8, !11}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !6, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

%class.lint = type { i32, i32, ptr, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 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: mustprogress uwtable
declare dso_local void @_ZN4lint4readEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lintplES_(ptr dead_on_unwind noalias writable sret(%class.lint) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lintmiES_(ptr dead_on_unwind noalias writable sret(%class.lint) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lintmlES_(ptr dead_on_unwind noalias writable sret(%class.lint) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4lintltES_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef byval(%class.lint) align 8) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress norecurse noreturn uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %class.lint, align 8
  %2 = alloca %class.lint, align 8
  %3 = alloca [10 x i8], align 1
  %4 = alloca %class.lint, align 8
  %5 = alloca %class.lint, align 8
  %6 = alloca %class.lint, align 8
  %7 = alloca %class.lint, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #5
  call void @_ZN4lintC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef 100)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  call void @_ZN4lintC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 100)
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %3) #5
  br label %8

8:                                                ; preds = %20, %0
  call void @_ZN4lint4readEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  call void @_ZN4lint4readEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %10 = load i8, ptr %3, align 1, !tbaa !5
  switch i8 %10, label %18 [
    i8 43, label %11
    i8 45, label %12
    i8 42, label %17
  ]

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @_ZN4lintplES_(ptr dead_on_unwind nonnull writable sret(%class.lint) align 8 %4, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull byval(%class.lint) align 8 %2)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %20

12:                                               ; preds = %8
  %13 = call noundef zeroext i1 @_ZN4lintltES_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull byval(%class.lint) align 8 %2)
  br i1 %13, label %14, label %16

14:                                               ; preds = %12
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @_ZN4lintmiES_(ptr dead_on_unwind nonnull writable sret(%class.lint) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull byval(%class.lint) align 8 %1)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %20

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  call void @_ZN4lintmiES_(ptr dead_on_unwind nonnull writable sret(%class.lint) align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull byval(%class.lint) align 8 %2)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  br label %20

17:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @_ZN4lintmlES_(ptr dead_on_unwind nonnull writable sret(%class.lint) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull byval(%class.lint) align 8 %2)
  call void @_ZN4lint5writeEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  br label %20

18:                                               ; preds = %8
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %20

20:                                               ; preds = %14, %16, %18, %17, %11
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %8, !llvm.loop !8
}

declare void @_ZN4lintC1Ei(ptr, i32) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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 #4 = { mustprogress norecurse noreturn 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 #5 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass