; LLVM IR from begeekmyfriend/leetcode :: 0166_fraction_to_recurring_decimal (fraction)

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

@.str = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @fractionToDecimal(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i8, align 1
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1024, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = call noalias ptr @malloc(i64 noundef %24) #8
  store ptr %25, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %26 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %26, ptr %8, align 8, !tbaa !9
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %33

29:                                               ; preds = %2
  %30 = load ptr, ptr %7, align 8, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %30, i64 0
  store i8 0, ptr %31, align 1, !tbaa !11
  %32 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %32, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %209

33:                                               ; preds = %2
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %42

36:                                               ; preds = %33
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %37, i64 0
  store i8 48, ptr %38, align 1, !tbaa !11
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  store i8 0, ptr %40, align 1, !tbaa !11
  %41 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %41, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %209

42:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  store i64 %44, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  store i64 %46, ptr %11, align 8, !tbaa !12
  %47 = load i64, ptr %10, align 8, !tbaa !12
  %48 = icmp slt i64 %47, 0
  br i1 %48, label %49, label %52

49:                                               ; preds = %42
  %50 = load i64, ptr %10, align 8, !tbaa !12
  %51 = sub nsw i64 0, %50
  store i64 %51, ptr %10, align 8, !tbaa !12
  br label %52

52:                                               ; preds = %49, %42
  %53 = load i64, ptr %11, align 8, !tbaa !12
  %54 = icmp slt i64 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %52
  %56 = load i64, ptr %11, align 8, !tbaa !12
  %57 = sub nsw i64 0, %56
  store i64 %57, ptr %11, align 8, !tbaa !12
  br label %58

58:                                               ; preds = %55, %52
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #7
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sitofp i32 %59 to float
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sitofp i32 %61 to float
  %63 = fdiv float %60, %62
  %64 = fcmp oge float %63, 0.000000e+00
  %65 = zext i1 %64 to i8
  store i8 %65, ptr %12, align 1, !tbaa !14
  %66 = load i8, ptr %12, align 1, !tbaa !14, !range !16, !noundef !17
  %67 = trunc i8 %66 to i1
  br i1 %67, label %71, label %68

68:                                               ; preds = %58
  %69 = load ptr, ptr %8, align 8, !tbaa !9
  %70 = getelementptr inbounds i8, ptr %69, i32 1
  store ptr %70, ptr %8, align 8, !tbaa !9
  store i8 45, ptr %69, align 1, !tbaa !11
  br label %71

71:                                               ; preds = %68, %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %72 = load i64, ptr %10, align 8, !tbaa !12
  %73 = load i64, ptr %11, align 8, !tbaa !12
  %74 = srem i64 %72, %73
  store i64 %74, ptr %13, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %75 = load i64, ptr %10, align 8, !tbaa !12
  %76 = load i64, ptr %11, align 8, !tbaa !12
  %77 = sdiv i64 %75, %76
  store i64 %77, ptr %14, align 8, !tbaa !12
  %78 = load ptr, ptr %8, align 8, !tbaa !9
  %79 = load i64, ptr %14, align 8, !tbaa !12
  %80 = icmp sgt i64 %79, 0
  br i1 %80, label %81, label %83

81:                                               ; preds = %71
  %82 = load i64, ptr %14, align 8, !tbaa !12
  br label %86

83:                                               ; preds = %71
  %84 = load i64, ptr %14, align 8, !tbaa !12
  %85 = sub nsw i64 0, %84
  br label %86

86:                                               ; preds = %83, %81
  %87 = phi i64 [ %82, %81 ], [ %85, %83 ]
  %88 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %78, ptr noundef @.str, i64 noundef %87) #7
  %89 = load i64, ptr %13, align 8, !tbaa !12
  %90 = icmp eq i64 %89, 0
  br i1 %90, label %91, label %93

91:                                               ; preds = %86
  %92 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %92, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %208

93:                                               ; preds = %86
  %94 = load ptr, ptr %7, align 8, !tbaa !9
  %95 = load ptr, ptr %7, align 8, !tbaa !9
  %96 = call i64 @strlen(ptr noundef %95) #9
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  store ptr %97, ptr %8, align 8, !tbaa !9
  %98 = load ptr, ptr %8, align 8, !tbaa !9
  %99 = getelementptr inbounds i8, ptr %98, i32 1
  store ptr %99, ptr %8, align 8, !tbaa !9
  store i8 46, ptr %98, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = call noalias ptr @malloc(i64 noundef %101) #8
  store ptr %102, ptr %17, align 8, !tbaa !9
  %103 = load ptr, ptr %17, align 8, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %103, i8 0, i64 %105, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %106 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %106, ptr %18, align 8, !tbaa !9
  store i32 1333, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = mul i64 %108, 16
  %110 = call noalias ptr @malloc(i64 noundef %109) #8
  store ptr %110, ptr %19, align 8, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %120, %93
  %112 = load i32, ptr %15, align 4, !tbaa !5
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %115, label %123

115:                                              ; preds = %111
  %116 = load ptr, ptr %19, align 8, !tbaa !9
  %117 = load i32, ptr %15, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds %struct.list_head, ptr %116, i64 %118
  call void @INIT_LIST_HEAD(ptr noundef %119)
  br label %120

120:                                              ; preds = %115
  %121 = load i32, ptr %15, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %15, align 4, !tbaa !5
  br label %111, !llvm.loop !18

123:                                              ; preds = %111
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %201, %123
  %125 = load i64, ptr %13, align 8, !tbaa !12
  %126 = icmp ne i64 %125, 0
  br i1 %126, label %127, label %202

127:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %128 = load ptr, ptr %19, align 8, !tbaa !9
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = load i64, ptr %13, align 8, !tbaa !12
  %131 = trunc i64 %130 to i32
  %132 = call i32 @find(ptr noundef %128, i32 noundef %129, i32 noundef %131)
  store i32 %132, ptr %20, align 4, !tbaa !5
  %133 = load i32, ptr %20, align 4, !tbaa !5
  %134 = icmp sge i32 %133, 0
  br i1 %134, label %135, label %165

135:                                              ; preds = %127
  br label %136

136:                                              ; preds = %140, %135
  %137 = load i32, ptr %20, align 4, !tbaa !5
  %138 = add nsw i32 %137, -1
  store i32 %138, ptr %20, align 4, !tbaa !5
  %139 = icmp sgt i32 %137, 0
  br i1 %139, label %140, label %146

140:                                              ; preds = %136
  %141 = load ptr, ptr %17, align 8, !tbaa !9
  %142 = getelementptr inbounds i8, ptr %141, i32 1
  store ptr %142, ptr %17, align 8, !tbaa !9
  %143 = load i8, ptr %141, align 1, !tbaa !11
  %144 = load ptr, ptr %8, align 8, !tbaa !9
  %145 = getelementptr inbounds i8, ptr %144, i32 1
  store ptr %145, ptr %8, align 8, !tbaa !9
  store i8 %143, ptr %144, align 1, !tbaa !11
  br label %136, !llvm.loop !20

146:                                              ; preds = %136
  %147 = load ptr, ptr %8, align 8, !tbaa !9
  %148 = getelementptr inbounds i8, ptr %147, i32 1
  store ptr %148, ptr %8, align 8, !tbaa !9
  store i8 40, ptr %147, align 1, !tbaa !11
  br label %149

149:                                              ; preds = %154, %146
  %150 = load ptr, ptr %17, align 8, !tbaa !9
  %151 = load i8, ptr %150, align 1, !tbaa !11
  %152 = sext i8 %151 to i32
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %160

154:                                              ; preds = %149
  %155 = load ptr, ptr %17, align 8, !tbaa !9
  %156 = getelementptr inbounds i8, ptr %155, i32 1
  store ptr %156, ptr %17, align 8, !tbaa !9
  %157 = load i8, ptr %155, align 1, !tbaa !11
  %158 = load ptr, ptr %8, align 8, !tbaa !9
  %159 = getelementptr inbounds i8, ptr %158, i32 1
  store ptr %159, ptr %8, align 8, !tbaa !9
  store i8 %157, ptr %158, align 1, !tbaa !11
  br label %149, !llvm.loop !21

160:                                              ; preds = %149
  %161 = load ptr, ptr %8, align 8, !tbaa !9
  %162 = getelementptr inbounds i8, ptr %161, i32 1
  store ptr %162, ptr %8, align 8, !tbaa !9
  store i8 41, ptr %161, align 1, !tbaa !11
  %163 = load ptr, ptr %8, align 8, !tbaa !9
  store i8 0, ptr %163, align 1, !tbaa !11
  %164 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %164, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %199

165:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %166 = call noalias ptr @malloc(i64 noundef 24) #8
  store ptr %166, ptr %21, align 8, !tbaa !9
  %167 = load i64, ptr %13, align 8, !tbaa !12
  %168 = trunc i64 %167 to i32
  %169 = load ptr, ptr %21, align 8, !tbaa !9
  %170 = getelementptr inbounds %struct.rem_node, ptr %169, i32 0, i32 0
  store i32 %168, ptr %170, align 8, !tbaa !22
  %171 = load i32, ptr %15, align 4, !tbaa !5
  %172 = load ptr, ptr %21, align 8, !tbaa !9
  %173 = getelementptr inbounds %struct.rem_node, ptr %172, i32 0, i32 1
  store i32 %171, ptr %173, align 4, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %174 = load i64, ptr %13, align 8, !tbaa !12
  %175 = load i32, ptr %6, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = srem i64 %174, %176
  %178 = trunc i64 %177 to i32
  store i32 %178, ptr %22, align 4, !tbaa !5
  %179 = load ptr, ptr %21, align 8, !tbaa !9
  %180 = getelementptr inbounds %struct.rem_node, ptr %179, i32 0, i32 2
  %181 = load ptr, ptr %19, align 8, !tbaa !9
  %182 = load i32, ptr %22, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds %struct.list_head, ptr %181, i64 %183
  call void @list_add(ptr noundef %180, ptr noundef %184)
  %185 = load i64, ptr %13, align 8, !tbaa !12
  %186 = mul nsw i64 %185, 10
  %187 = load i64, ptr %11, align 8, !tbaa !12
  %188 = sdiv i64 %186, %187
  %189 = add nsw i64 %188, 48
  %190 = trunc i64 %189 to i8
  %191 = load ptr, ptr %18, align 8, !tbaa !9
  %192 = getelementptr inbounds i8, ptr %191, i32 1
  store ptr %192, ptr %18, align 8, !tbaa !9
  store i8 %190, ptr %191, align 1, !tbaa !11
  %193 = load i64, ptr %13, align 8, !tbaa !12
  %194 = mul nsw i64 %193, 10
  %195 = load i64, ptr %11, align 8, !tbaa !12
  %196 = srem i64 %194, %195
  store i64 %196, ptr %13, align 8, !tbaa !12
  %197 = load i32, ptr %15, align 4, !tbaa !5
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  store i32 0, ptr %9, align 4
  br label %199

199:                                              ; preds = %165, %160
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  %200 = load i32, ptr %9, align 4
  switch i32 %200, label %207 [
    i32 0, label %201
  ]

201:                                              ; preds = %199
  br label %124, !llvm.loop !26

202:                                              ; preds = %124
  %203 = load ptr, ptr %8, align 8, !tbaa !9
  %204 = load ptr, ptr %17, align 8, !tbaa !9
  %205 = call ptr @strcpy(ptr noundef %203, ptr noundef %204) #7
  %206 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %206, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %207

207:                                              ; preds = %202, %199
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %208

208:                                              ; preds = %207, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %209

209:                                              ; preds = %208, %36, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %210 = load ptr, ptr %3, align 8
  ret ptr %210
}

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

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @INIT_LIST_HEAD(ptr noundef) #6

; Function Attrs: nounwind uwtable
declare hidden i32 @find(ptr noundef, i32 noundef, i32 noundef) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @list_add(ptr noundef, ptr noundef) #6

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 "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 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = !{!23, !6, i64 0}
!23 = !{!"rem_node", !6, i64 0, !6, i64 4, !24, i64 8}
!24 = !{!"list_head", !10, i64 0, !10, i64 8}
!25 = !{!23, !6, i64 4}
!26 = distinct !{!26, !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.list_head = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @fractionToDecimal(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = tail call noalias dereferenceable_or_null(1024) ptr @malloc(i64 noundef 1024) #8
  %4 = icmp eq i32 %1, 0
  br i1 %4, label %5, label %6

5:                                                ; preds = %2
  store i8 0, ptr %3, align 1, !tbaa !5
  br label %.loopexit

6:                                                ; preds = %2
  %7 = icmp eq i32 %0, 0
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  store i8 48, ptr %3, align 1, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %3, i64 1
  store i8 0, ptr %9, align 1, !tbaa !5
  br label %.loopexit

10:                                               ; preds = %6
  %11 = tail call i32 @llvm.abs.i32(i32 %0, i1 false)
  %12 = tail call i32 @llvm.abs.i32(i32 %1, i1 false)
  %.095 = zext i32 %12 to i64
  %13 = sitofp i32 %0 to float
  %14 = sitofp i32 %1 to float
  %15 = fdiv float %13, %14
  %16 = fcmp ult float %15, 0.000000e+00
  br i1 %16, label %17, label %19

17:                                               ; preds = %10
  %18 = getelementptr inbounds i8, ptr %3, i64 1
  store i8 45, ptr %3, align 1, !tbaa !5
  br label %19

19:                                               ; preds = %17, %10
  %.077 = phi ptr [ %3, %10 ], [ %18, %17 ]
  %20 = urem i32 %11, %12
  %.zext = zext nneg i32 %20 to i64
  %21 = udiv i32 %11, %12
  %.zext107 = zext i32 %21 to i64
  %22 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %.077, ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.zext107) #9
  %23 = icmp eq i32 %20, 0
  br i1 %23, label %.loopexit, label %24

24:                                               ; preds = %19
  %25 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #10
  %26 = getelementptr inbounds i8, ptr %3, i64 %25
  store i8 46, ptr %26, align 1, !tbaa !5
  %calloc = tail call dereferenceable_or_null(1024) ptr @calloc(i64 1, i64 1024)
  %27 = tail call noalias dereferenceable_or_null(21328) ptr @malloc(i64 noundef 21328) #8
  br label %28

28:                                               ; preds = %24, %28
  %indvars.iv = phi i64 [ 0, %24 ], [ %indvars.iv.next, %28 ]
  %29 = getelementptr inbounds %struct.list_head, ptr %27, i64 %indvars.iv
  tail call void @INIT_LIST_HEAD(ptr noundef %29)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1333
  br i1 %exitcond.not, label %.preheader108.preheader, label %28, !llvm.loop !8

.preheader108.preheader:                          ; preds = %28
  %30 = getelementptr inbounds i8, ptr %26, i64 1
  br label %.preheader108

.preheader108:                                    ; preds = %.preheader108.preheader, %63
  %.093 = phi i64 [ %.194, %63 ], [ %.zext, %.preheader108.preheader ]
  %.190 = phi i32 [ %.291, %63 ], [ 0, %.preheader108.preheader ]
  %.084 = phi ptr [ %.387, %63 ], [ %calloc, %.preheader108.preheader ]
  %.082 = phi ptr [ %.183, %63 ], [ %calloc, %.preheader108.preheader ]
  %.178 = phi ptr [ %.481, %63 ], [ %30, %.preheader108.preheader ]
  %.0 = phi ptr [ %.1, %63 ], [ undef, %.preheader108.preheader ]
  %.178143 = ptrtoint ptr %.178 to i64
  %.084144 = ptrtoint ptr %.084 to i64
  %.not = icmp eq i64 %.093, 0
  br i1 %.not, label %64, label %31

31:                                               ; preds = %.preheader108
  %32 = trunc nuw nsw i64 %.093 to i32
  %33 = tail call i32 @find(ptr noundef %27, i32 noundef 1333, i32 noundef %32)
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %50, label %.preheader

.preheader:                                       ; preds = %31
  %.not126 = icmp eq i32 %33, 0
  br i1 %.not126, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %35 = zext nneg i32 %33 to i64
  %min.iters.check = icmp ult i32 %33, 32
  %36 = sub i64 %.178143, %.084144
  %diff.check = icmp ult i64 %36, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %.lr.ph.preheader153, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %35, 2147483616
  %.cast = trunc nuw nsw i64 %n.vec to i32
  %ind.end = sub nsw i32 %33, %.cast
  %ind.end145 = getelementptr i8, ptr %.178, i64 %n.vec
  %ind.end147 = getelementptr i8, ptr %.084, i64 %n.vec
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %next.gep = getelementptr i8, ptr %.178, i64 %index
  %next.gep150 = getelementptr i8, ptr %.084, i64 %index
  %37 = getelementptr i8, ptr %next.gep150, i64 16
  %wide.load = load <16 x i8>, ptr %next.gep150, align 1, !tbaa !5
  %wide.load152 = load <16 x i8>, ptr %37, align 1, !tbaa !5
  %38 = getelementptr i8, ptr %next.gep, i64 16
  store <16 x i8> %wide.load, ptr %next.gep, align 1, !tbaa !5
  store <16 x i8> %wide.load152, ptr %38, align 1, !tbaa !5
  %index.next = add nuw i64 %index, 32
  %39 = icmp eq i64 %index.next, %n.vec
  br i1 %39, label %middle.block, label %vector.body, !llvm.loop !10

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %35
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader153

.lr.ph.preheader153:                              ; preds = %middle.block, %.lr.ph.preheader
  %.076114.ph = phi i32 [ %33, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.279113.ph = phi ptr [ %.178, %.lr.ph.preheader ], [ %ind.end145, %middle.block ]
  %.185112.ph = phi ptr [ %.084, %.lr.ph.preheader ], [ %ind.end147, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader153, %.lr.ph
  %.076114 = phi i32 [ %40, %.lr.ph ], [ %.076114.ph, %.lr.ph.preheader153 ]
  %.279113 = phi ptr [ %43, %.lr.ph ], [ %.279113.ph, %.lr.ph.preheader153 ]
  %.185112 = phi ptr [ %41, %.lr.ph ], [ %.185112.ph, %.lr.ph.preheader153 ]
  %40 = add nsw i32 %.076114, -1
  %41 = getelementptr inbounds i8, ptr %.185112, i64 1
  %42 = load i8, ptr %.185112, align 1, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %.279113, i64 1
  store i8 %42, ptr %.279113, align 1, !tbaa !5
  %44 = icmp ugt i32 %.076114, 1
  br i1 %44, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.preheader
  %.185.lcssa = phi ptr [ %.084, %.preheader ], [ %ind.end147, %middle.block ], [ %41, %.lr.ph ]
  %.279.lcssa = phi ptr [ %.178, %.preheader ], [ %ind.end145, %middle.block ], [ %43, %.lr.ph ]
  store i8 40, ptr %.279.lcssa, align 1, !tbaa !5
  %.380116 = getelementptr inbounds i8, ptr %.279.lcssa, i64 1
  %45 = load i8, ptr %.185.lcssa, align 1, !tbaa !5
  %.not104117 = icmp eq i8 %45, 0
  br i1 %.not104117, label %._crit_edge122, label %.lr.ph121

.lr.ph121:                                        ; preds = %._crit_edge, %.lr.ph121
  %46 = phi i8 [ %48, %.lr.ph121 ], [ %45, %._crit_edge ]
  %.380119 = phi ptr [ %.380, %.lr.ph121 ], [ %.380116, %._crit_edge ]
  %.286118 = phi ptr [ %47, %.lr.ph121 ], [ %.185.lcssa, %._crit_edge ]
  %47 = getelementptr inbounds i8, ptr %.286118, i64 1
  store i8 %46, ptr %.380119, align 1, !tbaa !5
  %.380 = getelementptr inbounds i8, ptr %.380119, i64 1
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %.not104 = icmp eq i8 %48, 0
  br i1 %.not104, label %._crit_edge122, label %.lr.ph121, !llvm.loop !14

._crit_edge122:                                   ; preds = %.lr.ph121, %._crit_edge
  %.286.lcssa = phi ptr [ %.185.lcssa, %._crit_edge ], [ %47, %.lr.ph121 ]
  %.279.pn.lcssa = phi ptr [ %.279.lcssa, %._crit_edge ], [ %.380119, %.lr.ph121 ]
  %.380.lcssa = phi ptr [ %.380116, %._crit_edge ], [ %.380, %.lr.ph121 ]
  %49 = getelementptr inbounds i8, ptr %.279.pn.lcssa, i64 2
  store i8 41, ptr %.380.lcssa, align 1, !tbaa !5
  store i8 0, ptr %49, align 1, !tbaa !5
  br label %63

50:                                               ; preds = %31
  %51 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
  store i32 %32, ptr %51, align 8, !tbaa !15
  %52 = getelementptr inbounds i8, ptr %51, i64 4
  store i32 %.190, ptr %52, align 4, !tbaa !20
  %53 = urem i64 %.093, 1333
  %54 = getelementptr inbounds i8, ptr %51, i64 8
  %55 = getelementptr inbounds %struct.list_head, ptr %27, i64 %53
  tail call void @list_add(ptr noundef nonnull %54, ptr noundef %55)
  %56 = mul nuw nsw i64 %.093, 10
  %57 = udiv i64 %56, %.095
  %58 = trunc i64 %57 to i8
  %59 = add i8 %58, 48
  %60 = getelementptr inbounds i8, ptr %.082, i64 1
  store i8 %59, ptr %.082, align 1, !tbaa !5
  %61 = urem i64 %56, %.095
  %62 = add nsw i32 %.190, 1
  br label %63

63:                                               ; preds = %50, %._crit_edge122
  %.194 = phi i64 [ %.093, %._crit_edge122 ], [ %61, %50 ]
  %.291 = phi i32 [ %.190, %._crit_edge122 ], [ %62, %50 ]
  %.387 = phi ptr [ %.286.lcssa, %._crit_edge122 ], [ %.084, %50 ]
  %.183 = phi ptr [ %.082, %._crit_edge122 ], [ %60, %50 ]
  %.481 = phi ptr [ %49, %._crit_edge122 ], [ %.178, %50 ]
  %.1 = phi ptr [ %3, %._crit_edge122 ], [ %.0, %50 ]
  br i1 %34, label %.preheader108, label %.loopexit, !llvm.loop !21

64:                                               ; preds = %.preheader108
  %65 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %.178, ptr noundef nonnull dereferenceable(1) %.084) #9
  br label %.loopexit

.loopexit:                                        ; preds = %63, %19, %64, %8, %5
  %.4 = phi ptr [ %3, %5 ], [ %3, %8 ], [ %3, %19 ], [ %3, %64 ], [ %.1, %63 ]
  ret ptr %.4
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @INIT_LIST_HEAD(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden i32 @find(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @list_add(ptr noundef, ptr noundef) local_unnamed_addr #4

; 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 #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

attributes #0 = { 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 #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) 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 #2 = { nofree 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 #3 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #4 = { inlinehint 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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }

!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 = distinct !{!10, !9, !11, !12}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !9, !11}
!14 = distinct !{!14, !9}
!15 = !{!16, !17, i64 0}
!16 = !{!"rem_node", !17, i64 0, !17, i64 4, !18, i64 8}
!17 = !{!"int", !6, i64 0}
!18 = !{!"list_head", !19, i64 0, !19, i64 8}
!19 = !{!"any pointer", !6, i64 0}
!20 = !{!16, !17, i64 4}
!21 = distinct !{!21, !9}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass