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

; 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.ENV_VAR_LIST = type { %struct._LIST_ENTRY, ptr, ptr, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [142 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i32], align 4
@.str.7 = external hidden unnamed_addr constant [44 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 ptr @AllocateZeroPool(i64 noundef) #1

declare zeroext i8 @DebugAssertEnabled() #1

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

declare void @FreePool(ptr noundef) #1

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

declare ptr @AllocateCopyPool(i64 noundef, ptr noundef) #1

declare i64 @StrSize(ptr noundef) #1

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

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

declare ptr @InitializeListHead(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @SetEnvironmentVariables(ptr noundef %0) #2 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr null, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %1
  store i64 -9223372036854775806, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %193

12:                                               ; preds = %1
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %13

13:                                               ; preds = %186, %12
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load i64, ptr %5, align 8, !tbaa !9
  %16 = getelementptr inbounds ptr, ptr %14, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %17, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %13
  br label %189

21:                                               ; preds = %13
  br label %22

22:                                               ; preds = %21
  %23 = call zeroext i8 @DebugAssertEnabled()
  %24 = icmp ne i8 %23, 0
  br i1 %24, label %25, label %31

25:                                               ; preds = %22
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call ptr @StrStr(ptr noundef %26, ptr noundef @.str.6)
  %28 = icmp ne ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @DebugAssert(ptr noundef @.str, i64 noundef 325, ptr noundef @.str.7)
  br label %30

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

31:                                               ; preds = %30, %22
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  %34 = call ptr @AllocateZeroPool(i64 noundef 40)
  store ptr %34, ptr %7, align 8, !tbaa !5
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %41

37:                                               ; preds = %33
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %38, i32 0, i32 0
  %40 = call i64 @SetEnvironmentVariableList(ptr noundef %39)
  store i64 -9223372036854775799, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %193

41:                                               ; preds = %33
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = call ptr @StrStr(ptr noundef %42, ptr noundef @.str.6)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = ptrtoint ptr %43 to i64
  %46 = ptrtoint ptr %44 to i64
  %47 = sub i64 %45, %46
  %48 = sdiv exact i64 %47, 2
  %49 = add nsw i64 %48, 1
  %50 = mul i64 %49, 2
  %51 = call ptr @AllocateZeroPool(i64 noundef %50)
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %52, i32 0, i32 1
  store ptr %51, ptr %53, align 8, !tbaa !11
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = icmp eq ptr %56, null
  br i1 %57, label %58, label %70

58:                                               ; preds = %41
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %64

62:                                               ; preds = %59
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %63)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %62, %59
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %67, i32 0, i32 0
  %69 = call i64 @SetEnvironmentVariableList(ptr noundef %68)
  store i64 -9223372036854775799, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %193

70:                                               ; preds = %41
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %71, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = call ptr @StrStr(ptr noundef %75, ptr noundef @.str.6)
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = ptrtoint ptr %76 to i64
  %79 = ptrtoint ptr %77 to i64
  %80 = sub i64 %78, %79
  %81 = sdiv exact i64 %80, 2
  %82 = call ptr @StrnCpy(ptr noundef %73, ptr noundef %74, i64 noundef %81)
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = call i64 @StrSize(ptr noundef %83)
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  %88 = call i64 @StrSize(ptr noundef %87)
  %89 = sub i64 %84, %88
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  %94 = call i64 @StrLen(ptr noundef %93)
  %95 = getelementptr inbounds i16, ptr %90, i64 %94
  %96 = getelementptr inbounds i16, ptr %95, i64 1
  %97 = call ptr @AllocateCopyPool(i64 noundef %89, ptr noundef %96)
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %98, i32 0, i32 2
  store ptr %97, ptr %99, align 8, !tbaa !15
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %100, i32 0, i32 2
  %102 = load ptr, ptr %101, align 8, !tbaa !15
  %103 = icmp eq ptr %102, null
  br i1 %103, label %104, label %130

104:                                              ; preds = %70
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %106, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !11
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %116

110:                                              ; preds = %105
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !11
  call void @FreePool(ptr noundef %113)
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %114, i32 0, i32 1
  store ptr null, ptr %115, align 8, !tbaa !11
  br label %116

116:                                              ; preds = %110, %105
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = icmp ne ptr %120, null
  br i1 %121, label %122, label %124

122:                                              ; preds = %119
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %123)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %124

124:                                              ; preds = %122, %119
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %127, i32 0, i32 0
  %129 = call i64 @SetEnvironmentVariableList(ptr noundef %128)
  store i64 -9223372036854775799, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %193

130:                                              ; preds = %70
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %131, i32 0, i32 3
  store i32 2, ptr %132, align 8, !tbaa !16
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = icmp eq ptr %133, null
  br i1 %134, label %135, label %180

135:                                              ; preds = %130
  %136 = call ptr @AllocateZeroPool(i64 noundef 40)
  store ptr %136, ptr %6, align 8, !tbaa !5
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = icmp eq ptr %137, null
  br i1 %138, label %139, label %176

139:                                              ; preds = %135
  br label %140

140:                                              ; preds = %139
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %141, i32 0, i32 1
  %143 = load ptr, ptr %142, align 8, !tbaa !11
  %144 = icmp ne ptr %143, null
  br i1 %144, label %145, label %151

145:                                              ; preds = %140
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %146, i32 0, i32 1
  %148 = load ptr, ptr %147, align 8, !tbaa !11
  call void @FreePool(ptr noundef %148)
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %149, i32 0, i32 1
  store ptr null, ptr %150, align 8, !tbaa !11
  br label %151

151:                                              ; preds = %145, %140
  br label %152

152:                                              ; preds = %151
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %155, i32 0, i32 2
  %157 = load ptr, ptr %156, align 8, !tbaa !15
  %158 = icmp ne ptr %157, null
  br i1 %158, label %159, label %165

159:                                              ; preds = %154
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %160, i32 0, i32 2
  %162 = load ptr, ptr %161, align 8, !tbaa !15
  call void @FreePool(ptr noundef %162)
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %163, i32 0, i32 2
  store ptr null, ptr %164, align 8, !tbaa !15
  br label %165

165:                                              ; preds = %159, %154
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = icmp ne ptr %169, null
  br i1 %170, label %171, label %173

171:                                              ; preds = %168
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %172)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %173

173:                                              ; preds = %171, %168
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  store i64 -9223372036854775799, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %193

176:                                              ; preds = %135
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %177, i32 0, i32 0
  %179 = call ptr @InitializeListHead(ptr noundef %178)
  br label %180

180:                                              ; preds = %176, %130
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %7, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %183, i32 0, i32 0
  %185 = call ptr @InsertTailList(ptr noundef %182, ptr noundef %184)
  br label %186

186:                                              ; preds = %180
  %187 = load i64, ptr %5, align 8, !tbaa !9
  %188 = add i64 %187, 1
  store i64 %188, ptr %5, align 8, !tbaa !9
  br label %13

189:                                              ; preds = %20
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.ENV_VAR_LIST, ptr %190, i32 0, i32 0
  %192 = call i64 @SetEnvironmentVariableList(ptr noundef %191)
  store i64 %192, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %193

193:                                              ; preds = %189, %175, %126, %66, %37, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  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
  %194 = load i64, ptr %2, align 8
  ret i64 %194
}

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

declare ptr @StrnCpy(ptr noundef, ptr noundef, i64 noundef) #1

declare i64 @StrLen(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 = !{!12, !6, i64 24}
!16 = !{!12, !14, i64 32}


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

@.str = external hidden unnamed_addr constant [142 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i32], align 4
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #0

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

declare void @FreePool(ptr noundef) local_unnamed_addr #0

declare ptr @AllocateCopyPool(i64 noundef, ptr noundef) local_unnamed_addr #0

declare i64 @StrSize(ptr noundef) local_unnamed_addr #0

declare ptr @InsertTailList(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare ptr @InitializeListHead(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @SetEnvironmentVariables(ptr noundef readonly %0) local_unnamed_addr #1 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %70, label %.preheader

.preheader:                                       ; preds = %1
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %63
  %5 = phi ptr [ %67, %63 ], [ %3, %.preheader ]
  %.073 = phi ptr [ %.1, %63 ], [ null, %.preheader ]
  %.04672 = phi i64 [ %65, %63 ], [ 0, %.preheader ]
  %6 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %10, label %7

7:                                                ; preds = %.lr.ph
  %8 = tail call ptr @StrStr(ptr noundef nonnull %5, ptr noundef nonnull @.str.6) #2
  %.not56 = icmp eq ptr %8, null
  br i1 %.not56, label %9, label %10

9:                                                ; preds = %7
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 325, ptr noundef nonnull @.str.7) #2
  br label %10

10:                                               ; preds = %7, %9, %.lr.ph
  %11 = tail call ptr @AllocateZeroPool(i64 noundef 40) #2
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %10
  %14 = tail call i64 @SetEnvironmentVariableList(ptr noundef %.073)
  br label %70

15:                                               ; preds = %10
  %16 = tail call ptr @StrStr(ptr noundef nonnull %5, ptr noundef nonnull @.str.6) #2
  %17 = ptrtoint ptr %16 to i64
  %18 = ptrtoint ptr %5 to i64
  %reass.sub = sub i64 %17, %18
  %19 = add i64 %reass.sub, 2
  %20 = tail call ptr @AllocateZeroPool(i64 noundef %19) #2
  %21 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %20, ptr %21, align 8, !tbaa !9
  %22 = icmp eq ptr %20, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %15
  tail call void @FreePool(ptr noundef nonnull %11) #2
  %24 = tail call i64 @SetEnvironmentVariableList(ptr noundef %.073)
  br label %70

25:                                               ; preds = %15
  %26 = tail call ptr @StrStr(ptr noundef nonnull %5, ptr noundef nonnull @.str.6) #2
  %27 = ptrtoint ptr %26 to i64
  %28 = sub i64 %27, %18
  %29 = ashr exact i64 %28, 1
  %30 = tail call ptr @StrnCpy(ptr noundef nonnull %20, ptr noundef nonnull %5, i64 noundef %29) #2
  %31 = tail call i64 @StrSize(ptr noundef nonnull %5) #2
  %32 = load ptr, ptr %21, align 8, !tbaa !9
  %33 = tail call i64 @StrSize(ptr noundef %32) #2
  %34 = sub i64 %31, %33
  %35 = load ptr, ptr %21, align 8, !tbaa !9
  %36 = tail call i64 @StrLen(ptr noundef %35) #2
  %37 = getelementptr inbounds i16, ptr %5, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 2
  %39 = tail call ptr @AllocateCopyPool(i64 noundef %34, ptr noundef nonnull %38) #2
  %40 = getelementptr inbounds i8, ptr %11, i64 24
  store ptr %39, ptr %40, align 8, !tbaa !13
  %41 = icmp eq ptr %39, null
  br i1 %41, label %42, label %47

42:                                               ; preds = %25
  %43 = load ptr, ptr %21, align 8, !tbaa !9
  %.not59 = icmp eq ptr %43, null
  br i1 %.not59, label %45, label %44

44:                                               ; preds = %42
  tail call void @FreePool(ptr noundef nonnull %43) #2
  store ptr null, ptr %21, align 8, !tbaa !9
  br label %45

45:                                               ; preds = %44, %42
  tail call void @FreePool(ptr noundef nonnull %11) #2
  %46 = tail call i64 @SetEnvironmentVariableList(ptr noundef %.073)
  br label %70

47:                                               ; preds = %25
  %48 = getelementptr inbounds i8, ptr %11, i64 32
  store i32 2, ptr %48, align 8, !tbaa !14
  %49 = icmp eq ptr %.073, null
  br i1 %49, label %50, label %63

50:                                               ; preds = %47
  %51 = tail call ptr @AllocateZeroPool(i64 noundef 40) #2
  %52 = icmp eq ptr %51, null
  br i1 %52, label %53, label %61

53:                                               ; preds = %50
  %54 = getelementptr inbounds i8, ptr %11, i64 24
  %55 = load ptr, ptr %21, align 8, !tbaa !9
  %.not57 = icmp eq ptr %55, null
  br i1 %.not57, label %57, label %56

56:                                               ; preds = %53
  tail call void @FreePool(ptr noundef nonnull %55) #2
  store ptr null, ptr %21, align 8, !tbaa !9
  br label %57

57:                                               ; preds = %53, %56
  %58 = load ptr, ptr %54, align 8, !tbaa !13
  %.not58 = icmp eq ptr %58, null
  br i1 %.not58, label %60, label %59

59:                                               ; preds = %57
  tail call void @FreePool(ptr noundef nonnull %58) #2
  store ptr null, ptr %54, align 8, !tbaa !13
  br label %60

60:                                               ; preds = %59, %57
  tail call void @FreePool(ptr noundef nonnull %11) #2
  br label %70

61:                                               ; preds = %50
  %62 = tail call ptr @InitializeListHead(ptr noundef nonnull %51) #2
  br label %63

63:                                               ; preds = %61, %47
  %.1 = phi ptr [ %51, %61 ], [ %.073, %47 ]
  %64 = tail call ptr @InsertTailList(ptr noundef nonnull %.1, ptr noundef nonnull %11) #2
  %65 = add i64 %.04672, 1
  %66 = getelementptr inbounds ptr, ptr %0, i64 %65
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = icmp eq ptr %67, null
  br i1 %68, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %63, %.preheader
  %.0.lcssa = phi ptr [ null, %.preheader ], [ %.1, %63 ]
  %69 = tail call i64 @SetEnvironmentVariableList(ptr noundef %.0.lcssa)
  br label %70

70:                                               ; preds = %1, %._crit_edge, %60, %45, %23, %13
  %.047 = phi i64 [ %69, %._crit_edge ], [ -9223372036854775799, %13 ], [ -9223372036854775799, %23 ], [ -9223372036854775799, %45 ], [ -9223372036854775799, %60 ], [ -9223372036854775806, %1 ]
  ret i64 %.047
}

declare ptr @StrStr(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @StrnCpy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare i64 @StrLen(ptr noundef) local_unnamed_addr #0

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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"", !11, i64 0, !6, i64 16, !6, i64 24, !12, i64 32}
!11 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !12, i64 32}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass