; LLVM IR from pms67/HadesFCS :: Communication/UAVDataLink (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"

%struct.DataContainer_INS = type { float, float, float, float }

@INSData = external dso_local global %struct.DataContainer_INS, align 4
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [256 x i8], align 16
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca [4 x i8], align 1
  %6 = alloca [256 x i8], align 16
  %7 = alloca i8, align 1
  %8 = alloca [4 x float], align 16
  %9 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  store float 5.000000e+00, ptr @INSData, align 4, !tbaa !5
  store float 0xC003333340000000, ptr getelementptr inbounds (%struct.DataContainer_INS, ptr @INSData, i32 0, i32 1), align 4, !tbaa !10
  store float 0x40516C2900000000, ptr getelementptr inbounds (%struct.DataContainer_INS, ptr @INSData, i32 0, i32 2), align 4, !tbaa !11
  store float 1.000000e+02, ptr getelementptr inbounds (%struct.DataContainer_INS, ptr @INSData, i32 0, i32 3), align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 256, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  %10 = getelementptr inbounds [256 x i8], ptr %2, i64 0, i64 0
  %11 = call zeroext i8 @UAVDataLink_pack(i8 noundef zeroext 3, i8 noundef zeroext 69, i8 noundef zeroext 16, ptr noundef @INSData, ptr noundef %10)
  store i8 %11, ptr %3, align 1, !tbaa !13
  %12 = load i8, ptr %3, align 1, !tbaa !13
  %13 = zext i8 %12 to i32
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %13)
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #4
  store i8 0, ptr %4, align 1, !tbaa !13
  br label %15

15:                                               ; preds = %29, %0
  %16 = load i8, ptr %4, align 1, !tbaa !13
  %17 = zext i8 %16 to i32
  %18 = load i8, ptr %3, align 1, !tbaa !13
  %19 = zext i8 %18 to i32
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #4
  br label %32

22:                                               ; preds = %15
  %23 = load i8, ptr %4, align 1, !tbaa !13
  %24 = zext i8 %23 to i64
  %25 = getelementptr inbounds [256 x i8], ptr %2, i64 0, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !13
  %27 = zext i8 %26 to i32
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %27)
  br label %29

29:                                               ; preds = %22
  %30 = load i8, ptr %4, align 1, !tbaa !13
  %31 = add i8 %30, 1
  store i8 %31, ptr %4, align 1, !tbaa !13
  br label %15, !llvm.loop !14

32:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 256, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  %33 = getelementptr inbounds [256 x i8], ptr %2, i64 0, i64 0
  %34 = load i8, ptr %3, align 1, !tbaa !13
  %35 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 0
  %36 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %37 = call zeroext i8 @UAVDataLink_unpack(ptr noundef %33, i8 noundef zeroext %34, ptr noundef %35, ptr noundef %36)
  store i8 %37, ptr %7, align 1, !tbaa !13
  %38 = load i8, ptr %7, align 1, !tbaa !13
  %39 = zext i8 %38 to i32
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %39)
  %41 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 0
  %42 = load i8, ptr %41, align 1, !tbaa !13
  %43 = zext i8 %42 to i32
  %44 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 1
  %45 = load i8, ptr %44, align 1, !tbaa !13
  %46 = zext i8 %45 to i32
  %47 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 2
  %48 = load i8, ptr %47, align 1, !tbaa !13
  %49 = zext i8 %48 to i32
  %50 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 3
  %51 = load i8, ptr %50, align 1, !tbaa !13
  %52 = zext i8 %51 to i32
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %43, i32 noundef %46, i32 noundef %49, i32 noundef %52)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  %54 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %55 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 3
  %56 = load i8, ptr %55, align 1, !tbaa !13
  %57 = getelementptr inbounds [4 x float], ptr %8, i64 0, i64 0
  %58 = call zeroext i8 @UAVDataLink_payloadToFloats(ptr noundef %54, i8 noundef zeroext %56, ptr noundef %57)
  store i8 %58, ptr %9, align 1, !tbaa !13
  %59 = getelementptr inbounds [4 x float], ptr %8, i64 0, i64 0
  %60 = load float, ptr %59, align 16, !tbaa !16
  %61 = fpext float %60 to double
  %62 = getelementptr inbounds [4 x float], ptr %8, i64 0, i64 1
  %63 = load float, ptr %62, align 4, !tbaa !16
  %64 = fpext float %63 to double
  %65 = getelementptr inbounds [4 x float], ptr %8, i64 0, i64 2
  %66 = load float, ptr %65, align 8, !tbaa !16
  %67 = fpext float %66 to double
  %68 = getelementptr inbounds [4 x float], ptr %8, i64 0, i64 3
  %69 = load float, ptr %68, align 4, !tbaa !16
  %70 = fpext float %69 to double
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %61, double noundef %64, double noundef %67, double noundef %70)
  %72 = call i32 @getchar()
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr %2) #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 zeroext i8 @UAVDataLink_pack(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef) #2

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

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

declare zeroext i8 @UAVDataLink_unpack(ptr noundef, i8 noundef zeroext, ptr noundef, ptr noundef) #2

declare zeroext i8 @UAVDataLink_payloadToFloats(ptr noundef, i8 noundef zeroext, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare i32 @getchar() #3

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 = { inlinehint 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 = { 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, !7, i64 0}
!6 = !{!"DataContainer_INS", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 12}
!13 = !{!8, !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!7, !7, i64 0}


; 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.DataContainer_INS = type { float, float, float, float }

@INSData = external dso_local global %struct.DataContainer_INS, align 4
@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [256 x i8], align 16
  %2 = alloca [4 x i8], align 1
  %3 = alloca [256 x i8], align 16
  %4 = alloca [4 x float], align 16
  store <4 x float> <float 5.000000e+00, float 0xC003333340000000, float 0x40516C2900000000, float 1.000000e+02>, ptr @INSData, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %1) #5
  %5 = call zeroext i8 @UAVDataLink_pack(i8 noundef zeroext 3, i8 noundef zeroext 69, i8 noundef zeroext 16, ptr noundef nonnull @INSData, ptr noundef nonnull %1) #5
  %6 = zext i8 %5 to i32
  %7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
  %.not = icmp eq i8 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %0
  %wide.trip.count = zext i8 %5 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #5
  %8 = call zeroext i8 @UAVDataLink_unpack(ptr noundef nonnull %1, i8 noundef zeroext %5, ptr noundef nonnull %2, ptr noundef nonnull %3) #5
  %9 = zext i8 %8 to i32
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
  %11 = load i8, ptr %2, align 1, !tbaa !9
  %12 = zext i8 %11 to i32
  %13 = getelementptr inbounds i8, ptr %2, i64 1
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %15 = zext i8 %14 to i32
  %16 = getelementptr inbounds i8, ptr %2, i64 2
  %17 = load i8, ptr %16, align 1, !tbaa !9
  %18 = zext i8 %17 to i32
  %19 = getelementptr inbounds i8, ptr %2, i64 3
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = zext i8 %20 to i32
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %12, i32 noundef %15, i32 noundef %18, i32 noundef %21)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %23 = load i8, ptr %19, align 1, !tbaa !9
  %24 = call zeroext i8 @UAVDataLink_payloadToFloats(ptr noundef nonnull %3, i8 noundef zeroext %23, ptr noundef nonnull %4) #5
  %25 = load float, ptr %4, align 16, !tbaa !5
  %26 = fpext float %25 to double
  %27 = getelementptr inbounds i8, ptr %4, i64 4
  %28 = load float, ptr %27, align 4, !tbaa !5
  %29 = fpext float %28 to double
  %30 = getelementptr inbounds i8, ptr %4, i64 8
  %31 = load float, ptr %30, align 8, !tbaa !5
  %32 = fpext float %31 to double
  %33 = getelementptr inbounds i8, ptr %4, i64 12
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = fpext float %34 to double
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %26, double noundef %29, double noundef %32, double noundef %35)
  %37 = call i32 @getchar()
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %1) #5
  ret i32 0

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %38 = getelementptr inbounds [256 x i8], ptr %1, i64 0, i64 %indvars.iv
  %39 = load i8, ptr %38, align 1, !tbaa !9
  %40 = zext i8 %39 to i32
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %40)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10
}

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

declare zeroext i8 @UAVDataLink_pack(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare zeroext i8 @UAVDataLink_unpack(ptr noundef, i8 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #2

declare zeroext i8 @UAVDataLink_payloadToFloats(ptr noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #4

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 = { mustprogress 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 = { 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 #4 = { inlinehint 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass