; LLVM IR from xergioalex/analysisOfSortAlgorithms :: algorithms/c (runTests)

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

@.str = external hidden unnamed_addr constant [44 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [50 x i8], align 16
  %12 = alloca [200 x i8], align 16
  store i32 0, ptr %3, align 4
  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 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 10, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 50, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 200, ptr %12) #4
  %13 = call i32 @system(ptr noundef @.str)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %87, %2
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = icmp sle i32 %15, 5
  br i1 %16, label %17, label %90

17:                                               ; preds = %14
  store i32 10, ptr %9, align 4, !tbaa !5
  store i32 1, ptr %10, align 4, !tbaa !5
  store i32 10, ptr %8, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %82, %17
  %19 = load i32, ptr %8, align 4, !tbaa !5
  %20 = icmp sle i32 %19, 1000000
  br i1 %20, label %21, label %86

21:                                               ; preds = %18
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = srem i32 %22, 10
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %28

25:                                               ; preds = %21
  store i32 1, ptr %10, align 4, !tbaa !5
  %26 = load i32, ptr %9, align 4, !tbaa !5
  %27 = mul nsw i32 %26, 10
  store i32 %27, ptr %9, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %25, %21
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %76, %28
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 7
  br i1 %31, label %32, label %79

32:                                               ; preds = %29
  %33 = getelementptr inbounds [50 x i8], ptr %11, i64 0, i64 0
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  br label %66

37:                                               ; preds = %32
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = icmp eq i32 %38, 1
  br i1 %39, label %40, label %41

40:                                               ; preds = %37
  br label %64

41:                                               ; preds = %37
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = icmp eq i32 %42, 2
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  br label %62

45:                                               ; preds = %41
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 3
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  br label %60

49:                                               ; preds = %45
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = icmp eq i32 %50, 4
  br i1 %51, label %52, label %53

52:                                               ; preds = %49
  br label %58

53:                                               ; preds = %49
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = icmp eq i32 %54, 5
  %56 = zext i1 %55 to i64
  %57 = select i1 %55, ptr @.str.6, ptr @.str.7
  br label %58

58:                                               ; preds = %53, %52
  %59 = phi ptr [ @.str.5, %52 ], [ %57, %53 ]
  br label %60

60:                                               ; preds = %58, %48
  %61 = phi ptr [ @.str.4, %48 ], [ %59, %58 ]
  br label %62

62:                                               ; preds = %60, %44
  %63 = phi ptr [ @.str.3, %44 ], [ %61, %60 ]
  br label %64

64:                                               ; preds = %62, %40
  %65 = phi ptr [ @.str.2, %40 ], [ %63, %62 ]
  br label %66

66:                                               ; preds = %64, %36
  %67 = phi ptr [ @.str.1, %36 ], [ %65, %64 ]
  %68 = call ptr @strcpy(ptr noundef %33, ptr noundef %67) #4
  %69 = getelementptr inbounds [200 x i8], ptr %12, i64 0, i64 0
  %70 = getelementptr inbounds [50 x i8], ptr %11, i64 0, i64 0
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %69, ptr noundef @.str.8, ptr noundef %70, i32 noundef %71) #4
  %73 = getelementptr inbounds [200 x i8], ptr %12, i64 0, i64 0
  %74 = call i32 @system(ptr noundef %73)
  %75 = call i32 @system(ptr noundef @.str.9)
  br label %76

76:                                               ; preds = %66
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  br label %29, !llvm.loop !11

79:                                               ; preds = %29
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %10, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %79
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = add nsw i32 %84, %83
  store i32 %85, ptr %8, align 4, !tbaa !5
  br label %18, !llvm.loop !13

86:                                               ; preds = %18
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %6, align 4, !tbaa !5
  br label %14, !llvm.loop !14

90:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 200, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 50, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  ret i32 0
}

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

declare i32 @system(ptr noundef) #2

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

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

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


; 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 [44 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca [50 x i8], align 16
  %4 = alloca [200 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %4) #5
  %5 = tail call i32 @system(ptr noundef nonnull @.str) #5
  br label %.preheader

.preheader:                                       ; preds = %2, %42
  %.02130 = phi i32 [ 0, %2 ], [ %43, %42 ]
  br label %6

6:                                                ; preds = %6, %.preheader
  %.029 = phi i32 [ 1, %.preheader ], [ %39, %6 ]
  %.01728 = phi i32 [ 10, %.preheader ], [ %spec.select, %6 ]
  %.01927 = phi i32 [ 10, %.preheader ], [ %40, %6 ]
  %7 = srem i32 %.029, 10
  %8 = icmp eq i32 %7, 0
  %9 = mul nsw i32 %.01728, 10
  %spec.select = select i1 %8, i32 %9, i32 %.01728
  %10 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.1) #5
  %11 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %12 = call i32 @system(ptr noundef nonnull %4) #5
  %13 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %14 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.2) #5
  %15 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %16 = call i32 @system(ptr noundef nonnull %4) #5
  %17 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %18 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.3) #5
  %19 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %20 = call i32 @system(ptr noundef nonnull %4) #5
  %21 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %22 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.4) #5
  %23 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %24 = call i32 @system(ptr noundef nonnull %4) #5
  %25 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %26 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.5) #5
  %27 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %28 = call i32 @system(ptr noundef nonnull %4) #5
  %29 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %30 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.6) #5
  %31 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %32 = call i32 @system(ptr noundef nonnull %4) #5
  %33 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %34 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.7) #5
  %35 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %3, i32 noundef %.01927) #5
  %36 = call i32 @system(ptr noundef nonnull %4) #5
  %37 = call i32 @system(ptr noundef nonnull @.str.9) #5
  %38 = add nsw i32 %.029, 1
  %39 = select i1 %8, i32 2, i32 %38
  %40 = add nsw i32 %spec.select, %.01927
  %41 = icmp slt i32 %40, 1000001
  br i1 %41, label %6, label %42, !llvm.loop !5

42:                                               ; preds = %6
  %43 = add nuw nsw i32 %.02130, 1
  %exitcond.not = icmp eq i32 %43, 6
  br i1 %exitcond.not, label %44, label %.preheader, !llvm.loop !7

44:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %3) #5
  ret i32 0
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

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

attributes #0 = { nofree 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree "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 nofree nounwind willreturn memory(argmem: readwrite) "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 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass