; LLVM IR from mrbid/CSGO_TENSOR_TRIGGER :: GOBOT15/KERAS2C/include (k2c_merge_layers)

; 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.__va_list_tag = type { i32, i32, ptr, ptr }
%struct.k2c_tensor = type { ptr, i64, i64, [5 x i64] }

; 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
declare void @llvm.va_start.p0(ptr) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #1

; Function Attrs: nounwind uwtable
define dso_local void @k2c_concatenate(ptr noundef %0, i64 noundef %1, i64 noundef %2, ...) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca [1 x %struct.__va_list_tag], align 16
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca [5 x i64], align 16
  %12 = alloca [5 x i64], align 16
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #5
  %16 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %7, i64 0, i64 0
  call void @llvm.va_start.p0(ptr %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %92, %3
  %18 = load i64, ptr %13, align 8, !tbaa !9
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = icmp ult i64 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %95

22:                                               ; preds = %17
  %23 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %7, i64 0, i64 0
  %24 = getelementptr inbounds %struct.__va_list_tag, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 16
  %26 = icmp ule i32 %25, 40
  br i1 %26, label %27, label %32

27:                                               ; preds = %22
  %28 = getelementptr inbounds %struct.__va_list_tag, ptr %23, i32 0, i32 3
  %29 = load ptr, ptr %28, align 16
  %30 = getelementptr i8, ptr %29, i32 %25
  %31 = add i32 %25, 8
  store i32 %31, ptr %24, align 16
  br label %36

32:                                               ; preds = %22
  %33 = getelementptr inbounds %struct.__va_list_tag, ptr %23, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8
  %35 = getelementptr i8, ptr %34, i32 8
  store ptr %35, ptr %33, align 8
  br label %36

36:                                               ; preds = %32, %27
  %37 = phi ptr [ %30, %27 ], [ %34, %32 ]
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  store ptr %38, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %39

39:                                               ; preds = %81, %36
  %40 = load i64, ptr %15, align 8, !tbaa !9
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.k2c_tensor, ptr %41, i32 0, i32 2
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = icmp ult i64 %40, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %39
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %84

46:                                               ; preds = %39
  %47 = load i64, ptr %15, align 8, !tbaa !9
  %48 = getelementptr inbounds [5 x i64], ptr %11, i64 0, i64 0
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.k2c_tensor, ptr %49, i32 0, i32 3
  %51 = getelementptr inbounds [5 x i64], ptr %50, i64 0, i64 0
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.k2c_tensor, ptr %52, i32 0, i32 1
  %54 = load i64, ptr %53, align 8, !tbaa !13
  call void @k2c_idx2sub(i64 noundef %47, ptr noundef %48, ptr noundef %51, i64 noundef %54)
  %55 = getelementptr inbounds [5 x i64], ptr %12, i64 0, i64 0
  %56 = getelementptr inbounds [5 x i64], ptr %11, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %55, ptr align 16 %56, i64 40, i1 false)
  %57 = load i64, ptr %9, align 8, !tbaa !9
  %58 = load i64, ptr %5, align 8, !tbaa !9
  %59 = getelementptr inbounds [5 x i64], ptr %12, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = add i64 %60, %57
  store i64 %61, ptr %59, align 8, !tbaa !9
  %62 = getelementptr inbounds [5 x i64], ptr %12, i64 0, i64 0
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.k2c_tensor, ptr %63, i32 0, i32 3
  %65 = getelementptr inbounds [5 x i64], ptr %64, i64 0, i64 0
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.k2c_tensor, ptr %66, i32 0, i32 1
  %68 = load i64, ptr %67, align 8, !tbaa !13
  %69 = call i64 @k2c_sub2idx(ptr noundef %62, ptr noundef %65, i64 noundef %68)
  store i64 %69, ptr %10, align 8, !tbaa !9
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.k2c_tensor, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = load i64, ptr %15, align 8, !tbaa !9
  %74 = getelementptr inbounds float, ptr %72, i64 %73
  %75 = load float, ptr %74, align 4, !tbaa !15
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.k2c_tensor, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  %79 = load i64, ptr %10, align 8, !tbaa !9
  %80 = getelementptr inbounds float, ptr %78, i64 %79
  store float %75, ptr %80, align 4, !tbaa !15
  br label %81

81:                                               ; preds = %46
  %82 = load i64, ptr %15, align 8, !tbaa !9
  %83 = add i64 %82, 1
  store i64 %83, ptr %15, align 8, !tbaa !9
  br label %39, !llvm.loop !17

84:                                               ; preds = %45
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.k2c_tensor, ptr %85, i32 0, i32 3
  %87 = load i64, ptr %5, align 8, !tbaa !9
  %88 = getelementptr inbounds [5 x i64], ptr %86, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !9
  %90 = load i64, ptr %9, align 8, !tbaa !9
  %91 = add i64 %90, %89
  store i64 %91, ptr %9, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %84
  %93 = load i64, ptr %13, align 8, !tbaa !9
  %94 = add i64 %93, 1
  store i64 %94, ptr %13, align 8, !tbaa !9
  br label %17, !llvm.loop !19

95:                                               ; preds = %21
  %96 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %7, i64 0, i64 0
  call void @llvm.va_end.p0(ptr %96)
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  ret void
}

declare void @k2c_idx2sub(i64 noundef, ptr noundef, ptr noundef, i64 noundef) #3

; 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

declare i64 @k2c_sub2idx(ptr noundef, ptr noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
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" }
attributes #3 = { "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 = !{!12, !10, i64 16}
!12 = !{!"k2c_tensor", !6, i64 0, !10, i64 8, !10, i64 16, !7, i64 24}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !6, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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.__va_list_tag = type { i32, i32, ptr, ptr }

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #1

; Function Attrs: nounwind uwtable
define dso_local void @k2c_concatenate(ptr noundef %0, i64 noundef %1, i64 noundef %2, ...) local_unnamed_addr #2 {
  %4 = alloca [1 x %struct.__va_list_tag], align 16
  %5 = alloca [5 x i64], align 16
  %6 = alloca [5 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #5
  call void @llvm.va_start.p0(ptr nonnull %4)
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %._crit_edge27, label %.lr.ph26

.lr.ph26:                                         ; preds = %3
  %7 = getelementptr inbounds i8, ptr %4, i64 8
  %8 = getelementptr inbounds i8, ptr %4, i64 16
  %9 = getelementptr inbounds [5 x i64], ptr %6, i64 0, i64 %1
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  br label %12

._crit_edge27:                                    ; preds = %._crit_edge, %3
  call void @llvm.va_end.p0(ptr nonnull %4)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  ret void

12:                                               ; preds = %.lr.ph26, %._crit_edge
  %.01924 = phi i64 [ 0, %.lr.ph26 ], [ %34, %._crit_edge ]
  %.02023 = phi i64 [ 0, %.lr.ph26 ], [ %33, %._crit_edge ]
  %13 = load i32, ptr %4, align 16
  %14 = icmp ult i32 %13, 41
  br i1 %14, label %15, label %20

15:                                               ; preds = %12
  %16 = load ptr, ptr %8, align 16
  %17 = zext nneg i32 %13 to i64
  %18 = getelementptr i8, ptr %16, i64 %17
  %19 = add nuw nsw i32 %13, 8
  store i32 %19, ptr %4, align 16
  br label %23

20:                                               ; preds = %12
  %21 = load ptr, ptr %7, align 8
  %22 = getelementptr i8, ptr %21, i64 8
  store ptr %22, ptr %7, align 8
  br label %23

23:                                               ; preds = %20, %15
  %24 = phi ptr [ %18, %15 ], [ %21, %20 ]
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %.not28 = icmp eq i64 %27, 0
  br i1 %.not28, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %23
  %28 = getelementptr inbounds i8, ptr %25, i64 24
  %29 = getelementptr inbounds i8, ptr %25, i64 8
  br label %35

._crit_edge:                                      ; preds = %35, %23
  %30 = getelementptr inbounds i8, ptr %25, i64 24
  %31 = getelementptr inbounds [5 x i64], ptr %30, i64 0, i64 %1
  %32 = load i64, ptr %31, align 8, !tbaa !12
  %33 = add i64 %32, %.02023
  %34 = add nuw i64 %.01924, 1
  %exitcond.not = icmp eq i64 %34, %2
  br i1 %exitcond.not, label %._crit_edge27, label %12, !llvm.loop !13

35:                                               ; preds = %.lr.ph, %35
  %.022 = phi i64 [ 0, %.lr.ph ], [ %46, %35 ]
  %36 = load i64, ptr %29, align 8, !tbaa !15
  call void @k2c_idx2sub(i64 noundef %.022, ptr noundef nonnull %5, ptr noundef nonnull %28, i64 noundef %36) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %6, ptr noundef nonnull align 16 dereferenceable(40) %5, i64 40, i1 false)
  %37 = load i64, ptr %9, align 8, !tbaa !12
  %38 = add i64 %37, %.02023
  store i64 %38, ptr %9, align 8, !tbaa !12
  %39 = load i64, ptr %11, align 8, !tbaa !15
  %40 = call i64 @k2c_sub2idx(ptr noundef nonnull %6, ptr noundef nonnull %10, i64 noundef %39) #5
  %41 = load ptr, ptr %25, align 8, !tbaa !16
  %42 = getelementptr inbounds float, ptr %41, i64 %.022
  %43 = load float, ptr %42, align 4, !tbaa !17
  %44 = load ptr, ptr %0, align 8, !tbaa !16
  %45 = getelementptr inbounds float, ptr %44, i64 %40
  store float %43, ptr %45, align 4, !tbaa !17
  %46 = add nuw i64 %.022, 1
  %47 = load i64, ptr %26, align 8, !tbaa !9
  %48 = icmp ult i64 %46, %47
  br i1 %48, label %35, label %._crit_edge, !llvm.loop !19
}

declare void @k2c_idx2sub(i64 noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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

declare i64 @k2c_sub2idx(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn }
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" }
attributes #3 = { "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 = { mustprogress 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, !11, i64 16}
!10 = !{!"k2c_tensor", !6, i64 0, !11, i64 8, !11, i64 16, !7, i64 24}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = distinct !{!19, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass