; LLVM IR from mncoppola/rpef :: utilities_src/squashfs2.1/lzma/C/7zip/Compress/LZMA_C (LzmaTest)

; 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._CLzmaDecoderState = type { %struct._CLzmaProperties, ptr }
%struct._CLzmaProperties = type { i32, i32, i32 }

@kCantReadMessage = external dso_local global ptr, align 8
@kCantWriteMessage = external dso_local global ptr, align 8
@kCantAllocateMessage = external dso_local global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1

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

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

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main3(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %struct._CLzmaDecoderState, align 8
  %16 = alloca [5 x i8], align 1
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i8, align 1
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 5, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call i32 @fseek(ptr noundef %24, i64 noundef 0, i32 noundef 2)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call i64 @ftell(ptr noundef %26)
  store i64 %27, ptr %18, align 8, !tbaa !11
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call i32 @fseek(ptr noundef %28, i64 noundef 0, i32 noundef 0)
  %30 = load i64, ptr %18, align 8, !tbaa !11
  %31 = trunc i64 %30 to i32
  %32 = zext i32 %31 to i64
  %33 = load i64, ptr %18, align 8, !tbaa !11
  %34 = icmp ne i64 %32, %33
  br i1 %34, label %35, label %38

35:                                               ; preds = %3
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = call i32 @PrintError(ptr noundef %36, ptr noundef @.str.4)
  store i32 %37, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %42

38:                                               ; preds = %3
  %39 = load i64, ptr %18, align 8, !tbaa !11
  %40 = sub nsw i64 %39, 13
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %13, align 4, !tbaa !9
  store i32 0, ptr %19, align 4
  br label %42

42:                                               ; preds = %38, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  %43 = load i32, ptr %19, align 4
  switch i32 %43, label %226 [
    i32 0, label %44
  ]

44:                                               ; preds = %42
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds [5 x i8], ptr %16, i64 0, i64 0
  %47 = call i32 @MyReadFileAndCheck(ptr noundef %45, ptr noundef %46, i64 noundef 5)
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %53, label %49

49:                                               ; preds = %44
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %52 = call i32 @PrintError(ptr noundef %50, ptr noundef %51)
  store i32 %52, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %226

53:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %94, %53
  %55 = load i32, ptr %20, align 4, !tbaa !9
  %56 = icmp slt i32 %55, 8
  br i1 %56, label %57, label %97

57:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #6
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call i32 @MyReadFileAndCheck(ptr noundef %58, ptr noundef %21, i64 noundef 1)
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %65, label %61

61:                                               ; preds = %57
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %64 = call i32 @PrintError(ptr noundef %62, ptr noundef %63)
  store i32 %64, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %91

65:                                               ; preds = %57
  %66 = load i8, ptr %21, align 1, !tbaa !13
  %67 = zext i8 %66 to i32
  %68 = icmp ne i32 %67, 255
  br i1 %68, label %69, label %70

69:                                               ; preds = %65
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %69, %65
  %71 = load i32, ptr %20, align 4, !tbaa !9
  %72 = icmp slt i32 %71, 4
  br i1 %72, label %73, label %81

73:                                               ; preds = %70
  %74 = load i8, ptr %21, align 1, !tbaa !13
  %75 = zext i8 %74 to i32
  %76 = load i32, ptr %20, align 4, !tbaa !9
  %77 = mul nsw i32 %76, 8
  %78 = shl i32 %75, %77
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = add i32 %79, %78
  store i32 %80, ptr %8, align 4, !tbaa !9
  br label %90

81:                                               ; preds = %70
  %82 = load i8, ptr %21, align 1, !tbaa !13
  %83 = zext i8 %82 to i32
  %84 = load i32, ptr %20, align 4, !tbaa !9
  %85 = sub nsw i32 %84, 4
  %86 = mul nsw i32 %85, 8
  %87 = shl i32 %83, %86
  %88 = load i32, ptr %9, align 4, !tbaa !9
  %89 = add i32 %88, %87
  store i32 %89, ptr %9, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %81, %73
  store i32 0, ptr %19, align 4
  br label %91

91:                                               ; preds = %90, %61
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #6
  %92 = load i32, ptr %19, align 4
  switch i32 %92, label %115 [
    i32 0, label %93
  ]

93:                                               ; preds = %91
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %20, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %20, align 4, !tbaa !9
  br label %54, !llvm.loop !14

97:                                               ; preds = %54
  %98 = load i32, ptr %12, align 4, !tbaa !9
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %97
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = call i32 @PrintError(ptr noundef %101, ptr noundef @.str.5)
  store i32 %102, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %115

103:                                              ; preds = %97
  %104 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %104, ptr %10, align 4, !tbaa !9
  %105 = load i32, ptr %9, align 4, !tbaa !9
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %111, label %107

107:                                              ; preds = %103
  %108 = load i32, ptr %8, align 4, !tbaa !9
  %109 = load i32, ptr %8, align 4, !tbaa !9
  %110 = icmp ne i32 %108, %109
  br i1 %110, label %111, label %114

111:                                              ; preds = %107, %103
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = call i32 @PrintError(ptr noundef %112, ptr noundef @.str.6)
  store i32 %113, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %115

114:                                              ; preds = %107
  store i32 0, ptr %19, align 4
  br label %115

115:                                              ; preds = %114, %111, %100, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  %116 = load i32, ptr %19, align 4
  switch i32 %116, label %226 [
    i32 0, label %117
  ]

117:                                              ; preds = %115
  %118 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 0
  %119 = getelementptr inbounds [5 x i8], ptr %16, i64 0, i64 0
  %120 = call i32 @LzmaDecodeProperties(ptr noundef %118, ptr noundef %119, i32 noundef 5)
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %125

122:                                              ; preds = %117
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = call i32 @PrintError(ptr noundef %123, ptr noundef @.str.7)
  store i32 %124, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %226

125:                                              ; preds = %117
  %126 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 0
  %127 = getelementptr inbounds %struct._CLzmaProperties, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %127, align 8, !tbaa !16
  %129 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 0
  %130 = getelementptr inbounds %struct._CLzmaProperties, ptr %129, i32 0, i32 1
  %131 = load i32, ptr %130, align 4, !tbaa !19
  %132 = add nsw i32 %128, %131
  %133 = shl i32 768, %132
  %134 = add nsw i32 1846, %133
  %135 = sext i32 %134 to i64
  %136 = mul i64 %135, 2
  %137 = call noalias ptr @malloc(i64 noundef %136) #7
  %138 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 1
  store ptr %137, ptr %138, align 8, !tbaa !20
  %139 = load i32, ptr %10, align 4, !tbaa !9
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %125
  store ptr null, ptr %11, align 8, !tbaa !5
  br label %146

142:                                              ; preds = %125
  %143 = load i32, ptr %10, align 4, !tbaa !9
  %144 = zext i32 %143 to i64
  %145 = call noalias ptr @malloc(i64 noundef %144) #7
  store ptr %145, ptr %11, align 8, !tbaa !5
  br label %146

146:                                              ; preds = %142, %141
  %147 = load i32, ptr %13, align 4, !tbaa !9
  %148 = icmp eq i32 %147, 0
  br i1 %148, label %149, label %150

149:                                              ; preds = %146
  store ptr null, ptr %14, align 8, !tbaa !5
  br label %154

150:                                              ; preds = %146
  %151 = load i32, ptr %13, align 4, !tbaa !9
  %152 = zext i32 %151 to i64
  %153 = call noalias ptr @malloc(i64 noundef %152) #7
  store ptr %153, ptr %14, align 8, !tbaa !5
  br label %154

154:                                              ; preds = %150, %149
  %155 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 1
  %156 = load ptr, ptr %155, align 8, !tbaa !20
  %157 = icmp eq ptr %156, null
  br i1 %157, label %170, label %158

158:                                              ; preds = %154
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = icmp eq ptr %159, null
  br i1 %160, label %161, label %164

161:                                              ; preds = %158
  %162 = load i32, ptr %10, align 4, !tbaa !9
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %170, label %164

164:                                              ; preds = %161, %158
  %165 = load ptr, ptr %14, align 8, !tbaa !5
  %166 = icmp eq ptr %165, null
  br i1 %166, label %167, label %178

167:                                              ; preds = %164
  %168 = load i32, ptr %13, align 4, !tbaa !9
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %178

170:                                              ; preds = %167, %161, %154
  %171 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 1
  %172 = load ptr, ptr %171, align 8, !tbaa !20
  call void @free(ptr noundef %172) #6
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %173) #6
  %174 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %174) #6
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = load ptr, ptr @kCantAllocateMessage, align 8, !tbaa !5
  %177 = call i32 @PrintError(ptr noundef %175, ptr noundef %176)
  store i32 %177, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %226

178:                                              ; preds = %167, %164
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = load ptr, ptr %14, align 8, !tbaa !5
  %181 = load i32, ptr %13, align 4, !tbaa !9
  %182 = zext i32 %181 to i64
  %183 = call i32 @MyReadFileAndCheck(ptr noundef %179, ptr noundef %180, i64 noundef %182)
  %184 = icmp ne i32 %183, 0
  br i1 %184, label %189, label %185

185:                                              ; preds = %178
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  %187 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %188 = call i32 @PrintError(ptr noundef %186, ptr noundef %187)
  store i32 %188, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %226

189:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %190 = load ptr, ptr %14, align 8, !tbaa !5
  %191 = load i32, ptr %13, align 4, !tbaa !9
  %192 = load ptr, ptr %11, align 8, !tbaa !5
  %193 = load i32, ptr %10, align 4, !tbaa !9
  %194 = call i32 @LzmaDecode(ptr noundef %15, ptr noundef %190, i32 noundef %191, ptr noundef %22, ptr noundef %192, i32 noundef %193, ptr noundef %23)
  store i32 %194, ptr %17, align 4, !tbaa !9
  %195 = load i32, ptr %17, align 4, !tbaa !9
  %196 = icmp ne i32 %195, 0
  br i1 %196, label %197, label %204

197:                                              ; preds = %189
  %198 = load ptr, ptr %7, align 8, !tbaa !5
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = call i64 @strlen(ptr noundef %199) #8
  %201 = getelementptr inbounds i8, ptr %198, i64 %200
  %202 = load i32, ptr %17, align 4, !tbaa !9
  %203 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %201, ptr noundef @.str.8, i32 noundef %202) #6
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %220

204:                                              ; preds = %189
  %205 = load ptr, ptr %6, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %219

207:                                              ; preds = %204
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = load ptr, ptr %11, align 8, !tbaa !5
  %210 = load i32, ptr %23, align 4, !tbaa !9
  %211 = zext i32 %210 to i64
  %212 = call i32 @MyWriteFileAndCheck(ptr noundef %208, ptr noundef %209, i64 noundef %211)
  %213 = icmp ne i32 %212, 0
  br i1 %213, label %218, label %214

214:                                              ; preds = %207
  %215 = load ptr, ptr %7, align 8, !tbaa !5
  %216 = load ptr, ptr @kCantWriteMessage, align 8, !tbaa !5
  %217 = call i32 @PrintError(ptr noundef %215, ptr noundef %216)
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %218

218:                                              ; preds = %214, %207
  br label %219

219:                                              ; preds = %218, %204
  br label %220

220:                                              ; preds = %219, %197
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  %221 = getelementptr inbounds %struct._CLzmaDecoderState, ptr %15, i32 0, i32 1
  %222 = load ptr, ptr %221, align 8, !tbaa !20
  call void @free(ptr noundef %222) #6
  %223 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %223) #6
  %224 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %224) #6
  %225 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %225, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %226

226:                                              ; preds = %220, %185, %170, %122, %115, %49, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 5, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %227 = load i32, ptr %4, align 4
  ret i32 %227
}

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

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #4

declare i64 @ftell(ptr noundef) #4

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

declare i32 @LzmaDecodeProperties(ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

declare i32 @LzmaDecode(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

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 "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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !10, i64 0}
!17 = !{!"_CLzmaDecoderState", !18, i64 0, !6, i64 16}
!18 = !{!"_CLzmaProperties", !10, i64 0, !10, i64 4, !10, i64 8}
!19 = !{!17, !10, i64 4}
!20 = !{!17, !6, i64 16}


; 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._CLzmaDecoderState = type { %struct._CLzmaProperties, ptr }
%struct._CLzmaProperties = type { i32, i32, i32 }

@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
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main3(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct._CLzmaDecoderState, align 8
  %5 = alloca [5 x i8], align 1
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %5) #7
  %9 = tail call i32 @fseek(ptr noundef %0, i64 noundef 0, i32 noundef 2)
  %10 = tail call i64 @ftell(ptr noundef %0)
  %11 = tail call i32 @fseek(ptr noundef %0, i64 noundef 0, i32 noundef 0)
  %.not = icmp ult i64 %10, 4294967296
  br i1 %.not, label %14, label %12

12:                                               ; preds = %3
  %13 = tail call i32 @PrintError(ptr noundef %2, ptr noundef nonnull @.str.4)
  br label %.thread110

14:                                               ; preds = %3
  %15 = trunc nuw i64 %10 to i32
  %16 = add i32 %15, -13
  %17 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 5)
  %.not86 = icmp eq i32 %17, 0
  br i1 %.not86, label %19, label %.preheader.preheader

.preheader.preheader:                             ; preds = %14
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %18 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not = icmp eq i32 %18, 0
  br i1 %.not89.not, label %22, label %.preheader.1

19:                                               ; preds = %14
  %20 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %21 = call i32 @PrintError(ptr noundef %2, ptr noundef %20)
  br label %.thread110

22:                                               ; preds = %.preheader.7, %.preheader.6, %.preheader.5, %.preheader.4, %.preheader.3, %.preheader.2, %.preheader.1, %.preheader.preheader
  %23 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %24 = call i32 @PrintError(ptr noundef %2, ptr noundef %23)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  br label %.thread110

.preheader.1:                                     ; preds = %.preheader.preheader
  %25 = load i8, ptr %6, align 1, !tbaa !9
  %.not90 = icmp ne i8 %25, -1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %26 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.1 = icmp eq i32 %26, 0
  br i1 %.not89.not.1, label %22, label %.preheader.2

.preheader.2:                                     ; preds = %.preheader.1
  %27 = load i8, ptr %6, align 1, !tbaa !9
  %.not90.1 = icmp ne i8 %27, -1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %28 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.2 = icmp eq i32 %28, 0
  br i1 %.not89.not.2, label %22, label %.preheader.3

.preheader.3:                                     ; preds = %.preheader.2
  %29 = load i8, ptr %6, align 1, !tbaa !9
  %.not90.2 = icmp ne i8 %29, -1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %30 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.3 = icmp eq i32 %30, 0
  br i1 %.not89.not.3, label %22, label %.preheader.4

.preheader.4:                                     ; preds = %.preheader.3
  %31 = zext i8 %29 to i32
  %32 = shl nuw nsw i32 %31, 16
  %33 = zext i8 %27 to i32
  %34 = shl nuw nsw i32 %33, 8
  %35 = zext i8 %25 to i32
  %36 = or disjoint i32 %34, %35
  %37 = or disjoint i32 %32, %36
  %38 = load i8, ptr %6, align 1, !tbaa !9
  %.not90.3 = icmp ne i8 %38, -1
  %39 = zext i8 %38 to i32
  %40 = shl nuw i32 %39, 24
  %41 = or disjoint i32 %40, %37
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %42 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.4 = icmp eq i32 %42, 0
  br i1 %.not89.not.4, label %22, label %.preheader.5

.preheader.5:                                     ; preds = %.preheader.4
  %43 = load i8, ptr %6, align 1, !tbaa !9
  %.not90.4 = icmp ne i8 %43, -1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %44 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.5 = icmp eq i32 %44, 0
  br i1 %.not89.not.5, label %22, label %.preheader.6

.preheader.6:                                     ; preds = %.preheader.5
  %45 = load i8, ptr %6, align 1, !tbaa !9
  %.not90.5 = icmp ne i8 %45, -1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %46 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.6 = icmp eq i32 %46, 0
  br i1 %.not89.not.6, label %22, label %.preheader.7

.preheader.7:                                     ; preds = %.preheader.6
  %47 = load i8, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #7
  %48 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %.not89.not.7 = icmp eq i32 %48, 0
  br i1 %.not89.not.7, label %22, label %49

49:                                               ; preds = %.preheader.7
  %.not90.6 = icmp ne i8 %47, -1
  %50 = load i8, ptr %6, align 1, !tbaa !9
  %.not90.7 = icmp ne i8 %50, -1
  %.not133 = select i1 %.not90.7, i1 true, i1 %.not90.6
  %.not132 = select i1 %.not133, i1 true, i1 %.not90.5
  %.not130 = select i1 %.not132, i1 true, i1 %.not90.4
  %.not128 = select i1 %.not130, i1 true, i1 %.not90.3
  %.not126 = select i1 %.not128, i1 true, i1 %.not90.2
  %.not124 = select i1 %.not126, i1 true, i1 %.not90.1
  %narrow = select i1 %.not124, i1 true, i1 %.not90
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #7
  br i1 %narrow, label %53, label %51

51:                                               ; preds = %49
  %52 = call i32 @PrintError(ptr noundef %2, ptr noundef nonnull @.str.5)
  br label %.thread110

53:                                               ; preds = %49
  %54 = zext i8 %50 to i32
  %55 = shl nuw i32 %54, 24
  %56 = zext i8 %47 to i32
  %57 = shl nuw nsw i32 %56, 16
  %58 = zext i8 %45 to i32
  %59 = shl nuw nsw i32 %58, 8
  %60 = zext i8 %43 to i32
  %61 = or disjoint i32 %59, %60
  %62 = or disjoint i32 %57, %61
  %63 = or disjoint i32 %55, %62
  %.not88 = icmp eq i32 %63, 0
  br i1 %.not88, label %66, label %64

64:                                               ; preds = %53
  %65 = call i32 @PrintError(ptr noundef %2, ptr noundef nonnull @.str.6)
  br label %.thread110

66:                                               ; preds = %53
  %67 = call i32 @LzmaDecodeProperties(ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 5) #7
  %.not91 = icmp eq i32 %67, 0
  br i1 %.not91, label %70, label %68

68:                                               ; preds = %66
  %69 = call i32 @PrintError(ptr noundef %2, ptr noundef nonnull @.str.7)
  br label %.thread110

70:                                               ; preds = %66
  %71 = load i32, ptr %4, align 8, !tbaa !10
  %72 = getelementptr inbounds i8, ptr %4, i64 4
  %73 = load i32, ptr %72, align 4, !tbaa !14
  %74 = add nsw i32 %73, %71
  %75 = shl i32 768, %74
  %76 = add nuw nsw i32 %75, 1846
  %77 = sext i32 %76 to i64
  %78 = shl nsw i64 %77, 1
  %79 = call noalias ptr @malloc(i64 noundef %78) #8
  %80 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %79, ptr %80, align 8, !tbaa !15
  %81 = icmp eq i32 %41, 0
  br i1 %81, label %85, label %82

82:                                               ; preds = %70
  %83 = zext i32 %41 to i64
  %84 = call noalias ptr @malloc(i64 noundef %83) #8
  br label %85

85:                                               ; preds = %70, %82
  %.074 = phi ptr [ %84, %82 ], [ null, %70 ]
  %86 = icmp eq i32 %16, 0
  br i1 %86, label %90, label %87

87:                                               ; preds = %85
  %88 = zext i32 %16 to i64
  %89 = call noalias ptr @malloc(i64 noundef %88) #8
  br label %90

90:                                               ; preds = %85, %87
  %.069 = phi ptr [ %89, %87 ], [ null, %85 ]
  %91 = icmp eq ptr %79, null
  br i1 %91, label %98, label %92

92:                                               ; preds = %90
  %93 = icmp eq ptr %.074, null
  %94 = icmp ne i32 %41, 0
  %or.cond = select i1 %93, i1 %94, i1 false
  br i1 %or.cond, label %98, label %95

95:                                               ; preds = %92
  %96 = icmp eq ptr %.069, null
  %97 = icmp ne i32 %16, 0
  %or.cond5 = select i1 %96, i1 %97, i1 false
  br i1 %or.cond5, label %98, label %101

98:                                               ; preds = %95, %92, %90
  call void @free(ptr noundef %79) #7
  call void @free(ptr noundef %.074) #7
  call void @free(ptr noundef %.069) #7
  %99 = load ptr, ptr @kCantAllocateMessage, align 8, !tbaa !5
  %100 = call i32 @PrintError(ptr noundef %2, ptr noundef %99)
  br label %.thread110

101:                                              ; preds = %95
  %102 = zext i32 %16 to i64
  %103 = call i32 @MyReadFileAndCheck(ptr noundef %0, ptr noundef %.069, i64 noundef %102)
  %.not92 = icmp eq i32 %103, 0
  br i1 %.not92, label %104, label %107

104:                                              ; preds = %101
  %105 = load ptr, ptr @kCantReadMessage, align 8, !tbaa !5
  %106 = call i32 @PrintError(ptr noundef %2, ptr noundef %105)
  br label %.thread110

107:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %108 = call i32 @LzmaDecode(ptr noundef nonnull %4, ptr noundef %.069, i32 noundef %16, ptr noundef nonnull %7, ptr noundef %.074, i32 noundef %41, ptr noundef nonnull %8) #7
  %.not93 = icmp eq i32 %108, 0
  br i1 %.not93, label %113, label %109

109:                                              ; preds = %107
  %110 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #9
  %111 = getelementptr inbounds i8, ptr %2, i64 %110
  %112 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %111, ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %108) #7
  br label %121

113:                                              ; preds = %107
  %.not94 = icmp eq ptr %1, null
  br i1 %.not94, label %121, label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %8, align 4, !tbaa !16
  %116 = zext i32 %115 to i64
  %117 = call i32 @MyWriteFileAndCheck(ptr noundef nonnull %1, ptr noundef %.074, i64 noundef %116)
  %.not95 = icmp eq i32 %117, 0
  br i1 %.not95, label %118, label %121

118:                                              ; preds = %114
  %119 = load ptr, ptr @kCantWriteMessage, align 8, !tbaa !5
  %120 = call i32 @PrintError(ptr noundef %2, ptr noundef %119)
  br label %121

121:                                              ; preds = %113, %118, %114, %109
  %.068 = phi i32 [ 1, %109 ], [ 0, %114 ], [ 1, %118 ], [ 0, %113 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  %122 = load ptr, ptr %80, align 8, !tbaa !15
  call void @free(ptr noundef %122) #7
  call void @free(ptr noundef %.074) #7
  call void @free(ptr noundef %.069) #7
  br label %.thread110

.thread110:                                       ; preds = %64, %51, %22, %12, %121, %104, %98, %68, %19
  %.4 = phi i32 [ %69, %68 ], [ %100, %98 ], [ %.068, %121 ], [ %106, %104 ], [ %21, %19 ], [ %13, %12 ], [ %65, %64 ], [ %52, %51 ], [ %24, %22 ]
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  ret i32 %.4
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(ptr nocapture noundef) local_unnamed_addr #1

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

declare i32 @LzmaDecodeProperties(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

declare i32 @LzmaDecode(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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 = { 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 #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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, !13, i64 0}
!11 = !{!"_CLzmaDecoderState", !12, i64 0, !6, i64 16}
!12 = !{!"_CLzmaProperties", !13, i64 0, !13, i64 4, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!11, !13, i64 4}
!15 = !{!11, !6, i64 16}
!16 = !{!13, !13, i64 0}


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