; LLVM IR from tangjz/acm-icpc :: poj (1004)

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

@tmp = external dso_local global double, align 8
@ans = external dso_local global double, align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %3

3:                                                ; preds = %12, %0
  %4 = load i32, ptr %2, align 4, !tbaa !5
  %5 = icmp slt i32 %4, 12
  br i1 %5, label %7, label %6

6:                                                ; preds = %3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  br label %15

7:                                                ; preds = %3
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @tmp)
  %9 = load double, ptr @tmp, align 8, !tbaa !9
  %10 = load double, ptr @ans, align 8, !tbaa !9
  %11 = fadd double %10, %9
  store double %11, ptr @ans, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %7
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %2, align 4, !tbaa !5
  br label %3, !llvm.loop !11

15:                                               ; preds = %6
  %16 = load double, ptr @ans, align 8, !tbaa !9
  %17 = fdiv double %16, 1.200000e+01
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %17)
  ret i32 0
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

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

attributes #0 = { mustprogress norecurse 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 = { "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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

@tmp = external dso_local global double, align 8
@ans = external dso_local local_unnamed_addr global double, align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %2 = load double, ptr @tmp, align 8, !tbaa !5
  %3 = load double, ptr @ans, align 8, !tbaa !5
  %4 = fadd double %2, %3
  store double %4, ptr @ans, align 8, !tbaa !5
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %6 = load double, ptr @tmp, align 8, !tbaa !5
  %7 = load double, ptr @ans, align 8, !tbaa !5
  %8 = fadd double %6, %7
  store double %8, ptr @ans, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %10 = load double, ptr @tmp, align 8, !tbaa !5
  %11 = load double, ptr @ans, align 8, !tbaa !5
  %12 = fadd double %10, %11
  store double %12, ptr @ans, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %14 = load double, ptr @tmp, align 8, !tbaa !5
  %15 = load double, ptr @ans, align 8, !tbaa !5
  %16 = fadd double %14, %15
  store double %16, ptr @ans, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %18 = load double, ptr @tmp, align 8, !tbaa !5
  %19 = load double, ptr @ans, align 8, !tbaa !5
  %20 = fadd double %18, %19
  store double %20, ptr @ans, align 8, !tbaa !5
  %21 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %22 = load double, ptr @tmp, align 8, !tbaa !5
  %23 = load double, ptr @ans, align 8, !tbaa !5
  %24 = fadd double %22, %23
  store double %24, ptr @ans, align 8, !tbaa !5
  %25 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %26 = load double, ptr @tmp, align 8, !tbaa !5
  %27 = load double, ptr @ans, align 8, !tbaa !5
  %28 = fadd double %26, %27
  store double %28, ptr @ans, align 8, !tbaa !5
  %29 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %30 = load double, ptr @tmp, align 8, !tbaa !5
  %31 = load double, ptr @ans, align 8, !tbaa !5
  %32 = fadd double %30, %31
  store double %32, ptr @ans, align 8, !tbaa !5
  %33 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %34 = load double, ptr @tmp, align 8, !tbaa !5
  %35 = load double, ptr @ans, align 8, !tbaa !5
  %36 = fadd double %34, %35
  store double %36, ptr @ans, align 8, !tbaa !5
  %37 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %38 = load double, ptr @tmp, align 8, !tbaa !5
  %39 = load double, ptr @ans, align 8, !tbaa !5
  %40 = fadd double %38, %39
  store double %40, ptr @ans, align 8, !tbaa !5
  %41 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %42 = load double, ptr @tmp, align 8, !tbaa !5
  %43 = load double, ptr @ans, align 8, !tbaa !5
  %44 = fadd double %42, %43
  store double %44, ptr @ans, align 8, !tbaa !5
  %45 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tmp)
  %46 = load double, ptr @tmp, align 8, !tbaa !5
  %47 = load double, ptr @ans, align 8, !tbaa !5
  %48 = fadd double %46, %47
  store double %48, ptr @ans, align 8, !tbaa !5
  %49 = fdiv double %48, 1.200000e+01
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %49)
  ret i32 0
}

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

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

attributes #0 = { mustprogress nofree norecurse 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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass