; LLVM IR from OpenDiS/OpenDiS :: core/pydis/c/util (Timer)

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

%struct._home = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, double, double, double, double, double, double, i32, i32, i32, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, i32, ptr, ptr, ptr, i32, i32, i32, [3 x [3 x double]], [3 x [3 x double]], %struct.BurgInfo_t, i32, i32, i32, i32, i32, i32, i32, %struct.timeval }
%struct.BurgInfo_t = type { i32, i32, ptr, ptr, ptr, ptr }
%struct.timeval = type { i64, i64 }
%struct._timer = type { double, double, double, double, i32, ptr }

; 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: nounwind uwtable
define dso_local void @TimerClearAll(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %4

4:                                                ; preds = %19, %1
  %5 = load i32, ptr %3, align 4, !tbaa !9
  %6 = icmp slt i32 %5, 35
  br i1 %6, label %7, label %22

7:                                                ; preds = %4
  %8 = load i32, ptr %3, align 4, !tbaa !9
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %11

10:                                               ; preds = %7
  br label %19

11:                                               ; preds = %7
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._home, ptr %12, i32 0, i32 51
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds %struct._timer, ptr %14, i64 %16
  %18 = getelementptr inbounds %struct._timer, ptr %17, i32 0, i32 1
  store double 0.000000e+00, ptr %18, align 8, !tbaa !17
  br label %19

19:                                               ; preds = %11, %10
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %3, align 4, !tbaa !9
  br label %4, !llvm.loop !19

22:                                               ; preds = %4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 344}
!12 = !{!"_home", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104, !10, i64 112, !10, i64 116, !6, i64 120, !10, i64 128, !10, i64 132, !10, i64 136, !6, i64 144, !10, i64 152, !10, i64 156, !6, i64 160, !6, i64 168, !6, i64 176, !13, i64 184, !13, i64 192, !13, i64 200, !13, i64 208, !13, i64 216, !13, i64 224, !10, i64 232, !10, i64 236, !10, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !10, i64 272, !6, i64 280, !10, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !10, i64 320, !10, i64 324, !6, i64 328, !10, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !10, i64 368, !10, i64 372, !10, i64 376, !6, i64 384, !6, i64 392, !10, i64 400, !10, i64 404, !6, i64 408, !6, i64 416, !6, i64 424, !10, i64 432, !10, i64 436, !10, i64 440, !7, i64 448, !7, i64 520, !14, i64 592, !10, i64 632, !10, i64 636, !10, i64 640, !10, i64 644, !10, i64 648, !10, i64 652, !10, i64 656, !15, i64 664}
!13 = !{!"double", !7, i64 0}
!14 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!"timeval", !16, i64 0, !16, i64 8}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !13, i64 8}
!18 = !{!"_timer", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !10, i64 32, !6, i64 40}
!19 = distinct !{!19, !20}
!20 = !{!"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(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @TimerClearAll(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 344
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 56
  store double 0.000000e+00, ptr %4, align 8, !tbaa !15
  %5 = getelementptr inbounds i8, ptr %3, i64 104
  store double 0.000000e+00, ptr %5, align 8, !tbaa !15
  %6 = getelementptr inbounds i8, ptr %3, i64 152
  store double 0.000000e+00, ptr %6, align 8, !tbaa !15
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 200
  store double 0.000000e+00, ptr %8, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %7, i64 248
  store double 0.000000e+00, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %7, i64 296
  store double 0.000000e+00, ptr %10, align 8, !tbaa !15
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 344
  store double 0.000000e+00, ptr %12, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %11, i64 392
  store double 0.000000e+00, ptr %13, align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %11, i64 440
  store double 0.000000e+00, ptr %14, align 8, !tbaa !15
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 488
  store double 0.000000e+00, ptr %16, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %15, i64 536
  store double 0.000000e+00, ptr %17, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %15, i64 584
  store double 0.000000e+00, ptr %18, align 8, !tbaa !15
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 632
  store double 0.000000e+00, ptr %20, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %19, i64 680
  store double 0.000000e+00, ptr %21, align 8, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %19, i64 728
  store double 0.000000e+00, ptr %22, align 8, !tbaa !15
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 776
  store double 0.000000e+00, ptr %24, align 8, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %23, i64 824
  store double 0.000000e+00, ptr %25, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %23, i64 872
  store double 0.000000e+00, ptr %26, align 8, !tbaa !15
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 920
  store double 0.000000e+00, ptr %28, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %27, i64 968
  store double 0.000000e+00, ptr %29, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %27, i64 1016
  store double 0.000000e+00, ptr %30, align 8, !tbaa !15
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 1064
  store double 0.000000e+00, ptr %32, align 8, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %31, i64 1112
  store double 0.000000e+00, ptr %33, align 8, !tbaa !15
  %34 = getelementptr inbounds i8, ptr %31, i64 1160
  store double 0.000000e+00, ptr %34, align 8, !tbaa !15
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 1208
  store double 0.000000e+00, ptr %36, align 8, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %35, i64 1256
  store double 0.000000e+00, ptr %37, align 8, !tbaa !15
  %38 = getelementptr inbounds i8, ptr %35, i64 1304
  store double 0.000000e+00, ptr %38, align 8, !tbaa !15
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 1352
  store double 0.000000e+00, ptr %40, align 8, !tbaa !15
  %41 = getelementptr inbounds i8, ptr %39, i64 1400
  store double 0.000000e+00, ptr %41, align 8, !tbaa !15
  %42 = getelementptr inbounds i8, ptr %39, i64 1448
  store double 0.000000e+00, ptr %42, align 8, !tbaa !15
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 1496
  store double 0.000000e+00, ptr %44, align 8, !tbaa !15
  %45 = getelementptr inbounds i8, ptr %43, i64 1544
  store double 0.000000e+00, ptr %45, align 8, !tbaa !15
  %46 = getelementptr inbounds i8, ptr %43, i64 1592
  store double 0.000000e+00, ptr %46, align 8, !tbaa !15
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 1640
  store double 0.000000e+00, ptr %48, align 8, !tbaa !15
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) 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, !10, i64 344}
!6 = !{!"_home", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !7, i64 96, !7, i64 100, !10, i64 104, !7, i64 112, !7, i64 116, !10, i64 120, !7, i64 128, !7, i64 132, !7, i64 136, !10, i64 144, !7, i64 152, !7, i64 156, !10, i64 160, !10, i64 168, !10, i64 176, !11, i64 184, !11, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !7, i64 232, !7, i64 236, !7, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !7, i64 272, !10, i64 280, !7, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !7, i64 320, !7, i64 324, !10, i64 328, !7, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !7, i64 368, !7, i64 372, !7, i64 376, !10, i64 384, !10, i64 392, !7, i64 400, !7, i64 404, !10, i64 408, !10, i64 416, !10, i64 424, !7, i64 432, !7, i64 436, !7, i64 440, !8, i64 448, !8, i64 520, !12, i64 592, !7, i64 632, !7, i64 636, !7, i64 640, !7, i64 644, !7, i64 648, !7, i64 652, !7, i64 656, !13, i64 664}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = !{!"timeval", !14, i64 0, !14, i64 8}
!14 = !{!"long", !8, i64 0}
!15 = !{!16, !11, i64 8}
!16 = !{!"_timer", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !7, i64 32, !10, i64 40}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass