Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include <stdio.h> #include <math.h> const double eps = 1e-10; int n; //math.hライブラリでy1, y2...とかって変数名が使われてるらしい double ix1, ix2, ix3, ix4; double iy1, iy2, iy3, iy4; //増加率を見る方法 int solve() { double Ax = ix2 - ix1; double Ay = iy2 - iy1; double Bx = ix4 - ix3; double By = iy4 - iy3; double val = Ax * By - Ay * Bx; return (fabs(val) < eps); } int main() { scanf("%d", &n); for(int i=0; i<n; ++i) { scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ix1, &iy1, &ix2, &iy2, &ix3, &iy3, &ix4, &iy4); if(solve()) { printf("YES\n"); } else { printf("NO\n"); } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312336/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312336/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @eps = dso_local local_unnamed_addr constant double 1.000000e-10, align 8 @ix2 = dso_local global double 0.000000e+00, align 8 @ix1 = dso_local global double 0.000000e+00, align 8 @iy2 = dso_local global double 0.000000e+00, align 8 @iy1 = dso_local global double 0.000000e+00, align 8 @ix4 = dso_local global double 0.000000e+00, align 8 @ix3 = dso_local global double 0.000000e+00, align 8 @iy4 = dso_local global double 0.000000e+00, align 8 @iy3 = dso_local global double 0.000000e+00, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @n = dso_local global i32 0, align 4 @.str.1 = private unnamed_addr constant [32 x i8] c"%lf %lf %lf %lf %lf %lf %lf %lf\00", align 1 @str = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @solve() local_unnamed_addr #0 { entry: %0 = load double, ptr @ix2, align 8, !tbaa !5 %1 = load double, ptr @ix1, align 8, !tbaa !5 %sub = fsub double %0, %1 %2 = load double, ptr @iy2, align 8, !tbaa !5 %3 = load double, ptr @iy1, align 8, !tbaa !5 %sub1 = fsub double %2, %3 %4 = load double, ptr @ix4, align 8, !tbaa !5 %5 = load double, ptr @ix3, align 8, !tbaa !5 %sub2 = fsub double %4, %5 %6 = load double, ptr @iy4, align 8, !tbaa !5 %7 = load double, ptr @iy3, align 8, !tbaa !5 %sub3 = fsub double %6, %7 %8 = fneg double %sub1 %neg = fmul double %sub2, %8 %9 = tail call double @llvm.fmuladd.f64(double %sub, double %sub3, double %neg) %10 = tail call double @llvm.fabs.f64(double %9) %cmp = fcmp olt double %10, 1.000000e-10 %conv = zext i1 %cmp to i32 ret i32 %conv } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !9 %cmp7 = icmp sgt i32 %0, 0 br i1 %cmp7, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry ret i32 0 for.body: ; preds = %entry, %for.body %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @ix1, ptr noundef nonnull @iy1, ptr noundef nonnull @ix2, ptr noundef nonnull @iy2, ptr noundef nonnull @ix3, ptr noundef nonnull @iy3, ptr noundef nonnull @ix4, ptr noundef nonnull @iy4) %1 = load double, ptr @ix2, align 8, !tbaa !5 %2 = load double, ptr @ix1, align 8, !tbaa !5 %sub.i = fsub double %1, %2 %3 = load double, ptr @iy2, align 8, !tbaa !5 %4 = load double, ptr @iy1, align 8, !tbaa !5 %sub1.i = fsub double %3, %4 %5 = load double, ptr @ix4, align 8, !tbaa !5 %6 = load double, ptr @ix3, align 8, !tbaa !5 %sub2.i = fsub double %5, %6 %7 = load double, ptr @iy4, align 8, !tbaa !5 %8 = load double, ptr @iy3, align 8, !tbaa !5 %sub3.i = fsub double %7, %8 %9 = fneg double %sub1.i %neg.i = fmul double %sub2.i, %9 %10 = tail call double @llvm.fmuladd.f64(double %sub.i, double %sub3.i, double %neg.i) %11 = tail call double @llvm.fabs.f64(double %10) %cmp.i = fcmp uge double %11, 1.000000e-10 %str.str.4 = select i1 %cmp.i, ptr @str, ptr @str.4 %puts6 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.str.4) %inc = add nuw nsw i32 %i.08, 1 %12 = load i32, ptr @n, align 4, !tbaa !9 %cmp = icmp slt i32 %inc, %12 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 speculatable willreturn memory(none) } attributes #2 = { nofree 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 = { 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 #4 = { nofree 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !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 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> /* 2ツ点ツづーツ津環づゥツ陳シツ静シツづ個傾ツつォツづーツ仰づ淞づゥ */ void calc_slope(double x1, double y1, double x2, double y2, double* a, double* b) { *a = (y2 - y1) / (x2 - x1); *b = y1 - ((*a) * x1); return; } int main(void) { int n, i; double x[4], y[4], a[2], b[2]; scanf("%d", &n); for(i = 0; i < n; i++) { int i; for(i = 0; i < 4; i++) { scanf("%lf", x + i); scanf("%lf", y + i); } for(i = 0; i < (4 / 2); i++) { calc_slope( x[i*2], y[i*2], x[i*2+1], y[i*2+1], &a[i], &b[i]); } if(a[0] == a[1]) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312408/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312408/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1 @str = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable define dso_local void @calc_slope(double noundef %x1, double noundef %y1, double noundef %x2, double noundef %y2, ptr nocapture noundef writeonly %a, ptr nocapture noundef writeonly %b) local_unnamed_addr #0 { entry: %sub = fsub double %y2, %y1 %sub1 = fsub double %x2, %x1 %div = fdiv double %sub, %sub1 store double %div, ptr %a, align 8, !tbaa !5 %neg = fneg double %div %0 = tail call double @llvm.fmuladd.f64(double %neg, double %x1, double %y1) store double %0, ptr %b, align 8, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %x = alloca [4 x double], align 16 %y = alloca [4 x double], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %x) #6 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %y) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !9 %cmp53 = icmp sgt i32 %0, 0 br i1 %cmp53, label %for.cond2.preheader.lr.ph, label %for.end37 for.cond2.preheader.lr.ph: ; preds = %entry %add.ptr.1 = getelementptr inbounds double, ptr %x, i64 1 %add.ptr8.1 = getelementptr inbounds double, ptr %y, i64 1 %add.ptr.2 = getelementptr inbounds double, ptr %x, i64 2 %add.ptr8.2 = getelementptr inbounds double, ptr %y, i64 2 %add.ptr.3 = getelementptr inbounds double, ptr %x, i64 3 %add.ptr8.3 = getelementptr inbounds double, ptr %y, i64 3 br label %for.cond2.preheader for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.cond2.preheader %i.054 = phi i32 [ 0, %for.cond2.preheader.lr.ph ], [ %inc36, %for.cond2.preheader ] %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %y) %call5.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr.1) %call9.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr8.1) %call5.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr.2) %call9.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr8.2) %call5.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr.3) %call9.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr8.3) %1 = load <2 x double>, ptr %x, align 16 %2 = load <2 x double>, ptr %y, align 16 %3 = load <2 x double>, ptr %add.ptr.1, align 8 %4 = load <2 x double>, ptr %add.ptr8.1, align 8 %5 = load double, ptr %add.ptr.2, align 16, !tbaa !5 %6 = load double, ptr %add.ptr8.2, align 16, !tbaa !5 %7 = load double, ptr %add.ptr.3, align 8, !tbaa !5 %8 = load double, ptr %add.ptr8.3, align 8, !tbaa !5 %9 = insertelement <2 x double> %4, double %8, i64 1 %10 = insertelement <2 x double> %2, double %6, i64 1 %11 = fsub <2 x double> %9, %10 %12 = insertelement <2 x double> %3, double %7, i64 1 %13 = insertelement <2 x double> %1, double %5, i64 1 %14 = fsub <2 x double> %12, %13 %15 = fdiv <2 x double> %11, %14 %16 = extractelement <2 x double> %15, i64 0 %17 = extractelement <2 x double> %15, i64 1 %cmp32 = fcmp oeq double %16, %17 %str.4.str = select i1 %cmp32, ptr @str.4, ptr @str %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.str) %inc36 = add nuw nsw i32 %i.054, 1 %18 = load i32, ptr %n, align 4, !tbaa !9 %cmp = icmp slt i32 %inc36, %18 br i1 %cmp, label %for.cond2.preheader, label %for.end37, !llvm.loop !11 for.end37: ; preds = %for.cond2.preheader, %entry call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %y) #6 call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %x) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) 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 speculatable willreturn memory(none) } attributes #2 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { 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 #5 = { nofree nounwind } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"double", !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 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main() { double x[4],y[4],m1,m2; int n,i,j; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<4;j++) scanf("%lf%lf",&x[j],&y[j]); m1=(y[1]-y[0])/(x[1]-x[0]); m2=(y[3]-y[2])/(x[3]-x[2]); printf("%s\n",m1==m2?"YES":"NO"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312451/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312451/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%lf%lf\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca [4 x double], align 16 %y = alloca [4 x double], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %y) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp29 = icmp sgt i32 %0, 0 br i1 %cmp29, label %for.cond1.preheader.lr.ph, label %for.end23 for.cond1.preheader.lr.ph: ; preds = %entry %arrayidx7 = getelementptr inbounds [4 x double], ptr %y, i64 0, i64 1 %arrayidx9 = getelementptr inbounds [4 x double], ptr %x, i64 0, i64 1 %arrayidx12 = getelementptr inbounds [4 x double], ptr %y, i64 0, i64 3 %arrayidx13 = getelementptr inbounds [4 x double], ptr %y, i64 0, i64 2 %arrayidx15 = getelementptr inbounds [4 x double], ptr %x, i64 0, i64 3 %arrayidx16 = getelementptr inbounds [4 x double], ptr %x, i64 0, i64 2 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheader %i.030 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc22, %for.cond1.preheader ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %arrayidx7) %call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx16, ptr noundef nonnull %arrayidx13) %call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx15, ptr noundef nonnull %arrayidx12) %1 = load <2 x double>, ptr %arrayidx7, align 8 %2 = load <2 x double>, ptr %y, align 16 %3 = load <2 x double>, ptr %arrayidx9, align 8 %4 = load <2 x double>, ptr %x, align 16 %5 = load double, ptr %arrayidx12, align 8, !tbaa !9 %6 = load double, ptr %arrayidx13, align 16, !tbaa !9 %7 = load double, ptr %arrayidx15, align 8, !tbaa !9 %8 = load double, ptr %arrayidx16, align 16, !tbaa !9 %9 = insertelement <2 x double> %1, double %5, i64 1 %10 = insertelement <2 x double> %2, double %6, i64 1 %11 = fsub <2 x double> %9, %10 %12 = insertelement <2 x double> %3, double %7, i64 1 %13 = insertelement <2 x double> %4, double %8, i64 1 %14 = fsub <2 x double> %12, %13 %15 = fdiv <2 x double> %11, %14 %16 = extractelement <2 x double> %15, i64 0 %17 = extractelement <2 x double> %15, i64 1 %cmp19 = fcmp oeq double %16, %17 %cond = select i1 %cmp19, ptr @.str.3, ptr @.str.4 %puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond) %inc22 = add nuw nsw i32 %i.030, 1 %18 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc22, %18 br i1 %cmp, label %for.cond1.preheader, label %for.end23, !llvm.loop !11 for.end23: ; preds = %for.cond1.preheader, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %x) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree 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 = { nofree nounwind } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#define _CRT_SECURE_NO_WARNINGS ////#define _USE_MATH_DEFINES #include<stdio.h> //#include<stdlib.h> //#include<math.h> //#include<string.h> //#include<time.h> #define P(type,x) fprintf(stdout,"%"#type"\n",x) int main() { int n, d[1000][5],i,p,q,r,f,c; while (fscanf(stdin, "%d", &n),n) { f = 1; for (i = 0; i < n; i++) fscanf(stdin, "%d%d%d%d", &d[i][0], &d[i][1], &d[i][2], &d[i][3]), d[i][4] = 4 * (d[i][1] + d[i][3]) + 9 * d[i][2]; fscanf(stdin, "%d%d%d%d", &p, &q, &r,&c); for (i = 0; i < n; i++) if (d[i][1] <= p&&d[i][2] <= q&&d[i][3] <= r&&d[i][4] <= c) P(d, d[i][0]), f = 0; if (f) puts("NA"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312501/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312501/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdin = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"NA\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %d = alloca [1000 x [5 x i32]], align 16 %p = alloca i32, align 4 %q = alloca i32, align 4 %r = alloca i32, align 4 %c = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 20000, ptr nonnull %d) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call80 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %n) #4 %1 = load i32, ptr %n, align 4, !tbaa !9 %tobool.not81 = icmp eq i32 %1, 0 br i1 %tobool.not81, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %if.end58 %2 = phi i32 [ %25, %if.end58 ], [ %1, %entry ] %cmp75 = icmp sgt i32 %2, 0 br i1 %cmp75, label %for.body, label %for.end for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %3 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv %arrayidx4 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 1 %arrayidx7 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 2 %arrayidx10 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 3 %call11 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %3, ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx10) #4 %4 = load i32, ptr %arrayidx4, align 4, !tbaa !9 %5 = load i32, ptr %arrayidx10, align 4, !tbaa !9 %add = add nsw i32 %5, %4 %mul = shl nsw i32 %add, 2 %6 = load i32, ptr %arrayidx7, align 4, !tbaa !9 %mul21 = mul nsw i32 %6, 9 %add22 = add nsw i32 %mul, %mul21 %arrayidx25 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv, i64 4 store i32 %add22, ptr %arrayidx25, align 4, !tbaa !9 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %7 = load i32, ptr %n, align 4, !tbaa !9 %8 = sext i32 %7 to i64 %cmp = icmp slt i64 %indvars.iv.next, %8 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %for.cond.preheader %9 = load ptr, ptr @stdin, align 8, !tbaa !5 %call26 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %9, ptr noundef nonnull @.str.1, ptr noundef nonnull %p, ptr noundef nonnull %q, ptr noundef nonnull %r, ptr noundef nonnull %c) #4 %10 = load i32, ptr %n, align 4, !tbaa !9 %cmp2877 = icmp sgt i32 %10, 0 br i1 %cmp2877, label %for.body29, label %if.then56 for.body29: ; preds = %for.end, %for.inc52 %11 = phi i32 [ %22, %for.inc52 ], [ %10, %for.end ] %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.inc52 ], [ 0, %for.end ] %f.079 = phi i32 [ %f.1, %for.inc52 ], [ 1, %for.end ] %arrayidx31 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv83 %arrayidx32 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv83, i64 1 %12 = load i32, ptr %arrayidx32, align 4, !tbaa !9 %13 = load i32, ptr %p, align 4, !tbaa !9 %cmp33.not = icmp sgt i32 %12, %13 br i1 %cmp33.not, label %for.inc52, label %land.lhs.true land.lhs.true: ; preds = %for.body29 %arrayidx36 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv83, i64 2 %14 = load i32, ptr %arrayidx36, align 4, !tbaa !9 %15 = load i32, ptr %q, align 4, !tbaa !9 %cmp37.not = icmp sgt i32 %14, %15 br i1 %cmp37.not, label %for.inc52, label %land.lhs.true38 land.lhs.true38: ; preds = %land.lhs.true %arrayidx41 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv83, i64 3 %16 = load i32, ptr %arrayidx41, align 4, !tbaa !9 %17 = load i32, ptr %r, align 4, !tbaa !9 %cmp42.not = icmp sgt i32 %16, %17 br i1 %cmp42.not, label %for.inc52, label %land.lhs.true43 land.lhs.true43: ; preds = %land.lhs.true38 %arrayidx46 = getelementptr inbounds [1000 x [5 x i32]], ptr %d, i64 0, i64 %indvars.iv83, i64 4 %18 = load i32, ptr %arrayidx46, align 4, !tbaa !9 %19 = load i32, ptr %c, align 4, !tbaa !9 %cmp47.not = icmp sgt i32 %18, %19 br i1 %cmp47.not, label %for.inc52, label %if.then if.then: ; preds = %land.lhs.true43 %20 = load ptr, ptr @stdout, align 8, !tbaa !5 %21 = load i32, ptr %arrayidx31, align 4, !tbaa !9 %call51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.2, i32 noundef %21) %.pre = load i32, ptr %n, align 4, !tbaa !9 br label %for.inc52 for.inc52: ; preds = %for.body29, %land.lhs.true, %land.lhs.true38, %land.lhs.true43, %if.then %22 = phi i32 [ %.pre, %if.then ], [ %11, %land.lhs.true43 ], [ %11, %land.lhs.true38 ], [ %11, %land.lhs.true ], [ %11, %for.body29 ] %f.1 = phi i32 [ 0, %if.then ], [ %f.079, %land.lhs.true43 ], [ %f.079, %land.lhs.true38 ], [ %f.079, %land.lhs.true ], [ %f.079, %for.body29 ] %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %23 = sext i32 %22 to i64 %cmp28 = icmp slt i64 %indvars.iv.next84, %23 br i1 %cmp28, label %for.body29, label %for.end54, !llvm.loop !13 for.end54: ; preds = %for.inc52 %tobool55.not = icmp eq i32 %f.1, 0 br i1 %tobool55.not, label %if.end58, label %if.then56 if.then56: ; preds = %for.end, %for.end54 %call57 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3) br label %if.end58 if.end58: ; preds = %if.then56, %for.end54 %24 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %24, ptr noundef nonnull @.str, ptr noundef nonnull %n) #4 %25 = load i32, ptr %n, align 4, !tbaa !9 %tobool.not = icmp eq i32 %25, 0 br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !14 while.end: ; preds = %if.end58, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 20000, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; 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 = { "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 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12}
#include<stdio.h> int main(void) { int n; char s[110]; scanf("%d%s",&n,s); int i,j,a,b,ans=0,cnt; char c; for(i=1;i<n;i++){ cnt=0; for(c='a';c<='z';c++){ a = 0; b = 0; for(j=0;j<i;j++){ if(s[j]==c) a = 1; } for(j=i;j<n;j++){ if(s[j]==c) b = 1; } if((a==1)&&(b==1)) cnt++; } if(ans<cnt) ans = cnt; } printf("%d\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312545/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312545/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %s = alloca [110 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp70 = icmp sgt i32 %0, 1 br i1 %cmp70, label %for.cond1.preheader.preheader, label %for.end44 for.cond1.preheader.preheader: ; preds = %entry %1 = zext i32 %0 to i64 %wide.trip.count81 = zext i32 %0 to i64 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.end37.split.us %indvar = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next, %for.end37.split.us ] %indvars.iv74 = phi i64 [ 1, %for.cond1.preheader.preheader ], [ %indvars.iv.next75, %for.end37.split.us ] %ans.072 = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %spec.select62, %for.end37.split.us ] %2 = add i64 %indvar, 2 %umax = call i64 @llvm.umax.i64(i64 %2, i64 %wide.trip.count81) %3 = xor i64 %indvar, -1 %4 = add i64 %umax, %3 %min.iters.check89 = icmp ult i64 %indvars.iv74, 8 %n.vec92 = and i64 %indvars.iv74, 9223372036854775800 %cmp.n94 = icmp eq i64 %indvars.iv74, %n.vec92 %min.iters.check = icmp ult i64 %4, 8 %n.vec = and i64 %4, -8 %ind.end = add i64 %indvars.iv74, %n.vec %cmp.n = icmp eq i64 %4, %n.vec br label %for.cond5.preheader.us for.cond5.preheader.us: ; preds = %for.cond13.for.end27_crit_edge.us, %for.cond1.preheader %c.069.us = phi i8 [ 97, %for.cond1.preheader ], [ %inc36.us, %for.cond13.for.end27_crit_edge.us ] %cnt.068.us = phi i32 [ 0, %for.cond1.preheader ], [ %spec.select61.us, %for.cond13.for.end27_crit_edge.us ] br i1 %min.iters.check89, label %for.body8.us.preheader, label %vector.ph90 vector.ph90: ; preds = %for.cond5.preheader.us %broadcast.splatinsert101 = insertelement <4 x i8> poison, i8 %c.069.us, i64 0 %broadcast.splat102 = shufflevector <4 x i8> %broadcast.splatinsert101, <4 x i8> poison, <4 x i32> zeroinitializer br label %vector.body95 vector.body95: ; preds = %vector.body95, %vector.ph90 %index96 = phi i64 [ 0, %vector.ph90 ], [ %index.next103, %vector.body95 ] %vec.phi97 = phi <4 x i32> [ zeroinitializer, %vector.ph90 ], [ %9, %vector.body95 ] %vec.phi98 = phi <4 x i32> [ zeroinitializer, %vector.ph90 ], [ %10, %vector.body95 ] %5 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %index96 %wide.load99 = load <4 x i8>, ptr %5, align 8, !tbaa !9 %6 = getelementptr inbounds i8, ptr %5, i64 4 %wide.load100 = load <4 x i8>, ptr %6, align 4, !tbaa !9 %7 = icmp eq <4 x i8> %wide.load99, %broadcast.splat102 %8 = icmp eq <4 x i8> %wide.load100, %broadcast.splat102 %9 = select <4 x i1> %7, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi97 %10 = select <4 x i1> %8, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi98 %index.next103 = add nuw i64 %index96, 8 %11 = icmp eq i64 %index.next103, %n.vec92 br i1 %11, label %middle.block87, label %vector.body95, !llvm.loop !10 middle.block87: ; preds = %vector.body95 %rdx.select.cmp104.not = icmp ne <4 x i32> %9, zeroinitializer %rdx.select.cmp106109 = icmp ne <4 x i32> %10, zeroinitializer %rdx.select.cmp106 = select <4 x i1> %rdx.select.cmp104.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp106109 %12 = bitcast <4 x i1> %rdx.select.cmp106 to i4 %.not = icmp ne i4 %12, 0 %rdx.select107 = zext i1 %.not to i32 br i1 %cmp.n94, label %for.cond13.preheader.us, label %for.body8.us.preheader for.body8.us.preheader: ; preds = %for.cond5.preheader.us, %middle.block87 %indvars.iv.ph = phi i64 [ 0, %for.cond5.preheader.us ], [ %n.vec92, %middle.block87 ] %a.064.us.ph = phi i32 [ 0, %for.cond5.preheader.us ], [ %rdx.select107, %middle.block87 ] br label %for.body8.us for.body16.us: ; preds = %for.body16.us.preheader, %for.body16.us %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body16.us ], [ %indvars.iv76.ph, %for.body16.us.preheader ] %b.067.us = phi i32 [ %spec.select60.us, %for.body16.us ], [ %b.067.us.ph, %for.body16.us.preheader ] %arrayidx18.us = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv76 %13 = load i8, ptr %arrayidx18.us, align 1, !tbaa !9 %cmp21.us = icmp eq i8 %13, %c.069.us %spec.select60.us = select i1 %cmp21.us, i32 1, i32 %b.067.us %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %cmp14.us = icmp ult i64 %indvars.iv.next77, %1 br i1 %cmp14.us, label %for.body16.us, label %for.cond13.for.end27_crit_edge.us, !llvm.loop !14 for.body8.us: ; preds = %for.body8.us.preheader, %for.body8.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body8.us ], [ %indvars.iv.ph, %for.body8.us.preheader ] %a.064.us = phi i32 [ %spec.select.us, %for.body8.us ], [ %a.064.us.ph, %for.body8.us.preheader ] %arrayidx.us = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv %14 = load i8, ptr %arrayidx.us, align 1, !tbaa !9 %cmp11.us = icmp eq i8 %14, %c.069.us %spec.select.us = select i1 %cmp11.us, i32 1, i32 %a.064.us %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv74 br i1 %exitcond.not, label %for.cond13.preheader.us, label %for.body8.us, !llvm.loop !15 for.cond13.preheader.us: ; preds = %for.body8.us, %middle.block87 %spec.select.us.lcssa = phi i32 [ %rdx.select107, %middle.block87 ], [ %spec.select.us, %for.body8.us ] br i1 %min.iters.check, label %for.body16.us.preheader, label %vector.ph vector.ph: ; preds = %for.cond13.preheader.us %broadcast.splatinsert = insertelement <4 x i8> poison, i8 %c.069.us, i64 0 %broadcast.splat = shufflevector <4 x i8> %broadcast.splatinsert, <4 x i8> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ] %vec.phi83 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ] %offset.idx = add i64 %indvars.iv74, %index %15 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %offset.idx %wide.load = load <4 x i8>, ptr %15, align 1, !tbaa !9 %16 = getelementptr inbounds i8, ptr %15, i64 4 %wide.load84 = load <4 x i8>, ptr %16, align 1, !tbaa !9 %17 = icmp eq <4 x i8> %wide.load, %broadcast.splat %18 = icmp eq <4 x i8> %wide.load84, %broadcast.splat %19 = select <4 x i1> %17, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi %20 = select <4 x i1> %18, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi83 %index.next = add nuw i64 %index, 8 %21 = icmp eq i64 %index.next, %n.vec br i1 %21, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %rdx.select.cmp.not = icmp ne <4 x i32> %19, zeroinitializer %rdx.select.cmp85110 = icmp ne <4 x i32> %20, zeroinitializer %rdx.select.cmp85 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp85110 %22 = bitcast <4 x i1> %rdx.select.cmp85 to i4 %.not111 = icmp ne i4 %22, 0 %rdx.select86 = zext i1 %.not111 to i32 br i1 %cmp.n, label %for.cond13.for.end27_crit_edge.us, label %for.body16.us.preheader for.body16.us.preheader: ; preds = %for.cond13.preheader.us, %middle.block %indvars.iv76.ph = phi i64 [ %indvars.iv74, %for.cond13.preheader.us ], [ %ind.end, %middle.block ] %b.067.us.ph = phi i32 [ 0, %for.cond13.preheader.us ], [ %rdx.select86, %middle.block ] br label %for.body16.us for.cond13.for.end27_crit_edge.us: ; preds = %for.body16.us, %middle.block %spec.select60.us.lcssa = phi i32 [ %rdx.select86, %middle.block ], [ %spec.select60.us, %for.body16.us ] %cmp28.us = icmp eq i32 %spec.select.us.lcssa, 1 %cmp30.us = icmp eq i32 %spec.select60.us.lcssa, 1 %or.cond.us = select i1 %cmp28.us, i1 %cmp30.us, i1 false %inc33.us = zext i1 %or.cond.us to i32 %spec.select61.us = add nuw nsw i32 %cnt.068.us, %inc33.us %inc36.us = add nuw nsw i8 %c.069.us, 1 %exitcond79.not = icmp eq i8 %inc36.us, 123 br i1 %exitcond79.not, label %for.end37.split.us, label %for.cond5.preheader.us, !llvm.loop !17 for.end37.split.us: ; preds = %for.cond13.for.end27_crit_edge.us %spec.select62 = call i32 @llvm.smax.i32(i32 %ans.072, i32 %spec.select61.us) %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %exitcond82.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count81 %indvar.next = add i64 %indvar, 1 br i1 %exitcond82.not, label %for.end44, label %for.cond1.preheader, !llvm.loop !18 for.end44: ; preds = %for.end37.split.us, %entry %ans.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select62, %for.end37.split.us ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umax.i64(i64, i64) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11, !12, !13} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !11, !13, !12} !15 = distinct !{!15, !11, !13, !12} !16 = distinct !{!16, !11, !12, !13} !17 = distinct !{!17, !11} !18 = distinct !{!18, !11}
#include <stdio.h> int main(int argc, char *argv[]) { int n; char s[101]; scanf("%d%s", &n, s); int cnt, max = 0; int ans; for(int i = 0; i < n - 1; i++){ ans = 0; for(int j = 'a'; j <= 'z'; j++){ cnt = 0; for(int k = 0; k <= i; k++){ if(s[k] == j){ cnt++; break; } } for(int k = i + 1; k < n; k++){ if(s[k] == j){ cnt++; break; } } if(cnt == 2) ans++; } max = (max > ans ? max : ans); } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312589/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312589/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %s = alloca [101 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp70 = icmp sgt i32 %0, 1 br i1 %cmp70, label %for.cond1.preheader.preheader, label %for.cond.cleanup for.cond1.preheader.preheader: ; preds = %entry %sub = add nsw i32 %0, -1 %1 = zext i32 %0 to i64 %wide.trip.count87 = zext i32 %sub to i64 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.cond.cleanup3 %indvars.iv82 = phi i64 [ 1, %for.cond1.preheader.preheader ], [ %indvars.iv.next83, %for.cond.cleanup3 ] %indvars.iv76 = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvars.iv.next77, %for.cond.cleanup3 ] %max.071 = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %cond, %for.cond.cleanup3 ] br label %for.cond5.preheader for.cond.cleanup: ; preds = %for.cond.cleanup3, %entry %max.0.lcssa = phi i32 [ 0, %entry ], [ %cond, %for.cond.cleanup3 ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 for.cond5.preheader: ; preds = %for.cond1.preheader, %cleanup28 %j.069 = phi i32 [ 97, %for.cond1.preheader ], [ %inc36, %cleanup28 ] %ans.068 = phi i32 [ 0, %for.cond1.preheader ], [ %spec.select, %cleanup28 ] br label %for.body8 for.cond.cleanup3: ; preds = %cleanup28 %cond = call i32 @llvm.smax.i32(i32 %max.071, i32 %spec.select) %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1 %exitcond88.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count87 br i1 %exitcond88.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !9 for.cond5: ; preds = %for.body8 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv82 br i1 %exitcond.not, label %cleanup, label %for.body8, !llvm.loop !11 for.body8: ; preds = %for.cond5.preheader, %for.cond5 %indvars.iv = phi i64 [ 0, %for.cond5.preheader ], [ %indvars.iv.next, %for.cond5 ] %arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv %2 = load i8, ptr %arrayidx, align 1, !tbaa !12 %conv = sext i8 %2 to i32 %cmp9 = icmp eq i32 %j.069, %conv br i1 %cmp9, label %cleanup, label %for.cond5 cleanup: ; preds = %for.body8, %for.cond5 %cnt.0 = phi i32 [ 0, %for.cond5 ], [ 1, %for.body8 ] br label %for.cond13 for.cond13: ; preds = %for.body17, %cleanup %indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body17 ], [ %indvars.iv76, %cleanup ] %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %cmp14 = icmp ult i64 %indvars.iv.next79, %1 br i1 %cmp14, label %for.body17, label %cleanup28 for.body17: ; preds = %for.cond13 %arrayidx19 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv.next79 %3 = load i8, ptr %arrayidx19, align 1, !tbaa !12 %conv20 = sext i8 %3 to i32 %cmp21 = icmp eq i32 %j.069, %conv20 br i1 %cmp21, label %if.then23, label %for.cond13, !llvm.loop !13 if.then23: ; preds = %for.body17 %inc24 = add nuw nsw i32 %cnt.0, 1 br label %cleanup28 cleanup28: ; preds = %for.cond13, %if.then23 %cnt.1 = phi i32 [ %inc24, %if.then23 ], [ %cnt.0, %for.cond13 ] %cmp30 = icmp eq i32 %cnt.1, 2 %inc33 = zext i1 %cmp30 to i32 %spec.select = add nuw nsw i32 %ans.068, %inc33 %inc36 = add nuw nsw i32 %j.069, 1 %exitcond81.not = icmp eq i32 %inc36, 123 br i1 %exitcond81.not, label %for.cond.cleanup3, label %for.cond5.preheader, !llvm.loop !14 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = !{!7, !7, i64 0} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include <stdio.h> int main(void) { int N; int i, j; int ans = 0; char S[110]; scanf("%d %s", &N, S); for(i = 0; i < N; i++) { int alf1[30] = {0}; int cnt = 0; for(j = 0; j < i; j++) alf1[S[j] - 'a']++; for(j = i; j < N; j++) { if(alf1[S[j] - 'a'] > 0) { cnt++; alf1[S[j] - 'a'] = 0; } } if(ans < cnt) ans = cnt; } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312639/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312639/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %S = alloca [110 x i8], align 16 %alf1 = alloca [30 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %S) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %S) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body.preheader, label %for.end35 for.body.preheader: ; preds = %entry %wide.trip.count67 = zext i32 %0 to i64 br label %for.body for.body: ; preds = %for.body.preheader, %for.end28 %indvars.iv59 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next60, %for.end28 ] %ans.056 = phi i32 [ 0, %for.body.preheader ], [ %spec.select, %for.end28 ] call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %alf1) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %alf1, i8 0, i64 120, i1 false) %cmp249.not = icmp eq i64 %indvars.iv59, 0 br i1 %cmp249.not, label %for.body10.preheader, label %for.body3.preheader for.body3.preheader: ; preds = %for.body %xtraiter = and i64 %indvars.iv59, 1 %1 = icmp eq i64 %indvars.iv59, 1 br i1 %1, label %for.body10.preheader.loopexit.unr-lcssa, label %for.body3.preheader.new for.body3.preheader.new: ; preds = %for.body3.preheader %unroll_iter = and i64 %indvars.iv59, 9223372036854775806 br label %for.body3 for.body3: ; preds = %for.body3, %for.body3.preheader.new %indvars.iv = phi i64 [ 0, %for.body3.preheader.new ], [ %indvars.iv.next.1, %for.body3 ] %niter = phi i64 [ 0, %for.body3.preheader.new ], [ %niter.next.1, %for.body3 ] %arrayidx = getelementptr inbounds [110 x i8], ptr %S, i64 0, i64 %indvars.iv %2 = load i8, ptr %arrayidx, align 2, !tbaa !9 %conv = sext i8 %2 to i64 %sub = add nsw i64 %conv, -97 %arrayidx5 = getelementptr inbounds [30 x i32], ptr %alf1, i64 0, i64 %sub %3 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %inc = add nsw i32 %3, 1 store i32 %inc, ptr %arrayidx5, align 4, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds [110 x i8], ptr %S, i64 0, i64 %indvars.iv.next %4 = load i8, ptr %arrayidx.1, align 1, !tbaa !9 %conv.1 = sext i8 %4 to i64 %sub.1 = add nsw i64 %conv.1, -97 %arrayidx5.1 = getelementptr inbounds [30 x i32], ptr %alf1, i64 0, i64 %sub.1 %5 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5 %inc.1 = add nsw i32 %5, 1 store i32 %inc.1, ptr %arrayidx5.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.body10.preheader.loopexit.unr-lcssa, label %for.body3, !llvm.loop !10 for.body10.preheader.loopexit.unr-lcssa: ; preds = %for.body3, %for.body3.preheader %indvars.iv.unr = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next.1, %for.body3 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body10.preheader, label %for.body3.epil for.body3.epil: ; preds = %for.body10.preheader.loopexit.unr-lcssa %arrayidx.epil = getelementptr inbounds [110 x i8], ptr %S, i64 0, i64 %indvars.iv.unr %6 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9 %conv.epil = sext i8 %6 to i64 %sub.epil = add nsw i64 %conv.epil, -97 %arrayidx5.epil = getelementptr inbounds [30 x i32], ptr %alf1, i64 0, i64 %sub.epil %7 = load i32, ptr %arrayidx5.epil, align 4, !tbaa !5 %inc.epil = add nsw i32 %7, 1 store i32 %inc.epil, ptr %arrayidx5.epil, align 4, !tbaa !5 br label %for.body10.preheader for.body10.preheader: ; preds = %for.body3.epil, %for.body10.preheader.loopexit.unr-lcssa, %for.body br label %for.body10 for.body10: ; preds = %for.body10.preheader, %for.inc26 %indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.inc26 ], [ %indvars.iv59, %for.body10.preheader ] %cnt.053 = phi i32 [ %cnt.1, %for.inc26 ], [ 0, %for.body10.preheader ] %arrayidx12 = getelementptr inbounds [110 x i8], ptr %S, i64 0, i64 %indvars.iv61 %8 = load i8, ptr %arrayidx12, align 1, !tbaa !9 %conv13 = sext i8 %8 to i64 %sub14 = add nsw i64 %conv13, -97 %arrayidx16 = getelementptr inbounds [30 x i32], ptr %alf1, i64 0, i64 %sub14 %9 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %cmp17 = icmp sgt i32 %9, 0 br i1 %cmp17, label %if.then, label %for.inc26 if.then: ; preds = %for.body10 %inc19 = add nsw i32 %cnt.053, 1 store i32 0, ptr %arrayidx16, align 4, !tbaa !5 br label %for.inc26 for.inc26: ; preds = %for.body10, %if.then %cnt.1 = phi i32 [ %inc19, %if.then ], [ %cnt.053, %for.body10 ] %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count67 br i1 %exitcond65.not, label %for.end28, label %for.body10, !llvm.loop !12 for.end28: ; preds = %for.inc26 %spec.select = call i32 @llvm.smax.i32(i32 %ans.056, i32 %cnt.1) call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %alf1) #5 %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1 %exitcond68.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count67 br i1 %exitcond68.not, label %for.end35, label %for.body, !llvm.loop !13 for.end35: ; preds = %for.end28, %entry %ans.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.end28 ] %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %S) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define min(a,b) (((a)<(b))?(a):(b)) #define max(a,b) (((a)>(b))?(a):(b)) #define abs(a) (((a)>0)?(a):(-a)) int main() { int n; char s[110]; int ans = 0, ch[30], count; scanf("%d%s", &n, s); for (int i = 1; i < n; i++) { for (int j = 0; j < 30; j++) { ch[j] = 0; } count = 0; for (int j = 0; j <= i; j++) { ch[s[j] - 'a'] = 1; } for (int j = i + 1; j < n; j++) { if (ch[s[j] - 'a'] == 1) { count++; ch[s[j] - 'a'] = 0; } } ans = max(ans, count); } printf("%d", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312682/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312682/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%s\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %s = alloca [110 x i8], align 16 %ch = alloca [30 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %s) #5 call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %ch) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %s) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp66 = icmp sgt i32 %0, 1 br i1 %cmp66, label %for.cond1.preheader.preheader, label %for.cond.cleanup for.cond1.preheader.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count82 = zext i32 %1 to i64 %wide.trip.count79 = zext i32 %0 to i64 br label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.cond.cleanup21 %indvar = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next, %for.cond.cleanup21 ] %indvars.iv74 = phi i64 [ 2, %for.cond1.preheader.preheader ], [ %indvars.iv.next75, %for.cond.cleanup21 ] %i.068 = phi i32 [ 1, %for.cond1.preheader.preheader ], [ %add, %for.cond.cleanup21 ] %ans.067 = phi i32 [ 0, %for.cond1.preheader.preheader ], [ %cond, %for.cond.cleanup21 ] %2 = add i64 %indvar, 1 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %ch, i8 0, i64 120, i1 false), !tbaa !5 %xtraiter = and i64 %indvars.iv74, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.cond.cleanup8.unr-lcssa, label %for.cond1.preheader.new for.cond1.preheader.new: ; preds = %for.cond1.preheader %unroll_iter = and i64 %indvars.iv74, 9223372036854775804 br label %for.body9 for.cond.cleanup: ; preds = %for.cond.cleanup21, %entry %ans.0.lcssa = phi i32 [ 0, %entry ], [ %cond, %for.cond.cleanup21 ] %call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %ch) #5 call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %s) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 for.cond.cleanup8.unr-lcssa: ; preds = %for.body9, %for.cond1.preheader %indvars.iv.unr = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next.3, %for.body9 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup8, label %for.body9.epil for.body9.epil: ; preds = %for.cond.cleanup8.unr-lcssa, %for.body9.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body9.epil ], [ %indvars.iv.unr, %for.cond.cleanup8.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.cond.cleanup8.unr-lcssa ] %arrayidx11.epil = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv.epil %4 = load i8, ptr %arrayidx11.epil, align 1, !tbaa !9 %conv.epil = sext i8 %4 to i64 %sub.epil = add nsw i64 %conv.epil, -97 %arrayidx13.epil = getelementptr inbounds [30 x i32], ptr %ch, i64 0, i64 %sub.epil store i32 1, ptr %arrayidx13.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup8, label %for.body9.epil, !llvm.loop !10 for.cond.cleanup8: ; preds = %for.body9.epil, %for.cond.cleanup8.unr-lcssa %add = add nuw nsw i32 %i.068, 1 %cmp1963 = icmp slt i32 %add, %0 br i1 %cmp1963, label %for.body22, label %for.cond.cleanup21 for.body9: ; preds = %for.body9, %for.cond1.preheader.new %indvars.iv = phi i64 [ 0, %for.cond1.preheader.new ], [ %indvars.iv.next.3, %for.body9 ] %niter = phi i64 [ 0, %for.cond1.preheader.new ], [ %niter.next.3, %for.body9 ] %arrayidx11 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv %5 = load i8, ptr %arrayidx11, align 4, !tbaa !9 %conv = sext i8 %5 to i64 %sub = add nsw i64 %conv, -97 %arrayidx13 = getelementptr inbounds [30 x i32], ptr %ch, i64 0, i64 %sub store i32 1, ptr %arrayidx13, align 4, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx11.1 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv.next %6 = load i8, ptr %arrayidx11.1, align 1, !tbaa !9 %conv.1 = sext i8 %6 to i64 %sub.1 = add nsw i64 %conv.1, -97 %arrayidx13.1 = getelementptr inbounds [30 x i32], ptr %ch, i64 0, i64 %sub.1 store i32 1, ptr %arrayidx13.1, align 4, !tbaa !5 %indvars.iv.next.1 = or i64 %indvars.iv, 2 %arrayidx11.2 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv.next.1 %7 = load i8, ptr %arrayidx11.2, align 2, !tbaa !9 %conv.2 = sext i8 %7 to i64 %sub.2 = add nsw i64 %conv.2, -97 %arrayidx13.2 = getelementptr inbounds [30 x i32], ptr %ch, i64 0, i64 %sub.2 store i32 1, ptr %arrayidx13.2, align 4, !tbaa !5 %indvars.iv.next.2 = or i64 %indvars.iv, 3 %arrayidx11.3 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv.next.2 %8 = load i8, ptr %arrayidx11.3, align 1, !tbaa !9 %conv.3 = sext i8 %8 to i64 %sub.3 = add nsw i64 %conv.3, -97 %arrayidx13.3 = getelementptr inbounds [30 x i32], ptr %ch, i64 0, i64 %sub.3 store i32 1, ptr %arrayidx13.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond.cleanup8.unr-lcssa, label %for.body9, !llvm.loop !12 for.cond.cleanup21: ; preds = %for.inc38, %for.cond.cleanup8 %count.0.lcssa = phi i32 [ 0, %for.cond.cleanup8 ], [ %count.1, %for.inc38 ] %cond = call i32 @llvm.smax.i32(i32 %ans.067, i32 %count.0.lcssa) %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %exitcond83.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count82 %indvar.next = add i64 %indvar, 1 br i1 %exitcond83.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !14 for.body22: ; preds = %for.cond.cleanup8, %for.inc38 %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.inc38 ], [ %indvars.iv74, %for.cond.cleanup8 ] %count.064 = phi i32 [ %count.1, %for.inc38 ], [ 0, %for.cond.cleanup8 ] %arrayidx24 = getelementptr inbounds [110 x i8], ptr %s, i64 0, i64 %indvars.iv76 %9 = load i8, ptr %arrayidx24, align 1, !tbaa !9 %conv25 = sext i8 %9 to i64 %sub26 = add nsw i64 %conv25, -97 %arrayidx28 = getelementptr inbounds [30 x i32], ptr %ch, i64 0, i64 %sub26 %10 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %cmp29 = icmp eq i32 %10, 1 br i1 %cmp29, label %if.then, label %for.inc38 if.then: ; preds = %for.body22 %inc31 = add nsw i32 %count.064, 1 store i32 0, ptr %arrayidx28, align 4, !tbaa !5 br label %for.inc38 for.inc38: ; preds = %for.body22, %if.then %count.1 = phi i32 [ %inc31, %if.then ], [ %count.064, %for.body22 ] %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79 br i1 %exitcond80.not, label %for.cond.cleanup21, label %for.body22, !llvm.loop !15 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.unroll.disable"} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13} !15 = distinct !{!15, !13}
#include <stdio.h> int main(){ int N,D,X[20][20],S=0; scanf("%d %d",&N,&D); for(int i=1;i<=N;i++){ for(int j=1;j<=D;j++){ scanf("%d",&X[i][j]); } } int d,p; for(int i=1;i<N;i++){ for(int j=i+1;j<=N;j++){ d=0; for(int k=1;k<=D;k++){ d+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]); } p=0; while(p*p<d) p++; if(p*p==d) S++; } } printf("%d\n",S); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312725/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312725/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %D = alloca i32, align 4 %X = alloca [20 x [20 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4 call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %X) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %D) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not84 = icmp slt i32 %0, 1 br i1 %cmp.not84, label %for.cond.cleanup14, label %for.cond1.preheader.lr.ph for.cond1.preheader.lr.ph: ; preds = %entry %1 = load i32, ptr %D, align 4, !tbaa !5 %2 = icmp slt i32 %1, 1 br i1 %2, label %for.cond12.preheader, label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond.cleanup3 %3 = phi i32 [ %17, %for.cond.cleanup3 ], [ %0, %for.cond1.preheader.lr.ph ] %4 = phi i32 [ %18, %for.cond.cleanup3 ], [ %1, %for.cond1.preheader.lr.ph ] %indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.cond.cleanup3 ], [ 1, %for.cond1.preheader.lr.ph ] %cmp2.not82 = icmp slt i32 %4, 1 br i1 %cmp2.not82, label %for.cond.cleanup3, label %for.body4 for.cond12.preheader: ; preds = %for.cond.cleanup3, %for.cond1.preheader.lr.ph %.lcssa = phi i32 [ %0, %for.cond1.preheader.lr.ph ], [ %17, %for.cond.cleanup3 ] %cmp1395 = icmp sgt i32 %.lcssa, 1 br i1 %cmp1395, label %for.body15.lr.ph, label %for.cond.cleanup14 for.body15.lr.ph: ; preds = %for.cond12.preheader %5 = load i32, ptr %D, align 4 %.fr = freeze i32 %5 %cmp22.not86 = icmp slt i32 %.fr, 1 br i1 %cmp22.not86, label %for.cond12.loopexit.us.preheader, label %for.body15.preheader for.cond12.loopexit.us.preheader: ; preds = %for.body15.lr.ph %6 = add i32 %.lcssa, -1 %min.iters.check142 = icmp ult i32 %.lcssa, 9 br i1 %min.iters.check142, label %for.cond12.loopexit.us.preheader159, label %vector.ph143 vector.ph143: ; preds = %for.cond12.loopexit.us.preheader %n.vec145 = and i32 %6, -8 %ind.end146 = sub i32 %.lcssa, %n.vec145 %ind.end148 = or i32 %n.vec145, 1 %.splatinsert = insertelement <4 x i32> poison, i32 %.lcssa, i64 0 %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %induction = add <4 x i32> %.splat, <i32 0, i32 -1, i32 -2, i32 -3> br label %vector.body151 vector.body151: ; preds = %vector.body151, %vector.ph143 %index152 = phi i32 [ 0, %vector.ph143 ], [ %index.next156, %vector.body151 ] %vec.ind = phi <4 x i32> [ %induction, %vector.ph143 ], [ %vec.ind.next, %vector.body151 ] %vec.phi154 = phi <4 x i32> [ zeroinitializer, %vector.ph143 ], [ %9, %vector.body151 ] %vec.phi155 = phi <4 x i32> [ zeroinitializer, %vector.ph143 ], [ %10, %vector.body151 ] %7 = add <4 x i32> %vec.ind, <i32 -1, i32 -1, i32 -1, i32 -1> %8 = add <4 x i32> %vec.ind, <i32 -5, i32 -5, i32 -5, i32 -5> %9 = add <4 x i32> %vec.phi154, %7 %10 = add <4 x i32> %vec.phi155, %8 %index.next156 = add nuw i32 %index152, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 -8, i32 -8, i32 -8, i32 -8> %11 = icmp eq i32 %index.next156, %n.vec145 br i1 %11, label %middle.block140, label %vector.body151, !llvm.loop !9 middle.block140: ; preds = %vector.body151 %bin.rdx157 = add <4 x i32> %10, %9 %12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx157) %cmp.n150 = icmp eq i32 %6, %n.vec145 br i1 %cmp.n150, label %for.cond.cleanup14, label %for.cond12.loopexit.us.preheader159 for.cond12.loopexit.us.preheader159: ; preds = %for.cond12.loopexit.us.preheader, %middle.block140 %indvars.iv123.in.ph = phi i32 [ %.lcssa, %for.cond12.loopexit.us.preheader ], [ %ind.end146, %middle.block140 ] %i11.097.us.ph = phi i32 [ 1, %for.cond12.loopexit.us.preheader ], [ %ind.end148, %middle.block140 ] %S.096.us.ph = phi i32 [ 0, %for.cond12.loopexit.us.preheader ], [ %12, %middle.block140 ] br label %for.cond12.loopexit.us for.body15.preheader: ; preds = %for.body15.lr.ph %13 = add nuw i32 %.fr, 1 %14 = add nuw i32 %.lcssa, 1 %wide.trip.count121 = zext i32 %.lcssa to i64 %wide.trip.count116 = zext i32 %14 to i64 %wide.trip.count = zext i32 %13 to i64 %15 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %.fr, 8 %n.vec = and i64 %15, -8 %ind.end = or i64 %n.vec, 1 %cmp.n = icmp eq i64 %15, %n.vec br label %for.cond21.preheader.lr.ph for.cond12.loopexit.us: ; preds = %for.cond12.loopexit.us.preheader159, %for.cond12.loopexit.us %indvars.iv123.in = phi i32 [ %indvars.iv123, %for.cond12.loopexit.us ], [ %indvars.iv123.in.ph, %for.cond12.loopexit.us.preheader159 ] %i11.097.us = phi i32 [ %add.us, %for.cond12.loopexit.us ], [ %i11.097.us.ph, %for.cond12.loopexit.us.preheader159 ] %S.096.us = phi i32 [ %16, %for.cond12.loopexit.us ], [ %S.096.us.ph, %for.cond12.loopexit.us.preheader159 ] %indvars.iv123 = add i32 %indvars.iv123.in, -1 %add.us = add nuw nsw i32 %i11.097.us, 1 %16 = add i32 %S.096.us, %indvars.iv123 %exitcond125.not = icmp eq i32 %add.us, %.lcssa br i1 %exitcond125.not, label %for.cond.cleanup14, label %for.cond12.loopexit.us, !llvm.loop !13 for.cond.cleanup3.loopexit: ; preds = %for.body4 %.pre = load i32, ptr %N, align 4, !tbaa !5 br label %for.cond.cleanup3 for.cond.cleanup3: ; preds = %for.cond.cleanup3.loopexit, %for.cond1.preheader %17 = phi i32 [ %.pre, %for.cond.cleanup3.loopexit ], [ %3, %for.cond1.preheader ] %18 = phi i32 [ %20, %for.cond.cleanup3.loopexit ], [ %4, %for.cond1.preheader ] %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1 %19 = sext i32 %17 to i64 %cmp.not.not = icmp slt i64 %indvars.iv105, %19 br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond12.preheader, !llvm.loop !14 for.body4: ; preds = %for.cond1.preheader, %for.body4 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.cond1.preheader ] %arrayidx6 = getelementptr inbounds [20 x [20 x i32]], ptr %X, i64 0, i64 %indvars.iv105, i64 %indvars.iv %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %20 = load i32, ptr %D, align 4, !tbaa !5 %21 = sext i32 %20 to i64 %cmp2.not.not = icmp slt i64 %indvars.iv, %21 br i1 %cmp2.not.not, label %for.body4, label %for.cond.cleanup3.loopexit, !llvm.loop !16 for.cond12.loopexit: ; preds = %while.end %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1 %exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121 br i1 %exitcond122.not, label %for.cond.cleanup14, label %for.cond21.preheader.lr.ph, !llvm.loop !17 for.cond.cleanup14: ; preds = %for.cond12.loopexit, %for.cond12.loopexit.us, %middle.block140, %entry, %for.cond12.preheader %S.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %entry ], [ %12, %middle.block140 ], [ %16, %for.cond12.loopexit.us ], [ %spec.select, %for.cond12.loopexit ] %call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %S.0.lcssa) call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %X) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 for.cond21.preheader.lr.ph: ; preds = %for.cond12.loopexit, %for.body15.preheader %indvars.iv118 = phi i64 [ 1, %for.body15.preheader ], [ %indvars.iv.next119, %for.cond12.loopexit ] %indvars.iv111 = phi i64 [ 2, %for.body15.preheader ], [ %indvars.iv.next112, %for.cond12.loopexit ] %S.096 = phi i32 [ 0, %for.body15.preheader ], [ %spec.select, %for.cond12.loopexit ] %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 br label %for.cond21.preheader for.cond21.preheader: ; preds = %for.cond21.preheader.lr.ph, %while.end %indvars.iv113 = phi i64 [ %indvars.iv111, %for.cond21.preheader.lr.ph ], [ %indvars.iv.next114, %while.end ] %S.191 = phi i32 [ %S.096, %for.cond21.preheader.lr.ph ], [ %spec.select, %while.end ] br i1 %min.iters.check, label %for.body24.preheader, label %vector.body vector.body: ; preds = %for.cond21.preheader, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond21.preheader ] %vec.phi = phi <4 x i32> [ %30, %vector.body ], [ zeroinitializer, %for.cond21.preheader ] %vec.phi136 = phi <4 x i32> [ %31, %vector.body ], [ zeroinitializer, %for.cond21.preheader ] %offset.idx = or i64 %index, 1 %22 = getelementptr inbounds [20 x [20 x i32]], ptr %X, i64 0, i64 %indvars.iv118, i64 %offset.idx %wide.load = load <4 x i32>, ptr %22, align 4, !tbaa !5 %23 = getelementptr inbounds i32, ptr %22, i64 4 %wide.load137 = load <4 x i32>, ptr %23, align 4, !tbaa !5 %24 = getelementptr inbounds [20 x [20 x i32]], ptr %X, i64 0, i64 %indvars.iv113, i64 %offset.idx %wide.load138 = load <4 x i32>, ptr %24, align 4, !tbaa !5 %25 = getelementptr inbounds i32, ptr %24, i64 4 %wide.load139 = load <4 x i32>, ptr %25, align 4, !tbaa !5 %26 = sub nsw <4 x i32> %wide.load, %wide.load138 %27 = sub nsw <4 x i32> %wide.load137, %wide.load139 %28 = mul nsw <4 x i32> %26, %26 %29 = mul nsw <4 x i32> %27, %27 %30 = add <4 x i32> %28, %vec.phi %31 = add <4 x i32> %29, %vec.phi136 %index.next = add nuw i64 %index, 8 %32 = icmp eq i64 %index.next, %n.vec br i1 %32, label %middle.block, label %vector.body, !llvm.loop !18 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %31, %30 %33 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) br i1 %cmp.n, label %for.cond21.while.cond.preheader_crit_edge, label %for.body24.preheader for.body24.preheader: ; preds = %for.cond21.preheader, %middle.block %indvars.iv108.ph = phi i64 [ 1, %for.cond21.preheader ], [ %ind.end, %middle.block ] %d.087.ph = phi i32 [ 0, %for.cond21.preheader ], [ %33, %middle.block ] br label %for.body24 for.cond21.while.cond.preheader_crit_edge: ; preds = %for.body24, %middle.block %add42.lcssa = phi i32 [ %33, %middle.block ], [ %add42, %for.body24 ] br label %while.cond for.body24: ; preds = %for.body24.preheader, %for.body24 %indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.body24 ], [ %indvars.iv108.ph, %for.body24.preheader ] %d.087 = phi i32 [ %add42, %for.body24 ], [ %d.087.ph, %for.body24.preheader ] %arrayidx28 = getelementptr inbounds [20 x [20 x i32]], ptr %X, i64 0, i64 %indvars.iv118, i64 %indvars.iv108 %34 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %arrayidx32 = getelementptr inbounds [20 x [20 x i32]], ptr %X, i64 0, i64 %indvars.iv113, i64 %indvars.iv108 %35 = load i32, ptr %arrayidx32, align 4, !tbaa !5 %sub = sub nsw i32 %34, %35 %mul = mul nsw i32 %sub, %sub %add42 = add nuw nsw i32 %mul, %d.087 %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1 %exitcond.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count br i1 %exitcond.not, label %for.cond21.while.cond.preheader_crit_edge, label %for.body24, !llvm.loop !19 while.cond: ; preds = %while.cond, %for.cond21.while.cond.preheader_crit_edge %p.0 = phi i32 [ %inc48, %while.cond ], [ 0, %for.cond21.while.cond.preheader_crit_edge ] %mul46 = mul nsw i32 %p.0, %p.0 %cmp47 = icmp ult i32 %mul46, %add42.lcssa %inc48 = add nuw nsw i32 %p.0, 1 br i1 %cmp47, label %while.cond, label %while.end, !llvm.loop !20 while.end: ; preds = %while.cond %cmp50 = icmp eq i32 %mul46, %add42.lcssa %inc51 = zext i1 %cmp50 to i32 %spec.select = add nsw i32 %S.191, %inc51 %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1 %exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count116 br i1 %exitcond117.not, label %for.cond12.loopexit, label %for.cond21.preheader, !llvm.loop !21 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10, !15} !15 = !{!"llvm.loop.unswitch.partial.disable"} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10, !11, !12} !19 = distinct !{!19, !10, !12, !11} !20 = distinct !{!20, !10} !21 = distinct !{!21, !10}
#include<stdio.h> #include<math.h> int main(void) { int i,j,k,n,d,count=0,sum=0; int x[11][11]; scanf("%d%d",&n,&d); for(i=0;i<n;i++){ for(j=0;j<d;j++) scanf("%d",&x[i][j]); } for(i=0;i<n-1;i++){ for(j=1;j+i<n;j++){ for(k=0;k<d;k++){ sum+=(x[i][k]-x[i+j][k])*(x[i][k]-x[i+j][k]); } if(sqrt(sum)-(int)sqrt(sum)==0) count++; sum=0; } } printf("%d",count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312769/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312769/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %d = alloca i32, align 4 %x = alloca [11 x [11 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 484, ptr nonnull %x) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp84 = icmp sgt i32 %0, 0 br i1 %cmp84, label %for.cond1.preheader.lr.ph, label %for.end57 for.cond1.preheader.lr.ph: ; preds = %entry %1 = load i32, ptr %d, align 4, !tbaa !5 %2 = icmp sgt i32 %1, 0 br i1 %2, label %for.cond1.preheader, label %for.cond10.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc7 %3 = phi i32 [ %8, %for.inc7 ], [ %0, %for.cond1.preheader.lr.ph ] %4 = phi i32 [ %9, %for.inc7 ], [ %1, %for.cond1.preheader.lr.ph ] %indvars.iv102 = phi i64 [ %indvars.iv.next103, %for.inc7 ], [ 0, %for.cond1.preheader.lr.ph ] %cmp282 = icmp sgt i32 %4, 0 br i1 %cmp282, label %for.body3, label %for.inc7 for.cond10.preheader: ; preds = %for.inc7, %for.cond1.preheader.lr.ph %5 = phi i32 [ %0, %for.cond1.preheader.lr.ph ], [ %8, %for.inc7 ] %cmp1196 = icmp sgt i32 %5, 1 br i1 %cmp1196, label %for.cond13.preheader, label %for.end57 for.body3: ; preds = %for.cond1.preheader, %for.body3 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ] %arrayidx5 = getelementptr inbounds [11 x [11 x i32]], ptr %x, i64 0, i64 %indvars.iv102, i64 %indvars.iv %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = load i32, ptr %d, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %7 br i1 %cmp2, label %for.body3, label %for.inc7.loopexit, !llvm.loop !9 for.inc7.loopexit: ; preds = %for.body3 %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc7 for.inc7: ; preds = %for.inc7.loopexit, %for.cond1.preheader %8 = phi i32 [ %.pre, %for.inc7.loopexit ], [ %3, %for.cond1.preheader ] %9 = phi i32 [ %6, %for.inc7.loopexit ], [ %4, %for.cond1.preheader ] %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1 %10 = sext i32 %8 to i64 %cmp = icmp slt i64 %indvars.iv.next103, %10 br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !11 for.cond13.preheader: ; preds = %for.cond10.preheader, %for.inc55 %11 = phi i32 [ %31, %for.inc55 ], [ %5, %for.cond10.preheader ] %indvars.iv118 = phi i64 [ %indvars.iv.next119, %for.inc55 ], [ 0, %for.cond10.preheader ] %indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.inc55 ], [ 1, %for.cond10.preheader ] %count.098 = phi i32 [ %count.1.lcssa, %for.inc55 ], [ 0, %for.cond10.preheader ] %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1 %12 = sext i32 %11 to i64 %cmp1490 = icmp slt i64 %indvars.iv.next119, %12 br i1 %cmp1490, label %for.cond16.preheader, label %for.inc55 for.cond16.preheader: ; preds = %for.cond13.preheader, %for.end42 %indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.end42 ], [ 1, %for.cond13.preheader ] %indvars.iv110 = phi i64 [ %indvars.iv.next111, %for.end42 ], [ %indvars.iv108, %for.cond13.preheader ] %count.192 = phi i32 [ %count.2, %for.end42 ], [ %count.098, %for.cond13.preheader ] %13 = load i32, ptr %d, align 4, !tbaa !5 %cmp1786 = icmp sgt i32 %13, 0 br i1 %cmp1786, label %for.body18.lr.ph, label %for.end42 for.body18.lr.ph: ; preds = %for.cond16.preheader %wide.trip.count = zext i32 %13 to i64 %min.iters.check = icmp ult i32 %13, 8 br i1 %min.iters.check, label %for.body18.preheader, label %vector.ph vector.ph: ; preds = %for.body18.lr.ph %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ] %vec.phi126 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ] %14 = getelementptr inbounds [11 x [11 x i32]], ptr %x, i64 0, i64 %indvars.iv118, i64 %index %wide.load = load <4 x i32>, ptr %14, align 4, !tbaa !5 %15 = getelementptr inbounds i32, ptr %14, i64 4 %wide.load127 = load <4 x i32>, ptr %15, align 4, !tbaa !5 %16 = getelementptr inbounds [11 x [11 x i32]], ptr %x, i64 0, i64 %indvars.iv110, i64 %index %wide.load128 = load <4 x i32>, ptr %16, align 4, !tbaa !5 %17 = getelementptr inbounds i32, ptr %16, i64 4 %wide.load129 = load <4 x i32>, ptr %17, align 4, !tbaa !5 %18 = sub nsw <4 x i32> %wide.load, %wide.load128 %19 = sub nsw <4 x i32> %wide.load127, %wide.load129 %20 = mul nsw <4 x i32> %18, %18 %21 = mul nsw <4 x i32> %19, %19 %22 = add <4 x i32> %20, %vec.phi %23 = add <4 x i32> %21, %vec.phi126 %index.next = add nuw i64 %index, 8 %24 = icmp eq i64 %index.next, %n.vec br i1 %24, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %23, %22 %25 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end42, label %for.body18.preheader for.body18.preheader: ; preds = %for.body18.lr.ph, %middle.block %indvars.iv105.ph = phi i64 [ 0, %for.body18.lr.ph ], [ %n.vec, %middle.block ] %sum.288.ph = phi i32 [ 0, %for.body18.lr.ph ], [ %25, %middle.block ] br label %for.body18 for.body18: ; preds = %for.body18.preheader, %for.body18 %indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.body18 ], [ %indvars.iv105.ph, %for.body18.preheader ] %sum.288 = phi i32 [ %add39, %for.body18 ], [ %sum.288.ph, %for.body18.preheader ] %arrayidx22 = getelementptr inbounds [11 x [11 x i32]], ptr %x, i64 0, i64 %indvars.iv118, i64 %indvars.iv105 %26 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %arrayidx27 = getelementptr inbounds [11 x [11 x i32]], ptr %x, i64 0, i64 %indvars.iv110, i64 %indvars.iv105 %27 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %sub28 = sub nsw i32 %26, %27 %mul = mul nsw i32 %sub28, %sub28 %add39 = add nuw nsw i32 %mul, %sum.288 %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1 %exitcond.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count br i1 %exitcond.not, label %for.end42, label %for.body18, !llvm.loop !16 for.end42: ; preds = %for.body18, %middle.block, %for.cond16.preheader %sum.2.lcssa = phi i32 [ 0, %for.cond16.preheader ], [ %25, %middle.block ], [ %add39, %for.body18 ] %conv = sitofp i32 %sum.2.lcssa to double %call43 = call double @sqrt(double noundef %conv) #5 %call45 = call double @sqrt(double noundef %conv) #5 %conv46 = fptosi double %call45 to i32 %conv47 = sitofp i32 %conv46 to double %sub48 = fsub double %call43, %conv47 %cmp49 = fcmp oeq double %sub48, 0.000000e+00 %inc51 = zext i1 %cmp49 to i32 %count.2 = add nsw i32 %count.192, %inc51 %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1 %28 = add nuw nsw i64 %indvars.iv.next113, %indvars.iv118 %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1 %29 = load i32, ptr %n, align 4, !tbaa !5 %30 = trunc i64 %28 to i32 %cmp14 = icmp sgt i32 %29, %30 br i1 %cmp14, label %for.cond16.preheader, label %for.inc55, !llvm.loop !17 for.inc55: ; preds = %for.end42, %for.cond13.preheader %31 = phi i32 [ %11, %for.cond13.preheader ], [ %29, %for.end42 ] %count.1.lcssa = phi i32 [ %count.098, %for.cond13.preheader ], [ %count.2, %for.end42 ] %sub = add nsw i32 %31, -1 %32 = sext i32 %sub to i64 %cmp11 = icmp slt i64 %indvars.iv.next119, %32 %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1 br i1 %cmp11, label %for.cond13.preheader, label %for.end57, !llvm.loop !18 for.end57: ; preds = %for.inc55, %entry, %for.cond10.preheader %count.0.lcssa = phi i32 [ 0, %for.cond10.preheader ], [ 0, %entry ], [ %count.1.lcssa, %for.inc55 ] %call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 484, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4 attributes #0 = { nofree 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 = { mustprogress nofree nounwind willreturn memory(write) "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10, !12} !12 = !{!"llvm.loop.unswitch.partial.disable"} !13 = distinct !{!13, !10, !14, !15} !14 = !{!"llvm.loop.isvectorized", i32 1} !15 = !{!"llvm.loop.unroll.runtime.disable"} !16 = distinct !{!16, !10, !15, !14} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10}
#include<stdio.h> #include<math.h> int a[10][10],d; double calculation(int i,int j) { int k; double result=0; for(k=0; k<d; k++) result+=((a[i][k]-a[j][k])*(a[i][k]-a[j][k])); result=sqrt(result); return result; } int main() { int n,i,j,c=0; double ans; scanf("%d%d",&n,&d); for(i=0; i<n; i++) for(j=0; j<d; j++) scanf("%d",&a[i][j]); for(i=0; i<n-1; i++) { for(j=i+1; j<n; j++) { ans=calculation(i,j); if(ans==(int)ans) c++; } } printf("%d\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312811/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312811/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @d = dso_local global i32 0, align 4 @a = dso_local global [10 x [10 x i32]] zeroinitializer, align 16 @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable define dso_local double @calculation(i32 noundef %i, i32 noundef %j) local_unnamed_addr #0 { entry: %0 = load i32, ptr @d, align 4, !tbaa !5 %cmp25 = icmp sgt i32 %0, 0 br i1 %cmp25, label %for.body.lr.ph, label %for.end for.body.lr.ph: ; preds = %entry %idxprom = sext i32 %i to i64 %idxprom3 = sext i32 %j to i64 %wide.trip.count = zext i32 %0 to i64 %xtraiter = and i64 %wide.trip.count, 1 %1 = icmp eq i32 %0, 1 br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body for.body: ; preds = %for.body, %for.body.lr.ph.new %indvars.iv = phi i64 [ 0, %for.body.lr.ph.new ], [ %indvars.iv.next.1, %for.body ] %result.027 = phi double [ 0.000000e+00, %for.body.lr.ph.new ], [ %add.1, %for.body ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ] %arrayidx2 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %indvars.iv %2 = load i32, ptr %arrayidx2, align 8, !tbaa !5 %arrayidx6 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %idxprom3, i64 %indvars.iv %3 = load i32, ptr %arrayidx6, align 8, !tbaa !5 %sub = sub nsw i32 %2, %3 %mul = mul nsw i32 %sub, %sub %conv = sitofp i32 %mul to double %add = fadd double %result.027, %conv %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx2.1 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %indvars.iv.next %4 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5 %arrayidx6.1 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %idxprom3, i64 %indvars.iv.next %5 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %4, %5 %mul.1 = mul nsw i32 %sub.1, %sub.1 %conv.1 = sitofp i32 %mul.1 to double %add.1 = fadd double %add, %conv.1 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %add.lcssa.ph = phi double [ undef, %for.body.lr.ph ], [ %add.1, %for.body ] %indvars.iv.unr = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next.1, %for.body ] %result.027.unr = phi double [ 0.000000e+00, %for.body.lr.ph ], [ %add.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %arrayidx2.epil = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %indvars.iv.unr %6 = load i32, ptr %arrayidx2.epil, align 4, !tbaa !5 %arrayidx6.epil = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %idxprom3, i64 %indvars.iv.unr %7 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %6, %7 %mul.epil = mul nsw i32 %sub.epil, %sub.epil %conv.epil = sitofp i32 %mul.epil to double %add.epil = fadd double %result.027.unr, %conv.epil br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry %result.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %for.body.epil ] %call = tail call double @sqrt(double noundef %result.0.lcssa) #5 ret double %call } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double 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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull @d) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp43 = icmp sgt i32 %0, 0 br i1 %cmp43, label %for.cond1.preheader.lr.ph, label %for.end26 for.cond1.preheader.lr.ph: ; preds = %entry %1 = load i32, ptr @d, align 4, !tbaa !5 %2 = icmp sgt i32 %1, 0 br i1 %2, label %for.cond1.preheader, label %for.cond10.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc7 %3 = phi i32 [ %8, %for.inc7 ], [ %0, %for.cond1.preheader.lr.ph ] %4 = phi i32 [ %9, %for.inc7 ], [ %1, %for.cond1.preheader.lr.ph ] %indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.inc7 ], [ 0, %for.cond1.preheader.lr.ph ] %cmp241 = icmp sgt i32 %4, 0 br i1 %cmp241, label %for.body3, label %for.inc7 for.cond10.preheader: ; preds = %for.inc7, %for.cond1.preheader.lr.ph %5 = phi i32 [ %0, %for.cond1.preheader.lr.ph ], [ %8, %for.inc7 ] %cmp1149 = icmp sgt i32 %5, 1 br i1 %cmp1149, label %for.body12, label %for.end26 for.body3: ; preds = %for.cond1.preheader, %for.body3 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ] %arrayidx5 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv55, i64 %indvars.iv %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = load i32, ptr @d, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %7 br i1 %cmp2, label %for.body3, label %for.inc7.loopexit, !llvm.loop !11 for.inc7.loopexit: ; preds = %for.body3 %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc7 for.inc7: ; preds = %for.inc7.loopexit, %for.cond1.preheader %8 = phi i32 [ %.pre, %for.inc7.loopexit ], [ %3, %for.cond1.preheader ] %9 = phi i32 [ %6, %for.inc7.loopexit ], [ %4, %for.cond1.preheader ] %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1 %10 = sext i32 %8 to i64 %cmp = icmp slt i64 %indvars.iv.next56, %10 br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !12 for.cond10.loopexit: ; preds = %calculation.exit, %for.body12 %11 = phi i32 [ %13, %for.body12 ], [ %23, %calculation.exit ] %c.1.lcssa = phi i32 [ %c.050, %for.body12 ], [ %c.2, %calculation.exit ] %sub = add nsw i32 %11, -1 %12 = sext i32 %sub to i64 %cmp11 = icmp slt i64 %indvars.iv.next64, %12 %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1 br i1 %cmp11, label %for.body12, label %for.end26, !llvm.loop !14 for.body12: ; preds = %for.cond10.preheader, %for.cond10.loopexit %13 = phi i32 [ %11, %for.cond10.loopexit ], [ %5, %for.cond10.preheader ] %indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.cond10.loopexit ], [ 0, %for.cond10.preheader ] %indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.cond10.loopexit ], [ 1, %for.cond10.preheader ] %c.050 = phi i32 [ %c.1.lcssa, %for.cond10.loopexit ], [ 0, %for.cond10.preheader ] %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1 %14 = sext i32 %13 to i64 %cmp1445 = icmp slt i64 %indvars.iv.next64, %14 br i1 %cmp1445, label %for.body15, label %for.cond10.loopexit for.body15: ; preds = %for.body12, %calculation.exit %indvars.iv60 = phi i64 [ %indvars.iv.next61, %calculation.exit ], [ %indvars.iv58, %for.body12 ] %c.147 = phi i32 [ %c.2, %calculation.exit ], [ %c.050, %for.body12 ] %15 = load i32, ptr @d, align 4, !tbaa !5 %cmp25.i = icmp sgt i32 %15, 0 br i1 %cmp25.i, label %for.body.lr.ph.i, label %calculation.exit for.body.lr.ph.i: ; preds = %for.body15 %wide.trip.count.i = zext i32 %15 to i64 %xtraiter = and i64 %wide.trip.count.i, 1 %16 = icmp eq i32 %15, 1 br i1 %16, label %calculation.exit.loopexit.unr-lcssa, label %for.body.lr.ph.i.new for.body.lr.ph.i.new: ; preds = %for.body.lr.ph.i %unroll_iter = and i64 %wide.trip.count.i, 4294967294 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i.new %indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i.new ], [ %indvars.iv.next.i.1, %for.body.i ] %result.027.i = phi double [ 0.000000e+00, %for.body.lr.ph.i.new ], [ %add.i.1, %for.body.i ] %niter = phi i64 [ 0, %for.body.lr.ph.i.new ], [ %niter.next.1, %for.body.i ] %arrayidx2.i = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv63, i64 %indvars.iv.i %17 = load i32, ptr %arrayidx2.i, align 8, !tbaa !5 %arrayidx6.i = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv60, i64 %indvars.iv.i %18 = load i32, ptr %arrayidx6.i, align 8, !tbaa !5 %sub.i = sub nsw i32 %17, %18 %mul.i = mul nsw i32 %sub.i, %sub.i %conv.i = sitofp i32 %mul.i to double %add.i = fadd double %result.027.i, %conv.i %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %arrayidx2.i.1 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv63, i64 %indvars.iv.next.i %19 = load i32, ptr %arrayidx2.i.1, align 4, !tbaa !5 %arrayidx6.i.1 = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv60, i64 %indvars.iv.next.i %20 = load i32, ptr %arrayidx6.i.1, align 4, !tbaa !5 %sub.i.1 = sub nsw i32 %19, %20 %mul.i.1 = mul nsw i32 %sub.i.1, %sub.i.1 %conv.i.1 = sitofp i32 %mul.i.1 to double %add.i.1 = fadd double %add.i, %conv.i.1 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %calculation.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !9 calculation.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.lr.ph.i %add.i.lcssa.ph = phi double [ undef, %for.body.lr.ph.i ], [ %add.i.1, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i.1, %for.body.i ] %result.027.i.unr = phi double [ 0.000000e+00, %for.body.lr.ph.i ], [ %add.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %calculation.exit, label %for.body.i.epil for.body.i.epil: ; preds = %calculation.exit.loopexit.unr-lcssa %arrayidx2.i.epil = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv63, i64 %indvars.iv.i.unr %21 = load i32, ptr %arrayidx2.i.epil, align 4, !tbaa !5 %arrayidx6.i.epil = getelementptr inbounds [10 x [10 x i32]], ptr @a, i64 0, i64 %indvars.iv60, i64 %indvars.iv.i.unr %22 = load i32, ptr %arrayidx6.i.epil, align 4, !tbaa !5 %sub.i.epil = sub nsw i32 %21, %22 %mul.i.epil = mul nsw i32 %sub.i.epil, %sub.i.epil %conv.i.epil = sitofp i32 %mul.i.epil to double %add.i.epil = fadd double %result.027.i.unr, %conv.i.epil br label %calculation.exit calculation.exit: ; preds = %for.body.i.epil, %calculation.exit.loopexit.unr-lcssa, %for.body15 %result.0.lcssa.i = phi double [ 0.000000e+00, %for.body15 ], [ %add.i.lcssa.ph, %calculation.exit.loopexit.unr-lcssa ], [ %add.i.epil, %for.body.i.epil ] %call.i = call double @sqrt(double noundef %result.0.lcssa.i) #5 %conv = fptosi double %call.i to i32 %conv17 = sitofp i32 %conv to double %cmp18 = fcmp oeq double %call.i, %conv17 %inc20 = zext i1 %cmp18 to i32 %c.2 = add nsw i32 %c.147, %inc20 %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1 %23 = load i32, ptr %n, align 4, !tbaa !5 %24 = sext i32 %23 to i64 %cmp14 = icmp slt i64 %indvars.iv.next61, %24 br i1 %cmp14, label %for.body15, label %for.cond10.loopexit, !llvm.loop !15 for.end26: ; preds = %for.cond10.loopexit, %entry, %for.cond10.preheader %c.0.lcssa = phi i32 [ 0, %for.cond10.preheader ], [ 0, %entry ], [ %c.1.lcssa, %for.cond10.loopexit ] %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 attributes #0 = { nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) 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 = { mustprogress nofree nounwind willreturn memory(write) "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 = { nofree 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 #4 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13} !13 = !{!"llvm.loop.unswitch.partial.disable"} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10}
#include<stdio.h> #include<string.h> #include<math.h> #define FOR(n) for(int i=0;i<n;i++) #define FORJ(n) for(int j=0;j<n;j++) #define PRN(n) printf("%d\n",n) #define PRS(s) printf("%s\n",s) #define PRC(c) printf("%c\n",c) int main(void){ int n,d; scanf("%d %d",&n,&d); int x[n][d],cnt=0; FOR(n){ FORJ(d)scanf("%d",&x[i][j]); if(i){ FORJ(i){ int ans=0; for(int k=0;k<d;k++){ ans+=pow(x[i][k]-x[j][k],2); } if(pow(ans,0.5)==(int)pow(ans,0.5))cnt++; } } } PRN(cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312855/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312855/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = load i32, ptr %d, align 4, !tbaa !5 %3 = zext i32 %2 to i64 %4 = call ptr @llvm.stacksave.p0() %5 = mul nuw i64 %3, %1 %vla = alloca i32, i64 %5, align 16 %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp73 = icmp sgt i32 %6, 0 br i1 %cmp73, label %for.cond1.preheader, label %for.cond.cleanup for.cond1.preheader: ; preds = %entry, %for.inc45 %indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.inc45 ], [ 0, %entry ] %cnt.074 = phi i32 [ %cnt.3, %for.inc45 ], [ 0, %entry ] %7 = load i32, ptr %d, align 4, !tbaa !5 %cmp266 = icmp sgt i32 %7, 0 br i1 %cmp266, label %for.body4.lr.ph, label %for.cond.cleanup3 for.body4.lr.ph: ; preds = %for.cond1.preheader %8 = mul nuw nsw i64 %indvars.iv86, %3 %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %8 br label %for.body4 for.cond.cleanup: ; preds = %for.inc45, %entry %cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.3, %for.inc45 ] %call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa) call void @llvm.stackrestore.p0(ptr %4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 for.cond.cleanup3: ; preds = %for.body4, %for.cond1.preheader %tobool.not = icmp eq i64 %indvars.iv86, 0 br i1 %tobool.not, label %for.inc45, label %for.cond9.preheader for.cond9.preheader: ; preds = %for.cond.cleanup3 %9 = mul nuw nsw i64 %indvars.iv86, %3 %arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %9 br label %for.cond13.preheader for.body4: ; preds = %for.body4.lr.ph, %for.body4 %indvars.iv = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next, %for.body4 ] %arrayidx6 = getelementptr inbounds i32, ptr %arrayidx, i64 %indvars.iv %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %10 = load i32, ptr %d, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp2 = icmp slt i64 %indvars.iv.next, %11 br i1 %cmp2, label %for.body4, label %for.cond.cleanup3, !llvm.loop !9 for.cond13.preheader: ; preds = %for.cond9.preheader, %for.cond.cleanup15 %indvars.iv81 = phi i64 [ 0, %for.cond9.preheader ], [ %indvars.iv.next82, %for.cond.cleanup15 ] %cnt.171 = phi i32 [ %cnt.074, %for.cond9.preheader ], [ %cnt.2, %for.cond.cleanup15 ] %12 = load i32, ptr %d, align 4, !tbaa !5 %cmp1468 = icmp sgt i32 %12, 0 br i1 %cmp1468, label %for.body16.lr.ph, label %for.cond.cleanup15 for.body16.lr.ph: ; preds = %for.cond13.preheader %13 = mul nuw nsw i64 %indvars.iv81, %3 %arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %13 %wide.trip.count = zext i32 %12 to i64 %xtraiter = and i64 %wide.trip.count, 1 %14 = icmp eq i32 %12, 1 br i1 %14, label %for.cond.cleanup15.loopexit.unr-lcssa, label %for.body16.lr.ph.new for.body16.lr.ph.new: ; preds = %for.body16.lr.ph %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body16 for.cond.cleanup15.loopexit.unr-lcssa: ; preds = %for.body16, %for.body16.lr.ph %conv27.lcssa.ph = phi i32 [ undef, %for.body16.lr.ph ], [ %conv27.1, %for.body16 ] %indvars.iv78.unr = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next79.1, %for.body16 ] %ans.069.unr = phi i32 [ 0, %for.body16.lr.ph ], [ %conv27.1, %for.body16 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup15, label %for.body16.epil for.body16.epil: ; preds = %for.cond.cleanup15.loopexit.unr-lcssa %arrayidx20.epil = getelementptr inbounds i32, ptr %arrayidx18, i64 %indvars.iv78.unr %15 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5 %arrayidx24.epil = getelementptr inbounds i32, ptr %arrayidx22, i64 %indvars.iv78.unr %16 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %15, %16 %conv.epil = sitofp i32 %sub.epil to double %square.epil = fmul double %conv.epil, %conv.epil %conv26.epil = sitofp i32 %ans.069.unr to double %add.epil = fadd double %square.epil, %conv26.epil %conv27.epil = fptosi double %add.epil to i32 br label %for.cond.cleanup15 for.cond.cleanup15: ; preds = %for.body16.epil, %for.cond.cleanup15.loopexit.unr-lcssa, %for.cond13.preheader %ans.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ %conv27.lcssa.ph, %for.cond.cleanup15.loopexit.unr-lcssa ], [ %conv27.epil, %for.body16.epil ] %conv31 = sitofp i32 %ans.0.lcssa to double %sqrt = call double @sqrt(double %conv31) #5 %abs = call double @llvm.fabs.f64(double %sqrt) %sqrt64 = call double @sqrt(double %conv31) #5 %abs65 = call double @llvm.fabs.f64(double %sqrt64) %conv35 = fptosi double %abs65 to i32 %conv36 = sitofp i32 %conv35 to double %cmp37 = fcmp oeq double %abs, %conv36 %inc40 = zext i1 %cmp37 to i32 %cnt.2 = add nsw i32 %cnt.171, %inc40 %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1 %exitcond85.not = icmp eq i64 %indvars.iv.next82, %indvars.iv86 br i1 %exitcond85.not, label %for.inc45, label %for.cond13.preheader, !llvm.loop !11 for.body16: ; preds = %for.body16, %for.body16.lr.ph.new %indvars.iv78 = phi i64 [ 0, %for.body16.lr.ph.new ], [ %indvars.iv.next79.1, %for.body16 ] %ans.069 = phi i32 [ 0, %for.body16.lr.ph.new ], [ %conv27.1, %for.body16 ] %niter = phi i64 [ 0, %for.body16.lr.ph.new ], [ %niter.next.1, %for.body16 ] %arrayidx20 = getelementptr inbounds i32, ptr %arrayidx18, i64 %indvars.iv78 %17 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %arrayidx24 = getelementptr inbounds i32, ptr %arrayidx22, i64 %indvars.iv78 %18 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %sub = sub nsw i32 %17, %18 %conv = sitofp i32 %sub to double %square = fmul double %conv, %conv %conv26 = sitofp i32 %ans.069 to double %add = fadd double %square, %conv26 %conv27 = fptosi double %add to i32 %indvars.iv.next79 = or i64 %indvars.iv78, 1 %arrayidx20.1 = getelementptr inbounds i32, ptr %arrayidx18, i64 %indvars.iv.next79 %19 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5 %arrayidx24.1 = getelementptr inbounds i32, ptr %arrayidx22, i64 %indvars.iv.next79 %20 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %19, %20 %conv.1 = sitofp i32 %sub.1 to double %square.1 = fmul double %conv.1, %conv.1 %conv26.1 = sitofp i32 %conv27 to double %add.1 = fadd double %square.1, %conv26.1 %conv27.1 = fptosi double %add.1 to i32 %indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.cleanup15.loopexit.unr-lcssa, label %for.body16, !llvm.loop !12 for.inc45: ; preds = %for.cond.cleanup15, %for.cond.cleanup3 %cnt.3 = phi i32 [ %cnt.074, %for.cond.cleanup3 ], [ %cnt.2, %for.cond.cleanup15 ] %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %21 = load i32, ptr %n, align 4, !tbaa !5 %22 = sext i32 %21 to i64 %cmp = icmp slt i64 %indvars.iv.next87, %22 br i1 %cmp, label %for.cond1.preheader, label %for.cond.cleanup, !llvm.loop !13 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 declare double @sqrt(double) local_unnamed_addr ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10}
#include<stdio.h> #include<math.h> #include<stdlib.h> int main() { int d,n,i,j,k,ret=0; int **x; double l1,l2; scanf("%d%d",&n,&d); x=(int**)malloc(n*sizeof(int*)); for(i=0;i<n;i++) { x[i]=(int*)malloc(d*sizeof(int)); } for(i=0; i<n; i++) { for(j=0;j<d;j++) { scanf("%d",&x[i][j]); } } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { for(l1=0,k=0;k<d;k++) { l1+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]); } l1=sqrt(l1); l2=(int)l1; if(l1==l2) ret++; } } printf("%d\n",ret); for(i=0;i<n;i++) { free(x[i]); } free(x); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312899/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312899/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %d = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 3 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp117 = icmp sgt i32 %0, 0 br i1 %cmp117, label %for.body.lr.ph, label %for.end71 for.body.lr.ph: ; preds = %entry %1 = load i32, ptr %d, align 4, !tbaa !5 %conv3 = sext i32 %1 to i64 %mul4 = shl nsw i64 %conv3, 2 %wide.trip.count = zext i32 %0 to i64 br label %for.body for.cond6.preheader: ; preds = %for.body br i1 %cmp117, label %for.cond10.preheader.lr.ph, label %for.end71 for.cond10.preheader.lr.ph: ; preds = %for.cond6.preheader %2 = load i32, ptr %d, align 4, !tbaa !5 %3 = icmp sgt i32 %2, 0 br i1 %3, label %for.cond10.preheader, label %for.body28.preheader for.body: ; preds = %for.body.lr.ph, %for.body %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ] %call5 = call noalias ptr @malloc(i64 noundef %mul4) #7 %arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv store ptr %call5, ptr %arrayidx, align 8, !tbaa !9 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond6.preheader, label %for.body, !llvm.loop !11 for.cond10.preheader: ; preds = %for.cond10.preheader.lr.ph, %for.inc22 %4 = phi i32 [ %9, %for.inc22 ], [ %0, %for.cond10.preheader.lr.ph ] %5 = phi i32 [ %10, %for.inc22 ], [ %2, %for.cond10.preheader.lr.ph ] %indvars.iv141 = phi i64 [ %indvars.iv.next142, %for.inc22 ], [ 0, %for.cond10.preheader.lr.ph ] %cmp11119 = icmp sgt i32 %5, 0 br i1 %cmp11119, label %for.body13.lr.ph, label %for.inc22 for.body13.lr.ph: ; preds = %for.cond10.preheader %arrayidx15 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv141 %6 = load ptr, ptr %arrayidx15, align 8, !tbaa !9 br label %for.body13 for.cond25.preheader: ; preds = %for.inc22 %cmp26130 = icmp sgt i32 %9, 0 br i1 %cmp26130, label %for.body28.preheader, label %for.end71 for.body28.preheader: ; preds = %for.cond10.preheader.lr.ph, %for.cond25.preheader %.ph = phi i32 [ %0, %for.cond10.preheader.lr.ph ], [ %9, %for.cond25.preheader ] br label %for.body28 for.body13: ; preds = %for.body13.lr.ph, %for.body13 %indvars.iv138 = phi i64 [ 0, %for.body13.lr.ph ], [ %indvars.iv.next139, %for.body13 ] %arrayidx17 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv138 %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx17) %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1 %7 = load i32, ptr %d, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp11 = icmp slt i64 %indvars.iv.next139, %8 br i1 %cmp11, label %for.body13, label %for.inc22.loopexit, !llvm.loop !13 for.inc22.loopexit: ; preds = %for.body13 %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.inc22 for.inc22: ; preds = %for.inc22.loopexit, %for.cond10.preheader %9 = phi i32 [ %.pre, %for.inc22.loopexit ], [ %4, %for.cond10.preheader ] %10 = phi i32 [ %7, %for.inc22.loopexit ], [ %5, %for.cond10.preheader ] %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1 %11 = sext i32 %9 to i64 %cmp7 = icmp slt i64 %indvars.iv.next142, %11 br i1 %cmp7, label %for.cond10.preheader, label %for.cond25.preheader, !llvm.loop !14 for.cond25.loopexit.loopexit: ; preds = %for.end59 %.pre160 = sext i32 %25 to i64 br label %for.cond25.loopexit for.cond25.loopexit: ; preds = %for.cond25.loopexit.loopexit, %for.body28 %.pre-phi = phi i64 [ %.pre160, %for.cond25.loopexit.loopexit ], [ %14, %for.body28 ] %12 = phi i32 [ %25, %for.cond25.loopexit.loopexit ], [ %13, %for.body28 ] %ret.1.lcssa = phi i32 [ %ret.2, %for.cond25.loopexit.loopexit ], [ %ret.0131, %for.body28 ] %cmp26 = icmp slt i64 %indvars.iv.next155, %.pre-phi %indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1 br i1 %cmp26, label %for.body28, label %for.end71, !llvm.loop !16 for.body28: ; preds = %for.body28.preheader, %for.cond25.loopexit %13 = phi i32 [ %12, %for.cond25.loopexit ], [ %.ph, %for.body28.preheader ] %indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.cond25.loopexit ], [ 0, %for.body28.preheader ] %indvars.iv149 = phi i64 [ %indvars.iv.next150, %for.cond25.loopexit ], [ 1, %for.body28.preheader ] %ret.0131 = phi i32 [ %ret.1.lcssa, %for.cond25.loopexit ], [ 0, %for.body28.preheader ] %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1 %14 = sext i32 %13 to i64 %cmp30126 = icmp slt i64 %indvars.iv.next155, %14 br i1 %cmp30126, label %for.cond33.preheader.lr.ph, label %for.cond25.loopexit for.cond33.preheader.lr.ph: ; preds = %for.body28 %arrayidx38 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv154 br label %for.cond33.preheader for.cond33.preheader: ; preds = %for.cond33.preheader.lr.ph, %for.end59 %indvars.iv151 = phi i64 [ %indvars.iv149, %for.cond33.preheader.lr.ph ], [ %indvars.iv.next152, %for.end59 ] %ret.1127 = phi i32 [ %ret.0131, %for.cond33.preheader.lr.ph ], [ %ret.2, %for.end59 ] %15 = load i32, ptr %d, align 4, !tbaa !5 %cmp34123 = icmp sgt i32 %15, 0 br i1 %cmp34123, label %for.body36.lr.ph, label %for.end59 for.body36.lr.ph: ; preds = %for.cond33.preheader %16 = load ptr, ptr %arrayidx38, align 8, !tbaa !9 %arrayidx42 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv151 %17 = load ptr, ptr %arrayidx42, align 8, !tbaa !9 %wide.trip.count147 = zext i32 %15 to i64 %xtraiter = and i64 %wide.trip.count147, 1 %18 = icmp eq i32 %15, 1 br i1 %18, label %for.end59.loopexit.unr-lcssa, label %for.body36.lr.ph.new for.body36.lr.ph.new: ; preds = %for.body36.lr.ph %unroll_iter = and i64 %wide.trip.count147, 4294967294 br label %for.body36 for.body36: ; preds = %for.body36, %for.body36.lr.ph.new %indvars.iv144 = phi i64 [ 0, %for.body36.lr.ph.new ], [ %indvars.iv.next145.1, %for.body36 ] %l1.0125 = phi double [ 0.000000e+00, %for.body36.lr.ph.new ], [ %add56.1, %for.body36 ] %niter = phi i64 [ 0, %for.body36.lr.ph.new ], [ %niter.next.1, %for.body36 ] %arrayidx40 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv144 %19 = load i32, ptr %arrayidx40, align 4, !tbaa !5 %arrayidx44 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv144 %20 = load i32, ptr %arrayidx44, align 4, !tbaa !5 %sub = sub nsw i32 %19, %20 %mul54 = mul nsw i32 %sub, %sub %conv55 = sitofp i32 %mul54 to double %add56 = fadd double %l1.0125, %conv55 %indvars.iv.next145 = or i64 %indvars.iv144, 1 %arrayidx40.1 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv.next145 %21 = load i32, ptr %arrayidx40.1, align 4, !tbaa !5 %arrayidx44.1 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.next145 %22 = load i32, ptr %arrayidx44.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %21, %22 %mul54.1 = mul nsw i32 %sub.1, %sub.1 %conv55.1 = sitofp i32 %mul54.1 to double %add56.1 = fadd double %add56, %conv55.1 %indvars.iv.next145.1 = add nuw nsw i64 %indvars.iv144, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end59.loopexit.unr-lcssa, label %for.body36, !llvm.loop !17 for.end59.loopexit.unr-lcssa: ; preds = %for.body36, %for.body36.lr.ph %add56.lcssa.ph = phi double [ undef, %for.body36.lr.ph ], [ %add56.1, %for.body36 ] %indvars.iv144.unr = phi i64 [ 0, %for.body36.lr.ph ], [ %indvars.iv.next145.1, %for.body36 ] %l1.0125.unr = phi double [ 0.000000e+00, %for.body36.lr.ph ], [ %add56.1, %for.body36 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end59, label %for.body36.epil for.body36.epil: ; preds = %for.end59.loopexit.unr-lcssa %arrayidx40.epil = getelementptr inbounds i32, ptr %16, i64 %indvars.iv144.unr %23 = load i32, ptr %arrayidx40.epil, align 4, !tbaa !5 %arrayidx44.epil = getelementptr inbounds i32, ptr %17, i64 %indvars.iv144.unr %24 = load i32, ptr %arrayidx44.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %23, %24 %mul54.epil = mul nsw i32 %sub.epil, %sub.epil %conv55.epil = sitofp i32 %mul54.epil to double %add56.epil = fadd double %l1.0125.unr, %conv55.epil br label %for.end59 for.end59: ; preds = %for.body36.epil, %for.end59.loopexit.unr-lcssa, %for.cond33.preheader %l1.0.lcssa = phi double [ 0.000000e+00, %for.cond33.preheader ], [ %add56.lcssa.ph, %for.end59.loopexit.unr-lcssa ], [ %add56.epil, %for.body36.epil ] %call60 = call double @sqrt(double noundef %l1.0.lcssa) #6 %conv61 = fptosi double %call60 to i32 %conv62 = sitofp i32 %conv61 to double %cmp63 = fcmp oeq double %call60, %conv62 %inc65 = zext i1 %cmp63 to i32 %ret.2 = add nsw i32 %ret.1127, %inc65 %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1 %25 = load i32, ptr %n, align 4, !tbaa !5 %26 = trunc i64 %indvars.iv.next152 to i32 %cmp30 = icmp sgt i32 %25, %26 br i1 %cmp30, label %for.cond33.preheader, label %for.cond25.loopexit.loopexit, !llvm.loop !18 for.end71: ; preds = %for.cond25.loopexit, %entry, %for.cond6.preheader, %for.cond25.preheader %ret.0.lcssa = phi i32 [ 0, %for.cond25.preheader ], [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %ret.1.lcssa, %for.cond25.loopexit ] %call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ret.0.lcssa) %27 = load i32, ptr %n, align 4, !tbaa !5 %cmp74134 = icmp sgt i32 %27, 0 br i1 %cmp74134, label %for.body76, label %for.end81 for.body76: ; preds = %for.end71, %for.body76 %indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.body76 ], [ 0, %for.end71 ] %arrayidx78 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv157 %28 = load ptr, ptr %arrayidx78, align 8, !tbaa !9 call void @free(ptr noundef %28) #6 %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1 %29 = load i32, ptr %n, align 4, !tbaa !5 %30 = sext i32 %29 to i64 %cmp74 = icmp slt i64 %indvars.iv.next158, %30 br i1 %cmp74, label %for.body76, label %for.end81, !llvm.loop !19 for.end81: ; preds = %for.body76, %for.end71 call void @free(ptr noundef %call1) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5 ; 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 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(write) "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 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 #6 = { nounwind } attributes #7 = { nounwind allocsize(0) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12, !15} !15 = !{!"llvm.loop.unswitch.partial.disable"} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12} !18 = distinct !{!18, !12} !19 = distinct !{!19, !12}
#include <stdio.h> #include <math.h> int main() { int N, D, i, n,m; int array[10][11]; int sum = 0; int count = 0; double kyori; scanf("%d%d", &N, &D); for (i = 1; i <= N; i++) { for (m = 1; m <= D; m++) { scanf("%d", &array[i][m]); } } for (i = 1; i<N; i++) { for (n = i + 1; n <= N; n++) { sum = 0; for (m = 1; m <= D; m++) { sum += pow(array[i][m] - array[n][m], 2); } kyori = pow(sum, 0.5); if (ceil(kyori) == floor(kyori)) { count++; sum = 0; } } } printf("%d\n", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312949/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312949/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %D = alloca i32, align 4 %array = alloca [10 x [11 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #5 call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %array) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %D) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not65 = icmp slt i32 %0, 1 br i1 %cmp.not65, label %for.end44, label %for.cond1.preheader.lr.ph for.cond1.preheader.lr.ph: ; preds = %entry %1 = load i32, ptr %D, align 4, !tbaa !5 %2 = icmp slt i32 %1, 1 br i1 %2, label %for.cond10.preheader, label %for.cond1.preheader for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc7 %3 = phi i32 [ %8, %for.inc7 ], [ %0, %for.cond1.preheader.lr.ph ] %4 = phi i32 [ %9, %for.inc7 ], [ %1, %for.cond1.preheader.lr.ph ] %indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.inc7 ], [ 1, %for.cond1.preheader.lr.ph ] %cmp2.not63 = icmp slt i32 %4, 1 br i1 %cmp2.not63, label %for.inc7, label %for.body3 for.cond10.preheader: ; preds = %for.inc7, %for.cond1.preheader.lr.ph %5 = phi i32 [ %0, %for.cond1.preheader.lr.ph ], [ %8, %for.inc7 ] %cmp1174 = icmp sgt i32 %5, 1 br i1 %cmp1174, label %for.body12, label %for.end44 for.body3: ; preds = %for.cond1.preheader, %for.body3 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 1, %for.cond1.preheader ] %arrayidx5 = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv80, i64 %indvars.iv %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = load i32, ptr %D, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp2.not.not = icmp slt i64 %indvars.iv, %7 br i1 %cmp2.not.not, label %for.body3, label %for.inc7.loopexit, !llvm.loop !9 for.inc7.loopexit: ; preds = %for.body3 %.pre = load i32, ptr %N, align 4, !tbaa !5 br label %for.inc7 for.inc7: ; preds = %for.inc7.loopexit, %for.cond1.preheader %8 = phi i32 [ %.pre, %for.inc7.loopexit ], [ %3, %for.cond1.preheader ] %9 = phi i32 [ %6, %for.inc7.loopexit ], [ %4, %for.cond1.preheader ] %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %10 = sext i32 %8 to i64 %cmp.not.not = icmp slt i64 %indvars.iv80, %10 br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !11 for.cond10.loopexit: ; preds = %for.end33, %for.body12 %.pre-phi = phi i64 [ %13, %for.body12 ], [ %26, %for.end33 ] %11 = phi i32 [ %12, %for.body12 ], [ %25, %for.end33 ] %count.1.lcssa = phi i32 [ %count.075, %for.body12 ], [ %count.2, %for.end33 ] %cmp11 = icmp slt i64 %indvars.iv.next92, %.pre-phi %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 br i1 %cmp11, label %for.body12, label %for.end44, !llvm.loop !13 for.body12: ; preds = %for.cond10.preheader, %for.cond10.loopexit %12 = phi i32 [ %11, %for.cond10.loopexit ], [ %5, %for.cond10.preheader ] %indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.cond10.loopexit ], [ 1, %for.cond10.preheader ] %indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.cond10.loopexit ], [ 2, %for.cond10.preheader ] %count.075 = phi i32 [ %count.1.lcssa, %for.cond10.loopexit ], [ 0, %for.cond10.preheader ] %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1 %13 = sext i32 %12 to i64 %cmp14.not70.not = icmp slt i64 %indvars.iv91, %13 br i1 %cmp14.not70.not, label %for.cond16.preheader, label %for.cond10.loopexit for.cond16.preheader: ; preds = %for.body12, %for.end33 %indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.end33 ], [ %indvars.iv86, %for.body12 ] %count.172 = phi i32 [ %count.2, %for.end33 ], [ %count.075, %for.body12 ] %14 = load i32, ptr %D, align 4, !tbaa !5 %cmp17.not67 = icmp slt i32 %14, 1 br i1 %cmp17.not67, label %for.end33, label %for.body18.lr.ph for.body18.lr.ph: ; preds = %for.cond16.preheader %15 = zext i32 %14 to i64 %xtraiter = and i64 %15, 1 %16 = icmp eq i32 %14, 1 br i1 %16, label %for.end33.loopexit.unr-lcssa, label %for.body18.lr.ph.new for.body18.lr.ph.new: ; preds = %for.body18.lr.ph %unroll_iter = and i64 %15, 4294967294 br label %for.body18 for.body18: ; preds = %for.body18, %for.body18.lr.ph.new %indvars.iv83 = phi i64 [ 1, %for.body18.lr.ph.new ], [ %indvars.iv.next84.1, %for.body18 ] %sum.069 = phi i32 [ 0, %for.body18.lr.ph.new ], [ %conv30.1, %for.body18 ] %niter = phi i64 [ 0, %for.body18.lr.ph.new ], [ %niter.next.1, %for.body18 ] %arrayidx22 = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv91, i64 %indvars.iv83 %17 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %arrayidx26 = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv88, i64 %indvars.iv83 %18 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %sub = sub nsw i32 %17, %18 %conv = sitofp i32 %sub to double %square = fmul double %conv, %conv %conv28 = sitofp i32 %sum.069 to double %add29 = fadd double %square, %conv28 %conv30 = fptosi double %add29 to i32 %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %arrayidx22.1 = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv91, i64 %indvars.iv.next84 %19 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5 %arrayidx26.1 = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv88, i64 %indvars.iv.next84 %20 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %19, %20 %conv.1 = sitofp i32 %sub.1 to double %square.1 = fmul double %conv.1, %conv.1 %conv28.1 = sitofp i32 %conv30 to double %add29.1 = fadd double %square.1, %conv28.1 %conv30.1 = fptosi double %add29.1 to i32 %indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end33.loopexit.unr-lcssa, label %for.body18, !llvm.loop !14 for.end33.loopexit.unr-lcssa: ; preds = %for.body18, %for.body18.lr.ph %conv30.lcssa.ph = phi i32 [ undef, %for.body18.lr.ph ], [ %conv30.1, %for.body18 ] %indvars.iv83.unr = phi i64 [ 1, %for.body18.lr.ph ], [ %indvars.iv.next84.1, %for.body18 ] %sum.069.unr = phi i32 [ 0, %for.body18.lr.ph ], [ %conv30.1, %for.body18 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end33, label %for.body18.epil for.body18.epil: ; preds = %for.end33.loopexit.unr-lcssa %arrayidx22.epil = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv91, i64 %indvars.iv83.unr %21 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !5 %arrayidx26.epil = getelementptr inbounds [10 x [11 x i32]], ptr %array, i64 0, i64 %indvars.iv88, i64 %indvars.iv83.unr %22 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %21, %22 %conv.epil = sitofp i32 %sub.epil to double %square.epil = fmul double %conv.epil, %conv.epil %conv28.epil = sitofp i32 %sum.069.unr to double %add29.epil = fadd double %square.epil, %conv28.epil %conv30.epil = fptosi double %add29.epil to i32 br label %for.end33 for.end33: ; preds = %for.body18.epil, %for.end33.loopexit.unr-lcssa, %for.cond16.preheader %sum.0.lcssa = phi i32 [ 0, %for.cond16.preheader ], [ %conv30.lcssa.ph, %for.end33.loopexit.unr-lcssa ], [ %conv30.epil, %for.body18.epil ] %conv34 = sitofp i32 %sum.0.lcssa to double %sqrt = call double @sqrt(double %conv34) #5 %abs = call double @llvm.fabs.f64(double %sqrt) %23 = call double @llvm.ceil.f64(double %abs) %24 = call double @llvm.floor.f64(double %abs) %cmp36 = fcmp oeq double %23, %24 %inc38 = zext i1 %cmp36 to i32 %count.2 = add nsw i32 %count.172, %inc38 %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1 %25 = load i32, ptr %N, align 4, !tbaa !5 %26 = sext i32 %25 to i64 %cmp14.not.not = icmp slt i64 %indvars.iv88, %26 br i1 %cmp14.not.not, label %for.cond16.preheader, label %for.cond10.loopexit, !llvm.loop !15 for.end44: ; preds = %for.cond10.loopexit, %entry, %for.cond10.preheader %count.0.lcssa = phi i32 [ 0, %for.cond10.preheader ], [ 0, %entry ], [ %count.1.lcssa, %for.cond10.loopexit ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %array) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.ceil.f64(double) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.floor.f64(double) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 declare double @sqrt(double) local_unnamed_addr ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare double @llvm.fabs.f64(double) #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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10, !12} !12 = !{!"llvm.loop.unswitch.partial.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10}
#include<stdio.h> #include<math.h> #define df 0 int main(){ int n,d; scanf("%d%d",&n,&d); int pos[100],i; for(i=0;i<n*d;i++) scanf("%d",&pos[i]); int j,count=0,a,b,k; for(i=0;i<n-1;i++){ for(j=i+1;j<n;j++){ a=0; for(k=0;k<d;k++){ a+=(pos[i*d+k]-pos[j*d+k])*(pos[i*d+k]-pos[j*d+k]); } b=sqrt(a); b=b*b; if(df)printf("%d %d\n",a,b); if(a==b)count++; } } printf("%d",count); return 0; } /// confirm df==0 ///
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_312992/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_312992/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %d = alloca i32, align 4 %pos = alloca [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %d) call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %pos) #5 %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = load i32, ptr %d, align 4, !tbaa !5 %mul67 = mul nsw i32 %1, %0 %cmp68 = icmp sgt i32 %mul67, 0 br i1 %cmp68, label %for.body, label %for.cond2.preheader for.cond2.preheader: ; preds = %for.body, %entry %2 = phi i32 [ %0, %entry ], [ %3, %for.body ] %cmp378 = icmp sgt i32 %2, 1 br i1 %cmp378, label %for.body4, label %for.end45 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %pos, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = load i32, ptr %d, align 4, !tbaa !5 %mul = mul nsw i32 %4, %3 %5 = sext i32 %mul to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond2.loopexit: ; preds = %for.end33, %for.body4 %6 = phi i32 [ %7, %for.body4 ], [ %29, %for.end33 ] %count.1.lcssa = phi i32 [ %count.079, %for.body4 ], [ %spec.select, %for.end33 ] %sub = add nsw i32 %6, -1 %cmp3 = icmp slt i32 %add, %sub br i1 %cmp3, label %for.body4, label %for.end45, !llvm.loop !11 for.body4: ; preds = %for.cond2.preheader, %for.cond2.loopexit %7 = phi i32 [ %6, %for.cond2.loopexit ], [ %2, %for.cond2.preheader ] %i.180 = phi i32 [ %add, %for.cond2.loopexit ], [ 0, %for.cond2.preheader ] %count.079 = phi i32 [ %count.1.lcssa, %for.cond2.loopexit ], [ 0, %for.cond2.preheader ] %add = add nuw nsw i32 %i.180, 1 %cmp673 = icmp slt i32 %add, %7 br i1 %cmp673, label %for.cond8.preheader, label %for.cond2.loopexit for.cond8.preheader: ; preds = %for.body4, %for.end33 %count.175 = phi i32 [ %spec.select, %for.end33 ], [ %count.079, %for.body4 ] %j.074 = phi i32 [ %inc41, %for.end33 ], [ %add, %for.body4 ] %8 = load i32, ptr %d, align 4, !tbaa !5 %cmp970 = icmp sgt i32 %8, 0 br i1 %cmp970, label %for.body10.lr.ph, label %for.end33 for.body10.lr.ph: ; preds = %for.cond8.preheader %mul11 = mul nsw i32 %8, %i.180 %mul15 = mul nsw i32 %8, %j.074 %9 = sext i32 %mul11 to i64 %10 = sext i32 %mul15 to i64 %wide.trip.count = zext i32 %8 to i64 %min.iters.check = icmp ult i32 %8, 8 br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph vector.ph: ; preds = %for.body10.lr.ph %n.vec = and i64 %wide.trip.count, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ] %vec.phi90 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ] %11 = add nsw i64 %index, %9 %12 = getelementptr inbounds [100 x i32], ptr %pos, i64 0, i64 %11 %wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5 %13 = getelementptr inbounds i32, ptr %12, i64 4 %wide.load91 = load <4 x i32>, ptr %13, align 4, !tbaa !5 %14 = add nsw i64 %index, %10 %15 = getelementptr inbounds [100 x i32], ptr %pos, i64 0, i64 %14 %wide.load92 = load <4 x i32>, ptr %15, align 4, !tbaa !5 %16 = getelementptr inbounds i32, ptr %15, i64 4 %wide.load93 = load <4 x i32>, ptr %16, align 4, !tbaa !5 %17 = sub nsw <4 x i32> %wide.load, %wide.load92 %18 = sub nsw <4 x i32> %wide.load91, %wide.load93 %19 = mul nsw <4 x i32> %17, %17 %20 = mul nsw <4 x i32> %18, %18 %21 = add <4 x i32> %19, %vec.phi %22 = add <4 x i32> %20, %vec.phi90 %index.next = add nuw i64 %index, 8 %23 = icmp eq i64 %index.next, %n.vec br i1 %23, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %22, %21 %24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end33, label %for.body10.preheader for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block %indvars.iv83.ph = phi i64 [ 0, %for.body10.lr.ph ], [ %n.vec, %middle.block ] %a.071.ph = phi i32 [ 0, %for.body10.lr.ph ], [ %24, %middle.block ] br label %for.body10 for.body10: ; preds = %for.body10.preheader, %for.body10 %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body10 ], [ %indvars.iv83.ph, %for.body10.preheader ] %a.071 = phi i32 [ %add30, %for.body10 ], [ %a.071.ph, %for.body10.preheader ] %25 = add nsw i64 %indvars.iv83, %9 %arrayidx14 = getelementptr inbounds [100 x i32], ptr %pos, i64 0, i64 %25 %26 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %27 = add nsw i64 %indvars.iv83, %10 %arrayidx18 = getelementptr inbounds [100 x i32], ptr %pos, i64 0, i64 %27 %28 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %sub19 = sub nsw i32 %26, %28 %mul29 = mul nsw i32 %sub19, %sub19 %add30 = add nuw nsw i32 %mul29, %a.071 %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %exitcond.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count br i1 %exitcond.not, label %for.end33, label %for.body10, !llvm.loop !15 for.end33: ; preds = %for.body10, %middle.block, %for.cond8.preheader %a.0.lcssa = phi i32 [ 0, %for.cond8.preheader ], [ %24, %middle.block ], [ %add30, %for.body10 ] %conv = sitofp i32 %a.0.lcssa to double %call34 = call double @sqrt(double noundef %conv) #5 %conv35 = fptosi double %call34 to i32 %mul36 = mul nsw i32 %conv35, %conv35 %cmp37 = icmp eq i32 %a.0.lcssa, %mul36 %inc39 = zext i1 %cmp37 to i32 %spec.select = add nsw i32 %count.175, %inc39 %inc41 = add nuw nsw i32 %j.074, 1 %29 = load i32, ptr %n, align 4, !tbaa !5 %cmp6 = icmp slt i32 %inc41, %29 br i1 %cmp6, label %for.cond8.preheader, label %for.cond2.loopexit, !llvm.loop !16 for.end45: ; preds = %for.cond2.loopexit, %for.cond2.preheader %count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %count.1.lcssa, %for.cond2.loopexit ] %call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %pos) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4 attributes #0 = { nofree 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 = { mustprogress nofree nounwind willreturn memory(write) "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !10, !14, !13} !16 = distinct !{!16, !10}
#include<stdio.h> #define min(x,y) ((x<y)?(x):(y)) int main(){ int n,m,d[105][105],f[105],u[105],i,j,x,y,ans; while(scanf("%d",&n)!=EOF){ if(n==0)break; scanf("%d",&m); for(i=0;i<n;i++){ f[i]=1000000; u[i]=0; for(j=0;j<n;j++){ d[i][j]=1000000; } } for(i=0;i<m;i++){ scanf("%d,%d,",&x,&y); scanf("%d",&d[x][y]); d[y][x]=d[x][y]; } ans=1;f[0]=0; while(1){ x=-1; for(i=0;i<n;i++){ if(u[i]==0 && (x==-1 || f[i]<f[x]))x=i; } if(x==-1)break; u[x]=1; ans+=f[x]/100-1; for(i=0;i<n;i++){ f[i]=min(f[i],d[x][i]); } } printf("%d\n",ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313034/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313034/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d,%d,\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %d = alloca [105 x [105 x i32]], align 16 %f = alloca [105 x i32], align 16 %u = alloca [105 x i32], align 16 %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 44100, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %f) #5 call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %u) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5 %call125 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp126 = icmp eq i32 %call125, -1 %0 = load i32, ptr %n, align 4 %cmp1127 = icmp eq i32 %0, 0 %or.cond128 = select i1 %cmp126, i1 true, i1 %cmp1127 br i1 %or.cond128, label %while.end85, label %if.end if.end: ; preds = %entry, %while.end %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp3112 = icmp sgt i32 %1, 0 br i1 %cmp3112, label %for.body.us.preheader, label %for.cond16.preheader for.body.us.preheader: ; preds = %if.end %2 = zext i32 %1 to i64 %3 = shl nuw nsw i64 %2, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %u, i8 0, i64 %3, i1 false), !tbaa !5 %min.iters.check154 = icmp ult i32 %1, 8 %n.vec157 = and i64 %2, 4294967288 %cmp.n159 = icmp eq i64 %n.vec157, %2 br label %for.body.us for.body.us: ; preds = %for.body.us.preheader, %for.cond6.for.inc13_crit_edge.us %indvars.iv130 = phi i64 [ 0, %for.body.us.preheader ], [ %indvars.iv.next131, %for.cond6.for.inc13_crit_edge.us ] %arrayidx.us = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %indvars.iv130 store i32 1000000, ptr %arrayidx.us, align 4, !tbaa !5 br i1 %min.iters.check154, label %for.body8.us.preheader, label %vector.body160 vector.body160: ; preds = %for.body.us, %vector.body160 %index161 = phi i64 [ %index.next162, %vector.body160 ], [ 0, %for.body.us ] %4 = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %indvars.iv130, i64 %index161 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %4, align 4, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> <i32 1000000, i32 1000000, i32 1000000, i32 1000000>, ptr %5, align 4, !tbaa !5 %index.next162 = add nuw i64 %index161, 8 %6 = icmp eq i64 %index.next162, %n.vec157 br i1 %6, label %middle.block152, label %vector.body160, !llvm.loop !9 middle.block152: ; preds = %vector.body160 br i1 %cmp.n159, label %for.cond6.for.inc13_crit_edge.us, label %for.body8.us.preheader for.body8.us.preheader: ; preds = %for.body.us, %middle.block152 %indvars.iv.ph = phi i64 [ 0, %for.body.us ], [ %n.vec157, %middle.block152 ] br label %for.body8.us for.body8.us: ; preds = %for.body8.us.preheader, %for.body8.us %indvars.iv = phi i64 [ %indvars.iv.next, %for.body8.us ], [ %indvars.iv.ph, %for.body8.us.preheader ] %arrayidx12.us = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %indvars.iv130, i64 %indvars.iv store i32 1000000, ptr %arrayidx12.us, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %2 br i1 %exitcond.not, label %for.cond6.for.inc13_crit_edge.us, label %for.body8.us, !llvm.loop !13 for.cond6.for.inc13_crit_edge.us: ; preds = %for.body8.us, %middle.block152 %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1 %exitcond134.not = icmp eq i64 %indvars.iv.next131, %2 br i1 %exitcond134.not, label %for.cond16.preheader, label %for.body.us, !llvm.loop !14 for.cond16.preheader: ; preds = %for.cond6.for.inc13_crit_edge.us, %if.end %7 = load i32, ptr %m, align 4, !tbaa !5 %cmp17114 = icmp sgt i32 %7, 0 br i1 %cmp17114, label %for.body18, label %for.end35 for.body18: ; preds = %for.cond16.preheader, %for.body18 %i.1115 = phi i32 [ %inc34, %for.body18 ], [ 0, %for.cond16.preheader ] %call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %8 = load i32, ptr %x, align 4, !tbaa !5 %idxprom20 = sext i32 %8 to i64 %9 = load i32, ptr %y, align 4, !tbaa !5 %idxprom22 = sext i32 %9 to i64 %arrayidx23 = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %idxprom20, i64 %idxprom22 %call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx23) %10 = load i32, ptr %x, align 4, !tbaa !5 %idxprom25 = sext i32 %10 to i64 %11 = load i32, ptr %y, align 4, !tbaa !5 %idxprom27 = sext i32 %11 to i64 %arrayidx28 = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %idxprom25, i64 %idxprom27 %12 = load i32, ptr %arrayidx28, align 4, !tbaa !5 %arrayidx32 = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %idxprom27, i64 %idxprom25 store i32 %12, ptr %arrayidx32, align 4, !tbaa !5 %inc34 = add nuw nsw i32 %i.1115, 1 %13 = load i32, ptr %m, align 4, !tbaa !5 %cmp17 = icmp slt i32 %inc34, %13 br i1 %cmp17, label %for.body18, label %for.end35.loopexit, !llvm.loop !15 for.end35.loopexit: ; preds = %for.body18 %.pre = load i32, ptr %n, align 4, !tbaa !5 br label %for.end35 for.end35: ; preds = %for.end35.loopexit, %for.cond16.preheader %14 = phi i32 [ %.pre, %for.end35.loopexit ], [ %1, %for.cond16.preheader ] store i32 0, ptr %f, align 16, !tbaa !5 %cmp40118 = icmp sgt i32 %14, 0 %wide.trip.count138 = zext i32 %14 to i64 %wide.trip.count143 = zext i32 %14 to i64 br i1 %cmp40118, label %for.body41.preheader.preheader, label %while.end for.body41.preheader.preheader: ; preds = %for.end35 %xtraiter = and i64 %wide.trip.count138, 1 %15 = icmp eq i32 %14, 1 %unroll_iter = and i64 %wide.trip.count138, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 %min.iters.check = icmp ult i32 %14, 8 %n.vec = and i64 %wide.trip.count138, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count138 br label %for.body41.preheader while.cond37.loopexit: ; preds = %for.body65, %middle.block br i1 %cmp40118, label %for.body41.preheader, label %while.end for.body41.preheader: ; preds = %for.body41.preheader.preheader, %while.cond37.loopexit %ans.0147 = phi i32 [ %add, %while.cond37.loopexit ], [ 1, %for.body41.preheader.preheader ] br i1 %15, label %for.end55.unr-lcssa, label %for.body41 for.body41: ; preds = %for.body41.preheader, %for.inc53.1 %indvars.iv135 = phi i64 [ %indvars.iv.next136.1, %for.inc53.1 ], [ 0, %for.body41.preheader ] %i.2117119 = phi i32 [ %i.2116.1, %for.inc53.1 ], [ -1, %for.body41.preheader ] %niter = phi i64 [ %niter.next.1, %for.inc53.1 ], [ 0, %for.body41.preheader ] %arrayidx43 = getelementptr inbounds [105 x i32], ptr %u, i64 0, i64 %indvars.iv135 %16 = load i32, ptr %arrayidx43, align 8, !tbaa !5 %cmp44 = icmp eq i32 %16, 0 br i1 %cmp44, label %land.lhs.true, label %for.inc53 land.lhs.true: ; preds = %for.body41 %cmp45 = icmp eq i32 %i.2117119, -1 br i1 %cmp45, label %if.then51, label %lor.lhs.false lor.lhs.false: ; preds = %land.lhs.true %arrayidx47 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %indvars.iv135 %17 = load i32, ptr %arrayidx47, align 8, !tbaa !5 %idxprom48 = sext i32 %i.2117119 to i64 %arrayidx49 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %idxprom48 %18 = load i32, ptr %arrayidx49, align 4, !tbaa !5 %cmp50 = icmp slt i32 %17, %18 br i1 %cmp50, label %if.then51, label %for.inc53 if.then51: ; preds = %lor.lhs.false, %land.lhs.true %19 = trunc i64 %indvars.iv135 to i32 br label %for.inc53 for.inc53: ; preds = %for.body41, %lor.lhs.false, %if.then51 %i.2116 = phi i32 [ %i.2117119, %for.body41 ], [ %i.2117119, %lor.lhs.false ], [ %19, %if.then51 ] %indvars.iv.next136 = or i64 %indvars.iv135, 1 %arrayidx43.1 = getelementptr inbounds [105 x i32], ptr %u, i64 0, i64 %indvars.iv.next136 %20 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5 %cmp44.1 = icmp eq i32 %20, 0 br i1 %cmp44.1, label %land.lhs.true.1, label %for.inc53.1 land.lhs.true.1: ; preds = %for.inc53 %cmp45.1 = icmp eq i32 %i.2116, -1 br i1 %cmp45.1, label %if.then51.1, label %lor.lhs.false.1 lor.lhs.false.1: ; preds = %land.lhs.true.1 %arrayidx47.1 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %indvars.iv.next136 %21 = load i32, ptr %arrayidx47.1, align 4, !tbaa !5 %idxprom48.1 = sext i32 %i.2116 to i64 %arrayidx49.1 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %idxprom48.1 %22 = load i32, ptr %arrayidx49.1, align 4, !tbaa !5 %cmp50.1 = icmp slt i32 %21, %22 br i1 %cmp50.1, label %if.then51.1, label %for.inc53.1 if.then51.1: ; preds = %lor.lhs.false.1, %land.lhs.true.1 %23 = trunc i64 %indvars.iv.next136 to i32 br label %for.inc53.1 for.inc53.1: ; preds = %if.then51.1, %lor.lhs.false.1, %for.inc53 %i.2116.1 = phi i32 [ %i.2116, %for.inc53 ], [ %i.2116, %lor.lhs.false.1 ], [ %23, %if.then51.1 ] %indvars.iv.next136.1 = add nuw nsw i64 %indvars.iv135, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end55.unr-lcssa, label %for.body41, !llvm.loop !16 for.end55.unr-lcssa: ; preds = %for.inc53.1, %for.body41.preheader %i.2116.lcssa.ph = phi i32 [ undef, %for.body41.preheader ], [ %i.2116.1, %for.inc53.1 ] %indvars.iv135.unr = phi i64 [ 0, %for.body41.preheader ], [ %indvars.iv.next136.1, %for.inc53.1 ] %i.2117119.unr = phi i32 [ -1, %for.body41.preheader ], [ %i.2116.1, %for.inc53.1 ] br i1 %lcmp.mod.not, label %for.end55, label %for.body41.epil for.body41.epil: ; preds = %for.end55.unr-lcssa %arrayidx43.epil = getelementptr inbounds [105 x i32], ptr %u, i64 0, i64 %indvars.iv135.unr %24 = load i32, ptr %arrayidx43.epil, align 4, !tbaa !5 %cmp44.epil = icmp eq i32 %24, 0 br i1 %cmp44.epil, label %land.lhs.true.epil, label %for.end55 land.lhs.true.epil: ; preds = %for.body41.epil %cmp45.epil = icmp eq i32 %i.2117119.unr, -1 br i1 %cmp45.epil, label %if.then51.epil, label %lor.lhs.false.epil lor.lhs.false.epil: ; preds = %land.lhs.true.epil %arrayidx47.epil = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %indvars.iv135.unr %25 = load i32, ptr %arrayidx47.epil, align 4, !tbaa !5 %idxprom48.epil = sext i32 %i.2117119.unr to i64 %arrayidx49.epil = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %idxprom48.epil %26 = load i32, ptr %arrayidx49.epil, align 4, !tbaa !5 %cmp50.epil = icmp slt i32 %25, %26 br i1 %cmp50.epil, label %if.then51.epil, label %for.end55 if.then51.epil: ; preds = %lor.lhs.false.epil, %land.lhs.true.epil %27 = trunc i64 %indvars.iv135.unr to i32 br label %for.end55 for.end55: ; preds = %for.body41.epil, %lor.lhs.false.epil, %if.then51.epil, %for.end55.unr-lcssa %i.2116.lcssa = phi i32 [ %i.2116.lcssa.ph, %for.end55.unr-lcssa ], [ %i.2117119.unr, %for.body41.epil ], [ %i.2117119.unr, %lor.lhs.false.epil ], [ %27, %if.then51.epil ] %cmp56 = icmp eq i32 %i.2116.lcssa, -1 br i1 %cmp56, label %while.end, label %if.end58 if.end58: ; preds = %for.end55 %idxprom59 = sext i32 %i.2116.lcssa to i64 %arrayidx60 = getelementptr inbounds [105 x i32], ptr %u, i64 0, i64 %idxprom59 store i32 1, ptr %arrayidx60, align 4, !tbaa !5 %arrayidx62 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %idxprom59 %28 = load i32, ptr %arrayidx62, align 4, !tbaa !5 %div = sdiv i32 %28, 100 %sub = add i32 %ans.0147, -1 %add = add i32 %sub, %div br i1 %cmp40118, label %for.body65.preheader, label %while.end for.body65.preheader: ; preds = %if.end58 br i1 %min.iters.check, label %for.body65.preheader163, label %vector.body vector.body: ; preds = %for.body65.preheader, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body65.preheader ] %29 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %29, align 16, !tbaa !5 %30 = getelementptr inbounds i32, ptr %29, i64 4 %wide.load149 = load <4 x i32>, ptr %30, align 16, !tbaa !5 %31 = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %idxprom59, i64 %index %wide.load150 = load <4 x i32>, ptr %31, align 4, !tbaa !5 %32 = getelementptr inbounds i32, ptr %31, i64 4 %wide.load151 = load <4 x i32>, ptr %32, align 4, !tbaa !5 %33 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load150) %34 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load149, <4 x i32> %wide.load151) store <4 x i32> %33, ptr %29, align 16, !tbaa !5 store <4 x i32> %34, ptr %30, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %35 = icmp eq i64 %index.next, %n.vec br i1 %35, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body br i1 %cmp.n, label %while.cond37.loopexit, label %for.body65.preheader163 for.body65.preheader163: ; preds = %for.body65.preheader, %middle.block %indvars.iv140.ph = phi i64 [ 0, %for.body65.preheader ], [ %n.vec, %middle.block ] br label %for.body65 for.body65: ; preds = %for.body65.preheader163, %for.body65 %indvars.iv140 = phi i64 [ %indvars.iv.next141, %for.body65 ], [ %indvars.iv140.ph, %for.body65.preheader163 ] %arrayidx67 = getelementptr inbounds [105 x i32], ptr %f, i64 0, i64 %indvars.iv140 %36 = load i32, ptr %arrayidx67, align 4, !tbaa !5 %arrayidx71 = getelementptr inbounds [105 x [105 x i32]], ptr %d, i64 0, i64 %idxprom59, i64 %indvars.iv140 %37 = load i32, ptr %arrayidx71, align 4, !tbaa !5 %. = call i32 @llvm.smin.i32(i32 %36, i32 %37) store i32 %., ptr %arrayidx67, align 4, !tbaa !5 %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1 %exitcond144.not = icmp eq i64 %indvars.iv.next141, %wide.trip.count143 br i1 %exitcond144.not, label %while.cond37.loopexit, label %for.body65, !llvm.loop !18 while.end: ; preds = %for.end55, %while.cond37.loopexit, %if.end58, %for.end35 %ans.0.lcssa = phi i32 [ 1, %for.end35 ], [ %ans.0147, %for.end55 ], [ %add, %while.cond37.loopexit ], [ %add, %if.end58 ] store i32 -1, ptr %x, align 4, !tbaa !5 %call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp = icmp eq i32 %call, -1 %38 = load i32, ptr %n, align 4 %cmp1 = icmp eq i32 %38, 0 %or.cond = select i1 %cmp, i1 true, i1 %cmp1 br i1 %or.cond, label %while.end85, label %if.end, !llvm.loop !19 while.end85: ; preds = %while.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %u) #5 call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %f) #5 call void @llvm.lifetime.end.p0(i64 44100, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !11, !12} !18 = distinct !{!18, !10, !12, !11} !19 = distinct !{!19, !10}
#include <stdio.h> int main(void) { int a, b; if (scanf("%d%d", &a, &b) != 2) return 1; printf("%d\n", b >=a ? a : a - 1); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313092/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313092/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %cmp.not = icmp eq i32 %call, 2 br i1 %cmp.not, label %if.end, label %cleanup if.end: ; preds = %entry %0 = load i32, ptr %b, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4 %cmp1.not = icmp slt i32 %0, %1 %sub = sext i1 %cmp1.not to i32 %cond = add nsw i32 %1, %sub %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond) br label %cleanup cleanup: ; preds = %entry, %if.end %retval.0 = phi i32 [ 0, %if.end ], [ 1, %entry ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 %retval.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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void){ int a,b; scanf("%d %d",&a, &b); if(a > b) printf("%d\n",a-1); else printf("%d\n",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313142/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313142/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, %1 %sub = sext i1 %cmp to i32 %.sink = add nsw i32 %0, %sub %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a, b; int ans = 0; scanf("%d %d", &a, &b); ans += a - 1; if (a <= b) { ans++; } printf("%d\n", ans); return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313193/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313193/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %0, %1 %sub = sext i1 %cmp.not to i32 %spec.select = add nsw i32 %0, %sub %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { int a,b; scanf("%d %d",&a,&b); if(a<=b){ printf("%d",a); }else{ printf("%d",a-1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313250/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313250/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %0, %1 %sub = sext i1 %cmp.not to i32 %sub.sink = add nsw i32 %0, %sub %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a, b; scanf("%d%d", &a, &b); if(b >= a) printf("%d", a); else printf("%d", a-1); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313294/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313294/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %b, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4, !tbaa !5 %cmp.not = icmp slt i32 %0, %1 %sub = sext i1 %cmp.not to i32 %sub.sink = add nsw i32 %1, %sub %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int a,ac=0,wa=0,tle=0,re=0; char huruf[10]; scanf("%d",&a); for(int i=0;i<a;i++){ scanf("%s",huruf); if(huruf[0] == 'A'){ ac++; }else if(huruf[0]=='W'){ wa++; }else if(huruf[0]=='T'){ tle++; }else if(huruf[0]=='R'){ re++; } } printf("AC x %d\n",ac); printf("WA x %d\n",wa); printf("TLE x %d\n",tle); printf("RE x %d",re); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313337/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313337/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.5 = private unnamed_addr constant [8 x i8] c"RE x %d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %huruf = alloca [10 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %huruf) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.inc, %entry %ac.0.lcssa = phi i32 [ 0, %entry ], [ %ac.1, %for.inc ] %wa.0.lcssa = phi i32 [ 0, %entry ], [ %wa.1, %for.inc ] %tle.0.lcssa = phi i32 [ 0, %entry ], [ %tle.1, %for.inc ] %re.0.lcssa = phi i32 [ 0, %entry ], [ %re.1, %for.inc ] %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ac.0.lcssa) %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %wa.0.lcssa) %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %tle.0.lcssa) %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %re.0.lcssa) call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %huruf) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 ret i32 0 for.body: ; preds = %entry, %for.inc %i.042 = phi i32 [ %inc27, %for.inc ], [ 0, %entry ] %re.041 = phi i32 [ %re.1, %for.inc ], [ 0, %entry ] %tle.040 = phi i32 [ %tle.1, %for.inc ], [ 0, %entry ] %wa.039 = phi i32 [ %wa.1, %for.inc ], [ 0, %entry ] %ac.038 = phi i32 [ %ac.1, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %huruf) %1 = load i8, ptr %huruf, align 1, !tbaa !9 switch i8 %1, label %for.inc [ i8 65, label %if.then i8 87, label %if.then8 i8 84, label %if.then15 i8 82, label %if.then22 ] if.then: ; preds = %for.body %inc = add nsw i32 %ac.038, 1 br label %for.inc if.then8: ; preds = %for.body %inc9 = add nsw i32 %wa.039, 1 br label %for.inc if.then15: ; preds = %for.body %inc16 = add nsw i32 %tle.040, 1 br label %for.inc if.then22: ; preds = %for.body %inc23 = add nsw i32 %re.041, 1 br label %for.inc for.inc: ; preds = %for.body, %if.then, %if.then15, %if.then22, %if.then8 %ac.1 = phi i32 [ %inc, %if.then ], [ %ac.038, %if.then8 ], [ %ac.038, %if.then15 ], [ %ac.038, %if.then22 ], [ %ac.038, %for.body ] %wa.1 = phi i32 [ %wa.039, %if.then ], [ %inc9, %if.then8 ], [ %wa.039, %if.then15 ], [ %wa.039, %if.then22 ], [ %wa.039, %for.body ] %tle.1 = phi i32 [ %tle.040, %if.then ], [ %tle.040, %if.then8 ], [ %inc16, %if.then15 ], [ %tle.040, %if.then22 ], [ %tle.040, %for.body ] %re.1 = phi i32 [ %re.041, %if.then ], [ %re.041, %if.then8 ], [ %re.041, %if.then15 ], [ %inc23, %if.then22 ], [ %re.041, %for.body ] %inc27 = add nuw nsw i32 %i.042, 1 %2 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp slt i32 %inc27, %2 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { int N = 0; char Sn[3]; int AC = 0; int WA = 0; int TLE = 0; int RE = 0; scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%s", Sn); if (Sn[0] == 'A') { AC++; }else if (Sn[0] == 'W') { WA++; } else if (Sn[0] == 'T') { TLE++; } else { RE++; } } printf("AC x %d\n", AC ); printf("WA x %d\n", WA ); printf("TLE x %d\n", TLE); printf("RE x %d\n", RE ); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313388/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313388/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.5 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %Sn = alloca [3 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 store i32 0, ptr %N, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %Sn) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.inc, %entry %AC.0.lcssa = phi i32 [ 0, %entry ], [ %AC.1, %for.inc ] %WA.0.lcssa = phi i32 [ 0, %entry ], [ %WA.1, %for.inc ] %TLE.0.lcssa = phi i32 [ 0, %entry ], [ %TLE.1, %for.inc ] %RE.0.lcssa = phi i32 [ 0, %entry ], [ %RE.1, %for.inc ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %AC.0.lcssa) %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %WA.0.lcssa) %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %TLE.0.lcssa) %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %RE.0.lcssa) call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %Sn) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3 ret i32 0 for.body: ; preds = %entry, %for.inc %i.036 = phi i32 [ %inc21, %for.inc ], [ 0, %entry ] %RE.035 = phi i32 [ %RE.1, %for.inc ], [ 0, %entry ] %TLE.034 = phi i32 [ %TLE.1, %for.inc ], [ 0, %entry ] %WA.033 = phi i32 [ %WA.1, %for.inc ], [ 0, %entry ] %AC.032 = phi i32 [ %AC.1, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %Sn) %1 = load i8, ptr %Sn, align 1, !tbaa !9 switch i8 %1, label %if.else17 [ i8 65, label %if.then i8 87, label %if.then8 i8 84, label %if.then15 ] if.then: ; preds = %for.body %inc = add nsw i32 %AC.032, 1 br label %for.inc if.then8: ; preds = %for.body %inc9 = add nsw i32 %WA.033, 1 br label %for.inc if.then15: ; preds = %for.body %inc16 = add nsw i32 %TLE.034, 1 br label %for.inc if.else17: ; preds = %for.body %inc18 = add nsw i32 %RE.035, 1 br label %for.inc for.inc: ; preds = %if.then, %if.then15, %if.else17, %if.then8 %AC.1 = phi i32 [ %inc, %if.then ], [ %AC.032, %if.then8 ], [ %AC.032, %if.then15 ], [ %AC.032, %if.else17 ] %WA.1 = phi i32 [ %WA.033, %if.then ], [ %inc9, %if.then8 ], [ %WA.033, %if.then15 ], [ %WA.033, %if.else17 ] %TLE.1 = phi i32 [ %TLE.034, %if.then ], [ %TLE.034, %if.then8 ], [ %inc16, %if.then15 ], [ %TLE.034, %if.else17 ] %RE.1 = phi i32 [ %RE.035, %if.then ], [ %RE.035, %if.then8 ], [ %RE.035, %if.then15 ], [ %inc18, %if.else17 ] %inc21 = add nuw nsw i32 %i.036, 1 %2 = load i32, ptr %N, align 4, !tbaa !5 %cmp = icmp slt i32 %inc21, %2 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> #include <stdlib.h> char res[10]; int ac, wa, tle, re; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%s", res); if (res[0] == 'A') ac++; else if (res[0] == 'W') wa++; else if (res[0] == 'T') tle++; else re++; } printf("AC x %d\n", ac ); printf("WA x %d\n", wa ); printf("TLE x %d\n", tle ); printf("RE x %d\n", re ); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313430/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313430/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @res = dso_local global [10 x i8] zeroinitializer, align 1 @ac = dso_local local_unnamed_addr global i32 0, align 4 @wa = dso_local local_unnamed_addr global i32 0, align 4 @tle = dso_local local_unnamed_addr global i32 0, align 4 @re = dso_local local_unnamed_addr global i32 0, align 4 @.str.2 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.5 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp25 = icmp sgt i32 %0, 0 br i1 %cmp25, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.inc, %entry %1 = load i32, ptr @ac, align 4, !tbaa !5 %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1) %2 = load i32, ptr @wa, align 4, !tbaa !5 %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %2) %3 = load i32, ptr @tle, align 4, !tbaa !5 %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %3) %4 = load i32, ptr @re, align 4, !tbaa !5 %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 for.body: ; preds = %entry, %for.inc %i.026 = phi i32 [ %inc19, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @res) %5 = load i8, ptr @res, align 1, !tbaa !9 switch i8 %5, label %if.else15 [ i8 65, label %for.inc i8 87, label %if.then7 i8 84, label %if.then13 ] if.then7: ; preds = %for.body br label %for.inc if.then13: ; preds = %for.body br label %for.inc if.else15: ; preds = %for.body br label %for.inc for.inc: ; preds = %for.body, %if.then13, %if.else15, %if.then7 %ac.sink27 = phi ptr [ @tle, %if.then13 ], [ @re, %if.else15 ], [ @wa, %if.then7 ], [ @ac, %for.body ] %6 = load i32, ptr %ac.sink27, align 4, !tbaa !5 %inc = add nsw i32 %6, 1 store i32 %inc, ptr %ac.sink27, align 4, !tbaa !5 %inc19 = add nuw nsw i32 %i.026, 1 %7 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc19, %7 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { char buf[10]; int x; char ans[10]; int a = 0; int b = 0; int c = 0; int d = 0; char ac[10] = "AC"; char wa[10] = "WA"; char tle[10] = "TLE"; char re[10] = "RE"; fgets(buf, sizeof(buf), stdin); sscanf(buf, "%d", &x); for(int i = 0; i < x; i++){ fgets(buf, sizeof(buf), stdin); sscanf(buf, "%s", ans); if(ans[0] == 'A'){ a++; } else if (ans[0] == 'W'){ b++; } else if (ans[0] == 'T'){ c++; } else if (ans[0] == 'R'){ d++; } } printf("AC x %d\n", a); printf("WA x %d\n", b); printf("TLE x %d\n", c); printf("RE x %d\n", d); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313481/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313481/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdin = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.5 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %buf = alloca [10 x i8], align 1 %x = alloca i32, align 4 %ans = alloca [10 x i8], align 1 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %buf) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %ans) #3 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 10, ptr noundef %0) %call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %buf, ptr noundef nonnull @.str, ptr noundef nonnull %x) #3 %1 = load i32, ptr %x, align 4, !tbaa !9 %cmp43 = icmp sgt i32 %1, 0 br i1 %cmp43, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.inc, %entry %a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1, %for.inc ] %b.0.lcssa = phi i32 [ 0, %entry ], [ %b.1, %for.inc ] %c.0.lcssa = phi i32 [ 0, %entry ], [ %c.1, %for.inc ] %d.0.lcssa = phi i32 [ 0, %entry ], [ %d.1, %for.inc ] %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %a.0.lcssa) %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %b.0.lcssa) %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %c.0.lcssa) %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %d.0.lcssa) call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %ans) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3 call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %buf) #3 ret i32 0 for.body: ; preds = %entry, %for.inc %i.048 = phi i32 [ %inc33, %for.inc ], [ 0, %entry ] %d.047 = phi i32 [ %d.1, %for.inc ], [ 0, %entry ] %c.046 = phi i32 [ %c.1, %for.inc ], [ 0, %entry ] %b.045 = phi i32 [ %b.1, %for.inc ], [ 0, %entry ] %a.044 = phi i32 [ %a.1, %for.inc ], [ 0, %entry ] %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call4 = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 10, ptr noundef %2) %call7 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %buf, ptr noundef nonnull @.str.1, ptr noundef nonnull %ans) #3 %3 = load i8, ptr %ans, align 1, !tbaa !11 switch i8 %3, label %for.inc [ i8 65, label %if.then i8 87, label %if.then14 i8 84, label %if.then21 i8 82, label %if.then28 ] if.then: ; preds = %for.body %inc = add nsw i32 %a.044, 1 br label %for.inc if.then14: ; preds = %for.body %inc15 = add nsw i32 %b.045, 1 br label %for.inc if.then21: ; preds = %for.body %inc22 = add nsw i32 %c.046, 1 br label %for.inc if.then28: ; preds = %for.body %inc29 = add nsw i32 %d.047, 1 br label %for.inc for.inc: ; preds = %for.body, %if.then, %if.then21, %if.then28, %if.then14 %a.1 = phi i32 [ %inc, %if.then ], [ %a.044, %if.then14 ], [ %a.044, %if.then21 ], [ %a.044, %if.then28 ], [ %a.044, %for.body ] %b.1 = phi i32 [ %b.045, %if.then ], [ %inc15, %if.then14 ], [ %b.045, %if.then21 ], [ %b.045, %if.then28 ], [ %b.045, %for.body ] %c.1 = phi i32 [ %c.046, %if.then ], [ %c.046, %if.then14 ], [ %inc22, %if.then21 ], [ %c.046, %if.then28 ], [ %c.046, %for.body ] %d.1 = phi i32 [ %d.047, %if.then ], [ %d.047, %if.then14 ], [ %d.047, %if.then21 ], [ %inc29, %if.then28 ], [ %d.047, %for.body ] %inc33 = add nuw nsw i32 %i.048, 1 %4 = load i32, ptr %x, align 4, !tbaa !9 %cmp = icmp slt i32 %inc33, %4 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"}
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <malloc.h> int main(void) { int N; int a = 0; int b = 0; int c = 0; int d = 0; char* S; scanf("%d", &N); S = (char *)calloc(N, sizeof(char)); for (int i = 0; i < N; i++) { scanf("%s", &S[i]); if ((strcmp(S + i, "AC")) == 0) { a++; } else if ((strcmp(S + i, "WA")) == 0) { b++; } else if ((strcmp(S + i, "TLE")) == 0) { c++; } else if ((strcmp(S + i, "RE")) == 0) { d++; } else { ; } } printf("AC x %d\n", a); printf("WA x %d\n", b); printf("TLE x %d\n", c); printf("RE x %d\n", d); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313524/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313524/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"WA\00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"TLE\00", align 1 @.str.5 = private unnamed_addr constant [3 x i8] c"RE\00", align 1 @.str.6 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.7 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.8 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.9 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 1) #6 %cmp53 = icmp sgt i32 %0, 0 br i1 %cmp53, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.inc, %entry %b.0.lcssa = phi i32 [ 0, %entry ], [ %b.1, %for.inc ] %c.0.lcssa = phi i32 [ 0, %entry ], [ %c.1, %for.inc ] %d.0.lcssa = phi i32 [ 0, %entry ], [ %d.1, %for.inc ] %a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1, %for.inc ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %a.0.lcssa) %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %b.0.lcssa) %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %c.0.lcssa) %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %d.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5 ret i32 0 for.body: ; preds = %entry, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] %a.057 = phi i32 [ %a.1, %for.inc ], [ 0, %entry ] %d.056 = phi i32 [ %d.1, %for.inc ], [ 0, %entry ] %c.055 = phi i32 [ %c.1, %for.inc ], [ 0, %entry ] %b.054 = phi i32 [ %b.1, %for.inc ], [ 0, %entry ] %arrayidx = getelementptr inbounds i8, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx) %call4 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(3) @.str.2) #7 %cmp5 = icmp eq i32 %call4, 0 br i1 %cmp5, label %if.then, label %if.else if.then: ; preds = %for.body %inc = add nsw i32 %a.057, 1 br label %for.inc if.else: ; preds = %for.body %call9 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(3) @.str.3) #7 %cmp10 = icmp eq i32 %call9, 0 br i1 %cmp10, label %if.then12, label %if.else14 if.then12: ; preds = %if.else %inc13 = add nsw i32 %b.054, 1 br label %for.inc if.else14: ; preds = %if.else %call17 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(4) @.str.4) #7 %cmp18 = icmp eq i32 %call17, 0 br i1 %cmp18, label %if.then20, label %if.else22 if.then20: ; preds = %if.else14 %inc21 = add nsw i32 %c.055, 1 br label %for.inc if.else22: ; preds = %if.else14 %call25 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(3) @.str.5) #7 %cmp26 = icmp eq i32 %call25, 0 %inc29 = zext i1 %cmp26 to i32 %spec.select = add nsw i32 %d.056, %inc29 br label %for.inc for.inc: ; preds = %if.else22, %if.then, %if.then20, %if.then12 %b.1 = phi i32 [ %b.054, %if.then ], [ %inc13, %if.then12 ], [ %b.054, %if.then20 ], [ %b.054, %if.else22 ] %c.1 = phi i32 [ %c.055, %if.then ], [ %c.055, %if.then12 ], [ %inc21, %if.then20 ], [ %c.055, %if.else22 ] %d.1 = phi i32 [ %d.056, %if.then ], [ %d.056, %if.then12 ], [ %d.056, %if.then20 ], [ %spec.select, %if.else22 ] %a.1 = phi i32 [ %inc, %if.then ], [ %a.057, %if.then12 ], [ %a.057, %if.then20 ], [ %a.057, %if.else22 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %N, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #4 = { 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 #5 = { nounwind } attributes #6 = { nounwind allocsize(0,1) } attributes #7 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> #include<math.h> #include <stdlib.h> #include<ctype.h> //qsort int compare_int(const void *a, const void *b) { return *(int*)a - *(int*)b; } //比較 int max(int a, int b){ if (a>b) return a; else return b; } int min(int a,int b) { if(a>b) return b; else return a; } //main関数 int main() { int N; int ans[4] = {0}; char c; char s[3]; scanf("%d",&N); for(int i = 0; i < N ; i++){ scanf("%s", &s); if(s[0] == 'A')ans[0]++; else if(s[0] == 'W')ans[1]++; else if(s[0] == 'T')ans[2]++; else ans[3]++; scanf("%c", &c); } printf("AC x %d\n", ans[0]); printf("WA x %d\n", ans[1]); printf("TLE x %d\n", ans[2]); printf("RE x %d\n", ans[3]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313568/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313568/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%c\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.5 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.6 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %b.a } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %N = alloca i32, align 4 %c = alloca i8, align 1 %s = alloca [3 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #6 call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp43 = icmp sgt i32 %0, 0 br i1 %cmp43, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %if.end24, %entry %ans.sroa.0.0.lcssa = phi i32 [ 0, %entry ], [ %ans.sroa.0.1, %if.end24 ] %ans.sroa.6.0.lcssa = phi i32 [ 0, %entry ], [ %ans.sroa.6.1, %if.end24 ] %ans.sroa.9.0.lcssa = phi i32 [ 0, %entry ], [ %ans.sroa.9.1, %if.end24 ] %ans.sroa.12.0.lcssa = phi i32 [ 0, %entry ], [ %ans.sroa.12.1, %if.end24 ] %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %ans.sroa.0.0.lcssa) %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %ans.sroa.6.0.lcssa) %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %ans.sroa.9.0.lcssa) %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %ans.sroa.12.0.lcssa) call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #6 call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6 ret i32 0 for.body: ; preds = %entry, %if.end24 %i.048 = phi i32 [ %inc26, %if.end24 ], [ 0, %entry ] %ans.sroa.12.047 = phi i32 [ %ans.sroa.12.1, %if.end24 ], [ 0, %entry ] %ans.sroa.9.046 = phi i32 [ %ans.sroa.9.1, %if.end24 ], [ 0, %entry ] %ans.sroa.6.045 = phi i32 [ %ans.sroa.6.1, %if.end24 ], [ 0, %entry ] %ans.sroa.0.044 = phi i32 [ %ans.sroa.0.1, %if.end24 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %1 = load i8, ptr %s, align 1, !tbaa !9 switch i8 %1, label %if.else20 [ i8 65, label %if.then i8 87, label %if.then9 i8 84, label %if.then17 ] if.then: ; preds = %for.body %inc = add nsw i32 %ans.sroa.0.044, 1 br label %if.end24 if.then9: ; preds = %for.body %inc11 = add nsw i32 %ans.sroa.6.045, 1 br label %if.end24 if.then17: ; preds = %for.body %inc19 = add nsw i32 %ans.sroa.9.046, 1 br label %if.end24 if.else20: ; preds = %for.body %inc22 = add nsw i32 %ans.sroa.12.047, 1 br label %if.end24 if.end24: ; preds = %if.then9, %if.else20, %if.then17, %if.then %ans.sroa.0.1 = phi i32 [ %inc, %if.then ], [ %ans.sroa.0.044, %if.then9 ], [ %ans.sroa.0.044, %if.then17 ], [ %ans.sroa.0.044, %if.else20 ] %ans.sroa.6.1 = phi i32 [ %ans.sroa.6.045, %if.then ], [ %inc11, %if.then9 ], [ %ans.sroa.6.045, %if.then17 ], [ %ans.sroa.6.045, %if.else20 ] %ans.sroa.9.1 = phi i32 [ %ans.sroa.9.046, %if.then ], [ %ans.sroa.9.046, %if.then9 ], [ %inc19, %if.then17 ], [ %ans.sroa.9.046, %if.else20 ] %ans.sroa.12.1 = phi i32 [ %ans.sroa.12.047, %if.then ], [ %ans.sroa.12.047, %if.then9 ], [ %ans.sroa.12.047, %if.then17 ], [ %inc22, %if.else20 ] %call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %c) %inc26 = add nuw nsw i32 %i.048, 1 %2 = load i32, ptr %N, align 4, !tbaa !5 %cmp = icmp slt i32 %inc26, %2 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10 } ; 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #5 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 nofree nosync nounwind willreturn memory(none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> int main() { int n; int ret; int ac, wa, tle, re; char str[16]; ret = scanf("%d", &n); if (!ret) return 0; ac = wa = tle = re = 0; while (n--) { ret = scanf("%s", str); if (!ret) return 0; if (strcmp(str, "AC") == 0) ac++; if (strcmp(str, "WA") == 0) wa++; if (strcmp(str, "TLE") == 0) tle++; if (strcmp(str, "RE") == 0) re++; } printf("AC x %d\n", ac); printf("WA x %d\n", wa); printf("TLE x %d\n", tle); printf("RE x %d\n", re); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313625/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313625/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"WA\00", align 1 @.str.5 = private unnamed_addr constant [3 x i8] c"RE\00", align 1 @.str.6 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.7 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.8 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.9 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %str = alloca [16 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %str) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %tobool.not = icmp eq i32 %call, 0 br i1 %tobool.not, label %cleanup, label %while.cond.preheader while.cond.preheader: ; preds = %entry %0 = load i32, ptr %n, align 4, !tbaa !5 %dec50 = add nsw i32 %0, -1 store i32 %dec50, ptr %n, align 4, !tbaa !5 %tobool1.not51 = icmp eq i32 %0, 0 br i1 %tobool1.not51, label %while.end, label %while.body while.body: ; preds = %while.cond.preheader, %if.end5 %re.055 = phi i32 [ %re.1, %if.end5 ], [ 0, %while.cond.preheader ] %tle.054 = phi i32 [ %tle.1, %if.end5 ], [ 0, %while.cond.preheader ] %wa.053 = phi i32 [ %wa.1, %if.end5 ], [ 0, %while.cond.preheader ] %ac.052 = phi i32 [ %spec.select, %if.end5 ], [ 0, %while.cond.preheader ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str) %tobool3.not = icmp eq i32 %call2, 0 br i1 %tobool3.not, label %cleanup, label %if.end5 if.end5: ; preds = %while.body %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %str, ptr noundef nonnull dereferenceable(3) @.str.2, i64 3) %cmp = icmp eq i32 %bcmp, 0 %inc = zext i1 %cmp to i32 %spec.select = add nuw nsw i32 %ac.052, %inc %bcmp43 = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %str, ptr noundef nonnull dereferenceable(3) @.str.3, i64 3) %cmp12 = icmp eq i32 %bcmp43, 0 %inc14 = zext i1 %cmp12 to i32 %wa.1 = add nuw nsw i32 %wa.053, %inc14 %lhsv = load i32, ptr %str, align 16 %.not = icmp eq i32 %lhsv, 4541524 %inc20 = zext i1 %.not to i32 %tle.1 = add nuw nsw i32 %tle.054, %inc20 %bcmp45 = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %str, ptr noundef nonnull dereferenceable(3) @.str.5, i64 3) %cmp24 = icmp eq i32 %bcmp45, 0 %inc26 = zext i1 %cmp24 to i32 %re.1 = add nuw nsw i32 %re.055, %inc26 %1 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %1, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool1.not = icmp eq i32 %1, 0 br i1 %tobool1.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end5, %while.cond.preheader %ac.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %spec.select, %if.end5 ] %wa.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %wa.1, %if.end5 ] %tle.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %tle.1, %if.end5 ] %re.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %re.1, %if.end5 ] %call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %ac.0.lcssa) %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %wa.0.lcssa) %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %tle.0.lcssa) %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %re.0.lcssa) br label %cleanup cleanup: ; preds = %while.body, %entry, %while.end call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %str) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3 attributes #0 = { nofree 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 = { nofree nounwind willreturn memory(argmem: read) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> int main(void){ int n,i; int AC=0,WA=0,TLE=0,RE=0; char s[100001][16]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",s[i]); if(strcmp(s[i],"AC")==0) AC++; if(strcmp(s[i],"WA")==0) WA++; if(strcmp(s[i],"TLE")==0) TLE++; if(strcmp(s[i],"RE")==0) RE++; } printf("AC x %d\n",AC); printf("WA x %d\n",WA); printf("TLE x %d\n",TLE); printf("RE x %d\n",RE); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313683/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313683/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"AC\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"WA\00", align 1 @.str.4 = private unnamed_addr constant [4 x i8] c"TLE\00", align 1 @.str.5 = private unnamed_addr constant [3 x i8] c"RE\00", align 1 @.str.6 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.7 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.8 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.9 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %s = alloca [100001 x [16 x i8]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 1600016, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp46 = icmp sgt i32 %0, 0 br i1 %cmp46, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %RE.051 = phi i32 [ %RE.1, %for.body ], [ 0, %entry ] %TLE.050 = phi i32 [ %TLE.1, %for.body ], [ 0, %entry ] %WA.049 = phi i32 [ %WA.1, %for.body ], [ 0, %entry ] %AC.048 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100001 x [16 x i8]], ptr %s, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %call5 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(3) @.str.2) #5 %cmp6 = icmp eq i32 %call5, 0 %inc = zext i1 %cmp6 to i32 %spec.select = add nuw nsw i32 %AC.048, %inc %call10 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(3) @.str.3) #5 %cmp11 = icmp eq i32 %call10, 0 %inc13 = zext i1 %cmp11 to i32 %WA.1 = add nuw nsw i32 %WA.049, %inc13 %call18 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(4) @.str.4) #5 %cmp19 = icmp eq i32 %call18, 0 %inc21 = zext i1 %cmp19 to i32 %TLE.1 = add nuw nsw i32 %TLE.050, %inc21 %call26 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(3) @.str.5) #5 %cmp27 = icmp eq i32 %call26, 0 %inc29 = zext i1 %cmp27 to i32 %RE.1 = add nuw nsw i32 %RE.051, %inc29 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %AC.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ] %WA.0.lcssa = phi i32 [ 0, %entry ], [ %WA.1, %for.body ] %TLE.0.lcssa = phi i32 [ 0, %entry ], [ %TLE.1, %for.body ] %RE.0.lcssa = phi i32 [ 0, %entry ], [ %RE.1, %for.body ] %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %AC.0.lcssa) %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %WA.0.lcssa) %call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %TLE.0.lcssa) %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %RE.0.lcssa) call void @llvm.lifetime.end.p0(i64 1600016, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> int main(){ int n,i,c[4]={0}; char s[3]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",s); if(s[0]=='A'){ c[0]++; } else if(s[0]=='W'){ c[1]++; } else if(s[0]=='T'){ c[2]++; } else if(s[0]=='R'){ c[3]++; } } printf("AC x %d\n",c[0]); printf("WA x %d\n",c[1]); printf("TLE x %d\n",c[2]); printf("RE x %d\n",c[3]); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313726/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313726/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"AC x %d\0A\00", align 1 @.str.3 = private unnamed_addr constant [9 x i8] c"WA x %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [10 x i8] c"TLE x %d\0A\00", align 1 @.str.5 = private unnamed_addr constant [9 x i8] c"RE x %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %s = alloca [3 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp48 = icmp sgt i32 %0, 0 br i1 %cmp48, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %c.sroa.12.053 = phi i32 [ %c.sroa.12.1, %for.inc ], [ 0, %entry ] %c.sroa.9.052 = phi i32 [ %c.sroa.9.1, %for.inc ], [ 0, %entry ] %c.sroa.6.051 = phi i32 [ %c.sroa.6.1, %for.inc ], [ 0, %entry ] %c.sroa.0.050 = phi i32 [ %c.sroa.0.1, %for.inc ], [ 0, %entry ] %i.049 = phi i32 [ %inc31, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %1 = load i8, ptr %s, align 1, !tbaa !9 switch i8 %1, label %for.inc [ i8 65, label %if.then i8 87, label %if.then9 i8 84, label %if.then17 i8 82, label %if.then25 ] if.then: ; preds = %for.body %inc = add nsw i32 %c.sroa.0.050, 1 br label %for.inc if.then9: ; preds = %for.body %inc11 = add nsw i32 %c.sroa.6.051, 1 br label %for.inc if.then17: ; preds = %for.body %inc19 = add nsw i32 %c.sroa.9.052, 1 br label %for.inc if.then25: ; preds = %for.body %inc27 = add nsw i32 %c.sroa.12.053, 1 br label %for.inc for.inc: ; preds = %for.body, %if.then, %if.then17, %if.then25, %if.then9 %c.sroa.0.1 = phi i32 [ %inc, %if.then ], [ %c.sroa.0.050, %if.then9 ], [ %c.sroa.0.050, %if.then17 ], [ %c.sroa.0.050, %if.then25 ], [ %c.sroa.0.050, %for.body ] %c.sroa.6.1 = phi i32 [ %c.sroa.6.051, %if.then ], [ %inc11, %if.then9 ], [ %c.sroa.6.051, %if.then17 ], [ %c.sroa.6.051, %if.then25 ], [ %c.sroa.6.051, %for.body ] %c.sroa.9.1 = phi i32 [ %c.sroa.9.052, %if.then ], [ %c.sroa.9.052, %if.then9 ], [ %inc19, %if.then17 ], [ %c.sroa.9.052, %if.then25 ], [ %c.sroa.9.052, %for.body ] %c.sroa.12.1 = phi i32 [ %c.sroa.12.053, %if.then ], [ %c.sroa.12.053, %if.then9 ], [ %c.sroa.12.053, %if.then17 ], [ %inc27, %if.then25 ], [ %c.sroa.12.053, %for.body ] %inc31 = add nuw nsw i32 %i.049, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc31, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.inc, %entry %c.sroa.0.0.lcssa = phi i32 [ 0, %entry ], [ %c.sroa.0.1, %for.inc ] %c.sroa.6.0.lcssa = phi i32 [ 0, %entry ], [ %c.sroa.6.1, %for.inc ] %c.sroa.9.0.lcssa = phi i32 [ 0, %entry ], [ %c.sroa.9.1, %for.inc ] %c.sroa.12.0.lcssa = phi i32 [ 0, %entry ], [ %c.sroa.12.1, %for.inc ] %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %c.sroa.0.0.lcssa) %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %c.sroa.6.0.lcssa) %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %c.sroa.9.0.lcssa) %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %c.sroa.12.0.lcssa) call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(){ int a, cont=0; scanf("%d", &a); cont= (a-1)/2; printf("%d\n", cont); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313777/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313777/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %sub = add nsw i32 %0, -1 %div = sdiv i32 %sub, 2 %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #include<string.h> static int comp(const void *i1,const void *i2) { int *p1=(int *)i1; int *p2=(int *)i2; return (*p1-*p2); } int main() { int array[200],i,j,k; scanf("%d",&i); for(j=0;j<i;j++) scanf("%d",&array[j]); qsort(array,i,sizeof(int),comp); printf("%d ",array[i-1]); for(j=1;j<i-1;j++) printf("%d ",array[j]); printf("%d\n",array[0]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_31382/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_31382/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %array = alloca [200 x i32], align 16 %i = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %array) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %0 = load i32, ptr %i, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %0, 0 br i1 %cmp23, label %for.body, label %entry.for.end_crit_edge entry.for.end_crit_edge: ; preds = %entry %.pre = sext i32 %0 to i64 br label %for.end for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %i, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry.for.end_crit_edge %conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ] call void @qsort(ptr noundef nonnull %array, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @comp) #5 %3 = load i32, ptr %i, align 4, !tbaa !5 %sub = add nsw i32 %3, -1 %idxprom2 = sext i32 %sub to i64 %arrayidx3 = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %idxprom2 %4 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4) %5 = load i32, ptr %i, align 4, !tbaa !5 %cmp726 = icmp sgt i32 %5, 2 br i1 %cmp726, label %for.body9, label %for.end15 for.body9: ; preds = %for.end, %for.body9 %indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body9 ], [ 1, %for.end ] %arrayidx11 = getelementptr inbounds [200 x i32], ptr %array, i64 0, i64 %indvars.iv30 %6 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6) %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1 %7 = load i32, ptr %i, align 4, !tbaa !5 %sub6 = add nsw i32 %7, -1 %8 = sext i32 %sub6 to i64 %cmp7 = icmp slt i64 %indvars.iv.next31, %8 br i1 %cmp7, label %for.body9, label %for.end15, !llvm.loop !11 for.end15: ; preds = %for.body9, %for.end %9 = load i32, ptr %array, align 16, !tbaa !5 %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #5 call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %array) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define internal i32 @comp(ptr nocapture noundef readonly %i1, ptr nocapture noundef readonly %i2) #4 { entry: %0 = load i32, ptr %i1, align 4, !tbaa !5 %1 = load i32, ptr %i2, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { nofree "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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <stdlib.h> #include <math.h> #define lli long long int #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define true 1 #define false 0 typedef struct node { struct node* below; struct node* side; int isParent; int id; } node; void add(node *a,node *b){ node *swap; swap = a->below; a->below = b; b->side = swap; } int dfs(node *a,lli k){ static int counter; int height = 0; int c=0; node* b = a; a = a->below; while(a){ counter = 0; c += dfs(a,k); a = a->side; height = max(counter,height); } counter = height + 1; if(height == k-1 && !b->isParent){ b->isParent = true; c++; counter = 0; } return c; } int main(void){ int i; int n; int x; int ans; lli k; node *a; scanf("%d%lld",&n,&k); a = calloc(sizeof(node),n); scanf("%d",&x); if(x==1){ ans = 0; }else{ ans = 1; } a[0].isParent = true; for(i=1;i<n;i++){ scanf("%d",&x); add(&a[x-1],&a[i]); if(x==1){ a[i].isParent = true; } a[i].id = i; } printf("%d\n",ans + dfs(a,k)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313863/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313863/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct.node = type { ptr, ptr, i32, i32 } @dfs.counter = internal unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [7 x i8] c"%d%lld\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @add(ptr nocapture noundef %a, ptr noundef %b) local_unnamed_addr #0 { entry: %0 = load ptr, ptr %a, align 8, !tbaa !5 store ptr %b, ptr %a, align 8, !tbaa !5 %side = getelementptr inbounds %struct.node, ptr %b, i64 0, i32 1 store ptr %0, ptr %side, align 8, !tbaa !11 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local i32 @dfs(ptr nocapture noundef %a, i64 noundef %k) local_unnamed_addr #2 { entry: %a.addr.017 = load ptr, ptr %a, align 8, !tbaa !12 %tobool.not18 = icmp eq ptr %a.addr.017, null br i1 %tobool.not18, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.021 = phi ptr [ %a.addr.0, %while.body ], [ %a.addr.017, %entry ] %c.020 = phi i32 [ %add, %while.body ], [ 0, %entry ] %height.019 = phi i32 [ %cond, %while.body ], [ 0, %entry ] store i32 0, ptr @dfs.counter, align 4, !tbaa !13 %call = tail call i32 @dfs(ptr noundef nonnull %a.addr.021, i64 noundef %k) %add = add nsw i32 %call, %c.020 %side = getelementptr inbounds %struct.node, ptr %a.addr.021, i64 0, i32 1 %0 = load i32, ptr @dfs.counter, align 4 %cond = tail call i32 @llvm.smax.i32(i32 %0, i32 %height.019) %a.addr.0 = load ptr, ptr %side, align 8, !tbaa !12 %tobool.not = icmp eq ptr %a.addr.0, null br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %entry %height.0.lcssa = phi i32 [ 0, %entry ], [ %cond, %while.body ] %c.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ] %add1 = add nuw nsw i32 %height.0.lcssa, 1 store i32 %add1, ptr @dfs.counter, align 4, !tbaa !13 %conv = zext i32 %height.0.lcssa to i64 %sub = add nsw i64 %k, -1 %cmp2 = icmp eq i64 %sub, %conv br i1 %cmp2, label %land.lhs.true, label %if.end land.lhs.true: ; preds = %while.end %isParent = getelementptr inbounds %struct.node, ptr %a, i64 0, i32 2 %1 = load i32, ptr %isParent, align 8, !tbaa !16 %tobool4.not = icmp eq i32 %1, 0 br i1 %tobool4.not, label %if.then, label %if.end if.then: ; preds = %land.lhs.true store i32 1, ptr %isParent, align 8, !tbaa !16 %inc = add nsw i32 %c.0.lcssa, 1 store i32 0, ptr @dfs.counter, align 4, !tbaa !13 br label %if.end if.end: ; preds = %if.then, %land.lhs.true, %while.end %c.1 = phi i32 [ %c.0.lcssa, %land.lhs.true ], [ %inc, %if.then ], [ %c.0.lcssa, %while.end ] ret i32 %c.1 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !13 %conv = sext i32 %0 to i64 %call1 = call noalias ptr @calloc(i64 noundef 24, i64 noundef %conv) #8 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %1 = load i32, ptr %x, align 4, !tbaa !13 %isParent = getelementptr inbounds %struct.node, ptr %call1, i64 0, i32 2 store i32 1, ptr %isParent, align 8, !tbaa !16 %2 = load i32, ptr %n, align 4, !tbaa !13 %cmp431 = icmp sgt i32 %2, 1 br i1 %cmp431, label %for.body, label %for.end for.body: ; preds = %entry, %if.end16 %indvars.iv = phi i64 [ %indvars.iv.next, %if.end16 ], [ 1, %entry ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x) %3 = load i32, ptr %x, align 4, !tbaa !13 %sub = add nsw i32 %3, -1 %idxprom = sext i32 %sub to i64 %arrayidx7 = getelementptr inbounds %struct.node, ptr %call1, i64 %idxprom %arrayidx9 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv %4 = load ptr, ptr %arrayidx7, align 8, !tbaa !5 store ptr %arrayidx9, ptr %arrayidx7, align 8, !tbaa !5 %side.i = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv, i32 1 store ptr %4, ptr %side.i, align 8, !tbaa !11 %cmp10 = icmp eq i32 %3, 1 br i1 %cmp10, label %if.then12, label %if.end16 if.then12: ; preds = %for.body %isParent15 = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv, i32 2 store i32 1, ptr %isParent15, align 8, !tbaa !16 br label %if.end16 if.end16: ; preds = %if.then12, %for.body %id = getelementptr inbounds %struct.node, ptr %call1, i64 %indvars.iv, i32 3 %5 = trunc i64 %indvars.iv to i32 store i32 %5, ptr %id, align 4, !tbaa !17 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = load i32, ptr %n, align 4, !tbaa !13 %7 = sext i32 %6 to i64 %cmp4 = icmp slt i64 %indvars.iv.next, %7 br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !18 for.end: ; preds = %if.end16, %entry %cmp = icmp ne i32 %1, 1 %. = zext i1 %cmp to i32 %8 = load i64, ptr %k, align 8, !tbaa !19 %call19 = call i32 @dfs(ptr noundef nonnull %call1, i64 noundef %8) %add = add nsw i32 %call19, %. %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #6 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 nosync nounwind memory(readwrite, inaccessiblemem: none) 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 = { nofree 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } attributes #8 = { nounwind allocsize(0,1) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !7, i64 0} !6 = !{!"node", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20} !7 = !{!"any pointer", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"int", !8, i64 0} !11 = !{!6, !7, i64 8} !12 = !{!7, !7, i64 0} !13 = !{!10, !10, i64 0} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.mustprogress"} !16 = !{!6, !10, i64 16} !17 = !{!6, !10, i64 20} !18 = distinct !{!18, !15} !19 = !{!20, !20, i64 0} !20 = !{!"long long", !8, i64 0}
#include <stdio.h> int main () { int n, min, i, x, s, t; scanf("%d", &n); min = 1000000001; t = -1000000001; for (i = 0; i < n; i++) { scanf("%d", &x); s = x - min; if (s >= t && i != 0) t = s; if (min > x) min = x; } printf("%d\n", t); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313920/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313920/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp13 = icmp sgt i32 %0, 0 br i1 %cmp13, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %t.016 = phi i32 [ %spec.select, %for.body ], [ -1000000001, %entry ] %min.015 = phi i32 [ %min.1, %for.body ], [ 1000000001, %entry ] %i.014 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %1 = load i32, ptr %x, align 4, !tbaa !5 %sub = sub nsw i32 %1, %min.015 %cmp2 = icmp sge i32 %sub, %t.016 %cmp3 = icmp ne i32 %i.014, 0 %or.cond = and i1 %cmp3, %cmp2 %spec.select = select i1 %or.cond, i32 %sub, i32 %t.016 %min.1 = call i32 @llvm.smin.i32(i32 %min.015, i32 %1) %inc = add nuw nsw i32 %i.014, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %t.0.lcssa = phi i32 [ -1000000001, %entry ], [ %spec.select, %for.body ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %t.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #define N 200000 int main(void){ int i,j,n,f[N]; long minv,maxv=-1000000000; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&f[i]); } minv = f[0]; for(j=1;j<n;j++){ if(maxv<f[j]-minv) maxv = f[j]-minv; if(minv>f[j]) minv = f[j]; } printf("%d\n",maxv); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_313964/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_313964/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %f = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %f) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp40 = icmp sgt i32 %0, 0 br i1 %cmp40, label %for.body, label %for.end28 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %f, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp442 = icmp sgt i32 %1, 1 br i1 %cmp442, label %for.body6.preheader, label %for.end28 for.body6.preheader: ; preds = %for.end %.pre = load i32, ptr %f, align 16, !tbaa !5 %3 = sext i32 %.pre to i64 %wide.trip.count = zext i32 %1 to i64 %4 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %4, 1 %5 = icmp eq i32 %1, 2 br i1 %5, label %for.end28.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %4, -2 br label %for.body6 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv49 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next50.1, %for.body6 ] %maxv.045 = phi i64 [ -1000000000, %for.body6.preheader.new ], [ %spec.select.1, %for.body6 ] %minv.044 = phi i64 [ %3, %for.body6.preheader.new ], [ %minv.1.1, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ] %arrayidx8 = getelementptr inbounds [200000 x i32], ptr %f, i64 0, i64 %indvars.iv49 %6 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %conv9 = sext i32 %6 to i64 %sub = sub nsw i64 %conv9, %minv.044 %spec.select = call i64 @llvm.smax.i64(i64 %maxv.045, i64 %sub) %minv.1 = call i64 @llvm.smin.i64(i64 %minv.044, i64 %conv9) %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1 %arrayidx8.1 = getelementptr inbounds [200000 x i32], ptr %f, i64 0, i64 %indvars.iv.next50 %7 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5 %conv9.1 = sext i32 %7 to i64 %sub.1 = sub nsw i64 %conv9.1, %minv.1 %spec.select.1 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %sub.1) %minv.1.1 = call i64 @llvm.smin.i64(i64 %minv.1, i64 %conv9.1) %indvars.iv.next50.1 = add nuw nsw i64 %indvars.iv49, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end28.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11 for.end28.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %spec.select.lcssa.ph = phi i64 [ undef, %for.body6.preheader ], [ %spec.select.1, %for.body6 ] %indvars.iv49.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next50.1, %for.body6 ] %maxv.045.unr = phi i64 [ -1000000000, %for.body6.preheader ], [ %spec.select.1, %for.body6 ] %minv.044.unr = phi i64 [ %3, %for.body6.preheader ], [ %minv.1.1, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end28, label %for.body6.epil for.body6.epil: ; preds = %for.end28.loopexit.unr-lcssa %arrayidx8.epil = getelementptr inbounds [200000 x i32], ptr %f, i64 0, i64 %indvars.iv49.unr %8 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %conv9.epil = sext i32 %8 to i64 %sub.epil = sub nsw i64 %conv9.epil, %minv.044.unr %spec.select.epil = call i64 @llvm.smax.i64(i64 %maxv.045.unr, i64 %sub.epil) br label %for.end28 for.end28: ; preds = %for.body6.epil, %for.end28.loopexit.unr-lcssa, %entry, %for.end %maxv.0.lcssa = phi i64 [ -1000000000, %for.end ], [ -1000000000, %entry ], [ %spec.select.lcssa.ph, %for.end28.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body6.epil ] %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %maxv.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %f) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <stdlib.h> int main() { int i; //??\??? int n; scanf("%d", &n); int R[n]; for( i = 0; i < n; ++i ) scanf("%d", &R[i]); //min???????°???????????????????max????????¶ int min = R[0], max = R[1] - R[0]; for( i = 1; i < n; ++i ){ max = max < R[i] - min ? R[i] - min : max; min = min > R[i] ? R[i] : min; } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314028/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314028/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp41 = icmp sgt i32 %3, 0 call void @llvm.assume(i1 %cmp41) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %vla, align 16, !tbaa !5 %arrayidx3.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 1 %.pre53 = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 %sub = sub nsw i32 %.pre53, %.pre %cmp643 = icmp sgt i32 %4, 1 br i1 %cmp643, label %for.body7.preheader, label %for.end26 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %4 to i64 %6 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %6, 1 %7 = icmp eq i32 %4, 2 br i1 %7, label %for.end26.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %6, -2 %invariant.gep = getelementptr i32, ptr %vla, i64 1 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv50 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next51.1, %for.body7 ] %max.046 = phi i32 [ %sub, %for.body7.preheader.new ], [ %sub10.max.0.1, %for.body7 ] %min.045 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %cond23.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv50 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %8, %min.045 %sub10.max.0 = call i32 @llvm.smax.i32(i32 %max.046, i32 %sub10) %cond23 = call i32 @llvm.smin.i32(i32 %min.045, i32 %8) %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv50 %9 = load i32, ptr %gep, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %9, %cond23 %sub10.max.0.1 = call i32 @llvm.smax.i32(i32 %sub10.max.0, i32 %sub10.1) %cond23.1 = call i32 @llvm.smin.i32(i32 %cond23, i32 %9) %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end26.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end26.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %sub10.max.0.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %sub10.max.0.1, %for.body7 ] %indvars.iv50.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next51.1, %for.body7 ] %max.046.unr = phi i32 [ %sub, %for.body7.preheader ], [ %sub10.max.0.1, %for.body7 ] %min.045.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %cond23.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end26, label %for.body7.epil for.body7.epil: ; preds = %for.end26.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv50.unr %10 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %10, %min.045.unr %sub10.max.0.epil = call i32 @llvm.smax.i32(i32 %max.046.unr, i32 %sub10.epil) br label %for.end26 for.end26: ; preds = %for.body7.epil, %for.end26.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %sub, %for.end ], [ %sub10.max.0.lcssa.ph, %for.end26.loopexit.unr-lcssa ], [ %sub10.max.0.epil, %for.body7.epil ] %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #define N 200000 int main() { int i, num, maxnum, minnum, array[N]; scanf("%d", &num); for( i=0; i<num; i++){ scanf("%d", &array[i]); } maxnum = array[1] - array[0]; minnum = array[0]; for( i=1; i<num; i++){ if( maxnum <= ( array[i] - minnum ) ){ maxnum = array[i] - minnum; } if( minnum >= array[i] ){ minnum = array[i]; } } printf("%d\n", maxnum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314071/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314071/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca i32, align 4 %array = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %array) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %0 = load i32, ptr %num, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp37) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %array, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %num, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %arrayidx2.phi.trans.insert = getelementptr inbounds [200000 x i32], ptr %array, i64 0, i64 1 %.pre = load i32, ptr %arrayidx2.phi.trans.insert, align 4, !tbaa !5 %.pre49 = load i32, ptr %array, align 16, !tbaa !5 %sub = sub nsw i32 %.pre, %.pre49 %cmp639 = icmp sgt i32 %1, 1 br i1 %cmp639, label %for.body7.preheader, label %for.end24 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end24.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %3, -2 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv46 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next47.1, %for.body7 ] %minnum.042 = phi i32 [ %.pre49, %for.body7.preheader.new ], [ %minnum.1.1, %for.body7 ] %maxnum.041 = phi i32 [ %sub, %for.body7.preheader.new ], [ %spec.select.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds [200000 x i32], ptr %array, i64 0, i64 %indvars.iv46 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %5, %minnum.042 %spec.select = call i32 @llvm.smax.i32(i32 %maxnum.041, i32 %sub10) %minnum.1 = call i32 @llvm.smin.i32(i32 %minnum.042, i32 %5) %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1 %arrayidx9.1 = getelementptr inbounds [200000 x i32], ptr %array, i64 0, i64 %indvars.iv.next47 %6 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %6, %minnum.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub10.1) %minnum.1.1 = call i32 @llvm.smin.i32(i32 %minnum.1, i32 %6) %indvars.iv.next47.1 = add nuw nsw i64 %indvars.iv46, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end24.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end24.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %indvars.iv46.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next47.1, %for.body7 ] %minnum.042.unr = phi i32 [ %.pre49, %for.body7.preheader ], [ %minnum.1.1, %for.body7 ] %maxnum.041.unr = phi i32 [ %sub, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end24, label %for.body7.epil for.body7.epil: ; preds = %for.end24.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds [200000 x i32], ptr %array, i64 0, i64 %indvars.iv46.unr %7 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %7, %minnum.042.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %maxnum.041.unr, i32 %sub10.epil) br label %for.end24 for.end24: ; preds = %for.body7.epil, %for.end24.loopexit.unr-lcssa, %for.end %maxnum.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body7.epil ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxnum.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %array) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> #include<stdlib.h> int main(){ int n,i,j,minv,maxv,*r; scanf("%d",&n); r = malloc(sizeof(int)*n); for(i = 0;i < n;i++){ scanf("%d",&r[i]); } minv = r[0]; maxv = r[1] - r[0]; for(j = 1;j < n;j++){ if(maxv > (r[j] - minv)){ maxv = maxv; } else{ maxv = r[j] - minv; } if(minv < r[j]){ minv = minv; } else{ minv = r[j]; } } printf("%d\n",maxv); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314114/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314114/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = zext i32 %0 to i64 %mul = shl nuw nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp51 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp51) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %call1, align 4, !tbaa !5 %arrayidx5.phi.trans.insert = getelementptr inbounds i32, ptr %call1, i64 1 %.pre63 = load i32, ptr %arrayidx5.phi.trans.insert, align 4, !tbaa !5 %sub = sub nsw i32 %.pre63, %.pre %cmp853 = icmp sgt i32 %1, 1 br i1 %cmp853, label %for.body10.preheader, label %for.end30 for.body10.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end30.loopexit.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %3, -2 %invariant.gep = getelementptr i32, ptr %call1, i64 1 br label %for.body10 for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv60 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next61.1, %for.body10 ] %maxv.056 = phi i32 [ %sub, %for.body10.preheader.new ], [ %maxv.0.sub13.1, %for.body10 ] %minv.055 = phi i32 [ %.pre, %for.body10.preheader.new ], [ %minv.1.1, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ] %arrayidx12 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv60 %5 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %sub13 = sub nsw i32 %5, %minv.055 %maxv.0.sub13 = call i32 @llvm.smax.i32(i32 %maxv.056, i32 %sub13) %minv.1 = call i32 @llvm.smin.i32(i32 %minv.055, i32 %5) %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv60 %6 = load i32, ptr %gep, align 4, !tbaa !5 %sub13.1 = sub nsw i32 %6, %minv.1 %maxv.0.sub13.1 = call i32 @llvm.smax.i32(i32 %maxv.0.sub13, i32 %sub13.1) %minv.1.1 = call i32 @llvm.smin.i32(i32 %minv.1, i32 %6) %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end30.loopexit.unr-lcssa, label %for.body10, !llvm.loop !11 for.end30.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %maxv.0.sub13.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %maxv.0.sub13.1, %for.body10 ] %indvars.iv60.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next61.1, %for.body10 ] %maxv.056.unr = phi i32 [ %sub, %for.body10.preheader ], [ %maxv.0.sub13.1, %for.body10 ] %minv.055.unr = phi i32 [ %.pre, %for.body10.preheader ], [ %minv.1.1, %for.body10 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end30, label %for.body10.epil for.body10.epil: ; preds = %for.end30.loopexit.unr-lcssa %arrayidx12.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv60.unr %7 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5 %sub13.epil = sub nsw i32 %7, %minv.055.unr %maxv.0.sub13.epil = call i32 @llvm.smax.i32(i32 %maxv.056.unr, i32 %sub13.epil) br label %for.end30 for.end30: ; preds = %for.body10.epil, %for.end30.loopexit.unr-lcssa, %for.end %maxv.0.lcssa = phi i32 [ %sub, %for.end ], [ %maxv.0.sub13.lcssa.ph, %for.end30.loopexit.unr-lcssa ], [ %maxv.0.sub13.epil, %for.body10.epil ] %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 attributes #0 = { nofree 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #6 = { nounwind } attributes #7 = { nounwind allocsize(0) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main(void) { int n, i; int min, max; int r[200000]; scanf("%d\n", &n); for (i = 0; i < n; i++) { scanf("%d\n", &r[i]); } max = -2000000000; min = r[0]; for ( i = 1; i < n; i++) { if (r[i] - min > max) { max = r[i] - min; } if (r[i] < min) { min = r[i]; } } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314158/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314158/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %r = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %r) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp34 = icmp sgt i32 %0, 0 br i1 %cmp34, label %for.body, label %for.end21 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp436 = icmp sgt i32 %1, 1 br i1 %cmp436, label %for.body5.preheader, label %for.end21 for.body5.preheader: ; preds = %for.end %.pre = load i32, ptr %r, align 16, !tbaa !5 %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end21.loopexit.unr-lcssa, label %for.body5.preheader.new for.body5.preheader.new: ; preds = %for.body5.preheader %unroll_iter = and i64 %3, -2 br label %for.body5 for.body5: ; preds = %for.body5, %for.body5.preheader.new %indvars.iv43 = phi i64 [ 1, %for.body5.preheader.new ], [ %indvars.iv.next44.1, %for.body5 ] %max.039 = phi i32 [ -2000000000, %for.body5.preheader.new ], [ %spec.select.1, %for.body5 ] %min.038 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %min.1.1, %for.body5 ] %niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ] %arrayidx7 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv43 %5 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %sub = sub nsw i32 %5, %min.038 %spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 %max.039) %min.1 = call i32 @llvm.smin.i32(i32 %5, i32 %min.038) %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %arrayidx7.1 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv.next44 %6 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %6, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %sub.1, i32 %spec.select) %min.1.1 = call i32 @llvm.smin.i32(i32 %6, i32 %min.1) %indvars.iv.next44.1 = add nuw nsw i64 %indvars.iv43, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end21.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11 for.end21.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %spec.select.1, %for.body5 ] %indvars.iv43.unr = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next44.1, %for.body5 ] %max.039.unr = phi i32 [ -2000000000, %for.body5.preheader ], [ %spec.select.1, %for.body5 ] %min.038.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %min.1.1, %for.body5 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end21, label %for.body5.epil for.body5.epil: ; preds = %for.end21.loopexit.unr-lcssa %arrayidx7.epil = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv43.unr %7 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %7, %min.038.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %sub.epil, i32 %max.039.unr) br label %for.end21 for.end21: ; preds = %for.body5.epil, %for.end21.loopexit.unr-lcssa, %entry, %for.end %max.0.lcssa = phi i32 [ -2000000000, %for.end ], [ -2000000000, %entry ], [ %spec.select.lcssa.ph, %for.end21.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body5.epil ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %r) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int main(){ int max,min,sa=0,i,n,r[200000]={}; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&r[i]); min = r[0]; max=min; for(i=0;i<n-1;i++){ if(r[i+1]-min<0) { min = r[i+1]; max = min; } if(max<r[i+1]) max = r[i+1]; if(sa<max-min) sa=max-min; } if(max==min&&sa==0){ sa = r[1]-r[0]; for(i=0;i<n-1;i++){ if(sa<r[i+1]-r[i]) sa = r[i+1]-r[i]; } } printf("%d\n",sa); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314200/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314200/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %r = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %r) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) %r, i8 0, i64 800000, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp87 = icmp sgt i32 %0, 0 br i1 %cmp87, label %for.body, label %if.then32.thread for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %r, align 16, !tbaa !5 %sub = add i32 %1, -1 %cmp489 = icmp sgt i32 %1, 1 br i1 %cmp489, label %for.body5.preheader, label %for.end29 for.body5.preheader: ; preds = %for.end %wide.trip.count = zext i32 %sub to i64 %xtraiter = and i64 %wide.trip.count, 1 %3 = icmp eq i32 %sub, 1 br i1 %3, label %for.end29.loopexit.unr-lcssa, label %for.body5.preheader.new for.body5.preheader.new: ; preds = %for.body5.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body5 for.body5: ; preds = %for.body5, %for.body5.preheader.new %indvars.iv104 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next105.1, %for.body5 ] %sa.092 = phi i32 [ 0, %for.body5.preheader.new ], [ %sa.1.1, %for.body5 ] %min.091 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %spec.select85.1, %for.body5 ] %max.090 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %max.2.1, %for.body5 ] %niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ] %indvars.iv.next105 = or i64 %indvars.iv104, 1 %arrayidx7 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv.next105 %4 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp9 = icmp slt i32 %4, %min.091 %spec.select = select i1 %cmp9, i32 %4, i32 %max.090 %spec.select85 = call i32 @llvm.smin.i32(i32 %4, i32 %min.091) %max.2 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %4) %sub22 = sub nsw i32 %max.2, %spec.select85 %sa.1 = call i32 @llvm.smax.i32(i32 %sa.092, i32 %sub22) %indvars.iv.next105.1 = add nuw nsw i64 %indvars.iv104, 2 %arrayidx7.1 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv.next105.1 %5 = load i32, ptr %arrayidx7.1, align 8, !tbaa !5 %cmp9.1 = icmp slt i32 %5, %spec.select85 %spec.select.1 = select i1 %cmp9.1, i32 %5, i32 %max.2 %spec.select85.1 = call i32 @llvm.smin.i32(i32 %5, i32 %spec.select85) %max.2.1 = call i32 @llvm.smax.i32(i32 %spec.select.1, i32 %5) %sub22.1 = sub nsw i32 %max.2.1, %spec.select85.1 %sa.1.1 = call i32 @llvm.smax.i32(i32 %sa.1, i32 %sub22.1) %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa.loopexit, label %for.body5, !llvm.loop !11 for.end29.loopexit.unr-lcssa.loopexit: ; preds = %for.body5 %6 = add nuw nsw i64 %indvars.iv104, 3 br label %for.end29.loopexit.unr-lcssa for.end29.loopexit.unr-lcssa: ; preds = %for.end29.loopexit.unr-lcssa.loopexit, %for.body5.preheader %spec.select85.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %spec.select85.1, %for.end29.loopexit.unr-lcssa.loopexit ] %max.2.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %max.2.1, %for.end29.loopexit.unr-lcssa.loopexit ] %sa.1.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %sa.1.1, %for.end29.loopexit.unr-lcssa.loopexit ] %indvars.iv104.unr = phi i64 [ 1, %for.body5.preheader ], [ %6, %for.end29.loopexit.unr-lcssa.loopexit ] %sa.092.unr = phi i32 [ 0, %for.body5.preheader ], [ %sa.1.1, %for.end29.loopexit.unr-lcssa.loopexit ] %min.091.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %spec.select85.1, %for.end29.loopexit.unr-lcssa.loopexit ] %max.090.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %max.2.1, %for.end29.loopexit.unr-lcssa.loopexit ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end29, label %for.body5.epil for.body5.epil: ; preds = %for.end29.loopexit.unr-lcssa %arrayidx7.epil = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv104.unr %7 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5 %cmp9.epil = icmp slt i32 %7, %min.091.unr %spec.select.epil = select i1 %cmp9.epil, i32 %7, i32 %max.090.unr %spec.select85.epil = call i32 @llvm.smin.i32(i32 %7, i32 %min.091.unr) %max.2.epil = call i32 @llvm.smax.i32(i32 %spec.select.epil, i32 %7) %sub22.epil = sub nsw i32 %max.2.epil, %spec.select85.epil %sa.1.epil = call i32 @llvm.smax.i32(i32 %sa.092.unr, i32 %sub22.epil) br label %for.end29 for.end29: ; preds = %for.body5.epil, %for.end29.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %max.2.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %max.2.epil, %for.body5.epil ] %min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %spec.select85.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %spec.select85.epil, %for.body5.epil ] %sa.0.lcssa = phi i32 [ 0, %for.end ], [ %sa.1.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %sa.1.epil, %for.body5.epil ] %cmp30 = icmp eq i32 %max.0.lcssa, %min.0.lcssa %cmp31 = icmp eq i32 %sa.0.lcssa, 0 %or.cond = select i1 %cmp30, i1 %cmp31, i1 false br i1 %or.cond, label %if.then32, label %if.end58 if.then32.thread: ; preds = %entry %arrayidx33129 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 1 %8 = load i32, ptr %arrayidx33129, align 4, !tbaa !5 br label %if.end58 if.then32: ; preds = %for.end29 %arrayidx33 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 1 %9 = load i32, ptr %arrayidx33, align 4, !tbaa !5 %sub35 = sub nsw i32 %9, %.pre br i1 %cmp489, label %for.body39.preheader, label %if.end58 for.body39.preheader: ; preds = %if.then32 %wide.trip.count110 = zext i32 %sub to i64 %min.iters.check = icmp ult i32 %1, 9 br i1 %min.iters.check, label %for.body39.preheader133, label %vector.ph vector.ph: ; preds = %for.body39.preheader %n.vec = and i64 %wide.trip.count110, 4294967288 %vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3 %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %sub35, i64 0 %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load132, %vector.body ] %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %17, %vector.body ] %vec.phi131 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %18, %vector.body ] %10 = or i64 %index, 1 %11 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %10 %wide.load = load <4 x i32>, ptr %11, align 4, !tbaa !5 %12 = getelementptr inbounds i32, ptr %11, i64 4 %wide.load132 = load <4 x i32>, ptr %12, align 4, !tbaa !5 %13 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6> %14 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load132, <4 x i32> <i32 3, i32 4, i32 5, i32 6> %15 = sub nsw <4 x i32> %wide.load, %13 %16 = sub nsw <4 x i32> %wide.load132, %14 %17 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %15) %18 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi131, <4 x i32> %16) %index.next = add nuw i64 %index, 8 %19 = icmp eq i64 %index.next, %n.vec br i1 %19, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %17, <4 x i32> %18) %20 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count110 %vector.recur.extract = extractelement <4 x i32> %wide.load132, i64 3 br i1 %cmp.n, label %if.end58, label %for.body39.preheader133 for.body39.preheader133: ; preds = %for.body39.preheader, %middle.block %scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body39.preheader ] %indvars.iv107.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body39.preheader ] %sa.299.ph = phi i32 [ %20, %middle.block ], [ %sub35, %for.body39.preheader ] br label %for.body39 for.body39: ; preds = %for.body39.preheader133, %for.body39 %scalar.recur = phi i32 [ %21, %for.body39 ], [ %scalar.recur.ph, %for.body39.preheader133 ] %indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.body39 ], [ %indvars.iv107.ph, %for.body39.preheader133 ] %sa.299 = phi i32 [ %spec.select86, %for.body39 ], [ %sa.299.ph, %for.body39.preheader133 ] %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1 %arrayidx42 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv.next108 %21 = load i32, ptr %arrayidx42, align 4, !tbaa !5 %sub45 = sub nsw i32 %21, %scalar.recur %spec.select86 = call i32 @llvm.smax.i32(i32 %sa.299, i32 %sub45) %exitcond111.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count110 br i1 %exitcond111.not, label %if.end58, label %for.body39, !llvm.loop !15 if.end58: ; preds = %for.body39, %middle.block, %if.then32.thread, %if.then32, %for.end29 %sa.4 = phi i32 [ %sa.0.lcssa, %for.end29 ], [ %sub35, %if.then32 ], [ %8, %if.then32.thread ], [ %20, %middle.block ], [ %spec.select86, %for.body39 ] %call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sa.4) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %r) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !10, !14, !13}
#include <stdio.h> #define N 200000 int main() { int n, i, max, min; int R[N]; scanf("%d", &n); scanf("%d", &R[0]); min = R[0]; max = -1e9; for (i = 1; i < n; i++) { scanf("%d", &R[i]); if (max < R[i] - min) max = R[i] - min; if (R[i] < min) min = R[i]; } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314244/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314244/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %R = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %R) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %R) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp28 = icmp sgt i32 %0, 1 br i1 %cmp28, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %1 = load i32, ptr %R, align 16, !tbaa !5 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %min.031 = phi i32 [ %1, %for.body.preheader ], [ %min.1, %for.body ] %max.030 = phi i32 [ -1000000000, %for.body.preheader ], [ %spec.select, %for.body ] %arrayidx3 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx3) %2 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %sub = sub nsw i32 %2, %min.031 %spec.select = call i32 @llvm.smax.i32(i32 %max.030, i32 %sub) %min.1 = call i32 @llvm.smin.i32(i32 %2, i32 %min.031) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ -1000000000, %entry ], [ %spec.select, %for.body ] %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %R) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #define MAX_N 200000 int main(){ int i,j; int n,maxv,min; int r[MAX_N]; scanf("%d",&n); for(i=0; i<n; i++) scanf("%d",&r[i]); min = r[0]; maxv = r[1] - min; for(j=1; j<n; j++){ if(maxv < r[j] - min) maxv = r[j] - min; if(min > r[j]) min = r[j]; } printf("%d\n",maxv); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314288/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314288/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %r = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %r) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp36 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp36) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %r, align 16, !tbaa !5 %arrayidx3.phi.trans.insert = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 1 %.pre48 = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 %sub = sub nsw i32 %.pre48, %.pre %cmp538 = icmp sgt i32 %1, 1 br i1 %cmp538, label %for.body6.preheader, label %for.end23 for.body6.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end23.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %3, -2 br label %for.body6 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv45 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next46.1, %for.body6 ] %min.041 = phi i32 [ %.pre, %for.body6.preheader.new ], [ %min.1.1, %for.body6 ] %maxv.040 = phi i32 [ %sub, %for.body6.preheader.new ], [ %spec.select.1, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ] %arrayidx8 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv45 %5 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %sub9 = sub nsw i32 %5, %min.041 %spec.select = call i32 @llvm.smax.i32(i32 %maxv.040, i32 %sub9) %min.1 = call i32 @llvm.smin.i32(i32 %min.041, i32 %5) %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %arrayidx8.1 = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv.next46 %6 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5 %sub9.1 = sub nsw i32 %6, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub9.1) %min.1.1 = call i32 @llvm.smin.i32(i32 %min.1, i32 %6) %indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end23.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11 for.end23.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %spec.select.1, %for.body6 ] %indvars.iv45.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next46.1, %for.body6 ] %min.041.unr = phi i32 [ %.pre, %for.body6.preheader ], [ %min.1.1, %for.body6 ] %maxv.040.unr = phi i32 [ %sub, %for.body6.preheader ], [ %spec.select.1, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end23, label %for.body6.epil for.body6.epil: ; preds = %for.end23.loopexit.unr-lcssa %arrayidx8.epil = getelementptr inbounds [200000 x i32], ptr %r, i64 0, i64 %indvars.iv45.unr %7 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %sub9.epil = sub nsw i32 %7, %min.041.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %maxv.040.unr, i32 %sub9.epil) br label %for.end23 for.end23: ; preds = %for.body6.epil, %for.end23.loopexit.unr-lcssa, %for.end %maxv.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end23.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body6.epil ] %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %r) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main(){ int h,i,j,n,min,max; max = -9999999999; scanf("%d",&n); scanf("%d",&h); min = h; for(j = 1;j < n;j++){ scanf("%d",&i); if(max > i-min) max = max; else max = i-min; if(i > min) min = min; else min = i; } printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314345/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314345/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %h = alloca i32, align 4 %i = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp16 = icmp sgt i32 %0, 1 br i1 %cmp16, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %1 = load i32, ptr %h, align 4, !tbaa !5 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %max.019 = phi i32 [ %max.0.sub, %for.body ], [ -1410065407, %for.body.preheader ] %min.018 = phi i32 [ %min.1, %for.body ], [ %1, %for.body.preheader ] %j.017 = phi i32 [ %inc, %for.body ], [ 1, %for.body.preheader ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %2 = load i32, ptr %i, align 4, !tbaa !5 %sub = sub nsw i32 %2, %min.018 %max.0.sub = call i32 @llvm.smax.i32(i32 %max.019, i32 %sub) %min.1 = call i32 @llvm.smin.i32(i32 %2, i32 %min.018) %inc = add nuw nsw i32 %j.017, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ -1410065407, %entry ], [ %max.0.sub, %for.body ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int main(void) { int n, i, j, max, min; int *R; scanf("%d", &n); R = malloc(sizeof(int*) * n); for (i = 0; i < n; i++) { scanf("%d", R + i); } max = R[1] - R[0]; if (R[0] < R[1]) min = R[0]; else min = R[1]; for (i = 2; i < n; i++) { if (max < R[i] - min) max = R[i] - min; if (min > R[i]) min = R[i]; } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314389/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314389/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = zext i32 %0 to i64 %mul = shl nuw nsw i64 %conv, 3 %call1 = call noalias ptr @malloc(i64 noundef %mul) #7 %cmp59 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp59) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %arrayidx.phi.trans.insert = getelementptr inbounds i32, ptr %call1, i64 1 %.pre = load i32, ptr %arrayidx.phi.trans.insert, align 4, !tbaa !5 %.pre71 = load i32, ptr %call1, align 4, !tbaa !5 %sub = sub nsw i32 %.pre, %.pre71 %cmp1261 = icmp sgt i32 %1, 2 br i1 %cmp1261, label %for.body14.preheader, label %for.end34 for.body14.preheader: ; preds = %for.end %. = call i32 @llvm.smin.i32(i32 %.pre71, i32 %.pre) %wide.trip.count = zext i32 %1 to i64 %xtraiter = and i64 %wide.trip.count, 1 %3 = icmp eq i32 %1, 3 br i1 %3, label %for.end34.loopexit.unr-lcssa, label %for.body14.preheader.new for.body14.preheader.new: ; preds = %for.body14.preheader %4 = and i64 %wide.trip.count, 4294967294 %5 = add nsw i64 %4, -4 br label %for.body14 for.body14: ; preds = %for.body14, %for.body14.preheader.new %indvars.iv68 = phi i64 [ 2, %for.body14.preheader.new ], [ %indvars.iv.next69.1, %for.body14 ] %min.163 = phi i32 [ %., %for.body14.preheader.new ], [ %min.2.1, %for.body14 ] %max.062 = phi i32 [ %sub, %for.body14.preheader.new ], [ %spec.select.1, %for.body14 ] %niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.1, %for.body14 ] %arrayidx15 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv68 %6 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %sub16 = sub nsw i32 %6, %min.163 %spec.select = call i32 @llvm.smax.i32(i32 %max.062, i32 %sub16) %min.2 = call i32 @llvm.smin.i32(i32 %min.163, i32 %6) %indvars.iv.next69 = or i64 %indvars.iv68, 1 %arrayidx15.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next69 %7 = load i32, ptr %arrayidx15.1, align 4, !tbaa !5 %sub16.1 = sub nsw i32 %7, %min.2 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub16.1) %min.2.1 = call i32 @llvm.smin.i32(i32 %min.2, i32 %7) %indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter, %5 br i1 %niter.ncmp.1, label %for.end34.loopexit.unr-lcssa, label %for.body14, !llvm.loop !11 for.end34.loopexit.unr-lcssa: ; preds = %for.body14, %for.body14.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body14.preheader ], [ %spec.select.1, %for.body14 ] %indvars.iv68.unr = phi i64 [ 2, %for.body14.preheader ], [ %indvars.iv.next69.1, %for.body14 ] %min.163.unr = phi i32 [ %., %for.body14.preheader ], [ %min.2.1, %for.body14 ] %max.062.unr = phi i32 [ %sub, %for.body14.preheader ], [ %spec.select.1, %for.body14 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end34, label %for.body14.epil for.body14.epil: ; preds = %for.end34.loopexit.unr-lcssa %arrayidx15.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv68.unr %8 = load i32, ptr %arrayidx15.epil, align 4, !tbaa !5 %sub16.epil = sub nsw i32 %8, %min.163.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %max.062.unr, i32 %sub16.epil) br label %for.end34 for.end34: ; preds = %for.body14.epil, %for.end34.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end34.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body14.epil ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 attributes #0 = { nofree 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #6 = { nounwind } attributes #7 = { nounwind allocsize(0) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <limits.h> int main(){ char line[100]; int num; fgets(line, sizeof(line), stdin); sscanf(line, "%d", &num); int N[200000]; int i, j; for(i=0; i<num; ++i){ fgets(line, sizeof(line), stdin); sscanf(line, "%d", &N[i]); } int max=INT_MIN; int tmp; int min=N[0]; for(i=1; i<num; ++i){ tmp=N[i]-min; if(tmp>max) max=tmp; if(N[i]<min) min=N[i]; } printf("%d\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314439/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314439/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @stdin = external local_unnamed_addr global ptr, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %line = alloca [100 x i8], align 16 %num = alloca i32, align 4 %N = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %line) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 100, ptr noundef %0) %call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef nonnull %num) #4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %N) #4 %1 = load i32, ptr %num, align 4, !tbaa !9 %cmp35 = icmp sgt i32 %1, 0 br i1 %cmp35, label %for.body, label %for.end23 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call4 = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 100, ptr noundef %2) %arrayidx = getelementptr inbounds [200000 x i32], ptr %N, i64 0, i64 %indvars.iv %call6 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) #4 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %num, align 4, !tbaa !9 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body %cmp937 = icmp sgt i32 %3, 1 br i1 %cmp937, label %for.body10.preheader, label %for.end23 for.body10.preheader: ; preds = %for.end %.pre = load i32, ptr %N, align 16, !tbaa !9 %wide.trip.count = zext i32 %3 to i64 %5 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %5, 1 %6 = icmp eq i32 %3, 2 br i1 %6, label %for.end23.loopexit.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %5, -2 br label %for.body10 for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv44 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next45.1, %for.body10 ] %min.040 = phi i32 [ %.pre, %for.body10.preheader.new ], [ %min.1.1, %for.body10 ] %max.038 = phi i32 [ -2147483648, %for.body10.preheader.new ], [ %spec.select.1, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ] %arrayidx12 = getelementptr inbounds [200000 x i32], ptr %N, i64 0, i64 %indvars.iv44 %7 = load i32, ptr %arrayidx12, align 4, !tbaa !9 %sub = sub nsw i32 %7, %min.040 %spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 %max.038) %min.1 = call i32 @llvm.smin.i32(i32 %7, i32 %min.040) %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %arrayidx12.1 = getelementptr inbounds [200000 x i32], ptr %N, i64 0, i64 %indvars.iv.next45 %8 = load i32, ptr %arrayidx12.1, align 4, !tbaa !9 %sub.1 = sub nsw i32 %8, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %sub.1, i32 %spec.select) %min.1.1 = call i32 @llvm.smin.i32(i32 %8, i32 %min.1) %indvars.iv.next45.1 = add nuw nsw i64 %indvars.iv44, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end23.loopexit.unr-lcssa, label %for.body10, !llvm.loop !13 for.end23.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %spec.select.1, %for.body10 ] %indvars.iv44.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next45.1, %for.body10 ] %min.040.unr = phi i32 [ %.pre, %for.body10.preheader ], [ %min.1.1, %for.body10 ] %max.038.unr = phi i32 [ -2147483648, %for.body10.preheader ], [ %spec.select.1, %for.body10 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end23, label %for.body10.epil for.body10.epil: ; preds = %for.end23.loopexit.unr-lcssa %arrayidx12.epil = getelementptr inbounds [200000 x i32], ptr %N, i64 0, i64 %indvars.iv44.unr %9 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !9 %sub.epil = sub nsw i32 %9, %min.040.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %sub.epil, i32 %max.038.unr) br label %for.end23 for.end23: ; preds = %for.body10.epil, %for.end23.loopexit.unr-lcssa, %entry, %for.end %max.0.lcssa = phi i32 [ -2147483648, %for.end ], [ -2147483648, %entry ], [ %spec.select.lcssa.ph, %for.end23.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body10.epil ] %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %N) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4 call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %line) #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: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !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 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12}
#include<stdio.h> int main(){ int max=-1000000000,tmp=-1000000000,min=1000000000,n,i,j=0,a[200000],prof[100000]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } if(n==2){ prof[0]=a[1]-a[0]; j++; }else{ for(i=0;i<n;i++){ if(a[i]>max){ max=a[i]; } if(a[i]<min){ prof[j]=max-min; j++; min=a[i]; max=-1000000000; } } prof[j]=max-min; j++; } for(i=0;i<j;i++){ if(prof[i]>tmp)tmp=prof[i]; } printf("%d\n",tmp); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314482/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314482/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [200000 x i32], align 16 %prof = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %prof) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp74 = icmp sgt i32 %0, 0 br i1 %cmp74, label %for.body, label %if.end34.thread106 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp2 = icmp eq i32 %1, 2 br i1 %cmp2, label %if.end34.thread, label %for.cond7.preheader for.cond7.preheader: ; preds = %for.end %cmp876 = icmp sgt i32 %1, 0 br i1 %cmp876, label %for.body9.preheader, label %if.end34.thread106 for.body9.preheader: ; preds = %for.cond7.preheader %wide.trip.count = zext i32 %1 to i64 %xtraiter = and i64 %wide.trip.count, 1 %3 = icmp eq i32 %1, 1 br i1 %3, label %if.end34.unr-lcssa, label %for.body9.preheader.new for.body9.preheader.new: ; preds = %for.body9.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body9 if.end34.thread: ; preds = %for.end %arrayidx3 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 1 %4 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %5 = load i32, ptr %a, align 16, !tbaa !5 %sub = sub nsw i32 %4, %5 store i32 %sub, ptr %prof, align 16, !tbaa !5 br label %for.body37.preheader for.body9: ; preds = %for.inc27.1, %for.body9.preheader.new %indvars.iv90 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next91.1, %for.inc27.1 ] %j.080 = phi i32 [ 0, %for.body9.preheader.new ], [ %j.1.1, %for.inc27.1 ] %min.078 = phi i32 [ 1000000000, %for.body9.preheader.new ], [ %min.1.1, %for.inc27.1 ] %max.077 = phi i32 [ -1000000000, %for.body9.preheader.new ], [ %max.2.1, %for.inc27.1 ] %niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc27.1 ] %arrayidx11 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv90 %6 = load i32, ptr %arrayidx11, align 8, !tbaa !5 %spec.select = call i32 @llvm.smax.i32(i32 %6, i32 %max.077) %cmp18 = icmp slt i32 %6, %min.078 br i1 %cmp18, label %if.then19, label %for.inc27 if.then19: ; preds = %for.body9 %sub20 = sub nsw i32 %spec.select, %min.078 %idxprom21 = sext i32 %j.080 to i64 %arrayidx22 = getelementptr inbounds [100000 x i32], ptr %prof, i64 0, i64 %idxprom21 store i32 %sub20, ptr %arrayidx22, align 4, !tbaa !5 %inc23 = add nsw i32 %j.080, 1 br label %for.inc27 for.inc27: ; preds = %for.body9, %if.then19 %max.2 = phi i32 [ -1000000000, %if.then19 ], [ %spec.select, %for.body9 ] %min.1 = phi i32 [ %6, %if.then19 ], [ %min.078, %for.body9 ] %j.1 = phi i32 [ %inc23, %if.then19 ], [ %j.080, %for.body9 ] %indvars.iv.next91 = or i64 %indvars.iv90, 1 %arrayidx11.1 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next91 %7 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5 %spec.select.1 = call i32 @llvm.smax.i32(i32 %7, i32 %max.2) %cmp18.1 = icmp slt i32 %7, %min.1 br i1 %cmp18.1, label %if.then19.1, label %for.inc27.1 if.then19.1: ; preds = %for.inc27 %sub20.1 = sub nsw i32 %spec.select.1, %min.1 %idxprom21.1 = sext i32 %j.1 to i64 %arrayidx22.1 = getelementptr inbounds [100000 x i32], ptr %prof, i64 0, i64 %idxprom21.1 store i32 %sub20.1, ptr %arrayidx22.1, align 4, !tbaa !5 %inc23.1 = add nsw i32 %j.1, 1 br label %for.inc27.1 for.inc27.1: ; preds = %if.then19.1, %for.inc27 %max.2.1 = phi i32 [ -1000000000, %if.then19.1 ], [ %spec.select.1, %for.inc27 ] %min.1.1 = phi i32 [ %7, %if.then19.1 ], [ %min.1, %for.inc27 ] %j.1.1 = phi i32 [ %inc23.1, %if.then19.1 ], [ %j.1, %for.inc27 ] %indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %if.end34.unr-lcssa, label %for.body9, !llvm.loop !11 if.end34.thread106: ; preds = %for.cond7.preheader, %entry store i32 -2000000000, ptr %prof, align 16, !tbaa !5 br label %for.body37.preheader if.end34.unr-lcssa: ; preds = %for.inc27.1, %for.body9.preheader %max.2.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %max.2.1, %for.inc27.1 ] %min.1.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %min.1.1, %for.inc27.1 ] %j.1.lcssa.ph = phi i32 [ undef, %for.body9.preheader ], [ %j.1.1, %for.inc27.1 ] %indvars.iv90.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next91.1, %for.inc27.1 ] %j.080.unr = phi i32 [ 0, %for.body9.preheader ], [ %j.1.1, %for.inc27.1 ] %min.078.unr = phi i32 [ 1000000000, %for.body9.preheader ], [ %min.1.1, %for.inc27.1 ] %max.077.unr = phi i32 [ -1000000000, %for.body9.preheader ], [ %max.2.1, %for.inc27.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %if.end34, label %for.body9.epil for.body9.epil: ; preds = %if.end34.unr-lcssa %arrayidx11.epil = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv90.unr %8 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5 %spec.select.epil = call i32 @llvm.smax.i32(i32 %8, i32 %max.077.unr) %cmp18.epil = icmp slt i32 %8, %min.078.unr br i1 %cmp18.epil, label %if.then19.epil, label %if.end34 if.then19.epil: ; preds = %for.body9.epil %sub20.epil = sub nsw i32 %spec.select.epil, %min.078.unr %idxprom21.epil = sext i32 %j.080.unr to i64 %arrayidx22.epil = getelementptr inbounds [100000 x i32], ptr %prof, i64 0, i64 %idxprom21.epil store i32 %sub20.epil, ptr %arrayidx22.epil, align 4, !tbaa !5 %inc23.epil = add nsw i32 %j.080.unr, 1 br label %if.end34 if.end34: ; preds = %for.body9.epil, %if.then19.epil, %if.end34.unr-lcssa %max.2.lcssa = phi i32 [ %max.2.lcssa.ph, %if.end34.unr-lcssa ], [ -1000000000, %if.then19.epil ], [ %spec.select.epil, %for.body9.epil ] %min.1.lcssa = phi i32 [ %min.1.lcssa.ph, %if.end34.unr-lcssa ], [ %8, %if.then19.epil ], [ %min.078.unr, %for.body9.epil ] %j.1.lcssa = phi i32 [ %j.1.lcssa.ph, %if.end34.unr-lcssa ], [ %inc23.epil, %if.then19.epil ], [ %j.080.unr, %for.body9.epil ] %9 = sub nsw i32 %max.2.lcssa, %min.1.lcssa %idxprom31 = sext i32 %j.1.lcssa to i64 %arrayidx32 = getelementptr inbounds [100000 x i32], ptr %prof, i64 0, i64 %idxprom31 store i32 %9, ptr %arrayidx32, align 4, !tbaa !5 %inc33 = add nsw i32 %j.1.lcssa, 1 %cmp3684 = icmp sgt i32 %j.1.lcssa, -1 br i1 %cmp3684, label %for.body37.preheader, label %for.end47 for.body37.preheader: ; preds = %if.end34.thread106, %if.end34.thread, %if.end34 %j.2105 = phi i32 [ 1, %if.end34.thread ], [ %inc33, %if.end34 ], [ 1, %if.end34.thread106 ] %wide.trip.count96 = zext i32 %j.2105 to i64 %min.iters.check = icmp ult i32 %j.2105, 8 br i1 %min.iters.check, label %for.body37.preheader115, label %vector.ph vector.ph: ; preds = %for.body37.preheader %n.vec = and i64 %wide.trip.count96, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ <i32 -1000000000, i32 -1000000000, i32 -1000000000, i32 -1000000000>, %vector.ph ], [ %12, %vector.body ] %vec.phi113 = phi <4 x i32> [ <i32 -1000000000, i32 -1000000000, i32 -1000000000, i32 -1000000000>, %vector.ph ], [ %13, %vector.body ] %10 = getelementptr inbounds [100000 x i32], ptr %prof, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %10, align 16, !tbaa !5 %11 = getelementptr inbounds i32, ptr %10, i64 4 %wide.load114 = load <4 x i32>, ptr %11, align 16, !tbaa !5 %12 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi) %13 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load114, <4 x i32> %vec.phi113) %index.next = add nuw i64 %index, 8 %14 = icmp eq i64 %index.next, %n.vec br i1 %14, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %12, <4 x i32> %13) %15 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count96 br i1 %cmp.n, label %for.end47, label %for.body37.preheader115 for.body37.preheader115: ; preds = %for.body37.preheader, %middle.block %indvars.iv93.ph = phi i64 [ 0, %for.body37.preheader ], [ %n.vec, %middle.block ] %tmp.085.ph = phi i32 [ -1000000000, %for.body37.preheader ], [ %15, %middle.block ] br label %for.body37 for.body37: ; preds = %for.body37.preheader115, %for.body37 %indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.body37 ], [ %indvars.iv93.ph, %for.body37.preheader115 ] %tmp.085 = phi i32 [ %spec.select73, %for.body37 ], [ %tmp.085.ph, %for.body37.preheader115 ] %arrayidx39 = getelementptr inbounds [100000 x i32], ptr %prof, i64 0, i64 %indvars.iv93 %16 = load i32, ptr %arrayidx39, align 4, !tbaa !5 %spec.select73 = call i32 @llvm.smax.i32(i32 %16, i32 %tmp.085) %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1 %exitcond97.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count96 br i1 %exitcond97.not, label %for.end47, label %for.body37, !llvm.loop !15 for.end47: ; preds = %for.body37, %middle.block, %if.end34 %tmp.0.lcssa = phi i32 [ -1000000000, %if.end34 ], [ %15, %middle.block ], [ %spec.select73, %for.body37 ] %call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %tmp.0.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %prof) #4 call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !10, !14, !13}
#include<stdio.h> int main(){ int i, num,alt,max=0,min=0; scanf("%d",&num); int buf[num]; for(i=0;i<num;i++){ scanf("%d",&buf[i]); } max=buf[1]-buf[0]; min=buf[0]; for(i=1;i<num;i++){ if(max<buf[i]-min)max=buf[i]-min; if(min>buf[i])min=buf[i]; } printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314525/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314525/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %num = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %0 = load i32, ptr %num, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %num, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %3, 0 call void @llvm.assume(i1 %cmp37) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %num, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %arrayidx2.phi.trans.insert = getelementptr inbounds i32, ptr %vla, i64 1 %.pre = load i32, ptr %arrayidx2.phi.trans.insert, align 4, !tbaa !5 %.pre49 = load i32, ptr %vla, align 16, !tbaa !5 %sub = sub nsw i32 %.pre, %.pre49 %cmp639 = icmp sgt i32 %4, 1 br i1 %cmp639, label %for.body7.preheader, label %for.end24 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %4 to i64 %6 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %6, 1 %7 = icmp eq i32 %4, 2 br i1 %7, label %for.end24.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %6, -2 %invariant.gep = getelementptr i32, ptr %vla, i64 1 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv46 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next47.1, %for.body7 ] %min.041 = phi i32 [ %.pre49, %for.body7.preheader.new ], [ %min.1.1, %for.body7 ] %max.040 = phi i32 [ %sub, %for.body7.preheader.new ], [ %spec.select.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %8, %min.041 %spec.select = call i32 @llvm.smax.i32(i32 %max.040, i32 %sub10) %min.1 = call i32 @llvm.smin.i32(i32 %min.041, i32 %8) %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv46 %9 = load i32, ptr %gep, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %9, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub10.1) %min.1.1 = call i32 @llvm.smin.i32(i32 %min.1, i32 %9) %indvars.iv.next47.1 = add nuw nsw i64 %indvars.iv46, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end24.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end24.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %indvars.iv46.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next47.1, %for.body7 ] %min.041.unr = phi i32 [ %.pre49, %for.body7.preheader ], [ %min.1.1, %for.body7 ] %max.040.unr = phi i32 [ %sub, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end24, label %for.body7.epil for.body7.epil: ; preds = %for.end24.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46.unr %10 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %10, %min.041.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %max.040.unr, i32 %sub10.epil) br label %for.end24 for.end24: ; preds = %for.body7.epil, %for.end24.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body7.epil ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> #define N 200000 int main(){ int n,i,j,max=0,min=0,a[N]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } min=a[0]; max=a[1]-a[0]; for(j=1;j<n;j++){ if(max<(a[j]-min)){ max=a[j]-min; } if(min>a[j]){ min=a[j]; } } printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314569/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314569/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp36 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp36) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %a, align 16, !tbaa !5 %arrayidx3.phi.trans.insert = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 1 %.pre48 = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 %sub = sub nsw i32 %.pre48, %.pre %cmp638 = icmp sgt i32 %1, 1 br i1 %cmp638, label %for.body7.preheader, label %for.end24 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end24.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %3, -2 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv45 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next46.1, %for.body7 ] %min.041 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %min.1.1, %for.body7 ] %max.040 = phi i32 [ %sub, %for.body7.preheader.new ], [ %spec.select.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv45 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %5, %min.041 %spec.select = call i32 @llvm.smax.i32(i32 %max.040, i32 %sub10) %min.1 = call i32 @llvm.smin.i32(i32 %min.041, i32 %5) %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %arrayidx9.1 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv.next46 %6 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %6, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub10.1) %min.1.1 = call i32 @llvm.smin.i32(i32 %min.1, i32 %6) %indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end24.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end24.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %indvars.iv45.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next46.1, %for.body7 ] %min.041.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %min.1.1, %for.body7 ] %max.040.unr = phi i32 [ %sub, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end24, label %for.body7.epil for.body7.epil: ; preds = %for.end24.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv45.unr %7 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %7, %min.041.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %max.040.unr, i32 %sub10.epil) br label %for.end24 for.end24: ; preds = %for.body7.epil, %for.end24.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body7.epil ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int main(){ int i,j,n,Max,key,key2,count=1; int A[200001]; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&A[i]); } Max=A[2]-A[1]; key2=A[n]; for(i=n;i>=2;i--){ if(key2<=A[i]){ for(j=i,count=1;j>1;j--){ // if(count==1){ if(Max<A[i]-A[j-1]){ Max=A[i]-A[j-1]; key=A[j-1];} // count++; else if(count==1){ if(key>A[j-1]){ if(Max<A[i]-A[j-1]){ Max=A[i]-A[j-1]; key=A[j-1];}} key2=A[i]; } count=1; } }} printf("%d\n",Max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314611/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314611/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %A = alloca [200001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %A) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not90 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp.not90) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %2 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %arrayidx2.phi.trans.insert = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 2 %.pre = load i32, ptr %arrayidx2.phi.trans.insert, align 8, !tbaa !5 %arrayidx3.phi.trans.insert = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 1 %.pre116 = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 %3 = sub nsw i32 %.pre, %.pre116 %cmp7100 = icmp sgt i32 %1, 1 br i1 %cmp7100, label %for.body8.preheader, label %for.end66 for.body8.preheader: ; preds = %for.end %arrayidx5 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %2 %4 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %5 = zext i32 %1 to i64 br label %for.body8 for.body8: ; preds = %for.body8.preheader, %for.inc64 %indvars.iv109 = phi i64 [ %5, %for.body8.preheader ], [ %indvars.iv.next110, %for.inc64 ] %key2.0105 = phi i32 [ %4, %for.body8.preheader ], [ %key2.3, %for.inc64 ] %Max.0103 = phi i32 [ %3, %for.body8.preheader ], [ %Max.4, %for.inc64 ] %arrayidx10 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv109 %6 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp11.not.not = icmp sgt i32 %key2.0105, %6 br i1 %cmp11.not.not, label %for.inc64, label %for.body14 for.body14: ; preds = %for.body8, %for.body14 %indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.body14 ], [ %indvars.iv109, %for.body8 ] %key2.196 = phi i32 [ %key2.2, %for.body14 ], [ %key2.0105, %for.body8 ] %Max.194 = phi i32 [ %Max.3, %for.body14 ], [ %Max.0103, %for.body8 ] %indvars.iv.next112 = add nsw i64 %indvars.iv111, -1 %idxprom18 = and i64 %indvars.iv.next112, 4294967295 %arrayidx19 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %idxprom18 %7 = load i32, ptr %arrayidx19, align 4, !tbaa !5 %sub20 = sub nsw i32 %6, %7 %cmp21 = icmp slt i32 %Max.194, %sub20 %Max.3 = call i32 @llvm.smax.i32(i32 %Max.194, i32 %sub20) %key2.2 = select i1 %cmp21, i32 %key2.196, i32 %6 %8 = trunc i64 %indvars.iv111 to i32 %cmp13 = icmp sgt i32 %8, 2 br i1 %cmp13, label %for.body14, label %for.inc64, !llvm.loop !11 for.inc64: ; preds = %for.body14, %for.body8 %Max.4 = phi i32 [ %Max.0103, %for.body8 ], [ %Max.3, %for.body14 ] %key2.3 = phi i32 [ %key2.0105, %for.body8 ], [ %key2.2, %for.body14 ] %indvars.iv.next110 = add nsw i64 %indvars.iv109, -1 %cmp7 = icmp sgt i64 %indvars.iv109, 2 br i1 %cmp7, label %for.body8, label %for.end66, !llvm.loop !12 for.end66: ; preds = %for.inc64, %for.end %Max.0.lcssa = phi i32 [ %3, %for.end ], [ %Max.4, %for.inc64 ] %call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %Max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %A) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> #define MAX 200000 int max(int a,int b){return a>b ? a: b;} int min(int a,int b){return a<b ? a: b;} int main(void){ int R[MAX],i,n; scanf("%d",&n); for(i=0;i<n;i++)scanf("%d",&R[i]); int maxv=-2000000000; int minv=R[0]; for(int i=1;i<n;i++){ maxv=max(maxv,R[i]-minv); minv=min(minv,R[i]); } printf("%d\n",maxv); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314655/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314655/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %R = alloca [200000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %R) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp25 = icmp sgt i32 %0, 0 br i1 %cmp25, label %for.body, label %for.cond.cleanup for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp527 = icmp sgt i32 %1, 1 br i1 %cmp527, label %for.body6.preheader, label %for.cond.cleanup for.body6.preheader: ; preds = %for.end %.pre = load i32, ptr %R, align 16, !tbaa !5 %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %3, -2 br label %for.body6 for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %cond.i.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %cond.i.1, %for.body6 ] %indvars.iv34.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next35.1, %for.body6 ] %minv.029.unr = phi i32 [ %.pre, %for.body6.preheader ], [ %cond.i24.1, %for.body6 ] %maxv.028.unr = phi i32 [ -2000000000, %for.body6.preheader ], [ %cond.i.1, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body6.epil for.body6.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa %arrayidx8.epil = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv34.unr %5 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %5, %minv.029.unr %cond.i.epil = call i32 @llvm.smax.i32(i32 %maxv.028.unr, i32 %sub.epil) br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body6.epil, %for.cond.cleanup.loopexit.unr-lcssa, %entry, %for.end %maxv.0.lcssa = phi i32 [ -2000000000, %for.end ], [ -2000000000, %entry ], [ %cond.i.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %cond.i.epil, %for.body6.epil ] %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %R) #5 ret i32 0 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv34 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next35.1, %for.body6 ] %minv.029 = phi i32 [ %.pre, %for.body6.preheader.new ], [ %cond.i24.1, %for.body6 ] %maxv.028 = phi i32 [ -2000000000, %for.body6.preheader.new ], [ %cond.i.1, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ] %arrayidx8 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv34 %6 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %sub = sub nsw i32 %6, %minv.029 %cond.i = call i32 @llvm.smax.i32(i32 %maxv.028, i32 %sub) %cond.i24 = call i32 @llvm.smin.i32(i32 %minv.029, i32 %6) %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1 %arrayidx8.1 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv.next35 %7 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %7, %cond.i24 %cond.i.1 = call i32 @llvm.smax.i32(i32 %cond.i, i32 %sub.1) %cond.i24.1 = call i32 @llvm.smin.i32(i32 %cond.i24, i32 %7) %indvars.iv.next35.1 = add nuw nsw i64 %indvars.iv34, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <stdlib.h> #define max(x,y) (x > y) ? x:y #define min(x,y) (x < y) ? x:y int main(){ int n; int maxv,minv; int i; int *R; scanf("%d",&n); R = (int *)malloc(sizeof(int) * n); for (i = 0;i < n;i++) scanf("%d",&R[i]); maxv = R[1] - R[0]; minv = R[0]; for (i = 1;i < n;i++){ maxv = max(maxv,R[i] - minv); minv = min(minv,R[i]); } printf("%d\n",maxv); free(R); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314699/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314699/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = zext i32 %0 to i64 %mul = shl nuw nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #8 %cmp54 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp54) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %arrayidx4.phi.trans.insert = getelementptr inbounds i32, ptr %call1, i64 1 %.pre = load i32, ptr %arrayidx4.phi.trans.insert, align 4, !tbaa !5 %.pre66 = load i32, ptr %call1, align 4, !tbaa !5 %sub = sub nsw i32 %.pre, %.pre66 %cmp856 = icmp sgt i32 %1, 1 br i1 %cmp856, label %for.body10.preheader, label %for.end31 for.body10.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end31.loopexit.unr-lcssa, label %for.body10.preheader.new for.body10.preheader.new: ; preds = %for.body10.preheader %unroll_iter = and i64 %3, -2 %invariant.gep = getelementptr i32, ptr %call1, i64 1 br label %for.body10 for.body10: ; preds = %for.body10, %for.body10.preheader.new %indvars.iv63 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next64.1, %for.body10 ] %maxv.059 = phi i32 [ %sub, %for.body10.preheader.new ], [ %maxv.0.sub13.1, %for.body10 ] %minv.057 = phi i32 [ %.pre66, %for.body10.preheader.new ], [ %cond28.1, %for.body10 ] %niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ] %arrayidx12 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv63 %5 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %sub13 = sub nsw i32 %5, %minv.057 %maxv.0.sub13 = call i32 @llvm.smax.i32(i32 %maxv.059, i32 %sub13) %cond28 = call i32 @llvm.smin.i32(i32 %minv.057, i32 %5) %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv63 %6 = load i32, ptr %gep, align 4, !tbaa !5 %sub13.1 = sub nsw i32 %6, %cond28 %maxv.0.sub13.1 = call i32 @llvm.smax.i32(i32 %maxv.0.sub13, i32 %sub13.1) %cond28.1 = call i32 @llvm.smin.i32(i32 %cond28, i32 %6) %indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end31.loopexit.unr-lcssa, label %for.body10, !llvm.loop !11 for.end31.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader %maxv.0.sub13.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %maxv.0.sub13.1, %for.body10 ] %indvars.iv63.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next64.1, %for.body10 ] %maxv.059.unr = phi i32 [ %sub, %for.body10.preheader ], [ %maxv.0.sub13.1, %for.body10 ] %minv.057.unr = phi i32 [ %.pre66, %for.body10.preheader ], [ %cond28.1, %for.body10 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end31, label %for.body10.epil for.body10.epil: ; preds = %for.end31.loopexit.unr-lcssa %arrayidx12.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv63.unr %7 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5 %sub13.epil = sub nsw i32 %7, %minv.057.unr %maxv.0.sub13.epil = call i32 @llvm.smax.i32(i32 %maxv.059.unr, i32 %sub13.epil) br label %for.end31 for.end31: ; preds = %for.body10.epil, %for.end31.loopexit.unr-lcssa, %for.end %maxv.0.lcssa = phi i32 [ %sub, %for.end ], [ %maxv.0.sub13.lcssa.ph, %for.end31.loopexit.unr-lcssa ], [ %maxv.0.sub13.epil, %for.body10.epil ] %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @free(ptr noundef nonnull %call1) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #6 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 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #7 = { nounwind } attributes #8 = { nounwind allocsize(0) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main() { int n, i; long input; long minv; long maxv; scanf("%d", &n); scanf("%ld", &input); minv = input; for (i = 1; i < n; i++) { scanf("%ld", &input); if (i == 1) maxv = input - minv; maxv = (maxv > input - minv) ? maxv : input - minv; minv = (minv < input) ? minv : input; } printf("%d\n", maxv); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314741/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314741/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %input = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %input) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %input) %0 = load i64, ptr %input, align 8, !tbaa !5 %1 = load i32, ptr %n, align 4, !tbaa !9 %cmp21 = icmp sgt i32 %1, 1 call void @llvm.assume(i1 %cmp21) %call2.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %input) %2 = load i64, ptr %input, align 8 %sub.peel = sub nsw i64 %2, %0 %3 = load i32, ptr %n, align 4, !tbaa !9 %cmp.peel = icmp sgt i32 %3, 2 br i1 %cmp.peel, label %for.body.peel.next, label %for.end for.body.peel.next: ; preds = %entry %cond11.peel = call i64 @llvm.smin.i64(i64 %0, i64 %2) br label %for.body for.body: ; preds = %for.body.peel.next, %for.body %maxv.024 = phi i64 [ %cond, %for.body ], [ %sub.peel, %for.body.peel.next ] %minv.023 = phi i64 [ %cond11, %for.body ], [ %cond11.peel, %for.body.peel.next ] %i.022 = phi i32 [ %inc, %for.body ], [ 2, %for.body.peel.next ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %input) %4 = load i64, ptr %input, align 8 %sub = sub nsw i64 %4, %minv.023 %cond = call i64 @llvm.smax.i64(i64 %maxv.024, i64 %sub) %cond11 = call i64 @llvm.smin.i64(i64 %minv.023, i64 %4) %inc = add nuw nsw i32 %i.022, 1 %5 = load i32, ptr %n, align 4, !tbaa !9 %cmp = icmp slt i32 %inc, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body, %entry %cond.lcssa = phi i64 [ %sub.peel, %entry ], [ %cond, %for.body ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %cond.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %input) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long", !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 = distinct !{!11, !12, !13} !12 = !{!"llvm.loop.mustprogress"} !13 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main (void) { int n,i,j,maxv,minv; scanf("%d",&n); int x[n]; for(i=0;i<n;i++) { scanf("%d", &x[i]); } minv=x[0]; maxv=-x[0]; for(j=1;j<=n-1;j++) { if(maxv<x[j]-minv)maxv=x[j]-minv; if(minv>x[j])minv=x[j]; } printf("%d\n",maxv); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314785/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314785/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp36 = icmp sgt i32 %3, 0 call void @llvm.assume(i1 %cmp36) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %vla, align 16, !tbaa !5 %sub = sub nsw i32 0, %.pre %cmp6.not.not38 = icmp sgt i32 %4, 1 br i1 %cmp6.not.not38, label %for.body7.preheader, label %for.end24 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %4 to i64 %6 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %6, 1 %7 = icmp eq i32 %4, 2 br i1 %7, label %for.end24.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %6, -2 %invariant.gep = getelementptr i32, ptr %vla, i64 1 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv45 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next46.1, %for.body7 ] %minv.040 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %minv.1.1, %for.body7 ] %maxv.039 = phi i32 [ %sub, %for.body7.preheader.new ], [ %spec.select.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv45 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %8, %minv.040 %spec.select = call i32 @llvm.smax.i32(i32 %maxv.039, i32 %sub10) %minv.1 = call i32 @llvm.smin.i32(i32 %minv.040, i32 %8) %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv45 %9 = load i32, ptr %gep, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %9, %minv.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub10.1) %minv.1.1 = call i32 @llvm.smin.i32(i32 %minv.1, i32 %9) %indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end24.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end24.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %indvars.iv45.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next46.1, %for.body7 ] %minv.040.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %minv.1.1, %for.body7 ] %maxv.039.unr = phi i32 [ %sub, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end24, label %for.body7.epil for.body7.epil: ; preds = %for.end24.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv45.unr %10 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %10, %minv.040.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %maxv.039.unr, i32 %sub10.epil) br label %for.end24 for.end24: ; preds = %for.body7.epil, %for.end24.loopexit.unr-lcssa, %for.end %maxv.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body7.epil ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #5 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main() { int n; int min, maxDiff = (1 << (sizeof(int) * 8 - 2)) * -1; scanf(" %d", &n); int current, i; scanf(" %d", &min); for (i = 1; i < n; i++) { scanf(" %d", &current); int diff = current - min; if (diff > maxDiff) { maxDiff = diff; } if (current < min) { min = current; } } printf("%d\n", maxDiff); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314835/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314835/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %min = alloca i32, align 4 %current = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %min) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %current) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %min) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp11 = icmp sgt i32 %0, 1 br i1 %cmp11, label %for.body, label %for.end for.body: ; preds = %entry, %if.end6 %maxDiff.013 = phi i32 [ %spec.select, %if.end6 ], [ -1073741824, %entry ] %i.012 = phi i32 [ %inc, %if.end6 ], [ 1, %entry ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %current) %1 = load i32, ptr %current, align 4, !tbaa !5 %2 = load i32, ptr %min, align 4, !tbaa !5 %sub = sub nsw i32 %1, %2 %spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 %maxDiff.013) %cmp4 = icmp slt i32 %1, %2 br i1 %cmp4, label %if.then5, label %if.end6 if.then5: ; preds = %for.body store i32 %1, ptr %min, align 4, !tbaa !5 br label %if.end6 if.end6: ; preds = %if.then5, %for.body %inc = add nuw nsw i32 %i.012, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %if.end6, %entry %maxDiff.0.lcssa = phi i32 [ -1073741824, %entry ], [ %spec.select, %if.end6 ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxDiff.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %current) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %min) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #define MAX 200000 int max(int a,int b) { return a>b ? a: b;} int min(int a,int b) { return a<b ? a: b;} int main(void) { int R[MAX], i, n; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&R[i]); int maxv = -2000000000; int minv = R[0]; for(int i=1; i<n; i++) { maxv = max(maxv, R[i] - minv); minv = min(minv, R[i]); } printf("%d\n",maxv); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314879/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314879/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %R = alloca [200000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %R) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp25 = icmp sgt i32 %0, 0 br i1 %cmp25, label %for.body, label %for.cond.cleanup for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp527 = icmp sgt i32 %1, 1 br i1 %cmp527, label %for.body6.preheader, label %for.cond.cleanup for.body6.preheader: ; preds = %for.end %.pre = load i32, ptr %R, align 16, !tbaa !5 %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %3, -2 br label %for.body6 for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %cond.i.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %cond.i.1, %for.body6 ] %indvars.iv34.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next35.1, %for.body6 ] %minv.029.unr = phi i32 [ %.pre, %for.body6.preheader ], [ %cond.i24.1, %for.body6 ] %maxv.028.unr = phi i32 [ -2000000000, %for.body6.preheader ], [ %cond.i.1, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body6.epil for.body6.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa %arrayidx8.epil = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv34.unr %5 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %5, %minv.029.unr %cond.i.epil = call i32 @llvm.smax.i32(i32 %maxv.028.unr, i32 %sub.epil) br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body6.epil, %for.cond.cleanup.loopexit.unr-lcssa, %entry, %for.end %maxv.0.lcssa = phi i32 [ -2000000000, %for.end ], [ -2000000000, %entry ], [ %cond.i.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %cond.i.epil, %for.body6.epil ] %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %R) #5 ret i32 0 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv34 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next35.1, %for.body6 ] %minv.029 = phi i32 [ %.pre, %for.body6.preheader.new ], [ %cond.i24.1, %for.body6 ] %maxv.028 = phi i32 [ -2000000000, %for.body6.preheader.new ], [ %cond.i.1, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ] %arrayidx8 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv34 %6 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %sub = sub nsw i32 %6, %minv.029 %cond.i = call i32 @llvm.smax.i32(i32 %maxv.028, i32 %sub) %cond.i24 = call i32 @llvm.smin.i32(i32 %minv.029, i32 %6) %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1 %arrayidx8.1 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv.next35 %7 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %7, %cond.i24 %cond.i.1 = call i32 @llvm.smax.i32(i32 %cond.i, i32 %sub.1) %cond.i24.1 = call i32 @llvm.smin.i32(i32 %cond.i24, i32 %7) %indvars.iv.next35.1 = add nuw nsw i64 %indvars.iv34, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> int main(){ int a,b[200000],i,max,min; scanf("%d",&a); for(i=0;i<a;i++){ scanf("%d",&b[i]); } min=b[0]; max=b[1]-b[0]; for(i=1;i<a;i++){ if(max<b[i]-min){ max=b[i]-min; } if(min>b[i]){ min=b[i]; } } printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314921/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314921/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %b) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp37) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %b, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %b, align 16, !tbaa !5 %arrayidx3.phi.trans.insert = getelementptr inbounds [200000 x i32], ptr %b, i64 0, i64 1 %.pre49 = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 %sub = sub nsw i32 %.pre49, %.pre %cmp639 = icmp sgt i32 %1, 1 br i1 %cmp639, label %for.body7.preheader, label %for.end24 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end24.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %3, -2 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv46 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next47.1, %for.body7 ] %min.042 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %min.1.1, %for.body7 ] %max.041 = phi i32 [ %sub, %for.body7.preheader.new ], [ %spec.select.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds [200000 x i32], ptr %b, i64 0, i64 %indvars.iv46 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %5, %min.042 %spec.select = call i32 @llvm.smax.i32(i32 %max.041, i32 %sub10) %min.1 = call i32 @llvm.smin.i32(i32 %min.042, i32 %5) %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1 %arrayidx9.1 = getelementptr inbounds [200000 x i32], ptr %b, i64 0, i64 %indvars.iv.next47 %6 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %6, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %sub10.1) %min.1.1 = call i32 @llvm.smin.i32(i32 %min.1, i32 %6) %indvars.iv.next47.1 = add nuw nsw i64 %indvars.iv46, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end24.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end24.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %indvars.iv46.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next47.1, %for.body7 ] %min.042.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %min.1.1, %for.body7 ] %max.041.unr = phi i32 [ %sub, %for.body7.preheader ], [ %spec.select.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end24, label %for.body7.epil for.body7.epil: ; preds = %for.end24.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds [200000 x i32], ptr %b, i64 0, i64 %indvars.iv46.unr %7 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %7, %min.042.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %max.041.unr, i32 %sub10.epil) br label %for.end24 for.end24: ; preds = %for.body7.epil, %for.end24.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %sub, %for.end ], [ %spec.select.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body7.epil ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <stdlib.h> #define N 200000 #define M 10*10*10*10*10*10*10*10*10 int max(int x,int y); int min(int x,int y); int main(){ int i,j,n; int R[N]; int minv; int maxv; scanf("%d",&n); if(n < 2 || n > N) exit(1); for(i=0;i<=n-1;i++){ scanf("%d",&R[i]); if(R[i] < 1 || R[i] > M) exit(2); } minv = R[0]; maxv = R[1]-R[0]; for(j=1;j<=n-1;j++){ maxv = max(maxv,R[j]-minv); minv = min(minv,R[j]); } printf("%d\n",maxv); return 0; } int max(int x,int y){ if(x>y) return x; else return y; } int min(int x,int y){ if(x<y) return x; else return y; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_314965/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_314965/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %R = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %R) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4 %1 = add i32 %0, -200001 %or.cond = icmp ult i32 %1, -199999 br i1 %or.cond, label %if.then, label %for.body if.then: ; preds = %entry call void @exit(i32 noundef 1) #7 unreachable for.cond: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp2.not.not = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp2.not.not, label %for.body, label %for.end, !llvm.loop !9 for.body: ; preds = %entry, %for.cond %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %5 = add i32 %4, -1000000001 %or.cond41 = icmp ult i32 %5, -1000000000 br i1 %or.cond41, label %if.then11, label %for.cond if.then11: ; preds = %for.body call void @exit(i32 noundef 2) #7 unreachable for.end: ; preds = %for.cond %.pre = load i32, ptr %R, align 16, !tbaa !5 %arrayidx14.phi.trans.insert = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 1 %.pre56 = load i32, ptr %arrayidx14.phi.trans.insert, align 4, !tbaa !5 %sub16 = sub nsw i32 %.pre56, %.pre %cmp19.not.not46 = icmp sgt i32 %2, 1 br i1 %cmp19.not.not46, label %for.body20.preheader, label %for.end30 for.body20.preheader: ; preds = %for.end %wide.trip.count = zext i32 %2 to i64 %6 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %6, 1 %7 = icmp eq i32 %2, 2 br i1 %7, label %for.end30.loopexit.unr-lcssa, label %for.body20.preheader.new for.body20.preheader.new: ; preds = %for.body20.preheader %unroll_iter = and i64 %6, -2 br label %for.body20 for.body20: ; preds = %for.body20, %for.body20.preheader.new %indvars.iv53 = phi i64 [ 1, %for.body20.preheader.new ], [ %indvars.iv.next54.1, %for.body20 ] %maxv.049 = phi i32 [ %sub16, %for.body20.preheader.new ], [ %x.y.i.1, %for.body20 ] %minv.048 = phi i32 [ %.pre, %for.body20.preheader.new ], [ %x.y.i42.1, %for.body20 ] %niter = phi i64 [ 0, %for.body20.preheader.new ], [ %niter.next.1, %for.body20 ] %arrayidx22 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv53 %8 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %sub23 = sub nsw i32 %8, %minv.048 %x.y.i = call i32 @llvm.smax.i32(i32 %maxv.049, i32 %sub23) %x.y.i42 = call i32 @llvm.smin.i32(i32 %minv.048, i32 %8) %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1 %arrayidx22.1 = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv.next54 %9 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5 %sub23.1 = sub nsw i32 %9, %x.y.i42 %x.y.i.1 = call i32 @llvm.smax.i32(i32 %x.y.i, i32 %sub23.1) %x.y.i42.1 = call i32 @llvm.smin.i32(i32 %x.y.i42, i32 %9) %indvars.iv.next54.1 = add nuw nsw i64 %indvars.iv53, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end30.loopexit.unr-lcssa, label %for.body20, !llvm.loop !11 for.end30.loopexit.unr-lcssa: ; preds = %for.body20, %for.body20.preheader %x.y.i.lcssa.ph = phi i32 [ undef, %for.body20.preheader ], [ %x.y.i.1, %for.body20 ] %indvars.iv53.unr = phi i64 [ 1, %for.body20.preheader ], [ %indvars.iv.next54.1, %for.body20 ] %maxv.049.unr = phi i32 [ %sub16, %for.body20.preheader ], [ %x.y.i.1, %for.body20 ] %minv.048.unr = phi i32 [ %.pre, %for.body20.preheader ], [ %x.y.i42.1, %for.body20 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end30, label %for.body20.epil for.body20.epil: ; preds = %for.end30.loopexit.unr-lcssa %arrayidx22.epil = getelementptr inbounds [200000 x i32], ptr %R, i64 0, i64 %indvars.iv53.unr %10 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !5 %sub23.epil = sub nsw i32 %10, %minv.048.unr %x.y.i.epil = call i32 @llvm.smax.i32(i32 %maxv.049.unr, i32 %sub23.epil) br label %for.end30 for.end30: ; preds = %for.body20.epil, %for.end30.loopexit.unr-lcssa, %for.end %maxv.0.lcssa = phi i32 [ %sub16, %for.end ], [ %x.y.i.lcssa.ph, %for.end30.loopexit.unr-lcssa ], [ %x.y.i.epil, %for.body20.epil ] %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %maxv.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %R) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: noreturn nounwind declare void @exit(i32 noundef) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #4 { entry: %x.y = tail call i32 @llvm.smax.i32(i32 %x, i32 %y) ret i32 %x.y } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @min(i32 noundef %x, i32 noundef %y) local_unnamed_addr #4 { entry: %x.y = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %x.y } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #5 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 = { noreturn 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 #4 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } attributes #7 = { noreturn 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> #define N 2000000 int main(void){ int i,max=-1000000000; int min; int n,R[N]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&R[i]); } min = R[0]; for(i=1;i<n;i++){ if(R[i] - min > max) max = R[i] - min; if(R[i] < min) min = R[i]; } printf("%d\n",max); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315007/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315007/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %R = alloca [2000000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8000000, ptr nonnull %R) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp34 = icmp sgt i32 %0, 0 br i1 %cmp34, label %for.body, label %for.end21 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [2000000 x i32], ptr %R, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp436 = icmp sgt i32 %1, 1 br i1 %cmp436, label %for.body5.preheader, label %for.end21 for.body5.preheader: ; preds = %for.end %.pre = load i32, ptr %R, align 16, !tbaa !5 %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end21.loopexit.unr-lcssa, label %for.body5.preheader.new for.body5.preheader.new: ; preds = %for.body5.preheader %unroll_iter = and i64 %3, -2 br label %for.body5 for.body5: ; preds = %for.body5, %for.body5.preheader.new %indvars.iv43 = phi i64 [ 1, %for.body5.preheader.new ], [ %indvars.iv.next44.1, %for.body5 ] %min.039 = phi i32 [ %.pre, %for.body5.preheader.new ], [ %min.1.1, %for.body5 ] %max.038 = phi i32 [ -1000000000, %for.body5.preheader.new ], [ %spec.select.1, %for.body5 ] %niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ] %arrayidx7 = getelementptr inbounds [2000000 x i32], ptr %R, i64 0, i64 %indvars.iv43 %5 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %sub = sub nsw i32 %5, %min.039 %spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 %max.038) %min.1 = call i32 @llvm.smin.i32(i32 %5, i32 %min.039) %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %arrayidx7.1 = getelementptr inbounds [2000000 x i32], ptr %R, i64 0, i64 %indvars.iv.next44 %6 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5 %sub.1 = sub nsw i32 %6, %min.1 %spec.select.1 = call i32 @llvm.smax.i32(i32 %sub.1, i32 %spec.select) %min.1.1 = call i32 @llvm.smin.i32(i32 %6, i32 %min.1) %indvars.iv.next44.1 = add nuw nsw i64 %indvars.iv43, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end21.loopexit.unr-lcssa, label %for.body5, !llvm.loop !11 for.end21.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body5.preheader ], [ %spec.select.1, %for.body5 ] %indvars.iv43.unr = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next44.1, %for.body5 ] %min.039.unr = phi i32 [ %.pre, %for.body5.preheader ], [ %min.1.1, %for.body5 ] %max.038.unr = phi i32 [ -1000000000, %for.body5.preheader ], [ %spec.select.1, %for.body5 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end21, label %for.body5.epil for.body5.epil: ; preds = %for.end21.loopexit.unr-lcssa %arrayidx7.epil = getelementptr inbounds [2000000 x i32], ptr %R, i64 0, i64 %indvars.iv43.unr %7 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5 %sub.epil = sub nsw i32 %7, %min.039.unr %spec.select.epil = call i32 @llvm.smax.i32(i32 %sub.epil, i32 %max.038.unr) br label %for.end21 for.end21: ; preds = %for.body5.epil, %for.end21.loopexit.unr-lcssa, %entry, %for.end %max.0.lcssa = phi i32 [ -1000000000, %for.end ], [ -1000000000, %entry ], [ %spec.select.lcssa.ph, %for.end21.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body5.epil ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 8000000, ptr nonnull %R) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include<stdio.h> #define M 200000 int main(){ int i,n,min,max; int I[M]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&I[i]); } min=I[0]; max=I[1]-I[0]; for(i=1;i<n;++i){ max=(max<(I[i]-min))?(I[i]-min) : max; min=(min>I[i])?I[i] : min; } printf("%d\n",max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315050/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315050/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %I = alloca [200000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %I) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp41 = icmp sgt i32 %0, 0 call void @llvm.assume(i1 %cmp41) br label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200000 x i32], ptr %I, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %.pre = load i32, ptr %I, align 16, !tbaa !5 %arrayidx3.phi.trans.insert = getelementptr inbounds [200000 x i32], ptr %I, i64 0, i64 1 %.pre53 = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 %sub = sub nsw i32 %.pre53, %.pre %cmp643 = icmp sgt i32 %1, 1 br i1 %cmp643, label %for.body7.preheader, label %for.end26 for.body7.preheader: ; preds = %for.end %wide.trip.count = zext i32 %1 to i64 %3 = add nsw i64 %wide.trip.count, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i32 %1, 2 br i1 %4, label %for.end26.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %3, -2 br label %for.body7 for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv50 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next51.1, %for.body7 ] %max.046 = phi i32 [ %sub, %for.body7.preheader.new ], [ %sub10.max.0.1, %for.body7 ] %min.045 = phi i32 [ %.pre, %for.body7.preheader.new ], [ %cond23.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %arrayidx9 = getelementptr inbounds [200000 x i32], ptr %I, i64 0, i64 %indvars.iv50 %5 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %sub10 = sub nsw i32 %5, %min.045 %sub10.max.0 = call i32 @llvm.smax.i32(i32 %max.046, i32 %sub10) %cond23 = call i32 @llvm.smin.i32(i32 %min.045, i32 %5) %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %arrayidx9.1 = getelementptr inbounds [200000 x i32], ptr %I, i64 0, i64 %indvars.iv.next51 %6 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5 %sub10.1 = sub nsw i32 %6, %cond23 %sub10.max.0.1 = call i32 @llvm.smax.i32(i32 %sub10.max.0, i32 %sub10.1) %cond23.1 = call i32 @llvm.smin.i32(i32 %cond23, i32 %6) %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.end26.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 for.end26.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %sub10.max.0.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %sub10.max.0.1, %for.body7 ] %indvars.iv50.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next51.1, %for.body7 ] %max.046.unr = phi i32 [ %sub, %for.body7.preheader ], [ %sub10.max.0.1, %for.body7 ] %min.045.unr = phi i32 [ %.pre, %for.body7.preheader ], [ %cond23.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end26, label %for.body7.epil for.body7.epil: ; preds = %for.end26.loopexit.unr-lcssa %arrayidx9.epil = getelementptr inbounds [200000 x i32], ptr %I, i64 0, i64 %indvars.iv50.unr %7 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5 %sub10.epil = sub nsw i32 %7, %min.045.unr %sub10.max.0.epil = call i32 @llvm.smax.i32(i32 %max.046.unr, i32 %sub10.epil) br label %for.end26 for.end26: ; preds = %for.body7.epil, %for.end26.loopexit.unr-lcssa, %for.end %max.0.lcssa = phi i32 [ %sub, %for.end ], [ %sub10.max.0.lcssa.ph, %for.end26.loopexit.unr-lcssa ], [ %sub10.max.0.epil, %for.body7.epil ] %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %max.0.lcssa) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %I) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) declare void @llvm.assume(i1 noundef) #4 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <stdlib.h> #define int long long #define inf (int)(1e18) /*int can_achieve(int k, int *a, int N){ int i, sum = 0; for(i = 0; i < N; i++){ sum += (a[i] + k + 1) / (N + 1); } if(sum <= k){ return 1; } else{ return 0; } } int main(){ int N, i; scanf("%lld", &N); int *a = (int *)malloc(sizeof(int) * N); for(i = 0; i < N; i++){ scanf("%lld", &a[i]); } int l = 0, r = inf, h; while(r - l > 1){ h = (l + r) / 2; if(can_achieve(h, a, N) == 1){ r = h; } else{ l = h; } } printf("%lld\n", r); return 0; }*/ signed main(){ int N, i, j, s, K = 0, f; scanf("%lld", &N); int *a = (int *)malloc(sizeof(int) * N); for(i = 0; i < N; i++){ scanf("%lld", &a[i]); } for(i = 0; ; i = (i + 1) % N){ s = a[i] / N; K += s; a[i] -= s * (N + 1); f = 0; for(j = 0; j < N; j++){ a[j] += s; if(a[j] >= N){ f = 1; } } if(f == 0){ printf("%lld\n", K); return 0; } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315094/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315094/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i64, ptr %N, align 8, !tbaa !5 %mul = shl i64 %0, 3 %call1 = call noalias ptr @malloc(i64 noundef %mul) #5 %cmp39 = icmp sgt i64 %0, 0 br i1 %cmp39, label %for.body, label %for.cond3.preheader.thread for.cond3.preheader.thread: ; preds = %entry %add5.neg53 = xor i64 %0, -1 br label %for.cond3.preheader.split for.cond3.preheader: ; preds = %for.body %add5.neg = xor i64 %14, -1 %cmp941 = icmp sgt i64 %14, 0 br i1 %cmp941, label %for.cond3.us.preheader, label %for.cond3.preheader.split for.cond3.us.preheader: ; preds = %for.cond3.preheader %min.iters.check = icmp ult i64 %14, 4 %n.vec = and i64 %14, -4 %broadcast.splatinsert59 = insertelement <2 x i64> poison, i64 %14, i64 0 %broadcast.splat60 = shufflevector <2 x i64> %broadcast.splatinsert59, <2 x i64> poison, <2 x i32> zeroinitializer %cmp.n = icmp eq i64 %14, %n.vec br label %for.cond3.us for.cond3.us: ; preds = %for.cond3.us.preheader, %for.inc22.us %K.0.us = phi i64 [ %add.us, %for.inc22.us ], [ 0, %for.cond3.us.preheader ] %i.1.us = phi i64 [ %rem.us, %for.inc22.us ], [ 0, %for.cond3.us.preheader ] %arrayidx4.us = getelementptr inbounds i64, ptr %call1, i64 %i.1.us %1 = load i64, ptr %arrayidx4.us, align 8, !tbaa !5 %div.us = sdiv i64 %1, %14 %mul6.neg.us = mul i64 %div.us, %add5.neg %sub.us = add i64 %mul6.neg.us, %1 store i64 %sub.us, ptr %arrayidx4.us, align 8, !tbaa !5 br i1 %min.iters.check, label %for.body10.us.preheader, label %vector.ph vector.ph: ; preds = %for.cond3.us %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %div.us, i64 0 %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %vec.phi57 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ] %2 = getelementptr inbounds i64, ptr %call1, i64 %index %wide.load = load <2 x i64>, ptr %2, align 8, !tbaa !5 %3 = getelementptr inbounds i64, ptr %2, i64 2 %wide.load58 = load <2 x i64>, ptr %3, align 8, !tbaa !5 %4 = add nsw <2 x i64> %wide.load, %broadcast.splat %5 = add nsw <2 x i64> %wide.load58, %broadcast.splat store <2 x i64> %4, ptr %2, align 8, !tbaa !5 store <2 x i64> %5, ptr %3, align 8, !tbaa !5 %6 = icmp slt <2 x i64> %4, %broadcast.splat60 %7 = icmp slt <2 x i64> %5, %broadcast.splat60 %8 = select <2 x i1> %6, <2 x i64> %vec.phi, <2 x i64> <i64 1, i64 1> %9 = select <2 x i1> %7, <2 x i64> %vec.phi57, <2 x i64> <i64 1, i64 1> %index.next = add nuw i64 %index, 4 %10 = icmp eq i64 %index.next, %n.vec br i1 %10, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %rdx.select.cmp.not = icmp ne <2 x i64> %8, zeroinitializer %rdx.select.cmp6163 = icmp ne <2 x i64> %9, zeroinitializer %rdx.select.cmp61 = select <2 x i1> %rdx.select.cmp.not, <2 x i1> <i1 true, i1 true>, <2 x i1> %rdx.select.cmp6163 %11 = bitcast <2 x i1> %rdx.select.cmp61 to i2 %.not = icmp ne i2 %11, 0 %rdx.select62 = zext i1 %.not to i64 br i1 %cmp.n, label %for.cond8.for.end17_crit_edge.us, label %for.body10.us.preheader for.body10.us.preheader: ; preds = %for.cond3.us, %middle.block %f.043.us.ph = phi i64 [ 0, %for.cond3.us ], [ %rdx.select62, %middle.block ] %j.042.us.ph = phi i64 [ 0, %for.cond3.us ], [ %n.vec, %middle.block ] br label %for.body10.us for.inc22.us: ; preds = %for.cond8.for.end17_crit_edge.us %add23.us = add nsw i64 %i.1.us, 1 %rem.us = srem i64 %add23.us, %14 br label %for.cond3.us for.body10.us: ; preds = %for.body10.us.preheader, %for.body10.us %f.043.us = phi i64 [ %spec.select.us, %for.body10.us ], [ %f.043.us.ph, %for.body10.us.preheader ] %j.042.us = phi i64 [ %inc16.us, %for.body10.us ], [ %j.042.us.ph, %for.body10.us.preheader ] %arrayidx11.us = getelementptr inbounds i64, ptr %call1, i64 %j.042.us %12 = load i64, ptr %arrayidx11.us, align 8, !tbaa !5 %add12.us = add nsw i64 %12, %div.us store i64 %add12.us, ptr %arrayidx11.us, align 8, !tbaa !5 %cmp14.not.us = icmp slt i64 %add12.us, %14 %spec.select.us = select i1 %cmp14.not.us, i64 %f.043.us, i64 1 %inc16.us = add nuw nsw i64 %j.042.us, 1 %exitcond.not = icmp eq i64 %inc16.us, %14 br i1 %exitcond.not, label %for.cond8.for.end17_crit_edge.us, label %for.body10.us, !llvm.loop !13 for.cond8.for.end17_crit_edge.us: ; preds = %for.body10.us, %middle.block %spec.select.us.lcssa = phi i64 [ %rdx.select62, %middle.block ], [ %spec.select.us, %for.body10.us ] %add.us = add nsw i64 %div.us, %K.0.us %cmp18.us = icmp eq i64 %spec.select.us.lcssa, 0 br i1 %cmp18.us, label %if.then19, label %for.inc22.us for.cond3.preheader.split: ; preds = %for.cond3.preheader.thread, %for.cond3.preheader %add5.neg56 = phi i64 [ %add5.neg53, %for.cond3.preheader.thread ], [ %add5.neg, %for.cond3.preheader ] %.lcssa55 = phi i64 [ %0, %for.cond3.preheader.thread ], [ %14, %for.cond3.preheader ] %13 = load i64, ptr %call1, align 8, !tbaa !5 %div45 = sdiv i64 %13, %.lcssa55 %mul6.neg46 = mul i64 %div45, %add5.neg56 %sub47 = add i64 %mul6.neg46, %13 store i64 %sub47, ptr %call1, align 8, !tbaa !5 br label %if.then19 for.body: ; preds = %entry, %for.body %i.040 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i64, ptr %call1, i64 %i.040 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %inc = add nuw nsw i64 %i.040, 1 %14 = load i64, ptr %N, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %14 br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !14 if.then19: ; preds = %for.cond8.for.end17_crit_edge.us, %for.cond3.preheader.split %.us-phi = phi i64 [ %div45, %for.cond3.preheader.split ], [ %add.us, %for.cond8.for.end17_crit_edge.us ] %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.us-phi) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 #4 = { nounwind } attributes #5 = { nounwind allocsize(0) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10, !12, !11} !14 = distinct !{!14, !10}
#include<stdio.h> int main(){ int a, b, c, k; scanf("%d %d %d %d", &a, &b, &c, &k); if(a >= k){ printf("%d\n", k); } else if(a+b >= k){ printf("%d\n", a); } else { printf("%d\n", a-(k-(a+b))); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315137/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315137/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %k) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %k, align 4, !tbaa !5 %cmp.not = icmp slt i32 %0, %1 br i1 %cmp.not, label %if.else, label %if.end9 if.else: ; preds = %entry %2 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %2, %0 %cmp2.not = icmp slt i32 %add, %1 br i1 %cmp2.not, label %if.else5, label %if.end9 if.else5: ; preds = %if.else %sub.neg = sub i32 %0, %1 %sub7 = add i32 %sub.neg, %add br label %if.end9 if.end9: ; preds = %if.else, %entry, %if.else5 %.sink = phi i32 [ %sub7, %if.else5 ], [ %1, %entry ], [ %0, %if.else ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #define max(p,q)((p)>(q)?(p):(q)) #define min(p,q)((p)<(q)?(p):(q)) int main(){ int a,b,c,k; scanf("%d%d%d%d",&a,&b,&c,&k); printf("%d",1*min(a,k)+0*min(b,max(0,k-a))+(-1)*min(c,max(0,k-a-b))); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315180/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315180/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %k) %0 = load i32, ptr %a, align 4 %1 = load i32, ptr %k, align 4 %2 = load i32, ptr %c, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %4 = add i32 %0, %3 %sub21 = sub i32 %1, %4 %cond28 = call i32 @llvm.smax.i32(i32 %sub21, i32 0) %spec.select = call i32 @llvm.smin.i32(i32 %2, i32 %cond28) %cond = call i32 @llvm.smin.i32(i32 %0, i32 %1) %add44 = sub i32 %cond, %spec.select %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add44) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int a, b, c, k; scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); scanf("%d", &k); if(k <= a){ printf("%d\n", k); } else if(k <= (a + b)){ printf("%d\n", a); } else{ printf("%d\n", a-(k-a-b)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315223/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315223/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %0, %1 br i1 %cmp.not, label %if.else, label %if.end12 if.else: ; preds = %entry %2 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp5.not = icmp sgt i32 %0, %add br i1 %cmp5.not, label %if.else8, label %if.end12 if.else8: ; preds = %if.else %sub9.neg = sub i32 %1, %0 %sub10 = add i32 %sub9.neg, %add br label %if.end12 if.end12: ; preds = %if.else, %entry, %if.else8 %.sink = phi i32 [ %sub10, %if.else8 ], [ %0, %entry ], [ %1, %if.else ] %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { long long int a,b,c,k,ans; scanf("%lld%lld%lld%lld",&a,&b,&c,&k); if(a>=k) ans=k; else if(a<k&&a+b>=k) ans=a; else if(a+b<k) ans=a-(k-a-b); printf("%lld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315267/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315267/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %k) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %k, align 8, !tbaa !5 %cmp.not = icmp slt i64 %0, %1 br i1 %cmp.not, label %land.lhs.true, label %if.end11 land.lhs.true: ; preds = %entry %2 = load i64, ptr %b, align 8, !tbaa !5 %add = add nsw i64 %2, %0 %cmp2.not = icmp slt i64 %add, %1 br i1 %cmp2.not, label %if.else4, label %if.end11 if.else4: ; preds = %land.lhs.true %sub8.neg = sub i64 %0, %1 %sub9 = add i64 %sub8.neg, %add br label %if.end11 if.end11: ; preds = %land.lhs.true, %entry, %if.else4 %ans.0 = phi i64 [ %sub9, %if.else4 ], [ %1, %entry ], [ %0, %land.lhs.true ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> int main() { int x1,x2,y1,y2; scanf("%d %d %d %d", &x1, &y1, &x2, &y2); int d; if(x1==x2) { d = y1 - y2; if(d<0) d = -1*d; printf("%d %d %d %d", x1+d, y1, x2+d, y2); } else if(y1 == y2) { d = x1 - x2; if(d<0) d = -1*d; printf("%d %d %d %d", x1, y1+d, x2, y2+d); } else if(abs(x2-x1) == abs(y2-y1)) { printf("%d %d %d %d", x1, y2, x2, y1); } else { printf("-1"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_31531/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_31531/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x1 = alloca i32, align 4 %x2 = alloca i32, align 4 %y1 = alloca i32, align 4 %y2 = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2) %0 = load i32, ptr %x1, align 4, !tbaa !5 %1 = load i32, ptr %x2, align 4, !tbaa !5 %cmp = icmp eq i32 %0, %1 %2 = load i32, ptr %y1, align 4, !tbaa !5 %3 = load i32, ptr %y2, align 4, !tbaa !5 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %sub = sub nsw i32 %2, %3 %spec.select = call i32 @llvm.abs.i32(i32 %sub, i1 true) %add = add nsw i32 %spec.select, %0 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add, i32 noundef %2, i32 noundef %add, i32 noundef %3) br label %if.end25 if.else: ; preds = %entry %cmp5 = icmp eq i32 %2, %3 br i1 %cmp5, label %if.then6, label %if.else15 if.then6: ; preds = %if.else %sub7 = sub nsw i32 %0, %1 %spec.select36 = call i32 @llvm.abs.i32(i32 %sub7, i1 true) %add12 = add nsw i32 %2, %spec.select36 %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0, i32 noundef %add12, i32 noundef %1, i32 noundef %add12) br label %if.end25 if.else15: ; preds = %if.else %sub16 = sub nsw i32 %1, %0 %4 = call i32 @llvm.abs.i32(i32 %sub16, i1 true) %sub17 = sub nsw i32 %3, %2 %5 = call i32 @llvm.abs.i32(i32 %sub17, i1 true) %cmp18 = icmp eq i32 %4, %5 br i1 %cmp18, label %if.then19, label %if.else21 if.then19: ; preds = %if.else15 %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0, i32 noundef %3, i32 noundef %1, i32 noundef %2) br label %if.end25 if.else21: ; preds = %if.else15 %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1) br label %if.end25 if.end25: ; preds = %if.then6, %if.else21, %if.then19, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(){ int A,B,C,K; int totyu=0; int sai=0; scanf("%d %d %d %d",&A,&B,&C,&K); if(A-K>=0){ printf("%d\n",K); }else{ if(A+B-K>=0){ printf("%d\n",A); }else{ totyu = K-A-B; sai = A - totyu; //printf("%d\n",totyu); printf("%d\n",sai); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315353/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315353/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 %C = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %K) %0 = load i32, ptr %A, align 4, !tbaa !5 %1 = load i32, ptr %K, align 4, !tbaa !5 %cmp.not = icmp slt i32 %0, %1 br i1 %cmp.not, label %if.else, label %if.end11 if.else: ; preds = %entry %2 = load i32, ptr %B, align 4, !tbaa !5 %add = add nsw i32 %2, %0 %cmp3.not = icmp slt i32 %add, %1 br i1 %cmp3.not, label %if.else6, label %if.end11 if.else6: ; preds = %if.else %sub8.neg = sub i32 %0, %1 %sub9 = add i32 %sub8.neg, %add br label %if.end11 if.end11: ; preds = %if.else, %entry, %if.else6 %.sink = phi i32 [ %sub9, %if.else6 ], [ %1, %entry ], [ %0, %if.else ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main() { int A,B,C,K,sum; scanf("%d %d %d %d",&A,&B,&C,&K); if (K <= A){ sum = K; }else if(K > A && K <= A + B){ sum = A; }else{ sum = A - (K - A - B); } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315397/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315397/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 %C = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %K) %0 = load i32, ptr %K, align 4, !tbaa !5 %1 = load i32, ptr %A, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %0, %1 br i1 %cmp.not, label %land.lhs.true, label %if.end7 land.lhs.true: ; preds = %entry %2 = load i32, ptr %B, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp2.not = icmp sgt i32 %0, %add br i1 %cmp2.not, label %if.else4, label %if.end7 if.else4: ; preds = %land.lhs.true %sub5.neg = sub i32 %1, %0 %sub6 = add i32 %sub5.neg, %add br label %if.end7 if.end7: ; preds = %land.lhs.true, %entry, %if.else4 %sum.0 = phi i32 [ %sub6, %if.else4 ], [ %0, %entry ], [ %1, %land.lhs.true ] %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <string.h> int main() { int a,b,c,k; scanf("%d %d %d %d",&a,&b,&c,&k); if(k<=a){ printf("%d",k); } else if(k<=a+b){ printf("%d",a); } else{ printf("%d",a-(k-a-b)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315447/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315447/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %0, %1 br i1 %cmp.not, label %if.else, label %if.end9 if.else: ; preds = %entry %2 = load i32, ptr %b, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp2.not = icmp sgt i32 %0, %add br i1 %cmp2.not, label %if.else5, label %if.end9 if.else5: ; preds = %if.else %sub6.neg = sub i32 %1, %0 %sub7 = add i32 %sub6.neg, %add br label %if.end9 if.end9: ; preds = %if.else, %entry, %if.else5 %.sink = phi i32 [ %sub7, %if.else5 ], [ %0, %entry ], [ %1, %if.else ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { int A, B, C,K; scanf("%d", &A); scanf("%d", &B); scanf("%d", &C); scanf("%d", &K); if (K < A) printf("%d", K); else if (K <= A + B &&K>=A) printf("%d", A); else printf("%d",A - (K - A - B)); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315490/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315490/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 %C = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %B) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %C) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K) %0 = load i32, ptr %K, align 4, !tbaa !5 %1 = load i32, ptr %A, align 4, !tbaa !5 %cmp = icmp slt i32 %0, %1 br i1 %cmp, label %if.end13, label %if.else if.else: ; preds = %entry %2 = load i32, ptr %B, align 4, !tbaa !5 %add = add nsw i32 %2, %1 %cmp5.not = icmp sgt i32 %0, %add br i1 %cmp5.not, label %if.else9, label %if.end13 if.else9: ; preds = %if.else %sub10.neg = sub i32 %1, %0 %sub11 = add i32 %sub10.neg, %add br label %if.end13 if.end13: ; preds = %if.else, %entry, %if.else9 %.sink = phi i32 [ %sub11, %if.else9 ], [ %0, %entry ], [ %1, %if.else ] %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void){ long long int a,b,c,k; scanf("%lld %lld %lld %lld",&a,&b,&c,&k); if(k<=a){ printf("%lld",k); }else if(k<=a+b){ printf("%lld",a); }else{ printf("%lld",a-(k-a-b)); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315533/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315533/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %k) %0 = load i64, ptr %k, align 8, !tbaa !5 %1 = load i64, ptr %a, align 8, !tbaa !5 %cmp.not = icmp sgt i64 %0, %1 br i1 %cmp.not, label %if.else, label %if.end9 if.else: ; preds = %entry %2 = load i64, ptr %b, align 8, !tbaa !5 %add = add nsw i64 %2, %1 %cmp2.not = icmp sgt i64 %0, %add br i1 %cmp2.not, label %if.else5, label %if.end9 if.else5: ; preds = %if.else %sub6.neg = sub i64 %1, %0 %sub7 = add i64 %sub6.neg, %add br label %if.end9 if.end9: ; preds = %if.else, %entry, %if.else5 %.sink = phi i64 [ %sub7, %if.else5 ], [ %0, %entry ], [ %1, %if.else ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.sink) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> /* 1 チームの記録 */ typedef struct team { int no; int time; int score; } Team; /* チームの記録を入れ換える */ void swap(Team *a, Team *b){ Team c; c = *b; *b = *a; *a = c; } /* チームの順位を判定する (sort で使用, 入れ換えるか否かを返す) */ int compare(Team a, Team b){ if (a.score < b.score){ return 1; }else if (a.score > b.score){ return 0; } if (a.time > b.time){ return 1; }else if (a.time < b.time){ return 0; } if (a.no < b.no){ return 1; } return 0; } /* チームの順位を判定し並び替える */ void sort(Team *t, int length){ int i, j; for (i = 0; i < length - 1; i++){ for (j = 0; j < length - 1 - i; j++){ if (compare(t[j], t[j+1])){ swap(&t[j], &t[j+1]); } } } } int main(void){ int M, T, P, R; int m, t, p, j; Team teams[50]; int penalty_num[50][10]; int i, k; while (scanf("%d %d %d %d", &M, &T, &P, &R) == 4){ if (M == 0 && T == 0 && P == 0 && R == 0){ break; } /* 初期化 */ for (i = 0; i < T; i++){ teams[i].no = i + 1; teams[i].time = 0; teams[i].score = 0; for (k = 0; k < P; k++){ penalty_num[i][k] = 0; } } /* 解答提出ログを読み込む */ for (i = 0; i < R; i++){ scanf("%d %d %d %d", &m, &t, &p, &j); t--; p--; if (j != 0){ /* 不正解 */ penalty_num[t][p]++; /* 誤答回数を記録する */ continue; } /* 正解 */ /* 誤答回数 * 20 分をペナルティとして加算する */ teams[t].time += m + penalty_num[t][p] * 20; teams[t].score++; } /* 順位の高い順に並び替える */ sort(teams, T); /* 順位の高い順に出力する */ for (i = 0; i < T; i++){ printf("%d", teams[i].no); /* 区切り文字 */ if (i < T - 1){ if (teams[i].score == teams[i+1].score && teams[i].time == teams[i+1].time){ printf("="); /* 同順位 */ }else{ printf(","); } } } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315584/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315584/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" %struct.team = type { i32, i32, i32 } @.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 { entry: %c = alloca %struct.team, align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %c) call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %c, ptr noundef nonnull align 4 dereferenceable(12) %b, i64 12, i1 false), !tbaa.struct !5 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %b, ptr noundef nonnull align 4 dereferenceable(12) %a, i64 12, i1 false), !tbaa.struct !5 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %a, ptr noundef nonnull align 4 dereferenceable(12) %c, i64 12, i1 false), !tbaa.struct !5 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %c) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @compare(i64 %a.coerce0, i32 %a.coerce1, i64 %b.coerce0, i32 %b.coerce1) local_unnamed_addr #3 { entry: %a.sroa.0.0.extract.trunc = trunc i64 %a.coerce0 to i32 %a.sroa.2.0.extract.shift = lshr i64 %a.coerce0, 32 %a.sroa.2.0.extract.trunc = trunc i64 %a.sroa.2.0.extract.shift to i32 %b.sroa.0.0.extract.trunc = trunc i64 %b.coerce0 to i32 %b.sroa.2.0.extract.shift = lshr i64 %b.coerce0, 32 %b.sroa.2.0.extract.trunc = trunc i64 %b.sroa.2.0.extract.shift to i32 %cmp = icmp slt i32 %a.coerce1, %b.coerce1 br i1 %cmp, label %return, label %if.else if.else: ; preds = %entry %cmp5 = icmp sgt i32 %a.coerce1, %b.coerce1 br i1 %cmp5, label %return, label %if.end7 if.end7: ; preds = %if.else %cmp9 = icmp sgt i32 %a.sroa.2.0.extract.trunc, %b.sroa.2.0.extract.trunc br i1 %cmp9, label %return, label %if.else11 if.else11: ; preds = %if.end7 %cmp14 = icmp slt i32 %a.sroa.2.0.extract.trunc, %b.sroa.2.0.extract.trunc br i1 %cmp14, label %return, label %if.end17 if.end17: ; preds = %if.else11 %cmp19 = icmp slt i32 %a.sroa.0.0.extract.trunc, %b.sroa.0.0.extract.trunc %. = zext i1 %cmp19 to i32 br label %return return: ; preds = %if.end17, %if.else11, %if.end7, %if.else, %entry %retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %if.end7 ], [ 0, %if.else11 ], [ %., %if.end17 ] ret i32 %retval.0 } ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @sort(ptr nocapture noundef %t, i32 noundef %length) local_unnamed_addr #4 { entry: %c.i = alloca %struct.team, align 4 %sub = add i32 %length, -1 %cmp35 = icmp sgt i32 %length, 1 br i1 %cmp35, label %for.cond1.preheader, label %for.end15 for.cond1.preheader: ; preds = %entry, %for.inc13 %indvars.iv38 = phi i32 [ %indvars.iv.next39, %for.inc13 ], [ %sub, %entry ] %i.036 = phi i32 [ %inc14, %for.inc13 ], [ 0, %entry ] %cmp433 = icmp sgt i32 %sub, %i.036 br i1 %cmp433, label %for.body5.preheader, label %for.inc13 for.body5.preheader: ; preds = %for.cond1.preheader %wide.trip.count = zext i32 %indvars.iv38 to i64 br label %for.body5 for.body5: ; preds = %for.body5.preheader, %for.inc %indvars.iv = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next, %for.inc ] %arrayidx = getelementptr inbounds %struct.team, ptr %t, i64 %indvars.iv %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx7 = getelementptr inbounds %struct.team, ptr %t, i64 %indvars.iv.next %arrayidx.coerce.sroa.0.0.copyload = load i64, ptr %arrayidx, align 4 %arrayidx.coerce.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8 %arrayidx.coerce.sroa.2.0.copyload = load i32, ptr %arrayidx.coerce.sroa.2.0.arrayidx.sroa_idx, align 4 %arrayidx7.coerce.sroa.0.0.copyload = load i64, ptr %arrayidx7, align 4 %arrayidx7.coerce.sroa.2.0.arrayidx7.sroa_idx = getelementptr inbounds i8, ptr %arrayidx7, i64 8 %arrayidx7.coerce.sroa.2.0.copyload = load i32, ptr %arrayidx7.coerce.sroa.2.0.arrayidx7.sroa_idx, align 4 %a.sroa.0.0.extract.trunc.i = trunc i64 %arrayidx.coerce.sroa.0.0.copyload to i32 %a.sroa.2.0.extract.shift.i = lshr i64 %arrayidx.coerce.sroa.0.0.copyload, 32 %a.sroa.2.0.extract.trunc.i = trunc i64 %a.sroa.2.0.extract.shift.i to i32 %b.sroa.0.0.extract.trunc.i = trunc i64 %arrayidx7.coerce.sroa.0.0.copyload to i32 %b.sroa.2.0.extract.shift.i = lshr i64 %arrayidx7.coerce.sroa.0.0.copyload, 32 %b.sroa.2.0.extract.trunc.i = trunc i64 %b.sroa.2.0.extract.shift.i to i32 %cmp.i = icmp slt i32 %arrayidx.coerce.sroa.2.0.copyload, %arrayidx7.coerce.sroa.2.0.copyload br i1 %cmp.i, label %if.then, label %if.else.i if.else.i: ; preds = %for.body5 %cmp5.i = icmp sgt i32 %arrayidx.coerce.sroa.2.0.copyload, %arrayidx7.coerce.sroa.2.0.copyload br i1 %cmp5.i, label %for.inc, label %if.end7.i if.end7.i: ; preds = %if.else.i %cmp9.i = icmp sgt i32 %a.sroa.2.0.extract.trunc.i, %b.sroa.2.0.extract.trunc.i br i1 %cmp9.i, label %if.then, label %if.else11.i if.else11.i: ; preds = %if.end7.i %cmp14.i = icmp sge i32 %a.sroa.2.0.extract.trunc.i, %b.sroa.2.0.extract.trunc.i %cmp19.i.not = icmp slt i32 %a.sroa.0.0.extract.trunc.i, %b.sroa.0.0.extract.trunc.i %or.cond = select i1 %cmp14.i, i1 %cmp19.i.not, i1 false br i1 %or.cond, label %if.then, label %for.inc if.then: ; preds = %if.else11.i, %if.end7.i, %for.body5 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %c.i) call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %c.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx7, i64 12, i1 false), !tbaa.struct !5 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx7, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false), !tbaa.struct !5 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, ptr noundef nonnull align 4 dereferenceable(12) %c.i, i64 12, i1 false), !tbaa.struct !5 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %c.i) br label %for.inc for.inc: ; preds = %if.else11.i, %if.else.i, %if.then %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.inc13, label %for.body5, !llvm.loop !10 for.inc13: ; preds = %for.inc, %for.cond1.preheader %inc14 = add nuw nsw i32 %i.036, 1 %indvars.iv.next39 = add i32 %indvars.iv38, -1 %exitcond40.not = icmp eq i32 %inc14, %sub br i1 %exitcond40.not, label %for.end15, label %for.cond1.preheader, !llvm.loop !12 for.end15: ; preds = %for.inc13, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #5 { entry: %c.i.i = alloca %struct.team, align 4 %M = alloca i32, align 4 %T = alloca i32, align 4 %P = alloca i32, align 4 %R = alloca i32, align 4 %m = alloca i32, align 4 %t = alloca i32, align 4 %p = alloca i32, align 4 %j = alloca i32, align 4 %teams = alloca [50 x %struct.team], align 16 %penalty_num = alloca [50 x [10 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %P) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %R) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j) #9 call void @llvm.lifetime.start.p0(i64 600, ptr nonnull %teams) #9 call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %penalty_num) #9 %call116 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M, ptr noundef nonnull %T, ptr noundef nonnull %P, ptr noundef nonnull %R) %cmp117 = icmp eq i32 %call116, 4 br i1 %cmp117, label %while.body, label %while.end while.body: ; preds = %entry, %for.end84 %0 = load i32, ptr %M, align 4, !tbaa !6 %cmp1 = icmp eq i32 %0, 0 %1 = load i32, ptr %T, align 4 %cmp2 = icmp eq i32 %1, 0 %or.cond = select i1 %cmp1, i1 %cmp2, i1 false %2 = load i32, ptr %P, align 4 %cmp4 = icmp eq i32 %2, 0 %or.cond86 = select i1 %or.cond, i1 %cmp4, i1 false %3 = load i32, ptr %R, align 4 %cmp6 = icmp eq i32 %3, 0 %or.cond87 = select i1 %or.cond86, i1 %cmp6, i1 false br i1 %or.cond87, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %while.body %cmp7110 = icmp sgt i32 %1, 0 br i1 %cmp7110, label %for.body.lr.ph, label %for.cond22.preheader for.body.lr.ph: ; preds = %for.cond.preheader %cmp13108 = icmp sgt i32 %2, 0 %4 = zext i32 %2 to i64 %5 = shl nuw nsw i64 %4, 2 %wide.trip.count = zext i32 %1 to i64 br label %for.body for.cond.loopexit: ; preds = %for.body14.preheader, %for.body %exitcond.not = icmp eq i64 %indvar.next, %wide.trip.count br i1 %exitcond.not, label %for.cond22.preheader, label %for.body, !llvm.loop !13 for.cond22.preheader: ; preds = %for.cond.loopexit, %for.cond.preheader %cmp23112 = icmp sgt i32 %3, 0 br i1 %cmp23112, label %for.body24, label %for.end50 for.body: ; preds = %for.body.lr.ph, %for.cond.loopexit %indvar = phi i64 [ 0, %for.body.lr.ph ], [ %indvar.next, %for.cond.loopexit ] %indvar.next = add nuw nsw i64 %indvar, 1 %arrayidx = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %indvar %6 = trunc i64 %indvar.next to i32 store i32 %6, ptr %arrayidx, align 4, !tbaa !14 %time = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %indvar, i32 1 store i32 0, ptr %time, align 4, !tbaa !16 %score = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %indvar, i32 2 store i32 0, ptr %score, align 4, !tbaa !17 br i1 %cmp13108, label %for.body14.preheader, label %for.cond.loopexit for.body14.preheader: ; preds = %for.body %7 = mul nuw nsw i64 %indvar, 40 %scevgep = getelementptr i8, ptr %penalty_num, i64 %7 call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %5, i1 false), !tbaa !6 br label %for.cond.loopexit for.body24: ; preds = %for.cond22.preheader, %for.inc48 %i.1113 = phi i32 [ %inc49, %for.inc48 ], [ 0, %for.cond22.preheader ] %call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %t, ptr noundef nonnull %p, ptr noundef nonnull %j) %8 = load i32, ptr %t, align 4, !tbaa !6 %dec = add nsw i32 %8, -1 store i32 %dec, ptr %t, align 4, !tbaa !6 %9 = load i32, ptr %p, align 4, !tbaa !6 %dec26 = add nsw i32 %9, -1 store i32 %dec26, ptr %p, align 4, !tbaa !6 %10 = load i32, ptr %j, align 4, !tbaa !6 %cmp27.not = icmp eq i32 %10, 0 br i1 %cmp27.not, label %if.end34, label %if.then28 if.then28: ; preds = %for.body24 %idxprom29 = sext i32 %dec to i64 %idxprom31 = sext i32 %dec26 to i64 %arrayidx32 = getelementptr inbounds [50 x [10 x i32]], ptr %penalty_num, i64 0, i64 %idxprom29, i64 %idxprom31 br label %for.inc48 if.end34: ; preds = %for.body24 %11 = load i32, ptr %m, align 4, !tbaa !6 %idxprom35 = sext i32 %dec to i64 %idxprom37 = sext i32 %dec26 to i64 %arrayidx38 = getelementptr inbounds [50 x [10 x i32]], ptr %penalty_num, i64 0, i64 %idxprom35, i64 %idxprom37 %12 = load i32, ptr %arrayidx38, align 4, !tbaa !6 %mul = mul nsw i32 %12, 20 %add39 = add nsw i32 %mul, %11 %time42 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %idxprom35, i32 1 %13 = load i32, ptr %time42, align 4, !tbaa !16 %add43 = add nsw i32 %add39, %13 store i32 %add43, ptr %time42, align 4, !tbaa !16 %score46 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %idxprom35, i32 2 br label %for.inc48 for.inc48: ; preds = %if.end34, %if.then28 %score46.sink123 = phi ptr [ %score46, %if.end34 ], [ %arrayidx32, %if.then28 ] %14 = load i32, ptr %score46.sink123, align 4, !tbaa !6 %inc47 = add nsw i32 %14, 1 store i32 %inc47, ptr %score46.sink123, align 4, !tbaa !6 %inc49 = add nuw nsw i32 %i.1113, 1 %15 = load i32, ptr %R, align 4, !tbaa !6 %cmp23 = icmp slt i32 %inc49, %15 br i1 %cmp23, label %for.body24, label %for.end50.loopexit, !llvm.loop !18 for.end50.loopexit: ; preds = %for.inc48 %.pre = load i32, ptr %T, align 4, !tbaa !6 br label %for.end50 for.end50: ; preds = %for.end50.loopexit, %for.cond22.preheader %16 = phi i32 [ %.pre, %for.end50.loopexit ], [ %1, %for.cond22.preheader ] %sub.i = add i32 %16, -1 %cmp35.i = icmp sgt i32 %16, 1 br i1 %cmp35.i, label %for.cond1.preheader.i, label %sort.exit for.cond1.preheader.i: ; preds = %for.end50, %for.inc13.i %indvars.iv38.i = phi i32 [ %indvars.iv.next39.i, %for.inc13.i ], [ %sub.i, %for.end50 ] %i.036.i = phi i32 [ %inc14.i, %for.inc13.i ], [ 0, %for.end50 ] %cmp433.i = icmp sgt i32 %sub.i, %i.036.i br i1 %cmp433.i, label %for.body5.preheader.i, label %for.inc13.i for.body5.preheader.i: ; preds = %for.cond1.preheader.i %wide.trip.count.i = zext i32 %indvars.iv38.i to i64 br label %for.body5.i for.body5.i: ; preds = %for.inc.i, %for.body5.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body5.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ] %arrayidx.i = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv.i %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx7.i = getelementptr inbounds %struct.team, ptr %teams, i64 %indvars.iv.next.i %arrayidx.coerce.sroa.0.0.copyload.i = load i64, ptr %arrayidx.i, align 4 %arrayidx.coerce.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 8 %arrayidx.coerce.sroa.2.0.copyload.i = load i32, ptr %arrayidx.coerce.sroa.2.0.arrayidx.sroa_idx.i, align 4 %arrayidx7.coerce.sroa.0.0.copyload.i = load i64, ptr %arrayidx7.i, align 4 %arrayidx7.coerce.sroa.2.0.arrayidx7.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx7.i, i64 8 %arrayidx7.coerce.sroa.2.0.copyload.i = load i32, ptr %arrayidx7.coerce.sroa.2.0.arrayidx7.sroa_idx.i, align 4 %a.sroa.0.0.extract.trunc.i.i = trunc i64 %arrayidx.coerce.sroa.0.0.copyload.i to i32 %a.sroa.2.0.extract.shift.i.i = lshr i64 %arrayidx.coerce.sroa.0.0.copyload.i, 32 %a.sroa.2.0.extract.trunc.i.i = trunc i64 %a.sroa.2.0.extract.shift.i.i to i32 %b.sroa.0.0.extract.trunc.i.i = trunc i64 %arrayidx7.coerce.sroa.0.0.copyload.i to i32 %b.sroa.2.0.extract.shift.i.i = lshr i64 %arrayidx7.coerce.sroa.0.0.copyload.i, 32 %b.sroa.2.0.extract.trunc.i.i = trunc i64 %b.sroa.2.0.extract.shift.i.i to i32 %cmp.i.i = icmp slt i32 %arrayidx.coerce.sroa.2.0.copyload.i, %arrayidx7.coerce.sroa.2.0.copyload.i br i1 %cmp.i.i, label %if.then.i, label %if.else.i.i if.else.i.i: ; preds = %for.body5.i %cmp5.i.i = icmp sgt i32 %arrayidx.coerce.sroa.2.0.copyload.i, %arrayidx7.coerce.sroa.2.0.copyload.i br i1 %cmp5.i.i, label %for.inc.i, label %if.end7.i.i if.end7.i.i: ; preds = %if.else.i.i %cmp9.i.i = icmp sgt i32 %a.sroa.2.0.extract.trunc.i.i, %b.sroa.2.0.extract.trunc.i.i br i1 %cmp9.i.i, label %if.then.i, label %if.else11.i.i if.else11.i.i: ; preds = %if.end7.i.i %cmp14.i.i = icmp sge i32 %a.sroa.2.0.extract.trunc.i.i, %b.sroa.2.0.extract.trunc.i.i %cmp19.i.not.i = icmp slt i32 %a.sroa.0.0.extract.trunc.i.i, %b.sroa.0.0.extract.trunc.i.i %or.cond.i = select i1 %cmp14.i.i, i1 %cmp19.i.not.i, i1 false br i1 %or.cond.i, label %if.then.i, label %for.inc.i if.then.i: ; preds = %if.else11.i.i, %if.end7.i.i, %for.body5.i call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %c.i.i) call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %c.i.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx7.i, i64 12, i1 false), !tbaa.struct !5 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx7.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i, i64 12, i1 false), !tbaa.struct !5 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i, ptr noundef nonnull align 4 dereferenceable(12) %c.i.i, i64 12, i1 false), !tbaa.struct !5 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %c.i.i) br label %for.inc.i for.inc.i: ; preds = %if.then.i, %if.else11.i.i, %if.else.i.i %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i br i1 %exitcond.not.i, label %for.inc13.i, label %for.body5.i, !llvm.loop !10 for.inc13.i: ; preds = %for.inc.i, %for.cond1.preheader.i %inc14.i = add nuw nsw i32 %i.036.i, 1 %indvars.iv.next39.i = add i32 %indvars.iv38.i, -1 %exitcond40.not.i = icmp eq i32 %inc14.i, %sub.i br i1 %exitcond40.not.i, label %sort.exit, label %for.cond1.preheader.i, !llvm.loop !12 sort.exit: ; preds = %for.inc13.i, %for.end50 %cmp52114 = icmp sgt i32 %16, 0 br i1 %cmp52114, label %for.body53, label %for.end84 for.body53: ; preds = %sort.exit, %for.inc82 %indvars.iv = phi i64 [ %indvars.iv.next.pre-phi, %for.inc82 ], [ 0, %sort.exit ] %arrayidx55 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %indvars.iv %17 = load i32, ptr %arrayidx55, align 4, !tbaa !14 %call57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17) %18 = load i32, ptr %T, align 4, !tbaa !6 %sub = add nsw i32 %18, -1 %19 = sext i32 %sub to i64 %cmp58 = icmp slt i64 %indvars.iv, %19 br i1 %cmp58, label %if.then59, label %for.body53.for.inc82_crit_edge for.body53.for.inc82_crit_edge: ; preds = %for.body53 %.pre122 = add nuw nsw i64 %indvars.iv, 1 br label %for.inc82 if.then59: ; preds = %for.body53 %score62 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %indvars.iv, i32 2 %20 = load i32, ptr %score62, align 4, !tbaa !17 %21 = add nuw nsw i64 %indvars.iv, 1 %score66 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %21, i32 2 %22 = load i32, ptr %score66, align 4, !tbaa !17 %cmp67 = icmp eq i32 %20, %22 br i1 %cmp67, label %land.lhs.true68, label %if.else land.lhs.true68: ; preds = %if.then59 %time71 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %indvars.iv, i32 1 %23 = load i32, ptr %time71, align 4, !tbaa !16 %time75 = getelementptr inbounds [50 x %struct.team], ptr %teams, i64 0, i64 %21, i32 1 %24 = load i32, ptr %time75, align 4, !tbaa !16 %cmp76 = icmp eq i32 %23, %24 br i1 %cmp76, label %if.then77, label %if.else if.then77: ; preds = %land.lhs.true68 %putchar107 = call i32 @putchar(i32 61) br label %for.inc82 if.else: ; preds = %land.lhs.true68, %if.then59 %putchar106 = call i32 @putchar(i32 44) br label %for.inc82 for.inc82: ; preds = %for.body53.for.inc82_crit_edge, %if.else, %if.then77 %indvars.iv.next.pre-phi = phi i64 [ %.pre122, %for.body53.for.inc82_crit_edge ], [ %21, %if.else ], [ %21, %if.then77 ] %25 = load i32, ptr %T, align 4, !tbaa !6 %26 = sext i32 %25 to i64 %cmp52 = icmp slt i64 %indvars.iv.next.pre-phi, %26 br i1 %cmp52, label %for.body53, label %for.end84, !llvm.loop !19 for.end84: ; preds = %for.inc82, %sort.exit %putchar = call i32 @putchar(i32 10) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M, ptr noundef nonnull %T, ptr noundef nonnull %P, ptr noundef nonnull %R) %cmp = icmp eq i32 %call, 4 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !20 while.end: ; preds = %for.end84, %while.body, %entry call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %penalty_num) #9 call void @llvm.lifetime.end.p0(i64 600, ptr nonnull %teams) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %R) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %P) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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 #4 = { nofree nosync nounwind memory(argmem: readwrite) 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 #5 = { nofree 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 #6 = { 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 #7 = { nofree nounwind } attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #9 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6} !6 = !{!7, !7, i64 0} !7 = !{!"int", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11} !14 = !{!15, !7, i64 0} !15 = !{!"team", !7, i64 0, !7, i64 4, !7, i64 8} !16 = !{!15, !7, i64 4} !17 = !{!15, !7, i64 8} !18 = distinct !{!18, !11} !19 = distinct !{!19, !11} !20 = distinct !{!20, !11}
#include <stdio.h> #define max(X, Y) ((X) > (Y) ? (X) : (Y)) typedef long long ll; ll k, a, b; ll x, y; int main() { scanf("%lld %lld %lld", &k, &a, &b); x = k + 1; y = a + (b - a) * ((k - a + 1) / 2) + (k - a + 1) % 2; printf("%lld\n", max(x, y)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315627/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315627/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1 @k = dso_local global i64 0, align 8 @a = dso_local global i64 0, align 8 @b = dso_local global i64 0, align 8 @x = dso_local local_unnamed_addr global i64 0, align 8 @y = dso_local local_unnamed_addr global i64 0, align 8 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @k, ptr noundef nonnull @a, ptr noundef nonnull @b) %0 = load i64, ptr @k, align 8, !tbaa !5 %add = add nsw i64 %0, 1 store i64 %add, ptr @x, align 8, !tbaa !5 %1 = load i64, ptr @a, align 8, !tbaa !5 %2 = load i64, ptr @b, align 8, !tbaa !5 %sub = sub nsw i64 %2, %1 %sub1 = sub nsw i64 %0, %1 %add2 = add nsw i64 %sub1, 1 %div = sdiv i64 %add2, 2 %mul = mul nsw i64 %div, %sub %rem = srem i64 %add2, 2 %add3 = add i64 %rem, %1 %add6 = add i64 %add3, %mul store i64 %add6, ptr @y, align 8, !tbaa !5 %cond = tail call i64 @llvm.smax.i64(i64 %add, i64 %add6) %call7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cond) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #2 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> int main(void) { long long int K, A, B, i; scanf("%lld %lld %lld", &K, &A, &B); long long int bisket = 1, yen = 0; if (K < A || (B - A) <= 2) { printf("%lld", K + 1); return 0; } for (i = 1; i <= K; i++) { if (i == K) { if (yen == 0) bisket++; else bisket += B; break; } if(yen == 1 ) { bisket += B; yen = 0; } else if (bisket >= A) { bisket -= A; yen = 1; } else bisket++; } printf("%lld", bisket); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315670/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315670/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %K = alloca i64, align 8 %A = alloca i64, align 8 %B = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #3 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K, ptr noundef nonnull %A, ptr noundef nonnull %B) %0 = load i64, ptr %K, align 8, !tbaa !5 %1 = load i64, ptr %A, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 br i1 %cmp, label %if.then, label %lor.lhs.false lor.lhs.false: ; preds = %entry %2 = load i64, ptr %B, align 8, !tbaa !5 %sub = sub nsw i64 %2, %1 %cmp1 = icmp slt i64 %sub, 3 br i1 %cmp1, label %if.then, label %for.cond.preheader for.cond.preheader: ; preds = %lor.lhs.false %cmp3.not42 = icmp slt i64 %0, 1 br i1 %cmp3.not42, label %cleanup, label %for.body.preheader for.body.preheader: ; preds = %for.cond.preheader %cmp448 = icmp eq i64 %0, 1 br i1 %cmp448, label %if.then5, label %if.end10.preheader if.end10.preheader: ; preds = %for.body.preheader %3 = add i64 %0, -1 %xtraiter = and i64 %3, 1 %4 = icmp eq i64 %0, 2 br i1 %4, label %if.then5.loopexit.unr-lcssa, label %if.end10.preheader.new if.end10.preheader.new: ; preds = %if.end10.preheader %unroll_iter = and i64 %3, -2 br label %if.end10 if.then: ; preds = %lor.lhs.false, %entry %add = add nsw i64 %0, 1 br label %cleanup if.then5.loopexit.unr-lcssa: ; preds = %for.inc.1, %if.end10.preheader %bisket.1.lcssa.ph = phi i64 [ undef, %if.end10.preheader ], [ %bisket.1.1, %for.inc.1 ] %.lcssa.ph = phi i1 [ undef, %if.end10.preheader ], [ %5, %for.inc.1 ] %bisket.04450.unr = phi i64 [ 1, %if.end10.preheader ], [ %bisket.1.1, %for.inc.1 ] %yen.04549.unr = phi i1 [ false, %if.end10.preheader ], [ %6, %for.inc.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %if.then5, label %if.end10.epil if.end10.epil: ; preds = %if.then5.loopexit.unr-lcssa br i1 %yen.04549.unr, label %if.then12.epil, label %if.else14.epil if.else14.epil: ; preds = %if.end10.epil %cmp15.not.epil = icmp slt i64 %bisket.04450.unr, %1 br i1 %cmp15.not.epil, label %if.else18.epil, label %if.then16.epil if.then16.epil: ; preds = %if.else14.epil %sub17.epil = sub nsw i64 %bisket.04450.unr, %1 br label %if.then5 if.else18.epil: ; preds = %if.else14.epil %inc19.epil = add nsw i64 %bisket.04450.unr, 1 br label %if.then5 if.then12.epil: ; preds = %if.end10.epil %add13.epil = add nsw i64 %bisket.04450.unr, %2 br label %if.then5 if.then5: ; preds = %if.then5.loopexit.unr-lcssa, %if.then12.epil, %if.else18.epil, %if.then16.epil, %for.body.preheader %yen.045.lcssa = phi i1 [ true, %for.body.preheader ], [ %.lcssa.ph, %if.then5.loopexit.unr-lcssa ], [ true, %if.then12.epil ], [ false, %if.then16.epil ], [ true, %if.else18.epil ] %bisket.044.lcssa = phi i64 [ 1, %for.body.preheader ], [ %bisket.1.lcssa.ph, %if.then5.loopexit.unr-lcssa ], [ %add13.epil, %if.then12.epil ], [ %sub17.epil, %if.then16.epil ], [ %inc19.epil, %if.else18.epil ] br i1 %yen.045.lcssa, label %if.then7, label %if.else if.then7: ; preds = %if.then5 %inc = add nsw i64 %bisket.044.lcssa, 1 br label %cleanup if.else: ; preds = %if.then5 %add8 = add nsw i64 %bisket.044.lcssa, %2 br label %cleanup if.end10: ; preds = %for.inc.1, %if.end10.preheader.new %bisket.04450 = phi i64 [ 1, %if.end10.preheader.new ], [ %bisket.1.1, %for.inc.1 ] %yen.04549 = phi i64 [ 0, %if.end10.preheader.new ], [ %yen.1.1, %for.inc.1 ] %niter = phi i64 [ 0, %if.end10.preheader.new ], [ %niter.next.1, %for.inc.1 ] %cmp11 = icmp eq i64 %yen.04549, 1 br i1 %cmp11, label %if.then12, label %if.else14 if.then12: ; preds = %if.end10 %add13 = add nsw i64 %bisket.04450, %2 br label %for.inc if.else14: ; preds = %if.end10 %cmp15.not = icmp slt i64 %bisket.04450, %1 br i1 %cmp15.not, label %if.else18, label %if.then16 if.then16: ; preds = %if.else14 %sub17 = sub nsw i64 %bisket.04450, %1 br label %for.inc if.else18: ; preds = %if.else14 %inc19 = add nsw i64 %bisket.04450, 1 br label %for.inc for.inc: ; preds = %if.then12, %if.else18, %if.then16 %bisket.1 = phi i64 [ %add13, %if.then12 ], [ %sub17, %if.then16 ], [ %inc19, %if.else18 ] %cmp11.1 = phi i1 [ false, %if.then12 ], [ true, %if.then16 ], [ false, %if.else18 ] br i1 %cmp11.1, label %if.then12.1, label %if.else14.1 if.else14.1: ; preds = %for.inc %cmp15.not.1 = icmp slt i64 %bisket.1, %1 br i1 %cmp15.not.1, label %if.else18.1, label %if.then16.1 if.then16.1: ; preds = %if.else14.1 %sub17.1 = sub nsw i64 %bisket.1, %1 br label %for.inc.1 if.else18.1: ; preds = %if.else14.1 %inc19.1 = add nsw i64 %bisket.1, 1 br label %for.inc.1 if.then12.1: ; preds = %for.inc %add13.1 = add nsw i64 %bisket.1, %2 br label %for.inc.1 for.inc.1: ; preds = %if.then12.1, %if.else18.1, %if.then16.1 %bisket.1.1 = phi i64 [ %add13.1, %if.then12.1 ], [ %sub17.1, %if.then16.1 ], [ %inc19.1, %if.else18.1 ] %5 = phi i1 [ true, %if.then12.1 ], [ false, %if.then16.1 ], [ true, %if.else18.1 ] %6 = phi i1 [ false, %if.then12.1 ], [ true, %if.then16.1 ], [ false, %if.else18.1 ] %yen.1.1 = phi i64 [ 0, %if.then12.1 ], [ 1, %if.then16.1 ], [ 0, %if.else18.1 ] %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %if.then5.loopexit.unr-lcssa, label %if.end10 cleanup: ; preds = %if.else, %if.then7, %for.cond.preheader, %if.then %bisket.2.sink = phi i64 [ %add, %if.then ], [ %inc, %if.then7 ], [ %add8, %if.else ], [ 1, %for.cond.preheader ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %bisket.2.sink) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #define N 13000000 int c[N]; int main(void) { int i, j, k=0, n; c[0]=c[1]=1; for(i=2;i*i<N;++i) if (!c[i]) for(j=i*i;j<N;j+=i) c[j]=1; while (scanf("%d", &n), n) { int a, b; if (!c[n]) { puts("0"); continue; } for(a=n;c[a];--a); for(b=n;c[b];++b); printf("%d\n", b-a); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315713/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315713/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @c = dso_local local_unnamed_addr global [13000000 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [2 x i8] c"0\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 store i32 1, ptr getelementptr inbounds ([13000000 x i32], ptr @c, i64 0, i64 1), align 4, !tbaa !5 store i32 1, ptr @c, align 16, !tbaa !5 br label %for.body while.cond.preheader: ; preds = %for.inc7 %call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %tobool9.not55 = icmp eq i32 %0, 0 br i1 %tobool9.not55, label %while.end, label %while.body for.body: ; preds = %entry, %for.inc7 %indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %for.inc7 ] %mul53 = phi i32 [ 4, %entry ], [ %mul, %for.inc7 ] %arrayidx = getelementptr inbounds [13000000 x i32], ptr @c, i64 0, i64 %indvars.iv %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %tobool.not = icmp eq i32 %1, 0 %cmp349 = icmp ult i32 %mul53, 13000000 %or.cond = and i1 %tobool.not, %cmp349 br i1 %or.cond, label %for.body4.preheader, label %for.inc7 for.body4.preheader: ; preds = %for.body %2 = zext i32 %mul53 to i64 br label %for.body4 for.body4: ; preds = %for.body4.preheader, %for.body4 %indvars.iv56 = phi i64 [ %2, %for.body4.preheader ], [ %indvars.iv.next57, %for.body4 ] %arrayidx6 = getelementptr inbounds [13000000 x i32], ptr @c, i64 0, i64 %indvars.iv56 store i32 1, ptr %arrayidx6, align 4, !tbaa !5 %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, %indvars.iv %cmp3 = icmp ult i64 %indvars.iv.next57, 13000000 br i1 %cmp3, label %for.body4, label %for.inc7, !llvm.loop !9 for.inc7: ; preds = %for.body4, %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = trunc i64 %indvars.iv.next to i32 %mul = mul nsw i32 %3, %3 %exitcond.not = icmp eq i64 %indvars.iv.next, 3606 br i1 %exitcond.not, label %while.cond.preheader, label %for.body, !llvm.loop !11 while.body: ; preds = %while.cond.preheader, %cleanup %4 = phi i32 [ %10, %cleanup ], [ %0, %while.cond.preheader ] %idxprom10 = sext i32 %4 to i64 %arrayidx11 = getelementptr inbounds [13000000 x i32], ptr @c, i64 0, i64 %idxprom10 %5 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %tobool12.not = icmp eq i32 %5, 0 br i1 %tobool12.not, label %if.then13, label %for.cond16 if.then13: ; preds = %while.body %call14 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1) br label %cleanup, !llvm.loop !12 for.cond16: ; preds = %while.body, %for.cond16 %indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.cond16 ], [ %idxprom10, %while.body ] %arrayidx18 = getelementptr inbounds [13000000 x i32], ptr @c, i64 0, i64 %indvars.iv60 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %tobool19.not = icmp eq i32 %6, 0 %indvars.iv.next61 = add i64 %indvars.iv60, -1 br i1 %tobool19.not, label %for.cond23, label %for.cond16, !llvm.loop !13 for.cond23: ; preds = %for.cond16, %for.cond23 %indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.cond23 ], [ %idxprom10, %for.cond16 ] %arrayidx25 = getelementptr inbounds [13000000 x i32], ptr @c, i64 0, i64 %indvars.iv63 %7 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %tobool26.not = icmp eq i32 %7, 0 %indvars.iv.next64 = add i64 %indvars.iv63, 1 br i1 %tobool26.not, label %for.end30, label %for.cond23, !llvm.loop !14 for.end30: ; preds = %for.cond23 %8 = trunc i64 %indvars.iv60 to i32 %9 = trunc i64 %indvars.iv63 to i32 %sub = sub nsw i32 %9, %8 %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub) br label %cleanup cleanup: ; preds = %for.end30, %if.then13 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %10 = load i32, ptr %n, align 4, !tbaa !5 %tobool9.not = icmp eq i32 %10, 0 br i1 %tobool9.not, label %while.end, label %while.body while.end: ; preds = %cleanup, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include<stdio.h> #include<stdlib.h> int fibonacci(int n,int *x){ int i; x[0]=1; x[1]=1; for(i=2;i<=n;i++){ x[i]=x[i-2]+x[i-1]; } return x[n]; } int main(){ int n,i,j; int *f; scanf("%d",&n); f=(int *)malloc(n *sizeof(int)); j=fibonacci(n,f); printf("%d\n",j); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315757/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315757/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @fibonacci(i32 noundef %n, ptr nocapture noundef %x) local_unnamed_addr #0 { entry: store i32 1, ptr %x, align 4, !tbaa !5 %arrayidx1 = getelementptr inbounds i32, ptr %x, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not20 = icmp slt i32 %n, 2 br i1 %cmp.not20, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -2 %2 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 %invariant.gep = getelementptr i32, ptr %x, i64 2 %invariant.gep26 = getelementptr i32, ptr %x, i64 3 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %4 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add = add nsw i32 %4, %5 %arrayidx7 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv store i32 %add, ptr %arrayidx7, align 4, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add.1 = add nsw i32 %add, %4 %arrayidx7.1 = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !5 %add.2 = add nsw i32 %add.1, %add %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv store i32 %add.2, ptr %gep, align 4, !tbaa !5 %add.3 = add nsw i32 %add.2, %add.1 %gep27 = getelementptr i32, ptr %invariant.gep26, i64 %indvars.iv store i32 %add.3, ptr %gep27, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %.unr25 = phi i32 [ 1, %for.body.preheader ], [ %add.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %6 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %7 = phi i32 [ %6, %for.body.epil ], [ %.unr25, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %6, %7 %arrayidx7.epil = getelementptr inbounds i32, ptr %x, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx7.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds i32, ptr %x, i64 %idxprom8 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 ret i32 %8 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call1 = call noalias ptr @malloc(i64 noundef %mul) #6 store i32 1, ptr %call1, align 4, !tbaa !5 %arrayidx1.i = getelementptr inbounds i32, ptr %call1, i64 1 store i32 1, ptr %arrayidx1.i, align 4, !tbaa !5 %cmp.not20.i = icmp slt i32 %0, 2 br i1 %cmp.not20.i, label %fibonacci.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count.i = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count.i, -2 %3 = add nsw i64 %wide.trip.count.i, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %fibonacci.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %2, -4 %invariant.gep = getelementptr i32, ptr %call1, i64 2 %invariant.gep5 = getelementptr i32, ptr %call1, i64 3 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %5 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ] %6 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.2, %for.body.i ] %indvars.iv.i = phi i64 [ 2, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %add.i = add nsw i32 %6, %5 %arrayidx7.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i store i32 %add.i, ptr %arrayidx7.i, align 4, !tbaa !5 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %add.i.1 = add nsw i32 %5, %add.i %arrayidx7.i.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next.i store i32 %add.i.1, ptr %arrayidx7.i.1, align 4, !tbaa !5 %add.i.2 = add nsw i32 %add.i, %add.i.1 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.i store i32 %add.i.2, ptr %gep, align 4, !tbaa !5 %add.i.3 = add nsw i32 %add.i.1, %add.i.2 %gep6 = getelementptr i32, ptr %invariant.gep5, i64 %indvars.iv.i store i32 %add.i.3, ptr %gep6, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %fibonacci.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !9 fibonacci.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %.unr = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.3, %for.body.i ] %.unr4 = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.2, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 2, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %fibonacci.exit, label %for.body.i.epil for.body.i.epil: ; preds = %fibonacci.exit.loopexit.unr-lcssa, %for.body.i.epil %7 = phi i32 [ %add.i.epil, %for.body.i.epil ], [ %.unr, %fibonacci.exit.loopexit.unr-lcssa ] %8 = phi i32 [ %7, %for.body.i.epil ], [ %.unr4, %fibonacci.exit.loopexit.unr-lcssa ] %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %fibonacci.exit.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %fibonacci.exit.loopexit.unr-lcssa ] %add.i.epil = add nsw i32 %8, %7 %arrayidx7.i.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i.epil store i32 %add.i.epil, ptr %arrayidx7.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %fibonacci.exit, label %for.body.i.epil, !llvm.loop !13 fibonacci.exit: ; preds = %fibonacci.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry %arrayidx9.i = getelementptr inbounds i32, ptr %call1, i64 %conv %9 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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 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 = { 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 #4 = { 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 #5 = { nounwind } attributes #6 = { nounwind allocsize(0) } !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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !12}
#include <stdio.h> int main(void) { long long int n,x,i,min=1000000001,max=-1,sum1=1,sum2=1; long long int ans; scanf("%lld",&n); for(i=0;i<n;i++) { scanf("%lld",&x); if(x<min) { min=x; sum1=0; } if(x==min) sum1++; if(x>max) { max=x; sum2=0; } if(x==max) sum2++; } if(max-min==0) ans=(sum2*(sum2-1)/2); else ans=(sum1*sum2); printf("%lld %lld",max-min,ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_31580/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_31580/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %x = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp34 = icmp sgt i64 %0, 0 br i1 %cmp34, label %for.body, label %if.else for.body: ; preds = %entry, %for.body %sum2.039 = phi i64 [ %sum2.2, %for.body ], [ 1, %entry ] %sum1.038 = phi i64 [ %sum1.2, %for.body ], [ 1, %entry ] %max.037 = phi i64 [ %max.1, %for.body ], [ -1, %entry ] %min.036 = phi i64 [ %spec.select, %for.body ], [ 1000000001, %entry ] %i.035 = phi i64 [ %inc13, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %1 = load i64, ptr %x, align 8, !tbaa !5 %cmp2 = icmp slt i64 %1, %min.036 %spec.select = call i64 @llvm.smin.i64(i64 %1, i64 %min.036) %spec.select33 = select i1 %cmp2, i64 0, i64 %sum1.038 %cmp3.not = icmp sle i64 %1, %min.036 %inc = zext i1 %cmp3.not to i64 %sum1.2 = add nsw i64 %spec.select33, %inc %cmp6 = icmp sgt i64 %1, %max.037 %max.1 = call i64 @llvm.smax.i64(i64 %1, i64 %max.037) %sum2.1 = select i1 %cmp6, i64 0, i64 %sum2.039 %cmp9.not = icmp sge i64 %1, %max.037 %inc11 = zext i1 %cmp9.not to i64 %sum2.2 = add nsw i64 %sum2.1, %inc11 %inc13 = add nuw nsw i64 %i.035, 1 %2 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc13, %2 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp14 = icmp eq i64 %max.1, %spec.select br i1 %cmp14, label %if.then15, label %if.else if.then15: ; preds = %for.end %sub16 = add nsw i64 %sum2.2, -1 %mul = mul nsw i64 %sub16, %sum2.2 %div = sdiv i64 %mul, 2 br label %if.end18 if.else: ; preds = %entry, %for.end %sum2.0.lcssa53 = phi i64 [ %sum2.2, %for.end ], [ 1, %entry ] %sum1.0.lcssa52 = phi i64 [ %sum1.2, %for.end ], [ 1, %entry ] %max.0.lcssa51 = phi i64 [ %max.1, %for.end ], [ -1, %entry ] %min.0.lcssa49 = phi i64 [ %spec.select, %for.end ], [ 1000000001, %entry ] %mul17 = mul nsw i64 %sum2.0.lcssa53, %sum1.0.lcssa52 br label %if.end18 if.end18: ; preds = %if.else, %if.then15 %max.0.lcssa50 = phi i64 [ %max.1, %if.then15 ], [ %max.0.lcssa51, %if.else ] %min.0.lcssa48 = phi i64 [ %spec.select, %if.then15 ], [ %min.0.lcssa49, %if.else ] %ans.0 = phi i64 [ %div, %if.then15 ], [ %mul17, %if.else ] %sub = sub nsw i64 %max.0.lcssa50, %min.0.lcssa48 %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub, i64 noundef %ans.0) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int F[44] = {0}; int fibonacci(int n){ if(n == 1 || n == 0) return F[n] = 1; if(F[n] != 0) return F[n]; return F[n] = fibonacci(n - 2) + fibonacci(n - 1); } int main(){ int n; int fib; scanf("%d",&n); fib = fibonacci(n); printf("%d\n",fib); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315843/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315843/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @F = dso_local local_unnamed_addr global [44 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #0 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [44 x i32], ptr @F, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [44 x i32], ptr @F, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, 0 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %n, -2 %call = tail call i32 @fibonacci(i32 noundef %sub) %sub9 = add nsw i32 %n, -1 %call10 = tail call i32 @fibonacci(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int F[100]; int fibonacci(int n){ if(n == 0 || n == 1) return F[n] = 1; if(F[n] != -1) return F[n]; F[n] = fibonacci(n-2) + fibonacci(n-1); return F[n]; } int main(void){ int n,i; for(i=0;i<100;i++){ F[i] = -1; } scanf("%d",&n); printf("%d\n",fibonacci(n)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_315887/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_315887/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @F = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #0 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret23 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -1 br i1 %cmp4.not, label %if.end8, label %common.ret23 common.ret23: ; preds = %if.end, %if.then, %if.end8 %common.ret23.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret23.op if.end8: ; preds = %if.end %sub = add nsw i32 %n, -2 %call = tail call i32 @fibonacci(i32 noundef %sub) %sub9 = add nsw i32 %n, -1 %call10 = tail call i32 @fibonacci(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret23 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) @F, i8 -1, i64 400, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
///light lightens... #include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> typedef long long ll; void test() { int n; scanf("%d",&n); char s[n+1]; scanf("%s",s); int i,j,a[26]={0}; for(i=0;i<n;i++){ a[s[i]-97]++; } for(i=0;i<26;i++){ for(j=0;j<a[i];j++){ printf("%c",i+97); } } printf("\n"); } int main() { int t; scanf("%d",&t); while(t--)test(); } ///dark darkens///
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_31593/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_31593/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @test() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [26 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i8, i64 %1, align 16 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %a) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(104) %a, i8 0, i64 104, i1 false) %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp32 = icmp sgt i32 %3, 0 br i1 %cmp32, label %for.body.preheader, label %for.cond9.preheader.preheader for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %3 to i64 %xtraiter = and i64 %wide.trip.count, 1 %4 = icmp eq i32 %3, 1 br i1 %4, label %for.cond9.preheader.preheader.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv %5 = load i8, ptr %arrayidx, align 2, !tbaa !9 %conv = sext i8 %5 to i64 %sub = add nsw i64 %conv, -97 %arrayidx3 = getelementptr inbounds [26 x i32], ptr %a, i64 0, i64 %sub %6 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %inc = add nsw i32 %6, 1 store i32 %inc, ptr %arrayidx3, align 4, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.next %7 = load i8, ptr %arrayidx.1, align 1, !tbaa !9 %conv.1 = sext i8 %7 to i64 %sub.1 = add nsw i64 %conv.1, -97 %arrayidx3.1 = getelementptr inbounds [26 x i32], ptr %a, i64 0, i64 %sub.1 %8 = load i32, ptr %arrayidx3.1, align 4, !tbaa !5 %inc.1 = add nsw i32 %8, 1 store i32 %inc.1, ptr %arrayidx3.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond9.preheader.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !10 for.cond9.preheader.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond9.preheader.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond9.preheader.preheader.loopexit.unr-lcssa %arrayidx.epil = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv.unr %9 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9 %conv.epil = sext i8 %9 to i64 %sub.epil = add nsw i64 %conv.epil, -97 %arrayidx3.epil = getelementptr inbounds [26 x i32], ptr %a, i64 0, i64 %sub.epil %10 = load i32, ptr %arrayidx3.epil, align 4, !tbaa !5 %inc.epil = add nsw i32 %10, 1 store i32 %inc.epil, ptr %arrayidx3.epil, align 4, !tbaa !5 br label %for.cond9.preheader.preheader for.cond9.preheader.preheader: ; preds = %for.body.epil, %for.cond9.preheader.preheader.loopexit.unr-lcssa, %entry br label %for.cond9.preheader for.cond9.preheader: ; preds = %for.cond9.preheader.preheader, %for.inc20 %indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.inc20 ], [ 0, %for.cond9.preheader.preheader ] %arrayidx11 = getelementptr inbounds [26 x i32], ptr %a, i64 0, i64 %indvars.iv39 %11 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp1234 = icmp sgt i32 %11, 0 br i1 %cmp1234, label %for.body14.lr.ph, label %for.inc20 for.body14.lr.ph: ; preds = %for.cond9.preheader %12 = trunc i64 %indvars.iv39 to i32 %13 = add i32 %12, 97 br label %for.body14 for.body14: ; preds = %for.body14.lr.ph, %for.body14 %j.035 = phi i32 [ 0, %for.body14.lr.ph ], [ %inc18, %for.body14 ] %putchar31 = call i32 @putchar(i32 %13) %inc18 = add nuw nsw i32 %j.035, 1 %exitcond38.not = icmp eq i32 %inc18, %11 br i1 %exitcond38.not, label %for.inc20, label %for.body14, !llvm.loop !12 for.inc20: ; preds = %for.body14, %for.cond9.preheader %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1 %exitcond43.not = icmp eq i64 %indvars.iv.next40, 26 br i1 %exitcond43.not, label %for.end22, label %for.cond9.preheader, !llvm.loop !13 for.end22: ; preds = %for.inc20 %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %a) #6 call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec1 = add nsw i32 %0, -1 store i32 %dec1, ptr %t, align 4, !tbaa !5 %tobool.not2 = icmp eq i32 %0, 0 br i1 %tobool.not2, label %while.end, label %while.body while.body: ; preds = %entry, %while.body call void @test() %1 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %1, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %1, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5 attributes #0 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #5 = { nofree nounwind } attributes #6 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11} !14 = distinct !{!14, !11}
#include<stdio.h> #define N 44 int fibonacci(int); int main(){ int i,n; scanf("%d",&n); printf("%d\n",fibonacci(n)); return 0; } int fibonacci(int n){ int F[n],i; F[0]=1; F[1]=1; for( i=2 ; i<=n ; i++) F[i] = F[i-2] + F[i-1]; return F[n]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316015/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316015/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #3 { entry: %0 = zext i32 %n to i64 %vla = alloca i32, i64 %0, align 16 store i32 1, ptr %vla, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not16 = icmp slt i32 %n, 2 br i1 %cmp.not16, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -2 %3 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 %invariant.gep = getelementptr i32, ptr %vla, i64 2 %invariant.gep22 = getelementptr i32, ptr %vla, i64 3 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %6 = phi i32 [ 1, %for.body.preheader.new ], [ %add.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add = add nsw i32 %5, %6 %arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %add, ptr %arrayidx7, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add.1 = add nsw i32 %add, %5 %arrayidx7.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !5 %add.2 = add nsw i32 %add.1, %add %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv store i32 %add.2, ptr %gep, align 8, !tbaa !5 %add.3 = add nsw i32 %add.2, %add.1 %gep23 = getelementptr i32, ptr %invariant.gep22, i64 %indvars.iv store i32 %add.3, ptr %gep23, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %.unr21 = phi i32 [ 1, %for.body.preheader ], [ %add.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %7 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %8 = phi i32 [ %7, %for.body.epil ], [ %.unr21, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %7, %8 %arrayidx7.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx7.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8 %9 = load i32, ptr %arrayidx9, align 4, !tbaa !5 ret i32 %9 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree norecurse nosync nounwind memory(none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include <stdio.h> int fib(int); int a[50]={0}; int main(void) { int n; scanf("%d",&n); printf("%d\n",fib(n)); return 0; } int fib(int n) { a[1]=a[0]=1; if(a[n]!=0) return a[n]; a[n] = fib(n-1) + fib(n-2); return a[n]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316066/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316066/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @a = dso_local local_unnamed_addr global [50 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fib(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fib(i32 noundef %n) local_unnamed_addr #3 { entry: store i32 1, ptr @a, align 16, !tbaa !5 store i32 1, ptr getelementptr inbounds ([50 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5 %idxprom = sext i32 %n to i64 %arrayidx = getelementptr inbounds [50 x i32], ptr @a, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp.not = icmp eq i32 %0, 0 br i1 %cmp.not, label %if.end, label %common.ret14 common.ret14: ; preds = %entry, %if.end %common.ret14.op = phi i32 [ %add, %if.end ], [ %0, %entry ] ret i32 %common.ret14.op if.end: ; preds = %entry %sub = add nsw i32 %n, -1 %call = tail call i32 @fib(i32 noundef %sub) %sub3 = add nsw i32 %n, -2 %call4 = tail call i32 @fib(i32 noundef %sub3) %add = add nsw i32 %call4, %call store i32 %add, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret14 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #define MAX 100 int F[MAX]; int main(){ int i,n; scanf("%d",&n); /*for( i = 0 ; i < n ; i++ ){ F[i] = -1; }*/ F[0] = 1; F[1] = 1; for( i = 2 ; i <= n ; i++ ){ F[i] = F[i-2] + F[i-1]; } printf("%d\n",F[n]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316109/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316109/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @F = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) store i32 1, ptr @F, align 16, !tbaa !5 store i32 1, ptr getelementptr inbounds ([100 x i32], ptr @F, i64 0, i64 1), align 4, !tbaa !5 %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not13 = icmp slt i32 %0, 2 br i1 %cmp.not13, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -2 %3 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %6 = phi i32 [ 1, %for.body.preheader.new ], [ %add.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add = add nsw i32 %5, %6 %arrayidx5 = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %indvars.iv store i32 %add, ptr %arrayidx5, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add.1 = add nsw i32 %add, %5 %arrayidx5.1 = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx5.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %add.2 = add nsw i32 %add.1, %add %arrayidx5.2 = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %indvars.iv.next.1 store i32 %add.2, ptr %arrayidx5.2, align 8, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %add.3 = add nsw i32 %add.2, %add.1 %arrayidx5.3 = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %indvars.iv.next.2 store i32 %add.3, ptr %arrayidx5.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %.unr18 = phi i32 [ 1, %for.body.preheader ], [ %add.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %7 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %8 = phi i32 [ %7, %for.body.epil ], [ %.unr18, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %7, %8 %arrayidx5.epil = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx5.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom6 = sext i32 %0 to i64 %arrayidx7 = getelementptr inbounds [100 x i32], ptr @F, i64 0, i64 %idxprom6 %9 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> #define N 44 int fibonacci(int); int main(){ int i,n; scanf("%d",&n); printf("%d\n",fibonacci(n)); return 0; } int fibonacci(int n){ int F[n],i; F[0]=1; F[1]=1; for( i=2 ; i<=n ; i++) F[i] = F[i-2] + F[i-1]; return F[n]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316152/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316152/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #3 { entry: %0 = zext i32 %n to i64 %vla = alloca i32, i64 %0, align 16 store i32 1, ptr %vla, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not16 = icmp slt i32 %n, 2 br i1 %cmp.not16, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count, -2 %3 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %2, -4 %invariant.gep = getelementptr i32, ptr %vla, i64 2 %invariant.gep22 = getelementptr i32, ptr %vla, i64 3 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %6 = phi i32 [ 1, %for.body.preheader.new ], [ %add.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add = add nsw i32 %5, %6 %arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %add, ptr %arrayidx7, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add.1 = add nsw i32 %add, %5 %arrayidx7.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !5 %add.2 = add nsw i32 %add.1, %add %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv store i32 %add.2, ptr %gep, align 8, !tbaa !5 %add.3 = add nsw i32 %add.2, %add.1 %gep23 = getelementptr i32, ptr %invariant.gep22, i64 %indvars.iv store i32 %add.3, ptr %gep23, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %.unr21 = phi i32 [ 1, %for.body.preheader ], [ %add.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %7 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %8 = phi i32 [ %7, %for.body.epil ], [ %.unr21, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %7, %8 %arrayidx7.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx7.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8 %9 = load i32, ptr %arrayidx9, align 4, !tbaa !5 ret i32 %9 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree norecurse nosync nounwind memory(none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> #include<string.h> int main () { int t, n, i,j; char a[200],ch; scanf ("%d", &t); while (t > 0) { j=0; scanf ("%d", &n); scanf("%s",&a); for(i=0;i<strlen(a);i++) { if(a[i]=='b') { ch=a[i]; a[i]=a[j]; a[j]=ch; j++; } } printf("%s \n",a); t--; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_31621/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_31621/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%s \0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 %a = alloca [200 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %.pr = load i32, ptr %t, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %.pr, 0 br i1 %cmp31, label %while.body, label %while.end while.body: ; preds = %entry, %for.end %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %char0 = load i8, ptr %a, align 16 %cmp427.not = icmp eq i8 %char0, 0 br i1 %cmp427.not, label %for.end, label %for.body for.body: ; preds = %while.body, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %while.body ] %j.028 = phi i32 [ %j.1, %for.inc ], [ 0, %while.body ] %arrayidx = getelementptr inbounds [200 x i8], ptr %a, i64 0, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !9 %cmp7 = icmp eq i8 %0, 98 br i1 %cmp7, label %if.then, label %for.inc if.then: ; preds = %for.body %idxprom11 = sext i32 %j.028 to i64 %arrayidx12 = getelementptr inbounds [200 x i8], ptr %a, i64 0, i64 %idxprom11 %1 = load i8, ptr %arrayidx12, align 1, !tbaa !9 store i8 %1, ptr %arrayidx, align 1, !tbaa !9 store i8 98, ptr %arrayidx12, align 1, !tbaa !9 %inc = add nsw i32 %j.028, 1 br label %for.inc for.inc: ; preds = %for.body, %if.then %j.1 = phi i32 [ %inc, %if.then ], [ %j.028, %for.body ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #5 %cmp4 = icmp ugt i64 %call3, %indvars.iv.next br i1 %cmp4, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.inc, %while.body %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %a) %2 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %cmp = icmp sgt i32 %2, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12 while.end: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11}
#include<stdio.h> #define NIL -1 int fibonacci(int); int fib[45]; int main(){ int n,i,answer; scanf("%d",&n); for(i=0;i<=n;i++){ fib[i]=NIL; } answer=fibonacci(n); printf("%d\n",answer); return 0; } int fibonacci(int n){ if(n==0||n==1) return fib[n]=1; if(fib[n]!=NIL) return fib[n]; return fib[n]=fibonacci(n-2)+fibonacci(n-1); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316268/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316268/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @fib = dso_local local_unnamed_addr global [45 x i32] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not5 = icmp slt i32 %0, 0 br i1 %cmp.not5, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nuw i32 %0, 1 %2 = zext i32 %1 to i64 %3 = shl nuw nsw i64 %2, 2 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @fib, i8 -1, i64 %3, i1 false), !tbaa !5 br label %for.end for.end: ; preds = %for.body.preheader, %entry %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #3 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [45 x i32], ptr @fib, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [45 x i32], ptr @fib, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -1 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %n, -2 %call = tail call i32 @fibonacci(i32 noundef %sub) %sub9 = add nsw i32 %n, -1 %call10 = tail call i32 @fibonacci(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #define MAX 45 int answer(int); int fib[MAX]; int main(){ int x; scanf("%d" ,&x); printf("%d\n" ,answer(x)); return 0; } int answer(int x){ if(fib[x] > 0){ return fib[x]; } if(x <= 1){ return 1; } else{ return fib[x] = answer(x-1) + answer(x-2); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316310/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316310/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @fib = dso_local local_unnamed_addr global [45 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %0 = load i32, ptr %x, align 4, !tbaa !5 %call1 = call i32 @answer(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @answer(i32 noundef %x) local_unnamed_addr #3 { entry: %idxprom = sext i32 %x to i64 %arrayidx = getelementptr inbounds [45 x i32], ptr @fib, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, 0 br i1 %cmp, label %common.ret14, label %if.end if.end: ; preds = %entry %cmp3 = icmp slt i32 %x, 2 br i1 %cmp3, label %common.ret14, label %if.else common.ret14: ; preds = %if.end, %entry, %if.else %common.ret14.op = phi i32 [ %add, %if.else ], [ %0, %entry ], [ 1, %if.end ] ret i32 %common.ret14.op if.else: ; preds = %if.end %sub = add nsw i32 %x, -1 %call = tail call i32 @answer(i32 noundef %sub) %sub5 = add nsw i32 %x, -2 %call6 = tail call i32 @answer(i32 noundef %sub5) %add = add nsw i32 %call6, %call store i32 %add, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret14 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #define N 45 int fibonacci(int); int F[N]; int main(){ int n,i; for(i=0;i<N;i++){ F[i]=-1; } scanf("%d",&n); printf("%d\n", fibonacci(n)); return 0; } int fibonacci(int n){ int i; if(n == 0 || n == 1) return F[n] = 1 ; if( F[n]!= -1) return F[n]; else return F[n] = fibonacci(n - 2) + fibonacci(n - 1); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316354/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316354/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @F = dso_local local_unnamed_addr global [45 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(180) @F, i8 -1, i64 180, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #3 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [45 x i32], ptr @F, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret19 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [45 x i32], ptr @F, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -1 br i1 %cmp4.not, label %if.else, label %common.ret19 common.ret19: ; preds = %if.end, %if.then, %if.else %common.ret19.op = phi i32 [ %add, %if.else ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret19.op if.else: ; preds = %if.end %sub = add nsw i32 %n, -2 %call = tail call i32 @fibonacci(i32 noundef %sub) %sub8 = add nsw i32 %n, -1 %call9 = tail call i32 @fibonacci(i32 noundef %sub8) %add = add nsw i32 %call9, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret19 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { int n,i,a=1,b=1,c=1; scanf("%d",&n); for(i=0;i<n-1;i++){ a=b+c; c=b; b=a; } printf("%d\n",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316398/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316398/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp5 = icmp sgt i32 %0, 1 br i1 %cmp5, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %1 = add i32 %0, -2 %2 = add i32 %0, -1 %xtraiter = and i32 %2, 7 %3 = icmp ult i32 %1, 7 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i32 %2, -8 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %c.08 = phi i32 [ 1, %for.body.preheader.new ], [ %add.6, %for.body ] %b.07 = phi i32 [ 1, %for.body.preheader.new ], [ %add.7, %for.body ] %niter = phi i32 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ] %add = add nsw i32 %c.08, %b.07 %add.1 = add nsw i32 %b.07, %add %add.2 = add nsw i32 %add, %add.1 %add.3 = add nsw i32 %add.1, %add.2 %add.4 = add nsw i32 %add.2, %add.3 %add.5 = add nsw i32 %add.3, %add.4 %add.6 = add nsw i32 %add.4, %add.5 %add.7 = add nsw i32 %add.5, %add.6 %niter.next.7 = add i32 %niter, 8 %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %add.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %add.7, %for.body ] %c.08.unr = phi i32 [ 1, %for.body.preheader ], [ %add.6, %for.body ] %b.07.unr = phi i32 [ 1, %for.body.preheader ], [ %add.7, %for.body ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %c.08.epil = phi i32 [ %b.07.epil, %for.body.epil ], [ %c.08.unr, %for.end.loopexit.unr-lcssa ] %b.07.epil = phi i32 [ %add.epil, %for.body.epil ], [ %b.07.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i32 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %c.08.epil, %b.07.epil %epil.iter.next = add i32 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %b.0.lcssa = phi i32 [ 1, %entry ], [ %add.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %add.epil, %for.body.epil ] %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %b.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> long long fibodp(int n) { long long fibodp[200] = {0}; fibodp[1] = 1; fibodp[2] = 2; for(int i = 3; i <= n; i++) { fibodp[i] = fibodp[i-1] + fibodp[i-2]; } return fibodp[n]; } int a; int main(void){ int a; scanf("%d", &a); printf("%lld\n", fibodp(a)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316440/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316440/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @a = dso_local local_unnamed_addr global i32 0, align 4 ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i64 @fibodp(i32 noundef %n) local_unnamed_addr #0 { entry: %fibodp = alloca [200 x i64], align 16 call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %fibodp) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) %fibodp, i8 0, i64 1600, i1 false) %arrayidx = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 1 store i64 1, ptr %arrayidx, align 8, !tbaa !5 %arrayidx1 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 2 store i64 2, ptr %arrayidx1, align 16, !tbaa !5 %cmp.not15 = icmp slt i32 %n, 3 br i1 %cmp.not15, label %for.cond.cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -3 %2 = add nsw i64 %wide.trip.count, -4 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i64 [ 2, %for.body.preheader ], [ %add.3, %for.body ] %indvars.iv.unr = phi i64 [ 3, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil %4 = phi i64 [ %add.epil, %for.body.epil ], [ %.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ] %5 = add nsw i64 %indvars.iv.epil, -2 %arrayidx5.epil = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %5 %6 = load i64, ptr %arrayidx5.epil, align 8, !tbaa !5 %add.epil = add nsw i64 %6, %4 %arrayidx7.epil = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %indvars.iv.epil store i64 %add.epil, ptr %arrayidx7.epil, align 8, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !9 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %idxprom8 %7 = load i64, ptr %arrayidx9, align 8, !tbaa !5 call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %fibodp) #5 ret i64 %7 for.body: ; preds = %for.body, %for.body.preheader.new %8 = phi i64 [ 2, %for.body.preheader.new ], [ %add.3, %for.body ] %indvars.iv = phi i64 [ 3, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %9 = add nsw i64 %indvars.iv, -2 %arrayidx5 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %9 %10 = load i64, ptr %arrayidx5, align 8, !tbaa !5 %add = add nsw i64 %10, %8 %arrayidx7 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %indvars.iv store i64 %add, ptr %arrayidx7, align 8, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %11 = add nsw i64 %indvars.iv, -1 %arrayidx5.1 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %11 %12 = load i64, ptr %arrayidx5.1, align 8, !tbaa !5 %add.1 = add nsw i64 %12, %add %arrayidx7.1 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %indvars.iv.next store i64 %add.1, ptr %arrayidx7.1, align 8, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx5.2 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %indvars.iv %13 = load i64, ptr %arrayidx5.2, align 8, !tbaa !5 %add.2 = add nsw i64 %13, %add.1 %arrayidx7.2 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %indvars.iv.next.1 store i64 %add.2, ptr %arrayidx7.2, align 8, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %14 = add nuw nsw i64 %indvars.iv, 1 %arrayidx5.3 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %14 %15 = load i64, ptr %arrayidx5.3, align 8, !tbaa !5 %add.3 = add nsw i64 %15, %add.2 %arrayidx7.3 = getelementptr inbounds [200 x i64], ptr %fibodp, i64 0, i64 %indvars.iv.next.2 store i64 %add.3, ptr %arrayidx7.3, align 8, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !11 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %fibodp.i = alloca [200 x i64], align 16 %a = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !13 call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %fibodp.i) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) %fibodp.i, i8 0, i64 1600, i1 false) %arrayidx.i = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 1 store i64 1, ptr %arrayidx.i, align 8, !tbaa !5 %arrayidx1.i = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 2 store i64 2, ptr %arrayidx1.i, align 16, !tbaa !5 %cmp.not15.i = icmp slt i32 %0, 3 br i1 %cmp.not15.i, label %fibodp.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count.i = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count.i, -3 %3 = add nsw i64 %wide.trip.count.i, -4 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %fibodp.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %2, -4 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %5 = phi i64 [ 2, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ] %indvars.iv.i = phi i64 [ 3, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %6 = add nsw i64 %indvars.iv.i, -2 %arrayidx5.i = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %6 %7 = load i64, ptr %arrayidx5.i, align 8, !tbaa !5 %add.i = add nsw i64 %7, %5 %arrayidx7.i = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %indvars.iv.i store i64 %add.i, ptr %arrayidx7.i, align 8, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %8 = add nsw i64 %indvars.iv.i, -1 %arrayidx5.i.1 = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %8 %9 = load i64, ptr %arrayidx5.i.1, align 8, !tbaa !5 %add.i.1 = add nsw i64 %9, %add.i %arrayidx7.i.1 = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %indvars.iv.next.i store i64 %add.i.1, ptr %arrayidx7.i.1, align 8, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %arrayidx5.i.2 = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %indvars.iv.i %10 = load i64, ptr %arrayidx5.i.2, align 8, !tbaa !5 %add.i.2 = add nsw i64 %10, %add.i.1 %arrayidx7.i.2 = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %indvars.iv.next.i.1 store i64 %add.i.2, ptr %arrayidx7.i.2, align 8, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %11 = add nuw nsw i64 %indvars.iv.i, 1 %arrayidx5.i.3 = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %11 %12 = load i64, ptr %arrayidx5.i.3, align 8, !tbaa !5 %add.i.3 = add nsw i64 %12, %add.i.2 %arrayidx7.i.3 = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %indvars.iv.next.i.2 store i64 %add.i.3, ptr %arrayidx7.i.3, align 8, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add nuw i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %fibodp.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !11 fibodp.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %.unr = phi i64 [ 2, %for.body.preheader.i ], [ %add.i.3, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 3, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %fibodp.exit, label %for.body.i.epil for.body.i.epil: ; preds = %fibodp.exit.loopexit.unr-lcssa, %for.body.i.epil %13 = phi i64 [ %add.i.epil, %for.body.i.epil ], [ %.unr, %fibodp.exit.loopexit.unr-lcssa ] %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %fibodp.exit.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %fibodp.exit.loopexit.unr-lcssa ] %14 = add nsw i64 %indvars.iv.i.epil, -2 %arrayidx5.i.epil = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %14 %15 = load i64, ptr %arrayidx5.i.epil, align 8, !tbaa !5 %add.i.epil = add nsw i64 %15, %13 %arrayidx7.i.epil = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %indvars.iv.i.epil store i64 %add.i.epil, ptr %arrayidx7.i.epil, align 8, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %fibodp.exit, label %for.body.i.epil, !llvm.loop !15 fibodp.exit: ; preds = %fibodp.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry %idxprom8.i = sext i32 %0 to i64 %arrayidx9.i = getelementptr inbounds [200 x i64], ptr %fibodp.i, i64 0, i64 %idxprom8.i %16 = load i64, ptr %arrayidx9.i, align 8, !tbaa !5 call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %fibodp.i) #5 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %16) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 attributes #0 = { nofree nosync nounwind memory(none) 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { nofree 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 #4 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = !{!14, !14, i64 0} !14 = !{!"int", !7, i64 0} !15 = distinct !{!15, !10}
#include<stdio.h> int dp[50]; int fibonacci(int n){ if(n == 0||n == 1) return dp[n]=1; if(dp[n]!= -1) return dp[n]; return dp[n]=fibonacci(n-2) + fibonacci(n-1); } int main(){ int n,i; for(i = 0;i<50;i++) dp[i] = -1; scanf("%d",&n); printf("%d\n",fibonacci(n)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316505/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316505/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @dp = dso_local local_unnamed_addr global [50 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #0 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [50 x i32], ptr @dp, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [50 x i32], ptr @dp, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -1 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %n, -2 %call = tail call i32 @fibonacci(i32 noundef %sub) %sub9 = add nsw i32 %n, -1 %call10 = tail call i32 @fibonacci(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) @dp, i8 -1, i64 200, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> void fibo(int); int main() { int n; scanf("%d",&n); fibo(n); return 0; } void fibo(int n) { int F[n+1],i; F[0]=1; F[1]=1; for(i=2;i<=n;i++) { F[i]=F[i-2]+F[i-1]; } printf("%d\n",F[n]); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316549/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316549/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 call void @fibo(i32 noundef %0) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @fibo(i32 noundef %n) local_unnamed_addr #0 { entry: %add = add i32 %n, 1 %0 = zext i32 %add to i64 %vla = alloca i32, i64 %0, align 16 store i32 1, ptr %vla, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not17 = icmp slt i32 %n, 2 br i1 %cmp.not17, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %1 = add nsw i64 %0, -2 %2 = add nsw i64 %0, -3 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 %invariant.gep = getelementptr i32, ptr %vla, i64 2 %invariant.gep23 = getelementptr i32, ptr %vla, i64 3 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %4 = phi i32 [ 1, %for.body.preheader.new ], [ %add6.3, %for.body ] %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add6.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add6 = add nsw i32 %4, %5 %arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %add6, ptr %arrayidx8, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add6.1 = add nsw i32 %add6, %4 %arrayidx8.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next store i32 %add6.1, ptr %arrayidx8.1, align 4, !tbaa !5 %add6.2 = add nsw i32 %add6.1, %add6 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv store i32 %add6.2, ptr %gep, align 8, !tbaa !5 %add6.3 = add nsw i32 %add6.2, %add6.1 %gep24 = getelementptr i32, ptr %invariant.gep23, i64 %indvars.iv store i32 %add6.3, ptr %gep24, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add6.3, %for.body ] %.unr22 = phi i32 [ 1, %for.body.preheader ], [ %add6.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %6 = phi i32 [ %add6.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %7 = phi i32 [ %6, %for.body.epil ], [ %.unr22, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add6.epil = add nsw i32 %6, %7 %arrayidx8.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.epil store i32 %add6.epil, ptr %arrayidx8.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom9 = sext i32 %n to i64 %arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %idxprom9 %8 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"}
#include<stdio.h> int fibonacci(int); int main(){ int x,y; scanf("%d",&x); printf("%d\n",fibonacci(x)); return 0; } int fibonacci(int n){ int i,F[50] ; F[0] = 1; F[1] = 1; for(i = 2 ; i<=n ; i++){ F[i] = F[i-2] + F[i-1]; } return F[n]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316592/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316592/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %F.i = alloca [50 x i32], align 16 %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %0 = load i32, ptr %x, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %F.i) #4 store i32 1, ptr %F.i, align 16, !tbaa !5 %arrayidx1.i = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 1 store i32 1, ptr %arrayidx1.i, align 4, !tbaa !5 %cmp.not15.i = icmp slt i32 %0, 2 br i1 %cmp.not15.i, label %fibonacci.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count.i = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count.i, -2 %3 = add nsw i64 %wide.trip.count.i, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %fibonacci.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %2, -4 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %5 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ] %6 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.2, %for.body.i ] %indvars.iv.i = phi i64 [ 2, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %add.i = add nsw i32 %6, %5 %arrayidx7.i = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 %indvars.iv.i store i32 %add.i, ptr %arrayidx7.i, align 8, !tbaa !5 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %add.i.1 = add nsw i32 %5, %add.i %arrayidx7.i.1 = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 %indvars.iv.next.i store i32 %add.i.1, ptr %arrayidx7.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %add.i.2 = add nsw i32 %add.i, %add.i.1 %arrayidx7.i.2 = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 %indvars.iv.next.i.1 store i32 %add.i.2, ptr %arrayidx7.i.2, align 8, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %add.i.3 = add nsw i32 %add.i.1, %add.i.2 %arrayidx7.i.3 = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 %indvars.iv.next.i.2 store i32 %add.i.3, ptr %arrayidx7.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %fibonacci.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !9 fibonacci.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %.unr = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.3, %for.body.i ] %.unr3 = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.2, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 2, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %fibonacci.exit, label %for.body.i.epil for.body.i.epil: ; preds = %fibonacci.exit.loopexit.unr-lcssa, %for.body.i.epil %7 = phi i32 [ %add.i.epil, %for.body.i.epil ], [ %.unr, %fibonacci.exit.loopexit.unr-lcssa ] %8 = phi i32 [ %7, %for.body.i.epil ], [ %.unr3, %fibonacci.exit.loopexit.unr-lcssa ] %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %fibonacci.exit.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %fibonacci.exit.loopexit.unr-lcssa ] %add.i.epil = add nsw i32 %8, %7 %arrayidx7.i.epil = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 %indvars.iv.i.epil store i32 %add.i.epil, ptr %arrayidx7.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %fibonacci.exit, label %for.body.i.epil, !llvm.loop !11 fibonacci.exit: ; preds = %fibonacci.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry %idxprom8.i = sext i32 %0 to i64 %arrayidx9.i = getelementptr inbounds [50 x i32], ptr %F.i, i64 0, i64 %idxprom8.i %9 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %F.i) #4 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #3 { entry: %F = alloca [50 x i32], align 16 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %F) #4 store i32 1, ptr %F, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not15 = icmp slt i32 %n, 2 br i1 %cmp.not15, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -2 %2 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %4 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add = add nsw i32 %4, %5 %arrayidx7 = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 %indvars.iv store i32 %add, ptr %arrayidx7, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add.1 = add nsw i32 %add, %4 %arrayidx7.1 = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %add.2 = add nsw i32 %add.1, %add %arrayidx7.2 = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 %indvars.iv.next.1 store i32 %add.2, ptr %arrayidx7.2, align 8, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %add.3 = add nsw i32 %add.2, %add.1 %arrayidx7.3 = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 %indvars.iv.next.2 store i32 %add.3, ptr %arrayidx7.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %.unr20 = phi i32 [ 1, %for.body.preheader ], [ %add.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %6 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %7 = phi i32 [ %6, %for.body.epil ], [ %.unr20, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %6, %7 %arrayidx7.epil = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx7.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !13 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds [50 x i32], ptr %F, i64 0, i64 %idxprom8 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %F) #4 ret i32 %8 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !12}
#include <stdio.h> int F[50]; int fibonacci(int n) { if( n==0 || n==1 ){ F[n] = 1; return F[n]; } if( F[n]!=-1 ) return F[n]; F[n]=fibonacci(n-1)+fibonacci(n-2); return F[n]; } int main() { int n,i; for( i=0 ; i<50 ; i++ ) F[i]=-1; scanf("%d",&n); printf("%d\n",fibonacci(n)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316635/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316635/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @F = dso_local local_unnamed_addr global [50 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #0 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [50 x i32], ptr @F, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret26 if.end: ; preds = %entry %idxprom4 = sext i32 %n to i64 %arrayidx5 = getelementptr inbounds [50 x i32], ptr @F, i64 0, i64 %idxprom4 %0 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %cmp6.not = icmp eq i32 %0, -1 br i1 %cmp6.not, label %if.end10, label %common.ret26 common.ret26: ; preds = %if.end, %if.then, %if.end10 %common.ret26.op = phi i32 [ %add, %if.end10 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret26.op if.end10: ; preds = %if.end %sub = add nsw i32 %n, -1 %call = tail call i32 @fibonacci(i32 noundef %sub) %sub11 = add nsw i32 %n, -2 %call12 = tail call i32 @fibonacci(i32 noundef %sub11) %add = add nsw i32 %call12, %call store i32 %add, ptr %arrayidx5, align 4, !tbaa !5 br label %common.ret26 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) @F, i8 -1, i64 200, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibonacci(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int x[45]; int fibo(int); int main(){ int n,i; for(i=0;i<45;i++){ x[i]=-10; } scanf("%d",&n); printf("%d\n",fibo(n)); return 0; } int fibo(int y){ if(y==1||y==0) return x[y]=1; if(x[y]!=-10) return x[y]; return x[y]=fibo(y-1)+fibo(y-2); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316679/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316679/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @x = dso_local local_unnamed_addr global [45 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr @x, align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 4), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 8), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 12), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 16), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 20), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 24), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 28), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 32), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 36), align 16, !tbaa !5 store <4 x i32> <i32 -10, i32 -10, i32 -10, i32 -10>, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 40), align 16, !tbaa !5 store i32 -10, ptr getelementptr inbounds ([45 x i32], ptr @x, i64 0, i64 44), align 16, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fibo(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fibo(i32 noundef %y) local_unnamed_addr #3 { entry: %or.cond = icmp ult i32 %y, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %y to i64 %arrayidx = getelementptr inbounds [45 x i32], ptr @x, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %y to i64 %arrayidx3 = getelementptr inbounds [45 x i32], ptr @x, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -10 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %y, -1 %call = tail call i32 @fibo(i32 noundef %sub) %sub9 = add nsw i32 %y, -2 %call10 = tail call i32 @fibo(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdlib.h> #include <stdio.h> #define MAX_SIZE 45 static int fib(int n, int *m) { if (!m[n]) { m[n - 2] = fib(n - 2, m); m[n - 1] = fib(n - 1, m); m[n] = m[n - 2] + m[n - 1]; } return m[n]; } int main(int argc, char **argv) { int n, i; int m[MAX_SIZE]; for (i = 0; i < MAX_SIZE; ++i) m[i] = 0; m[0] = m[1] = 1; scanf("%d", &n); printf("%d\n", fib(n, m)); exit(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316721/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316721/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: noreturn nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %m = alloca [45 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 180, ptr nonnull %m) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(180) %m, i8 0, i64 180, i1 false), !tbaa !5 %arrayidx1 = getelementptr inbounds [45 x i32], ptr %m, i64 0, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 store i32 1, ptr %m, align 16, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call3 = call fastcc i32 @fib(i32 noundef %0, ptr noundef nonnull %m) %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call3) call void @exit(i32 noundef 0) #7 unreachable } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define internal fastcc i32 @fib(i32 noundef %n, ptr noundef %m) unnamed_addr #3 { entry: %idxprom = sext i32 %n to i64 %arrayidx = getelementptr inbounds i32, ptr %m, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %tobool.not = icmp eq i32 %0, 0 br i1 %tobool.not, label %if.then, label %common.ret common.ret: ; preds = %entry, %if.then %common.ret.op = phi i32 [ %add, %if.then ], [ %0, %entry ] ret i32 %common.ret.op if.then: ; preds = %entry %sub = add nsw i32 %n, -2 %call = tail call fastcc i32 @fib(i32 noundef %sub, ptr noundef nonnull %m) %idxprom2 = sext i32 %sub to i64 %arrayidx3 = getelementptr inbounds i32, ptr %m, i64 %idxprom2 store i32 %call, ptr %arrayidx3, align 4, !tbaa !5 %sub4 = add nsw i32 %n, -1 %call5 = tail call fastcc i32 @fib(i32 noundef %sub4, ptr noundef nonnull %m) %idxprom7 = sext i32 %sub4 to i64 %arrayidx8 = getelementptr inbounds i32, ptr %m, i64 %idxprom7 store i32 %call5, ptr %arrayidx8, align 4, !tbaa !5 %1 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %add = add nsw i32 %1, %call5 store i32 %add, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret } ; Function Attrs: noreturn nounwind declare void @exit(i32 noundef) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 attributes #0 = { noreturn 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 = { nofree nosync nounwind memory(argmem: readwrite) 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 #4 = { noreturn 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nounwind } attributes #7 = { noreturn 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #define MAX 44 int fibonacci(int n){ int F[MAX],i; F[0]=1; F[1]=1; for(i=2;i<=n;i++) F[i]=F[i-2]+F[i-1]; return F[n]; } int main (){ int n; scanf("%d",&n); printf("%d\n",fibonacci(n)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316765/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316765/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i32 @fibonacci(i32 noundef %n) local_unnamed_addr #0 { entry: %F = alloca [44 x i32], align 16 call void @llvm.lifetime.start.p0(i64 176, ptr nonnull %F) #4 store i32 1, ptr %F, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not15 = icmp slt i32 %n, 2 br i1 %cmp.not15, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -2 %2 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %4 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %5 = phi i32 [ 1, %for.body.preheader.new ], [ %add.2, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %add = add nsw i32 %4, %5 %arrayidx7 = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 %indvars.iv store i32 %add, ptr %arrayidx7, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %add.1 = add nsw i32 %add, %4 %arrayidx7.1 = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %add.2 = add nsw i32 %add.1, %add %arrayidx7.2 = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 %indvars.iv.next.1 store i32 %add.2, ptr %arrayidx7.2, align 8, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %add.3 = add nsw i32 %add.2, %add.1 %arrayidx7.3 = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 %indvars.iv.next.2 store i32 %add.3, ptr %arrayidx7.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %.unr20 = phi i32 [ 1, %for.body.preheader ], [ %add.2, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %6 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %7 = phi i32 [ %6, %for.body.epil ], [ %.unr20, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %add.epil = add nsw i32 %6, %7 %arrayidx7.epil = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx7.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds [44 x i32], ptr %F, i64 0, i64 %idxprom8 %8 = load i32, ptr %arrayidx9, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 176, ptr nonnull %F) #4 ret i32 %8 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %F.i = alloca [44 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 176, ptr nonnull %F.i) #4 store i32 1, ptr %F.i, align 16, !tbaa !5 %arrayidx1.i = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 1 store i32 1, ptr %arrayidx1.i, align 4, !tbaa !5 %cmp.not15.i = icmp slt i32 %0, 2 br i1 %cmp.not15.i, label %fibonacci.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count.i = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count.i, -2 %3 = add nsw i64 %wide.trip.count.i, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %fibonacci.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %2, -4 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %5 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ] %6 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.2, %for.body.i ] %indvars.iv.i = phi i64 [ 2, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %add.i = add nsw i32 %6, %5 %arrayidx7.i = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 %indvars.iv.i store i32 %add.i, ptr %arrayidx7.i, align 8, !tbaa !5 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %add.i.1 = add nsw i32 %5, %add.i %arrayidx7.i.1 = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 %indvars.iv.next.i store i32 %add.i.1, ptr %arrayidx7.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %add.i.2 = add nsw i32 %add.i, %add.i.1 %arrayidx7.i.2 = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 %indvars.iv.next.i.1 store i32 %add.i.2, ptr %arrayidx7.i.2, align 8, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %add.i.3 = add nsw i32 %add.i.1, %add.i.2 %arrayidx7.i.3 = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 %indvars.iv.next.i.2 store i32 %add.i.3, ptr %arrayidx7.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %fibonacci.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !9 fibonacci.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %.unr = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.3, %for.body.i ] %.unr3 = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.2, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 2, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %fibonacci.exit, label %for.body.i.epil for.body.i.epil: ; preds = %fibonacci.exit.loopexit.unr-lcssa, %for.body.i.epil %7 = phi i32 [ %add.i.epil, %for.body.i.epil ], [ %.unr, %fibonacci.exit.loopexit.unr-lcssa ] %8 = phi i32 [ %7, %for.body.i.epil ], [ %.unr3, %fibonacci.exit.loopexit.unr-lcssa ] %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %fibonacci.exit.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %fibonacci.exit.loopexit.unr-lcssa ] %add.i.epil = add nsw i32 %8, %7 %arrayidx7.i.epil = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 %indvars.iv.i.epil store i32 %add.i.epil, ptr %arrayidx7.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %fibonacci.exit, label %for.body.i.epil, !llvm.loop !13 fibonacci.exit: ; preds = %fibonacci.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry %idxprom8.i = sext i32 %0 to i64 %arrayidx9.i = getelementptr inbounds [44 x i32], ptr %F.i, i64 0, i64 %idxprom8.i %9 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5 call void @llvm.lifetime.end.p0(i64 176, ptr nonnull %F.i) #4 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree nosync nounwind memory(none) 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 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 = { 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !12}
#include <stdio.h> int Fibo(int); int c[44]; int main () { int n = 0; scanf("%d",&n); printf("%d\n",Fibo(n)); return 0; } int Fibo(int x) { if(x == 0 || x == 1) return c[x] = 1; if(c[x] != 0) return c[x]; return c[x] = Fibo(x - 1) + Fibo(x - 2); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316815/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316815/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @c = dso_local local_unnamed_addr global [44 x i32] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 store i32 0, ptr %n, align 4, !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @Fibo(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @Fibo(i32 noundef %x) local_unnamed_addr #3 { entry: %or.cond = icmp ult i32 %x, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %x to i64 %arrayidx = getelementptr inbounds [44 x i32], ptr @c, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %x to i64 %arrayidx3 = getelementptr inbounds [44 x i32], ptr @c, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, 0 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %x, -1 %call = tail call i32 @Fibo(i32 noundef %sub) %sub9 = add nsw i32 %x, -2 %call10 = tail call i32 @Fibo(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int dp[50]; int fib(int n){ if(n==0 || n==1) return dp[n]=1; if(dp[n] != -1) return dp[n]; return dp[n] = fib(n-1)+fib(n-2); } int main(){ int n,i; for(i=0 ; i<50 ; i++) dp[i] = -1; scanf("%d",&n); printf("%d\n",fib(n)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316859/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316859/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @dp = dso_local local_unnamed_addr global [50 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fib(i32 noundef %n) local_unnamed_addr #0 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [50 x i32], ptr @dp, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [50 x i32], ptr @dp, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -1 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %n, -1 %call = tail call i32 @fib(i32 noundef %sub) %sub9 = add nsw i32 %n, -2 %call10 = tail call i32 @fib(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) @dp, i8 -1, i64 200, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fib(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int dp[50]; int fib(int ); int main(){ int n,i; for(i=0;i<50;i++) dp[i]=-1; scanf("%d",&n); printf("%d\n",fib(n)); return 0; } int fib(int n){ if(n==0 || n==1) return dp[n]=1; if(dp[n] != -1) return dp[n]; return dp[n] = fib(n-1) + fib(n-2); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316901/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316901/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @dp = dso_local local_unnamed_addr global [50 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) @dp, i8 -1, i64 200, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @fib(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @fib(i32 noundef %n) local_unnamed_addr #3 { entry: %or.cond = icmp ult i32 %n, 2 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds [50 x i32], ptr @dp, i64 0, i64 %idxprom store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %common.ret20 if.end: ; preds = %entry %idxprom2 = sext i32 %n to i64 %arrayidx3 = getelementptr inbounds [50 x i32], ptr @dp, i64 0, i64 %idxprom2 %0 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %cmp4.not = icmp eq i32 %0, -1 br i1 %cmp4.not, label %if.end8, label %common.ret20 common.ret20: ; preds = %if.end, %if.then, %if.end8 %common.ret20.op = phi i32 [ %add, %if.end8 ], [ 1, %if.then ], [ %0, %if.end ] ret i32 %common.ret20.op if.end8: ; preds = %if.end %sub = add nsw i32 %n, -1 %call = tail call i32 @fib(i32 noundef %sub) %sub9 = add nsw i32 %n, -2 %call10 = tail call i32 @fib(i32 noundef %sub9) %add = add nsw i32 %call10, %call store i32 %add, ptr %arrayidx3, align 4, !tbaa !5 br label %common.ret20 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree 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 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> void fibonacchi(int n) { int Fib[50]; int i; Fib[0] = 1; Fib[1] = 1; for (i = 2; i <= n; ++i) { Fib[i] = Fib[i-1] + Fib[i-2]; } printf("%d\n",Fib[n]); } int main() { int n; scanf("%d", &n); fibonacchi(n); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_316945/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_316945/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @fibonacchi(i32 noundef %n) local_unnamed_addr #0 { entry: %Fib = alloca [50 x i32], align 16 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %Fib) #3 store i32 1, ptr %Fib, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 1 store i32 1, ptr %arrayidx1, align 4, !tbaa !5 %cmp.not15 = icmp slt i32 %n, 2 br i1 %cmp.not15, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %1 = add nsw i64 %wide.trip.count, -2 %2 = add nsw i64 %wide.trip.count, -3 %xtraiter = and i64 %1, 3 %3 = icmp ult i64 %2, 3 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %1, -4 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %4 = phi i32 [ 1, %for.body.preheader.new ], [ %add.3, %for.body ] %indvars.iv = phi i64 [ 2, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %5 = add nsw i64 %indvars.iv, -2 %arrayidx5 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %5 %6 = load i32, ptr %arrayidx5, align 8, !tbaa !5 %add = add nsw i32 %6, %4 %arrayidx7 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %indvars.iv store i32 %add, ptr %arrayidx7, align 8, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %7 = add nsw i64 %indvars.iv, -1 %arrayidx5.1 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %7 %8 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5 %add.1 = add nsw i32 %8, %add %arrayidx7.1 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %indvars.iv.next store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx5.2 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %indvars.iv %9 = load i32, ptr %arrayidx5.2, align 8, !tbaa !5 %add.2 = add nsw i32 %9, %add.1 %arrayidx7.2 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %indvars.iv.next.1 store i32 %add.2, ptr %arrayidx7.2, align 8, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %10 = or i64 %indvars.iv, 1 %arrayidx5.3 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %10 %11 = load i32, ptr %arrayidx5.3, align 4, !tbaa !5 %add.3 = add nsw i32 %11, %add.2 %arrayidx7.3 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %indvars.iv.next.2 store i32 %add.3, ptr %arrayidx7.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %niter.next.3 = add nuw i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %.unr = phi i32 [ 1, %for.body.preheader ], [ %add.3, %for.body ] %indvars.iv.unr = phi i64 [ 2, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %12 = phi i32 [ %add.epil, %for.body.epil ], [ %.unr, %for.end.loopexit.unr-lcssa ] %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ] %13 = add nsw i64 %indvars.iv.epil, -2 %arrayidx5.epil = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %13 %14 = load i32, ptr %arrayidx5.epil, align 4, !tbaa !5 %add.epil = add nsw i32 %14, %12 %arrayidx7.epil = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %indvars.iv.epil store i32 %add.epil, ptr %arrayidx7.epil, align 4, !tbaa !5 %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11 for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry %idxprom8 = sext i32 %n to i64 %arrayidx9 = getelementptr inbounds [50 x i32], ptr %Fib, i64 0, i64 %idxprom8 %15 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %15) call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %Fib) #3 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %Fib.i = alloca [50 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %Fib.i) #3 store i32 1, ptr %Fib.i, align 16, !tbaa !5 %arrayidx1.i = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 1 store i32 1, ptr %arrayidx1.i, align 4, !tbaa !5 %cmp.not15.i = icmp slt i32 %0, 2 br i1 %cmp.not15.i, label %fibonacchi.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %entry %1 = add nuw i32 %0, 1 %wide.trip.count.i = zext i32 %1 to i64 %2 = add nsw i64 %wide.trip.count.i, -2 %3 = add nsw i64 %wide.trip.count.i, -3 %xtraiter = and i64 %2, 3 %4 = icmp ult i64 %3, 3 br i1 %4, label %fibonacchi.exit.loopexit.unr-lcssa, label %for.body.preheader.i.new for.body.preheader.i.new: ; preds = %for.body.preheader.i %unroll_iter = and i64 %2, -4 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new %5 = phi i32 [ 1, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ] %indvars.iv.i = phi i64 [ 2, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ] %6 = add nsw i64 %indvars.iv.i, -2 %arrayidx5.i = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %6 %7 = load i32, ptr %arrayidx5.i, align 8, !tbaa !5 %add.i = add nsw i32 %7, %5 %arrayidx7.i = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %indvars.iv.i store i32 %add.i, ptr %arrayidx7.i, align 8, !tbaa !5 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %8 = add nsw i64 %indvars.iv.i, -1 %arrayidx5.i.1 = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %8 %9 = load i32, ptr %arrayidx5.i.1, align 4, !tbaa !5 %add.i.1 = add nsw i32 %9, %add.i %arrayidx7.i.1 = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %indvars.iv.next.i store i32 %add.i.1, ptr %arrayidx7.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %arrayidx5.i.2 = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %indvars.iv.i %10 = load i32, ptr %arrayidx5.i.2, align 8, !tbaa !5 %add.i.2 = add nsw i32 %10, %add.i.1 %arrayidx7.i.2 = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %indvars.iv.next.i.1 store i32 %add.i.2, ptr %arrayidx7.i.2, align 8, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %11 = or i64 %indvars.iv.i, 1 %arrayidx5.i.3 = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %11 %12 = load i32, ptr %arrayidx5.i.3, align 4, !tbaa !5 %add.i.3 = add nsw i32 %12, %add.i.2 %arrayidx7.i.3 = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %indvars.iv.next.i.2 store i32 %add.i.3, ptr %arrayidx7.i.3, align 4, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %niter.next.3 = add nuw i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %fibonacchi.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !9 fibonacchi.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i %.unr = phi i32 [ 1, %for.body.preheader.i ], [ %add.i.3, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 2, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %fibonacchi.exit, label %for.body.i.epil for.body.i.epil: ; preds = %fibonacchi.exit.loopexit.unr-lcssa, %for.body.i.epil %13 = phi i32 [ %add.i.epil, %for.body.i.epil ], [ %.unr, %fibonacchi.exit.loopexit.unr-lcssa ] %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %fibonacchi.exit.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %fibonacchi.exit.loopexit.unr-lcssa ] %14 = add nsw i64 %indvars.iv.i.epil, -2 %arrayidx5.i.epil = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %14 %15 = load i32, ptr %arrayidx5.i.epil, align 4, !tbaa !5 %add.i.epil = add nsw i32 %15, %13 %arrayidx7.i.epil = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %indvars.iv.i.epil store i32 %add.i.epil, ptr %arrayidx7.i.epil, align 4, !tbaa !5 %indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %fibonacchi.exit, label %for.body.i.epil, !llvm.loop !13 fibonacchi.exit: ; preds = %fibonacchi.exit.loopexit.unr-lcssa, %for.body.i.epil, %entry %idxprom8.i = sext i32 %0 to i64 %arrayidx9.i = getelementptr inbounds [50 x i32], ptr %Fib.i, i64 0, i64 %idxprom8.i %16 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %16) call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %Fib.i) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree 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 = { 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 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !12}