; LLVM IR from ANL-CESAR/XSBench :: opencl (io)

; 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.Inputs = type { i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @border_print() #0

declare i32 @printf(ptr noundef, ...) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @print_results(ptr noundef byval(%struct.Inputs) align 8 %0, i32 noundef %1, double noundef %2, i32 noundef %3, i64 noundef %4, double noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  store i32 %1, ptr %7, align 4, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !5
  store i64 %4, ptr %10, align 8, !tbaa !11
  store double %5, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !5
  %18 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %27

21:                                               ; preds = %6
  %22 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 3
  %23 = load i32, ptr %22, align 8, !tbaa !16
  %24 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 7
  %25 = load i32, ptr %24, align 8, !tbaa !17
  %26 = mul nsw i32 %23, %25
  store i32 %26, ptr %12, align 4, !tbaa !5
  br label %35

27:                                               ; preds = %6
  %28 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = icmp eq i32 %29, 2
  br i1 %30, label %31, label %34

31:                                               ; preds = %27
  %32 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 3
  %33 = load i32, ptr %32, align 8, !tbaa !16
  store i32 %33, ptr %12, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %31, %27
  br label %35

35:                                               ; preds = %34, %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %36 = load i32, ptr %12, align 4, !tbaa !5
  %37 = sitofp i32 %36 to double
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = fdiv double %37, %38
  %40 = fptosi double %39 to i32
  store i32 %40, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %41 = load i32, ptr %12, align 4, !tbaa !5
  %42 = sitofp i32 %41 to double
  %43 = load double, ptr %11, align 8, !tbaa !9
  %44 = fdiv double %42, %43
  %45 = fptosi double %44 to i32
  store i32 %45, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 1, ptr %15, align 4, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %65

48:                                               ; preds = %35
  call void @border_print()
  call void @center_print(ptr noundef @.str.5, i32 noundef 79)
  call void @border_print()
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %51 = load double, ptr %8, align 8, !tbaa !9
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, double noundef %51)
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  call void @fancy_int(i64 noundef %55)
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %57 = load i32, ptr %13, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  call void @fancy_int(i64 noundef %58)
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %60 = load double, ptr %11, align 8, !tbaa !9
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, double noundef %60)
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %63 = load i32, ptr %14, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  call void @fancy_int(i64 noundef %64)
  br label %65

65:                                               ; preds = %48, %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store i64 0, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store i64 0, ptr %17, align 8, !tbaa !11
  %66 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %67 = load i32, ptr %66, align 4, !tbaa !13
  %68 = icmp eq i32 %67, 2
  br i1 %68, label %69, label %70

69:                                               ; preds = %65
  store i64 945990, ptr %17, align 8, !tbaa !11
  store i64 952131, ptr %16, align 8, !tbaa !11
  br label %76

70:                                               ; preds = %65
  %71 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %72 = load i32, ptr %71, align 4, !tbaa !13
  %73 = icmp eq i32 %72, 1
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  store i64 941535, ptr %17, align 8, !tbaa !11
  store i64 954318, ptr %16, align 8, !tbaa !11
  br label %75

75:                                               ; preds = %74, %70
  br label %76

76:                                               ; preds = %75, %69
  %77 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 4
  %78 = load i32, ptr %77, align 4, !tbaa !18
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %86

80:                                               ; preds = %76
  %81 = load i64, ptr %10, align 8, !tbaa !11
  %82 = load i64, ptr %16, align 8, !tbaa !11
  %83 = icmp eq i64 %81, %82
  br i1 %83, label %84, label %85

84:                                               ; preds = %80
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %84, %80
  br label %97

86:                                               ; preds = %76
  %87 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 4
  %88 = load i32, ptr %87, align 4, !tbaa !18
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %96

90:                                               ; preds = %86
  %91 = load i64, ptr %10, align 8, !tbaa !11
  %92 = load i64, ptr %17, align 8, !tbaa !11
  %93 = icmp eq i64 %91, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %90
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %94, %90
  br label %96

96:                                               ; preds = %95, %86
  br label %97

97:                                               ; preds = %96, %85
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %110

100:                                              ; preds = %97
  %101 = load i32, ptr %15, align 4, !tbaa !5
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %106

103:                                              ; preds = %100
  %104 = load i64, ptr %10, align 8, !tbaa !11
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i64 noundef %104)
  br label %109

106:                                              ; preds = %100
  %107 = load i64, ptr %10, align 8, !tbaa !11
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i64 noundef %107)
  br label %109

109:                                              ; preds = %106, %103
  call void @border_print()
  br label %110

110:                                              ; preds = %109, %97
  %111 = load i32, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  ret i32 %111
}

; Function Attrs: nounwind uwtable
declare dso_local void @fancy_int(i64 noundef) #0

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 = { "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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !6, i64 44}
!14 = !{!"", !6, i64 0, !15, i64 8, !15, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !6, i64 24}
!17 = !{!14, !6, i64 40}
!18 = !{!14, !6, i64 28}


; 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.Inputs = type { i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @border_print() local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @print_results(ptr nocapture noundef readonly byval(%struct.Inputs) align 8 %0, i32 noundef %1, double noundef %2, i32 noundef %3, i64 noundef %4, double noundef %5) local_unnamed_addr #0 {
  %7 = getelementptr inbounds i8, ptr %0, i64 44
  %8 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %8, label %18 [
    i32 1, label %9
    i32 2, label %15
  ]

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  %13 = load i32, ptr %12, align 8, !tbaa !12
  %14 = mul nsw i32 %13, %11
  br label %18

15:                                               ; preds = %6
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load i32, ptr %16, align 8, !tbaa !11
  br label %18

18:                                               ; preds = %6, %15, %9
  %.020 = phi i32 [ %14, %9 ], [ %17, %15 ], [ 0, %6 ]
  %19 = icmp eq i32 %1, 0
  br i1 %19, label %20, label %37

20:                                               ; preds = %18
  %21 = sitofp i32 %.020 to double
  %22 = fdiv double %21, %5
  %23 = fptosi double %22 to i32
  %24 = fdiv double %21, %2
  %25 = fptosi double %24 to i32
  tail call void @border_print()
  tail call void @center_print(ptr noundef nonnull @.str.5, i32 noundef 79)
  tail call void @border_print()
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, double noundef %2)
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %30 = sext i32 %.020 to i64
  tail call void @fancy_int(i64 noundef %30)
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %32 = sext i32 %25 to i64
  tail call void @fancy_int(i64 noundef %32)
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, double noundef %5)
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %36 = sext i32 %23 to i64
  tail call void @fancy_int(i64 noundef %36)
  br label %37

37:                                               ; preds = %20, %18
  switch i32 %8, label %.fold.split [
    i32 2, label %39
    i32 1, label %38
  ]

38:                                               ; preds = %37
  br label %39

.fold.split:                                      ; preds = %37
  br label %39

39:                                               ; preds = %37, %.fold.split, %38
  %.018 = phi i64 [ 954318, %38 ], [ 952131, %37 ], [ 0, %.fold.split ]
  %.0 = phi i64 [ 941535, %38 ], [ 945990, %37 ], [ 0, %.fold.split ]
  %40 = getelementptr inbounds i8, ptr %0, i64 28
  %41 = load i32, ptr %40, align 4, !tbaa !13
  switch i32 %41, label %.thread [
    i32 1, label %43
    i32 0, label %42
  ]

42:                                               ; preds = %39
  br label %43

43:                                               ; preds = %39, %42
  %.018.pn = phi i64 [ %.0, %42 ], [ %.018, %39 ]
  %.not = icmp ne i64 %.018.pn, %4
  %.019 = zext i1 %.not to i32
  br i1 %19, label %44, label %46

.thread:                                          ; preds = %39
  br i1 %19, label %.thread32, label %46

44:                                               ; preds = %43
  %spec.select = select i1 %.not, ptr @.str.12, ptr @.str.13
  %spec.select38 = zext i1 %.not to i32
  br label %.thread32

.thread32:                                        ; preds = %44, %.thread
  %.str.13.sink = phi ptr [ @.str.12, %.thread ], [ %spec.select, %44 ]
  %.0193135 = phi i32 [ 1, %.thread ], [ %spec.select38, %44 ]
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.13.sink, i64 noundef %4)
  tail call void @border_print()
  br label %46

46:                                               ; preds = %.thread, %.thread32, %43
  %.01930 = phi i32 [ 1, %.thread ], [ %.0193135, %.thread32 ], [ %.019, %43 ]
  ret i32 %.01930
}

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

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

!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, !7, i64 44}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !7, i64 24}
!12 = !{!6, !7, i64 40}
!13 = !{!6, !7, i64 28}


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