; LLVM IR from turi-code/SFrame :: oss_src/image/jpeg_io.ll (ZN8graphlab11decode_jpegEPKcmPPcRm)

; 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_decompress_struct = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], i32, ptr, i32, i32, i32, [16 x i8], [16 x i8], [16 x i8], i32, i32, i8, i8, i8, i16, i16, i32, i8, i32, ptr, i32, i32, i32, i32, i32, ptr, i32, [4 x ptr], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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] }
%class.anon = type { i8 }

declare i32 @__gxx_personality_v0(...)

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

declare ptr @jpeg_std_error(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN8graphlabL15jpeg_error_exitEP18jpeg_common_struct(ptr noundef) #3

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

declare void @jpeg_mem_src(ptr noundef, ptr noundef, i64 noundef) #2

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

declare ptr @__cxa_begin_catch(ptr)

declare void @jpeg_destroy_decompress(ptr noundef) #2

declare void @__cxa_rethrow()

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #4

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8graphlab11decode_jpegEPKcmPPcRm(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #3 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.jpeg_decompress_struct, align 8
  %10 = alloca %struct.jpeg_error_mgr, align 8
  %11 = alloca %class.anon, align 1
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca [1 x ptr], align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 656, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 168, ptr %10) #8
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 656, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 168, i1 false)
  %20 = call ptr @jpeg_std_error(ptr noundef %10)
  %21 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %9, i32 0, i32 0
  store ptr %20, ptr %21, align 8, !tbaa !11
  %22 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %10, i32 0, i32 0
  store ptr @_ZN8graphlabL15jpeg_error_exitEP18jpeg_common_struct, ptr %22, align 8, !tbaa !19
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %23, align 8, !tbaa !5
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 0, ptr %24, align 8, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %31

27:                                               ; preds = %4
  br label %28

28:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #8
  call void @"_ZZN8graphlab11decode_jpegEPKcmPPcRmENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) %11)
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30, %4
  invoke void @jpeg_CreateDecompress(ptr noundef %9, i32 noundef 80, i64 noundef 656)
          to label %32 unwind label %82

32:                                               ; preds = %31
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i64, ptr %6, align 8, !tbaa !9
  invoke void @jpeg_mem_src(ptr noundef %9, ptr noundef %33, i64 noundef %34)
          to label %35 unwind label %82

35:                                               ; preds = %32
  %36 = invoke i32 @jpeg_read_header(ptr noundef %9, i32 noundef 1)
          to label %37 unwind label %82

37:                                               ; preds = %35
  %38 = invoke i32 @jpeg_start_decompress(ptr noundef %9)
          to label %39 unwind label %82

39:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %40 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %9, i32 0, i32 7
  %41 = load i32, ptr %40, align 8, !tbaa !21
  %42 = zext i32 %41 to i64
  store i64 %42, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %43 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %9, i32 0, i32 8
  %44 = load i32, ptr %43, align 4, !tbaa !22
  %45 = zext i32 %44 to i64
  store i64 %45, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %46 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %9, i32 0, i32 9
  %47 = load i32, ptr %46, align 8, !tbaa !23
  %48 = sext i32 %47 to i64
  store i64 %48, ptr %16, align 8, !tbaa !9
  %49 = load i64, ptr %14, align 8, !tbaa !9
  %50 = load i64, ptr %15, align 8, !tbaa !9
  %51 = mul i64 %49, %50
  %52 = load i64, ptr %16, align 8, !tbaa !9
  %53 = mul i64 %51, %52
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 %53, ptr %54, align 8, !tbaa !9
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %56) #9
          to label %58 unwind label %86

58:                                               ; preds = %39
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %57, ptr %59, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %60 = load i64, ptr %14, align 8, !tbaa !9
  %61 = load i64, ptr %16, align 8, !tbaa !9
  %62 = mul i64 %60, %61
  store i64 %62, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store i64 0, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  br label %63

63:                                               ; preds = %79, %58
  %64 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %9, i32 0, i32 34
  %65 = load i32, ptr %64, align 8, !tbaa !24
  %66 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %9, i32 0, i32 28
  %67 = load i32, ptr %66, align 4, !tbaa !25
  %68 = icmp ult i32 %65, %67
  br i1 %68, label %69, label %94

69:                                               ; preds = %63
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = load i64, ptr %18, align 8, !tbaa !9
  %73 = load i64, ptr %17, align 8, !tbaa !9
  %74 = mul i64 %72, %73
  %75 = getelementptr inbounds i8, ptr %71, i64 %74
  %76 = getelementptr inbounds [1 x ptr], ptr %19, i64 0, i64 0
  store ptr %75, ptr %76, align 8, !tbaa !5
  %77 = getelementptr inbounds [1 x ptr], ptr %19, i64 0, i64 0
  %78 = invoke i32 @jpeg_read_scanlines(ptr noundef %9, ptr noundef %77, i32 noundef 1)
          to label %79 unwind label %90

79:                                               ; preds = %69
  %80 = load i64, ptr %18, align 8, !tbaa !9
  %81 = add i64 %80, 1
  store i64 %81, ptr %18, align 8, !tbaa !9
  br label %63, !llvm.loop !26

82:                                               ; preds = %37, %35, %32, %31
  %83 = landingpad { ptr, i32 }
          catch ptr null
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %12, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %13, align 4
  br label %98

86:                                               ; preds = %39
  %87 = landingpad { ptr, i32 }
          catch ptr null
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %12, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %13, align 4
  br label %97

90:                                               ; preds = %94, %69
  %91 = landingpad { ptr, i32 }
          catch ptr null
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %12, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %97

94:                                               ; preds = %63
  %95 = invoke i32 @jpeg_finish_decompress(ptr noundef %9)
          to label %96 unwind label %90

96:                                               ; preds = %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %118

97:                                               ; preds = %90, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %98

98:                                               ; preds = %97, %82
  %99 = load ptr, ptr %12, align 8
  %100 = call ptr @__cxa_begin_catch(ptr %99) #8
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  %103 = icmp ne ptr %102, null
  br i1 %103, label %104, label %111

104:                                              ; preds = %98
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = icmp eq ptr %106, null
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  call void @_ZdaPv(ptr noundef %106) #10
  br label %109

109:                                              ; preds = %108, %104
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  store i64 0, ptr %110, align 8, !tbaa !9
  br label %111

111:                                              ; preds = %109, %98
  invoke void @jpeg_destroy_decompress(ptr noundef %9)
          to label %112 unwind label %113

112:                                              ; preds = %111
  invoke void @__cxa_rethrow() #11
          to label %127 unwind label %113

113:                                              ; preds = %112, %111
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %12, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %13, align 4
  invoke void @__cxa_end_catch()
          to label %117 unwind label %124

117:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 168, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 656, ptr %9) #8
  br label %119

118:                                              ; preds = %96
  call void @jpeg_destroy_decompress(ptr noundef %9)
  call void @llvm.lifetime.end.p0(i64 168, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 656, ptr %9) #8
  ret void

119:                                              ; preds = %117
  %120 = load ptr, ptr %12, align 8
  %121 = load i32, ptr %13, align 4
  %122 = insertvalue { ptr, i32 } poison, ptr %120, 0
  %123 = insertvalue { ptr, i32 } %122, i32 %121, 1
  resume { ptr, i32 } %123

124:                                              ; preds = %113
  %125 = landingpad { ptr, i32 }
          catch ptr null
  %126 = extractvalue { ptr, i32 } %125, 0
  call void @__clang_call_terminate(ptr %126) #12
  unreachable

127:                                              ; preds = %112
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZN8graphlab11decode_jpegEPKcmPPcRmENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1)) #5 align 2

declare i32 @jpeg_start_decompress(ptr noundef) #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #6

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

declare i32 @jpeg_finish_decompress(ptr noundef) #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress 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 #4 = { noinline noreturn nounwind uwtable "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 = { inlinehint mustprogress 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 = { nobuiltin 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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }
attributes #11 = { noreturn }
attributes #12 = { noreturn 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS22jpeg_decompress_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !6, i64 40, !13, i64 48, !13, i64 52, !13, i64 56, !14, i64 60, !14, i64 64, !13, i64 68, !13, i64 72, !15, i64 80, !13, i64 88, !13, i64 92, !16, i64 96, !13, i64 100, !13, i64 104, !13, i64 108, !17, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !13, i64 136, !13, i64 140, !13, i64 144, !13, i64 148, !13, i64 152, !13, i64 156, !6, i64 160, !13, i64 168, !13, i64 172, !13, i64 176, !13, i64 180, !13, i64 184, !6, i64 192, !7, i64 200, !7, i64 232, !7, i64 264, !13, i64 296, !6, i64 304, !13, i64 312, !13, i64 316, !13, i64 320, !7, i64 324, !7, i64 340, !7, i64 356, !13, i64 372, !13, i64 376, !7, i64 380, !7, i64 381, !7, i64 382, !18, i64 384, !18, i64 386, !13, i64 388, !7, i64 392, !13, i64 396, !6, i64 400, !13, i64 408, !13, i64 412, !13, i64 416, !13, i64 420, !13, i64 424, !6, i64 432, !13, i64 440, !7, i64 448, !13, i64 480, !13, i64 484, !13, i64 488, !7, i64 492, !13, i64 532, !13, i64 536, !13, i64 540, !13, i64 544, !13, i64 548, !6, i64 552, !13, i64 560, !13, i64 564, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !6, i64 640, !6, i64 648}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS13J_COLOR_SPACE", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTS12J_DCT_METHOD", !7, i64 0}
!17 = !{!"_ZTS13J_DITHER_MODE", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS14jpeg_error_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !7, i64 44, !13, i64 124, !10, i64 128, !6, i64 136, !13, i64 144, !6, i64 152, !13, i64 160, !13, i64 164}
!21 = !{!12, !13, i64 48}
!22 = !{!12, !13, i64 52}
!23 = !{!12, !13, i64 56}
!24 = !{!12, !13, i64 168}
!25 = !{!12, !13, i64 140}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; 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.jpeg_decompress_struct = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], i32, ptr, i32, i32, i32, [16 x i8], [16 x i8], [16 x i8], i32, i32, i8, i8, i8, i16, i16, i32, i8, i32, ptr, i32, i32, i32, i32, i32, ptr, i32, [4 x ptr], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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] }
%class.anon = type { i8 }

declare i32 @__gxx_personality_v0(...)

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

declare ptr @jpeg_std_error(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN8graphlabL15jpeg_error_exitEP18jpeg_common_struct(ptr noundef) #3

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

declare void @jpeg_mem_src(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @jpeg_read_header(ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @jpeg_destroy_decompress(ptr noundef) local_unnamed_addr #2

declare void @__cxa_rethrow() local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) 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) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8graphlab11decode_jpegEPKcmPPcRm(ptr noundef %0, i64 noundef %1, ptr nocapture noundef %2, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %3) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %5 = alloca %struct.jpeg_decompress_struct, align 8
  %6 = alloca %struct.jpeg_error_mgr, align 8
  %7 = alloca %class.anon, align 1
  %8 = alloca [1 x ptr], align 8
  call void @llvm.lifetime.start.p0(i64 656, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 168, ptr nonnull %6) #8
  %9 = getelementptr inbounds i8, ptr %5, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(656) %9, i8 0, i64 648, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(168) %6, i8 0, i64 168, i1 false)
  %10 = call ptr @jpeg_std_error(ptr noundef nonnull %6)
  store ptr %10, ptr %5, align 8, !tbaa !5
  store ptr @_ZN8graphlabL15jpeg_error_exitEP18jpeg_common_struct, ptr %6, align 8, !tbaa !16
  store ptr null, ptr %2, align 8, !tbaa !19
  store i64 0, ptr %3, align 8, !tbaa !20
  %11 = icmp eq ptr %0, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #8
  call void @"_ZZN8graphlab11decode_jpegEPKcmPPcRmENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) %7)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #8
  br label %13

13:                                               ; preds = %12, %4
  invoke void @jpeg_CreateDecompress(ptr noundef nonnull %5, i32 noundef 80, i64 noundef 656)
          to label %14 unwind label %47

14:                                               ; preds = %13
  invoke void @jpeg_mem_src(ptr noundef nonnull %5, ptr noundef %0, i64 noundef %1)
          to label %15 unwind label %47

15:                                               ; preds = %14
  %16 = invoke i32 @jpeg_read_header(ptr noundef nonnull %5, i32 noundef 1)
          to label %17 unwind label %47

17:                                               ; preds = %15
  %18 = invoke i32 @jpeg_start_decompress(ptr noundef nonnull %5)
          to label %19 unwind label %47

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %5, i64 48
  %21 = load i32, ptr %20, align 8, !tbaa !21
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %5, i64 52
  %24 = load i32, ptr %23, align 4, !tbaa !22
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %5, i64 56
  %27 = load i32, ptr %26, align 8, !tbaa !23
  %28 = sext i32 %27 to i64
  %29 = mul nsw i64 %28, %22
  %30 = mul i64 %29, %25
  store i64 %30, ptr %3, align 8, !tbaa !20
  %31 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %30) #9
          to label %32 unwind label %49

32:                                               ; preds = %19
  store ptr %31, ptr %2, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %33 = getelementptr inbounds i8, ptr %5, i64 168
  %34 = getelementptr inbounds i8, ptr %5, i64 140
  %35 = load i32, ptr %33, align 8, !tbaa !24
  %36 = load i32, ptr %34, align 4, !tbaa !25
  %37 = icmp ult i32 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %32, %42
  %.024 = phi i64 [ %43, %42 ], [ 0, %32 ]
  %38 = load ptr, ptr %2, align 8, !tbaa !19
  %39 = mul i64 %29, %.024
  %40 = getelementptr inbounds i8, ptr %38, i64 %39
  store ptr %40, ptr %8, align 8, !tbaa !19
  %41 = invoke i32 @jpeg_read_scanlines(ptr noundef nonnull %5, ptr noundef nonnull %8, i32 noundef 1)
          to label %42 unwind label %.loopexit

42:                                               ; preds = %.lr.ph
  %43 = add i64 %.024, 1
  %44 = load i32, ptr %33, align 8, !tbaa !24
  %45 = load i32, ptr %34, align 4, !tbaa !25
  %46 = icmp ult i32 %44, %45
  br i1 %46, label %.lr.ph, label %._crit_edge, !llvm.loop !26

47:                                               ; preds = %17, %15, %14, %13
  %48 = landingpad { ptr, i32 }
          catch ptr null
  br label %54

49:                                               ; preds = %19
  %50 = landingpad { ptr, i32 }
          catch ptr null
  br label %54

.loopexit:                                        ; preds = %.lr.ph
  %lpad.loopexit = landingpad { ptr, i32 }
          catch ptr null
  br label %51

.loopexit.split-lp:                               ; preds = %._crit_edge
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          catch ptr null
  br label %51

51:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %54

._crit_edge:                                      ; preds = %42, %32
  %52 = invoke i32 @jpeg_finish_decompress(ptr noundef nonnull %5)
          to label %53 unwind label %.loopexit.split-lp

53:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @jpeg_destroy_decompress(ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 656, ptr nonnull %5) #8
  ret void

54:                                               ; preds = %49, %51, %47
  %.pn.pn = phi { ptr, i32 } [ %48, %47 ], [ %lpad.phi, %51 ], [ %50, %49 ]
  %.1 = extractvalue { ptr, i32 } %.pn.pn, 0
  %55 = call ptr @__cxa_begin_catch(ptr %.1) #8
  %56 = load ptr, ptr %2, align 8, !tbaa !19
  %.not = icmp eq ptr %56, null
  br i1 %.not, label %58, label %57

57:                                               ; preds = %54
  call void @_ZdaPv(ptr noundef nonnull %56) #10
  store i64 0, ptr %3, align 8, !tbaa !20
  br label %58

58:                                               ; preds = %57, %54
  invoke void @jpeg_destroy_decompress(ptr noundef nonnull %5)
          to label %59 unwind label %60

59:                                               ; preds = %58
  invoke void @__cxa_rethrow() #11
          to label %66 unwind label %60

60:                                               ; preds = %59, %58
  %61 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %62 unwind label %63

62:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 656, ptr nonnull %5) #8
  resume { ptr, i32 } %61

63:                                               ; preds = %60
  %64 = landingpad { ptr, i32 }
          catch ptr null
  %65 = extractvalue { ptr, i32 } %64, 0
  call void @__clang_call_terminate(ptr %65) #12
  unreachable

66:                                               ; preds = %59
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZN8graphlab11decode_jpegEPKcmPPcRmENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #5 align 2

declare i32 @jpeg_start_decompress(ptr noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #6

declare i32 @jpeg_read_scanlines(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @jpeg_finish_decompress(ptr noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress 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 #4 = { noinline noreturn nounwind uwtable "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 = { inlinehint mustprogress 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 = { nobuiltin 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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }
attributes #11 = { noreturn }
attributes #12 = { noreturn 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 0}
!6 = !{!"_ZTS22jpeg_decompress_struct", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !11, i64 60, !11, i64 64, !10, i64 68, !10, i64 72, !12, i64 80, !10, i64 88, !10, i64 92, !13, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !14, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !7, i64 160, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !7, i64 192, !8, i64 200, !8, i64 232, !8, i64 264, !10, i64 296, !7, i64 304, !10, i64 312, !10, i64 316, !10, i64 320, !8, i64 324, !8, i64 340, !8, i64 356, !10, i64 372, !10, i64 376, !8, i64 380, !8, i64 381, !8, i64 382, !15, i64 384, !15, i64 386, !10, i64 388, !8, i64 392, !10, i64 396, !7, i64 400, !10, i64 408, !10, i64 412, !10, i64 416, !10, i64 420, !10, i64 424, !7, i64 432, !10, i64 440, !8, i64 448, !10, i64 480, !10, i64 484, !10, i64 488, !8, i64 492, !10, i64 532, !10, i64 536, !10, i64 540, !10, i64 544, !10, i64 548, !7, i64 552, !10, i64 560, !10, i64 564, !7, i64 568, !7, i64 576, !7, i64 584, !7, i64 592, !7, i64 600, !7, i64 608, !7, i64 616, !7, i64 624, !7, i64 632, !7, i64 640, !7, i64 648}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS13J_COLOR_SPACE", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTS12J_DCT_METHOD", !8, i64 0}
!14 = !{!"_ZTS13J_DITHER_MODE", !8, i64 0}
!15 = !{!"short", !8, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"_ZTS14jpeg_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, !18, i64 128, !7, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 164}
!18 = !{!"long", !8, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!18, !18, i64 0}
!21 = !{!6, !10, i64 48}
!22 = !{!6, !10, i64 52}
!23 = !{!6, !10, i64 56}
!24 = !{!6, !10, i64 168}
!25 = !{!6, !10, i64 140}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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