; LLVM IR from JayXon/Leanify :: lib/mozjpeg (jmemmgr)

; 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.jpeg_common_struct = type { ptr, ptr, ptr, ptr, i32, i32 }
%struct.jpeg_error_mgr = type { ptr, ptr, ptr, ptr, ptr, i32, %union.anon, i32, i64, ptr, i32, ptr, i32, i32 }
%union.anon = type { [8 x i32], [48 x i8] }
%struct.my_memory_mgr = type { %struct.jpeg_memory_mgr, [2 x ptr], [2 x ptr], ptr, ptr, i64, i32 }
%struct.jpeg_memory_mgr = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64 }

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

; Function Attrs: nounwind uwtable
define dso_local void @jinit_memory_mgr(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.jpeg_common_struct, ptr %9, i32 0, i32 1
  store ptr null, ptr %10, align 8, !tbaa !9
  store i64 1000000000, ptr %6, align 8, !tbaa !12
  %11 = load i64, ptr %6, align 8, !tbaa !12
  %12 = icmp ne i64 %11, 1000000000
  br i1 %12, label %13, label %24

13:                                               ; preds = %1
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.jpeg_common_struct, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %16, i32 0, i32 5
  store i32 3, ptr %17, align 8, !tbaa !15
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.jpeg_common_struct, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !17
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  call void %22(ptr noundef %23)
  br label %24

24:                                               ; preds = %13, %1
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = call i64 @jpeg_mem_init(ptr noundef %25)
  store i64 %26, ptr %4, align 8, !tbaa !12
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = call ptr @jpeg_get_small(ptr noundef %27, i64 noundef 168)
  store ptr %28, ptr %3, align 8, !tbaa !5
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %48

31:                                               ; preds = %24
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  call void @jpeg_mem_term(ptr noundef %32)
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.jpeg_common_struct, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %35, i32 0, i32 5
  store i32 54, ptr %36, align 8, !tbaa !15
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.jpeg_common_struct, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !14
  %40 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %39, i32 0, i32 6
  %41 = getelementptr inbounds [8 x i32], ptr %40, i64 0, i64 0
  store i32 0, ptr %41, align 4, !tbaa !18
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.jpeg_common_struct, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  %45 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  call void %46(ptr noundef %47)
  br label %48

48:                                               ; preds = %31, %24
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.my_memory_mgr, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %50, i32 0, i32 0
  store ptr @alloc_small, ptr %51, align 8, !tbaa !19
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.my_memory_mgr, ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %53, i32 0, i32 1
  store ptr @alloc_large, ptr %54, align 8, !tbaa !22
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.my_memory_mgr, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %56, i32 0, i32 2
  store ptr @alloc_sarray, ptr %57, align 8, !tbaa !23
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.my_memory_mgr, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %59, i32 0, i32 3
  store ptr @alloc_barray, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.my_memory_mgr, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %62, i32 0, i32 4
  store ptr @request_virt_sarray, ptr %63, align 8, !tbaa !25
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.my_memory_mgr, ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %65, i32 0, i32 5
  store ptr @request_virt_barray, ptr %66, align 8, !tbaa !26
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.my_memory_mgr, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %68, i32 0, i32 6
  store ptr @realize_virt_arrays, ptr %69, align 8, !tbaa !27
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.my_memory_mgr, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %71, i32 0, i32 7
  store ptr @access_virt_sarray, ptr %72, align 8, !tbaa !28
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.my_memory_mgr, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %74, i32 0, i32 8
  store ptr @access_virt_barray, ptr %75, align 8, !tbaa !29
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.my_memory_mgr, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %77, i32 0, i32 9
  store ptr @free_pool, ptr %78, align 8, !tbaa !30
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.my_memory_mgr, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %80, i32 0, i32 10
  store ptr @self_destruct, ptr %81, align 8, !tbaa !31
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.my_memory_mgr, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %83, i32 0, i32 12
  store i64 1000000000, ptr %84, align 8, !tbaa !32
  %85 = load i64, ptr %4, align 8, !tbaa !12
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.my_memory_mgr, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %87, i32 0, i32 11
  store i64 %85, ptr %88, align 8, !tbaa !33
  store i32 1, ptr %5, align 4, !tbaa !34
  br label %89

89:                                               ; preds = %103, %48
  %90 = load i32, ptr %5, align 4, !tbaa !34
  %91 = icmp sge i32 %90, 0
  br i1 %91, label %92, label %106

92:                                               ; preds = %89
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.my_memory_mgr, ptr %93, i32 0, i32 1
  %95 = load i32, ptr %5, align 4, !tbaa !34
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2 x ptr], ptr %94, i64 0, i64 %96
  store ptr null, ptr %97, align 8, !tbaa !5
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.my_memory_mgr, ptr %98, i32 0, i32 2
  %100 = load i32, ptr %5, align 4, !tbaa !34
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [2 x ptr], ptr %99, i64 0, i64 %101
  store ptr null, ptr %102, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %92
  %104 = load i32, ptr %5, align 4, !tbaa !34
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %5, align 4, !tbaa !34
  br label %89, !llvm.loop !35

106:                                              ; preds = %89
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.my_memory_mgr, ptr %107, i32 0, i32 3
  store ptr null, ptr %108, align 8, !tbaa !37
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.my_memory_mgr, ptr %109, i32 0, i32 4
  store ptr null, ptr %110, align 8, !tbaa !38
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.my_memory_mgr, ptr %111, i32 0, i32 5
  store i64 168, ptr %112, align 8, !tbaa !39
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.my_memory_mgr, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.jpeg_common_struct, ptr %115, i32 0, i32 1
  store ptr %114, ptr %116, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %117 = call ptr @getenv(ptr noundef @.str) #4
  store ptr %117, ptr %7, align 8, !tbaa !5
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %141

119:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 120, ptr %8, align 1, !tbaa !18
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %120, ptr noundef @.str.1, ptr noundef %4, ptr noundef %8) #4
  %122 = icmp sgt i32 %121, 0
  br i1 %122, label %123, label %140

123:                                              ; preds = %119
  %124 = load i8, ptr %8, align 1, !tbaa !18
  %125 = sext i8 %124 to i32
  %126 = icmp eq i32 %125, 109
  br i1 %126, label %131, label %127

127:                                              ; preds = %123
  %128 = load i8, ptr %8, align 1, !tbaa !18
  %129 = sext i8 %128 to i32
  %130 = icmp eq i32 %129, 77
  br i1 %130, label %131, label %134

131:                                              ; preds = %127, %123
  %132 = load i64, ptr %4, align 8, !tbaa !12
  %133 = mul nsw i64 %132, 1000
  store i64 %133, ptr %4, align 8, !tbaa !12
  br label %134

134:                                              ; preds = %131, %127
  %135 = load i64, ptr %4, align 8, !tbaa !12
  %136 = mul nsw i64 %135, 1000
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.my_memory_mgr, ptr %137, i32 0, i32 0
  %139 = getelementptr inbounds %struct.jpeg_memory_mgr, ptr %138, i32 0, i32 11
  store i64 %136, ptr %139, align 8, !tbaa !33
  br label %140

140:                                              ; preds = %134, %119
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  br label %141

141:                                              ; preds = %140, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

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

declare i64 @jpeg_mem_init(ptr noundef) #2

declare ptr @jpeg_get_small(ptr noundef, i64 noundef) #2

declare void @jpeg_mem_term(ptr noundef) #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @realize_virt_arrays(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @self_destruct(ptr noundef) #0

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

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

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

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 = { "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 }

!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 8}
!10 = !{!"jpeg_common_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 36}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !6, i64 0}
!15 = !{!16, !11, i64 40}
!16 = !{!"jpeg_error_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !7, i64 44, !11, i64 124, !13, i64 128, !6, i64 136, !11, i64 144, !6, i64 152, !11, i64 160, !11, i64 164}
!17 = !{!16, !6, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"", !21, i64 0, !7, i64 104, !7, i64 120, !6, i64 136, !6, i64 144, !13, i64 152, !11, i64 160}
!21 = !{!"jpeg_memory_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !13, i64 88, !13, i64 96}
!22 = !{!20, !6, i64 8}
!23 = !{!20, !6, i64 16}
!24 = !{!20, !6, i64 24}
!25 = !{!20, !6, i64 32}
!26 = !{!20, !6, i64 40}
!27 = !{!20, !6, i64 48}
!28 = !{!20, !6, i64 56}
!29 = !{!20, !6, i64 64}
!30 = !{!20, !6, i64 72}
!31 = !{!20, !6, i64 80}
!32 = !{!20, !13, i64 96}
!33 = !{!20, !13, i64 88}
!34 = !{!11, !11, i64 0}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!20, !6, i64 136}
!38 = !{!20, !6, i64 144}
!39 = !{!20, !13, i64 152}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

; Function Attrs: nounwind uwtable
define dso_local void @jinit_memory_mgr(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca i64, align 8
  %3 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr null, ptr %4, align 8, !tbaa !5
  %5 = tail call i64 @jpeg_mem_init(ptr noundef %0) #6
  store i64 %5, ptr %2, align 8, !tbaa !11
  %6 = tail call ptr @jpeg_get_small(ptr noundef %0, i64 noundef 168) #6
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %14

8:                                                ; preds = %1
  tail call void @jpeg_mem_term(ptr noundef nonnull %0) #6
  %9 = load ptr, ptr %0, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %9, i64 40
  store i32 54, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %9, i64 44
  store i32 0, ptr %11, align 4, !tbaa !16
  %12 = load ptr, ptr %0, align 8, !tbaa !13
  %13 = load ptr, ptr %12, align 8, !tbaa !17
  tail call void %13(ptr noundef nonnull %0) #6
  br label %14

14:                                               ; preds = %8, %1
  store ptr @alloc_small, ptr %6, align 8, !tbaa !18
  %15 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr @alloc_large, ptr %15, align 8, !tbaa !21
  %16 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr @alloc_sarray, ptr %16, align 8, !tbaa !22
  %17 = getelementptr inbounds i8, ptr %6, i64 24
  store ptr @alloc_barray, ptr %17, align 8, !tbaa !23
  %18 = getelementptr inbounds i8, ptr %6, i64 32
  store ptr @request_virt_sarray, ptr %18, align 8, !tbaa !24
  %19 = getelementptr inbounds i8, ptr %6, i64 40
  store ptr @request_virt_barray, ptr %19, align 8, !tbaa !25
  %20 = getelementptr inbounds i8, ptr %6, i64 48
  store ptr @realize_virt_arrays, ptr %20, align 8, !tbaa !26
  %21 = getelementptr inbounds i8, ptr %6, i64 56
  store ptr @access_virt_sarray, ptr %21, align 8, !tbaa !27
  %22 = getelementptr inbounds i8, ptr %6, i64 64
  store ptr @access_virt_barray, ptr %22, align 8, !tbaa !28
  %23 = getelementptr inbounds i8, ptr %6, i64 72
  store ptr @free_pool, ptr %23, align 8, !tbaa !29
  %24 = getelementptr inbounds i8, ptr %6, i64 80
  store ptr @self_destruct, ptr %24, align 8, !tbaa !30
  %25 = getelementptr inbounds i8, ptr %6, i64 96
  store i64 1000000000, ptr %25, align 8, !tbaa !31
  %26 = getelementptr inbounds i8, ptr %6, i64 88
  store i64 %5, ptr %26, align 8, !tbaa !32
  %27 = getelementptr inbounds i8, ptr %6, i64 104
  %28 = getelementptr inbounds i8, ptr %6, i64 152
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %27, i8 0, i64 48, i1 false)
  store i64 168, ptr %28, align 8, !tbaa !33
  store ptr %6, ptr %4, align 8, !tbaa !5
  %29 = tail call ptr @getenv(ptr noundef nonnull @.str) #6
  %.not = icmp eq ptr %29, null
  br i1 %.not, label %39, label %30

30:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  store i8 120, ptr %3, align 1, !tbaa !16
  %31 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %29, ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3) #6
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %33, label %38

33:                                               ; preds = %30
  %34 = load i8, ptr %3, align 1
  %35 = and i8 %34, -33
  %or.cond = icmp eq i8 %35, 77
  %.pre = load i64, ptr %2, align 8, !tbaa !11
  %36 = mul nsw i64 %.pre, 1000
  %spec.select = select i1 %or.cond, i64 %36, i64 %.pre
  %37 = mul nsw i64 %spec.select, 1000
  store i64 %37, ptr %26, align 8, !tbaa !32
  br label %38

38:                                               ; preds = %33, %30
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  br label %39

39:                                               ; preds = %38, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret void
}

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

declare i64 @jpeg_mem_init(ptr noundef) local_unnamed_addr #2

declare ptr @jpeg_get_small(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @jpeg_mem_term(ptr noundef) local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @realize_virt_arrays(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @self_destruct(ptr noundef) #0

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

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

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

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 nocallback nofree nosync 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 = { nofree nounwind memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"jpeg_common_struct", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !10, i64 40}
!15 = !{!"jpeg_error_mgr", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !8, i64 44, !10, i64 124, !12, i64 128, !7, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 164}
!16 = !{!8, !8, i64 0}
!17 = !{!15, !7, i64 0}
!18 = !{!19, !7, i64 0}
!19 = !{!"", !20, i64 0, !8, i64 104, !8, i64 120, !7, i64 136, !7, i64 144, !12, i64 152, !10, i64 160}
!20 = !{!"jpeg_memory_mgr", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !12, i64 88, !12, i64 96}
!21 = !{!19, !7, i64 8}
!22 = !{!19, !7, i64 16}
!23 = !{!19, !7, i64 24}
!24 = !{!19, !7, i64 32}
!25 = !{!19, !7, i64 40}
!26 = !{!19, !7, i64 48}
!27 = !{!19, !7, i64 56}
!28 = !{!19, !7, i64 64}
!29 = !{!19, !7, i64 72}
!30 = !{!19, !7, i64 80}
!31 = !{!19, !12, i64 96}
!32 = !{!19, !12, i64 88}
!33 = !{!19, !12, i64 152}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass