; LLVM IR from corentinartaud/graphics :: ThirdParty/FreeImage-3170/Source/LibJPEG (djpeg)

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

@progname = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@cdjpeg_message_table = external hidden constant [45 x ptr], align 16
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@outfilename = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@requested_fmt = external hidden global i32, align 4
@stdin = external global ptr, align 8
@stdout = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.jpeg_decompress_struct, align 8
  %7 = alloca %struct.jpeg_error_mgr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 632, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 168, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr @progname, align 8, !tbaa !9
  %16 = load ptr, ptr @progname, align 8, !tbaa !9
  %17 = icmp eq ptr %16, null
  br i1 %17, label %24, label %18

18:                                               ; preds = %2
  %19 = load ptr, ptr @progname, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %19, i64 0
  %21 = load i8, ptr %20, align 1, !tbaa !11
  %22 = sext i8 %21 to i32
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %18, %2
  store ptr @.str, ptr @progname, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %24, %18
  %26 = call ptr @jpeg_std_error(ptr noundef %7)
  %27 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 0
  store ptr %26, ptr %27, align 8, !tbaa !12
  call void @jpeg_CreateDecompress(ptr noundef %6, i32 noundef 90, i64 noundef 632)
  %28 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %7, i32 0, i32 11
  store ptr @cdjpeg_message_table, ptr %28, align 8, !tbaa !16
  %29 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %7, i32 0, i32 12
  store i32 1000, ptr %29, align 8, !tbaa !19
  %30 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %7, i32 0, i32 13
  store i32 1044, ptr %30, align 4, !tbaa !20
  call void @jpeg_set_marker_processor(ptr noundef %6, i32 noundef 254, ptr noundef @print_text_marker)
  call void @jpeg_set_marker_processor(ptr noundef %6, i32 noundef 236, ptr noundef @print_text_marker)
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = call i32 @parse_switches(ptr noundef %6, i32 noundef %31, ptr noundef %32, i32 noundef 0, i8 noundef zeroext 0)
  store i32 %33, ptr %8, align 4, !tbaa !5
  %34 = load i32, ptr %8, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sub nsw i32 %35, 1
  %37 = icmp slt i32 %34, %36
  br i1 %37, label %38, label %42

38:                                               ; preds = %25
  %39 = load ptr, ptr @stderr, align 8, !tbaa !9
  %40 = load ptr, ptr @progname, align 8, !tbaa !9
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.1, ptr noundef %40) #5
  call void @usage()
  br label %42

42:                                               ; preds = %38, %25
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %64

46:                                               ; preds = %42
  %47 = load ptr, ptr %5, align 8, !tbaa !9
  %48 = load i32, ptr %8, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds ptr, ptr %47, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = call noalias ptr @fopen(ptr noundef %51, ptr noundef @.str.2)
  store ptr %52, ptr %10, align 8, !tbaa !9
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %63

54:                                               ; preds = %46
  %55 = load ptr, ptr @stderr, align 8, !tbaa !9
  %56 = load ptr, ptr @progname, align 8, !tbaa !9
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.3, ptr noundef %56, ptr noundef %61) #5
  call void @exit(i32 noundef 1) #6
  unreachable

63:                                               ; preds = %46
  br label %66

64:                                               ; preds = %42
  %65 = call ptr @read_stdin()
  store ptr %65, ptr %10, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %64, %63
  %67 = load ptr, ptr @outfilename, align 8, !tbaa !9
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %79

69:                                               ; preds = %66
  %70 = load ptr, ptr @outfilename, align 8, !tbaa !9
  %71 = call noalias ptr @fopen(ptr noundef %70, ptr noundef @.str.4)
  store ptr %71, ptr %11, align 8, !tbaa !9
  %72 = icmp eq ptr %71, null
  br i1 %72, label %73, label %78

73:                                               ; preds = %69
  %74 = load ptr, ptr @stderr, align 8, !tbaa !9
  %75 = load ptr, ptr @progname, align 8, !tbaa !9
  %76 = load ptr, ptr @outfilename, align 8, !tbaa !9
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.3, ptr noundef %75, ptr noundef %76) #5
  call void @exit(i32 noundef 1) #6
  unreachable

78:                                               ; preds = %69
  br label %81

79:                                               ; preds = %66
  %80 = call ptr @write_stdout()
  store ptr %80, ptr %11, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %79, %78
  %82 = load ptr, ptr %10, align 8, !tbaa !9
  call void @jpeg_stdio_src(ptr noundef %6, ptr noundef %82)
  %83 = call i32 @jpeg_read_header(ptr noundef %6, i8 noundef zeroext 1)
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = load ptr, ptr %5, align 8, !tbaa !9
  %86 = call i32 @parse_switches(ptr noundef %6, i32 noundef %84, ptr noundef %85, i32 noundef 0, i8 noundef zeroext 1)
  store i32 %86, ptr %8, align 4, !tbaa !5
  %87 = load i32, ptr @requested_fmt, align 4, !tbaa !5
  switch i32 %87, label %98 [
    i32 0, label %88
    i32 2, label %90
    i32 1, label %92
    i32 3, label %94
    i32 5, label %96
  ]

88:                                               ; preds = %81
  %89 = call ptr @jinit_write_bmp(ptr noundef %6, i8 noundef zeroext 0)
  store ptr %89, ptr %9, align 8, !tbaa !9
  br label %106

90:                                               ; preds = %81
  %91 = call ptr @jinit_write_bmp(ptr noundef %6, i8 noundef zeroext 1)
  store ptr %91, ptr %9, align 8, !tbaa !9
  br label %106

92:                                               ; preds = %81
  %93 = call ptr @jinit_write_gif(ptr noundef %6)
  store ptr %93, ptr %9, align 8, !tbaa !9
  br label %106

94:                                               ; preds = %81
  %95 = call ptr @jinit_write_ppm(ptr noundef %6)
  store ptr %95, ptr %9, align 8, !tbaa !9
  br label %106

96:                                               ; preds = %81
  %97 = call ptr @jinit_write_targa(ptr noundef %6)
  store ptr %97, ptr %9, align 8, !tbaa !9
  br label %106

98:                                               ; preds = %81
  %99 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !12
  %101 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %100, i32 0, i32 5
  store i32 1043, ptr %101, align 8, !tbaa !21
  %102 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !12
  %104 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !22
  call void %105(ptr noundef %6)
  br label %106

106:                                              ; preds = %98, %96, %94, %92, %90, %88
  %107 = load ptr, ptr %11, align 8, !tbaa !9
  %108 = load ptr, ptr %9, align 8, !tbaa !9
  %109 = getelementptr inbounds %struct.djpeg_dest_struct, ptr %108, i32 0, i32 3
  store ptr %107, ptr %109, align 8, !tbaa !23
  %110 = call zeroext i8 @jpeg_start_decompress(ptr noundef %6)
  %111 = load ptr, ptr %9, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct.djpeg_dest_struct, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !25
  %114 = load ptr, ptr %9, align 8, !tbaa !9
  call void %113(ptr noundef %6, ptr noundef %114)
  br label %115

115:                                              ; preds = %121, %106
  %116 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 34
  %117 = load i32, ptr %116, align 8, !tbaa !26
  %118 = getelementptr inbounds %struct.jpeg_decompress_struct, ptr %6, i32 0, i32 28
  %119 = load i32, ptr %118, align 8, !tbaa !27
  %120 = icmp ult i32 %117, %119
  br i1 %120, label %121, label %134

121:                                              ; preds = %115
  %122 = load ptr, ptr %9, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.djpeg_dest_struct, ptr %122, i32 0, i32 4
  %124 = load ptr, ptr %123, align 8, !tbaa !28
  %125 = load ptr, ptr %9, align 8, !tbaa !9
  %126 = getelementptr inbounds %struct.djpeg_dest_struct, ptr %125, i32 0, i32 5
  %127 = load i32, ptr %126, align 8, !tbaa !29
  %128 = call i32 @jpeg_read_scanlines(ptr noundef %6, ptr noundef %124, i32 noundef %127)
  store i32 %128, ptr %12, align 4, !tbaa !5
  %129 = load ptr, ptr %9, align 8, !tbaa !9
  %130 = getelementptr inbounds %struct.djpeg_dest_struct, ptr %129, i32 0, i32 1
  %131 = load ptr, ptr %130, align 8, !tbaa !30
  %132 = load ptr, ptr %9, align 8, !tbaa !9
  %133 = load i32, ptr %12, align 4, !tbaa !5
  call void %131(ptr noundef %6, ptr noundef %132, i32 noundef %133)
  br label %115, !llvm.loop !31

134:                                              ; preds = %115
  %135 = load ptr, ptr %9, align 8, !tbaa !9
  %136 = getelementptr inbounds %struct.djpeg_dest_struct, ptr %135, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !33
  %138 = load ptr, ptr %9, align 8, !tbaa !9
  call void %137(ptr noundef %6, ptr noundef %138)
  %139 = call zeroext i8 @jpeg_finish_decompress(ptr noundef %6)
  call void @jpeg_destroy_decompress(ptr noundef %6)
  %140 = load ptr, ptr %10, align 8, !tbaa !9
  %141 = load ptr, ptr @stdin, align 8, !tbaa !9
  %142 = icmp ne ptr %140, %141
  br i1 %142, label %143, label %146

143:                                              ; preds = %134
  %144 = load ptr, ptr %10, align 8, !tbaa !9
  %145 = call i32 @fclose(ptr noundef %144)
  br label %146

146:                                              ; preds = %143, %134
  %147 = load ptr, ptr %11, align 8, !tbaa !9
  %148 = load ptr, ptr @stdout, align 8, !tbaa !9
  %149 = icmp ne ptr %147, %148
  br i1 %149, label %150, label %153

150:                                              ; preds = %146
  %151 = load ptr, ptr %11, align 8, !tbaa !9
  %152 = call i32 @fclose(ptr noundef %151)
  br label %153

153:                                              ; preds = %150, %146
  %154 = getelementptr inbounds %struct.jpeg_error_mgr, ptr %7, i32 0, i32 8
  %155 = load i64, ptr %154, align 8, !tbaa !34
  %156 = icmp ne i64 %155, 0
  %157 = zext i1 %156 to i64
  %158 = select i1 %156, i32 2, i32 0
  call void @exit(i32 noundef %158) #6
  unreachable
}

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

declare ptr @jpeg_std_error(ptr noundef) #2

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

declare void @jpeg_set_marker_processor(ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i8 @print_text_marker(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare hidden void @usage() #0

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

declare ptr @read_stdin() #2

declare ptr @write_stdout() #2

declare void @jpeg_stdio_src(ptr noundef, ptr noundef) #2

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

declare ptr @jinit_write_bmp(ptr noundef, i8 noundef zeroext) #2

declare ptr @jinit_write_gif(ptr noundef) #2

declare ptr @jinit_write_ppm(ptr noundef) #2

declare ptr @jinit_write_targa(ptr noundef) #2

declare zeroext i8 @jpeg_start_decompress(ptr noundef) #2

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

declare zeroext i8 @jpeg_finish_decompress(ptr noundef) #2

declare void @jpeg_destroy_decompress(ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

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 = { noreturn 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 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 0}
!13 = !{!"jpeg_decompress_struct", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !6, i64 36, !10, i64 40, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !6, i64 72, !14, i64 80, !7, i64 88, !7, i64 89, !6, i64 92, !7, i64 96, !7, i64 97, !7, i64 98, !6, i64 100, !7, i64 104, !6, i64 108, !7, i64 112, !7, i64 113, !7, i64 114, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !6, i64 136, !10, i64 144, !6, i64 152, !6, i64 156, !6, i64 160, !6, i64 164, !6, i64 168, !10, i64 176, !7, i64 184, !7, i64 216, !7, i64 248, !6, i64 280, !10, i64 288, !7, i64 296, !7, i64 297, !7, i64 298, !7, i64 299, !7, i64 315, !7, i64 331, !6, i64 348, !7, i64 352, !7, i64 353, !7, i64 354, !7, i64 355, !15, i64 356, !15, i64 358, !7, i64 360, !7, i64 361, !6, i64 364, !7, i64 368, !10, i64 376, !6, i64 384, !6, i64 388, !6, i64 392, !6, i64 396, !6, i64 400, !10, i64 408, !6, i64 416, !7, i64 424, !6, i64 456, !6, i64 460, !6, i64 464, !7, i64 468, !6, i64 508, !6, i64 512, !6, i64 516, !6, i64 520, !6, i64 524, !10, i64 528, !6, i64 536, !6, i64 540, !10, i64 544, !10, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624}
!14 = !{!"double", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !10, i64 152}
!17 = !{!"jpeg_error_mgr", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !7, i64 44, !6, i64 124, !18, i64 128, !10, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 164}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !6, i64 160}
!20 = !{!17, !6, i64 164}
!21 = !{!17, !6, i64 40}
!22 = !{!17, !10, i64 0}
!23 = !{!24, !10, i64 24}
!24 = !{!"djpeg_dest_struct", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40}
!25 = !{!24, !10, i64 0}
!26 = !{!13, !6, i64 152}
!27 = !{!13, !6, i64 120}
!28 = !{!24, !10, i64 32}
!29 = !{!24, !6, i64 40}
!30 = !{!24, !10, i64 8}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!24, !10, i64 16}
!34 = !{!17, !18, i64 128}


; 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, i8, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, i8, i8, i32, i8, i8, i8, i32, i8, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, ptr, [4 x ptr], [4 x ptr], [4 x ptr], i32, ptr, i8, i8, i8, [16 x i8], [16 x i8], [16 x i8], i32, i8, i8, i8, i8, i16, i16, i8, i8, i32, i8, 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] }

@progname = external hidden local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@cdjpeg_message_table = external hidden constant [45 x ptr], align 16
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@outfilename = external hidden local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@requested_fmt = external hidden local_unnamed_addr global i32, align 4
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.jpeg_decompress_struct, align 8
  %4 = alloca %struct.jpeg_error_mgr, align 8
  call void @llvm.lifetime.start.p0(i64 632, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 168, ptr nonnull %4) #6
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %5, ptr @progname, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %10, label %7

7:                                                ; preds = %2
  %8 = load i8, ptr %5, align 1, !tbaa !9
  %9 = icmp eq i8 %8, 0
  br i1 %9, label %10, label %11

10:                                               ; preds = %7, %2
  store ptr @.str, ptr @progname, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %10, %7
  %12 = call ptr @jpeg_std_error(ptr noundef nonnull %4) #6
  store ptr %12, ptr %3, align 8, !tbaa !10
  call void @jpeg_CreateDecompress(ptr noundef nonnull %3, i32 noundef 90, i64 noundef 632) #6
  %13 = getelementptr inbounds i8, ptr %4, i64 152
  store ptr @cdjpeg_message_table, ptr %13, align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %4, i64 160
  store i32 1000, ptr %14, align 8, !tbaa !18
  %15 = getelementptr inbounds i8, ptr %4, i64 164
  store i32 1044, ptr %15, align 4, !tbaa !19
  call void @jpeg_set_marker_processor(ptr noundef nonnull %3, i32 noundef 254, ptr noundef nonnull @print_text_marker) #6
  call void @jpeg_set_marker_processor(ptr noundef nonnull %3, i32 noundef 236, ptr noundef nonnull @print_text_marker) #6
  %16 = call i32 @parse_switches(ptr noundef nonnull %3, i32 noundef %0, ptr noundef nonnull %1, i32 noundef 0, i8 noundef zeroext 0)
  %17 = add nsw i32 %0, -1
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %19, label %23

19:                                               ; preds = %11
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = load ptr, ptr @progname, align 8, !tbaa !5
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.1, ptr noundef %21) #7
  call void @usage()
  br label %23

23:                                               ; preds = %19, %11
  %24 = icmp slt i32 %16, %0
  br i1 %24, label %25, label %36

25:                                               ; preds = %23
  %26 = sext i32 %16 to i64
  %27 = getelementptr inbounds ptr, ptr %1, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = call noalias ptr @fopen(ptr noundef %28, ptr noundef nonnull @.str.2)
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %38

31:                                               ; preds = %25
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = load ptr, ptr @progname, align 8, !tbaa !5
  %34 = load ptr, ptr %27, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.3, ptr noundef %33, ptr noundef %34) #7
  call void @exit(i32 noundef 1) #8
  unreachable

36:                                               ; preds = %23
  %37 = call ptr @read_stdin() #6
  br label %38

38:                                               ; preds = %25, %36
  %.028 = phi ptr [ %29, %25 ], [ %37, %36 ]
  %39 = load ptr, ptr @outfilename, align 8, !tbaa !5
  %.not = icmp eq ptr %39, null
  br i1 %.not, label %48, label %40

40:                                               ; preds = %38
  %41 = call noalias ptr @fopen(ptr noundef nonnull %39, ptr noundef nonnull @.str.4)
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = load ptr, ptr @progname, align 8, !tbaa !5
  %46 = load ptr, ptr @outfilename, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.3, ptr noundef %45, ptr noundef %46) #7
  call void @exit(i32 noundef 1) #8
  unreachable

48:                                               ; preds = %38
  %49 = call ptr @write_stdout() #6
  br label %50

50:                                               ; preds = %40, %48
  %.0 = phi ptr [ %41, %40 ], [ %49, %48 ]
  call void @jpeg_stdio_src(ptr noundef nonnull %3, ptr noundef %.028) #6
  %51 = call i32 @jpeg_read_header(ptr noundef nonnull %3, i8 noundef zeroext 1) #6
  %52 = call i32 @parse_switches(ptr noundef nonnull %3, i32 noundef %0, ptr noundef nonnull %1, i32 noundef 0, i8 noundef zeroext 1)
  %53 = load i32, ptr @requested_fmt, align 4, !tbaa !20
  switch i32 %53, label %64 [
    i32 0, label %54
    i32 2, label %56
    i32 1, label %58
    i32 3, label %60
    i32 5, label %62
  ]

54:                                               ; preds = %50
  %55 = call ptr @jinit_write_bmp(ptr noundef nonnull %3, i8 noundef zeroext 0) #6
  br label %68

56:                                               ; preds = %50
  %57 = call ptr @jinit_write_bmp(ptr noundef nonnull %3, i8 noundef zeroext 1) #6
  br label %68

58:                                               ; preds = %50
  %59 = call ptr @jinit_write_gif(ptr noundef nonnull %3) #6
  br label %68

60:                                               ; preds = %50
  %61 = call ptr @jinit_write_ppm(ptr noundef nonnull %3) #6
  br label %68

62:                                               ; preds = %50
  %63 = call ptr @jinit_write_targa(ptr noundef nonnull %3) #6
  br label %68

64:                                               ; preds = %50
  %65 = load ptr, ptr %3, align 8, !tbaa !10
  %66 = getelementptr inbounds i8, ptr %65, i64 40
  store i32 1043, ptr %66, align 8, !tbaa !21
  %67 = load ptr, ptr %65, align 8, !tbaa !22
  call void %67(ptr noundef nonnull %3) #6
  br label %68

68:                                               ; preds = %64, %62, %60, %58, %56, %54
  %.029 = phi ptr [ null, %64 ], [ %63, %62 ], [ %61, %60 ], [ %59, %58 ], [ %57, %56 ], [ %55, %54 ]
  %69 = getelementptr inbounds i8, ptr %.029, i64 24
  store ptr %.0, ptr %69, align 8, !tbaa !23
  %70 = call zeroext i8 @jpeg_start_decompress(ptr noundef nonnull %3) #6
  %71 = load ptr, ptr %.029, align 8, !tbaa !25
  call void %71(ptr noundef nonnull %3, ptr noundef nonnull %.029) #6
  %72 = getelementptr inbounds i8, ptr %3, i64 152
  %73 = getelementptr inbounds i8, ptr %3, i64 120
  %74 = load i32, ptr %72, align 8, !tbaa !26
  %75 = load i32, ptr %73, align 8, !tbaa !27
  %76 = icmp ult i32 %74, %75
  br i1 %76, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %68
  %77 = getelementptr inbounds i8, ptr %.029, i64 32
  %78 = getelementptr inbounds i8, ptr %.029, i64 40
  %79 = getelementptr inbounds i8, ptr %.029, i64 8
  br label %80

80:                                               ; preds = %.lr.ph, %80
  %81 = load ptr, ptr %77, align 8, !tbaa !28
  %82 = load i32, ptr %78, align 8, !tbaa !29
  %83 = call i32 @jpeg_read_scanlines(ptr noundef nonnull %3, ptr noundef %81, i32 noundef %82) #6
  %84 = load ptr, ptr %79, align 8, !tbaa !30
  call void %84(ptr noundef nonnull %3, ptr noundef nonnull %.029, i32 noundef %83) #6
  %85 = load i32, ptr %72, align 8, !tbaa !26
  %86 = load i32, ptr %73, align 8, !tbaa !27
  %87 = icmp ult i32 %85, %86
  br i1 %87, label %80, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %80, %68
  %88 = getelementptr inbounds i8, ptr %.029, i64 16
  %89 = load ptr, ptr %88, align 8, !tbaa !33
  call void %89(ptr noundef nonnull %3, ptr noundef nonnull %.029) #6
  %90 = call zeroext i8 @jpeg_finish_decompress(ptr noundef nonnull %3) #6
  call void @jpeg_destroy_decompress(ptr noundef nonnull %3) #6
  %91 = load ptr, ptr @stdin, align 8, !tbaa !5
  %.not35 = icmp eq ptr %.028, %91
  br i1 %.not35, label %94, label %92

92:                                               ; preds = %._crit_edge
  %93 = call i32 @fclose(ptr noundef %.028)
  br label %94

94:                                               ; preds = %92, %._crit_edge
  %95 = load ptr, ptr @stdout, align 8, !tbaa !5
  %.not36 = icmp eq ptr %.0, %95
  br i1 %.not36, label %98, label %96

96:                                               ; preds = %94
  %97 = call i32 @fclose(ptr noundef %.0)
  br label %98

98:                                               ; preds = %96, %94
  %99 = getelementptr inbounds i8, ptr %4, i64 128
  %100 = load i64, ptr %99, align 8, !tbaa !34
  %.not37 = icmp eq i64 %100, 0
  %101 = select i1 %.not37, i32 0, i32 2
  call void @exit(i32 noundef %101) #8
  unreachable
}

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

declare ptr @jpeg_std_error(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i8 @print_text_marker(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @parse_switches(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden void @usage() local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

declare ptr @read_stdin() local_unnamed_addr #2

declare ptr @write_stdout() local_unnamed_addr #2

declare void @jpeg_stdio_src(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare ptr @jinit_write_bmp(ptr noundef, i8 noundef zeroext) local_unnamed_addr #2

declare ptr @jinit_write_gif(ptr noundef) local_unnamed_addr #2

declare ptr @jinit_write_ppm(ptr noundef) local_unnamed_addr #2

declare ptr @jinit_write_targa(ptr noundef) local_unnamed_addr #2

declare zeroext i8 @jpeg_start_decompress(ptr noundef) local_unnamed_addr #2

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

declare zeroext i8 @jpeg_finish_decompress(ptr noundef) local_unnamed_addr #2

declare void @jpeg_destroy_decompress(ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #4

attributes #0 = { noreturn 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 = { 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 #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 = { noreturn 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 }
attributes #7 = { cold nounwind }
attributes #8 = { 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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 0}
!11 = !{!"jpeg_decompress_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !12, i64 36, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !13, i64 80, !7, i64 88, !7, i64 89, !12, i64 92, !7, i64 96, !7, i64 97, !7, i64 98, !12, i64 100, !7, i64 104, !12, i64 108, !7, i64 112, !7, i64 113, !7, i64 114, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !6, i64 144, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !6, i64 176, !7, i64 184, !7, i64 216, !7, i64 248, !12, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !7, i64 298, !7, i64 299, !7, i64 315, !7, i64 331, !12, i64 348, !7, i64 352, !7, i64 353, !7, i64 354, !7, i64 355, !14, i64 356, !14, i64 358, !7, i64 360, !7, i64 361, !12, i64 364, !7, i64 368, !6, i64 376, !12, i64 384, !12, i64 388, !12, i64 392, !12, i64 396, !12, i64 400, !6, i64 408, !12, i64 416, !7, i64 424, !12, i64 456, !12, i64 460, !12, i64 464, !7, i64 468, !12, i64 508, !12, i64 512, !12, i64 516, !12, i64 520, !12, i64 524, !6, i64 528, !12, i64 536, !12, i64 540, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !6, i64 152}
!16 = !{!"jpeg_error_mgr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !7, i64 44, !12, i64 124, !17, i64 128, !6, i64 136, !12, i64 144, !6, i64 152, !12, i64 160, !12, i64 164}
!17 = !{!"long", !7, i64 0}
!18 = !{!16, !12, i64 160}
!19 = !{!16, !12, i64 164}
!20 = !{!12, !12, i64 0}
!21 = !{!16, !12, i64 40}
!22 = !{!16, !6, i64 0}
!23 = !{!24, !6, i64 24}
!24 = !{!"djpeg_dest_struct", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40}
!25 = !{!24, !6, i64 0}
!26 = !{!11, !12, i64 152}
!27 = !{!11, !12, i64 120}
!28 = !{!24, !6, i64 32}
!29 = !{!24, !12, i64 40}
!30 = !{!24, !6, i64 8}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!24, !6, i64 16}
!34 = !{!16, !17, i64 128}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass