; LLVM IR from jingweizhanghuai/Morn :: src/util (morn_INI)

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

@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.m_INIWrite = external hidden unnamed_addr constant [11 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @INIRow(ptr noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @INICol(ptr noundef, i32 noundef, i64 noundef) #4

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

; Function Attrs: nounwind uwtable
define dso_local ptr @m_INIWrite(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ...) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca [1024 x i8], align 16
  %15 = alloca [1 x %struct.__va_list_tag], align 16
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %26, label %22

22:                                               ; preds = %19
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = ptrtoint ptr %23 to i64
  %25 = icmp eq i64 %24, -1
  br label %26

26:                                               ; preds = %22, %19
  %27 = phi i1 [ true, %19 ], [ %25, %22 ]
  %28 = zext i1 %27 to i32
  store i32 %28, ptr %9, align 4, !tbaa !11
  %29 = load i32, ptr %9, align 4, !tbaa !11
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %33

31:                                               ; preds = %26
  %32 = load i32, ptr %9, align 4, !tbaa !11
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %32, i32 noundef -1, ptr noundef @.str.1, i32 noundef 152, ptr noundef @__FUNCTION__.m_INIWrite, ptr noundef @.str.2)
  br label %33

33:                                               ; preds = %31, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %34

34:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = call i32 @INIRow(ptr noundef %35, i64 noundef %36)
  store i32 %37, ptr %10, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %39 = load i32, ptr %10, align 4, !tbaa !11
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %41, label %48

41:                                               ; preds = %38
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.MSheet, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !13
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %42, %46
  br label %48

48:                                               ; preds = %41, %38
  %49 = phi i1 [ false, %38 ], [ %47, %41 ]
  %50 = zext i1 %49 to i32
  store i32 %50, ptr %11, align 4, !tbaa !11
  %51 = load i32, ptr %11, align 4, !tbaa !11
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %55

53:                                               ; preds = %48
  %54 = load i32, ptr %11, align 4, !tbaa !11
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %54, i32 noundef -1, ptr noundef @.str.1, i32 noundef 153, ptr noundef @__FUNCTION__.m_INIWrite, ptr noundef @.str.2)
  br label %55

55:                                               ; preds = %53, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !11
  %60 = load i64, ptr %7, align 8, !tbaa !9
  %61 = call i32 @INICol(ptr noundef %58, i32 noundef %59, i64 noundef %60)
  store i32 %61, ptr %12, align 4, !tbaa !11
  br label %62

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %63 = load i32, ptr %12, align 4, !tbaa !11
  %64 = icmp slt i32 %63, 0
  br i1 %64, label %65, label %76

65:                                               ; preds = %62
  %66 = load i64, ptr %7, align 8, !tbaa !9
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MSheet, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !15
  %70 = load i32, ptr %10, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %69, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !11
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %66, %74
  br label %76

76:                                               ; preds = %65, %62
  %77 = phi i1 [ false, %62 ], [ %75, %65 ]
  %78 = zext i1 %77 to i32
  store i32 %78, ptr %13, align 4, !tbaa !11
  %79 = load i32, ptr %13, align 4, !tbaa !11
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %83

81:                                               ; preds = %76
  %82 = load i32, ptr %13, align 4, !tbaa !11
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %82, i32 noundef -1, ptr noundef @.str.1, i32 noundef 154, ptr noundef @__FUNCTION__.m_INIWrite, ptr noundef @.str.2)
  br label %83

83:                                               ; preds = %81, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 1024, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  %86 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %15, i64 0, i64 0
  call void @llvm.va_start.p0(ptr %86)
  %87 = getelementptr inbounds [1024 x i8], ptr %14, i64 0, i64 0
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %15, i64 0, i64 0
  %90 = call i32 @vsprintf(ptr noundef %87, ptr noundef %88, ptr noundef %89) #7
  %91 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %15, i64 0, i64 0
  call void @llvm.va_end.p0(ptr %91)
  %92 = load i32, ptr %10, align 4, !tbaa !11
  %93 = icmp sge i32 %92, 0
  br i1 %93, label %94, label %118

94:                                               ; preds = %85
  %95 = load i32, ptr %12, align 4, !tbaa !11
  %96 = icmp sge i32 %95, 0
  br i1 %96, label %97, label %118

97:                                               ; preds = %94
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.MSheet, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !16
  %101 = load i32, ptr %10, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds ptr, ptr %100, i64 %102
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  %105 = ptrtoint ptr %104 to i64
  store i64 %105, ptr %6, align 8, !tbaa !9
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.MSheet, ptr %106, i32 0, i32 3
  %108 = load ptr, ptr %107, align 8, !tbaa !17
  %109 = load i32, ptr %10, align 4, !tbaa !11
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds ptr, ptr %108, i64 %110
  %112 = load ptr, ptr %111, align 8, !tbaa !5
  %113 = load i32, ptr %12, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds ptr, ptr %112, i64 %114
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = ptrtoint ptr %116 to i64
  store i64 %117, ptr %7, align 8, !tbaa !9
  br label %118

118:                                              ; preds = %97, %94, %85
  %119 = load i32, ptr %12, align 4, !tbaa !11
  %120 = icmp slt i32 %119, 0
  br i1 %120, label %121, label %135

121:                                              ; preds = %118
  %122 = load i32, ptr %10, align 4, !tbaa !11
  %123 = icmp slt i32 %122, 0
  br i1 %123, label %124, label %125

124:                                              ; preds = %121
  br label %133

125:                                              ; preds = %121
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MSheet, ptr %126, i32 0, i32 2
  %128 = load ptr, ptr %127, align 8, !tbaa !15
  %129 = load i32, ptr %10, align 4, !tbaa !11
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i32, ptr %128, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !11
  br label %133

133:                                              ; preds = %125, %124
  %134 = phi i32 [ 0, %124 ], [ %132, %125 ]
  store i32 %134, ptr %12, align 4, !tbaa !11
  br label %135

135:                                              ; preds = %133, %118
  %136 = load i32, ptr %10, align 4, !tbaa !11
  %137 = icmp slt i32 %136, 0
  br i1 %137, label %138, label %147

138:                                              ; preds = %135
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.MSheet, ptr %139, i32 0, i32 0
  %141 = load i32, ptr %140, align 8, !tbaa !13
  store i32 %141, ptr %10, align 4, !tbaa !11
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !11
  %144 = load i64, ptr %6, align 8, !tbaa !9
  %145 = inttoptr i64 %144 to ptr
  %146 = call ptr @mSheetInfoWrite(ptr noundef %142, i32 noundef %143, ptr noundef %145, i32 noundef -1)
  br label %147

147:                                              ; preds = %138, %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %148 = load i64, ptr %7, align 8, !tbaa !9
  %149 = inttoptr i64 %148 to ptr
  %150 = call i64 @strlen(ptr noundef %149) #8
  %151 = add i64 %150, 1
  %152 = trunc i64 %151 to i32
  store i32 %152, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %153 = getelementptr inbounds [1024 x i8], ptr %14, i64 0, i64 0
  %154 = call i64 @strlen(ptr noundef %153) #8
  %155 = add i64 %154, 1
  %156 = trunc i64 %155 to i32
  store i32 %156, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = load i32, ptr %10, align 4, !tbaa !11
  %159 = load i32, ptr %12, align 4, !tbaa !11
  %160 = load i32, ptr %16, align 4, !tbaa !11
  %161 = load i32, ptr %17, align 4, !tbaa !11
  %162 = add nsw i32 %160, %161
  %163 = call ptr @mSheetWrite(ptr noundef %157, i32 noundef %158, i32 noundef %159, ptr noundef null, i32 noundef %162)
  store ptr %163, ptr %18, align 8, !tbaa !5
  %164 = load ptr, ptr %18, align 8, !tbaa !5
  %165 = load i64, ptr %7, align 8, !tbaa !9
  %166 = inttoptr i64 %165 to ptr
  %167 = load i32, ptr %16, align 4, !tbaa !11
  %168 = sext i32 %167 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %164, ptr align 1 %166, i64 %168, i1 false)
  %169 = load ptr, ptr %18, align 8, !tbaa !5
  %170 = load i32, ptr %16, align 4, !tbaa !11
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds i8, ptr %169, i64 %171
  %173 = getelementptr inbounds [1024 x i8], ptr %14, i64 0, i64 0
  %174 = load i32, ptr %17, align 4, !tbaa !11
  %175 = sext i32 %174 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %172, ptr align 16 %173, i64 %175, i1 false)
  %176 = load ptr, ptr %18, align 8, !tbaa !5
  %177 = load i32, ptr %16, align 4, !tbaa !11
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds i8, ptr %176, i64 %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  ret ptr %179
}

declare ptr @mSheetInfoWrite(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

declare ptr @mSheetWrite(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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 = { nocallback nofree nosync nounwind willreturn }
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 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"MSheet", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!14, !6, i64 16}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !6, i64 24}


; 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.__va_list_tag = type { i32, i32, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.m_INIWrite = external hidden unnamed_addr constant [11 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

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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #2

; Function Attrs: nofree nounwind
declare noundef i32 @vsprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @INIRow(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @INICol(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local ptr @m_INIWrite(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr nocapture noundef readonly %3, ...) local_unnamed_addr #4 {
  %5 = alloca [1024 x i8], align 16
  %6 = alloca [1 x %struct.__va_list_tag], align 16
  %magicptr = ptrtoint ptr %0 to i64
  switch i64 %magicptr, label %12 [
    i64 -1, label %7
    i64 0, label %7
  ]

7:                                                ; preds = %4, %4
  %8 = icmp eq ptr %0, null
  %9 = icmp eq ptr %0, inttoptr (i64 -1 to ptr)
  %10 = or i1 %8, %9
  %11 = zext i1 %10 to i32
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %11, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 152, ptr noundef nonnull @__FUNCTION__.m_INIWrite, ptr noundef nonnull @.str.2) #7
  br label %12

12:                                               ; preds = %4, %7
  %13 = tail call i32 @INIRow(ptr noundef %0, i64 noundef %1)
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %15, label %.thread

15:                                               ; preds = %12
  %16 = load i32, ptr %0, align 8, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp sgt i64 %17, %1
  br i1 %18, label %19, label %.thread

19:                                               ; preds = %15
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 153, ptr noundef nonnull @__FUNCTION__.m_INIWrite, ptr noundef nonnull @.str.2) #7
  br label %.thread

.thread:                                          ; preds = %12, %19, %15
  %20 = tail call i32 @INICol(ptr noundef %0, i32 noundef %13, i64 noundef %2)
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %.thread57, label %22

22:                                               ; preds = %.thread
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = sext i32 %13 to i64
  %26 = getelementptr inbounds i32, ptr %24, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !12
  %28 = sext i32 %27 to i64
  %29 = icmp sgt i64 %28, %2
  br i1 %29, label %30, label %.thread57

30:                                               ; preds = %22
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 154, ptr noundef nonnull @__FUNCTION__.m_INIWrite, ptr noundef nonnull @.str.2) #7
  br label %.thread57

.thread57:                                        ; preds = %.thread, %30, %22
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  call void @llvm.va_start.p0(ptr nonnull %6)
  %31 = call i32 @vsprintf(ptr noundef nonnull %5, ptr noundef %3, ptr noundef nonnull %6) #7
  call void @llvm.va_end.p0(ptr nonnull %6)
  %32 = or i32 %20, %13
  %or.cond = icmp sgt i32 %32, -1
  br i1 %or.cond, label %33, label %48

33:                                               ; preds = %.thread57
  %34 = getelementptr inbounds i8, ptr %0, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = zext nneg i32 %13 to i64
  %37 = getelementptr inbounds ptr, ptr %35, i64 %36
  %38 = load ptr, ptr %37, align 8, !tbaa !14
  %39 = ptrtoint ptr %38 to i64
  %40 = getelementptr inbounds i8, ptr %0, i64 24
  %41 = load ptr, ptr %40, align 8, !tbaa !15
  %42 = getelementptr inbounds ptr, ptr %41, i64 %36
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = zext nneg i32 %20 to i64
  %45 = getelementptr inbounds ptr, ptr %43, i64 %44
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  %47 = ptrtoint ptr %46 to i64
  br label %48

48:                                               ; preds = %33, %.thread57
  %.051 = phi i64 [ %47, %33 ], [ %2, %.thread57 ]
  %.0 = phi i64 [ %39, %33 ], [ %1, %.thread57 ]
  %brmerge = or i1 %14, %21
  %.mux = select i1 %21, i32 %20, i32 0
  br i1 %brmerge, label %54, label %.thread58

.thread58:                                        ; preds = %48
  %49 = getelementptr inbounds i8, ptr %0, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = zext nneg i32 %13 to i64
  %52 = getelementptr inbounds i32, ptr %50, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !12
  br label %59

54:                                               ; preds = %48
  br i1 %14, label %55, label %59

55:                                               ; preds = %54
  %56 = load i32, ptr %0, align 8, !tbaa !5
  %57 = inttoptr i64 %.0 to ptr
  %58 = call ptr @mSheetInfoWrite(ptr noundef nonnull %0, i32 noundef %56, ptr noundef %57, i32 noundef -1) #7
  br label %59

59:                                               ; preds = %.thread58, %55, %54
  %.05360 = phi i32 [ %.mux, %55 ], [ %.mux, %54 ], [ %53, %.thread58 ]
  %.052 = phi i32 [ %56, %55 ], [ %13, %54 ], [ %13, %.thread58 ]
  %60 = inttoptr i64 %.051 to ptr
  %61 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %60) #8
  %62 = trunc i64 %61 to i32
  %63 = add i32 %62, 1
  %64 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #8
  %65 = trunc i64 %64 to i32
  %66 = add i32 %65, 1
  %67 = add nsw i32 %66, %63
  %68 = call ptr @mSheetWrite(ptr noundef %0, i32 noundef %.052, i32 noundef %.05360, ptr noundef null, i32 noundef %67) #7
  %69 = sext i32 %63 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %68, ptr align 1 %60, i64 %69, i1 false)
  %70 = getelementptr inbounds i8, ptr %68, i64 %69
  %71 = sext i32 %66 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %70, ptr nonnull align 16 %5, i64 %71, i1 false)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  ret ptr %70
}

declare ptr @mSheetInfoWrite(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @mSheetWrite(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { 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 #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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { 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, !7, i64 0}
!6 = !{!"MSheet", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !10, i64 8}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 24}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass