; LLVM IR from attractivechaos/klib :: knetfile (khttp_parse_url)

; 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.knetFile_s = type { i32, i32, i64, ptr, ptr, i32, [4 x i32], i32, i32, i32, i32, ptr, ptr, ptr, i64, i64, ptr, ptr }

@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 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

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strstr(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #3

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #3

; 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
define dso_local ptr @khttp_parse_url(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = 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 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call ptr @strstr(ptr noundef %12, ptr noundef @.str.10) #6
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = icmp ne ptr %13, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %197

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 7
  store ptr %19, ptr %7, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %33, %17
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = sext i8 %22 to i32
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %30

25:                                               ; preds = %20
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load i8, ptr %26, align 1, !tbaa !9
  %28 = sext i8 %27 to i32
  %29 = icmp ne i32 %28, 47
  br label %30

30:                                               ; preds = %25, %20
  %31 = phi i1 [ false, %20 ], [ %29, %25 ]
  br i1 %31, label %32, label %36

32:                                               ; preds = %30
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i32 1
  store ptr %35, ptr %7, align 8, !tbaa !5
  br label %20, !llvm.loop !10

36:                                               ; preds = %30
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = ptrtoint ptr %37 to i64
  %40 = ptrtoint ptr %38 to i64
  %41 = sub i64 %39, %40
  %42 = sub nsw i64 %41, 7
  %43 = trunc i64 %42 to i32
  store i32 %43, ptr %10, align 4, !tbaa !12
  %44 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 128) #7
  store ptr %44, ptr %6, align 8, !tbaa !5
  %45 = load i32, ptr %10, align 4, !tbaa !12
  %46 = add nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = call noalias ptr @calloc(i64 noundef %47, i64 noundef 1) #7
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.knetFile_s, ptr %49, i32 0, i32 17
  store ptr %48, ptr %50, align 8, !tbaa !14
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.knetFile_s, ptr %51, i32 0, i32 17
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 7
  %56 = load i32, ptr %10, align 4, !tbaa !12
  %57 = sext i32 %56 to i64
  %58 = call ptr @strncpy(ptr noundef %53, ptr noundef %55, i64 noundef %57) #5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.knetFile_s, ptr %59, i32 0, i32 17
  %61 = load ptr, ptr %60, align 8, !tbaa !14
  %62 = load i32, ptr %10, align 4, !tbaa !12
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i8, ptr %61, i64 %63
  store i8 0, ptr %64, align 1, !tbaa !9
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.knetFile_s, ptr %65, i32 0, i32 17
  %67 = load ptr, ptr %66, align 8, !tbaa !14
  store ptr %67, ptr %9, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %81, %36
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = load i8, ptr %69, align 1, !tbaa !9
  %71 = sext i8 %70 to i32
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %78

73:                                               ; preds = %68
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load i8, ptr %74, align 1, !tbaa !9
  %76 = sext i8 %75 to i32
  %77 = icmp ne i32 %76, 58
  br label %78

78:                                               ; preds = %73, %68
  %79 = phi i1 [ false, %68 ], [ %77, %73 ]
  br i1 %79, label %80, label %84

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i32 1
  store ptr %83, ptr %9, align 8, !tbaa !5
  br label %68, !llvm.loop !17

84:                                               ; preds = %78
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = load i8, ptr %85, align 1, !tbaa !9
  %87 = sext i8 %86 to i32
  %88 = icmp eq i32 %87, 58
  br i1 %88, label %89, label %92

89:                                               ; preds = %84
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i32 1
  store ptr %91, ptr %9, align 8, !tbaa !5
  store i8 0, ptr %90, align 1, !tbaa !9
  br label %92

92:                                               ; preds = %89, %84
  %93 = call ptr @getenv(ptr noundef @.str.11) #5
  store ptr %93, ptr %8, align 8, !tbaa !5
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = icmp eq ptr %94, null
  br i1 %95, label %96, label %127

96:                                               ; preds = %92
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.knetFile_s, ptr %97, i32 0, i32 17
  %99 = load ptr, ptr %98, align 8, !tbaa !14
  %100 = call noalias ptr @strdup(ptr noundef %99) #5
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.knetFile_s, ptr %101, i32 0, i32 3
  store ptr %100, ptr %102, align 8, !tbaa !18
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = load i8, ptr %103, align 1, !tbaa !9
  %105 = sext i8 %104 to i32
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %109

107:                                              ; preds = %96
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  br label %110

109:                                              ; preds = %96
  br label %110

110:                                              ; preds = %109, %107
  %111 = phi ptr [ %108, %107 ], [ @.str.12, %109 ]
  %112 = call noalias ptr @strdup(ptr noundef %111) #5
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.knetFile_s, ptr %113, i32 0, i32 4
  store ptr %112, ptr %114, align 8, !tbaa !19
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = load i8, ptr %115, align 1, !tbaa !9
  %117 = sext i8 %116 to i32
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %121

119:                                              ; preds = %110
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  br label %122

121:                                              ; preds = %110
  br label %122

122:                                              ; preds = %121, %119
  %123 = phi ptr [ %120, %119 ], [ @.str.13, %121 ]
  %124 = call noalias ptr @strdup(ptr noundef %123) #5
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.knetFile_s, ptr %125, i32 0, i32 16
  store ptr %124, ptr %126, align 8, !tbaa !20
  br label %187

127:                                              ; preds = %92
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = call ptr @strstr(ptr noundef %128, ptr noundef @.str.10) #6
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = icmp eq ptr %129, %130
  br i1 %131, label %132, label %136

132:                                              ; preds = %127
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds i8, ptr %133, i64 7
  %135 = call noalias ptr @strdup(ptr noundef %134) #5
  br label %139

136:                                              ; preds = %127
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = call noalias ptr @strdup(ptr noundef %137) #5
  br label %139

139:                                              ; preds = %136, %132
  %140 = phi ptr [ %135, %132 ], [ %138, %136 ]
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.knetFile_s, ptr %141, i32 0, i32 3
  store ptr %140, ptr %142, align 8, !tbaa !18
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.knetFile_s, ptr %143, i32 0, i32 3
  %145 = load ptr, ptr %144, align 8, !tbaa !18
  store ptr %145, ptr %9, align 8, !tbaa !5
  br label %146

146:                                              ; preds = %159, %139
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  %148 = load i8, ptr %147, align 1, !tbaa !9
  %149 = sext i8 %148 to i32
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %156

151:                                              ; preds = %146
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = load i8, ptr %152, align 1, !tbaa !9
  %154 = sext i8 %153 to i32
  %155 = icmp ne i32 %154, 58
  br label %156

156:                                              ; preds = %151, %146
  %157 = phi i1 [ false, %146 ], [ %155, %151 ]
  br i1 %157, label %158, label %162

158:                                              ; preds = %156
  br label %159

159:                                              ; preds = %158
  %160 = load ptr, ptr %9, align 8, !tbaa !5
  %161 = getelementptr inbounds i8, ptr %160, i32 1
  store ptr %161, ptr %9, align 8, !tbaa !5
  br label %146, !llvm.loop !21

162:                                              ; preds = %156
  %163 = load ptr, ptr %9, align 8, !tbaa !5
  %164 = load i8, ptr %163, align 1, !tbaa !9
  %165 = sext i8 %164 to i32
  %166 = icmp eq i32 %165, 58
  br i1 %166, label %167, label %170

167:                                              ; preds = %162
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = getelementptr inbounds i8, ptr %168, i32 1
  store ptr %169, ptr %9, align 8, !tbaa !5
  store i8 0, ptr %168, align 1, !tbaa !9
  br label %170

170:                                              ; preds = %167, %162
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = load i8, ptr %171, align 1, !tbaa !9
  %173 = sext i8 %172 to i32
  %174 = icmp ne i32 %173, 0
  br i1 %174, label %175, label %177

175:                                              ; preds = %170
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  br label %178

177:                                              ; preds = %170
  br label %178

178:                                              ; preds = %177, %175
  %179 = phi ptr [ %176, %175 ], [ @.str.12, %177 ]
  %180 = call noalias ptr @strdup(ptr noundef %179) #5
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.knetFile_s, ptr %181, i32 0, i32 4
  store ptr %180, ptr %182, align 8, !tbaa !19
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = call noalias ptr @strdup(ptr noundef %183) #5
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.knetFile_s, ptr %185, i32 0, i32 16
  store ptr %184, ptr %186, align 8, !tbaa !20
  br label %187

187:                                              ; preds = %178, %122
  %188 = load ptr, ptr %6, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.knetFile_s, ptr %188, i32 0, i32 0
  store i32 3, ptr %189, align 8, !tbaa !22
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.knetFile_s, ptr %190, i32 0, i32 1
  store i32 -1, ptr %191, align 4, !tbaa !23
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.knetFile_s, ptr %192, i32 0, i32 5
  store i32 -1, ptr %193, align 8, !tbaa !24
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.knetFile_s, ptr %194, i32 0, i32 14
  store i64 0, ptr %195, align 8, !tbaa !25
  %196 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %196, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %197

197:                                              ; preds = %187, %16
  call void @llvm.lifetime.end.p0(i64 4, 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 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %198 = load ptr, ptr %3, align 8
  ret ptr %198
}

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(read) "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 allocsize(0,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 #3 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind allocsize(0,1) }

!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 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 120}
!15 = !{!"knetFile_s", !13, i64 0, !13, i64 4, !16, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !7, i64 36, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !16, i64 96, !16, i64 104, !6, i64 112, !6, i64 120}
!16 = !{!"long", !7, i64 0}
!17 = distinct !{!17, !11}
!18 = !{!15, !6, i64 16}
!19 = !{!15, !6, i64 24}
!20 = !{!15, !6, i64 112}
!21 = distinct !{!21, !11}
!22 = !{!15, !13, i64 0}
!23 = !{!15, !13, i64 4}
!24 = !{!15, !13, i64 32}
!25 = !{!15, !16, i64 96}


; 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.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #1

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

; Function Attrs: nofree nounwind uwtable
define dso_local noalias noundef ptr @khttp_parse_url(ptr noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #3 {
  %strlen = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.10)
  %strncmp = tail call i32 @strncmp(ptr %0, ptr nonnull @.str.10, i64 %strlen)
  %cmp.not = icmp eq i32 %strncmp, 0
  br i1 %cmp.not, label %3, label %55

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 7
  br label %5

5:                                                ; preds = %7, %3
  %.056 = phi ptr [ %4, %3 ], [ %8, %7 ]
  %6 = load i8, ptr %.056, align 1, !tbaa !5
  switch i8 %6, label %7 [
    i8 0, label %.critedge
    i8 47, label %.critedge
  ]

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %.056, i64 1
  br label %5, !llvm.loop !8

.critedge:                                        ; preds = %5, %5
  %9 = ptrtoint ptr %.056 to i64
  %10 = ptrtoint ptr %0 to i64
  %11 = sub i64 %9, %10
  %12 = tail call noalias dereferenceable_or_null(128) ptr @calloc(i64 noundef 1, i64 noundef 128) #6
  %13 = shl i64 %11, 32
  %sext = add i64 %13, -25769803776
  %14 = ashr exact i64 %sext, 32
  %15 = tail call noalias ptr @calloc(i64 noundef %14, i64 noundef 1) #6
  %16 = getelementptr inbounds i8, ptr %12, i64 120
  store ptr %15, ptr %16, align 8, !tbaa !10
  %sext63 = add i64 %13, -30064771072
  %17 = ashr exact i64 %sext63, 32
  %18 = tail call ptr @strncpy(ptr noundef %15, ptr noundef nonnull %4, i64 noundef %17) #7
  %19 = getelementptr inbounds i8, ptr %15, i64 %17
  store i8 0, ptr %19, align 1, !tbaa !5
  br label %20

20:                                               ; preds = %22, %.critedge
  %.055 = phi ptr [ %15, %.critedge ], [ %23, %22 ]
  %21 = load i8, ptr %.055, align 1, !tbaa !5
  switch i8 %21, label %22 [
    i8 58, label %24
    i8 0, label %.loopexit73
  ]

22:                                               ; preds = %20
  %23 = getelementptr inbounds i8, ptr %.055, i64 1
  br label %20, !llvm.loop !15

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %.055, i64 1
  store i8 0, ptr %.055, align 1, !tbaa !5
  br label %.loopexit73

.loopexit73:                                      ; preds = %20, %24
  %.1 = phi ptr [ %25, %24 ], [ %.055, %20 ]
  %26 = tail call ptr @getenv(ptr noundef nonnull @.str.11) #7
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %37

28:                                               ; preds = %.loopexit73
  %29 = tail call noalias ptr @strdup(ptr noundef %15) #7
  %30 = getelementptr inbounds i8, ptr %12, i64 16
  store ptr %29, ptr %30, align 8, !tbaa !16
  %31 = load i8, ptr %.1, align 1, !tbaa !5
  %.not71 = icmp eq i8 %31, 0
  %32 = select i1 %.not71, ptr @.str.12, ptr %.1
  %33 = tail call noalias ptr @strdup(ptr noundef nonnull %32) #7
  %34 = getelementptr inbounds i8, ptr %12, i64 24
  store ptr %33, ptr %34, align 8, !tbaa !17
  %.not72 = icmp eq i8 %6, 0
  %35 = select i1 %.not72, ptr @.str.13, ptr %.056
  %36 = tail call noalias ptr @strdup(ptr noundef nonnull %35) #7
  br label %51

37:                                               ; preds = %.loopexit73
  %strncmp67 = tail call i32 @strncmp(ptr nonnull %26, ptr nonnull @.str.10, i64 %strlen)
  %cmp = icmp eq i32 %strncmp67, 0
  %.sink.idx = select i1 %cmp, i64 7, i64 0
  %.sink = getelementptr inbounds i8, ptr %26, i64 %.sink.idx
  %38 = tail call noalias ptr @strdup(ptr noundef nonnull %.sink) #7
  %39 = getelementptr inbounds i8, ptr %12, i64 16
  store ptr %38, ptr %39, align 8, !tbaa !16
  br label %40

40:                                               ; preds = %42, %37
  %.2 = phi ptr [ %38, %37 ], [ %43, %42 ]
  %41 = load i8, ptr %.2, align 1, !tbaa !5
  switch i8 %41, label %42 [
    i8 58, label %44
    i8 0, label %.loopexit
  ]

42:                                               ; preds = %40
  %43 = getelementptr inbounds i8, ptr %.2, i64 1
  br label %40, !llvm.loop !18

44:                                               ; preds = %40
  %45 = getelementptr inbounds i8, ptr %.2, i64 1
  store i8 0, ptr %.2, align 1, !tbaa !5
  %.pre = load i8, ptr %45, align 1, !tbaa !5
  %46 = icmp eq i8 %.pre, 0
  %47 = select i1 %46, ptr @.str.12, ptr %45
  br label %.loopexit

.loopexit:                                        ; preds = %40, %44
  %.not70 = phi ptr [ %47, %44 ], [ @.str.12, %40 ]
  %48 = tail call noalias ptr @strdup(ptr noundef nonnull %.not70) #7
  %49 = getelementptr inbounds i8, ptr %12, i64 24
  store ptr %48, ptr %49, align 8, !tbaa !17
  %50 = tail call noalias ptr @strdup(ptr noundef %0) #7
  br label %51

51:                                               ; preds = %.loopexit, %28
  %.sink80 = phi ptr [ %50, %.loopexit ], [ %36, %28 ]
  %52 = getelementptr inbounds i8, ptr %12, i64 112
  store ptr %.sink80, ptr %52, align 8, !tbaa !19
  store i32 3, ptr %12, align 8, !tbaa !20
  %53 = getelementptr inbounds i8, ptr %12, i64 4
  store i32 -1, ptr %53, align 4, !tbaa !21
  %54 = getelementptr inbounds i8, ptr %12, i64 32
  store i32 -1, ptr %54, align 8, !tbaa !22
  br label %55

55:                                               ; preds = %2, %51
  %.0 = phi ptr [ %12, %51 ], [ null, %2 ]
  ret ptr %.0
}

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture) local_unnamed_addr #5

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #3 = { nofree 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 #4 = { nofree nounwind memory(read) "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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind allocsize(0,1) }
attributes #7 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !14, i64 120}
!11 = !{!"knetFile_s", !12, i64 0, !12, i64 4, !13, i64 8, !14, i64 16, !14, i64 24, !12, i64 32, !6, i64 36, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !13, i64 96, !13, i64 104, !14, i64 112, !14, i64 120}
!12 = !{!"int", !6, i64 0}
!13 = !{!"long", !6, i64 0}
!14 = !{!"any pointer", !6, i64 0}
!15 = distinct !{!15, !9}
!16 = !{!11, !14, i64 16}
!17 = !{!11, !14, i64 24}
!18 = distinct !{!18, !9}
!19 = !{!11, !14, i64 112}
!20 = !{!11, !12, i64 0}
!21 = !{!11, !12, i64 4}
!22 = !{!11, !12, i64 32}


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