; LLVM IR from boschglobal/dse.network :: dse/network/examples/stub (stub)

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_right_shift_u32(i32 noundef, i8 noundef zeroext, i8 noundef zeroext) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_left_shift_u32(i32 noundef, i8 noundef zeroext, i8 noundef zeroext) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_right_shift_u64(i64 noundef, i8 noundef zeroext, i8 noundef zeroext) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_left_shift_u64(i64 noundef, i8 noundef zeroext, i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @stub_float_types_pack(ptr noundef %0, ptr noundef %1, i64 noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %11 = load i64, ptr %7, align 8, !tbaa !9
  %12 = icmp ult i64 %11, 16
  br i1 %12, label %13, label %14

13:                                               ; preds = %3
  store i32 -22, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %129

14:                                               ; preds = %3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 0
  call void @llvm.memset.p0.i64(ptr align 1 %16, i8 0, i64 16, i1 false)
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.stub_float_types_t, ptr %17, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %18, i64 8, i1 false)
  %19 = load i64, ptr %9, align 8, !tbaa !9
  %20 = call zeroext i8 @pack_left_shift_u64(i64 noundef %19, i8 noundef zeroext 0, i8 noundef zeroext -1)
  %21 = zext i8 %20 to i32
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 0
  %24 = load i8, ptr %23, align 1, !tbaa !11
  %25 = zext i8 %24 to i32
  %26 = or i32 %25, %21
  %27 = trunc i32 %26 to i8
  store i8 %27, ptr %23, align 1, !tbaa !11
  %28 = load i64, ptr %9, align 8, !tbaa !9
  %29 = call zeroext i8 @pack_right_shift_u64(i64 noundef %28, i8 noundef zeroext 8, i8 noundef zeroext -1)
  %30 = zext i8 %29 to i32
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 1
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = zext i8 %33 to i32
  %35 = or i32 %34, %30
  %36 = trunc i32 %35 to i8
  store i8 %36, ptr %32, align 1, !tbaa !11
  %37 = load i64, ptr %9, align 8, !tbaa !9
  %38 = call zeroext i8 @pack_right_shift_u64(i64 noundef %37, i8 noundef zeroext 16, i8 noundef zeroext -1)
  %39 = zext i8 %38 to i32
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 2
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = zext i8 %42 to i32
  %44 = or i32 %43, %39
  %45 = trunc i32 %44 to i8
  store i8 %45, ptr %41, align 1, !tbaa !11
  %46 = load i64, ptr %9, align 8, !tbaa !9
  %47 = call zeroext i8 @pack_right_shift_u64(i64 noundef %46, i8 noundef zeroext 24, i8 noundef zeroext -1)
  %48 = zext i8 %47 to i32
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 3
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = zext i8 %51 to i32
  %53 = or i32 %52, %48
  %54 = trunc i32 %53 to i8
  store i8 %54, ptr %50, align 1, !tbaa !11
  %55 = load i64, ptr %9, align 8, !tbaa !9
  %56 = call zeroext i8 @pack_right_shift_u64(i64 noundef %55, i8 noundef zeroext 32, i8 noundef zeroext -1)
  %57 = zext i8 %56 to i32
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  %60 = load i8, ptr %59, align 1, !tbaa !11
  %61 = zext i8 %60 to i32
  %62 = or i32 %61, %57
  %63 = trunc i32 %62 to i8
  store i8 %63, ptr %59, align 1, !tbaa !11
  %64 = load i64, ptr %9, align 8, !tbaa !9
  %65 = call zeroext i8 @pack_right_shift_u64(i64 noundef %64, i8 noundef zeroext 40, i8 noundef zeroext -1)
  %66 = zext i8 %65 to i32
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 5
  %69 = load i8, ptr %68, align 1, !tbaa !11
  %70 = zext i8 %69 to i32
  %71 = or i32 %70, %66
  %72 = trunc i32 %71 to i8
  store i8 %72, ptr %68, align 1, !tbaa !11
  %73 = load i64, ptr %9, align 8, !tbaa !9
  %74 = call zeroext i8 @pack_right_shift_u64(i64 noundef %73, i8 noundef zeroext 48, i8 noundef zeroext -1)
  %75 = zext i8 %74 to i32
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 6
  %78 = load i8, ptr %77, align 1, !tbaa !11
  %79 = zext i8 %78 to i32
  %80 = or i32 %79, %75
  %81 = trunc i32 %80 to i8
  store i8 %81, ptr %77, align 1, !tbaa !11
  %82 = load i64, ptr %9, align 8, !tbaa !9
  %83 = call zeroext i8 @pack_right_shift_u64(i64 noundef %82, i8 noundef zeroext 56, i8 noundef zeroext -1)
  %84 = zext i8 %83 to i32
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i64 7
  %87 = load i8, ptr %86, align 1, !tbaa !11
  %88 = zext i8 %87 to i32
  %89 = or i32 %88, %84
  %90 = trunc i32 %89 to i8
  store i8 %90, ptr %86, align 1, !tbaa !11
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.stub_float_types_t, ptr %91, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %92, i64 4, i1 false)
  %93 = load i32, ptr %8, align 4, !tbaa !12
  %94 = call zeroext i8 @pack_left_shift_u32(i32 noundef %93, i8 noundef zeroext 0, i8 noundef zeroext -1)
  %95 = zext i8 %94 to i32
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 8
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = zext i8 %98 to i32
  %100 = or i32 %99, %95
  %101 = trunc i32 %100 to i8
  store i8 %101, ptr %97, align 1, !tbaa !11
  %102 = load i32, ptr %8, align 4, !tbaa !12
  %103 = call zeroext i8 @pack_right_shift_u32(i32 noundef %102, i8 noundef zeroext 8, i8 noundef zeroext -1)
  %104 = zext i8 %103 to i32
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds i8, ptr %105, i64 9
  %107 = load i8, ptr %106, align 1, !tbaa !11
  %108 = zext i8 %107 to i32
  %109 = or i32 %108, %104
  %110 = trunc i32 %109 to i8
  store i8 %110, ptr %106, align 1, !tbaa !11
  %111 = load i32, ptr %8, align 4, !tbaa !12
  %112 = call zeroext i8 @pack_right_shift_u32(i32 noundef %111, i8 noundef zeroext 16, i8 noundef zeroext -1)
  %113 = zext i8 %112 to i32
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds i8, ptr %114, i64 10
  %116 = load i8, ptr %115, align 1, !tbaa !11
  %117 = zext i8 %116 to i32
  %118 = or i32 %117, %113
  %119 = trunc i32 %118 to i8
  store i8 %119, ptr %115, align 1, !tbaa !11
  %120 = load i32, ptr %8, align 4, !tbaa !12
  %121 = call zeroext i8 @pack_right_shift_u32(i32 noundef %120, i8 noundef zeroext 24, i8 noundef zeroext -1)
  %122 = zext i8 %121 to i32
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %123, i64 11
  %125 = load i8, ptr %124, align 1, !tbaa !11
  %126 = zext i8 %125 to i32
  %127 = or i32 %126, %122
  %128 = trunc i32 %127 to i8
  store i8 %128, ptr %124, align 1, !tbaa !11
  store i32 16, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %129

129:                                              ; preds = %14, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %130 = load i32, ptr %4, align 4
  ret i32 %130
}

; 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) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !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"

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_right_shift_u32(i32 noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_left_shift_u32(i32 noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_right_shift_u64(i64 noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @pack_left_shift_u64(i64 noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -22, 17) i32 @stub_float_types_pack(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = icmp ult i64 %2, 16
  br i1 %4, label %54, label %5

5:                                                ; preds = %3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  %.0.copyload = load i64, ptr %1, align 8
  %6 = tail call zeroext i8 @pack_left_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 0, i8 noundef zeroext -1)
  %7 = load i8, ptr %0, align 1, !tbaa !5
  %8 = or i8 %7, %6
  store i8 %8, ptr %0, align 1, !tbaa !5
  %9 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 8, i8 noundef zeroext -1)
  %10 = getelementptr inbounds i8, ptr %0, i64 1
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = or i8 %11, %9
  store i8 %12, ptr %10, align 1, !tbaa !5
  %13 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 16, i8 noundef zeroext -1)
  %14 = getelementptr inbounds i8, ptr %0, i64 2
  %15 = load i8, ptr %14, align 1, !tbaa !5
  %16 = or i8 %15, %13
  store i8 %16, ptr %14, align 1, !tbaa !5
  %17 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 24, i8 noundef zeroext -1)
  %18 = getelementptr inbounds i8, ptr %0, i64 3
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %20 = or i8 %19, %17
  store i8 %20, ptr %18, align 1, !tbaa !5
  %21 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 32, i8 noundef zeroext -1)
  %22 = getelementptr inbounds i8, ptr %0, i64 4
  %23 = load i8, ptr %22, align 1, !tbaa !5
  %24 = or i8 %23, %21
  store i8 %24, ptr %22, align 1, !tbaa !5
  %25 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 40, i8 noundef zeroext -1)
  %26 = getelementptr inbounds i8, ptr %0, i64 5
  %27 = load i8, ptr %26, align 1, !tbaa !5
  %28 = or i8 %27, %25
  store i8 %28, ptr %26, align 1, !tbaa !5
  %29 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 48, i8 noundef zeroext -1)
  %30 = getelementptr inbounds i8, ptr %0, i64 6
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %32 = or i8 %31, %29
  store i8 %32, ptr %30, align 1, !tbaa !5
  %33 = tail call zeroext i8 @pack_right_shift_u64(i64 noundef %.0.copyload, i8 noundef zeroext 56, i8 noundef zeroext -1)
  %34 = getelementptr inbounds i8, ptr %0, i64 7
  %35 = load i8, ptr %34, align 1, !tbaa !5
  %36 = or i8 %35, %33
  store i8 %36, ptr %34, align 1, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %1, i64 8
  %.0.copyload8 = load i32, ptr %37, align 8
  %38 = tail call zeroext i8 @pack_left_shift_u32(i32 noundef %.0.copyload8, i8 noundef zeroext 0, i8 noundef zeroext -1)
  %39 = getelementptr inbounds i8, ptr %0, i64 8
  %40 = load i8, ptr %39, align 1, !tbaa !5
  %41 = or i8 %40, %38
  store i8 %41, ptr %39, align 1, !tbaa !5
  %42 = tail call zeroext i8 @pack_right_shift_u32(i32 noundef %.0.copyload8, i8 noundef zeroext 8, i8 noundef zeroext -1)
  %43 = getelementptr inbounds i8, ptr %0, i64 9
  %44 = load i8, ptr %43, align 1, !tbaa !5
  %45 = or i8 %44, %42
  store i8 %45, ptr %43, align 1, !tbaa !5
  %46 = tail call zeroext i8 @pack_right_shift_u32(i32 noundef %.0.copyload8, i8 noundef zeroext 16, i8 noundef zeroext -1)
  %47 = getelementptr inbounds i8, ptr %0, i64 10
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %49 = or i8 %48, %46
  store i8 %49, ptr %47, align 1, !tbaa !5
  %50 = tail call zeroext i8 @pack_right_shift_u32(i32 noundef %.0.copyload8, i8 noundef zeroext 24, i8 noundef zeroext -1)
  %51 = getelementptr inbounds i8, ptr %0, i64 11
  %52 = load i8, ptr %51, align 1, !tbaa !5
  %53 = or i8 %52, %50
  store i8 %53, ptr %51, align 1, !tbaa !5
  br label %54

54:                                               ; preds = %3, %5
  %.0 = phi i32 [ 16, %5 ], [ -22, %3 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 #2 = { 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass