; LLVM IR from VoidRune/Audio-engine :: src (minivorbis)

; 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.ogg_page = type { ptr, i64, ptr, i64 }
%struct.ogg_sync_state = type { ptr, i32, i32, i32, i32, i32, i32 }

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ogg_page_checksum_set(ptr noundef) #2

; 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) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ogg_sync_check(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @ogg_sync_pageseek(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [4 x i8], align 1
  %13 = alloca %struct.ogg_page, align 8
  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
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ogg_sync_state, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ogg_sync_state, ptr %17, i32 0, i32 3
  %19 = load i32, ptr %18, align 8, !tbaa !12
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %16, i64 %20
  store ptr %21, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ogg_sync_state, ptr %22, i32 0, i32 2
  %24 = load i32, ptr %23, align 4, !tbaa !13
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ogg_sync_state, ptr %25, i32 0, i32 3
  %27 = load i32, ptr %26, align 8, !tbaa !12
  %28 = sub nsw i32 %24, %27
  %29 = sext i32 %28 to i64
  store i64 %29, ptr %8, align 8, !tbaa !14
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = call i32 @ogg_sync_check(ptr noundef %30)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %2
  store i64 0, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %225

34:                                               ; preds = %2
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.ogg_sync_state, ptr %35, i32 0, i32 5
  %37 = load i32, ptr %36, align 8, !tbaa !16
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %89

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %40 = load i64, ptr %8, align 8, !tbaa !14
  %41 = icmp slt i64 %40, 27
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i64 0, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %86

43:                                               ; preds = %39
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call i32 @memcmp(ptr noundef %44, ptr noundef @.str, i64 noundef 4) #6
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  store i32 2, ptr %9, align 4
  br label %86

48:                                               ; preds = %43
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 26
  %51 = load i8, ptr %50, align 1, !tbaa !17
  %52 = zext i8 %51 to i32
  %53 = add nsw i32 %52, 27
  store i32 %53, ptr %10, align 4, !tbaa !18
  %54 = load i64, ptr %8, align 8, !tbaa !14
  %55 = load i32, ptr %10, align 4, !tbaa !18
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %54, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %48
  store i64 0, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %86

59:                                               ; preds = %48
  store i32 0, ptr %11, align 4, !tbaa !18
  br label %60

60:                                               ; preds = %79, %59
  %61 = load i32, ptr %11, align 4, !tbaa !18
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 26
  %64 = load i8, ptr %63, align 1, !tbaa !17
  %65 = zext i8 %64 to i32
  %66 = icmp slt i32 %61, %65
  br i1 %66, label %67, label %82

67:                                               ; preds = %60
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load i32, ptr %11, align 4, !tbaa !18
  %70 = add nsw i32 27, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i8, ptr %68, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !17
  %74 = zext i8 %73 to i32
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.ogg_sync_state, ptr %75, i32 0, i32 6
  %77 = load i32, ptr %76, align 4, !tbaa !19
  %78 = add nsw i32 %77, %74
  store i32 %78, ptr %76, align 4, !tbaa !19
  br label %79

79:                                               ; preds = %67
  %80 = load i32, ptr %11, align 4, !tbaa !18
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %11, align 4, !tbaa !18
  br label %60, !llvm.loop !20

82:                                               ; preds = %60
  %83 = load i32, ptr %10, align 4, !tbaa !18
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ogg_sync_state, ptr %84, i32 0, i32 5
  store i32 %83, ptr %85, align 8, !tbaa !16
  store i32 0, ptr %9, align 4
  br label %86

86:                                               ; preds = %82, %58, %47, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %87 = load i32, ptr %9, align 4
  switch i32 %87, label %225 [
    i32 0, label %88
    i32 2, label %187
  ]

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88, %34
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.ogg_sync_state, ptr %90, i32 0, i32 6
  %92 = load i32, ptr %91, align 4, !tbaa !19
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.ogg_sync_state, ptr %93, i32 0, i32 5
  %95 = load i32, ptr %94, align 8, !tbaa !16
  %96 = add nsw i32 %92, %95
  %97 = sext i32 %96 to i64
  %98 = load i64, ptr %8, align 8, !tbaa !14
  %99 = icmp sgt i64 %97, %98
  br i1 %99, label %100, label %101

100:                                              ; preds = %89
  store i64 0, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %225

101:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #5
  %102 = getelementptr inbounds [4 x i8], ptr %12, i64 0, i64 0
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i64 22
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %102, ptr align 1 %104, i64 4, i1 false)
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds i8, ptr %105, i64 22
  call void @llvm.memset.p0.i64(ptr align 1 %106, i8 0, i64 4, i1 false)
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 0
  store ptr %107, ptr %108, align 8, !tbaa !22
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.ogg_sync_state, ptr %109, i32 0, i32 5
  %111 = load i32, ptr %110, align 8, !tbaa !16
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 1
  store i64 %112, ptr %113, align 8, !tbaa !24
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ogg_sync_state, ptr %115, i32 0, i32 5
  %117 = load i32, ptr %116, align 8, !tbaa !16
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %114, i64 %118
  %120 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 2
  store ptr %119, ptr %120, align 8, !tbaa !25
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ogg_sync_state, ptr %121, i32 0, i32 6
  %123 = load i32, ptr %122, align 4, !tbaa !19
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds %struct.ogg_page, ptr %13, i32 0, i32 3
  store i64 %124, ptr %125, align 8, !tbaa !26
  call void @ogg_page_checksum_set(ptr noundef %13)
  %126 = getelementptr inbounds [4 x i8], ptr %12, i64 0, i64 0
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i64 22
  %129 = call i32 @memcmp(ptr noundef %126, ptr noundef %128, i64 noundef 4) #6
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %135

131:                                              ; preds = %101
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds i8, ptr %132, i64 22
  %134 = getelementptr inbounds [4 x i8], ptr %12, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %133, ptr align 1 %134, i64 4, i1 false)
  store i32 2, ptr %9, align 4
  br label %136

135:                                              ; preds = %101
  store i32 0, ptr %9, align 4
  br label %136

136:                                              ; preds = %135, %131
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %137 = load i32, ptr %9, align 4
  switch i32 %137, label %225 [
    i32 0, label %138
    i32 2, label %187
  ]

138:                                              ; preds = %136
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %165

141:                                              ; preds = %138
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.ogg_page, ptr %143, i32 0, i32 0
  store ptr %142, ptr %144, align 8, !tbaa !22
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.ogg_sync_state, ptr %145, i32 0, i32 5
  %147 = load i32, ptr %146, align 8, !tbaa !16
  %148 = sext i32 %147 to i64
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.ogg_page, ptr %149, i32 0, i32 1
  store i64 %148, ptr %150, align 8, !tbaa !24
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.ogg_sync_state, ptr %152, i32 0, i32 5
  %154 = load i32, ptr %153, align 8, !tbaa !16
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds i8, ptr %151, i64 %155
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.ogg_page, ptr %157, i32 0, i32 2
  store ptr %156, ptr %158, align 8, !tbaa !25
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.ogg_sync_state, ptr %159, i32 0, i32 6
  %161 = load i32, ptr %160, align 4, !tbaa !19
  %162 = sext i32 %161 to i64
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.ogg_page, ptr %163, i32 0, i32 3
  store i64 %162, ptr %164, align 8, !tbaa !26
  br label %165

165:                                              ; preds = %141, %138
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.ogg_sync_state, ptr %166, i32 0, i32 4
  store i32 0, ptr %167, align 4, !tbaa !27
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.ogg_sync_state, ptr %168, i32 0, i32 5
  %170 = load i32, ptr %169, align 8, !tbaa !16
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.ogg_sync_state, ptr %171, i32 0, i32 6
  %173 = load i32, ptr %172, align 4, !tbaa !19
  %174 = add nsw i32 %170, %173
  %175 = sext i32 %174 to i64
  store i64 %175, ptr %8, align 8, !tbaa !14
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.ogg_sync_state, ptr %176, i32 0, i32 3
  %178 = load i32, ptr %177, align 8, !tbaa !12
  %179 = sext i32 %178 to i64
  %180 = add nsw i64 %179, %175
  %181 = trunc i64 %180 to i32
  store i32 %181, ptr %177, align 8, !tbaa !12
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.ogg_sync_state, ptr %182, i32 0, i32 5
  store i32 0, ptr %183, align 8, !tbaa !16
  %184 = load ptr, ptr %4, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.ogg_sync_state, ptr %184, i32 0, i32 6
  store i32 0, ptr %185, align 4, !tbaa !19
  %186 = load i64, ptr %8, align 8, !tbaa !14
  store i64 %186, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %225

187:                                              ; preds = %136, %86
  %188 = load ptr, ptr %4, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.ogg_sync_state, ptr %188, i32 0, i32 5
  store i32 0, ptr %189, align 8, !tbaa !16
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.ogg_sync_state, ptr %190, i32 0, i32 6
  store i32 0, ptr %191, align 4, !tbaa !19
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = getelementptr inbounds i8, ptr %192, i64 1
  %194 = load i64, ptr %8, align 8, !tbaa !14
  %195 = sub nsw i64 %194, 1
  %196 = call ptr @memchr(ptr noundef %193, i32 noundef 79, i64 noundef %195) #6
  store ptr %196, ptr %7, align 8, !tbaa !5
  %197 = load ptr, ptr %7, align 8, !tbaa !5
  %198 = icmp ne ptr %197, null
  br i1 %198, label %208, label %199

199:                                              ; preds = %187
  %200 = load ptr, ptr %4, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.ogg_sync_state, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !9
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.ogg_sync_state, ptr %203, i32 0, i32 2
  %205 = load i32, ptr %204, align 4, !tbaa !13
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds i8, ptr %202, i64 %206
  store ptr %207, ptr %7, align 8, !tbaa !5
  br label %208

208:                                              ; preds = %199, %187
  %209 = load ptr, ptr %7, align 8, !tbaa !5
  %210 = load ptr, ptr %4, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.ogg_sync_state, ptr %210, i32 0, i32 0
  %212 = load ptr, ptr %211, align 8, !tbaa !9
  %213 = ptrtoint ptr %209 to i64
  %214 = ptrtoint ptr %212 to i64
  %215 = sub i64 %213, %214
  %216 = trunc i64 %215 to i32
  %217 = load ptr, ptr %4, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.ogg_sync_state, ptr %217, i32 0, i32 3
  store i32 %216, ptr %218, align 8, !tbaa !12
  %219 = load ptr, ptr %7, align 8, !tbaa !5
  %220 = load ptr, ptr %6, align 8, !tbaa !5
  %221 = ptrtoint ptr %219 to i64
  %222 = ptrtoint ptr %220 to i64
  %223 = sub i64 %221, %222
  %224 = sub nsw i64 0, %223
  store i64 %224, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %225

225:                                              ; preds = %208, %165, %136, %100, %86, %33
  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
  %226 = load i64, ptr %3, align 8
  ret i64 %226
}

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #6 = { 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, !6, i64 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 16}
!13 = !{!10, !11, i64 12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!10, !11, i64 24}
!17 = !{!7, !7, i64 0}
!18 = !{!11, !11, i64 0}
!19 = !{!10, !11, i64 28}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !6, i64 0}
!23 = !{!"", !6, i64 0, !15, i64 8, !6, i64 16, !15, i64 24}
!24 = !{!23, !15, i64 8}
!25 = !{!23, !6, i64 16}
!26 = !{!23, !15, i64 24}
!27 = !{!10, !11, i64 20}


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

@.str = external hidden unnamed_addr constant [5 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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775807, -9223372036854775808) i64 @ogg_sync_pageseek(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #1 {
  %3 = alloca [4 x i8], align 4
  %4 = alloca %struct.ogg_page, align 8
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i32, ptr %6, align 8, !tbaa !11
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i8, ptr %5, i64 %8
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !12
  %12 = sub nsw i32 %11, %7
  %13 = sext i32 %12 to i64
  %14 = tail call i32 @ogg_sync_check(ptr noundef nonnull %0)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %.thread

15:                                               ; preds = %2
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load i32, ptr %16, align 8, !tbaa !13
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %37

19:                                               ; preds = %15
  %20 = icmp slt i32 %12, 27
  br i1 %20, label %.thread, label %21

21:                                               ; preds = %19
  %bcmp = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %9, ptr noundef nonnull dereferenceable(4) @.str, i64 4)
  %.not69 = icmp eq i32 %bcmp, 0
  br i1 %.not69, label %22, label %69

22:                                               ; preds = %21
  %23 = getelementptr inbounds i8, ptr %9, i64 26
  %24 = load i8, ptr %23, align 1, !tbaa !14
  %25 = zext i8 %24 to i32
  %26 = add nuw nsw i32 %25, 27
  %27 = icmp ult i32 %12, %26
  br i1 %27, label %.thread, label %.preheader

.preheader:                                       ; preds = %22
  %invariant.gep = getelementptr inbounds i8, ptr %9, i64 27
  %.not82 = icmp eq i8 %24, 0
  br i1 %.not82, label %.thread76, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %28 = getelementptr inbounds i8, ptr %0, i64 28
  %.pre = load i32, ptr %28, align 4, !tbaa !15
  br label %29

29:                                               ; preds = %.lr.ph, %29
  %30 = phi i32 [ %.pre, %.lr.ph ], [ %33, %29 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %29 ]
  %gep = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv
  %31 = load i8, ptr %gep, align 1, !tbaa !14
  %32 = zext i8 %31 to i32
  %33 = add nsw i32 %30, %32
  store i32 %33, ptr %28, align 4, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = load i8, ptr %23, align 1, !tbaa !14
  %35 = zext i8 %34 to i64
  %36 = icmp ult i64 %indvars.iv.next, %35
  br i1 %36, label %29, label %.thread76, !llvm.loop !16

.thread76:                                        ; preds = %29, %.preheader
  store i32 %26, ptr %16, align 8, !tbaa !13
  br label %37

37:                                               ; preds = %.thread76, %15
  %38 = phi i32 [ %26, %.thread76 ], [ %17, %15 ]
  %39 = getelementptr inbounds i8, ptr %0, i64 28
  %40 = load i32, ptr %39, align 4, !tbaa !15
  %41 = add nsw i32 %38, %40
  %42 = icmp sgt i32 %41, %12
  br i1 %42, label %.thread, label %43

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  %44 = getelementptr inbounds i8, ptr %9, i64 22
  %45 = load i32, ptr %44, align 1
  store i32 %45, ptr %3, align 4
  store i32 0, ptr %44, align 1
  store ptr %9, ptr %4, align 8, !tbaa !18
  %46 = load i32, ptr %16, align 8, !tbaa !13
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %47, ptr %48, align 8, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %9, i64 %47
  %50 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %49, ptr %50, align 8, !tbaa !22
  %51 = load i32, ptr %39, align 4, !tbaa !15
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i8, ptr %4, i64 24
  store i64 %52, ptr %53, align 8, !tbaa !23
  call void @ogg_page_checksum_set(ptr noundef nonnull %4)
  %bcmp70 = call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %3, ptr noundef nonnull dereferenceable(4) %44, i64 4)
  %.not71 = icmp eq i32 %bcmp70, 0
  br i1 %.not71, label %55, label %54

54:                                               ; preds = %43
  store i32 %45, ptr %44, align 1
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  br label %69

55:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %.not73 = icmp eq ptr %1, null
  %.pre85 = load i32, ptr %16, align 8, !tbaa !13
  %.pre86 = load i32, ptr %39, align 4, !tbaa !15
  br i1 %.not73, label %63, label %56

56:                                               ; preds = %55
  store ptr %9, ptr %1, align 8, !tbaa !18
  %57 = sext i32 %.pre85 to i64
  %58 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %57, ptr %58, align 8, !tbaa !21
  %59 = getelementptr inbounds i8, ptr %9, i64 %57
  %60 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %59, ptr %60, align 8, !tbaa !22
  %61 = sext i32 %.pre86 to i64
  %62 = getelementptr inbounds i8, ptr %1, i64 24
  store i64 %61, ptr %62, align 8, !tbaa !23
  br label %63

63:                                               ; preds = %56, %55
  %64 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 0, ptr %64, align 4, !tbaa !24
  %65 = add nsw i32 %.pre86, %.pre85
  %66 = sext i32 %65 to i64
  %67 = load i32, ptr %6, align 8, !tbaa !11
  %68 = add i32 %67, %65
  store i32 %68, ptr %6, align 8, !tbaa !11
  store i32 0, ptr %16, align 8, !tbaa !13
  store i32 0, ptr %39, align 4, !tbaa !15
  br label %.thread

69:                                               ; preds = %54, %21
  store i32 0, ptr %16, align 8, !tbaa !13
  %70 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 0, ptr %70, align 4, !tbaa !15
  %71 = getelementptr inbounds i8, ptr %9, i64 1
  %72 = add nsw i64 %13, -1
  %73 = call ptr @memchr(ptr noundef nonnull %71, i32 noundef 79, i64 noundef %72) #5
  %.not72 = icmp eq ptr %73, null
  %.pre84 = load ptr, ptr %0, align 8, !tbaa !5
  br i1 %.not72, label %74, label %78

74:                                               ; preds = %69
  %75 = load i32, ptr %10, align 4, !tbaa !12
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %.pre84, i64 %76
  br label %78

78:                                               ; preds = %74, %69
  %.065 = phi ptr [ %73, %69 ], [ %77, %74 ]
  %79 = ptrtoint ptr %.065 to i64
  %80 = ptrtoint ptr %.pre84 to i64
  %81 = sub i64 %79, %80
  %82 = trunc i64 %81 to i32
  store i32 %82, ptr %6, align 8, !tbaa !11
  %83 = ptrtoint ptr %9 to i64
  %.neg = sub i64 %83, %79
  br label %.thread

.thread:                                          ; preds = %22, %19, %37, %2, %78, %63
  %.2 = phi i64 [ %.neg, %78 ], [ %66, %63 ], [ 0, %2 ], [ 0, %37 ], [ 0, %19 ], [ 0, %22 ]
  ret i64 %.2
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @memchr(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
attributes #5 = { 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 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 12}
!13 = !{!6, !10, i64 24}
!14 = !{!8, !8, i64 0}
!15 = !{!6, !10, i64 28}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !7, i64 0}
!19 = !{!"", !7, i64 0, !20, i64 8, !7, i64 16, !20, i64 24}
!20 = !{!"long", !8, i64 0}
!21 = !{!19, !20, i64 8}
!22 = !{!19, !7, i64 16}
!23 = !{!19, !20, i64 24}
!24 = !{!6, !10, i64 20}


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