; LLVM IR from hpcg-benchmark/hpcg :: src/MixedBaseCounter.ll (ZN16MixedBaseCounterC2EPii)

; 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.MixedBaseCounter = type { i32, [33 x i32], [33 x i32] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN16MixedBaseCounterC2EPii(ptr noundef nonnull align 4 dereferenceable(268) %0, ptr noundef %1, i32 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  %9 = load i32, ptr %6, align 4, !tbaa !9
  %10 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 0
  store i32 %9, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %28, %3
  %12 = load i32, ptr %7, align 4, !tbaa !9
  %13 = icmp slt i32 %12, 32
  br i1 %13, label %14, label %31

14:                                               ; preds = %11
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %15, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 1
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [33 x i32], ptr %20, i64 0, i64 %22
  store i32 %19, ptr %23, align 4, !tbaa !9
  %24 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 2
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [33 x i32], ptr %24, i64 0, i64 %26
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %14
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %7, align 4, !tbaa !9
  br label %11, !llvm.loop !13

31:                                               ; preds = %11
  %32 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 2
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [33 x i32], ptr %32, i64 0, i64 %34
  store i32 0, ptr %35, align 4, !tbaa !9
  %36 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 1
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [33 x i32], ptr %36, i64 0, i64 %38
  store i32 0, ptr %39, align 4, !tbaa !9
  %40 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 2
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [33 x i32], ptr %40, i64 0, i64 %42
  store i32 0, ptr %43, align 4, !tbaa !9
  %44 = getelementptr inbounds %class.MixedBaseCounter, ptr %8, i32 0, i32 1
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [33 x i32], ptr %44, i64 0, i64 %46
  store i32 0, ptr %47, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret void
}

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS16MixedBaseCounter", !10, i64 0, !7, i64 4, !7, i64 136}
!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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN16MixedBaseCounterC2EPii(ptr nocapture noundef nonnull writeonly align 4 dereferenceable(268) %0, ptr nocapture noundef readonly %1, i32 noundef %2) unnamed_addr #0 align 2 {
  store i32 %2, ptr %0, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = getelementptr inbounds i8, ptr %0, i64 136
  %6 = load i32, ptr %1, align 4, !tbaa !10
  store i32 %6, ptr %4, align 4, !tbaa !10
  store i32 0, ptr %5, align 4, !tbaa !10
  %7 = getelementptr inbounds i8, ptr %1, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !10
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %8, ptr %9, align 4, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %0, i64 140
  store i32 0, ptr %10, align 4, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load i32, ptr %11, align 4, !tbaa !10
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %12, ptr %13, align 4, !tbaa !10
  %14 = getelementptr inbounds i8, ptr %0, i64 144
  store i32 0, ptr %14, align 4, !tbaa !10
  %15 = getelementptr inbounds i8, ptr %1, i64 12
  %16 = load i32, ptr %15, align 4, !tbaa !10
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %16, ptr %17, align 4, !tbaa !10
  %18 = getelementptr inbounds i8, ptr %0, i64 148
  store i32 0, ptr %18, align 4, !tbaa !10
  %19 = getelementptr inbounds i8, ptr %1, i64 16
  %20 = load i32, ptr %19, align 4, !tbaa !10
  %21 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %20, ptr %21, align 4, !tbaa !10
  %22 = getelementptr inbounds i8, ptr %0, i64 152
  store i32 0, ptr %22, align 4, !tbaa !10
  %23 = getelementptr inbounds i8, ptr %1, i64 20
  %24 = load i32, ptr %23, align 4, !tbaa !10
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %24, ptr %25, align 4, !tbaa !10
  %26 = getelementptr inbounds i8, ptr %0, i64 156
  store i32 0, ptr %26, align 4, !tbaa !10
  %27 = getelementptr inbounds i8, ptr %1, i64 24
  %28 = load i32, ptr %27, align 4, !tbaa !10
  %29 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %28, ptr %29, align 4, !tbaa !10
  %30 = getelementptr inbounds i8, ptr %0, i64 160
  store i32 0, ptr %30, align 4, !tbaa !10
  %31 = getelementptr inbounds i8, ptr %1, i64 28
  %32 = load i32, ptr %31, align 4, !tbaa !10
  %33 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %32, ptr %33, align 4, !tbaa !10
  %34 = getelementptr inbounds i8, ptr %0, i64 164
  store i32 0, ptr %34, align 4, !tbaa !10
  %35 = getelementptr inbounds i8, ptr %1, i64 32
  %36 = load i32, ptr %35, align 4, !tbaa !10
  %37 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %36, ptr %37, align 4, !tbaa !10
  %38 = getelementptr inbounds i8, ptr %0, i64 168
  store i32 0, ptr %38, align 4, !tbaa !10
  %39 = getelementptr inbounds i8, ptr %1, i64 36
  %40 = load i32, ptr %39, align 4, !tbaa !10
  %41 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %40, ptr %41, align 4, !tbaa !10
  %42 = getelementptr inbounds i8, ptr %0, i64 172
  store i32 0, ptr %42, align 4, !tbaa !10
  %43 = getelementptr inbounds i8, ptr %1, i64 40
  %44 = load i32, ptr %43, align 4, !tbaa !10
  %45 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %44, ptr %45, align 4, !tbaa !10
  %46 = getelementptr inbounds i8, ptr %0, i64 176
  store i32 0, ptr %46, align 4, !tbaa !10
  %47 = getelementptr inbounds i8, ptr %1, i64 44
  %48 = load i32, ptr %47, align 4, !tbaa !10
  %49 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %48, ptr %49, align 4, !tbaa !10
  %50 = getelementptr inbounds i8, ptr %0, i64 180
  store i32 0, ptr %50, align 4, !tbaa !10
  %51 = getelementptr inbounds i8, ptr %1, i64 48
  %52 = load i32, ptr %51, align 4, !tbaa !10
  %53 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %52, ptr %53, align 4, !tbaa !10
  %54 = getelementptr inbounds i8, ptr %0, i64 184
  store i32 0, ptr %54, align 4, !tbaa !10
  %55 = getelementptr inbounds i8, ptr %1, i64 52
  %56 = load i32, ptr %55, align 4, !tbaa !10
  %57 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %56, ptr %57, align 4, !tbaa !10
  %58 = getelementptr inbounds i8, ptr %0, i64 188
  store i32 0, ptr %58, align 4, !tbaa !10
  %59 = getelementptr inbounds i8, ptr %1, i64 56
  %60 = load i32, ptr %59, align 4, !tbaa !10
  %61 = getelementptr inbounds i8, ptr %0, i64 60
  store i32 %60, ptr %61, align 4, !tbaa !10
  %62 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 0, ptr %62, align 4, !tbaa !10
  %63 = getelementptr inbounds i8, ptr %1, i64 60
  %64 = load i32, ptr %63, align 4, !tbaa !10
  %65 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 %64, ptr %65, align 4, !tbaa !10
  %66 = getelementptr inbounds i8, ptr %0, i64 196
  store i32 0, ptr %66, align 4, !tbaa !10
  %67 = getelementptr inbounds i8, ptr %1, i64 64
  %68 = load i32, ptr %67, align 4, !tbaa !10
  %69 = getelementptr inbounds i8, ptr %0, i64 68
  store i32 %68, ptr %69, align 4, !tbaa !10
  %70 = getelementptr inbounds i8, ptr %0, i64 200
  store i32 0, ptr %70, align 4, !tbaa !10
  %71 = getelementptr inbounds i8, ptr %1, i64 68
  %72 = load i32, ptr %71, align 4, !tbaa !10
  %73 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 %72, ptr %73, align 4, !tbaa !10
  %74 = getelementptr inbounds i8, ptr %0, i64 204
  store i32 0, ptr %74, align 4, !tbaa !10
  %75 = getelementptr inbounds i8, ptr %1, i64 72
  %76 = load i32, ptr %75, align 4, !tbaa !10
  %77 = getelementptr inbounds i8, ptr %0, i64 76
  store i32 %76, ptr %77, align 4, !tbaa !10
  %78 = getelementptr inbounds i8, ptr %0, i64 208
  store i32 0, ptr %78, align 4, !tbaa !10
  %79 = getelementptr inbounds i8, ptr %1, i64 76
  %80 = load i32, ptr %79, align 4, !tbaa !10
  %81 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 %80, ptr %81, align 4, !tbaa !10
  %82 = getelementptr inbounds i8, ptr %0, i64 212
  store i32 0, ptr %82, align 4, !tbaa !10
  %83 = getelementptr inbounds i8, ptr %1, i64 80
  %84 = load i32, ptr %83, align 4, !tbaa !10
  %85 = getelementptr inbounds i8, ptr %0, i64 84
  store i32 %84, ptr %85, align 4, !tbaa !10
  %86 = getelementptr inbounds i8, ptr %0, i64 216
  store i32 0, ptr %86, align 4, !tbaa !10
  %87 = getelementptr inbounds i8, ptr %1, i64 84
  %88 = load i32, ptr %87, align 4, !tbaa !10
  %89 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 %88, ptr %89, align 4, !tbaa !10
  %90 = getelementptr inbounds i8, ptr %0, i64 220
  store i32 0, ptr %90, align 4, !tbaa !10
  %91 = getelementptr inbounds i8, ptr %1, i64 88
  %92 = load i32, ptr %91, align 4, !tbaa !10
  %93 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 %92, ptr %93, align 4, !tbaa !10
  %94 = getelementptr inbounds i8, ptr %0, i64 224
  store i32 0, ptr %94, align 4, !tbaa !10
  %95 = getelementptr inbounds i8, ptr %1, i64 92
  %96 = load i32, ptr %95, align 4, !tbaa !10
  %97 = getelementptr inbounds i8, ptr %0, i64 96
  store i32 %96, ptr %97, align 4, !tbaa !10
  %98 = getelementptr inbounds i8, ptr %0, i64 228
  store i32 0, ptr %98, align 4, !tbaa !10
  %99 = getelementptr inbounds i8, ptr %1, i64 96
  %100 = load i32, ptr %99, align 4, !tbaa !10
  %101 = getelementptr inbounds i8, ptr %0, i64 100
  store i32 %100, ptr %101, align 4, !tbaa !10
  %102 = getelementptr inbounds i8, ptr %0, i64 232
  store i32 0, ptr %102, align 4, !tbaa !10
  %103 = getelementptr inbounds i8, ptr %1, i64 100
  %104 = load i32, ptr %103, align 4, !tbaa !10
  %105 = getelementptr inbounds i8, ptr %0, i64 104
  store i32 %104, ptr %105, align 4, !tbaa !10
  %106 = getelementptr inbounds i8, ptr %0, i64 236
  store i32 0, ptr %106, align 4, !tbaa !10
  %107 = getelementptr inbounds i8, ptr %1, i64 104
  %108 = load i32, ptr %107, align 4, !tbaa !10
  %109 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 %108, ptr %109, align 4, !tbaa !10
  %110 = getelementptr inbounds i8, ptr %0, i64 240
  store i32 0, ptr %110, align 4, !tbaa !10
  %111 = getelementptr inbounds i8, ptr %1, i64 108
  %112 = load i32, ptr %111, align 4, !tbaa !10
  %113 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 %112, ptr %113, align 4, !tbaa !10
  %114 = getelementptr inbounds i8, ptr %0, i64 244
  store i32 0, ptr %114, align 4, !tbaa !10
  %115 = getelementptr inbounds i8, ptr %1, i64 112
  %116 = load i32, ptr %115, align 4, !tbaa !10
  %117 = getelementptr inbounds i8, ptr %0, i64 116
  store i32 %116, ptr %117, align 4, !tbaa !10
  %118 = getelementptr inbounds i8, ptr %0, i64 248
  store i32 0, ptr %118, align 4, !tbaa !10
  %119 = getelementptr inbounds i8, ptr %1, i64 116
  %120 = load i32, ptr %119, align 4, !tbaa !10
  %121 = getelementptr inbounds i8, ptr %0, i64 120
  store i32 %120, ptr %121, align 4, !tbaa !10
  %122 = getelementptr inbounds i8, ptr %0, i64 252
  store i32 0, ptr %122, align 4, !tbaa !10
  %123 = getelementptr inbounds i8, ptr %1, i64 120
  %124 = load i32, ptr %123, align 4, !tbaa !10
  %125 = getelementptr inbounds i8, ptr %0, i64 124
  store i32 %124, ptr %125, align 4, !tbaa !10
  %126 = getelementptr inbounds i8, ptr %0, i64 256
  store i32 0, ptr %126, align 4, !tbaa !10
  %127 = getelementptr inbounds i8, ptr %1, i64 124
  %128 = load i32, ptr %127, align 4, !tbaa !10
  %129 = getelementptr inbounds i8, ptr %0, i64 128
  store i32 %128, ptr %129, align 4, !tbaa !10
  %130 = getelementptr inbounds i8, ptr %0, i64 260
  store i32 0, ptr %130, align 4, !tbaa !10
  %131 = getelementptr inbounds i8, ptr %0, i64 264
  store i32 0, ptr %131, align 4, !tbaa !10
  %132 = getelementptr inbounds i8, ptr %0, i64 132
  store i32 0, ptr %132, align 4, !tbaa !10
  %133 = sext i32 %2 to i64
  %134 = getelementptr inbounds [33 x i32], ptr %5, i64 0, i64 %133
  store i32 0, ptr %134, align 4, !tbaa !10
  %135 = getelementptr inbounds [33 x i32], ptr %4, i64 0, i64 %133
  store i32 0, ptr %135, align 4, !tbaa !10
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !7, i64 0}
!6 = !{!"_ZTS16MixedBaseCounter", !7, i64 0, !8, i64 4, !8, i64 136}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass