; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/ShellPkg/Application (SetEnvironmentVariableList)

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.ENV_VAR_LIST = type { %struct._LIST_ENTRY, ptr, ptr, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_RUNTIME_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }

@gRT = external global ptr, align 8
@gShellVariableGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [142 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #1

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @FreeEnvironmentVariableList(ptr noundef) #2

declare ptr @GetFirstNode(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @GetEnvironmentVariableList(ptr noundef) #2

declare i64 @StrSize(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @SetEnvironmentVariableList(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.ENV_VAR_LIST, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %7 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %3, i32 0, i32 0
  %8 = call ptr @InitializeListHead(ptr noundef %7)
  %9 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %3, i32 0, i32 0
  %10 = call i64 @GetEnvironmentVariableList(ptr noundef %9)
  store i64 %10, ptr %5, align 8, !tbaa !9
  br label %11

11:                                               ; preds = %1
  %12 = call zeroext i8 @DebugAssertEnabled()
  %13 = icmp ne i8 %12, 0
  br i1 %13, label %14, label %34

14:                                               ; preds = %11
  %15 = load i64, ptr %5, align 8, !tbaa !9
  %16 = icmp slt i64 %15, 0
  br i1 %16, label %17, label %33

17:                                               ; preds = %14
  br label %18

18:                                               ; preds = %17
  %19 = call zeroext i8 @DebugPrintEnabled()
  %20 = icmp ne i8 %19, 0
  br i1 %20, label %21, label %30

21:                                               ; preds = %18
  br label %22

22:                                               ; preds = %21
  %23 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %24 = icmp ne i8 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  %26 = load i64, ptr %5, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.2, i64 noundef %26)
  br label %27

27:                                               ; preds = %25, %22
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29, %18
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  call void @DebugAssert(ptr noundef @.str, i64 noundef 250, ptr noundef @.str.3)
  br label %33

33:                                               ; preds = %32, %14
  br label %34

34:                                               ; preds = %33, %11
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %3, i32 0, i32 0
  %38 = call ptr @GetFirstNode(ptr noundef %37)
  store ptr %38, ptr %4, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %86, %36
  %40 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %3, i32 0, i32 0
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %41, i32 0, i32 0
  %43 = call zeroext i8 @IsNull(ptr noundef %40, ptr noundef %42)
  %44 = icmp ne i8 %43, 0
  %45 = xor i1 %44, true
  br i1 %45, label %46, label %91

46:                                               ; preds = %39
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %59

51:                                               ; preds = %46
  %52 = load ptr, ptr @gRT, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.EFI_RUNTIME_SERVICES, ptr %52, i32 0, i32 9
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %55, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !11
  %58 = call i64 %54(ptr noundef %57, ptr noundef @gShellVariableGuid, i32 noundef 0, i64 noundef 0, ptr noundef null)
  store i64 %58, ptr %5, align 8, !tbaa !9
  br label %59

59:                                               ; preds = %51, %46
  br label %60

60:                                               ; preds = %59
  %61 = call zeroext i8 @DebugAssertEnabled()
  %62 = icmp ne i8 %61, 0
  br i1 %62, label %63, label %83

63:                                               ; preds = %60
  %64 = load i64, ptr %5, align 8, !tbaa !9
  %65 = icmp slt i64 %64, 0
  br i1 %65, label %66, label %82

66:                                               ; preds = %63
  br label %67

67:                                               ; preds = %66
  %68 = call zeroext i8 @DebugPrintEnabled()
  %69 = icmp ne i8 %68, 0
  br i1 %69, label %70, label %79

70:                                               ; preds = %67
  br label %71

71:                                               ; preds = %70
  %72 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %73 = icmp ne i8 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %71
  %75 = load i64, ptr %5, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.2, i64 noundef %75)
  br label %76

76:                                               ; preds = %74, %71
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78, %67
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  call void @DebugAssert(ptr noundef @.str, i64 noundef 259, ptr noundef @.str.3)
  br label %82

82:                                               ; preds = %81, %63
  br label %83

83:                                               ; preds = %82, %60
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %3, i32 0, i32 0
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %88, i32 0, i32 0
  %90 = call ptr @GetNextNode(ptr noundef %87, ptr noundef %89)
  store ptr %90, ptr %4, align 8, !tbaa !5
  br label %39, !llvm.loop !18

91:                                               ; preds = %39
  %92 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %3, i32 0, i32 0
  call void @FreeEnvironmentVariableList(ptr noundef %92)
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = call ptr @GetFirstNode(ptr noundef %93)
  store ptr %94, ptr %4, align 8, !tbaa !5
  br label %95

95:                                               ; preds = %163, %91
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %97, i32 0, i32 0
  %99 = call zeroext i8 @IsNull(ptr noundef %96, ptr noundef %98)
  %100 = icmp ne i8 %99, 0
  %101 = xor i1 %100, true
  br i1 %101, label %102, label %168

102:                                              ; preds = %95
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %103, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !20
  %106 = call i64 @StrSize(ptr noundef %105)
  store i64 %106, ptr %6, align 8, !tbaa !9
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %107, i32 0, i32 3
  %109 = load i32, ptr %108, align 8, !tbaa !21
  %110 = and i32 %109, 1
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %124

112:                                              ; preds = %102
  %113 = load ptr, ptr @gRT, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.EFI_RUNTIME_SERVICES, ptr %113, i32 0, i32 9
  %115 = load ptr, ptr %114, align 8, !tbaa !15
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %116, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !11
  %119 = load i64, ptr %6, align 8, !tbaa !9
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %120, i32 0, i32 2
  %122 = load ptr, ptr %121, align 8, !tbaa !20
  %123 = call i64 %115(ptr noundef %118, ptr noundef @gShellVariableGuid, i32 noundef 3, i64 noundef %119, ptr noundef %122)
  store i64 %123, ptr %5, align 8, !tbaa !9
  br label %136

124:                                              ; preds = %102
  %125 = load ptr, ptr @gRT, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.EFI_RUNTIME_SERVICES, ptr %125, i32 0, i32 9
  %127 = load ptr, ptr %126, align 8, !tbaa !15
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %128, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !11
  %131 = load i64, ptr %6, align 8, !tbaa !9
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %132, i32 0, i32 2
  %134 = load ptr, ptr %133, align 8, !tbaa !20
  %135 = call i64 %127(ptr noundef %130, ptr noundef @gShellVariableGuid, i32 noundef 2, i64 noundef %131, ptr noundef %134)
  store i64 %135, ptr %5, align 8, !tbaa !9
  br label %136

136:                                              ; preds = %124, %112
  br label %137

137:                                              ; preds = %136
  %138 = call zeroext i8 @DebugAssertEnabled()
  %139 = icmp ne i8 %138, 0
  br i1 %139, label %140, label %160

140:                                              ; preds = %137
  %141 = load i64, ptr %5, align 8, !tbaa !9
  %142 = icmp slt i64 %141, 0
  br i1 %142, label %143, label %159

143:                                              ; preds = %140
  br label %144

144:                                              ; preds = %143
  %145 = call zeroext i8 @DebugPrintEnabled()
  %146 = icmp ne i8 %145, 0
  br i1 %146, label %147, label %156

147:                                              ; preds = %144
  br label %148

148:                                              ; preds = %147
  %149 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %150 = icmp ne i8 %149, 0
  br i1 %150, label %151, label %153

151:                                              ; preds = %148
  %152 = load i64, ptr %5, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.2, i64 noundef %152)
  br label %153

153:                                              ; preds = %151, %148
  br label %154

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155, %144
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  call void @DebugAssert(ptr noundef @.str, i64 noundef 277, ptr noundef @.str.3)
  br label %159

159:                                              ; preds = %158, %140
  br label %160

160:                                              ; preds = %159, %137
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  %164 = load ptr, ptr %2, align 8, !tbaa !5
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %165, i32 0, i32 0
  %167 = call ptr @GetNextNode(ptr noundef %164, ptr noundef %166)
  store ptr %167, ptr %4, align 8, !tbaa !5
  br label %95, !llvm.loop !22

168:                                              ; preds = %95
  %169 = load ptr, ptr %2, align 8, !tbaa !5
  call void @FreeEnvironmentVariableList(ptr noundef %169)
  %170 = load i64, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #3
  ret i64 %170
}

declare ptr @InitializeListHead(ptr noundef) #1

declare zeroext i8 @IsNull(ptr noundef, ptr noundef) #1

declare ptr @GetNextNode(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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" }
attributes #3 = { 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 long", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"", !13, i64 0, !6, i64 16, !6, i64 24, !14, i64 32}
!13 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 88}
!16 = !{!"", !17, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!17 = !{!"", !10, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!12, !6, i64 24}
!21 = !{!12, !14, i64 32}
!22 = distinct !{!22, !19}


; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.ENV_VAR_LIST = type { %struct._LIST_ENTRY, ptr, ptr, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }

@gRT = external local_unnamed_addr global ptr, align 8
@gShellVariableGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [142 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #1

declare void @DebugPrint(i64 noundef, ptr noundef, ...) local_unnamed_addr #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: nounwind uwtable
declare dso_local void @FreeEnvironmentVariableList(ptr noundef) local_unnamed_addr #2

declare ptr @GetFirstNode(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @GetEnvironmentVariableList(ptr noundef) local_unnamed_addr #2

declare i64 @StrSize(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @SetEnvironmentVariableList(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca %struct.ENV_VAR_LIST, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %2) #3
  %3 = call ptr @InitializeListHead(ptr noundef nonnull %2) #3
  %4 = call i64 @GetEnvironmentVariableList(ptr noundef nonnull %2)
  %5 = call zeroext i8 @DebugAssertEnabled() #3
  %6 = icmp ne i8 %5, 0
  %7 = icmp slt i64 %4, 0
  %or.cond = select i1 %6, i1 %7, i1 false
  br i1 %or.cond, label %8, label %14

8:                                                ; preds = %1
  %9 = call zeroext i8 @DebugPrintEnabled() #3
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %13, label %10

10:                                               ; preds = %8
  %11 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not33 = icmp eq i8 %11, 0
  br i1 %.not33, label %13, label %12

12:                                               ; preds = %10
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.2, i64 noundef %4) #3
  br label %13

13:                                               ; preds = %10, %12, %8
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 250, ptr noundef nonnull @.str.3) #3
  br label %14

14:                                               ; preds = %13, %1
  %15 = call ptr @GetFirstNode(ptr noundef nonnull %2) #3
  %16 = call zeroext i8 @IsNull(ptr noundef nonnull %2, ptr noundef %15) #3
  %.not3442 = icmp eq i8 %16, 0
  br i1 %.not3442, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %14, %34
  %.044 = phi ptr [ %35, %34 ], [ %15, %14 ]
  %.02943 = phi i64 [ %.130, %34 ], [ %4, %14 ]
  %17 = getelementptr inbounds i8, ptr %.044, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %.not39 = icmp eq ptr %18, null
  br i1 %.not39, label %24, label %19

19:                                               ; preds = %.lr.ph
  %20 = load ptr, ptr @gRT, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %20, i64 88
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = call i64 %22(ptr noundef nonnull %18, ptr noundef nonnull @gShellVariableGuid, i32 noundef 0, i64 noundef 0, ptr noundef null) #3
  br label %24

24:                                               ; preds = %.lr.ph, %19
  %.130 = phi i64 [ %23, %19 ], [ %.02943, %.lr.ph ]
  %25 = call zeroext i8 @DebugAssertEnabled() #3
  %26 = icmp ne i8 %25, 0
  %27 = icmp slt i64 %.130, 0
  %or.cond3 = select i1 %26, i1 %27, i1 false
  br i1 %or.cond3, label %28, label %34

28:                                               ; preds = %24
  %29 = call zeroext i8 @DebugPrintEnabled() #3
  %.not40 = icmp eq i8 %29, 0
  br i1 %.not40, label %33, label %30

30:                                               ; preds = %28
  %31 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not41 = icmp eq i8 %31, 0
  br i1 %.not41, label %33, label %32

32:                                               ; preds = %30
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.2, i64 noundef %.130) #3
  br label %33

33:                                               ; preds = %30, %32, %28
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 259, ptr noundef nonnull @.str.3) #3
  br label %34

34:                                               ; preds = %24, %33
  %35 = call ptr @GetNextNode(ptr noundef nonnull %2, ptr noundef nonnull %.044) #3
  %36 = call zeroext i8 @IsNull(ptr noundef nonnull %2, ptr noundef %35) #3
  %.not34 = icmp eq i8 %36, 0
  br i1 %.not34, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %34, %14
  %.029.lcssa = phi i64 [ %4, %14 ], [ %.130, %34 ]
  call void @FreeEnvironmentVariableList(ptr noundef nonnull %2)
  %37 = call ptr @GetFirstNode(ptr noundef %0) #3
  %38 = call zeroext i8 @IsNull(ptr noundef %0, ptr noundef %37) #3
  %.not3545 = icmp eq i8 %38, 0
  br i1 %.not3545, label %.lr.ph48, label %._crit_edge49

.lr.ph48:                                         ; preds = %._crit_edge, %61
  %.146 = phi ptr [ %62, %61 ], [ %37, %._crit_edge ]
  %39 = getelementptr inbounds i8, ptr %.146, i64 24
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = call i64 @StrSize(ptr noundef %40) #3
  %42 = getelementptr inbounds i8, ptr %.146, i64 32
  %43 = load i32, ptr %42, align 8, !tbaa !20
  %44 = and i32 %43, 1
  %45 = load ptr, ptr @gRT, align 8, !tbaa !12
  %46 = getelementptr inbounds i8, ptr %45, i64 88
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = getelementptr inbounds i8, ptr %.146, i64 16
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = load ptr, ptr %39, align 8, !tbaa !19
  %. = or disjoint i32 %44, 2
  %51 = call i64 %47(ptr noundef %49, ptr noundef nonnull @gShellVariableGuid, i32 noundef %., i64 noundef %41, ptr noundef %50) #3
  %52 = call zeroext i8 @DebugAssertEnabled() #3
  %53 = icmp ne i8 %52, 0
  %54 = icmp slt i64 %51, 0
  %or.cond5 = select i1 %53, i1 %54, i1 false
  br i1 %or.cond5, label %55, label %61

55:                                               ; preds = %.lr.ph48
  %56 = call zeroext i8 @DebugPrintEnabled() #3
  %.not37 = icmp eq i8 %56, 0
  br i1 %.not37, label %60, label %57

57:                                               ; preds = %55
  %58 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not38 = icmp eq i8 %58, 0
  br i1 %.not38, label %60, label %59

59:                                               ; preds = %57
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.2, i64 noundef %51) #3
  br label %60

60:                                               ; preds = %57, %59, %55
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 277, ptr noundef nonnull @.str.3) #3
  br label %61

61:                                               ; preds = %.lr.ph48, %60
  %62 = call ptr @GetNextNode(ptr noundef %0, ptr noundef nonnull %.146) #3
  %63 = call zeroext i8 @IsNull(ptr noundef %0, ptr noundef %62) #3
  %.not35 = icmp eq i8 %63, 0
  br i1 %.not35, label %.lr.ph48, label %._crit_edge49, !llvm.loop !21

._crit_edge49:                                    ; preds = %61, %._crit_edge
  %.2.lcssa = phi i64 [ %.029.lcssa, %._crit_edge ], [ %51, %61 ]
  call void @FreeEnvironmentVariableList(ptr noundef %0)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #3
  ret i64 %.2.lcssa
}

declare ptr @InitializeListHead(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @IsNull(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @GetNextNode(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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" }
attributes #3 = { 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 16}
!6 = !{!"", !7, i64 0, !8, i64 16, !8, i64 24, !11, i64 32}
!7 = !{!"_LIST_ENTRY", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !8, i64 88}
!14 = !{!"", !15, i64 0, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !8, i64 120, !8, i64 128}
!15 = !{!"", !16, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!16 = !{!"long long", !9, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !8, i64 24}
!20 = !{!6, !11, i64 32}
!21 = distinct !{!21, !18}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass