; LLVM IR from ryanlayer/giggle :: test/unit (test_offset_index)

; 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.__kstring_t = type { i64, i64, ptr }
%struct.offset_index = type { ptr, ptr, i32, ptr, i32 }
%struct.input_file = type { ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, ptr, ptr, ptr }
%struct.file_id_offset_pairs = type { i64, i64, ptr }
%struct.file_id_offset_pair = type { i32, i64 }
%struct.offset_data_append_data_test_struct_larger = type { i32, float, [20 x i8] }

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@offset_data_size = external dso_local global i32, align 4
@offset_data_append_data = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.test_offset_index_add_data_larger.A_offsets = external hidden unnamed_addr constant [1000 x i32], align 16
@__const.test_offset_index_add_data_larger.A_data = external hidden unnamed_addr constant [1000 x i32], align 16
@__const.test_offset_index_add_data_larger.A_flt = external hidden unnamed_addr constant [1000 x float], align 16

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare ptr @input_file_init(ptr noundef) #2

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

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

declare ptr @offset_index_init(i32 noundef, ptr noundef) #2

declare void @UnityAssertEqualNumber(i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) #2

declare i64 @offset_index_add(ptr noundef, i64 noundef, ptr noundef, i32 noundef) #2

declare void @offset_index_destroy(ptr noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

declare void @input_file_destroy(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @offset_data_append_data_test_func_larger(ptr noundef, ptr noundef) #6

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

; Function Attrs: nounwind uwtable
define dso_local void @test_offset_index_add_data_larger() #6 {
  %1 = alloca [1000 x i32], align 16
  %2 = alloca [1000 x i32], align 16
  %3 = alloca [1000 x float], align 16
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca %struct.__kstring_t, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca [20 x i8], align 16
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4000, ptr %1) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const.test_offset_index_add_data_larger.A_offsets, i64 4000, i1 false)
  call void @llvm.lifetime.start.p0(i64 4000, ptr %2) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.test_offset_index_add_data_larger.A_data, i64 4000, i1 false)
  call void @llvm.lifetime.start.p0(i64 4000, ptr %3) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.test_offset_index_add_data_larger.A_flt, i64 4000, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  store ptr @.str, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call ptr @input_file_init(ptr noundef %18)
  store ptr %19, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 10, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = mul i64 %21, 1
  %23 = call noalias ptr @malloc(i64 noundef %22) #9
  store ptr %23, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #8
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  store i32 28, ptr @offset_data_size, align 4, !tbaa !9
  store ptr @offset_data_append_data_test_func_larger, ptr @offset_data_append_data, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %24 = call ptr @offset_index_init(i32 noundef 100, ptr noundef @.str.1)
  store ptr %24, ptr %12, align 8, !tbaa !5
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.offset_index, ptr %25, i32 0, i32 4
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = zext i32 %27 to i64
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %28, ptr noundef null, i64 noundef 818, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  br label %29

29:                                               ; preds = %36, %0
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.input_file, ptr %30, i32 0, i32 8
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call i32 %32(ptr noundef %33, ptr noundef %7, ptr noundef %6, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11)
  %35 = icmp sge i32 %34, 0
  br i1 %35, label %36, label %41

36:                                               ; preds = %29
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = load i64, ptr %10, align 8, !tbaa !16
  %39 = call i64 @offset_index_add(ptr noundef %37, i64 noundef %38, ptr noundef %11, i32 noundef 1)
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr %13, align 4, !tbaa !9
  br label %29, !llvm.loop !17

41:                                               ; preds = %29
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.offset_index, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  %45 = getelementptr inbounds %struct.file_id_offset_pairs, ptr %44, i32 0, i32 0
  %46 = load i64, ptr %45, align 8, !tbaa !20
  call void @UnityAssertEqualNumber(i64 noundef 1000, i64 noundef %46, ptr noundef null, i64 noundef 835, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 20, ptr %15) #8
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %132, %41
  %48 = load i32, ptr %14, align 4, !tbaa !9
  %49 = icmp ult i32 %48, 1000
  br i1 %49, label %50, label %135

50:                                               ; preds = %47
  %51 = load i32, ptr %14, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds [1000 x i32], ptr %1, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.offset_index, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !19
  %59 = getelementptr inbounds %struct.file_id_offset_pairs, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.offset_index, ptr %61, i32 0, i32 4
  %63 = load i32, ptr %62, align 8, !tbaa !11
  %64 = icmp eq i32 %63, 0
  %65 = zext i1 %64 to i64
  %66 = select i1 %64, i64 0, i64 12
  %67 = getelementptr inbounds i8, ptr %60, i64 %66
  %68 = load i32, ptr %14, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.offset_index, ptr %70, i32 0, i32 2
  %72 = load i32, ptr %71, align 8, !tbaa !23
  %73 = zext i32 %72 to i64
  %74 = mul i64 %69, %73
  %75 = getelementptr inbounds i8, ptr %67, i64 %74
  %76 = getelementptr inbounds %struct.file_id_offset_pair, ptr %75, i32 0, i32 1
  %77 = load i64, ptr %76, align 8, !tbaa !24
  call void @UnityAssertEqualNumber(i64 noundef %55, i64 noundef %77, ptr noundef null, i64 noundef 841, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.offset_index, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !19
  %81 = getelementptr inbounds %struct.file_id_offset_pairs, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !22
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.offset_index, ptr %83, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !11
  %86 = icmp eq i32 %85, 0
  %87 = zext i1 %86 to i64
  %88 = select i1 %86, i64 0, i64 12
  %89 = getelementptr inbounds i8, ptr %82, i64 %88
  %90 = load i32, ptr %14, align 4, !tbaa !9
  %91 = zext i32 %90 to i64
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.offset_index, ptr %92, i32 0, i32 2
  %94 = load i32, ptr %93, align 8, !tbaa !23
  %95 = zext i32 %94 to i64
  %96 = mul i64 %91, %95
  %97 = add i64 %96, 16
  %98 = getelementptr inbounds i8, ptr %89, i64 %97
  store ptr %98, ptr %16, align 8, !tbaa !5
  %99 = load i32, ptr %14, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds [1000 x i32], ptr %2, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = load ptr, ptr %16, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.offset_data_append_data_test_struct_larger, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 4, !tbaa !26
  %107 = zext i32 %106 to i64
  call void @UnityAssertEqualNumber(i64 noundef %103, i64 noundef %107, ptr noundef null, i64 noundef 845, i32 noundef 148)
  %108 = load i32, ptr %14, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds [1000 x float], ptr %3, i64 0, i64 %109
  %111 = load float, ptr %110, align 4, !tbaa !29
  %112 = fptosi float %111 to i64
  %113 = load ptr, ptr %16, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.offset_data_append_data_test_struct_larger, ptr %113, i32 0, i32 1
  %115 = load float, ptr %114, align 4, !tbaa !30
  %116 = fptosi float %115 to i64
  call void @UnityAssertEqualNumber(i64 noundef %112, i64 noundef %116, ptr noundef null, i64 noundef 846, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %117 = getelementptr inbounds [20 x i8], ptr %15, i64 0, i64 0
  %118 = load ptr, ptr %16, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.offset_data_append_data_test_struct_larger, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 4, !tbaa !26
  %121 = load ptr, ptr %16, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.offset_data_append_data_test_struct_larger, ptr %121, i32 0, i32 1
  %123 = load float, ptr %122, align 4, !tbaa !30
  %124 = fpext float %123 to double
  %125 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %117, ptr noundef @.str.3, i32 noundef %120, double noundef %124) #8
  store i32 %125, ptr %17, align 4, !tbaa !9
  %126 = getelementptr inbounds [20 x i8], ptr %15, i64 0, i64 0
  %127 = load ptr, ptr %16, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.offset_data_append_data_test_struct_larger, ptr %127, i32 0, i32 2
  %129 = getelementptr inbounds [20 x i8], ptr %128, i64 0, i64 0
  %130 = call i32 @strcmp(ptr noundef %126, ptr noundef %129) #10
  %131 = sext i32 %130 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %131, ptr noundef null, i64 noundef 848, i32 noundef 148)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %132

132:                                              ; preds = %50
  %133 = load i32, ptr %14, align 4, !tbaa !9
  %134 = add i32 %133, 1
  store i32 %134, ptr %14, align 4, !tbaa !9
  br label %47, !llvm.loop !31

135:                                              ; preds = %47
  %136 = getelementptr inbounds %struct.__kstring_t, ptr %11, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !32
  %138 = icmp ne ptr %137, null
  br i1 %138, label %139, label %142

139:                                              ; preds = %135
  %140 = getelementptr inbounds %struct.__kstring_t, ptr %11, i32 0, i32 2
  %141 = load ptr, ptr %140, align 8, !tbaa !32
  call void @free(ptr noundef %141) #8
  br label %142

142:                                              ; preds = %139, %135
  call void @input_file_destroy(ptr noundef %5)
  call void @offset_index_destroy(ptr noundef %12)
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %143) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4000, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4000, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 4000, ptr %1) #8
  ret void
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"offset_index", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32}
!13 = !{!14, !6, i64 64}
!14 = !{!"input_file", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !10, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!15 = !{!"long", !7, i64 0}
!16 = !{!15, !15, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !6, i64 0}
!20 = !{!21, !15, i64 0}
!21 = !{!"file_id_offset_pairs", !15, i64 0, !15, i64 8, !6, i64 16}
!22 = !{!21, !6, i64 16}
!23 = !{!12, !10, i64 16}
!24 = !{!25, !15, i64 8}
!25 = !{!"file_id_offset_pair", !10, i64 0, !15, i64 8}
!26 = !{!27, !10, i64 0}
!27 = !{!"offset_data_append_data_test_struct_larger", !10, i64 0, !28, i64 4, !7, i64 8}
!28 = !{!"float", !7, i64 0}
!29 = !{!28, !28, i64 0}
!30 = !{!27, !28, i64 4}
!31 = distinct !{!31, !18}
!32 = !{!33, !6, i64 16}
!33 = !{!"__kstring_t", !15, i64 0, !15, i64 8, !6, i64 16}


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

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@offset_data_size = external dso_local local_unnamed_addr global i32, align 4
@offset_data_append_data = external dso_local local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.test_offset_index_add_data_larger.A_offsets = external hidden unnamed_addr constant [1000 x i32], align 16
@__const.test_offset_index_add_data_larger.A_data = external hidden unnamed_addr constant [1000 x i32], align 16
@__const.test_offset_index_add_data_larger.A_flt = external hidden unnamed_addr constant [1000 x float], align 16

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

declare ptr @input_file_init(ptr noundef) local_unnamed_addr #1

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

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

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

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

declare i64 @offset_index_add(ptr noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @offset_index_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

declare void @input_file_destroy(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @offset_data_append_data_test_func_larger(ptr noundef, ptr noundef) #5

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

; Function Attrs: nounwind uwtable
define dso_local void @test_offset_index_add_data_larger() local_unnamed_addr #5 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca %struct.__kstring_t, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [20 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %10 = tail call ptr @input_file_init(ptr noundef nonnull @.str) #8
  store ptr %10, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 10, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %11 = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #9
  store ptr %11, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  store i32 28, ptr @offset_data_size, align 4, !tbaa !9
  store ptr @offset_data_append_data_test_func_larger, ptr @offset_data_append_data, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %12 = tail call ptr @offset_index_init(i32 noundef 100, ptr noundef nonnull @.str.1) #8
  store ptr %12, ptr %8, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 32
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = zext i32 %14 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %15, ptr noundef null, i64 noundef 818, i32 noundef 148) #8
  %16 = getelementptr inbounds i8, ptr %10, i64 64
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = call i32 %17(ptr noundef %10, ptr noundef nonnull %3, ptr noundef nonnull %2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7) #8
  %19 = icmp sgt i32 %18, -1
  br i1 %19, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %20 = load i64, ptr %6, align 8, !tbaa !16
  %21 = call i64 @offset_index_add(ptr noundef %12, i64 noundef %20, ptr noundef nonnull %7, i32 noundef 1) #8
  %22 = load ptr, ptr %16, align 8, !tbaa !13
  %23 = call i32 %22(ptr noundef nonnull %10, ptr noundef nonnull %3, ptr noundef nonnull %2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7) #8
  %24 = icmp sgt i32 %23, -1
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %0
  %25 = load ptr, ptr %12, align 8, !tbaa !19
  %26 = load i64, ptr %25, align 8, !tbaa !20
  call void @UnityAssertEqualNumber(i64 noundef 1000, i64 noundef %26, ptr noundef null, i64 noundef 835, i32 noundef 148) #8
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %9) #8
  %27 = getelementptr inbounds i8, ptr %12, i64 16
  br label %28

28:                                               ; preds = %._crit_edge, %28
  %indvars.iv = phi i64 [ 0, %._crit_edge ], [ %indvars.iv.next, %28 ]
  %29 = getelementptr inbounds [1000 x i32], ptr @__const.test_offset_index_add_data_larger.A_offsets, i64 0, i64 %indvars.iv
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = load ptr, ptr %12, align 8, !tbaa !19
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !22
  %35 = load i32, ptr %13, align 8, !tbaa !11
  %36 = icmp eq i32 %35, 0
  %37 = select i1 %36, i64 0, i64 12
  %38 = getelementptr inbounds i8, ptr %34, i64 %37
  %39 = load i32, ptr %27, align 8, !tbaa !23
  %40 = zext i32 %39 to i64
  %41 = mul nuw nsw i64 %indvars.iv, %40
  %42 = getelementptr inbounds i8, ptr %38, i64 %41
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = load i64, ptr %43, align 8, !tbaa !24
  call void @UnityAssertEqualNumber(i64 noundef %31, i64 noundef %44, ptr noundef null, i64 noundef 841, i32 noundef 148) #8
  %45 = load ptr, ptr %12, align 8, !tbaa !19
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = load i32, ptr %13, align 8, !tbaa !11
  %49 = icmp eq i32 %48, 0
  %50 = select i1 %49, i64 0, i64 12
  %51 = getelementptr inbounds i8, ptr %47, i64 %50
  %52 = load i32, ptr %27, align 8, !tbaa !23
  %53 = zext i32 %52 to i64
  %54 = mul nuw nsw i64 %indvars.iv, %53
  %55 = getelementptr inbounds i8, ptr %51, i64 %54
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %57 = getelementptr inbounds [1000 x i32], ptr @__const.test_offset_index_add_data_larger.A_data, i64 0, i64 %indvars.iv
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = load i32, ptr %56, align 4, !tbaa !26
  %61 = zext i32 %60 to i64
  call void @UnityAssertEqualNumber(i64 noundef %59, i64 noundef %61, ptr noundef null, i64 noundef 845, i32 noundef 148) #8
  %62 = getelementptr inbounds [1000 x float], ptr @__const.test_offset_index_add_data_larger.A_flt, i64 0, i64 %indvars.iv
  %63 = load float, ptr %62, align 4, !tbaa !29
  %64 = fptosi float %63 to i64
  %65 = getelementptr inbounds i8, ptr %55, i64 20
  %66 = load float, ptr %65, align 4, !tbaa !30
  %67 = fptosi float %66 to i64
  call void @UnityAssertEqualNumber(i64 noundef %64, i64 noundef %67, ptr noundef null, i64 noundef 846, i32 noundef 148) #8
  %68 = load i32, ptr %56, align 4, !tbaa !26
  %69 = load float, ptr %65, align 4, !tbaa !30
  %70 = fpext float %69 to double
  %71 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %68, double noundef %70) #8
  %72 = getelementptr inbounds i8, ptr %55, i64 24
  %73 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) %72) #10
  %74 = sext i32 %73 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %74, ptr noundef null, i64 noundef 848, i32 noundef 148) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1000
  br i1 %exitcond.not, label %75, label %28, !llvm.loop !31

75:                                               ; preds = %28
  %76 = getelementptr inbounds i8, ptr %7, i64 16
  %77 = load ptr, ptr %76, align 8, !tbaa !32
  %.not = icmp eq ptr %77, null
  br i1 %.not, label %79, label %78

78:                                               ; preds = %75
  call void @free(ptr noundef nonnull %77) #8
  br label %79

79:                                               ; preds = %78, %75
  call void @input_file_destroy(ptr noundef nonnull %1) #8
  call void @offset_index_destroy(ptr noundef nonnull %8) #8
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %80) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7

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 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nounwind willreturn allockind("free") 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"offset_index", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32}
!13 = !{!14, !6, i64 64}
!14 = !{!"input_file", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !10, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!15 = !{!"long", !7, i64 0}
!16 = !{!15, !15, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !6, i64 0}
!20 = !{!21, !15, i64 0}
!21 = !{!"file_id_offset_pairs", !15, i64 0, !15, i64 8, !6, i64 16}
!22 = !{!21, !6, i64 16}
!23 = !{!12, !10, i64 16}
!24 = !{!25, !15, i64 8}
!25 = !{!"file_id_offset_pair", !10, i64 0, !15, i64 8}
!26 = !{!27, !10, i64 0}
!27 = !{!"offset_data_append_data_test_struct_larger", !10, i64 0, !28, i64 4, !7, i64 8}
!28 = !{!"float", !7, i64 0}
!29 = !{!28, !28, i64 0}
!30 = !{!27, !28, i64 4}
!31 = distinct !{!31, !18}
!32 = !{!33, !6, i64 16}
!33 = !{!"__kstring_t", !15, i64 0, !15, i64 8, !6, i64 16}


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