; LLVM IR from guanzhi/GmSSL :: src/skf (skf_dummy)

; 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.Struct_DEVINFO = type <{ %struct.Struct_Version, [64 x i8], [64 x i8], [32 x i8], [32 x i8], %struct.Struct_Version, %struct.Struct_Version, i32, i32, i32, i32, i32, i32, i32, i32, [64 x i8] }>
%struct.Struct_Version = type { i8, i8 }

@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @SKF_GetDevInfo(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.Struct_DEVINFO, align 1
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 294, ptr %6) #5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %11, label %10

10:                                               ; preds = %2
  store i32 167772166, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %41

11:                                               ; preds = %2
  call void @llvm.memset.p0.i64(ptr align 1 %6, i8 0, i64 294, i1 false)
  %12 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 0
  %13 = getelementptr inbounds %struct.Struct_Version, ptr %12, i32 0, i32 0
  store i8 1, ptr %13, align 1, !tbaa !9
  %14 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 0
  %15 = getelementptr inbounds %struct.Struct_Version, ptr %14, i32 0, i32 1
  store i8 0, ptr %15, align 1, !tbaa !13
  %16 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 1
  %17 = call ptr @strcpy(ptr noundef %16, ptr noundef @.str.1) #5
  %18 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 2
  %19 = call ptr @strcpy(ptr noundef %18, ptr noundef @.str.1) #5
  %20 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 3
  %21 = call ptr @strcpy(ptr noundef %20, ptr noundef @.str.2) #5
  %22 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 4
  %23 = call ptr @strcpy(ptr noundef %22, ptr noundef @.str.3) #5
  %24 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 5
  %25 = getelementptr inbounds %struct.Struct_Version, ptr %24, i32 0, i32 0
  store i8 1, ptr %25, align 1, !tbaa !14
  %26 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 5
  %27 = getelementptr inbounds %struct.Struct_Version, ptr %26, i32 0, i32 1
  store i8 0, ptr %27, align 1, !tbaa !15
  %28 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 6
  %29 = getelementptr inbounds %struct.Struct_Version, ptr %28, i32 0, i32 0
  store i8 1, ptr %29, align 1, !tbaa !16
  %30 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 6
  %31 = getelementptr inbounds %struct.Struct_Version, ptr %30, i32 0, i32 1
  store i8 0, ptr %31, align 1, !tbaa !17
  %32 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 7
  store i32 1807, ptr %32, align 1, !tbaa !18
  %33 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 8
  store i32 197888, ptr %33, align 1, !tbaa !19
  %34 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 9
  store i32 7, ptr %34, align 1, !tbaa !20
  %35 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 10
  store i32 1025, ptr %35, align 1, !tbaa !21
  %36 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 11
  store i32 65536, ptr %36, align 1, !tbaa !22
  %37 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 12
  store i32 32768, ptr %37, align 1, !tbaa !23
  %38 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 13
  store i32 100, ptr %38, align 1, !tbaa !24
  %39 = getelementptr inbounds %struct.Struct_DEVINFO, ptr %6, i32 0, i32 14
  store i32 128, ptr %39, align 1, !tbaa !25
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %40, ptr align 1 %6, i64 294, i1 false)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %41

41:                                               ; preds = %11, %10
  call void @llvm.lifetime.end.p0(i64 294, ptr %6) #5
  %42 = load i32, ptr %3, align 4
  ret i32 %42
}

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

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #4

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

attributes #0 = { nocallback nofree 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #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, !7, i64 0}
!10 = !{!"Struct_DEVINFO", !11, i64 0, !7, i64 2, !7, i64 66, !7, i64 130, !7, i64 162, !11, i64 194, !11, i64 196, !12, i64 198, !12, i64 202, !12, i64 206, !12, i64 210, !12, i64 214, !12, i64 218, !12, i64 222, !12, i64 226, !7, i64 230}
!11 = !{!"Struct_Version", !7, i64 0, !7, i64 1}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !7, i64 1}
!14 = !{!10, !7, i64 194}
!15 = !{!10, !7, i64 195}
!16 = !{!10, !7, i64 196}
!17 = !{!10, !7, i64 197}
!18 = !{!10, !12, i64 198}
!19 = !{!10, !12, i64 202}
!20 = !{!10, !12, i64 206}
!21 = !{!10, !12, i64 210}
!22 = !{!10, !12, i64 214}
!23 = !{!10, !12, i64 218}
!24 = !{!10, !12, i64 222}
!25 = !{!10, !12, i64 226}


; 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.Struct_DEVINFO = type <{ %struct.Struct_Version, [64 x i8], [64 x i8], [32 x i8], [32 x i8], %struct.Struct_Version, %struct.Struct_Version, i32, i32, i32, i32, i32, i32, i32, i32, [64 x i8] }>
%struct.Struct_Version = type { i8, i8 }

@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local range(i32 0, 167772167) i32 @SKF_GetDevInfo(ptr nocapture noundef readnone %0, ptr noundef writeonly %1) local_unnamed_addr #1 {
  %3 = alloca %struct.Struct_DEVINFO, align 1
  call void @llvm.lifetime.start.p0(i64 294, ptr nonnull %3) #5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %18, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %3, i64 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(294) %5, i8 0, i64 292, i1 false)
  store i8 1, ptr %3, align 1, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %3, i64 1
  store i8 0, ptr %6, align 1, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %3, i64 2
  %8 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.1) #5
  %9 = getelementptr inbounds i8, ptr %3, i64 66
  %10 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) @.str.1) #5
  %11 = getelementptr inbounds i8, ptr %3, i64 130
  %12 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %11, ptr noundef nonnull dereferenceable(1) @.str.2) #5
  %13 = getelementptr inbounds i8, ptr %3, i64 162
  %14 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.3) #5
  %15 = getelementptr inbounds i8, ptr %3, i64 194
  store <4 x i8> <i8 1, i8 0, i8 1, i8 0>, ptr %15, align 1, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %3, i64 198
  store <4 x i32> <i32 1807, i32 197888, i32 7, i32 1025>, ptr %16, align 1, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %3, i64 214
  store <4 x i32> <i32 65536, i32 32768, i32 100, i32 128>, ptr %17, align 1, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(294) %1, ptr noundef nonnull align 1 dereferenceable(294) %3, i64 294, i1 false)
  br label %18

18:                                               ; preds = %2, %4
  %.0 = phi i32 [ 0, %4 ], [ 167772166, %2 ]
  call void @llvm.lifetime.end.p0(i64 294, ptr nonnull %3) #5
  ret i32 %.0
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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, !8, i64 0}
!6 = !{!"Struct_DEVINFO", !7, i64 0, !8, i64 2, !8, i64 66, !8, i64 130, !8, i64 162, !7, i64 194, !7, i64 196, !10, i64 198, !10, i64 202, !10, i64 206, !10, i64 210, !10, i64 214, !10, i64 218, !10, i64 222, !10, i64 226, !8, i64 230}
!7 = !{!"Struct_Version", !8, i64 0, !8, i64 1}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !8, i64 1}
!12 = !{!8, !8, i64 0}
!13 = !{!10, !10, i64 0}


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