; LLVM IR from artagnon/phoenixfs :: t (test-diff)

; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@stdout = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %struct.stat, align 8
  %12 = alloca %struct.stat, align 8
  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 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 144, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 144, ptr %12) #4
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 3
  br i1 %14, label %15, label %19

15:                                               ; preds = %2
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  call void @usage(ptr noundef %18)
  br label %19

19:                                               ; preds = %15, %2
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = getelementptr inbounds ptr, ptr %20, i64 1
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = call i32 @stat(ptr noundef %22, ptr noundef %11) #4
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %29

25:                                               ; preds = %19
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 1
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  call void (ptr, ...) @die(ptr noundef @.str, ptr noundef %28)
  br label %29

29:                                               ; preds = %25, %19
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 1
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = call noalias ptr @fopen(ptr noundef %32, ptr noundef @.str.1)
  store ptr %33, ptr %6, align 8, !tbaa !9
  %34 = icmp ne ptr %33, null
  br i1 %34, label %39, label %35

35:                                               ; preds = %29
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 1
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  call void (ptr, ...) @die(ptr noundef @.str.2, ptr noundef %38)
  br label %39

39:                                               ; preds = %35, %29
  %40 = getelementptr inbounds %struct.stat, ptr %11, i32 0, i32 8
  %41 = load i64, ptr %40, align 8, !tbaa !11
  store i64 %41, ptr %9, align 8, !tbaa !15
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = getelementptr inbounds ptr, ptr %42, i64 2
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = call i32 @stat(ptr noundef %44, ptr noundef %12) #4
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %51

47:                                               ; preds = %39
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %48, i64 2
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  call void (ptr, ...) @die(ptr noundef @.str, ptr noundef %50)
  br label %51

51:                                               ; preds = %47, %39
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = getelementptr inbounds ptr, ptr %52, i64 2
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call noalias ptr @fopen(ptr noundef %54, ptr noundef @.str.1)
  store ptr %55, ptr %7, align 8, !tbaa !9
  %56 = icmp ne ptr %55, null
  br i1 %56, label %61, label %57

57:                                               ; preds = %51
  %58 = load ptr, ptr %5, align 8, !tbaa !9
  %59 = getelementptr inbounds ptr, ptr %58, i64 2
  %60 = load ptr, ptr %59, align 8, !tbaa !9
  call void (ptr, ...) @die(ptr noundef @.str.2, ptr noundef %60)
  br label %61

61:                                               ; preds = %57, %51
  %62 = getelementptr inbounds %struct.stat, ptr %12, i32 0, i32 8
  %63 = load i64, ptr %62, align 8, !tbaa !11
  store i64 %63, ptr %10, align 8, !tbaa !15
  %64 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %64, ptr %8, align 8, !tbaa !9
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 3
  br i1 %66, label %67, label %78

67:                                               ; preds = %61
  %68 = load ptr, ptr %5, align 8, !tbaa !9
  %69 = getelementptr inbounds ptr, ptr %68, i64 3
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  %71 = call noalias ptr @fopen(ptr noundef %70, ptr noundef @.str.3)
  store ptr %71, ptr %8, align 8, !tbaa !9
  %72 = icmp ne ptr %71, null
  br i1 %72, label %77, label %73

73:                                               ; preds = %67
  %74 = load ptr, ptr %5, align 8, !tbaa !9
  %75 = getelementptr inbounds ptr, ptr %74, i64 3
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  call void (ptr, ...) @die(ptr noundef @.str.2, ptr noundef %76)
  br label %77

77:                                               ; preds = %73, %67
  br label %78

78:                                               ; preds = %77, %61
  %79 = load ptr, ptr %6, align 8, !tbaa !9
  %80 = load i64, ptr %9, align 8, !tbaa !15
  %81 = load ptr, ptr %7, align 8, !tbaa !9
  %82 = load i64, ptr %10, align 8, !tbaa !15
  %83 = load ptr, ptr %8, align 8, !tbaa !9
  %84 = call i32 @phoenixfs_diff(ptr noundef %79, i64 noundef %80, ptr noundef %81, i64 noundef %82, ptr noundef %83)
  %85 = load ptr, ptr %6, align 8, !tbaa !9
  %86 = call i32 @fclose(ptr noundef %85)
  %87 = load ptr, ptr %7, align 8, !tbaa !9
  %88 = call i32 @fclose(ptr noundef %87)
  %89 = load ptr, ptr %8, align 8, !tbaa !9
  %90 = icmp ne ptr %89, null
  br i1 %90, label %91, label %94

91:                                               ; preds = %78
  %92 = load ptr, ptr %8, align 8, !tbaa !9
  %93 = call i32 @fclose(ptr noundef %92)
  br label %94

94:                                               ; preds = %91, %78
  call void @llvm.lifetime.end.p0(i64 144, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 144, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, 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
  ret i32 0
}

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

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

; Function Attrs: nounwind
declare i32 @stat(ptr noundef, ptr noundef) #2

declare void @die(ptr noundef, ...) #3

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

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

declare i32 @fclose(ptr noundef) #3

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

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 = { 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 = { 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 = !{!12, !13, i64 48}
!12 = !{!"stat", !13, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !14, i64 72, !14, i64 88, !14, i64 104, !7, i64 120}
!13 = !{!"long", !7, i64 0}
!14 = !{!"timespec", !13, i64 0, !13, i64 8}
!15 = !{!13, !13, 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.stat, align 8
  %4 = alloca %struct.stat, align 8
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %4) #4
  %5 = icmp slt i32 %0, 3
  br i1 %5, label %6, label %8

6:                                                ; preds = %2
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %7)
  br label %8

8:                                                ; preds = %6, %2
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = call i32 @stat(ptr noundef %10, ptr noundef nonnull %3) #4
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %14, label %12

12:                                               ; preds = %8
  %13 = load ptr, ptr %9, align 8, !tbaa !5
  tail call void (ptr, ...) @die(ptr noundef nonnull @.str, ptr noundef %13) #4
  br label %14

14:                                               ; preds = %12, %8
  %15 = load ptr, ptr %9, align 8, !tbaa !5
  %16 = tail call noalias ptr @fopen(ptr noundef %15, ptr noundef nonnull @.str.1)
  %.not22 = icmp eq ptr %16, null
  br i1 %.not22, label %17, label %19

17:                                               ; preds = %14
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  tail call void (ptr, ...) @die(ptr noundef nonnull @.str.2, ptr noundef %18) #4
  br label %19

19:                                               ; preds = %17, %14
  %20 = getelementptr inbounds i8, ptr %3, i64 48
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = call i32 @stat(ptr noundef %23, ptr noundef nonnull %4) #4
  %.not23 = icmp eq i32 %24, 0
  br i1 %.not23, label %27, label %25

25:                                               ; preds = %19
  %26 = load ptr, ptr %22, align 8, !tbaa !5
  tail call void (ptr, ...) @die(ptr noundef nonnull @.str, ptr noundef %26) #4
  br label %27

27:                                               ; preds = %25, %19
  %28 = load ptr, ptr %22, align 8, !tbaa !5
  %29 = tail call noalias ptr @fopen(ptr noundef %28, ptr noundef nonnull @.str.1)
  %.not24 = icmp eq ptr %29, null
  br i1 %.not24, label %30, label %32

30:                                               ; preds = %27
  %31 = load ptr, ptr %22, align 8, !tbaa !5
  tail call void (ptr, ...) @die(ptr noundef nonnull @.str.2, ptr noundef %31) #4
  br label %32

32:                                               ; preds = %30, %27
  %33 = getelementptr inbounds i8, ptr %4, i64 48
  %34 = load i64, ptr %33, align 8, !tbaa !9
  %35 = load ptr, ptr @stdout, align 8, !tbaa !5
  %36 = icmp sgt i32 %0, 3
  br i1 %36, label %37, label %43

37:                                               ; preds = %32
  %38 = getelementptr inbounds i8, ptr %1, i64 24
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = tail call noalias ptr @fopen(ptr noundef %39, ptr noundef nonnull @.str.3)
  %.not25 = icmp eq ptr %40, null
  br i1 %.not25, label %41, label %43

41:                                               ; preds = %37
  %42 = load ptr, ptr %38, align 8, !tbaa !5
  tail call void (ptr, ...) @die(ptr noundef nonnull @.str.2, ptr noundef %42) #4
  br label %43

43:                                               ; preds = %37, %41, %32
  %.0 = phi ptr [ %40, %37 ], [ null, %41 ], [ %35, %32 ]
  %44 = tail call i32 @phoenixfs_diff(ptr noundef %16, i64 noundef %21, ptr noundef %29, i64 noundef %34, ptr noundef %.0) #4
  %45 = tail call i32 @fclose(ptr noundef %16)
  %46 = tail call i32 @fclose(ptr noundef %29)
  %.not26 = icmp eq ptr %.0, null
  br i1 %.not26, label %49, label %47

47:                                               ; preds = %43
  %48 = tail call i32 @fclose(ptr noundef nonnull %.0)
  br label %49

49:                                               ; preds = %47, %43
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %3) #4
  ret i32 0
}

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

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

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

declare void @die(ptr noundef, ...) local_unnamed_addr #3

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

declare i32 @phoenixfs_diff(ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

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

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!10, !11, i64 48}
!10 = !{!"stat", !11, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !13, i64 72, !13, i64 88, !13, i64 104, !7, i64 120}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"timespec", !11, i64 0, !11, i64 8}


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