; LLVM IR from stivalaa/EstimNetDirected :: src/Random123-1.09/examples (simple)

; 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.r123array2x64 = type { [2 x i64] }

@__const.main.key = external hidden unnamed_addr constant %struct.r123array2x64, align 8
@.str = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [54 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 %struct.r123array2x64, align 8
  %8 = alloca %struct.r123array2x64, align 8
  %9 = alloca %struct.r123array2x64, align 8
  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) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 @__const.main.key, i64 16, i1 false)
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %struct.r123array2x64, ptr %8, i32 0, i32 0
  %13 = getelementptr inbounds [2 x i64], ptr %12, i64 0, i64 0
  %14 = load i64, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds %struct.r123array2x64, ptr %8, i32 0, i32 0
  %16 = getelementptr inbounds [2 x i64], ptr %15, i64 0, i64 1
  %17 = load i64, ptr %16, align 8, !tbaa !11
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %14, i64 noundef %17)
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %54, %2
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 10
  br i1 %21, label %22, label %57

22:                                               ; preds = %19
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds %struct.r123array2x64, ptr %7, i32 0, i32 0
  %26 = getelementptr inbounds [2 x i64], ptr %25, i64 0, i64 0
  store i64 %24, ptr %26, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %27 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 0
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 1
  %30 = load i64, ptr %29, align 8
  %31 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %32 = load i64, ptr %31, align 8
  %33 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %34 = load i64, ptr %33, align 8
  %35 = call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 %28, i64 %30, i64 %32, i64 %34)
  %36 = getelementptr inbounds %struct.r123array2x64, ptr %9, i32 0, i32 0
  %37 = getelementptr inbounds { i64, i64 }, ptr %36, i32 0, i32 0
  %38 = extractvalue { i64, i64 } %35, 0
  store i64 %38, ptr %37, align 8
  %39 = getelementptr inbounds { i64, i64 }, ptr %36, i32 0, i32 1
  %40 = extractvalue { i64, i64 } %35, 1
  store i64 %40, ptr %39, align 8
  %41 = getelementptr inbounds %struct.r123array2x64, ptr %7, i32 0, i32 0
  %42 = getelementptr inbounds [2 x i64], ptr %41, i64 0, i64 0
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds %struct.r123array2x64, ptr %7, i32 0, i32 0
  %45 = getelementptr inbounds [2 x i64], ptr %44, i64 0, i64 1
  %46 = load i64, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.r123array2x64, ptr %9, i32 0, i32 0
  %48 = getelementptr inbounds [2 x i64], ptr %47, i64 0, i64 0
  %49 = load i64, ptr %48, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.r123array2x64, ptr %9, i32 0, i32 0
  %51 = getelementptr inbounds [2 x i64], ptr %50, i64 0, i64 1
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %43, i64 noundef %46, i64 noundef %49, i64 noundef %52)
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  br label %54

54:                                               ; preds = %22
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %6, align 4, !tbaa !5
  br label %19, !llvm.loop !13

57:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  ret i32 0
}

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden { i64, i64 } @threefry2x64_R(i32 noundef, i64, i64, i64, i64) #5

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { alwaysinline 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 #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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, 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"

%struct.r123array2x64 = type { [2 x i64] }

@__const.main.key = external hidden unnamed_addr constant %struct.r123array2x64, align 8
@.str = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %.sroa.01.0.copyload = load i64, ptr @__const.main.key, align 8
  %.sroa.5.0.copyload = load i64, ptr getelementptr inbounds (i8, ptr @__const.main.key, i64 8), align 8
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.sroa.01.0.copyload, i64 noundef %.sroa.5.0.copyload)
  %4 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 0, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %5 = extractvalue { i64, i64 } %4, 0
  %6 = extractvalue { i64, i64 } %4, 1
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 0, i64 noundef 0, i64 noundef %5, i64 noundef %6)
  %8 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 1, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %9 = extractvalue { i64, i64 } %8, 0
  %10 = extractvalue { i64, i64 } %8, 1
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 1, i64 noundef 0, i64 noundef %9, i64 noundef %10)
  %12 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 2, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %13 = extractvalue { i64, i64 } %12, 0
  %14 = extractvalue { i64, i64 } %12, 1
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 2, i64 noundef 0, i64 noundef %13, i64 noundef %14)
  %16 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 3, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %17 = extractvalue { i64, i64 } %16, 0
  %18 = extractvalue { i64, i64 } %16, 1
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 3, i64 noundef 0, i64 noundef %17, i64 noundef %18)
  %20 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 4, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %21 = extractvalue { i64, i64 } %20, 0
  %22 = extractvalue { i64, i64 } %20, 1
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 4, i64 noundef 0, i64 noundef %21, i64 noundef %22)
  %24 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 5, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %25 = extractvalue { i64, i64 } %24, 0
  %26 = extractvalue { i64, i64 } %24, 1
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 5, i64 noundef 0, i64 noundef %25, i64 noundef %26)
  %28 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 6, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %29 = extractvalue { i64, i64 } %28, 0
  %30 = extractvalue { i64, i64 } %28, 1
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 6, i64 noundef 0, i64 noundef %29, i64 noundef %30)
  %32 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 7, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %33 = extractvalue { i64, i64 } %32, 0
  %34 = extractvalue { i64, i64 } %32, 1
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 7, i64 noundef 0, i64 noundef %33, i64 noundef %34)
  %36 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 8, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %37 = extractvalue { i64, i64 } %36, 0
  %38 = extractvalue { i64, i64 } %36, 1
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 8, i64 noundef 0, i64 noundef %37, i64 noundef %38)
  %40 = tail call { i64, i64 } @threefry2x64_R(i32 noundef 20, i64 9, i64 0, i64 %.sroa.01.0.copyload, i64 %.sroa.5.0.copyload)
  %41 = extractvalue { i64, i64 } %40, 0
  %42 = extractvalue { i64, i64 } %40, 1
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 9, i64 noundef 0, i64 noundef %41, i64 noundef %42)
  ret i32 0
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden { i64, i64 } @threefry2x64_R(i32 noundef, i64, i64, i64, i64) local_unnamed_addr #2

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 = { 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 #2 = { alwaysinline 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" }

!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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass