; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (IScsiSessionInit)

; 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._ISCSI_SESSION = type { i32, %struct._ISCSI_SESSION_CONFIG_DATA, %struct._ISCSI_CHAP_AUTH_DATA, [224 x i8], i64, i8, [6 x i8], i16, i32, i32, i32, i32, i16, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i16, i32, i8, i8, i32, i32, i32, i32, i16, i8, i8, i8 }
%struct._ISCSI_SESSION_CONFIG_DATA = type { %struct.ISCSI_SESSION_CONFIG_NVDATA, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }
%struct.ISCSI_SESSION_CONFIG_NVDATA = type <{ i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, [224 x i8], %struct.EFI_IPv4_ADDRESS, i16, [8 x i8], [6 x i8] }>
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct._ISCSI_CHAP_AUTH_DATA = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], i32 }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }
%struct._LIST_ENTRY = type { ptr, ptr }

declare ptr @InitializeListHead(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @IScsiSessionInit(ptr noundef %0, i8 noundef zeroext %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  %5 = load i8, ptr %4, align 1, !tbaa !9
  %6 = icmp ne i8 %5, 0
  br i1 %6, label %18, label %7

7:                                                ; preds = %2
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %8, i32 0, i32 0
  store i32 1314083657, ptr %9, align 8, !tbaa !10
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %10, i32 0, i32 5
  store i8 0, ptr %11, align 8, !tbaa !21
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %12, i32 0, i32 13
  %14 = call ptr @InitializeListHead(ptr noundef %13)
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %15, i32 0, i32 15
  %17 = call ptr @InitializeListHead(ptr noundef %16)
  br label %18

18:                                               ; preds = %7, %2
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %19, i32 0, i32 7
  store i16 0, ptr %20, align 8, !tbaa !22
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %21, i32 0, i32 8
  store i32 1, ptr %22, align 4, !tbaa !23
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %23, i32 0, i32 11
  store i32 1, ptr %24, align 8, !tbaa !24
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %25, i32 0, i32 12
  store i16 1, ptr %26, align 4, !tbaa !25
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %27, i32 0, i32 16
  store i16 0, ptr %28, align 8, !tbaa !26
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %29, i32 0, i32 17
  store i32 1, ptr %30, align 4, !tbaa !27
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %31, i32 0, i32 18
  store i8 0, ptr %32, align 8, !tbaa !28
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %33, i32 0, i32 19
  store i8 1, ptr %34, align 1, !tbaa !29
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %35, i32 0, i32 20
  store i32 262144, ptr %36, align 4, !tbaa !30
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %37, i32 0, i32 21
  store i32 65536, ptr %38, align 8, !tbaa !31
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %39, i32 0, i32 22
  store i32 2, ptr %40, align 4, !tbaa !32
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %41, i32 0, i32 23
  store i32 20, ptr %42, align 8, !tbaa !33
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %43, i32 0, i32 24
  store i16 1, ptr %44, align 4, !tbaa !34
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %45, i32 0, i32 25
  store i8 1, ptr %46, align 2, !tbaa !35
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %47, i32 0, i32 26
  store i8 1, ptr %48, align 1, !tbaa !36
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %49, i32 0, i32 27
  store i8 0, ptr %50, align 8, !tbaa !37
  ret void
}

attributes #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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"_ISCSI_SESSION", !12, i64 0, !13, i64 4, !17, i64 276, !7, i64 2648, !19, i64 2872, !7, i64 2880, !7, i64 2881, !16, i64 2888, !12, i64 2892, !12, i64 2896, !12, i64 2900, !12, i64 2904, !16, i64 2908, !20, i64 2912, !12, i64 2928, !20, i64 2936, !16, i64 2952, !12, i64 2956, !7, i64 2960, !7, i64 2961, !12, i64 2964, !12, i64 2968, !12, i64 2972, !12, i64 2976, !16, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ISCSI_SESSION_CONFIG_DATA", !14, i64 0, !15, i64 259, !15, i64 263, !15, i64 267}
!14 = !{!"", !7, i64 0, !7, i64 1, !15, i64 2, !15, i64 6, !15, i64 10, !7, i64 14, !7, i64 15, !15, i64 239, !16, i64 243, !7, i64 245, !7, i64 253}
!15 = !{!"", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!"_ISCSI_CHAP_AUTH_DATA", !18, i64 0, !12, i64 292, !7, i64 296, !12, i64 1320, !7, i64 1324, !12, i64 1340, !7, i64 1344, !12, i64 2368}
!18 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!19 = !{!"long long", !7, i64 0}
!20 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!21 = !{!11, !7, i64 2880}
!22 = !{!11, !16, i64 2888}
!23 = !{!11, !12, i64 2892}
!24 = !{!11, !12, i64 2904}
!25 = !{!11, !16, i64 2908}
!26 = !{!11, !16, i64 2952}
!27 = !{!11, !12, i64 2956}
!28 = !{!11, !7, i64 2960}
!29 = !{!11, !7, i64 2961}
!30 = !{!11, !12, i64 2964}
!31 = !{!11, !12, i64 2968}
!32 = !{!11, !12, i64 2972}
!33 = !{!11, !12, i64 2976}
!34 = !{!11, !16, i64 2980}
!35 = !{!11, !7, i64 2982}
!36 = !{!11, !7, i64 2983}
!37 = !{!11, !7, i64 2984}


; 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"

declare ptr @InitializeListHead(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @IScsiSessionInit(ptr noundef %0, i8 noundef zeroext %1) local_unnamed_addr #1 {
  %.not = icmp eq i8 %1, 0
  br i1 %.not, label %3, label %9

3:                                                ; preds = %2
  store i32 1314083657, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 2880
  store i8 0, ptr %4, align 8, !tbaa !19
  %5 = getelementptr inbounds i8, ptr %0, i64 2912
  %6 = tail call ptr @InitializeListHead(ptr noundef nonnull %5) #2
  %7 = getelementptr inbounds i8, ptr %0, i64 2936
  %8 = tail call ptr @InitializeListHead(ptr noundef nonnull %7) #2
  br label %9

9:                                                ; preds = %3, %2
  %10 = getelementptr inbounds i8, ptr %0, i64 2888
  store i16 0, ptr %10, align 8, !tbaa !20
  %11 = getelementptr inbounds i8, ptr %0, i64 2892
  store i32 1, ptr %11, align 4, !tbaa !21
  %12 = getelementptr inbounds i8, ptr %0, i64 2904
  store i32 1, ptr %12, align 8, !tbaa !22
  %13 = getelementptr inbounds i8, ptr %0, i64 2908
  store i16 1, ptr %13, align 4, !tbaa !23
  %14 = getelementptr inbounds i8, ptr %0, i64 2952
  store i16 0, ptr %14, align 8, !tbaa !24
  %15 = getelementptr inbounds i8, ptr %0, i64 2956
  store i32 1, ptr %15, align 4, !tbaa !25
  %16 = getelementptr inbounds i8, ptr %0, i64 2960
  store i8 0, ptr %16, align 8, !tbaa !26
  %17 = getelementptr inbounds i8, ptr %0, i64 2961
  store i8 1, ptr %17, align 1, !tbaa !27
  %18 = getelementptr inbounds i8, ptr %0, i64 2964
  store <4 x i32> <i32 262144, i32 65536, i32 2, i32 20>, ptr %18, align 4, !tbaa !28
  %19 = getelementptr inbounds i8, ptr %0, i64 2980
  store i16 1, ptr %19, align 4, !tbaa !29
  %20 = getelementptr inbounds i8, ptr %0, i64 2982
  store i8 1, ptr %20, align 2, !tbaa !30
  %21 = getelementptr inbounds i8, ptr %0, i64 2983
  store i8 1, ptr %21, align 1, !tbaa !31
  %22 = getelementptr inbounds i8, ptr %0, i64 2984
  store i8 0, ptr %22, align 8, !tbaa !32
  ret void
}

attributes #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 = { 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 }

!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 = !{!"_ISCSI_SESSION", !7, i64 0, !10, i64 4, !14, i64 276, !8, i64 2648, !16, i64 2872, !8, i64 2880, !8, i64 2881, !13, i64 2888, !7, i64 2892, !7, i64 2896, !7, i64 2900, !7, i64 2904, !13, i64 2908, !17, i64 2912, !7, i64 2928, !17, i64 2936, !13, i64 2952, !7, i64 2956, !8, i64 2960, !8, i64 2961, !7, i64 2964, !7, i64 2968, !7, i64 2972, !7, i64 2976, !13, i64 2980, !8, i64 2982, !8, i64 2983, !8, i64 2984}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_ISCSI_SESSION_CONFIG_DATA", !11, i64 0, !12, i64 259, !12, i64 263, !12, i64 267}
!11 = !{!"", !8, i64 0, !8, i64 1, !12, i64 2, !12, i64 6, !12, i64 10, !8, i64 14, !8, i64 15, !12, i64 239, !13, i64 243, !8, i64 245, !8, i64 253}
!12 = !{!"", !8, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = !{!"_ISCSI_CHAP_AUTH_DATA", !15, i64 0, !7, i64 292, !8, i64 296, !7, i64 1320, !8, i64 1324, !7, i64 1340, !8, i64 1344, !7, i64 2368}
!15 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !8, i64 0, !8, i64 1, !8, i64 128, !8, i64 145, !8, i64 272}
!16 = !{!"long long", !8, i64 0}
!17 = !{!"_LIST_ENTRY", !18, i64 0, !18, i64 8}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!6, !8, i64 2880}
!20 = !{!6, !13, i64 2888}
!21 = !{!6, !7, i64 2892}
!22 = !{!6, !7, i64 2904}
!23 = !{!6, !13, i64 2908}
!24 = !{!6, !13, i64 2952}
!25 = !{!6, !7, i64 2956}
!26 = !{!6, !8, i64 2960}
!27 = !{!6, !8, i64 2961}
!28 = !{!7, !7, i64 0}
!29 = !{!6, !13, i64 2980}
!30 = !{!6, !8, i64 2982}
!31 = !{!6, !8, i64 2983}
!32 = !{!6, !8, i64 2984}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass