; LLVM IR from mncoppola/rpef :: utilities_src/squashfs4.2/lzma465/C/LzmaUtil (LzmaUtil)

; 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.CFileSeqInStream = type { %struct.ISeqInStream, %struct.CSzFile }
%struct.ISeqInStream = type { ptr }
%struct.CSzFile = type { ptr }
%struct.CFileOutStream = type { %struct.ISeqOutStream, %struct.CSzFile }
%struct.ISeqOutStream = type { ptr }

@kCantReadMessage = external dso_local global ptr, align 8
@kCantWriteMessage = external dso_local global ptr, align 8
@kCantAllocateMessage = external dso_local global ptr, align 8
@kDataErrorMessage = external dso_local global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @PrintHelp(ptr noundef) #0

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @PrintUserError(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @main2(i32 noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.CFileSeqInStream, align 8
  %9 = alloca %struct.CFileOutStream, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @FileSeqInStream_CreateVTable(ptr noundef %8)
  %18 = getelementptr inbounds %struct.CFileSeqInStream, ptr %8, i32 0, i32 1
  call void @File_Construct(ptr noundef %18)
  call void @FileOutStream_CreateVTable(ptr noundef %9)
  %19 = getelementptr inbounds %struct.CFileOutStream, ptr %9, i32 0, i32 1
  call void @File_Construct(ptr noundef %19)
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %24

22:                                               ; preds = %3
  %23 = load ptr, ptr %7, align 8, !tbaa !9
  call void @PrintHelp(ptr noundef %23)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

24:                                               ; preds = %3
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 3
  br i1 %26, label %36, label %27

27:                                               ; preds = %24
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 4
  br i1 %29, label %36, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %6, align 8, !tbaa !9
  %32 = getelementptr inbounds ptr, ptr %31, i64 1
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call i64 @strlen(ptr noundef %33) #5
  %35 = icmp ne i64 %34, 1
  br i1 %35, label %36, label %39

36:                                               ; preds = %30, %27, %24
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  %38 = call i32 @PrintUserError(ptr noundef %37)
  store i32 %38, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

39:                                               ; preds = %30
  %40 = load ptr, ptr %6, align 8, !tbaa !9
  %41 = getelementptr inbounds ptr, ptr %40, i64 1
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %42, i64 0
  %44 = load i8, ptr %43, align 1, !tbaa !11
  store i8 %44, ptr %10, align 1, !tbaa !11
  %45 = load i8, ptr %10, align 1, !tbaa !11
  %46 = sext i8 %45 to i32
  %47 = icmp eq i32 %46, 101
  br i1 %47, label %52, label %48

48:                                               ; preds = %39
  %49 = load i8, ptr %10, align 1, !tbaa !11
  %50 = sext i8 %49 to i32
  %51 = icmp eq i32 %50, 69
  br label %52

52:                                               ; preds = %48, %39
  %53 = phi i1 [ true, %39 ], [ %51, %48 ]
  %54 = zext i1 %53 to i32
  store i32 %54, ptr %12, align 4, !tbaa !5
  %55 = load i32, ptr %12, align 4, !tbaa !5
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %68, label %57

57:                                               ; preds = %52
  %58 = load i8, ptr %10, align 1, !tbaa !11
  %59 = sext i8 %58 to i32
  %60 = icmp ne i32 %59, 100
  br i1 %60, label %61, label %68

61:                                               ; preds = %57
  %62 = load i8, ptr %10, align 1, !tbaa !11
  %63 = sext i8 %62 to i32
  %64 = icmp ne i32 %63, 68
  br i1 %64, label %65, label %68

65:                                               ; preds = %61
  %66 = load ptr, ptr %7, align 8, !tbaa !9
  %67 = call i32 @PrintUserError(ptr noundef %66)
  store i32 %67, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

68:                                               ; preds = %61, %57, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i64 4, ptr %15, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store i64 8, ptr %16, align 8, !tbaa !12
  %69 = load i64, ptr %15, align 8, !tbaa !12
  %70 = icmp ne i64 %69, 4
  br i1 %70, label %74, label %71

71:                                               ; preds = %68
  %72 = load i64, ptr %16, align 8, !tbaa !12
  %73 = icmp ne i64 %72, 8
  br i1 %73, label %74, label %77

74:                                               ; preds = %71, %68
  %75 = load ptr, ptr %7, align 8, !tbaa !9
  %76 = call i32 @PrintError(ptr noundef %75, ptr noundef @.str.9)
  store i32 %76, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %78

77:                                               ; preds = %71
  store i32 0, ptr %14, align 4
  br label %78

78:                                               ; preds = %77, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %79 = load i32, ptr %14, align 4
  switch i32 %79, label %179 [
    i32 0, label %80
  ]

80:                                               ; preds = %78
  %81 = getelementptr inbounds %struct.CFileSeqInStream, ptr %8, i32 0, i32 1
  %82 = load ptr, ptr %6, align 8, !tbaa !9
  %83 = getelementptr inbounds ptr, ptr %82, i64 2
  %84 = load ptr, ptr %83, align 8, !tbaa !9
  %85 = call i32 @InFile_Open(ptr noundef %81, ptr noundef %84)
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %90

87:                                               ; preds = %80
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  %89 = call i32 @PrintError(ptr noundef %88, ptr noundef @.str.10)
  store i32 %89, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

90:                                               ; preds = %80
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = icmp sgt i32 %91, 3
  br i1 %92, label %93, label %104

93:                                               ; preds = %90
  store i32 1, ptr %13, align 4, !tbaa !5
  %94 = getelementptr inbounds %struct.CFileOutStream, ptr %9, i32 0, i32 1
  %95 = load ptr, ptr %6, align 8, !tbaa !9
  %96 = getelementptr inbounds ptr, ptr %95, i64 3
  %97 = load ptr, ptr %96, align 8, !tbaa !9
  %98 = call i32 @OutFile_Open(ptr noundef %94, ptr noundef %97)
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %93
  %101 = load ptr, ptr %7, align 8, !tbaa !9
  %102 = call i32 @PrintError(ptr noundef %101, ptr noundef @.str.11)
  store i32 %102, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

103:                                              ; preds = %93
  br label %111

104:                                              ; preds = %90
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %110

107:                                              ; preds = %104
  %108 = load ptr, ptr %7, align 8, !tbaa !9
  %109 = call i32 @PrintUserError(ptr noundef %108)
  br label %110

110:                                              ; preds = %107, %104
  br label %111

111:                                              ; preds = %110, %103
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %122

114:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %115 = getelementptr inbounds %struct.CFileSeqInStream, ptr %8, i32 0, i32 1
  %116 = call i32 @File_GetLength(ptr noundef %115, ptr noundef %17)
  %117 = getelementptr inbounds %struct.CFileOutStream, ptr %9, i32 0, i32 0
  %118 = getelementptr inbounds %struct.CFileSeqInStream, ptr %8, i32 0, i32 0
  %119 = load i64, ptr %17, align 8, !tbaa !14
  %120 = load ptr, ptr %7, align 8, !tbaa !9
  %121 = call i32 @Encode(ptr noundef %117, ptr noundef %118, i64 noundef %119, ptr noundef %120)
  store i32 %121, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br label %132

122:                                              ; preds = %111
  %123 = getelementptr inbounds %struct.CFileOutStream, ptr %9, i32 0, i32 0
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %128

126:                                              ; preds = %122
  %127 = getelementptr inbounds %struct.CFileSeqInStream, ptr %8, i32 0, i32 0
  br label %129

128:                                              ; preds = %122
  br label %129

129:                                              ; preds = %128, %126
  %130 = phi ptr [ %127, %126 ], [ null, %128 ]
  %131 = call i32 @Decode(ptr noundef %123, ptr noundef %130)
  store i32 %131, ptr %11, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %129, %114
  %133 = load i32, ptr %13, align 4, !tbaa !5
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %138

135:                                              ; preds = %132
  %136 = getelementptr inbounds %struct.CFileOutStream, ptr %9, i32 0, i32 1
  %137 = call i32 @File_Close(ptr noundef %136)
  br label %138

138:                                              ; preds = %135, %132
  %139 = getelementptr inbounds %struct.CFileSeqInStream, ptr %8, i32 0, i32 1
  %140 = call i32 @File_Close(ptr noundef %139)
  %141 = load i32, ptr %11, align 4, !tbaa !5
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %178

143:                                              ; preds = %138
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = icmp eq i32 %144, 2
  br i1 %145, label %146, label %150

146:                                              ; preds = %143
  %147 = load ptr, ptr %7, align 8, !tbaa !9
  %148 = load ptr, ptr @kCantAllocateMessage, align 8, !tbaa !9
  %149 = call i32 @PrintError(ptr noundef %147, ptr noundef %148)
  store i32 %149, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

150:                                              ; preds = %143
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = icmp eq i32 %151, 1
  br i1 %152, label %153, label %157

153:                                              ; preds = %150
  %154 = load ptr, ptr %7, align 8, !tbaa !9
  %155 = load ptr, ptr @kDataErrorMessage, align 8, !tbaa !9
  %156 = call i32 @PrintError(ptr noundef %154, ptr noundef %155)
  store i32 %156, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

157:                                              ; preds = %150
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = icmp eq i32 %158, 9
  br i1 %159, label %160, label %164

160:                                              ; preds = %157
  %161 = load ptr, ptr %7, align 8, !tbaa !9
  %162 = load ptr, ptr @kCantWriteMessage, align 8, !tbaa !9
  %163 = call i32 @PrintError(ptr noundef %161, ptr noundef %162)
  store i32 %163, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

164:                                              ; preds = %157
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = icmp eq i32 %165, 8
  br i1 %166, label %167, label %171

167:                                              ; preds = %164
  %168 = load ptr, ptr %7, align 8, !tbaa !9
  %169 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !9
  %170 = call i32 @PrintError(ptr noundef %168, ptr noundef %169)
  store i32 %170, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

171:                                              ; preds = %164
  br label %172

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr %7, align 8, !tbaa !9
  %176 = load i32, ptr %11, align 4, !tbaa !5
  %177 = call i32 @PrintErrorNumber(ptr noundef %175, i32 noundef %176)
  store i32 %177, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

178:                                              ; preds = %138
  store i32 0, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %179

179:                                              ; preds = %178, %174, %167, %160, %153, %146, %100, %87, %78, %65, %36, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  %180 = load i32, ptr %4, align 4
  ret i32 %180
}

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

declare void @FileSeqInStream_CreateVTable(ptr noundef) #3

declare void @File_Construct(ptr noundef) #3

declare void @FileOutStream_CreateVTable(ptr noundef) #3

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

declare i32 @InFile_Open(ptr noundef, ptr noundef) #3

declare i32 @OutFile_Open(ptr noundef, ptr noundef) #3

declare i32 @File_GetLength(ptr noundef, ptr noundef) #3

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

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

declare i32 @File_Close(ptr noundef) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}


; 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.CFileSeqInStream = type { %struct.ISeqInStream, %struct.CSzFile }
%struct.ISeqInStream = type { ptr }
%struct.CSzFile = type { ptr }
%struct.CFileOutStream = type { %struct.ISeqOutStream, %struct.CSzFile }
%struct.ISeqOutStream = type { ptr }

@kCantReadMessage = external dso_local local_unnamed_addr global ptr, align 8
@kCantWriteMessage = external dso_local local_unnamed_addr global ptr, align 8
@kCantAllocateMessage = external dso_local local_unnamed_addr global ptr, align 8
@kDataErrorMessage = external dso_local local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @PrintError(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @PrintErrorNumber(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main2(i32 noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.CFileSeqInStream, align 8
  %5 = alloca %struct.CFileOutStream, align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @FileSeqInStream_CreateVTable(ptr noundef nonnull %4) #4
  %7 = getelementptr inbounds i8, ptr %4, i64 8
  call void @File_Construct(ptr noundef nonnull %7) #4
  call void @FileOutStream_CreateVTable(ptr noundef nonnull %5) #4
  %8 = getelementptr inbounds i8, ptr %5, i64 8
  call void @File_Construct(ptr noundef nonnull %8) #4
  %9 = icmp eq i32 %0, 1
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  call void @PrintHelp(ptr noundef %2)
  br label %66

11:                                               ; preds = %3
  %12 = add i32 %0, -5
  %or.cond = icmp ult i32 %12, -2
  br i1 %or.cond, label %17, label %13

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %15) #5
  %.not = icmp eq i64 %16, 1
  br i1 %.not, label %19, label %17

17:                                               ; preds = %13, %11
  %18 = call i32 @PrintUserError(ptr noundef %2)
  br label %66

19:                                               ; preds = %13
  %20 = load i8, ptr %15, align 1, !tbaa !9
  %21 = and i8 %20, -33
  %.not57 = icmp eq i8 %21, 69
  switch i8 %20, label %22 [
    i8 101, label %24
    i8 100, label %24
    i8 69, label %24
    i8 68, label %24
  ]

22:                                               ; preds = %19
  %23 = call i32 @PrintUserError(ptr noundef %2)
  br label %66

24:                                               ; preds = %19, %19, %19, %19
  %25 = getelementptr inbounds i8, ptr %1, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = call i32 @InFile_Open(ptr noundef nonnull %7, ptr noundef %26) #4
  %.not52 = icmp eq i32 %27, 0
  br i1 %.not52, label %30, label %28

28:                                               ; preds = %24
  %29 = call i32 @PrintError(ptr noundef %2, ptr noundef nonnull @.str.10)
  br label %66

30:                                               ; preds = %24
  %31 = icmp ult i32 %0, 4
  br i1 %31, label %38, label %32

32:                                               ; preds = %30
  %33 = getelementptr inbounds i8, ptr %1, i64 24
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = call i32 @OutFile_Open(ptr noundef nonnull %8, ptr noundef %34) #4
  %.not53 = icmp eq i32 %35, 0
  br i1 %.not53, label %40, label %36

36:                                               ; preds = %32
  %37 = call i32 @PrintError(ptr noundef %2, ptr noundef nonnull @.str.11)
  br label %66

38:                                               ; preds = %30
  br i1 %.not57, label %.thread, label %.critedge

.thread:                                          ; preds = %38
  %39 = call i32 @PrintUserError(ptr noundef %2)
  br label %41

40:                                               ; preds = %32
  br i1 %.not57, label %41, label %.critedge

41:                                               ; preds = %.thread, %40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %42 = call i32 @File_GetLength(ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  %43 = load i64, ptr %6, align 8, !tbaa !10
  %44 = call i32 @Encode(ptr noundef nonnull %5, ptr noundef nonnull %4, i64 noundef %43, ptr noundef %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %47

.critedge:                                        ; preds = %38, %40
  %45 = phi ptr [ null, %38 ], [ %4, %40 ]
  %46 = call i32 @Decode(ptr noundef nonnull %5, ptr noundef %45)
  br label %47

47:                                               ; preds = %.critedge, %41
  %.048 = phi i32 [ %44, %41 ], [ %46, %.critedge ]
  br i1 %31, label %50, label %48

48:                                               ; preds = %47
  %49 = call i32 @File_Close(ptr noundef nonnull %8) #4
  br label %50

50:                                               ; preds = %48, %47
  %51 = call i32 @File_Close(ptr noundef nonnull %7) #4
  switch i32 %.048, label %64 [
    i32 0, label %66
    i32 2, label %52
    i32 1, label %55
    i32 9, label %58
    i32 8, label %61
  ]

52:                                               ; preds = %50
  %53 = load ptr, ptr @kCantAllocateMessage, align 8, !tbaa !5
  %54 = call i32 @PrintError(ptr noundef %2, ptr noundef %53)
  br label %66

55:                                               ; preds = %50
  %56 = load ptr, ptr @kDataErrorMessage, align 8, !tbaa !5
  %57 = call i32 @PrintError(ptr noundef %2, ptr noundef %56)
  br label %66

58:                                               ; preds = %50
  %59 = load ptr, ptr @kCantWriteMessage, align 8, !tbaa !5
  %60 = call i32 @PrintError(ptr noundef %2, ptr noundef %59)
  br label %66

61:                                               ; preds = %50
  %62 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %63 = call i32 @PrintError(ptr noundef %2, ptr noundef %62)
  br label %66

64:                                               ; preds = %50
  %65 = call i32 @PrintErrorNumber(ptr noundef %2, i32 noundef %.048)
  br label %66

66:                                               ; preds = %50, %64, %61, %58, %55, %52, %36, %28, %22, %17, %10
  %.1 = phi i32 [ 0, %10 ], [ %18, %17 ], [ %23, %22 ], [ %29, %28 ], [ %37, %36 ], [ %54, %52 ], [ %57, %55 ], [ %60, %58 ], [ %63, %61 ], [ %65, %64 ], [ %.048, %50 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  ret i32 %.1
}

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

declare void @FileSeqInStream_CreateVTable(ptr noundef) local_unnamed_addr #3

declare void @File_Construct(ptr noundef) local_unnamed_addr #3

declare void @FileOutStream_CreateVTable(ptr noundef) local_unnamed_addr #3

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

declare i32 @InFile_Open(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @OutFile_Open(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @File_GetLength(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

declare i32 @File_Close(ptr noundef) local_unnamed_addr #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !11, i64 0}
!11 = !{!"long long", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass