; LLVM IR from nbosb/simdal :: deps/sqlite/src (shell)

; 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"

@.str.32 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [18 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @deduceDatabaseType(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca [100 x i8], align 16
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = call noalias ptr @fopen64(ptr noundef %11, ptr noundef @.str.32)
  store ptr %12, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 100, ptr %9) #4
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %24

15:                                               ; preds = %2
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %23

18:                                               ; preds = %15
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call i32 @sqlite3_strlike(ptr noundef @.str.33, ptr noundef %19, i32 noundef 0)
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  store i32 3, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %96

23:                                               ; preds = %18, %15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %96

24:                                               ; preds = %2
  %25 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 0
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = call i64 @fread(ptr noundef %25, i64 noundef 16, i64 noundef 1, ptr noundef %26)
  store i64 %27, ptr %7, align 8, !tbaa !11
  %28 = load i64, ptr %7, align 8, !tbaa !11
  %29 = icmp eq i64 %28, 1
  br i1 %29, label %30, label %37

30:                                               ; preds = %24
  %31 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 0
  %32 = call i32 @memcmp(ptr noundef %31, ptr noundef @.str.34, i64 noundef 16) #5
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %30
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call i32 @fclose(ptr noundef %35)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %96

37:                                               ; preds = %30, %24
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call i32 @fseek(ptr noundef %38, i64 noundef -25, i32 noundef 2)
  %40 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 0
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = call i64 @fread(ptr noundef %40, i64 noundef 25, i64 noundef 1, ptr noundef %41)
  store i64 %42, ptr %7, align 8, !tbaa !11
  %43 = load i64, ptr %7, align 8, !tbaa !11
  %44 = icmp eq i64 %43, 1
  br i1 %44, label %45, label %50

45:                                               ; preds = %37
  %46 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 0
  %47 = call i32 @memcmp(ptr noundef %46, ptr noundef @.str.35, i64 noundef 17) #5
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  store i32 2, ptr %8, align 4, !tbaa !9
  br label %92

50:                                               ; preds = %45, %37
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = call i32 @fseek(ptr noundef %51, i64 noundef -22, i32 noundef 2)
  %53 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 0
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = call i64 @fread(ptr noundef %53, i64 noundef 22, i64 noundef 1, ptr noundef %54)
  store i64 %55, ptr %7, align 8, !tbaa !11
  %56 = load i64, ptr %7, align 8, !tbaa !11
  %57 = icmp eq i64 %56, 1
  br i1 %57, label %58, label %79

58:                                               ; preds = %50
  %59 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 0
  %60 = load i8, ptr %59, align 16, !tbaa !13
  %61 = sext i8 %60 to i32
  %62 = icmp eq i32 %61, 80
  br i1 %62, label %63, label %79

63:                                               ; preds = %58
  %64 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 1
  %65 = load i8, ptr %64, align 1, !tbaa !13
  %66 = sext i8 %65 to i32
  %67 = icmp eq i32 %66, 75
  br i1 %67, label %68, label %79

68:                                               ; preds = %63
  %69 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 2
  %70 = load i8, ptr %69, align 2, !tbaa !13
  %71 = sext i8 %70 to i32
  %72 = icmp eq i32 %71, 5
  br i1 %72, label %73, label %79

73:                                               ; preds = %68
  %74 = getelementptr inbounds [100 x i8], ptr %9, i64 0, i64 3
  %75 = load i8, ptr %74, align 1, !tbaa !13
  %76 = sext i8 %75 to i32
  %77 = icmp eq i32 %76, 6
  br i1 %77, label %78, label %79

78:                                               ; preds = %73
  store i32 3, ptr %8, align 4, !tbaa !9
  br label %91

79:                                               ; preds = %73, %68, %63, %58, %50
  %80 = load i64, ptr %7, align 8, !tbaa !11
  %81 = icmp eq i64 %80, 0
  br i1 %81, label %82, label %90

82:                                               ; preds = %79
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %90

85:                                               ; preds = %82
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = call i32 @sqlite3_strlike(ptr noundef @.str.33, ptr noundef %86, i32 noundef 0)
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %90

89:                                               ; preds = %85
  store i32 3, ptr %8, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %89, %85, %82, %79
  br label %91

91:                                               ; preds = %90, %78
  br label %92

92:                                               ; preds = %91, %49
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = call i32 @fclose(ptr noundef %93)
  %95 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %95, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %96

96:                                               ; preds = %92, %34, %23, %22
  call void @llvm.lifetime.end.p0(i64 100, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %97 = load i32, ptr %3, align 4
  ret i32 %97
}

declare noalias ptr @fopen64(ptr noundef, ptr noundef) #3

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

declare i32 @fclose(ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !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"

@.str.32 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [18 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @deduceDatabaseType(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca [100 x i8], align 16
  %4 = tail call noalias ptr @fopen64(ptr noundef %0, ptr noundef nonnull @.str.32)
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %3) #5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %6, label %11

6:                                                ; preds = %2
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %10, label %7

7:                                                ; preds = %6
  %8 = tail call i32 @sqlite3_strlike(ptr noundef nonnull @.str.33, ptr noundef %0, i32 noundef 0) #5
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %38, label %10

10:                                               ; preds = %7, %6
  br label %38

11:                                               ; preds = %2
  %12 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 16, i64 noundef 1, ptr noundef nonnull %4)
  %13 = icmp eq i64 %12, 1
  br i1 %13, label %14, label %18

14:                                               ; preds = %11
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %3, ptr noundef nonnull dereferenceable(16) @.str.34, i64 16)
  %15 = icmp eq i32 %bcmp, 0
  br i1 %15, label %16, label %18

16:                                               ; preds = %14
  %17 = tail call i32 @fclose(ptr noundef nonnull %4)
  br label %38

18:                                               ; preds = %14, %11
  %19 = tail call i32 @fseek(ptr noundef nonnull %4, i64 noundef -25, i32 noundef 2)
  %20 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 25, i64 noundef 1, ptr noundef nonnull %4)
  %21 = icmp eq i64 %20, 1
  br i1 %21, label %22, label %24

22:                                               ; preds = %18
  %bcmp37 = call i32 @bcmp(ptr noundef nonnull dereferenceable(17) %3, ptr noundef nonnull dereferenceable(17) @.str.35, i64 17)
  %23 = icmp eq i32 %bcmp37, 0
  br i1 %23, label %36, label %24

24:                                               ; preds = %22, %18
  %25 = tail call i32 @fseek(ptr noundef nonnull %4, i64 noundef -22, i32 noundef 2)
  %26 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 22, i64 noundef 1, ptr noundef nonnull %4)
  %27 = icmp eq i64 %26, 1
  %28 = load <4 x i8>, ptr %3, align 16
  %.fr = freeze <4 x i8> %28
  %.fr.scalar = bitcast <4 x i8> %.fr to i32
  %29 = icmp eq i32 %.fr.scalar, 101010256
  %op.rdx = and i1 %27, %29
  br i1 %op.rdx, label %36, label %30

30:                                               ; preds = %24
  %31 = icmp eq i64 %26, 0
  %32 = icmp ne i32 %1, 0
  %or.cond17 = and i1 %32, %31
  br i1 %or.cond17, label %33, label %36

33:                                               ; preds = %30
  %34 = tail call i32 @sqlite3_strlike(ptr noundef nonnull @.str.33, ptr noundef %0, i32 noundef 0) #5
  %35 = icmp eq i32 %34, 0
  %spec.select = select i1 %35, i32 3, i32 0
  br label %36

36:                                               ; preds = %33, %24, %22, %30
  %.0 = phi i32 [ 0, %30 ], [ 2, %22 ], [ 3, %24 ], [ %spec.select, %33 ]
  %37 = tail call i32 @fclose(ptr noundef nonnull %4)
  br label %38

38:                                               ; preds = %7, %36, %16, %10
  %.035 = phi i32 [ 1, %10 ], [ 1, %16 ], [ %.0, %36 ], [ 3, %7 ]
  call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %3) #5
  ret i32 %.035
}

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass