Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include<stdio.h> int main() { int n,m,p[1000]; int i,j,x,a; scanf("%d %d",&n,&m); for(i=0;i<n;i++){ scanf("%d",&p[i]); } x=0; for(i=0;i<n-1;i++){ for(j=i+1;j<n;j++){ if(p[i]>p[j]){ x=p[i]; p[i]=p[j]; p[j]=x; } } } a=0; for(i=0;i<m;i++){ a+=p[i]; } printf("%d\n",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178283/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178283/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 %m = alloca i32, align 4 %p = alloca [1000 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 %m) #4 call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %p) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.cond27.preheader for.cond2.preheader: ; preds = %for.body %cmp358 = icmp sgt i32 %2, 1 br i1 %cmp358, label %for.body4.preheader, label %for.cond27.preheader for.body4.preheader: ; preds = %for.cond2.preheader %sub = add nsw i32 %2, -1 %1 = zext i32 %2 to i64 %wide.trip.count74 = zext i32 %sub to i64 %wide.trip.count = zext i32 %2 to i64 br label %for.body4 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000 x i32], ptr %p, 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 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond2.loopexit: ; preds = %for.inc21, %for.body4 %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1 %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74 br i1 %exitcond75.not, label %for.cond27.preheader, label %for.body4, !llvm.loop !11 for.cond27.preheader: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader %4 = load i32, ptr %m, align 4, !tbaa !5 %cmp2860 = icmp sgt i32 %4, 0 br i1 %cmp2860, label %for.body29.preheader, label %for.end35 for.body29.preheader: ; preds = %for.cond27.preheader %wide.trip.count79 = zext i32 %4 to i64 %min.iters.check = icmp ult i32 %4, 8 br i1 %min.iters.check, label %for.body29.preheader85, label %vector.ph vector.ph: ; preds = %for.body29.preheader %n.vec = and i64 %wide.trip.count79, 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 ], [ %7, %vector.body ] %vec.phi83 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %5 = getelementptr inbounds [1000 x i32], ptr %p, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 %wide.load84 = load <4 x i32>, ptr %6, align 16, !tbaa !5 %7 = add <4 x i32> %wide.load, %vec.phi %8 = add <4 x i32> %wide.load84, %vec.phi83 %index.next = add nuw i64 %index, 8 %9 = icmp eq i64 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %8, %7 %10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count79 br i1 %cmp.n, label %for.end35, label %for.body29.preheader85 for.body29.preheader85: ; preds = %for.body29.preheader, %middle.block %indvars.iv76.ph = phi i64 [ 0, %for.body29.preheader ], [ %n.vec, %middle.block ] %a.062.ph = phi i32 [ 0, %for.body29.preheader ], [ %10, %middle.block ] br label %for.body29 for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit %indvars.iv71 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next72, %for.cond2.loopexit ] %indvars.iv66 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next67, %for.cond2.loopexit ] %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1 %cmp656 = icmp ult i64 %indvars.iv.next72, %1 br i1 %cmp656, label %for.body7.lr.ph, label %for.cond2.loopexit for.body7.lr.ph: ; preds = %for.body4 %arrayidx9 = getelementptr inbounds [1000 x i32], ptr %p, i64 0, i64 %indvars.iv71 br label %for.body7 for.body7: ; preds = %for.body7.lr.ph, %for.inc21 %indvars.iv68 = phi i64 [ %indvars.iv66, %for.body7.lr.ph ], [ %indvars.iv.next69, %for.inc21 ] %11 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %arrayidx11 = getelementptr inbounds [1000 x i32], ptr %p, i64 0, i64 %indvars.iv68 %12 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %11, %12 br i1 %cmp12, label %if.then, label %for.inc21 if.then: ; preds = %for.body7 store i32 %12, ptr %arrayidx9, align 4, !tbaa !5 store i32 %11, ptr %arrayidx11, align 4, !tbaa !5 br label %for.inc21 for.inc21: ; preds = %for.body7, %if.then %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1 %exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15 for.body29: ; preds = %for.body29.preheader85, %for.body29 %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body29 ], [ %indvars.iv76.ph, %for.body29.preheader85 ] %a.062 = phi i32 [ %add32, %for.body29 ], [ %a.062.ph, %for.body29.preheader85 ] %arrayidx31 = getelementptr inbounds [1000 x i32], ptr %p, i64 0, i64 %indvars.iv76 %13 = load i32, ptr %arrayidx31, align 4, !tbaa !5 %add32 = add nsw i32 %13, %a.062 %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.end35, label %for.body29, !llvm.loop !16 for.end35: ; preds = %for.body29, %middle.block, %for.cond27.preheader %a.0.lcssa = phi i32 [ 0, %for.cond27.preheader ], [ %10, %middle.block ], [ %add32, %for.body29 ] %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %a.0.lcssa) call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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.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} !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} !16 = distinct !{!16, !10, !14, !13}
#include <stdio.h> signed main(){ int N,K,sum=0; scanf("%d %d",&N,&K); int p[N],i,sa; sa=N-K; for(i=0;i<N;i++){ scanf("%d",&p[i]); } int j,above=0,c=0; int high[1000]={}; for(i=0;i<N;i++){ sum+=p[i]; } for(j=0;j<sa;j++){ c=0; above=0; for(i=0;i<N;i++){ if(p[i]>above){ above=p[i]; } } high[j]=above; for(i=0;i<N;i++){ if(p[i]==above && c==0){ p[i]=0; c++; } } } for(j=0;j<sa;j++){ sum-=high[j]; } printf("%d\n",sum); return(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178326/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178326/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 %K = alloca i32, align 4 %high = alloca [1000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #6 %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 !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 %4 = load i32, ptr %K, align 4, !tbaa !5 %sub = sub i32 %3, %4 %cmp78 = icmp sgt i32 %3, 0 br i1 %cmp78, label %for.body, label %for.cond10.preheader.thread 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.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %5 = load i32, ptr %N, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp = icmp slt i64 %indvars.iv.next, %6 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %high) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %high, i8 0, i64 4000, i1 false) %cmp380 = icmp sgt i32 %5, 0 br i1 %cmp380, label %for.body4.preheader, label %for.cond10.preheader for.body4.preheader: ; preds = %for.end %wide.trip.count = zext i32 %5 to i64 %min.iters.check = icmp ult i32 %5, 8 br i1 %min.iters.check, label %for.body4.preheader212, label %vector.ph vector.ph: ; preds = %for.body4.preheader %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 ], [ %9, %vector.body ] %vec.phi171 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ] %7 = getelementptr inbounds i32, ptr %vla, i64 %index %wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5 %8 = getelementptr inbounds i32, ptr %7, i64 4 %wide.load172 = load <4 x i32>, ptr %8, align 16, !tbaa !5 %9 = add <4 x i32> %wide.load, %vec.phi %10 = add <4 x i32> %wide.load172, %vec.phi171 %index.next = add nuw i64 %index, 8 %11 = icmp eq i64 %index.next, %n.vec br i1 %11, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %10, %9 %12 = 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.cond10.preheader, label %for.body4.preheader212 for.body4.preheader212: ; preds = %for.body4.preheader, %middle.block %indvars.iv119.ph = phi i64 [ 0, %for.body4.preheader ], [ %n.vec, %middle.block ] %sum.081.ph = phi i32 [ 0, %for.body4.preheader ], [ %12, %middle.block ] br label %for.body4 for.cond10.preheader: ; preds = %for.body4, %middle.block, %for.end %sum.0.lcssa = phi i32 [ 0, %for.end ], [ %12, %middle.block ], [ %add, %for.body4 ] %cmp1191 = icmp sgt i32 %sub, 0 br i1 %cmp1191, label %for.cond13.preheader.lr.ph, label %for.end52 for.cond10.preheader.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %high) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %high, i8 0, i64 4000, i1 false) %cmp1191152 = icmp sgt i32 %sub, 0 br i1 %cmp1191152, label %for.cond44.preheader.thread167, label %for.end52 for.cond13.preheader.lr.ph: ; preds = %for.cond10.preheader br i1 %cmp380, label %for.cond13.preheader.us.preheader, label %for.cond44.preheader.thread167 for.cond44.preheader.thread167: ; preds = %for.cond13.preheader.lr.ph, %for.cond10.preheader.thread %sum.0.lcssa156164 = phi i32 [ %sum.0.lcssa, %for.cond13.preheader.lr.ph ], [ 0, %for.cond10.preheader.thread ] %13 = xor i32 %4, -1 %14 = add i32 %3, %13 %15 = zext i32 %14 to i64 %16 = shl nuw nsw i64 %15, 2 %17 = add nuw nsw i64 %16, 4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %high, i8 0, i64 %17, i1 false), !tbaa !5 br label %for.body46.preheader for.cond13.preheader.us.preheader: ; preds = %for.cond13.preheader.lr.ph %wide.trip.count138 = zext i32 %sub to i64 %wide.trip.count128 = zext i32 %5 to i64 %min.iters.check175 = icmp ult i32 %5, 8 %n.vec178 = and i64 %wide.trip.count128, 4294967288 %cmp.n180 = icmp eq i64 %n.vec178, %wide.trip.count128 %xtraiter = and i64 %wide.trip.count128, 1 %18 = icmp eq i32 %5, 1 %unroll_iter = and i64 %wide.trip.count128, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.body15.us.preheader for.body15.us.preheader: ; preds = %for.cond26.for.inc41_crit_edge.us, %for.cond13.preheader.us.preheader %indvars.iv135 = phi i64 [ 0, %for.cond13.preheader.us.preheader ], [ %indvars.iv.next136, %for.cond26.for.inc41_crit_edge.us ] br i1 %min.iters.check175, label %for.body15.us.preheader208, label %vector.body181 vector.body181: ; preds = %for.body15.us.preheader, %vector.body181 %index182 = phi i64 [ %index.next187, %vector.body181 ], [ 0, %for.body15.us.preheader ] %vec.phi183 = phi <4 x i32> [ %21, %vector.body181 ], [ zeroinitializer, %for.body15.us.preheader ] %vec.phi184 = phi <4 x i32> [ %22, %vector.body181 ], [ zeroinitializer, %for.body15.us.preheader ] %19 = getelementptr inbounds i32, ptr %vla, i64 %index182 %wide.load185 = load <4 x i32>, ptr %19, align 16, !tbaa !5 %20 = getelementptr inbounds i32, ptr %19, i64 4 %wide.load186 = load <4 x i32>, ptr %20, align 16, !tbaa !5 %21 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load185, <4 x i32> %vec.phi183) %22 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load186, <4 x i32> %vec.phi184) %index.next187 = add nuw i64 %index182, 8 %23 = icmp eq i64 %index.next187, %n.vec178 br i1 %23, label %middle.block173, label %vector.body181, !llvm.loop !14 middle.block173: ; preds = %vector.body181 %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %21, <4 x i32> %22) %24 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) br i1 %cmp.n180, label %for.end23.us, label %for.body15.us.preheader208 for.body15.us.preheader208: ; preds = %for.body15.us.preheader, %middle.block173 %indvars.iv125.ph = phi i64 [ 0, %for.body15.us.preheader ], [ %n.vec178, %middle.block173 ] %above.086.us.ph = phi i32 [ 0, %for.body15.us.preheader ], [ %24, %middle.block173 ] br label %for.body15.us for.end23.us: ; preds = %for.body15.us, %middle.block173 %spec.select.us.lcssa = phi i32 [ %24, %middle.block173 ], [ %spec.select.us, %for.body15.us ] %arrayidx25.us = getelementptr inbounds [1000 x i32], ptr %high, i64 0, i64 %indvars.iv135 store i32 %spec.select.us.lcssa, ptr %arrayidx25.us, align 4, !tbaa !5 br i1 %18, label %for.cond26.for.inc41_crit_edge.us.unr-lcssa, label %for.body28.us for.body28.us: ; preds = %for.end23.us, %for.inc38.us.1 %indvars.iv130 = phi i64 [ %indvars.iv.next131.1, %for.inc38.us.1 ], [ 0, %for.end23.us ] %c.090.us = phi i32 [ %c.1.us.1, %for.inc38.us.1 ], [ 0, %for.end23.us ] %niter = phi i64 [ %niter.next.1, %for.inc38.us.1 ], [ 0, %for.end23.us ] %arrayidx30.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv130 %25 = load i32, ptr %arrayidx30.us, align 8, !tbaa !5 %cmp31.us = icmp eq i32 %25, %spec.select.us.lcssa %cmp32.us = icmp eq i32 %c.090.us, 0 %or.cond.us = select i1 %cmp31.us, i1 %cmp32.us, i1 false br i1 %or.cond.us, label %if.then33.us, label %for.inc38.us if.then33.us: ; preds = %for.body28.us store i32 0, ptr %arrayidx30.us, align 8, !tbaa !5 br label %for.inc38.us for.inc38.us: ; preds = %if.then33.us, %for.body28.us %c.1.us = phi i32 [ 1, %if.then33.us ], [ %c.090.us, %for.body28.us ] %indvars.iv.next131 = or i64 %indvars.iv130, 1 %arrayidx30.us.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next131 %26 = load i32, ptr %arrayidx30.us.1, align 4, !tbaa !5 %cmp31.us.1 = icmp eq i32 %26, %spec.select.us.lcssa %cmp32.us.1 = icmp eq i32 %c.1.us, 0 %or.cond.us.1 = select i1 %cmp31.us.1, i1 %cmp32.us.1, i1 false br i1 %or.cond.us.1, label %if.then33.us.1, label %for.inc38.us.1 if.then33.us.1: ; preds = %for.inc38.us store i32 0, ptr %arrayidx30.us.1, align 4, !tbaa !5 br label %for.inc38.us.1 for.inc38.us.1: ; preds = %if.then33.us.1, %for.inc38.us %c.1.us.1 = phi i32 [ 1, %if.then33.us.1 ], [ %c.1.us, %for.inc38.us ] %indvars.iv.next131.1 = add nuw nsw i64 %indvars.iv130, 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.cond26.for.inc41_crit_edge.us.unr-lcssa, label %for.body28.us, !llvm.loop !15 for.body15.us: ; preds = %for.body15.us.preheader208, %for.body15.us %indvars.iv125 = phi i64 [ %indvars.iv.next126, %for.body15.us ], [ %indvars.iv125.ph, %for.body15.us.preheader208 ] %above.086.us = phi i32 [ %spec.select.us, %for.body15.us ], [ %above.086.us.ph, %for.body15.us.preheader208 ] %arrayidx17.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv125 %27 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5 %spec.select.us = call i32 @llvm.smax.i32(i32 %27, i32 %above.086.us) %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1 %exitcond129.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count128 br i1 %exitcond129.not, label %for.end23.us, label %for.body15.us, !llvm.loop !16 for.cond26.for.inc41_crit_edge.us.unr-lcssa: ; preds = %for.inc38.us.1, %for.end23.us %indvars.iv130.unr = phi i64 [ 0, %for.end23.us ], [ %indvars.iv.next131.1, %for.inc38.us.1 ] %c.090.us.unr = phi i32 [ 0, %for.end23.us ], [ %c.1.us.1, %for.inc38.us.1 ] br i1 %lcmp.mod.not, label %for.cond26.for.inc41_crit_edge.us, label %for.body28.us.epil for.body28.us.epil: ; preds = %for.cond26.for.inc41_crit_edge.us.unr-lcssa %arrayidx30.us.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv130.unr %28 = load i32, ptr %arrayidx30.us.epil, align 4, !tbaa !5 %cmp31.us.epil = icmp eq i32 %28, %spec.select.us.lcssa %cmp32.us.epil = icmp eq i32 %c.090.us.unr, 0 %or.cond.us.epil = select i1 %cmp31.us.epil, i1 %cmp32.us.epil, i1 false br i1 %or.cond.us.epil, label %if.then33.us.epil, label %for.cond26.for.inc41_crit_edge.us if.then33.us.epil: ; preds = %for.body28.us.epil store i32 0, ptr %arrayidx30.us.epil, align 4, !tbaa !5 br label %for.cond26.for.inc41_crit_edge.us for.cond26.for.inc41_crit_edge.us: ; preds = %for.body28.us.epil, %if.then33.us.epil, %for.cond26.for.inc41_crit_edge.us.unr-lcssa %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1 %exitcond139.not = icmp eq i64 %indvars.iv.next136, %wide.trip.count138 br i1 %exitcond139.not, label %for.body46.preheader, label %for.body15.us.preheader, !llvm.loop !17 for.body4: ; preds = %for.body4.preheader212, %for.body4 %indvars.iv119 = phi i64 [ %indvars.iv.next120, %for.body4 ], [ %indvars.iv119.ph, %for.body4.preheader212 ] %sum.081 = phi i32 [ %add, %for.body4 ], [ %sum.081.ph, %for.body4.preheader212 ] %arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv119 %29 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %add = add nsw i32 %29, %sum.081 %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1 %exitcond.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count br i1 %exitcond.not, label %for.cond10.preheader, label %for.body4, !llvm.loop !18 for.body46.preheader: ; preds = %for.cond26.for.inc41_crit_edge.us, %for.cond44.preheader.thread167 %sum.0.lcssa155170 = phi i32 [ %sum.0.lcssa156164, %for.cond44.preheader.thread167 ], [ %sum.0.lcssa, %for.cond26.for.inc41_crit_edge.us ] %wide.trip.count143 = zext i32 %sub to i64 %min.iters.check191 = icmp ult i32 %sub, 8 br i1 %min.iters.check191, label %for.body46.preheader206, label %vector.ph192 vector.ph192: ; preds = %for.body46.preheader %n.vec194 = and i64 %wide.trip.count143, 4294967288 %30 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.0.lcssa155170, i64 0 br label %vector.body197 vector.body197: ; preds = %vector.body197, %vector.ph192 %index198 = phi i64 [ 0, %vector.ph192 ], [ %index.next203, %vector.body197 ] %vec.phi199 = phi <4 x i32> [ %30, %vector.ph192 ], [ %33, %vector.body197 ] %vec.phi200 = phi <4 x i32> [ zeroinitializer, %vector.ph192 ], [ %34, %vector.body197 ] %31 = getelementptr inbounds [1000 x i32], ptr %high, i64 0, i64 %index198 %wide.load201 = load <4 x i32>, ptr %31, align 16, !tbaa !5 %32 = getelementptr inbounds i32, ptr %31, i64 4 %wide.load202 = load <4 x i32>, ptr %32, align 16, !tbaa !5 %33 = sub <4 x i32> %vec.phi199, %wide.load201 %34 = sub <4 x i32> %vec.phi200, %wide.load202 %index.next203 = add nuw i64 %index198, 8 %35 = icmp eq i64 %index.next203, %n.vec194 br i1 %35, label %middle.block189, label %vector.body197, !llvm.loop !19 middle.block189: ; preds = %vector.body197 %bin.rdx204 = add <4 x i32> %34, %33 %36 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx204) %cmp.n196 = icmp eq i64 %n.vec194, %wide.trip.count143 br i1 %cmp.n196, label %for.end52, label %for.body46.preheader206 for.body46.preheader206: ; preds = %for.body46.preheader, %middle.block189 %indvars.iv140.ph = phi i64 [ 0, %for.body46.preheader ], [ %n.vec194, %middle.block189 ] %sum.1113.ph = phi i32 [ %sum.0.lcssa155170, %for.body46.preheader ], [ %36, %middle.block189 ] br label %for.body46 for.body46: ; preds = %for.body46.preheader206, %for.body46 %indvars.iv140 = phi i64 [ %indvars.iv.next141, %for.body46 ], [ %indvars.iv140.ph, %for.body46.preheader206 ] %sum.1113 = phi i32 [ %sub49, %for.body46 ], [ %sum.1113.ph, %for.body46.preheader206 ] %arrayidx48 = getelementptr inbounds [1000 x i32], ptr %high, i64 0, i64 %indvars.iv140 %37 = load i32, ptr %arrayidx48, align 4, !tbaa !5 %sub49 = sub nsw i32 %sum.1113, %37 %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 %for.end52, label %for.body46, !llvm.loop !20 for.end52: ; preds = %for.body46, %middle.block189, %for.cond10.preheader, %for.cond10.preheader.thread %sum.1.lcssa = phi i32 [ %sum.0.lcssa, %for.cond10.preheader ], [ 0, %for.cond10.preheader.thread ], [ %36, %middle.block189 ], [ %sub49, %for.body46 ] %call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.1.lcssa) call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %high) #6 call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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: 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: 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) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #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 = { 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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10, !12, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !12, !13} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10, !13, !12} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10, !13, !12} !19 = distinct !{!19, !10, !12, !13} !20 = distinct !{!20, !10, !13, !12}
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { signed long long int n,s=0,k; scanf("%lld",&n); k=n/2050; while(k>0) { s+=k%10; k/=10; } if(n%2050>0 && n%2050<2050) s=-1; printf("%lld\n",s); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17837/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17837/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 [5 x i8] c"%lld\00", align 1 @.str.2 = 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: %t = alloca i32, align 4 %n = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec17 = add nsw i32 %0, -1 store i32 %dec17, ptr %t, align 4, !tbaa !5 %tobool.not18 = icmp eq i32 %0, 0 br i1 %tobool.not18, label %while.end10, label %while.body while.body: ; preds = %entry, %while.end call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %1 = load i64, ptr %n, align 8, !tbaa !9 %cmp14 = icmp sgt i64 %1, 2049 br i1 %cmp14, label %while.body3.preheader, label %while.end while.body3.preheader: ; preds = %while.body %div19 = udiv i64 %1, 2050 br label %while.body3 while.body3: ; preds = %while.body3.preheader, %while.body3 %k.016 = phi i64 [ %div4, %while.body3 ], [ %div19, %while.body3.preheader ] %s.015 = phi i64 [ %add, %while.body3 ], [ 0, %while.body3.preheader ] %rem = urem i64 %k.016, 10 %add = add nuw nsw i64 %rem, %s.015 %div4 = udiv i64 %k.016, 10 %cmp.not = icmp ult i64 %k.016, 10 br i1 %cmp.not, label %while.end, label %while.body3, !llvm.loop !11 while.end: ; preds = %while.body3, %while.body %s.0.lcssa = phi i64 [ 0, %while.body ], [ %add, %while.body3 ] %rem5 = srem i64 %1, 2050 %cmp6 = icmp sgt i64 %rem5, 0 %s.1 = select i1 %cmp6, i64 -1, i64 %s.0.lcssa %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %s.1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3 %2 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %2, 0 br i1 %tobool.not, label %while.end10, label %while.body, !llvm.loop !13 while.end10: ; preds = %while.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 = !{!10, !10, i64 0} !10 = !{!"long long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12}
#include <stdio.h> #include <string.h> #define RANGE 1001 void customSort(int arr[], int n) { int freq[RANGE]; memset(freq, 0, sizeof(freq)); for (int i = 0; i < n; i++) freq[arr[i]]++; int k = 0; for (int i = 0; i < RANGE; i++) { while (freq[i]--) arr[k++] = i; } } int main() { int N, K; scanf("%d %d", &N, &K); int arr[N]; for(int i = 0; i < N; ++i) scanf("%d", &arr[i]); int n = sizeof(arr) / sizeof(arr[0]); customSort(arr, n); long long int sum = 0; for (int i = 0; i < K; i++) { sum += arr[i]; } printf("%lld\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178412/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178412/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 [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @customSort(ptr nocapture noundef %arr, i32 noundef %n) local_unnamed_addr #0 { entry: %freq = alloca [1001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %freq) #7 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %freq, i8 0, i64 4004, i1 false) %cmp23 = icmp sgt i32 %n, 0 br i1 %cmp23, label %for.body.preheader, label %while.cond.preheader.preheader for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %xtraiter = and i64 %wide.trip.count, 3 %0 = icmp ult i32 %n, 4 br i1 %0, label %while.cond.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, 4294967292 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.3, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ] %arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %idxprom1 = sext i32 %1 to i64 %arrayidx2 = getelementptr inbounds [1001 x i32], ptr %freq, i64 0, i64 %idxprom1 %2 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %inc = add nsw i32 %2, 1 store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.next %3 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %idxprom1.1 = sext i32 %3 to i64 %arrayidx2.1 = getelementptr inbounds [1001 x i32], ptr %freq, i64 0, i64 %idxprom1.1 %4 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5 %inc.1 = add nsw i32 %4, 1 store i32 %inc.1, ptr %arrayidx2.1, align 4, !tbaa !5 %indvars.iv.next.1 = or i64 %indvars.iv, 2 %arrayidx.2 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.next.1 %5 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %idxprom1.2 = sext i32 %5 to i64 %arrayidx2.2 = getelementptr inbounds [1001 x i32], ptr %freq, i64 0, i64 %idxprom1.2 %6 = load i32, ptr %arrayidx2.2, align 4, !tbaa !5 %inc.2 = add nsw i32 %6, 1 store i32 %inc.2, ptr %arrayidx2.2, align 4, !tbaa !5 %indvars.iv.next.2 = or i64 %indvars.iv, 3 %arrayidx.3 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.next.2 %7 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %idxprom1.3 = sext i32 %7 to i64 %arrayidx2.3 = getelementptr inbounds [1001 x i32], ptr %freq, i64 0, i64 %idxprom1.3 %8 = load i32, ptr %arrayidx2.3, align 4, !tbaa !5 %inc.3 = add nsw i32 %8, 1 store i32 %inc.3, ptr %arrayidx2.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 %while.cond.preheader.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !9 while.cond.preheader.preheader.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %while.cond.preheader.preheader, label %for.body.epil for.body.epil: ; preds = %while.cond.preheader.preheader.loopexit.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %while.cond.preheader.preheader.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %while.cond.preheader.preheader.loopexit.unr-lcssa ] %arrayidx.epil = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv.epil %9 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5 %idxprom1.epil = sext i32 %9 to i64 %arrayidx2.epil = getelementptr inbounds [1001 x i32], ptr %freq, i64 0, i64 %idxprom1.epil %10 = load i32, ptr %arrayidx2.epil, align 4, !tbaa !5 %inc.epil = add nsw i32 %10, 1 store i32 %inc.epil, ptr %arrayidx2.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 %while.cond.preheader.preheader, label %for.body.epil, !llvm.loop !11 while.cond.preheader.preheader: ; preds = %while.cond.preheader.preheader.loopexit.unr-lcssa, %for.body.epil, %entry br label %while.cond.preheader while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.inc14 %indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.inc14 ], [ 0, %while.cond.preheader.preheader ] %k.031 = phi i32 [ %k.1.lcssa, %for.inc14 ], [ 0, %while.cond.preheader.preheader ] %arrayidx10 = getelementptr inbounds [1001 x i32], ptr %freq, i64 0, i64 %indvars.iv38 %arrayidx10.promoted = load i32, ptr %arrayidx10, align 4, !tbaa !5 %tobool.not27 = icmp eq i32 %arrayidx10.promoted, 0 br i1 %tobool.not27, label %for.inc14, label %while.body.preheader while.body.preheader: ; preds = %while.cond.preheader %11 = sext i32 %k.031 to i64 %12 = trunc i64 %indvars.iv38 to i32 %13 = zext i32 %arrayidx10.promoted to i64 %min.iters.check = icmp ult i32 %arrayidx10.promoted, 8 br i1 %min.iters.check, label %while.body.preheader44, label %vector.ph vector.ph: ; preds = %while.body.preheader %n.vec = and i64 %13, 4294967288 %ind.end = add nsw i64 %n.vec, %11 %.cast = trunc i64 %n.vec to i32 %ind.end42 = sub i32 %arrayidx10.promoted, %.cast %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %12, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %invariant.gep = getelementptr i32, ptr %arr, i64 %11 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %gep = getelementptr i32, ptr %invariant.gep, i64 %index store <4 x i32> %broadcast.splat, ptr %gep, align 4, !tbaa !5 %14 = getelementptr inbounds i32, ptr %gep, i64 4 store <4 x i32> %broadcast.splat, ptr %14, align 4, !tbaa !5 %index.next = add nuw i64 %index, 8 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %13 br i1 %cmp.n, label %for.inc14.loopexit, label %while.body.preheader44 while.body.preheader44: ; preds = %while.body.preheader, %middle.block %indvars.iv35.ph = phi i64 [ %11, %while.body.preheader ], [ %ind.end, %middle.block ] %dec29.in.ph = phi i32 [ %arrayidx10.promoted, %while.body.preheader ], [ %ind.end42, %middle.block ] br label %while.body for.cond.cleanup7: ; preds = %for.inc14 call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %freq) #7 ret void while.body: ; preds = %while.body.preheader44, %while.body %indvars.iv35 = phi i64 [ %indvars.iv.next36, %while.body ], [ %indvars.iv35.ph, %while.body.preheader44 ] %dec29.in = phi i32 [ %dec29, %while.body ], [ %dec29.in.ph, %while.body.preheader44 ] %dec29 = add nsw i32 %dec29.in, -1 %indvars.iv.next36 = add nsw i64 %indvars.iv35, 1 %arrayidx13 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv35 store i32 %12, ptr %arrayidx13, align 4, !tbaa !5 %tobool.not = icmp eq i32 %dec29, 0 br i1 %tobool.not, label %for.inc14.loopexit, label %while.body, !llvm.loop !16 for.inc14.loopexit: ; preds = %while.body, %middle.block %indvars.iv.next36.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next36, %while.body ] %16 = trunc i64 %indvars.iv.next36.lcssa to i32 br label %for.inc14 for.inc14: ; preds = %for.inc14.loopexit, %while.cond.preheader %k.1.lcssa = phi i32 [ %k.031, %while.cond.preheader ], [ %16, %for.inc14.loopexit ] store i32 -1, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1 %exitcond41.not = icmp eq i64 %indvars.iv.next39, 1001 br i1 %exitcond41.not, label %for.cond.cleanup7, label %while.cond.preheader, !llvm.loop !17 } ; 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: %freq.i = alloca [1001 x i32], align 16 %N = alloca i32, align 4 %K = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7 call void @llvm.lifetime.start.p0(i64 4, 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 !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 %cmp20 = icmp sgt i32 %3, 0 br i1 %cmp20, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %freq.i) #7 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %freq.i, i8 0, i64 4004, i1 false) %cmp23.i = icmp sgt i32 %0, 0 br i1 %cmp23.i, label %for.body.i.preheader, label %while.cond.preheader.i.preheader for.body.i.preheader: ; preds = %for.cond.cleanup %xtraiter = and i64 %1, 3 %4 = icmp ult i32 %0, 4 br i1 %4, label %while.cond.preheader.i.preheader.loopexit.unr-lcssa, label %for.body.i.preheader.new for.body.i.preheader.new: ; preds = %for.body.i.preheader %unroll_iter = and i64 %1, 4294967292 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new %indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.3, %for.body.i ] %niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.3, %for.body.i ] %arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i %5 = load i32, ptr %arrayidx.i, align 16, !tbaa !5 %idxprom1.i = sext i32 %5 to i64 %arrayidx2.i = getelementptr inbounds [1001 x i32], ptr %freq.i, i64 0, i64 %idxprom1.i %6 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5 %inc.i = add nsw i32 %6, 1 store i32 %inc.i, ptr %arrayidx2.i, align 4, !tbaa !5 %indvars.iv.next.i = or i64 %indvars.iv.i, 1 %arrayidx.i.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i %7 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5 %idxprom1.i.1 = sext i32 %7 to i64 %arrayidx2.i.1 = getelementptr inbounds [1001 x i32], ptr %freq.i, i64 0, i64 %idxprom1.i.1 %8 = load i32, ptr %arrayidx2.i.1, align 4, !tbaa !5 %inc.i.1 = add nsw i32 %8, 1 store i32 %inc.i.1, ptr %arrayidx2.i.1, align 4, !tbaa !5 %indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2 %arrayidx.i.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i.1 %9 = load i32, ptr %arrayidx.i.2, align 8, !tbaa !5 %idxprom1.i.2 = sext i32 %9 to i64 %arrayidx2.i.2 = getelementptr inbounds [1001 x i32], ptr %freq.i, i64 0, i64 %idxprom1.i.2 %10 = load i32, ptr %arrayidx2.i.2, align 4, !tbaa !5 %inc.i.2 = add nsw i32 %10, 1 store i32 %inc.i.2, ptr %arrayidx2.i.2, align 4, !tbaa !5 %indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3 %arrayidx.i.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i.2 %11 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5 %idxprom1.i.3 = sext i32 %11 to i64 %arrayidx2.i.3 = getelementptr inbounds [1001 x i32], ptr %freq.i, i64 0, i64 %idxprom1.i.3 %12 = load i32, ptr %arrayidx2.i.3, align 4, !tbaa !5 %inc.i.3 = add nsw i32 %12, 1 store i32 %inc.i.3, ptr %arrayidx2.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 %while.cond.preheader.i.preheader.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !9 while.cond.preheader.i.preheader.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader %indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.3, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %while.cond.preheader.i.preheader, label %for.body.i.epil for.body.i.epil: ; preds = %while.cond.preheader.i.preheader.loopexit.unr-lcssa, %for.body.i.epil %indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %while.cond.preheader.i.preheader.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %while.cond.preheader.i.preheader.loopexit.unr-lcssa ] %arrayidx.i.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i.epil %13 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !5 %idxprom1.i.epil = sext i32 %13 to i64 %arrayidx2.i.epil = getelementptr inbounds [1001 x i32], ptr %freq.i, i64 0, i64 %idxprom1.i.epil %14 = load i32, ptr %arrayidx2.i.epil, align 4, !tbaa !5 %inc.i.epil = add nsw i32 %14, 1 store i32 %inc.i.epil, ptr %arrayidx2.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 %while.cond.preheader.i.preheader, label %for.body.i.epil, !llvm.loop !18 while.cond.preheader.i.preheader: ; preds = %while.cond.preheader.i.preheader.loopexit.unr-lcssa, %for.body.i.epil, %for.cond.cleanup br label %while.cond.preheader.i while.cond.preheader.i: ; preds = %while.cond.preheader.i.preheader, %for.inc14.i %indvars.iv38.i = phi i64 [ %indvars.iv.next39.i, %for.inc14.i ], [ 0, %while.cond.preheader.i.preheader ] %k.031.i = phi i32 [ %k.1.lcssa.i, %for.inc14.i ], [ 0, %while.cond.preheader.i.preheader ] %arrayidx10.i = getelementptr inbounds [1001 x i32], ptr %freq.i, i64 0, i64 %indvars.iv38.i %arrayidx10.promoted.i = load i32, ptr %arrayidx10.i, align 4, !tbaa !5 %tobool.not27.i = icmp eq i32 %arrayidx10.promoted.i, 0 br i1 %tobool.not27.i, label %for.inc14.i, label %while.body.preheader.i while.body.preheader.i: ; preds = %while.cond.preheader.i %15 = sext i32 %k.031.i to i64 %16 = trunc i64 %indvars.iv38.i to i32 %17 = zext i32 %arrayidx10.promoted.i to i64 %min.iters.check = icmp ult i32 %arrayidx10.promoted.i, 8 br i1 %min.iters.check, label %while.body.i.preheader, label %vector.ph vector.ph: ; preds = %while.body.preheader.i %n.vec = and i64 %17, 4294967288 %ind.end = add nsw i64 %n.vec, %15 %.cast = trunc i64 %n.vec to i32 %ind.end29 = sub i32 %arrayidx10.promoted.i, %.cast %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %16, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %invariant.gep = getelementptr i32, ptr %vla, i64 %15 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %gep = getelementptr i32, ptr %invariant.gep, i64 %index store <4 x i32> %broadcast.splat, ptr %gep, align 4, !tbaa !5 %18 = getelementptr inbounds i32, ptr %gep, i64 4 store <4 x i32> %broadcast.splat, ptr %18, align 4, !tbaa !5 %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 !19 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %17 br i1 %cmp.n, label %for.inc14.loopexit.i, label %while.body.i.preheader while.body.i.preheader: ; preds = %while.body.preheader.i, %middle.block %indvars.iv35.i.ph = phi i64 [ %15, %while.body.preheader.i ], [ %ind.end, %middle.block ] %dec29.in.i.ph = phi i32 [ %arrayidx10.promoted.i, %while.body.preheader.i ], [ %ind.end29, %middle.block ] br label %while.body.i while.body.i: ; preds = %while.body.i.preheader, %while.body.i %indvars.iv35.i = phi i64 [ %indvars.iv.next36.i, %while.body.i ], [ %indvars.iv35.i.ph, %while.body.i.preheader ] %dec29.in.i = phi i32 [ %dec29.i, %while.body.i ], [ %dec29.in.i.ph, %while.body.i.preheader ] %dec29.i = add nsw i32 %dec29.in.i, -1 %indvars.iv.next36.i = add nsw i64 %indvars.iv35.i, 1 %arrayidx13.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv35.i store i32 %16, ptr %arrayidx13.i, align 4, !tbaa !5 %tobool.not.i = icmp eq i32 %dec29.i, 0 br i1 %tobool.not.i, label %for.inc14.loopexit.i, label %while.body.i, !llvm.loop !20 for.inc14.loopexit.i: ; preds = %while.body.i, %middle.block %indvars.iv.next36.i.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next36.i, %while.body.i ] %20 = trunc i64 %indvars.iv.next36.i.lcssa to i32 br label %for.inc14.i for.inc14.i: ; preds = %for.inc14.loopexit.i, %while.cond.preheader.i %k.1.lcssa.i = phi i32 [ %k.031.i, %while.cond.preheader.i ], [ %20, %for.inc14.loopexit.i ] store i32 -1, ptr %arrayidx10.i, align 4, !tbaa !5 %indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1 %exitcond41.not.i = icmp eq i64 %indvars.iv.next39.i, 1001 br i1 %exitcond41.not.i, label %customSort.exit, label %while.cond.preheader.i, !llvm.loop !17 customSort.exit: ; preds = %for.inc14.i call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %freq.i) #7 %21 = load i32, ptr %K, align 4, !tbaa !5 %cmp422 = icmp sgt i32 %21, 0 br i1 %cmp422, label %for.body7.preheader, label %for.cond.cleanup6 for.body7.preheader: ; preds = %customSort.exit %wide.trip.count = zext i32 %21 to i64 %min.iters.check33 = icmp ult i32 %21, 4 br i1 %min.iters.check33, label %for.body7.preheader44, label %vector.ph34 vector.ph34: ; preds = %for.body7.preheader %n.vec36 = and i64 %wide.trip.count, 4294967292 br label %vector.body39 vector.body39: ; preds = %vector.body39, %vector.ph34 %index40 = phi i64 [ 0, %vector.ph34 ], [ %index.next43, %vector.body39 ] %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph34 ], [ %26, %vector.body39 ] %vec.phi41 = phi <2 x i64> [ zeroinitializer, %vector.ph34 ], [ %27, %vector.body39 ] %22 = getelementptr inbounds i32, ptr %vla, i64 %index40 %wide.load = load <2 x i32>, ptr %22, align 16, !tbaa !5 %23 = getelementptr inbounds i32, ptr %22, i64 2 %wide.load42 = load <2 x i32>, ptr %23, align 8, !tbaa !5 %24 = sext <2 x i32> %wide.load to <2 x i64> %25 = sext <2 x i32> %wide.load42 to <2 x i64> %26 = add <2 x i64> %vec.phi, %24 %27 = add <2 x i64> %vec.phi41, %25 %index.next43 = add nuw i64 %index40, 4 %28 = icmp eq i64 %index.next43, %n.vec36 br i1 %28, label %middle.block31, label %vector.body39, !llvm.loop !21 middle.block31: ; preds = %vector.body39 %bin.rdx = add <2 x i64> %27, %26 %29 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n38 = icmp eq i64 %n.vec36, %wide.trip.count br i1 %cmp.n38, label %for.cond.cleanup6, label %for.body7.preheader44 for.body7.preheader44: ; preds = %for.body7.preheader, %middle.block31 %indvars.iv26.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec36, %middle.block31 ] %sum.023.ph = phi i64 [ 0, %for.body7.preheader ], [ %29, %middle.block31 ] br label %for.body7 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.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %30 = load i32, ptr %N, align 4, !tbaa !5 %31 = sext i32 %30 to i64 %cmp = icmp slt i64 %indvars.iv.next, %31 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !22 for.cond.cleanup6: ; preds = %for.body7, %middle.block31, %customSort.exit %sum.0.lcssa = phi i64 [ 0, %customSort.exit ], [ %29, %middle.block31 ], [ %add, %for.body7 ] %call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7 ret i32 0 for.body7: ; preds = %for.body7.preheader44, %for.body7 %indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.body7 ], [ %indvars.iv26.ph, %for.body7.preheader44 ] %sum.023 = phi i64 [ %add, %for.body7 ], [ %sum.023.ph, %for.body7.preheader44 ] %arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv26 %32 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %conv10 = sext i32 %32 to i64 %add = add nsw i64 %sum.023, %conv10 %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1 %exitcond.not = icmp eq i64 %indvars.iv.next27, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !23 } ; 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 declare ptr @llvm.stacksave.p0() #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6 attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { 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, !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, !12} !19 = distinct !{!19, !10, !14, !15} !20 = distinct !{!20, !10, !15, !14} !21 = distinct !{!21, !10, !14, !15} !22 = distinct !{!22, !10} !23 = distinct !{!23, !10, !15, !14}
#include<stdio.h> int main(){ int N, K, p[1001]; int i, j; int tmp, ans = 0; scanf("%d %d", &N, &K); for(i = 0; i < N; ++i){ scanf("%d", &p[i]); } for(i = 0; i < N; ++i){ for(j = i +1; j < N; ++j){ if(p[i] > p[j]){ tmp = p[i]; p[i] = p[j]; p[j] = tmp; } } } for(i = 0; i < K; ++i){ ans = ans +p[i]; } printf("%d", ans); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178463/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178463/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: %N = alloca i32, align 4 %K = alloca i32, align 4 %p = alloca [1001 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 %K) #4 call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %p) #4 %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 !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.cond27.preheader for.cond2.preheader: ; preds = %for.body %cmp358 = icmp sgt i32 %2, 0 br i1 %cmp358, label %for.body4.preheader, label %for.cond27.preheader for.body4.preheader: ; preds = %for.cond2.preheader %1 = zext i32 %2 to i64 %wide.trip.count74 = zext i32 %2 to i64 br label %for.body4 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1001 x i32], ptr %p, 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 %2 = load i32, ptr %N, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond2.loopexit: ; preds = %for.inc21, %for.body4 %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1 %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74 br i1 %exitcond75.not, label %for.cond27.preheader, label %for.body4, !llvm.loop !11 for.cond27.preheader: ; preds = %for.cond2.loopexit, %entry, %for.cond2.preheader %4 = load i32, ptr %K, align 4, !tbaa !5 %cmp2860 = icmp sgt i32 %4, 0 br i1 %cmp2860, label %for.body29.preheader, label %for.end35 for.body29.preheader: ; preds = %for.cond27.preheader %wide.trip.count79 = zext i32 %4 to i64 %min.iters.check = icmp ult i32 %4, 8 br i1 %min.iters.check, label %for.body29.preheader85, label %vector.ph vector.ph: ; preds = %for.body29.preheader %n.vec = and i64 %wide.trip.count79, 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 ], [ %7, %vector.body ] %vec.phi83 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %5 = getelementptr inbounds [1001 x i32], ptr %p, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 %wide.load84 = load <4 x i32>, ptr %6, align 16, !tbaa !5 %7 = add <4 x i32> %wide.load, %vec.phi %8 = add <4 x i32> %wide.load84, %vec.phi83 %index.next = add nuw i64 %index, 8 %9 = icmp eq i64 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %8, %7 %10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count79 br i1 %cmp.n, label %for.end35, label %for.body29.preheader85 for.body29.preheader85: ; preds = %for.body29.preheader, %middle.block %indvars.iv76.ph = phi i64 [ 0, %for.body29.preheader ], [ %n.vec, %middle.block ] %ans.062.ph = phi i32 [ 0, %for.body29.preheader ], [ %10, %middle.block ] br label %for.body29 for.body4: ; preds = %for.body4.preheader, %for.cond2.loopexit %indvars.iv71 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next72, %for.cond2.loopexit ] %indvars.iv66 = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next67, %for.cond2.loopexit ] %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1 %cmp656 = icmp ult i64 %indvars.iv.next72, %1 br i1 %cmp656, label %for.body7.lr.ph, label %for.cond2.loopexit for.body7.lr.ph: ; preds = %for.body4 %arrayidx9 = getelementptr inbounds [1001 x i32], ptr %p, i64 0, i64 %indvars.iv71 br label %for.body7 for.body7: ; preds = %for.body7.lr.ph, %for.inc21 %indvars.iv68 = phi i64 [ %indvars.iv66, %for.body7.lr.ph ], [ %indvars.iv.next69, %for.inc21 ] %11 = load i32, ptr %arrayidx9, align 4, !tbaa !5 %arrayidx11 = getelementptr inbounds [1001 x i32], ptr %p, i64 0, i64 %indvars.iv68 %12 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %11, %12 br i1 %cmp12, label %if.then, label %for.inc21 if.then: ; preds = %for.body7 store i32 %12, ptr %arrayidx9, align 4, !tbaa !5 store i32 %11, ptr %arrayidx11, align 4, !tbaa !5 br label %for.inc21 for.inc21: ; preds = %for.body7, %if.then %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1 %exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count74 br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body7, !llvm.loop !15 for.body29: ; preds = %for.body29.preheader85, %for.body29 %indvars.iv76 = phi i64 [ %indvars.iv.next77, %for.body29 ], [ %indvars.iv76.ph, %for.body29.preheader85 ] %ans.062 = phi i32 [ %add32, %for.body29 ], [ %ans.062.ph, %for.body29.preheader85 ] %arrayidx31 = getelementptr inbounds [1001 x i32], ptr %p, i64 0, i64 %indvars.iv76 %13 = load i32, ptr %arrayidx31, align 4, !tbaa !5 %add32 = add nsw i32 %13, %ans.062 %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.end35, label %for.body29, !llvm.loop !16 for.end35: ; preds = %for.body29, %middle.block, %for.cond27.preheader %ans.0.lcssa = phi i32 [ 0, %for.cond27.preheader ], [ %10, %middle.block ], [ %add32, %for.body29 ] %call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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.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} !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} !16 = distinct !{!16, !10, !14, !13}
#include <stdio.h> #include <stdlib.h> int compare_int(const void *a, const void *b){ return *(int*)a - *(int*)b; } int main(void){ int n, k; int *p; int sum = 0; scanf("%d", &n); scanf("%d", &k); p = (int *)malloc(sizeof(int) * n); for(int i=0; i<n; i++){ scanf("%d", &p[i]); } qsort(p, n, sizeof(int), compare_int); for(int j=0; j<k; j++){ sum += p[j]; } printf("%d\n", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178506/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178506/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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #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: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7 %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 %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %conv = sext i32 %0 to i64 %mul = shl nsw i64 %conv, 2 %call2 = call noalias ptr @malloc(i64 noundef %mul) #8 %cmp24 = icmp sgt i32 %0, 0 br i1 %cmp24, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %conv5.pre-phi = phi i64 [ %conv, %entry ], [ %9, %for.body ] call void @qsort(ptr noundef %call2, i64 noundef %conv5.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_int) #7 %1 = load i32, ptr %k, align 4, !tbaa !5 %cmp726 = icmp sgt i32 %1, 0 br i1 %cmp726, label %for.body10.preheader, label %for.cond.cleanup9 for.body10.preheader: ; preds = %for.cond.cleanup %wide.trip.count = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %1, 8 br i1 %min.iters.check, label %for.body10.preheader37, label %vector.ph vector.ph: ; preds = %for.body10.preheader %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 ], [ %4, %vector.body ] %vec.phi35 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ] %2 = getelementptr inbounds i32, ptr %call2, i64 %index %wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 %wide.load36 = load <4 x i32>, ptr %3, align 4, !tbaa !5 %4 = add <4 x i32> %wide.load, %vec.phi %5 = add <4 x i32> %wide.load36, %vec.phi35 %index.next = add nuw i64 %index, 8 %6 = icmp eq i64 %index.next, %n.vec br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %5, %4 %7 = 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.cond.cleanup9, label %for.body10.preheader37 for.body10.preheader37: ; preds = %for.body10.preheader, %middle.block %indvars.iv32.ph = phi i64 [ 0, %for.body10.preheader ], [ %n.vec, %middle.block ] %sum.027.ph = phi i32 [ 0, %for.body10.preheader ], [ %7, %middle.block ] br label %for.body10 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %8 = load i32, ptr %n, align 4, !tbaa !5 %9 = sext i32 %8 to i64 %cmp = icmp slt i64 %indvars.iv.next, %9 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13 for.cond.cleanup9: ; preds = %for.body10, %middle.block, %for.cond.cleanup %sum.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %7, %middle.block ], [ %add, %for.body10 ] %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 for.body10: ; preds = %for.body10.preheader37, %for.body10 %indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.body10 ], [ %indvars.iv32.ph, %for.body10.preheader37 ] %sum.027 = phi i32 [ %add, %for.body10 ], [ %sum.027.ph, %for.body10.preheader37 ] %arrayidx12 = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv32 %10 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %add = add nsw i32 %10, %sum.027 %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %exitcond.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup9, label %for.body10, !llvm.loop !14 } ; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 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) #2 ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5 ; 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.vector.reduce.add.v4i32(<4 x i32>) #6 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 = { 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 = { 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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11}
#include<stdio.h> int fun(long long int n) { int sum=0; while(n!=0) { sum=sum+n%10; n=n/10; } return sum; } int main() { int t; long long int n,ans; scanf("%d",&t); while(t--) { int count=0; scanf("%lld",&n); if(n%2050!=0) printf("-1\n"); else { ans=n/2050; count=fun(ans); printf("%d\n",count); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17855/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17855/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 [5 x i8] c"%lld\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @fun(i64 noundef %n) local_unnamed_addr #0 { entry: %cmp.not5 = icmp eq i64 %n, 0 br i1 %cmp.not5, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %sum.07 = phi i32 [ %conv1, %while.body ], [ 0, %entry ] %n.addr.06 = phi i64 [ %div, %while.body ], [ %n, %entry ] %rem = srem i64 %n.addr.06, 10 %0 = trunc i64 %rem to i32 %conv1 = add i32 %sum.07, %0 %div = sdiv i64 %n.addr.06, 10 %n.addr.06.off = add i64 %n.addr.06, 9 %cmp.not = icmp ult i64 %n.addr.06.off, 19 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %while.body, %entry %sum.0.lcssa = phi i32 [ 0, %entry ], [ %conv1, %while.body ] ret i32 %sum.0.lcssa } ; 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: %t = alloca i32, align 4 %n = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !7 %dec5 = add nsw i32 %0, -1 store i32 %dec5, ptr %t, align 4, !tbaa !7 %tobool.not6 = icmp eq i32 %0, 0 br i1 %tobool.not6, label %while.end, label %while.body while.body: ; preds = %entry, %if.end %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %1 = load i64, ptr %n, align 8, !tbaa !11 %rem = srem i64 %1, 2050 %div = sdiv i64 %1, 2050 %cmp.not = icmp eq i64 %rem, 0 br i1 %cmp.not, label %if.else, label %if.then if.then: ; preds = %while.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end if.else: ; preds = %while.body %.off = add i64 %1, 2049 %cmp.not5.i = icmp ult i64 %.off, 4099 br i1 %cmp.not5.i, label %fun.exit, label %while.body.i while.body.i: ; preds = %if.else, %while.body.i %sum.07.i = phi i32 [ %conv1.i, %while.body.i ], [ 0, %if.else ] %n.addr.06.i = phi i64 [ %div.i, %while.body.i ], [ %div, %if.else ] %rem.i = srem i64 %n.addr.06.i, 10 %2 = trunc i64 %rem.i to i32 %conv1.i = add i32 %sum.07.i, %2 %div.i = sdiv i64 %n.addr.06.i, 10 %n.addr.06.off.i = add nsw i64 %n.addr.06.i, 9 %cmp.not.i = icmp ult i64 %n.addr.06.off.i, 19 br i1 %cmp.not.i, label %fun.exit, label %while.body.i, !llvm.loop !5 fun.exit: ; preds = %while.body.i, %if.else %sum.0.lcssa.i = phi i32 [ 0, %if.else ], [ %conv1.i, %while.body.i ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sum.0.lcssa.i) br label %if.end if.end: ; preds = %fun.exit, %if.then %3 = load i32, ptr %t, align 4, !tbaa !7 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %t, align 4, !tbaa !7 %tobool.not = icmp eq i32 %3, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13 while.end: ; preds = %if.end, %entry call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { 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 #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 = { nofree nounwind } 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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"int", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"} !11 = !{!12, !12, i64 0} !12 = !{!"long long", !9, i64 0} !13 = distinct !{!13, !6}
#include <stdio.h> #include <stdlib.h> int main () { int min = 0; int n; int i; scanf("%d", &n); for (i = 0; i < n; i++) { int a; scanf("%d", &a); if (a - min > 15) { printf("%d\n", min + 15); return 0; } min = a; } min = min + 15; min = (min > 90) ? 90 : min; printf("%d\n", min); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17860/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17860/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 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 %cmp20 = icmp sgt i32 %0, 0 br i1 %cmp20, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.022 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %min.021 = phi i32 [ %1, %for.inc ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i32, ptr %a, align 4, !tbaa !5 %sub = sub nsw i32 %1, %min.021 %cmp2 = icmp slt i32 %sub, 16 br i1 %cmp2, label %for.inc, label %cleanup cleanup: ; preds = %for.body %add = add nsw i32 %min.021, 15 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 br label %cleanup7 for.inc: ; preds = %for.body call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 %inc = add nuw nsw i32 %i.022, 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.inc, %entry %min.0.lcssa = phi i32 [ 0, %entry ], [ %1, %for.inc ] %3 = call i32 @llvm.smin.i32(i32 %min.0.lcssa, i32 75) %cond = add nsw i32 %3, 15 %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond) br label %cleanup7 cleanup7: ; preds = %cleanup, %for.end 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> int main() { int M; scanf("%d",&M); if(M>=1&&M<=23) { printf("%d",48-M); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178650/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178650/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: %M = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M) %0 = load i32, ptr %M, align 4 %1 = add i32 %0, -1 %or.cond = icmp ult i32 %1, 23 br i1 %or.cond, label %if.then, label %if.end if.then: ; preds = %entry %sub = sub nuw nsw i32 48, %0 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub) br label %if.end if.end: ; preds = %if.then, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #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)"}
#include <stdio.h> #include <string.h> char t1[1000]; char t2[100]; char t3[100]; int main(){ int n; int a,b; int i,j; char t; scanf("%s",&t1); scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",&t3); if(strcmp(t3,"replace")==0){ scanf("%d %d %s",&a,&b,&t2); for(j=0;j<b-a+1;j++){ t1[a+j]=t2[j]; } } else if(strcmp(t3,"reverse")==0){ scanf("%d %d",&a,&b); for(;a<b;){ t=t1[a]; t1[a]=t1[b]; t1[b]=t; a++; b--; } } else if(strcmp(t3,"print")==0){ scanf("%d %d",&a,&b); for(j=a;j<b+1;j++){ printf("%c",t1[j]); } printf("\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178931/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178931/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"%s\00", align 1 @t1 = dso_local global [1000 x i8] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @t3 = dso_local global [100 x i8] zeroinitializer, align 16 @.str.3 = private unnamed_addr constant [9 x i8] c"%d %d %s\00", align 1 @t2 = dso_local global [100 x i8] zeroinitializer, align 16 @.str.5 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.6 = private unnamed_addr constant [6 x i8] c"print\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 i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t1) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp73 = icmp sgt i32 %0, 0 br i1 %cmp73, label %for.body, label %for.end49 for.body: ; preds = %entry, %for.inc47 %i.074 = phi i32 [ %inc48, %for.inc47 ], [ 0, %entry ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t3) %lhsv = load i64, ptr @t3, align 16 switch i64 %lhsv, label %if.else29 [ i64 28538242730059122, label %if.then i64 28555907813500274, label %if.then14 ] if.then: ; preds = %for.body %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull @t2) %1 = load i32, ptr %b, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4, !tbaa !5 %cmp7.not69 = icmp slt i32 %1, %2 br i1 %cmp7.not69, label %for.inc47, label %for.body8.preheader for.body8.preheader: ; preds = %if.then %3 = sext i32 %2 to i64 %scevgep = getelementptr i8, ptr @t1, i64 %3 %4 = add i32 %1, 1 %5 = sub i32 %4, %2 %6 = zext i32 %5 to i64 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %scevgep, ptr nonnull align 16 @t2, i64 %6, i1 false), !tbaa !9 br label %for.inc47 if.then14: ; preds = %for.body %call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %a, ptr noundef nonnull %b) %a.promoted = load i32, ptr %a, align 4, !tbaa !5 %b.promoted = load i32, ptr %b, align 4, !tbaa !5 %cmp1766 = icmp slt i32 %a.promoted, %b.promoted br i1 %cmp1766, label %for.body18.preheader, label %for.inc47 for.body18.preheader: ; preds = %if.then14 %7 = sext i32 %a.promoted to i64 %8 = sext i32 %b.promoted to i64 br label %for.body18 for.body18: ; preds = %for.body18.preheader, %for.body18 %indvars.iv75 = phi i64 [ %8, %for.body18.preheader ], [ %indvars.iv.next76, %for.body18 ] %indvars.iv = phi i64 [ %7, %for.body18.preheader ], [ %indvars.iv.next, %for.body18 ] %arrayidx20 = getelementptr inbounds [1000 x i8], ptr @t1, i64 0, i64 %indvars.iv %9 = load i8, ptr %arrayidx20, align 1, !tbaa !9 %arrayidx22 = getelementptr inbounds [1000 x i8], ptr @t1, i64 0, i64 %indvars.iv75 %10 = load i8, ptr %arrayidx22, align 1, !tbaa !9 store i8 %10, ptr %arrayidx20, align 1, !tbaa !9 store i8 %9, ptr %arrayidx22, align 1, !tbaa !9 %indvars.iv.next = add nsw i64 %indvars.iv, 1 %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1 %cmp17 = icmp slt i64 %indvars.iv.next, %indvars.iv.next76 br i1 %cmp17, label %for.body18, label %for.cond16.for.inc47.loopexit63_crit_edge, !llvm.loop !10 if.else29: ; preds = %for.body %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) @t3, ptr noundef nonnull dereferenceable(6) @.str.6, i64 6) %cmp31 = icmp eq i32 %bcmp, 0 br i1 %cmp31, label %if.then32, label %for.inc47 if.then32: ; preds = %if.else29 %call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %a, ptr noundef nonnull %b) %11 = load i32, ptr %a, align 4, !tbaa !5 %12 = load i32, ptr %b, align 4, !tbaa !5 %cmp36.not71 = icmp sgt i32 %11, %12 br i1 %cmp36.not71, label %for.end43, label %for.body37.preheader for.body37.preheader: ; preds = %if.then32 %13 = sext i32 %11 to i64 br label %for.body37 for.body37: ; preds = %for.body37.preheader, %for.body37 %indvars.iv84 = phi i64 [ %13, %for.body37.preheader ], [ %indvars.iv.next85, %for.body37 ] %arrayidx39 = getelementptr inbounds [1000 x i8], ptr @t1, i64 0, i64 %indvars.iv84 %14 = load i8, ptr %arrayidx39, align 1, !tbaa !9 %conv = sext i8 %14 to i32 %putchar62 = call i32 @putchar(i32 %conv) %indvars.iv.next85 = add nsw i64 %indvars.iv84, 1 %15 = load i32, ptr %b, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp36.not.not = icmp slt i64 %indvars.iv84, %16 br i1 %cmp36.not.not, label %for.body37, label %for.end43, !llvm.loop !12 for.end43: ; preds = %for.body37, %if.then32 %putchar = call i32 @putchar(i32 10) br label %for.inc47 for.cond16.for.inc47.loopexit63_crit_edge: ; preds = %for.body18 %17 = trunc i64 %indvars.iv.next76 to i32 %18 = trunc i64 %indvars.iv.next to i32 store i32 %18, ptr %a, align 4, !tbaa !5 store i32 %17, ptr %b, align 4, !tbaa !5 br label %for.inc47 for.inc47: ; preds = %for.body8.preheader, %if.then14, %for.cond16.for.inc47.loopexit63_crit_edge, %if.then, %if.else29, %for.end43 %inc48 = add nuw nsw i32 %i.074, 1 %19 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc48, %19 br i1 %cmp, label %for.body, label %for.end49, !llvm.loop !13 for.end49: ; preds = %for.inc47, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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: 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 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 ; Function Attrs: 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) #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 = { nofree nounwind willreturn memory(argmem: read) } attributes #4 = { nofree nounwind } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 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}
#include<stdio.h> int main() { int x[100],t,i,flag=0; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d",&x[i]); } if(x[0]<=15) { for(i=0;i<t-1;i++) { if(x[i]+15<x[i+1]) { break; } } if(x[i]+15>=90) { printf("90"); } else printf("%d",x[i]+15); } else printf("15"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17899/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17899/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"90\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"15\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca [100 x i32], align 16 %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp39 = icmp sgt i32 %0, 0 br i1 %cmp39, label %for.body, label %if.else28 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %x, 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 %t, 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 %x, align 16, !tbaa !5 %cmp3 = icmp slt i32 %.pre, 16 br i1 %cmp3, label %for.cond4.preheader, label %if.else28 for.cond4.preheader: ; preds = %for.end %3 = call i32 @llvm.smax.i32(i32 %1, i32 1) %smax = add nsw i32 %3, -1 %wide.trip.count = zext i32 %smax to i64 br label %for.cond4 for.cond4: ; preds = %for.cond4.preheader, %for.body6 %4 = phi i32 [ %.pre, %for.cond4.preheader ], [ %5, %for.body6 ] %indvars.iv43 = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next44, %for.body6 ] %exitcond.not = icmp eq i64 %indvars.iv43, %wide.trip.count br i1 %exitcond.not, label %for.end16, label %for.body6 for.body6: ; preds = %for.cond4 %add = add nsw i32 %4, 15 %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv.next44 %5 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp slt i32 %add, %5 br i1 %cmp12, label %for.body6.for.end16_crit_edge, label %for.cond4, !llvm.loop !11 for.body6.for.end16_crit_edge: ; preds = %for.body6 %.pre46 = and i64 %indvars.iv43, 4294967295 br label %for.end16 for.end16: ; preds = %for.cond4, %for.body6.for.end16_crit_edge %idxprom17.pre-phi = phi i64 [ %.pre46, %for.body6.for.end16_crit_edge ], [ %wide.trip.count, %for.cond4 ] %arrayidx18 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %idxprom17.pre-phi %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %cmp20 = icmp sgt i32 %6, 74 br i1 %cmp20, label %if.then21, label %if.else if.then21: ; preds = %for.end16 %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1) br label %if.end30 if.else: ; preds = %for.end16 %add19 = add nsw i32 %6, 15 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add19) br label %if.end30 if.else28: ; preds = %entry, %for.end %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end30 if.end30: ; preds = %if.then21, %if.else, %if.else28 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.end.p0(i64 400, 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: 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 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 <string.h> #define BUFLEN 1000 void ord_print(char *str, int start, int end) { int i; for (i = start; i <= end; i++) { printf("%c", *(str + i)); } printf("\n"); } void ord_reverse(char *str, int start, int end) { int i; char tmp[BUFLEN]; for (i = 0; i < end - start + 1; i++) tmp[i] = *(str + end - i); for (i = 0; i < end - start + 1; i++) *(str + start + i) = tmp[i]; } void ord_replace(char *str, int start, int end, char *p) { int i; for (i = 0; i < end - start + 1; i++) *(str + start + i) = *(p + i); } int main(void) { int q, i, start, end; char str[BUFLEN], ord[BUFLEN], p[BUFLEN]; scanf("%s", str); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%s", ord); if (strcmp(ord, "print") == 0) { scanf("%d %d", &start, &end); ord_print(str, start, end); } else if (strcmp(ord, "reverse") == 0) { scanf("%d %d", &start, &end); ord_reverse(str, start, end); } else if (strcmp(ord, "replace") == 0) { scanf("%d %d %s", &start, &end, p); ord_replace(str, start, end, p); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179046/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179046/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.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.4 = private unnamed_addr constant [6 x i8] c"print\00", align 1 @.str.5 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.8 = private unnamed_addr constant [9 x i8] c"%d %d %s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @ord_print(ptr nocapture noundef readonly %str, i32 noundef %start, i32 noundef %end) local_unnamed_addr #0 { entry: %cmp.not5 = icmp sgt i32 %start, %end br i1 %cmp.not5, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %0 = sext i32 %start to i64 %1 = add i32 %end, 1 br label %for.body for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %add.ptr = getelementptr inbounds i8, ptr %str, i64 %indvars.iv %2 = load i8, ptr %add.ptr, align 1, !tbaa !5 %conv = sext i8 %2 to i32 %putchar4 = tail call i32 @putchar(i32 %conv) %indvars.iv.next = add nsw i64 %indvars.iv, 1 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 %exitcond.not = icmp eq i32 %1, %lftr.wideiv br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8 for.end: ; preds = %for.body, %entry %putchar = tail call i32 @putchar(i32 10) 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(argmem: readwrite) uwtable define dso_local void @ord_reverse(ptr nocapture noundef %str, i32 noundef %start, i32 noundef %end) local_unnamed_addr #2 { entry: %tmp = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %tmp) #8 %cmp.not29 = icmp slt i32 %end, %start br i1 %cmp.not29, label %for.end16, label %iter.check iter.check: ; preds = %entry %idx.ext = sext i32 %end to i64 %add.ptr = getelementptr inbounds i8, ptr %str, i64 %idx.ext %0 = add i32 %end, 1 %1 = sub i32 %0, %start %wide.trip.count = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %1, 8 br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check37 = icmp ult i32 %1, 32 br i1 %min.iters.check37, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %wide.trip.count, 4294967264 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %2 = sub nsw i64 0, %index %3 = getelementptr inbounds i8, ptr %add.ptr, i64 %2 %4 = getelementptr inbounds i8, ptr %3, i64 -15 %wide.load = load <16 x i8>, ptr %4, align 1, !tbaa !5 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %5 = getelementptr inbounds i8, ptr %3, i64 -31 %wide.load38 = load <16 x i8>, ptr %5, align 1, !tbaa !5 %reverse39 = shufflevector <16 x i8> %wide.load38, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %6 = getelementptr inbounds [1000 x i8], ptr %tmp, i64 0, i64 %index store <16 x i8> %reverse, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds i8, ptr %6, i64 16 store <16 x i8> %reverse39, ptr %7, align 16, !tbaa !5 %index.next = add nuw i64 %index, 32 %8 = icmp eq i64 %index.next, %n.vec br i1 %8, label %middle.block, label %vector.body, !llvm.loop !10 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond3.preheader, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %n.vec.remaining = and i64 %wide.trip.count, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec41 = and i64 %wide.trip.count, 4294967288 %invariant.gep = getelementptr i8, ptr %add.ptr, i64 -7 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index43 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next46, %vec.epilog.vector.body ] %9 = sub nsw i64 0, %index43 %gep = getelementptr i8, ptr %invariant.gep, i64 %9 %wide.load44 = load <8 x i8>, ptr %gep, align 1, !tbaa !5 %reverse45 = shufflevector <8 x i8> %wide.load44, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %10 = getelementptr inbounds [1000 x i8], ptr %tmp, i64 0, i64 %index43 store <8 x i8> %reverse45, ptr %10, align 8, !tbaa !5 %index.next46 = add nuw i64 %index43, 8 %11 = icmp eq i64 %index.next46, %n.vec41 br i1 %11, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !13 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n42 = icmp eq i64 %n.vec41, %wide.trip.count br i1 %cmp.n42, label %for.cond3.preheader, label %for.body.preheader for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec41, %vec.epilog.middle.block ] br label %for.body for.cond3.preheader: ; preds = %for.body, %vec.epilog.middle.block, %middle.block br i1 %cmp.not29, label %for.end16, label %for.body7.lr.ph for.body7.lr.ph: ; preds = %for.cond3.preheader %idx.ext10 = sext i32 %start to i64 %add.ptr11 = getelementptr inbounds i8, ptr %str, i64 %idx.ext10 %12 = add i32 %end, 1 %13 = sub i32 %12, %start %14 = zext i32 %13 to i64 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %add.ptr11, ptr nonnull align 16 %tmp, i64 %14, i1 false), !tbaa !5 br label %for.end16 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ] %idx.neg = sub nsw i64 0, %indvars.iv %add.ptr2 = getelementptr inbounds i8, ptr %add.ptr, i64 %idx.neg %15 = load i8, ptr %add.ptr2, align 1, !tbaa !5 %arrayidx = getelementptr inbounds [1000 x i8], ptr %tmp, i64 0, i64 %indvars.iv store i8 %15, ptr %arrayidx, align 1, !tbaa !5 %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.cond3.preheader, label %for.body, !llvm.loop !14 for.end16: ; preds = %entry, %for.body7.lr.ph, %for.cond3.preheader call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %tmp) #8 ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @ord_replace(ptr nocapture noundef writeonly %str, i32 noundef %start, i32 noundef %end, ptr nocapture noundef readonly %p) local_unnamed_addr #3 { entry: %p13 = ptrtoint ptr %p to i64 %str12 = ptrtoint ptr %str to i64 %cmp.not9 = icmp slt i32 %end, %start br i1 %cmp.not9, label %for.end, label %iter.check iter.check: ; preds = %entry %idx.ext1 = sext i32 %start to i64 %add.ptr2 = getelementptr inbounds i8, ptr %str, i64 %idx.ext1 %0 = add i32 %end, 1 %1 = sub i32 %0, %start %wide.trip.count = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %1, 8 br i1 %min.iters.check, label %for.body.preheader, label %vector.memcheck vector.memcheck: ; preds = %iter.check %2 = add i64 %str12, %idx.ext1 %3 = sub i64 %2, %p13 %diff.check = icmp ult i64 %3, 32 br i1 %diff.check, label %for.body.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.memcheck %min.iters.check14 = icmp ult i32 %1, 32 br i1 %min.iters.check14, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %wide.trip.count, 4294967264 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %4 = getelementptr inbounds i8, ptr %p, i64 %index %wide.load = load <16 x i8>, ptr %4, align 1, !tbaa !5 %5 = getelementptr inbounds i8, ptr %4, i64 16 %wide.load15 = load <16 x i8>, ptr %5, align 1, !tbaa !5 %6 = getelementptr inbounds i8, ptr %add.ptr2, i64 %index store <16 x i8> %wide.load, ptr %6, align 1, !tbaa !5 %7 = getelementptr inbounds i8, ptr %6, i64 16 store <16 x i8> %wide.load15, ptr %7, align 1, !tbaa !5 %index.next = add nuw i64 %index, 32 %8 = icmp eq i64 %index.next, %n.vec br i1 %8, label %middle.block, label %vector.body, !llvm.loop !15 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %n.vec.remaining = and i64 %wide.trip.count, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec17 = and i64 %wide.trip.count, 4294967288 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index19 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next21, %vec.epilog.vector.body ] %9 = getelementptr inbounds i8, ptr %p, i64 %index19 %wide.load20 = load <8 x i8>, ptr %9, align 1, !tbaa !5 %10 = getelementptr inbounds i8, ptr %add.ptr2, i64 %index19 store <8 x i8> %wide.load20, ptr %10, align 1, !tbaa !5 %index.next21 = add nuw i64 %index19, 8 %11 = icmp eq i64 %index.next21, %n.vec17 br i1 %11, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !16 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n18 = icmp eq i64 %n.vec17, %wide.trip.count br i1 %cmp.n18, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %vector.memcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec17, %vec.epilog.middle.block ] %12 = xor i64 %indvars.iv.ph, -1 %13 = add nsw i64 %12, %wide.trip.count %xtraiter = and i64 %wide.trip.count, 3 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol for.body.prol: ; preds = %for.body.preheader, %for.body.prol %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ] %add.ptr.prol = getelementptr inbounds i8, ptr %p, i64 %indvars.iv.prol %14 = load i8, ptr %add.ptr.prol, align 1, !tbaa !5 %add.ptr4.prol = getelementptr inbounds i8, ptr %add.ptr2, i64 %indvars.iv.prol store i8 %14, ptr %add.ptr4.prol, align 1, !tbaa !5 %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1 %prol.iter.next = add i64 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !17 for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ] %15 = icmp ult i64 %13, 3 br i1 %15, label %for.end, label %for.body for.body: ; preds = %for.body.prol.loopexit, %for.body %indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ] %add.ptr = getelementptr inbounds i8, ptr %p, i64 %indvars.iv %16 = load i8, ptr %add.ptr, align 1, !tbaa !5 %add.ptr4 = getelementptr inbounds i8, ptr %add.ptr2, i64 %indvars.iv store i8 %16, ptr %add.ptr4, align 1, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %add.ptr.1 = getelementptr inbounds i8, ptr %p, i64 %indvars.iv.next %17 = load i8, ptr %add.ptr.1, align 1, !tbaa !5 %add.ptr4.1 = getelementptr inbounds i8, ptr %add.ptr2, i64 %indvars.iv.next store i8 %17, ptr %add.ptr4.1, align 1, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %add.ptr.2 = getelementptr inbounds i8, ptr %p, i64 %indvars.iv.next.1 %18 = load i8, ptr %add.ptr.2, align 1, !tbaa !5 %add.ptr4.2 = getelementptr inbounds i8, ptr %add.ptr2, i64 %indvars.iv.next.1 store i8 %18, ptr %add.ptr4.2, align 1, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %add.ptr.3 = getelementptr inbounds i8, ptr %p, i64 %indvars.iv.next.2 %19 = load i8, ptr %add.ptr.3, align 1, !tbaa !5 %add.ptr4.3 = getelementptr inbounds i8, ptr %add.ptr2, i64 %indvars.iv.next.2 store i8 %19, ptr %add.ptr4.3, align 1, !tbaa !5 %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4 %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !19 for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %tmp.i = alloca [1000 x i8], align 16 %q = alloca i32, align 4 %start = alloca i32, align 4 %end = alloca i32, align 4 %str = alloca [1000 x i8], align 16 %ord = alloca [1000 x i8], align 16 %p = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %start) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %end) #8 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %str) #8 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %ord) #8 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %p) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %str) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %q) %0 = load i32, ptr %q, align 4, !tbaa !20 %cmp45 = icmp sgt i32 %0, 0 br i1 %cmp45, label %for.body, label %for.end for.body: ; preds = %entry, %for.inc %i.046 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %ord) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %ord, ptr noundef nonnull dereferenceable(6) @.str.4, i64 6) %cmp6 = icmp eq i32 %bcmp, 0 br i1 %cmp6, label %if.then, label %if.else if.then: ; preds = %for.body %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %start, ptr noundef nonnull %end) %1 = load i32, ptr %start, align 4, !tbaa !20 %2 = load i32, ptr %end, align 4, !tbaa !20 %cmp.not5.i = icmp sgt i32 %1, %2 br i1 %cmp.not5.i, label %ord_print.exit, label %for.body.preheader.i for.body.preheader.i: ; preds = %if.then %3 = sext i32 %1 to i64 %4 = add i32 %2, 1 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i = phi i64 [ %3, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ] %add.ptr.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i %5 = load i8, ptr %add.ptr.i, align 1, !tbaa !5 %conv.i = sext i8 %5 to i32 %putchar4.i = call i32 @putchar(i32 %conv.i) %indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1 %lftr.wideiv.i = trunc i64 %indvars.iv.next.i to i32 %exitcond.not.i = icmp eq i32 %4, %lftr.wideiv.i br i1 %exitcond.not.i, label %ord_print.exit, label %for.body.i, !llvm.loop !8 ord_print.exit: ; preds = %for.body.i, %if.then %putchar.i = call i32 @putchar(i32 10) br label %for.inc if.else: ; preds = %for.body %lhsv = load i64, ptr %ord, align 16 switch i64 %lhsv, label %for.inc [ i64 28555907813500274, label %if.then12 i64 28538242730059122, label %if.then19 ] if.then12: ; preds = %if.else %call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %start, ptr noundef nonnull %end) %6 = load i32, ptr %start, align 4, !tbaa !20 %7 = load i32, ptr %end, align 4, !tbaa !20 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %tmp.i) #8 %cmp.not29.i = icmp slt i32 %7, %6 br i1 %cmp.not29.i, label %ord_reverse.exit, label %iter.check iter.check: ; preds = %if.then12 %idx.ext.i = sext i32 %7 to i64 %add.ptr.i31 = getelementptr inbounds i8, ptr %str, i64 %idx.ext.i %reass.sub47 = sub i32 %7, %6 %8 = add i32 %reass.sub47, 1 %wide.trip.count.i = zext i32 %8 to i64 %min.iters.check = icmp ult i32 %8, 8 br i1 %min.iters.check, label %for.body.i32.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check48 = icmp ult i32 %8, 32 br i1 %min.iters.check48, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %wide.trip.count.i, 4294967264 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %9 = sub nsw i64 0, %index %10 = getelementptr inbounds i8, ptr %add.ptr.i31, i64 %9 %11 = getelementptr inbounds i8, ptr %10, i64 -15 %wide.load = load <16 x i8>, ptr %11, align 1, !tbaa !5 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %12 = getelementptr inbounds i8, ptr %10, i64 -31 %wide.load49 = load <16 x i8>, ptr %12, align 1, !tbaa !5 %reverse50 = shufflevector <16 x i8> %wide.load49, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %13 = getelementptr inbounds [1000 x i8], ptr %tmp.i, i64 0, i64 %index store <16 x i8> %reverse, ptr %13, align 16, !tbaa !5 %14 = getelementptr inbounds i8, ptr %13, i64 16 store <16 x i8> %reverse50, ptr %14, align 16, !tbaa !5 %index.next = add nuw i64 %index, 32 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !22 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i br i1 %cmp.n, label %for.body7.lr.ph.i, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %n.vec.remaining = and i64 %wide.trip.count.i, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body.i32.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec52 = and i64 %wide.trip.count.i, 4294967288 %invariant.gep = getelementptr i8, ptr %add.ptr.i31, i64 -7 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index54 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next57, %vec.epilog.vector.body ] %16 = sub nsw i64 0, %index54 %gep = getelementptr i8, ptr %invariant.gep, i64 %16 %wide.load55 = load <8 x i8>, ptr %gep, align 1, !tbaa !5 %reverse56 = shufflevector <8 x i8> %wide.load55, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %17 = getelementptr inbounds [1000 x i8], ptr %tmp.i, i64 0, i64 %index54 store <8 x i8> %reverse56, ptr %17, align 8, !tbaa !5 %index.next57 = add nuw i64 %index54, 8 %18 = icmp eq i64 %index.next57, %n.vec52 br i1 %18, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !23 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n53 = icmp eq i64 %n.vec52, %wide.trip.count.i br i1 %cmp.n53, label %for.body7.lr.ph.i, label %for.body.i32.preheader for.body.i32.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.i33.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec52, %vec.epilog.middle.block ] br label %for.body.i32 for.body7.lr.ph.i: ; preds = %for.body.i32, %vec.epilog.middle.block, %middle.block %idx.ext10.i = sext i32 %6 to i64 %add.ptr11.i = getelementptr inbounds i8, ptr %str, i64 %idx.ext10.i call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %add.ptr11.i, ptr nonnull align 16 %tmp.i, i64 %wide.trip.count.i, i1 false), !tbaa !5 br label %ord_reverse.exit for.body.i32: ; preds = %for.body.i32.preheader, %for.body.i32 %indvars.iv.i33 = phi i64 [ %indvars.iv.next.i34, %for.body.i32 ], [ %indvars.iv.i33.ph, %for.body.i32.preheader ] %idx.neg.i = sub nsw i64 0, %indvars.iv.i33 %add.ptr2.i = getelementptr inbounds i8, ptr %add.ptr.i31, i64 %idx.neg.i %19 = load i8, ptr %add.ptr2.i, align 1, !tbaa !5 %arrayidx.i = getelementptr inbounds [1000 x i8], ptr %tmp.i, i64 0, i64 %indvars.iv.i33 store i8 %19, ptr %arrayidx.i, align 1, !tbaa !5 %indvars.iv.next.i34 = add nuw nsw i64 %indvars.iv.i33, 1 %exitcond.not.i35 = icmp eq i64 %indvars.iv.next.i34, %wide.trip.count.i br i1 %exitcond.not.i35, label %for.body7.lr.ph.i, label %for.body.i32, !llvm.loop !24 ord_reverse.exit: ; preds = %if.then12, %for.body7.lr.ph.i call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %tmp.i) #8 br label %for.inc if.then19: ; preds = %if.else %call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.8, ptr noundef nonnull %start, ptr noundef nonnull %end, ptr noundef nonnull %p) %20 = load i32, ptr %start, align 4, !tbaa !20 %21 = load i32, ptr %end, align 4, !tbaa !20 %cmp.not9.i = icmp slt i32 %21, %20 br i1 %cmp.not9.i, label %for.inc, label %for.body.lr.ph.i36 for.body.lr.ph.i36: ; preds = %if.then19 %idx.ext1.i = sext i32 %20 to i64 %add.ptr2.i37 = getelementptr inbounds i8, ptr %str, i64 %idx.ext1.i %reass.sub = sub i32 %21, %20 %22 = add i32 %reass.sub, 1 %wide.trip.count.i38 = zext i32 %22 to i64 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %add.ptr2.i37, ptr nonnull align 16 %p, i64 %wide.trip.count.i38, i1 false), !tbaa !5 br label %for.inc for.inc: ; preds = %for.body.lr.ph.i36, %if.else, %if.then19, %ord_print.exit, %ord_reverse.exit %inc = add nuw nsw i32 %i.046, 1 %23 = load i32, ptr %q, align 4, !tbaa !20 %cmp = icmp slt i32 %inc, %23 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !25 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %p) #8 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %ord) #8 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %str) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %end) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %start) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #8 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 @putchar(i32 noundef) local_unnamed_addr #5 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6 ; Function Attrs: 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) #7 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 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 #3 = { 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 #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 = { nofree nounwind willreturn memory(argmem: read) } attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #8 = { 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9, !11, !12} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !9, !11, !12} !14 = distinct !{!14, !9, !12, !11} !15 = distinct !{!15, !9, !11, !12} !16 = distinct !{!16, !9, !11, !12} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.unroll.disable"} !19 = distinct !{!19, !9, !11} !20 = !{!21, !21, i64 0} !21 = !{!"int", !6, i64 0} !22 = distinct !{!22, !9, !11, !12} !23 = distinct !{!23, !9, !11, !12} !24 = distinct !{!24, !9, !12, !11} !25 = distinct !{!25, !9}
#include<stdio.h> #include<string.h> void print(char str[1000], int a, int b) { char substr[1000]; strncpy(substr, str + a, b - a + 1); substr[b - a + 1] = '\0'; printf("%s\n", substr); } void reverse(char str[1000], int a, int b) { int i; char revstr[1000]; strcpy(revstr, str); for (i = a;i <= b;i++) { revstr[i] = str[b + a - i]; } strcpy(str, revstr); } void replace(char str[1000], int a, int b, char p[1000]) { int i; for (i = a;i <= b;i++) { str[i] = p[i - a]; } } int main() { int i; int a, b, n; char str[1000], p[1000]; char op[10]; scanf("%s", str); scanf("%d", &n); for (i = 0;i < n;i++) { scanf("%s", op); if (strcmp(op, "print") == 0) { scanf("%d %d", &a, &b); print(str, a, b); } else if (strcmp(op, "reverse") == 0) { scanf("%d %d", &a, &b); reverse(str, a, b); } else if (strcmp(op, "replace") == 0) { scanf("%d %d %s", &a, &b, p); replace(str, a, b, p); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179097/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179097/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.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1 @.str.4 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.5 = private unnamed_addr constant [8 x i8] c"reverse\00", align 1 @.str.6 = private unnamed_addr constant [8 x i8] c"replace\00", align 1 @.str.7 = private unnamed_addr constant [9 x i8] c"%d %d %s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local void @print(ptr nocapture noundef readonly %str, i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %substr = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %substr) #9 %idx.ext = sext i32 %a to i64 %add.ptr = getelementptr inbounds i8, ptr %str, i64 %idx.ext %reass.sub = sub i32 %b, %a %add = add i32 %reass.sub, 1 %conv = sext i32 %add to i64 %call = call ptr @strncpy(ptr noundef nonnull %substr, ptr noundef %add.ptr, i64 noundef %conv) #9 %arrayidx = getelementptr inbounds [1000 x i8], ptr %substr, i64 0, i64 %conv store i8 0, ptr %arrayidx, align 1, !tbaa !5 %puts = call i32 @puts(ptr nonnull dereferenceable(1) %substr) call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %substr) #9 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 nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 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 memory(argmem: readwrite) uwtable define dso_local void @reverse(ptr noundef %str, i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 { entry: %revstr = alloca [1000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %revstr) #9 %call = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %revstr, ptr noundef nonnull dereferenceable(1) %str) #9 %cmp.not12 = icmp sgt i32 %a, %b br i1 %cmp.not12, label %for.end, label %iter.check iter.check: ; preds = %entry %add = add nsw i32 %b, %a %0 = sext i32 %a to i64 %1 = add i32 %b, 1 %2 = sub i32 %b, %a %3 = zext i32 %2 to i64 %4 = add nuw nsw i64 %3, 1 %min.iters.check = icmp ult i32 %2, 7 br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check15 = icmp ult i32 %2, 31 br i1 %min.iters.check15, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %4, 8589934560 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %5 = trunc i64 %index to i32 %6 = add i32 %5, %a %offset.idx16 = add i64 %index, %0 %7 = sub i32 %add, %6 %8 = sext i32 %7 to i64 %9 = getelementptr inbounds i8, ptr %str, i64 %8 %10 = getelementptr inbounds i8, ptr %9, i64 -15 %wide.load = load <16 x i8>, ptr %10, align 1, !tbaa !5 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %11 = getelementptr inbounds i8, ptr %9, i64 -31 %wide.load17 = load <16 x i8>, ptr %11, align 1, !tbaa !5 %reverse18 = shufflevector <16 x i8> %wide.load17, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %12 = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %offset.idx16 store <16 x i8> %reverse, ptr %12, align 1, !tbaa !5 %13 = getelementptr inbounds i8, ptr %12, i64 16 store <16 x i8> %reverse18, ptr %13, align 1, !tbaa !5 %index.next = add nuw i64 %index, 32 %14 = icmp eq i64 %index.next, %n.vec br i1 %14, label %middle.block, label %vector.body, !llvm.loop !8 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %ind.end21 = add nsw i64 %n.vec, %0 %n.vec.remaining = and i64 %4, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec20 = and i64 %4, 8589934584 %ind.end = add nsw i64 %n.vec20, %0 %invariant.gep = getelementptr i8, ptr %str, i64 -7 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index23 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next28, %vec.epilog.vector.body ] %15 = trunc i64 %index23 to i32 %16 = add i32 %15, %a %offset.idx25 = add i64 %index23, %0 %17 = sub i32 %add, %16 %18 = sext i32 %17 to i64 %gep = getelementptr i8, ptr %invariant.gep, i64 %18 %wide.load26 = load <8 x i8>, ptr %gep, align 1, !tbaa !5 %reverse27 = shufflevector <8 x i8> %wide.load26, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %19 = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %offset.idx25 store <8 x i8> %reverse27, ptr %19, align 1, !tbaa !5 %index.next28 = add nuw i64 %index23, 8 %20 = icmp eq i64 %index.next28, %n.vec20 br i1 %20, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n22 = icmp eq i64 %4, %n.vec20 br i1 %cmp.n22, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ %0, %iter.check ], [ %ind.end21, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ] %21 = add i32 %b, 1 %22 = trunc i64 %indvars.iv.ph to i32 %23 = sub i32 %21, %22 %24 = sub i32 %b, %22 %xtraiter = and i32 %23, 3 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol for.body.prol: ; preds = %for.body.preheader, %for.body.prol %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader ] %prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ] %25 = trunc i64 %indvars.iv.prol to i32 %sub.prol = sub i32 %add, %25 %idxprom.prol = sext i32 %sub.prol to i64 %arrayidx.prol = getelementptr inbounds i8, ptr %str, i64 %idxprom.prol %26 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5 %arrayidx2.prol = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %indvars.iv.prol store i8 %26, ptr %arrayidx2.prol, align 1, !tbaa !5 %indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1 %prol.iter.next = add i32 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13 for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ] %27 = icmp ult i32 %24, 3 br i1 %27, label %for.end, label %for.body for.body: ; preds = %for.body.prol.loopexit, %for.body %indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ] %28 = trunc i64 %indvars.iv to i32 %sub = sub i32 %add, %28 %idxprom = sext i32 %sub to i64 %arrayidx = getelementptr inbounds i8, ptr %str, i64 %idxprom %29 = load i8, ptr %arrayidx, align 1, !tbaa !5 %arrayidx2 = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %indvars.iv store i8 %29, ptr %arrayidx2, align 1, !tbaa !5 %indvars.iv.next = add nsw i64 %indvars.iv, 1 %30 = trunc i64 %indvars.iv.next to i32 %sub.1 = sub i32 %add, %30 %idxprom.1 = sext i32 %sub.1 to i64 %arrayidx.1 = getelementptr inbounds i8, ptr %str, i64 %idxprom.1 %31 = load i8, ptr %arrayidx.1, align 1, !tbaa !5 %arrayidx2.1 = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %indvars.iv.next store i8 %31, ptr %arrayidx2.1, align 1, !tbaa !5 %indvars.iv.next.1 = add nsw i64 %indvars.iv, 2 %32 = trunc i64 %indvars.iv.next.1 to i32 %sub.2 = sub i32 %add, %32 %idxprom.2 = sext i32 %sub.2 to i64 %arrayidx.2 = getelementptr inbounds i8, ptr %str, i64 %idxprom.2 %33 = load i8, ptr %arrayidx.2, align 1, !tbaa !5 %arrayidx2.2 = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %indvars.iv.next.1 store i8 %33, ptr %arrayidx2.2, align 1, !tbaa !5 %indvars.iv.next.2 = add nsw i64 %indvars.iv, 3 %34 = trunc i64 %indvars.iv.next.2 to i32 %sub.3 = sub i32 %add, %34 %idxprom.3 = sext i32 %sub.3 to i64 %arrayidx.3 = getelementptr inbounds i8, ptr %str, i64 %idxprom.3 %35 = load i8, ptr %arrayidx.3, align 1, !tbaa !5 %arrayidx2.3 = getelementptr inbounds [1000 x i8], ptr %revstr, i64 0, i64 %indvars.iv.next.2 store i8 %35, ptr %arrayidx2.3, align 1, !tbaa !5 %indvars.iv.next.3 = add nsw i64 %indvars.iv, 4 %lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32 %exitcond.not.3 = icmp eq i32 %1, %lftr.wideiv.3 br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !15 for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %entry %call4 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %revstr) #9 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %revstr) #9 ret void } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @replace(ptr nocapture noundef writeonly %str, i32 noundef %a, i32 noundef %b, ptr nocapture noundef readonly %p) local_unnamed_addr #4 { entry: %p12 = ptrtoint ptr %p to i64 %str11 = ptrtoint ptr %str to i64 %cmp.not7 = icmp sgt i32 %a, %b br i1 %cmp.not7, label %for.end, label %iter.check iter.check: ; preds = %entry %0 = sext i32 %a to i64 %1 = add i32 %b, 1 %2 = sub i32 %b, %a %3 = zext i32 %2 to i64 %4 = add nuw nsw i64 %3, 1 %min.iters.check = icmp ult i32 %2, 7 br i1 %min.iters.check, label %for.body.preheader, label %vector.memcheck vector.memcheck: ; preds = %iter.check %5 = add i64 %str11, %0 %6 = sub i64 %5, %p12 %diff.check = icmp ult i64 %6, 32 br i1 %diff.check, label %for.body.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.memcheck %min.iters.check13 = icmp ult i32 %2, 31 br i1 %min.iters.check13, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %4, 8589934560 %invariant.gep = getelementptr i8, ptr %str, i64 %0 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %7 = getelementptr inbounds i8, ptr %p, i64 %index %wide.load = load <16 x i8>, ptr %7, align 1, !tbaa !5 %8 = getelementptr inbounds i8, ptr %7, i64 16 %wide.load14 = load <16 x i8>, ptr %8, align 1, !tbaa !5 %gep = getelementptr i8, ptr %invariant.gep, i64 %index store <16 x i8> %wide.load, ptr %gep, align 1, !tbaa !5 %9 = getelementptr inbounds i8, ptr %gep, i64 16 store <16 x i8> %wide.load14, ptr %9, align 1, !tbaa !5 %index.next = add nuw i64 %index, 32 %10 = icmp eq i64 %index.next, %n.vec br i1 %10, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %ind.end17 = add nsw i64 %n.vec, %0 %n.vec.remaining = and i64 %4, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec16 = and i64 %4, 8589934584 %ind.end = add nsw i64 %n.vec16, %0 %invariant.gep23 = getelementptr i8, ptr %str, i64 %0 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index19 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next22, %vec.epilog.vector.body ] %11 = getelementptr inbounds i8, ptr %p, i64 %index19 %wide.load21 = load <8 x i8>, ptr %11, align 1, !tbaa !5 %gep24 = getelementptr i8, ptr %invariant.gep23, i64 %index19 store <8 x i8> %wide.load21, ptr %gep24, align 1, !tbaa !5 %index.next22 = add nuw i64 %index19, 8 %12 = icmp eq i64 %index.next22, %n.vec16 br i1 %12, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !17 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n18 = icmp eq i64 %4, %n.vec16 br i1 %cmp.n18, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %vector.memcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ %0, %iter.check ], [ %0, %vector.memcheck ], [ %ind.end17, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ] %13 = add i32 %b, 1 %14 = trunc i64 %indvars.iv.ph to i32 %15 = sub i32 %13, %14 %16 = sub i32 %b, %14 %xtraiter = and i32 %15, 3 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol for.body.prol: ; preds = %for.body.preheader, %for.body.prol %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader ] %prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ] %17 = sub nsw i64 %indvars.iv.prol, %0 %arrayidx.prol = getelementptr inbounds i8, ptr %p, i64 %17 %18 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5 %arrayidx2.prol = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.prol store i8 %18, ptr %arrayidx2.prol, align 1, !tbaa !5 %indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1 %prol.iter.next = add i32 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !18 for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ] %19 = icmp ult i32 %16, 3 br i1 %19, label %for.end, label %for.body for.body: ; preds = %for.body.prol.loopexit, %for.body %indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ] %20 = sub nsw i64 %indvars.iv, %0 %arrayidx = getelementptr inbounds i8, ptr %p, i64 %20 %21 = load i8, ptr %arrayidx, align 1, !tbaa !5 %arrayidx2 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv store i8 %21, ptr %arrayidx2, align 1, !tbaa !5 %indvars.iv.next = add nsw i64 %indvars.iv, 1 %22 = sub nsw i64 %indvars.iv.next, %0 %arrayidx.1 = getelementptr inbounds i8, ptr %p, i64 %22 %23 = load i8, ptr %arrayidx.1, align 1, !tbaa !5 %arrayidx2.1 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next store i8 %23, ptr %arrayidx2.1, align 1, !tbaa !5 %indvars.iv.next.1 = add nsw i64 %indvars.iv, 2 %24 = sub nsw i64 %indvars.iv.next.1, %0 %arrayidx.2 = getelementptr inbounds i8, ptr %p, i64 %24 %25 = load i8, ptr %arrayidx.2, align 1, !tbaa !5 %arrayidx2.2 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.1 store i8 %25, ptr %arrayidx2.2, align 1, !tbaa !5 %indvars.iv.next.2 = add nsw i64 %indvars.iv, 3 %26 = sub nsw i64 %indvars.iv.next.2, %0 %arrayidx.3 = getelementptr inbounds i8, ptr %p, i64 %26 %27 = load i8, ptr %arrayidx.3, align 1, !tbaa !5 %arrayidx2.3 = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.next.2 store i8 %27, ptr %arrayidx2.3, align 1, !tbaa !5 %indvars.iv.next.3 = add nsw i64 %indvars.iv, 4 %lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32 %exitcond.not.3 = icmp eq i32 %1, %lftr.wideiv.3 br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !19 for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %entry ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %revstr.i = alloca [1000 x i8], align 16 %substr.i = alloca [1000 x i8], align 16 %a = alloca i32, align 4 %b = alloca i32, align 4 %n = alloca i32, align 4 %str = alloca [1000 x i8], align 16 %p = alloca [1000 x i8], align 16 %op = alloca [10 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %str) #9 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %p) #9 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %op) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !20 %cmp40 = icmp sgt i32 %0, 0 br i1 %cmp40, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %invariant.gep = getelementptr i8, ptr %str, i64 -7 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc %i.041 = phi i32 [ %inc, %for.inc ], [ 0, %for.body.preheader ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %op) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %op, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6) %cmp6 = icmp eq i32 %bcmp, 0 br i1 %cmp6, label %if.then, label %if.else if.then: ; preds = %for.body %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %a, ptr noundef nonnull %b) %1 = load i32, ptr %a, align 4, !tbaa !20 %2 = load i32, ptr %b, align 4, !tbaa !20 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %substr.i) #9 %idx.ext.i = sext i32 %1 to i64 %add.ptr.i = getelementptr inbounds i8, ptr %str, i64 %idx.ext.i %reass.sub = sub i32 %2, %1 %add.i = add i32 %reass.sub, 1 %conv.i = sext i32 %add.i to i64 %call.i = call ptr @strncpy(ptr noundef nonnull %substr.i, ptr noundef nonnull %add.ptr.i, i64 noundef %conv.i) #9 %arrayidx.i = getelementptr inbounds [1000 x i8], ptr %substr.i, i64 0, i64 %conv.i store i8 0, ptr %arrayidx.i, align 1, !tbaa !5 %puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %substr.i) call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %substr.i) #9 br label %for.inc if.else: ; preds = %for.body %bcmp27 = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %op, ptr noundef nonnull dereferenceable(8) @.str.5, i64 8) %cmp11 = icmp eq i32 %bcmp27, 0 br i1 %cmp11, label %if.then12, label %if.else15 if.then12: ; preds = %if.else %call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %a, ptr noundef nonnull %b) %3 = load i32, ptr %a, align 4, !tbaa !20 %4 = load i32, ptr %b, align 4, !tbaa !20 call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %revstr.i) #9 %call.i29 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %revstr.i, ptr noundef nonnull dereferenceable(1) %str) #9 %cmp.not12.i = icmp sgt i32 %3, %4 br i1 %cmp.not12.i, label %reverse.exit, label %iter.check iter.check: ; preds = %if.then12 %add.i30 = add nsw i32 %4, %3 %5 = sext i32 %3 to i64 %6 = add i32 %4, 1 %7 = sub i32 %4, %3 %8 = zext i32 %7 to i64 %9 = add nuw nsw i64 %8, 1 %min.iters.check = icmp ult i32 %7, 7 br i1 %min.iters.check, label %for.body.i.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check42 = icmp ult i32 %7, 31 br i1 %min.iters.check42, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %9, 8589934560 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %10 = trunc i64 %index to i32 %11 = add i32 %3, %10 %offset.idx43 = add i64 %index, %5 %12 = sub i32 %add.i30, %11 %13 = sext i32 %12 to i64 %14 = getelementptr inbounds i8, ptr %str, i64 %13 %15 = getelementptr inbounds i8, ptr %14, i64 -15 %wide.load = load <16 x i8>, ptr %15, align 1, !tbaa !5 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %16 = getelementptr inbounds i8, ptr %14, i64 -31 %wide.load44 = load <16 x i8>, ptr %16, align 1, !tbaa !5 %reverse45 = shufflevector <16 x i8> %wide.load44, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %17 = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %offset.idx43 store <16 x i8> %reverse, ptr %17, align 1, !tbaa !5 %18 = getelementptr inbounds i8, ptr %17, i64 16 store <16 x i8> %reverse45, ptr %18, align 1, !tbaa !5 %index.next = add nuw i64 %index, 32 %19 = icmp eq i64 %index.next, %n.vec br i1 %19, label %middle.block, label %vector.body, !llvm.loop !22 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %9, %n.vec br i1 %cmp.n, label %reverse.exit, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %ind.end48 = add nsw i64 %n.vec, %5 %n.vec.remaining = and i64 %9, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body.i.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec47 = and i64 %9, 8589934584 %ind.end = add nsw i64 %n.vec47, %5 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index50 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next55, %vec.epilog.vector.body ] %20 = trunc i64 %index50 to i32 %21 = add i32 %3, %20 %offset.idx52 = add i64 %index50, %5 %22 = sub i32 %add.i30, %21 %23 = sext i32 %22 to i64 %gep = getelementptr i8, ptr %invariant.gep, i64 %23 %wide.load53 = load <8 x i8>, ptr %gep, align 1, !tbaa !5 %reverse54 = shufflevector <8 x i8> %wide.load53, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %24 = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %offset.idx52 store <8 x i8> %reverse54, ptr %24, align 1, !tbaa !5 %index.next55 = add nuw i64 %index50, 8 %25 = icmp eq i64 %index.next55, %n.vec47 br i1 %25, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !23 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n49 = icmp eq i64 %9, %n.vec47 br i1 %cmp.n49, label %reverse.exit, label %for.body.i.preheader for.body.i.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.i.ph = phi i64 [ %5, %iter.check ], [ %ind.end48, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ] %26 = add i32 %4, 1 %27 = trunc i64 %indvars.iv.i.ph to i32 %28 = sub i32 %26, %27 %29 = sub i32 %4, %27 %xtraiter = and i32 %28, 3 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol %indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ] %prol.iter = phi i32 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ] %30 = trunc i64 %indvars.iv.i.prol to i32 %sub.i.prol = sub i32 %add.i30, %30 %idxprom.i.prol = sext i32 %sub.i.prol to i64 %arrayidx.i31.prol = getelementptr inbounds i8, ptr %str, i64 %idxprom.i.prol %31 = load i8, ptr %arrayidx.i31.prol, align 1, !tbaa !5 %arrayidx2.i.prol = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %indvars.iv.i.prol store i8 %31, ptr %arrayidx2.i.prol, align 1, !tbaa !5 %indvars.iv.next.i.prol = add nsw i64 %indvars.iv.i.prol, 1 %prol.iter.next = add i32 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !24 for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader %indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ] %32 = icmp ult i32 %29, 3 br i1 %32, label %reverse.exit, label %for.body.i for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ] %33 = trunc i64 %indvars.iv.i to i32 %sub.i = sub i32 %add.i30, %33 %idxprom.i = sext i32 %sub.i to i64 %arrayidx.i31 = getelementptr inbounds i8, ptr %str, i64 %idxprom.i %34 = load i8, ptr %arrayidx.i31, align 1, !tbaa !5 %arrayidx2.i = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %indvars.iv.i store i8 %34, ptr %arrayidx2.i, align 1, !tbaa !5 %indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1 %35 = trunc i64 %indvars.iv.next.i to i32 %sub.i.1 = sub i32 %add.i30, %35 %idxprom.i.1 = sext i32 %sub.i.1 to i64 %arrayidx.i31.1 = getelementptr inbounds i8, ptr %str, i64 %idxprom.i.1 %36 = load i8, ptr %arrayidx.i31.1, align 1, !tbaa !5 %arrayidx2.i.1 = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %indvars.iv.next.i store i8 %36, ptr %arrayidx2.i.1, align 1, !tbaa !5 %indvars.iv.next.i.1 = add nsw i64 %indvars.iv.i, 2 %37 = trunc i64 %indvars.iv.next.i.1 to i32 %sub.i.2 = sub i32 %add.i30, %37 %idxprom.i.2 = sext i32 %sub.i.2 to i64 %arrayidx.i31.2 = getelementptr inbounds i8, ptr %str, i64 %idxprom.i.2 %38 = load i8, ptr %arrayidx.i31.2, align 1, !tbaa !5 %arrayidx2.i.2 = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %indvars.iv.next.i.1 store i8 %38, ptr %arrayidx2.i.2, align 1, !tbaa !5 %indvars.iv.next.i.2 = add nsw i64 %indvars.iv.i, 3 %39 = trunc i64 %indvars.iv.next.i.2 to i32 %sub.i.3 = sub i32 %add.i30, %39 %idxprom.i.3 = sext i32 %sub.i.3 to i64 %arrayidx.i31.3 = getelementptr inbounds i8, ptr %str, i64 %idxprom.i.3 %40 = load i8, ptr %arrayidx.i31.3, align 1, !tbaa !5 %arrayidx2.i.3 = getelementptr inbounds [1000 x i8], ptr %revstr.i, i64 0, i64 %indvars.iv.next.i.2 store i8 %40, ptr %arrayidx2.i.3, align 1, !tbaa !5 %indvars.iv.next.i.3 = add nsw i64 %indvars.iv.i, 4 %lftr.wideiv.i.3 = trunc i64 %indvars.iv.next.i.3 to i32 %exitcond.not.i.3 = icmp eq i32 %6, %lftr.wideiv.i.3 br i1 %exitcond.not.i.3, label %reverse.exit, label %for.body.i, !llvm.loop !25 reverse.exit: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %vec.epilog.middle.block, %if.then12 %call4.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %revstr.i) #9 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %revstr.i) #9 br label %for.inc if.else15: ; preds = %if.else %bcmp28 = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %op, ptr noundef nonnull dereferenceable(8) @.str.6, i64 8) %cmp18 = icmp eq i32 %bcmp28, 0 br i1 %cmp18, label %if.then19, label %for.inc if.then19: ; preds = %if.else15 %call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %p) %41 = load i32, ptr %a, align 4, !tbaa !20 %42 = load i32, ptr %b, align 4, !tbaa !20 %cmp.not7.i = icmp sgt i32 %41, %42 br i1 %cmp.not7.i, label %for.inc, label %for.body.preheader.i for.body.preheader.i: ; preds = %if.then19 %43 = sext i32 %41 to i64 %scevgep = getelementptr i8, ptr %str, i64 %43 %44 = sub i32 %42, %41 %45 = zext i32 %44 to i64 %46 = add nuw nsw i64 %45, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, ptr noundef nonnull align 16 dereferenceable(1) %p, i64 %46, i1 false), !tbaa !5 br label %for.inc for.inc: ; preds = %for.body.preheader.i, %if.then19, %if.then, %if.else15, %reverse.exit %inc = add nuw nsw i32 %i.041, 1 %47 = load i32, ptr %n, align 4, !tbaa !20 %cmp = icmp slt i32 %inc, %47 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26 for.end: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %op) #9 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %p) #9 call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %str) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #7 ; Function Attrs: 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) #8 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 nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-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 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 = { 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 #5 = { 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 #6 = { nofree nounwind } attributes #7 = { nofree nounwind willreturn memory(argmem: read) } attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 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 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9, !10, !11} !9 = !{!"llvm.loop.mustprogress"} !10 = !{!"llvm.loop.isvectorized", i32 1} !11 = !{!"llvm.loop.unroll.runtime.disable"} !12 = distinct !{!12, !9, !10, !11} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.unroll.disable"} !15 = distinct !{!15, !9, !10} !16 = distinct !{!16, !9, !10, !11} !17 = distinct !{!17, !9, !10, !11} !18 = distinct !{!18, !14} !19 = distinct !{!19, !9, !10} !20 = !{!21, !21, i64 0} !21 = !{!"int", !6, i64 0} !22 = distinct !{!22, !9, !10, !11} !23 = distinct !{!23, !9, !10, !11} !24 = distinct !{!24, !14} !25 = distinct !{!25, !9, !10} !26 = distinct !{!26, !9}
#include <stdio.h> int main() { int n,t[91],i,ans=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&t[i]); } if(t[0]>15) { printf("%d",15); return 0; } else ans=t[0]; if(n==1) { printf("%d",ans+15); return 0; } for(i=1;i<n;i++) { if((t[i]-t[i-1])>=16) { printf("%d",ans+15); return 0; } else ans = t[i]; } if(ans<75) printf("%d",ans+15); else printf("%d",90); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17914/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17914/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: %n = alloca i32, align 4 %t = alloca [91 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 364, ptr nonnull %t) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, label %for.body, label %cleanup for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [91 x i32], ptr %t, 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 %t, align 16, !tbaa !5 %cmp3 = icmp sgt i32 %.pre, 15 br i1 %cmp3, label %cleanup, label %if.else if.else: ; preds = %for.end %cmp6 = icmp eq i32 %1, 1 br i1 %cmp6, label %if.then7, label %for.cond10.preheader for.cond10.preheader: ; preds = %if.else %cmp1153 = icmp sgt i32 %1, 1 br i1 %cmp1153, label %for.body12.preheader, label %if.then30 for.body12.preheader: ; preds = %for.cond10.preheader %wide.trip.count = zext i32 %1 to i64 br label %for.body12 if.then7: ; preds = %if.else %add = add nsw i32 %.pre, 15 br label %cleanup for.cond10: ; preds = %for.body12 %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1 %exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count br i1 %exitcond.not, label %for.end28, label %for.body12, !llvm.loop !11 for.body12: ; preds = %for.body12.preheader, %for.cond10 %indvars.iv62 = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next63, %for.cond10 ] %3 = phi i32 [ %.pre, %for.body12.preheader ], [ %4, %for.cond10 ] %arrayidx14 = getelementptr inbounds [91 x i32], ptr %t, i64 0, i64 %indvars.iv62 %4 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %sub17 = sub nsw i32 %4, %3 %cmp18 = icmp sgt i32 %sub17, 15 br i1 %cmp18, label %if.then19, label %for.cond10 if.then19: ; preds = %for.body12 %add20 = add nsw i32 %3, 15 br label %cleanup for.end28: ; preds = %for.cond10 %cmp29 = icmp slt i32 %4, 75 br i1 %cmp29, label %if.then30, label %cleanup if.then30: ; preds = %for.cond10.preheader, %for.end28 %ans.0.lcssa76 = phi i32 [ %4, %for.end28 ], [ %.pre, %for.cond10.preheader ] %add31 = add nsw i32 %ans.0.lcssa76, 15 br label %cleanup cleanup: ; preds = %for.end28, %entry, %for.end, %if.then30, %if.then19, %if.then7 %add31.sink = phi i32 [ %add31, %if.then30 ], [ %add20, %if.then19 ], [ %add, %if.then7 ], [ 15, %for.end ], [ 90, %entry ], [ 90, %for.end28 ] %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add31.sink) call void @llvm.lifetime.end.p0(i64 364, ptr nonnull %t) #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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <string.h> int main(){ char s[1001], order[8], ch[1001]; int i, j, n, a, b; scanf("%s\n%d", s, &n); //命令,回数 for(i=0; i<n; i++) { scanf("%s %d %d", order, &a, &b); if(!strcmp(order, "reverse")) { for(j=a; j<=b; j++) ch[b-j] = s[j]; for(j=a; j<=b; j++) s[j] = ch[j-a]; } if (!strcmp(order, "replace")) { scanf("%s", ch); for (j=0; ch[j]!='\0'; j++) s[a+j] = ch[j]; } if (!strcmp(order, "print")) { for (j=a; j<=b; j++) printf("%c", s[j]); printf("\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179183/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179183/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"%s\0A%d\00", align 1 @.str.1 = private unnamed_addr constant [9 x i8] c"%s %d %d\00", align 1 @.str.2 = private unnamed_addr constant [8 x i8] c"reverse\00", align 1 @.str.3 = private unnamed_addr constant [8 x i8] c"replace\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.5 = private unnamed_addr constant [6 x i8] c"print\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [1001 x i8], align 16 %order = alloca [8 x i8], align 1 %ch = alloca [1001 x i8], align 16 %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %s) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %order) #6 call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %ch) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, 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.preheader, label %for.end60 for.body.preheader: ; preds = %entry %invariant.gep = getelementptr i8, ptr %ch, i64 -7 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc58 %i.088 = phi i32 [ %inc59, %for.inc58 ], [ 0, %for.body.preheader ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %order, ptr noundef nonnull %a, ptr noundef nonnull %b) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %order, ptr noundef nonnull dereferenceable(8) @.str.2, i64 8) %tobool.not = icmp eq i32 %bcmp, 0 br i1 %tobool.not, label %if.then, label %if.end if.then: ; preds = %for.body %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = load i32, ptr %b, align 4, !tbaa !5 %cmp6.not79 = icmp sgt i32 %1, %2 br i1 %cmp6.not79, label %if.end, label %iter.check iter.check: ; preds = %if.then %3 = sext i32 %1 to i64 %4 = sext i32 %2 to i64 %5 = add i32 %2, 1 %6 = sub i32 %2, %1 %7 = zext i32 %6 to i64 %8 = add nuw nsw i64 %7, 1 %min.iters.check = icmp ult i32 %6, 7 br i1 %min.iters.check, label %for.body7.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check101 = icmp ult i32 %6, 31 br i1 %min.iters.check101, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %8, 8589934560 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %offset.idx = add i64 %index, %3 %9 = getelementptr inbounds [1001 x i8], ptr %s, i64 0, i64 %offset.idx %wide.load = load <16 x i8>, ptr %9, align 1, !tbaa !9 %10 = getelementptr inbounds i8, ptr %9, i64 16 %wide.load102 = load <16 x i8>, ptr %10, align 1, !tbaa !9 %11 = sub nsw i64 %4, %offset.idx %12 = getelementptr inbounds [1001 x i8], ptr %ch, i64 0, i64 %11 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %13 = getelementptr inbounds i8, ptr %12, i64 -15 store <16 x i8> %reverse, ptr %13, align 1, !tbaa !9 %reverse103 = shufflevector <16 x i8> %wide.load102, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %14 = getelementptr inbounds i8, ptr %12, i64 -31 store <16 x i8> %reverse103, ptr %14, align 1, !tbaa !9 %index.next = add nuw i64 %index, 32 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !10 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %8, %n.vec br i1 %cmp.n, label %for.cond10.preheader, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %ind.end106 = add nsw i64 %n.vec, %3 %n.vec.remaining = and i64 %8, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body7.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec105 = and i64 %8, 8589934584 %ind.end = add nsw i64 %n.vec105, %3 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index108 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next112, %vec.epilog.vector.body ] %offset.idx109 = add i64 %index108, %3 %16 = getelementptr inbounds [1001 x i8], ptr %s, i64 0, i64 %offset.idx109 %wide.load110 = load <8 x i8>, ptr %16, align 1, !tbaa !9 %17 = sub nsw i64 %4, %offset.idx109 %reverse111 = shufflevector <8 x i8> %wide.load110, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %gep = getelementptr [1001 x i8], ptr %invariant.gep, i64 0, i64 %17 store <8 x i8> %reverse111, ptr %gep, align 1, !tbaa !9 %index.next112 = add nuw i64 %index108, 8 %18 = icmp eq i64 %index.next112, %n.vec105 br i1 %18, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n107 = icmp eq i64 %8, %n.vec105 br i1 %cmp.n107, label %for.cond10.preheader, label %for.body7.preheader for.body7.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ %3, %iter.check ], [ %ind.end106, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ] br label %for.body7 for.cond10.preheader: ; preds = %for.body7, %vec.epilog.middle.block, %middle.block br i1 %cmp6.not79, label %if.end, label %for.body12.preheader for.body12.preheader: ; preds = %for.cond10.preheader %19 = sext i32 %1 to i64 %scevgep = getelementptr i8, ptr %s, i64 %19 %20 = sub i32 %2, %1 %21 = zext i32 %20 to i64 %22 = add nuw nsw i64 %21, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, ptr noundef nonnull align 16 dereferenceable(1) %ch, i64 %22, i1 false), !tbaa !9 br label %if.end for.body7: ; preds = %for.body7.preheader, %for.body7 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body7 ], [ %indvars.iv.ph, %for.body7.preheader ] %arrayidx = getelementptr inbounds [1001 x i8], ptr %s, i64 0, i64 %indvars.iv %23 = load i8, ptr %arrayidx, align 1, !tbaa !9 %24 = sub nsw i64 %4, %indvars.iv %arrayidx9 = getelementptr inbounds [1001 x i8], ptr %ch, i64 0, i64 %24 store i8 %23, ptr %arrayidx9, align 1, !tbaa !9 %indvars.iv.next = add nsw i64 %indvars.iv, 1 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 %exitcond.not = icmp eq i32 %5, %lftr.wideiv br i1 %exitcond.not, label %for.cond10.preheader, label %for.body7, !llvm.loop !15 if.end: ; preds = %if.then, %for.body12.preheader, %for.cond10.preheader, %for.body %bcmp76 = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %order, ptr noundef nonnull dereferenceable(8) @.str.3, i64 8) %tobool23.not = icmp eq i32 %bcmp76, 0 br i1 %tobool23.not, label %if.then24, label %if.end40 if.then24: ; preds = %if.end %call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %ch) %25 = load i8, ptr %ch, align 16, !tbaa !9 %cmp30.not83 = icmp eq i8 %25, 0 br i1 %cmp30.not83, label %if.end40, label %for.body32.lr.ph for.body32.lr.ph: ; preds = %if.then24 %26 = load i32, ptr %a, align 4, !tbaa !5 %27 = sext i32 %26 to i64 br label %for.body32 for.body32: ; preds = %for.body32.lr.ph, %for.body32 %indvars.iv95 = phi i64 [ 0, %for.body32.lr.ph ], [ %indvars.iv.next96, %for.body32 ] %28 = phi i8 [ %25, %for.body32.lr.ph ], [ %30, %for.body32 ] %29 = add nsw i64 %indvars.iv95, %27 %arrayidx36 = getelementptr inbounds [1001 x i8], ptr %s, i64 0, i64 %29 store i8 %28, ptr %arrayidx36, align 1, !tbaa !9 %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1 %arrayidx29 = getelementptr inbounds [1001 x i8], ptr %ch, i64 0, i64 %indvars.iv.next96 %30 = load i8, ptr %arrayidx29, align 1, !tbaa !9 %cmp30.not = icmp eq i8 %30, 0 br i1 %cmp30.not, label %if.end40, label %for.body32, !llvm.loop !16 if.end40: ; preds = %for.body32, %if.then24, %if.end %bcmp77 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %order, ptr noundef nonnull dereferenceable(6) @.str.5, i64 6) %tobool43.not = icmp eq i32 %bcmp77, 0 br i1 %tobool43.not, label %if.then44, label %for.inc58 if.then44: ; preds = %if.end40 %31 = load i32, ptr %a, align 4, !tbaa !5 %32 = load i32, ptr %b, align 4, !tbaa !5 %cmp46.not85 = icmp sgt i32 %31, %32 br i1 %cmp46.not85, label %for.end55, label %for.body48.preheader for.body48.preheader: ; preds = %if.then44 %33 = sext i32 %31 to i64 br label %for.body48 for.body48: ; preds = %for.body48.preheader, %for.body48 %indvars.iv98 = phi i64 [ %33, %for.body48.preheader ], [ %indvars.iv.next99, %for.body48 ] %arrayidx50 = getelementptr inbounds [1001 x i8], ptr %s, i64 0, i64 %indvars.iv98 %34 = load i8, ptr %arrayidx50, align 1, !tbaa !9 %conv51 = sext i8 %34 to i32 %putchar78 = call i32 @putchar(i32 %conv51) %indvars.iv.next99 = add nsw i64 %indvars.iv98, 1 %35 = load i32, ptr %b, align 4, !tbaa !5 %36 = sext i32 %35 to i64 %cmp46.not.not = icmp slt i64 %indvars.iv98, %36 br i1 %cmp46.not.not, label %for.body48, label %for.end55, !llvm.loop !17 for.end55: ; preds = %for.body48, %if.then44 %putchar = call i32 @putchar(i32 10) br label %for.inc58 for.inc58: ; preds = %if.end40, %for.end55 %inc59 = add nuw nsw i32 %i.088, 1 %37 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc59, %37 br i1 %cmp, label %for.body, label %for.end60, !llvm.loop !18 for.end60: ; preds = %for.inc58, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %ch) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %order) #6 call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %s) #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 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 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4 ; Function Attrs: 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) #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 = { nofree nounwind willreturn memory(argmem: read) } attributes #4 = { nofree nounwind } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 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, !12, !13} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !11, !12, !13} !15 = distinct !{!15, !11, !13, !12} !16 = distinct !{!16, !11} !17 = distinct !{!17, !11} !18 = distinct !{!18, !11}
#include <stdio.h> #include <string.h> int main() { int n, a, b; char str[1001], q[1001], temp[1001], cmd[10]; scanf("%s", str); scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%s %d %d", cmd, &a, &b); if (strcmp(cmd, "print") == 0) { for (int j = a; j <= b; j++) { printf("%c", str[j]); } printf("\n"); } else if (strcmp(cmd, "reverse") == 0) { strcpy(temp, str); for (int j = 0; j < b - a + 1; j++) { str[a + j] = temp[b - j]; } } else { scanf("%s", q); for (int j = 0; j < strlen(q); j++) { str[a + j] = q[j]; } } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179226/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179226/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"%s\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"%s %d %d\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"print\00", align 1 @.str.6 = private unnamed_addr constant [8 x i8] c"reverse\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 i32, align 4 %b = alloca i32, align 4 %str = alloca [1001 x i8], align 16 %q = alloca [1001 x i8], align 16 %temp = alloca [1001 x i8], align 16 %cmd = alloca [10 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #8 call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %str) #8 call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %q) #8 call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %temp) #8 call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %cmd) #8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp79 = icmp sgt i32 %0, 0 br i1 %cmp79, label %for.body.preheader, label %for.cond.cleanup for.body.preheader: ; preds = %entry %invariant.gep = getelementptr i8, ptr %temp, i64 -7 br label %for.body for.cond.cleanup: ; preds = %for.inc57, %entry call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %cmd) #8 call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %temp) #8 call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %q) #8 call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %str) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #8 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8 ret i32 0 for.body: ; preds = %for.body.preheader, %for.inc57 %i.080 = phi i32 [ %inc58, %for.inc57 ], [ 0, %for.body.preheader ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %cmd, ptr noundef nonnull %a, ptr noundef nonnull %b) %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %cmd, ptr noundef nonnull dereferenceable(6) @.str.3, i64 6) %cmp6 = icmp eq i32 %bcmp, 0 br i1 %cmp6, label %if.then, label %if.else if.then: ; preds = %for.body %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = load i32, ptr %b, align 4, !tbaa !5 %cmp8.not77 = icmp sgt i32 %1, %2 br i1 %cmp8.not77, label %for.cond.cleanup9, label %for.body10.preheader for.body10.preheader: ; preds = %if.then %3 = sext i32 %1 to i64 br label %for.body10 for.cond.cleanup9: ; preds = %for.body10, %if.then %putchar = call i32 @putchar(i32 10) br label %for.inc57 for.body10: ; preds = %for.body10.preheader, %for.body10 %indvars.iv87 = phi i64 [ %3, %for.body10.preheader ], [ %indvars.iv.next88, %for.body10 ] %arrayidx = getelementptr inbounds [1001 x i8], ptr %str, i64 0, i64 %indvars.iv87 %4 = load i8, ptr %arrayidx, align 1, !tbaa !9 %conv = sext i8 %4 to i32 %putchar70 = call i32 @putchar(i32 %conv) %indvars.iv.next88 = add nsw i64 %indvars.iv87, 1 %5 = load i32, ptr %b, align 4, !tbaa !5 %6 = sext i32 %5 to i64 %cmp8.not.not = icmp slt i64 %indvars.iv87, %6 br i1 %cmp8.not.not, label %for.body10, label %for.cond.cleanup9, !llvm.loop !10 if.else: ; preds = %for.body %bcmp69 = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %cmd, ptr noundef nonnull dereferenceable(8) @.str.6, i64 8) %cmp15 = icmp eq i32 %bcmp69, 0 br i1 %cmp15, label %if.then17, label %if.else36 if.then17: ; preds = %if.else %call20 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %temp, ptr noundef nonnull dereferenceable(1) %str) #8 %7 = load i32, ptr %b, align 4, !tbaa !5 %8 = load i32, ptr %a, align 4, !tbaa !5 %cmp23.not75 = icmp slt i32 %7, %8 br i1 %cmp23.not75, label %for.inc57, label %iter.check iter.check: ; preds = %if.then17 %9 = sext i32 %7 to i64 %10 = sext i32 %8 to i64 %11 = add i32 %7, 1 %12 = sub i32 %11, %8 %wide.trip.count = zext i32 %12 to i64 %min.iters.check = icmp ult i32 %12, 8 br i1 %min.iters.check, label %for.body26.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check90 = icmp ult i32 %12, 32 br i1 %min.iters.check90, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %wide.trip.count, 4294967264 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %13 = sub nsw i64 %9, %index %14 = getelementptr inbounds [1001 x i8], ptr %temp, i64 0, i64 %13 %15 = getelementptr inbounds i8, ptr %14, i64 -15 %wide.load = load <16 x i8>, ptr %15, align 1, !tbaa !9 %reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %16 = getelementptr inbounds i8, ptr %14, i64 -31 %wide.load91 = load <16 x i8>, ptr %16, align 1, !tbaa !9 %reverse92 = shufflevector <16 x i8> %wide.load91, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %17 = add nsw i64 %index, %10 %18 = getelementptr inbounds [1001 x i8], ptr %str, i64 0, i64 %17 store <16 x i8> %reverse, ptr %18, align 1, !tbaa !9 %19 = getelementptr inbounds i8, ptr %18, i64 16 store <16 x i8> %reverse92, ptr %19, align 1, !tbaa !9 %index.next = add nuw i64 %index, 32 %20 = icmp eq i64 %index.next, %n.vec br i1 %20, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.inc57, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %n.vec.remaining = and i64 %wide.trip.count, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body26.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec94 = and i64 %wide.trip.count, 4294967288 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index96 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next99, %vec.epilog.vector.body ] %21 = sub nsw i64 %9, %index96 %gep = getelementptr [1001 x i8], ptr %invariant.gep, i64 0, i64 %21 %wide.load97 = load <8 x i8>, ptr %gep, align 1, !tbaa !9 %reverse98 = shufflevector <8 x i8> %wide.load97, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> %22 = add nsw i64 %index96, %10 %23 = getelementptr inbounds [1001 x i8], ptr %str, i64 0, i64 %22 store <8 x i8> %reverse98, ptr %23, align 1, !tbaa !9 %index.next99 = add nuw i64 %index96, 8 %24 = icmp eq i64 %index.next99, %n.vec94 br i1 %24, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !15 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n95 = icmp eq i64 %n.vec94, %wide.trip.count br i1 %cmp.n95, label %for.inc57, label %for.body26.preheader for.body26.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec94, %vec.epilog.middle.block ] br label %for.body26 for.body26: ; preds = %for.body26.preheader, %for.body26 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body26 ], [ %indvars.iv.ph, %for.body26.preheader ] %25 = sub nsw i64 %9, %indvars.iv %arrayidx29 = getelementptr inbounds [1001 x i8], ptr %temp, i64 0, i64 %25 %26 = load i8, ptr %arrayidx29, align 1, !tbaa !9 %27 = add nsw i64 %indvars.iv, %10 %arrayidx32 = getelementptr inbounds [1001 x i8], ptr %str, i64 0, i64 %27 store i8 %26, ptr %arrayidx32, align 1, !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.inc57, label %for.body26, !llvm.loop !16 if.else36: ; preds = %if.else %call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %call43 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %q) #9 %cmp4472.not = icmp eq i64 %call43, 0 br i1 %cmp4472.not, label %for.inc57, label %for.body47.lr.ph for.body47.lr.ph: ; preds = %if.else36 %28 = load i32, ptr %a, align 4, !tbaa !5 %29 = sext i32 %28 to i64 %scevgep = getelementptr i8, ptr %str, i64 %29 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %scevgep, ptr nonnull align 16 %q, i64 %call43, i1 false), !tbaa !9 br label %for.inc57 for.inc57: ; preds = %for.body26, %middle.block, %vec.epilog.middle.block, %for.body47.lr.ph, %if.else36, %if.then17, %for.cond.cleanup9 %inc58 = add nuw nsw i32 %i.080, 1 %30 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc58, %30 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !17 } ; 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: mustprogress nofree nounwind willreturn memory(argmem: readwrite) declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind willreturn memory(argmem: read) declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6 ; Function Attrs: 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) #7 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: readwrite) "no-trapping-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 = { nofree nounwind willreturn memory(argmem: read) } attributes #6 = { nofree nounwind } attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #8 = { nounwind } attributes #9 = { 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, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !11, !13, !14} !16 = distinct !{!16, !11, !14, !13} !17 = distinct !{!17, !11}
#include <stdio.h> int main(){ long t,u,v,n,a[2],flag,res; scanf("%ld",&t); for(long i=1;i<=t;i++){ flag=0; scanf("%ld %ld %ld",&n,&u,&v); scanf("%ld",&a[0]); for(long j=1;j<n;j++){ scanf("%ld",&a[1]); if(a[1]-a[0]>=2||a[0]-a[1]>=2) flag=2; if(flag==0&&(a[1]-a[0]==1||a[0]-a[1]==1)) flag=1; a[0]=a[1]; } if(flag==0){ if(u<v) res=u+v; else res=v+v; } else if(flag==1){ if(u<v) res=u; else res=v; } else if(flag==2){ res=0; } printf("%ld\n",res); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17927/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17927/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"%ld\00", align 1 @.str.1 = private unnamed_addr constant [12 x i8] c"%ld %ld %ld\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i64, align 8 %u = alloca i64, align 8 %v = alloca i64, align 8 %n = alloca i64, align 8 %a = alloca [2 x i64], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %u) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i64, ptr %t, align 8, !tbaa !5 %cmp.not65 = icmp slt i64 %0, 1 br i1 %cmp.not65, label %for.cond.cleanup, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %arrayidx7 = getelementptr inbounds [2 x i64], ptr %a, i64 0, i64 1 br label %for.body for.cond.cleanup: ; preds = %if.end48, %entry call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %u) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4 ret i32 0 for.body: ; preds = %for.body.lr.ph, %if.end48 %i.067 = phi i64 [ 1, %for.body.lr.ph ], [ %inc51, %if.end48 ] %res.066 = phi i64 [ undef, %for.body.lr.ph ], [ %res.1, %if.end48 ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %u, ptr noundef nonnull %v) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %1 = load i64, ptr %n, align 8, !tbaa !5 %cmp462 = icmp sgt i64 %1, 1 br i1 %cmp462, label %for.body6, label %if.then31 for.cond.cleanup5: ; preds = %for.body6 switch i64 %flag.2, label %if.end48 [ i64 0, label %if.then31 i64 1, label %if.then38 i64 2, label %if.then45 ] for.body6: ; preds = %for.body, %for.body6 %j.064 = phi i64 [ %inc, %for.body6 ], [ 1, %for.body ] %flag.063 = phi i64 [ %flag.2, %for.body6 ], [ 0, %for.body ] %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) %2 = load i64, ptr %arrayidx7, align 8, !tbaa !5 %3 = load i64, ptr %a, align 16, !tbaa !5 %sub = sub nsw i64 %2, %3 %cmp11 = icmp sgt i64 %sub, 1 %sub14 = sub nsw i64 %3, %2 %cmp15 = icmp sgt i64 %sub14, 1 %or.cond = select i1 %cmp11, i1 true, i1 %cmp15 %flag.1 = select i1 %or.cond, i64 2, i64 %flag.063 %cmp16 = icmp eq i64 %flag.1, 0 %cmp20 = icmp eq i64 %sub, 1 %cmp25 = icmp eq i64 %sub14, 1 %or.cond61 = select i1 %cmp20, i1 true, i1 %cmp25 %spec.select = zext i1 %or.cond61 to i64 %flag.2 = select i1 %cmp16, i64 %spec.select, i64 %flag.1 store i64 %2, ptr %a, align 16, !tbaa !5 %inc = add nuw nsw i64 %j.064, 1 %4 = load i64, ptr %n, align 8, !tbaa !5 %cmp4 = icmp slt i64 %inc, %4 br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !9 if.then31: ; preds = %for.body, %for.cond.cleanup5 %5 = load i64, ptr %u, align 8, !tbaa !5 %6 = load i64, ptr %v, align 8, !tbaa !5 %cmp32 = icmp slt i64 %5, %6 br i1 %cmp32, label %if.then33, label %if.else if.then33: ; preds = %if.then31 %add = add nsw i64 %6, %5 br label %if.end48 if.else: ; preds = %if.then31 %add34 = shl nsw i64 %6, 1 br label %if.end48 if.then38: ; preds = %for.cond.cleanup5 %7 = load i64, ptr %u, align 8, !tbaa !5 %8 = load i64, ptr %v, align 8, !tbaa !5 %. = call i64 @llvm.smin.i64(i64 %7, i64 %8) br label %if.end48 if.then45: ; preds = %for.cond.cleanup5 br label %if.end48 if.end48: ; preds = %for.cond.cleanup5, %if.then38, %if.then45, %if.then33, %if.else %res.1 = phi i64 [ %add, %if.then33 ], [ %add34, %if.else ], [ 0, %if.then45 ], [ %., %if.then38 ], [ %res.066, %for.cond.cleanup5 ] %call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %res.1) %inc51 = add nuw nsw i64 %i.067, 1 %9 = load i64, ptr %t, align 8, !tbaa !5 %cmp.not.not = icmp slt i64 %i.067, %9 br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !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: 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 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 = !{!"long", !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 iAbs(int x) { if (x >= 0) return x; return -1 * x; } int iMin(int x, int y) { if (x > y) return y; return x; } int main() { int t; scanf("%d", &t); for (int i = 0; i < t; i++) { int n, u, v; int obstacle[100]; int Mdiff = 0; scanf("%d %d %d", &n, &u, &v); for (int j = 0; j < n; j++) { scanf("%d", &obstacle[j]); if (j > 0) { if (Mdiff < iAbs(obstacle[j] - obstacle[j-1])) { Mdiff = iAbs(obstacle[j] - obstacle[j-1]); } } } if (Mdiff == 1) { printf("%d\n", iMin(u, v)); } else if (Mdiff == 0) { printf("%d\n", iMin(u, v)+v); } else { printf("0\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17932/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17932/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 [9 x i8] c"%d %d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @iAbs(i32 noundef %x) local_unnamed_addr #0 { entry: %retval.0 = tail call i32 @llvm.abs.i32(i32 %x, i1 true) ret i32 %retval.0 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @iMin(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 { entry: %y.x = tail call i32 @llvm.smin.i32(i32 %x, i32 %y) ret i32 %y.x } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %t = alloca i32, align 4 %n = alloca i32, align 4 %u = alloca i32, align 4 %v = alloca i32, align 4 %obstacle = alloca [100 x i32], align 16 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 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %if.end35, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6 ret i32 0 for.body: ; preds = %entry, %if.end35 %i.055 = phi i32 [ %inc37, %if.end35 ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #6 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %obstacle) #6 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %u, ptr noundef nonnull %v) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp351 = icmp sgt i32 %1, 0 br i1 %cmp351, label %for.inc.peel, label %if.then29 for.inc.peel: ; preds = %for.body %call6.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %obstacle) %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp3.peel = icmp sgt i32 %2, 1 br i1 %cmp3.peel, label %for.inc, label %if.then29 for.cond.cleanup4: ; preds = %for.inc switch i32 %spec.select, label %if.else32 [ i32 1, label %if.then25 i32 0, label %if.then29 ] for.inc: ; preds = %for.inc.peel, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ] %Mdiff.052 = phi i32 [ %spec.select, %for.inc ], [ 0, %for.inc.peel ] %arrayidx = getelementptr inbounds [100 x i32], ptr %obstacle, i64 0, i64 %indvars.iv %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %3 = load i32, ptr %arrayidx, align 4, !tbaa !5 %4 = add nuw i64 %indvars.iv, 4294967295 %idxprom10 = and i64 %4, 4294967295 %arrayidx11 = getelementptr inbounds [100 x i32], ptr %obstacle, i64 0, i64 %idxprom10 %5 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %sub12 = sub nsw i32 %3, %5 %retval.0.i = call i32 @llvm.abs.i32(i32 %sub12, i1 true) %spec.select = call i32 @llvm.smax.i32(i32 %Mdiff.052, i32 %retval.0.i) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = load i32, ptr %n, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp3 = icmp slt i64 %indvars.iv.next, %7 br i1 %cmp3, label %for.inc, label %for.cond.cleanup4, !llvm.loop !9 if.then25: ; preds = %for.cond.cleanup4 %8 = load i32, ptr %u, align 4, !tbaa !5 %9 = load i32, ptr %v, align 4, !tbaa !5 %y.x.i = call i32 @llvm.smin.i32(i32 %8, i32 %9) %call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %y.x.i) br label %if.end35 if.then29: ; preds = %for.inc.peel, %for.body, %for.cond.cleanup4 %10 = load i32, ptr %u, align 4, !tbaa !5 %11 = load i32, ptr %v, align 4, !tbaa !5 %y.x.i50 = call i32 @llvm.smin.i32(i32 %10, i32 %11) %add = add nsw i32 %y.x.i50, %11 %call31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add) br label %if.end35 if.else32: ; preds = %for.cond.cleanup4 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end35 if.end35: ; preds = %if.then29, %if.else32, %if.then25 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %obstacle) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 %inc37 = add nuw nsw i32 %i.055, 1 %12 = load i32, ptr %t, align 4, !tbaa !5 %cmp = icmp slt i32 %inc37, %12 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) #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: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #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 speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 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 = { nofree nounwind } 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 = distinct !{!9, !10, !11} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.peeled.count", i32 1} !12 = distinct !{!12, !10}
#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) void vertical(int[2][9][9]); void parallel(int[2][9][9]); void square(int[2][9][9],int,int); int main() { int p[2][9][9]; int n, i, j, f = 0; fscanf(stdin, "%d", &n); while (n--) { if (f) puts(""); f = 1; memset(p, 0, sizeof(p)); for (i = 0; i < 9; i++) for (j = 0; j < 9; j++) fscanf(stdin, "%d", &p[0][i][j]); //vertical vertical(p); //parallel parallel(p); //3x3square for (i = 0; i < 9; i += 3) for (j = 0; j < 9; j += 3) square(p, i, j); // for (i = 0; i < 9; i++,puts("")) for (j = 0; j < 9; j++) fprintf(stdout, "%c%d", p[1][i][j] == 1 ? '*' : ' ', p[0][i][j]); } return 0; } void vertical(int a[2][9][9]) { int i, j, cnt[10], k; for (j = 0; j < 9; j++) { memset(cnt, 0, sizeof(cnt)); for (i = 0; i < 9; i++) cnt[a[0][i][j]]++; for (k = 1; k <= 9; k++) if (cnt[k] > 1) for (i = 0; i < 9; i++) if (k == a[0][i][j]) a[1][i][j] = 1; } } void parallel(int a[2][9][9]){ int i, j, cnt[10], k; for (i = 0; i < 9; i++) { memset(cnt, 0, sizeof(cnt)); for (j = 0; j < 9; j++) cnt[a[0][i][j]]++; for (k = 1; k <= 9; k++) if (cnt[k] > 1) for (j = 0; j < 9; j++) if (k == a[0][i][j]) a[1][i][j] = 1; } } void square(int a[2][9][9], int h, int w){ int i, j, cnt[10] = {}, k; for (i = h; i < h + 3; i++) for (j = w; j < w + 3; j++) cnt[a[0][i][j]]++; for (k = 1; k <= 9; k++) { if (cnt[k] > 1) { for (i = h; i < h + 3; i++) for (j = w; j < w + 3; j++) if (a[0][i][j] == k) a[1][i][j] = 1; } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179363/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179363/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 @stdout = external local_unnamed_addr global ptr, align 8 @.str.2 = private unnamed_addr constant [5 x i8] c"%c%d\00", align 1 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %p = alloca [2 x [9 x [9 x i32]]], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 648, ptr nonnull %p) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %n) #7 %1 = load i32, ptr %n, align 4, !tbaa !9 %dec77 = add nsw i32 %1, -1 store i32 %dec77, ptr %n, align 4, !tbaa !9 %tobool.not78 = icmp eq i32 %1, 0 br i1 %tobool.not78, label %while.end, label %if.end while.cond.loopexit: ; preds = %for.cond30.preheader %2 = load i32, ptr %n, align 4, !tbaa !9 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %n, align 4, !tbaa !9 %tobool.not = icmp eq i32 %2, 0 br i1 %tobool.not, label %while.end, label %if.then.critedge, !llvm.loop !11 if.then.critedge: ; preds = %while.cond.loopexit %putchar = call i32 @putchar(i32 10) br label %if.end if.end: ; preds = %entry, %if.then.critedge call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(648) %p, i8 0, i64 648, i1 false) br label %for.cond3.preheader for.cond3.preheader: ; preds = %if.end, %for.cond3.preheader %indvars.iv = phi i64 [ 0, %if.end ], [ %indvars.iv.next, %for.cond3.preheader ] %3 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 0 %call9 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %3, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8) #7 %4 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.1 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 1 %call9.1 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %4, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.1) #7 %5 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.2 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 2 %call9.2 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %5, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.2) #7 %6 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.3 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 3 %call9.3 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %6, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.3) #7 %7 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.4 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 4 %call9.4 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %7, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.4) #7 %8 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.5 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 5 %call9.5 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %8, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.5) #7 %9 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.6 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 6 %call9.6 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %9, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.6) #7 %10 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.7 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 7 %call9.7 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %10, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.7) #7 %11 = load ptr, ptr @stdin, align 8, !tbaa !5 %arrayidx8.8 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv, i64 8 %call9.8 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %11, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8.8) #7 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 9 br i1 %exitcond.not, label %for.end12, label %for.cond3.preheader, !llvm.loop !13 for.end12: ; preds = %for.cond3.preheader call void @vertical(ptr noundef nonnull %p) call void @parallel(ptr noundef nonnull %p) call void @square(ptr noundef nonnull %p, i32 noundef 0, i32 noundef 0) call void @square(ptr noundef nonnull %p, i32 noundef 0, i32 noundef 3) call void @square(ptr noundef nonnull %p, i32 noundef 0, i32 noundef 6) call void @square(ptr noundef nonnull %p, i32 noundef 3, i32 noundef 0) call void @square(ptr noundef nonnull %p, i32 noundef 3, i32 noundef 3) call void @square(ptr noundef nonnull %p, i32 noundef 3, i32 noundef 6) call void @square(ptr noundef nonnull %p, i32 noundef 6, i32 noundef 0) call void @square(ptr noundef nonnull %p, i32 noundef 6, i32 noundef 3) call void @square(ptr noundef nonnull %p, i32 noundef 6, i32 noundef 6) br label %for.cond30.preheader for.cond30.preheader: ; preds = %for.end12, %for.cond30.preheader %indvars.iv86 = phi i64 [ 0, %for.end12 ], [ %indvars.iv.next87, %for.cond30.preheader ] %12 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 0 %13 = load i32, ptr %arrayidx37, align 4, !tbaa !9 %cmp38 = icmp eq i32 %13, 1 %cond = select i1 %cmp38, i32 42, i32 32 %arrayidx43 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 0 %14 = load i32, ptr %arrayidx43, align 4, !tbaa !9 %call44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.2, i32 noundef %cond, i32 noundef %14) %15 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.1 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 1 %16 = load i32, ptr %arrayidx37.1, align 4, !tbaa !9 %cmp38.1 = icmp eq i32 %16, 1 %cond.1 = select i1 %cmp38.1, i32 42, i32 32 %arrayidx43.1 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 1 %17 = load i32, ptr %arrayidx43.1, align 4, !tbaa !9 %call44.1 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.2, i32 noundef %cond.1, i32 noundef %17) %18 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.2 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 2 %19 = load i32, ptr %arrayidx37.2, align 4, !tbaa !9 %cmp38.2 = icmp eq i32 %19, 1 %cond.2 = select i1 %cmp38.2, i32 42, i32 32 %arrayidx43.2 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 2 %20 = load i32, ptr %arrayidx43.2, align 4, !tbaa !9 %call44.2 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.2, i32 noundef %cond.2, i32 noundef %20) %21 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.3 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 3 %22 = load i32, ptr %arrayidx37.3, align 4, !tbaa !9 %cmp38.3 = icmp eq i32 %22, 1 %cond.3 = select i1 %cmp38.3, i32 42, i32 32 %arrayidx43.3 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 3 %23 = load i32, ptr %arrayidx43.3, align 4, !tbaa !9 %call44.3 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.2, i32 noundef %cond.3, i32 noundef %23) %24 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.4 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 4 %25 = load i32, ptr %arrayidx37.4, align 4, !tbaa !9 %cmp38.4 = icmp eq i32 %25, 1 %cond.4 = select i1 %cmp38.4, i32 42, i32 32 %arrayidx43.4 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 4 %26 = load i32, ptr %arrayidx43.4, align 4, !tbaa !9 %call44.4 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.2, i32 noundef %cond.4, i32 noundef %26) %27 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.5 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 5 %28 = load i32, ptr %arrayidx37.5, align 4, !tbaa !9 %cmp38.5 = icmp eq i32 %28, 1 %cond.5 = select i1 %cmp38.5, i32 42, i32 32 %arrayidx43.5 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 5 %29 = load i32, ptr %arrayidx43.5, align 4, !tbaa !9 %call44.5 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.2, i32 noundef %cond.5, i32 noundef %29) %30 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.6 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 6 %31 = load i32, ptr %arrayidx37.6, align 4, !tbaa !9 %cmp38.6 = icmp eq i32 %31, 1 %cond.6 = select i1 %cmp38.6, i32 42, i32 32 %arrayidx43.6 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 6 %32 = load i32, ptr %arrayidx43.6, align 4, !tbaa !9 %call44.6 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.2, i32 noundef %cond.6, i32 noundef %32) %33 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.7 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 7 %34 = load i32, ptr %arrayidx37.7, align 4, !tbaa !9 %cmp38.7 = icmp eq i32 %34, 1 %cond.7 = select i1 %cmp38.7, i32 42, i32 32 %arrayidx43.7 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 7 %35 = load i32, ptr %arrayidx43.7, align 4, !tbaa !9 %call44.7 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.2, i32 noundef %cond.7, i32 noundef %35) %36 = load ptr, ptr @stdout, align 8, !tbaa !5 %arrayidx37.8 = getelementptr inbounds [2 x [9 x [9 x i32]]], ptr %p, i64 0, i64 1, i64 %indvars.iv86, i64 8 %37 = load i32, ptr %arrayidx37.8, align 4, !tbaa !9 %cmp38.8 = icmp eq i32 %37, 1 %cond.8 = select i1 %cmp38.8, i32 42, i32 32 %arrayidx43.8 = getelementptr inbounds [9 x [9 x i32]], ptr %p, i64 0, i64 %indvars.iv86, i64 8 %38 = load i32, ptr %arrayidx43.8, align 4, !tbaa !9 %call44.8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.2, i32 noundef %cond.8, i32 noundef %38) %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1 %putchar70 = call i32 @putchar(i32 10) %exitcond89.not = icmp eq i64 %indvars.iv.next87, 9 br i1 %exitcond89.not, label %while.cond.loopexit, label %for.cond30.preheader, !llvm.loop !14 while.end: ; preds = %while.cond.loopexit, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.end.p0(i64 648, ptr nonnull %p) #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 declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) 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: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @vertical(ptr nocapture noundef %a) local_unnamed_addr #4 { entry: %cnt = alloca [10 x i32], align 16 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %cnt) #7 br label %for.body for.body: ; preds = %entry, %for.inc38 %indvars.iv63 = phi i64 [ 0, %entry ], [ %indvars.iv.next64, %for.inc38 ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %cnt, i8 0, i64 40, i1 false) %arrayidx6 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 0, i64 %indvars.iv63 %0 = load i32, ptr %arrayidx6, align 4, !tbaa !9 %idxprom7 = sext i32 %0 to i64 %arrayidx8 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7 %1 = load i32, ptr %arrayidx8, align 4, !tbaa !9 %inc = add nsw i32 %1, 1 store i32 %inc, ptr %arrayidx8, align 4, !tbaa !9 %arrayidx6.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 1, i64 %indvars.iv63 %2 = load i32, ptr %arrayidx6.1, align 4, !tbaa !9 %idxprom7.1 = sext i32 %2 to i64 %arrayidx8.1 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.1 %3 = load i32, ptr %arrayidx8.1, align 4, !tbaa !9 %inc.1 = add nsw i32 %3, 1 store i32 %inc.1, ptr %arrayidx8.1, align 4, !tbaa !9 %arrayidx6.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 2, i64 %indvars.iv63 %4 = load i32, ptr %arrayidx6.2, align 4, !tbaa !9 %idxprom7.2 = sext i32 %4 to i64 %arrayidx8.2 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.2 %5 = load i32, ptr %arrayidx8.2, align 4, !tbaa !9 %inc.2 = add nsw i32 %5, 1 store i32 %inc.2, ptr %arrayidx8.2, align 4, !tbaa !9 %arrayidx6.3 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 3, i64 %indvars.iv63 %6 = load i32, ptr %arrayidx6.3, align 4, !tbaa !9 %idxprom7.3 = sext i32 %6 to i64 %arrayidx8.3 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.3 %7 = load i32, ptr %arrayidx8.3, align 4, !tbaa !9 %inc.3 = add nsw i32 %7, 1 store i32 %inc.3, ptr %arrayidx8.3, align 4, !tbaa !9 %arrayidx6.4 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 4, i64 %indvars.iv63 %8 = load i32, ptr %arrayidx6.4, align 4, !tbaa !9 %idxprom7.4 = sext i32 %8 to i64 %arrayidx8.4 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.4 %9 = load i32, ptr %arrayidx8.4, align 4, !tbaa !9 %inc.4 = add nsw i32 %9, 1 store i32 %inc.4, ptr %arrayidx8.4, align 4, !tbaa !9 %arrayidx6.5 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 5, i64 %indvars.iv63 %10 = load i32, ptr %arrayidx6.5, align 4, !tbaa !9 %idxprom7.5 = sext i32 %10 to i64 %arrayidx8.5 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.5 %11 = load i32, ptr %arrayidx8.5, align 4, !tbaa !9 %inc.5 = add nsw i32 %11, 1 store i32 %inc.5, ptr %arrayidx8.5, align 4, !tbaa !9 %arrayidx6.6 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 6, i64 %indvars.iv63 %12 = load i32, ptr %arrayidx6.6, align 4, !tbaa !9 %idxprom7.6 = sext i32 %12 to i64 %arrayidx8.6 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.6 %13 = load i32, ptr %arrayidx8.6, align 4, !tbaa !9 %inc.6 = add nsw i32 %13, 1 store i32 %inc.6, ptr %arrayidx8.6, align 4, !tbaa !9 %arrayidx6.7 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 7, i64 %indvars.iv63 %14 = load i32, ptr %arrayidx6.7, align 4, !tbaa !9 %idxprom7.7 = sext i32 %14 to i64 %arrayidx8.7 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.7 %15 = load i32, ptr %arrayidx8.7, align 4, !tbaa !9 %inc.7 = add nsw i32 %15, 1 store i32 %inc.7, ptr %arrayidx8.7, align 4, !tbaa !9 %arrayidx6.8 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 8, i64 %indvars.iv63 %16 = load i32, ptr %arrayidx6.8, align 4, !tbaa !9 %idxprom7.8 = sext i32 %16 to i64 %arrayidx8.8 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.8 %17 = load i32, ptr %arrayidx8.8, align 4, !tbaa !9 %inc.8 = add nsw i32 %17, 1 store i32 %inc.8, ptr %arrayidx8.8, align 4, !tbaa !9 %18 = zext i32 %0 to i64 %arrayidx30 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 0, i64 %indvars.iv63 %19 = zext i32 %2 to i64 %arrayidx30.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 1, i64 %indvars.iv63 %20 = zext i32 %4 to i64 %arrayidx30.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 2, i64 %indvars.iv63 %21 = zext i32 %6 to i64 %arrayidx30.3 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 3, i64 %indvars.iv63 %22 = zext i32 %8 to i64 %arrayidx30.4 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 4, i64 %indvars.iv63 %23 = zext i32 %10 to i64 %arrayidx30.5 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 5, i64 %indvars.iv63 %24 = zext i32 %12 to i64 %arrayidx30.6 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 6, i64 %indvars.iv63 %25 = zext i32 %14 to i64 %arrayidx30.7 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 7, i64 %indvars.iv63 %26 = zext i32 %16 to i64 %arrayidx30.8 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 8, i64 %indvars.iv63 br label %for.body12 for.body12: ; preds = %for.body, %for.inc35 %indvars.iv = phi i64 [ 1, %for.body ], [ %indvars.iv.next, %for.inc35 ] %arrayidx14 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %indvars.iv %27 = load i32, ptr %arrayidx14, align 4, !tbaa !9 %cmp15 = icmp sgt i32 %27, 1 br i1 %cmp15, label %for.body18.preheader, label %for.inc35 for.body18.preheader: ; preds = %for.body12 %cmp24 = icmp eq i64 %indvars.iv, %18 br i1 %cmp24, label %if.then25, label %for.inc31 if.then25: ; preds = %for.body18.preheader store i32 1, ptr %arrayidx30, align 4, !tbaa !9 br label %for.inc31 for.inc31: ; preds = %for.body18.preheader, %if.then25 %cmp24.1 = icmp eq i64 %indvars.iv, %19 br i1 %cmp24.1, label %if.then25.1, label %for.inc31.1 if.then25.1: ; preds = %for.inc31 store i32 1, ptr %arrayidx30.1, align 4, !tbaa !9 br label %for.inc31.1 for.inc31.1: ; preds = %if.then25.1, %for.inc31 %cmp24.2 = icmp eq i64 %indvars.iv, %20 br i1 %cmp24.2, label %if.then25.2, label %for.inc31.2 if.then25.2: ; preds = %for.inc31.1 store i32 1, ptr %arrayidx30.2, align 4, !tbaa !9 br label %for.inc31.2 for.inc31.2: ; preds = %if.then25.2, %for.inc31.1 %cmp24.3 = icmp eq i64 %indvars.iv, %21 br i1 %cmp24.3, label %if.then25.3, label %for.inc31.3 if.then25.3: ; preds = %for.inc31.2 store i32 1, ptr %arrayidx30.3, align 4, !tbaa !9 br label %for.inc31.3 for.inc31.3: ; preds = %if.then25.3, %for.inc31.2 %cmp24.4 = icmp eq i64 %indvars.iv, %22 br i1 %cmp24.4, label %if.then25.4, label %for.inc31.4 if.then25.4: ; preds = %for.inc31.3 store i32 1, ptr %arrayidx30.4, align 4, !tbaa !9 br label %for.inc31.4 for.inc31.4: ; preds = %if.then25.4, %for.inc31.3 %cmp24.5 = icmp eq i64 %indvars.iv, %23 br i1 %cmp24.5, label %if.then25.5, label %for.inc31.5 if.then25.5: ; preds = %for.inc31.4 store i32 1, ptr %arrayidx30.5, align 4, !tbaa !9 br label %for.inc31.5 for.inc31.5: ; preds = %if.then25.5, %for.inc31.4 %cmp24.6 = icmp eq i64 %indvars.iv, %24 br i1 %cmp24.6, label %if.then25.6, label %for.inc31.6 if.then25.6: ; preds = %for.inc31.5 store i32 1, ptr %arrayidx30.6, align 4, !tbaa !9 br label %for.inc31.6 for.inc31.6: ; preds = %if.then25.6, %for.inc31.5 %cmp24.7 = icmp eq i64 %indvars.iv, %25 br i1 %cmp24.7, label %if.then25.7, label %for.inc31.7 if.then25.7: ; preds = %for.inc31.6 store i32 1, ptr %arrayidx30.7, align 4, !tbaa !9 br label %for.inc31.7 for.inc31.7: ; preds = %if.then25.7, %for.inc31.6 %cmp24.8 = icmp eq i64 %indvars.iv, %26 br i1 %cmp24.8, label %if.then25.8, label %for.inc35 if.then25.8: ; preds = %for.inc31.7 store i32 1, ptr %arrayidx30.8, align 4, !tbaa !9 br label %for.inc35 for.inc35: ; preds = %for.inc31.7, %if.then25.8, %for.body12 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 10 br i1 %exitcond.not, label %for.inc38, label %for.body12, !llvm.loop !15 for.inc38: ; preds = %for.inc35 %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1 %exitcond66.not = icmp eq i64 %indvars.iv.next64, 9 br i1 %exitcond66.not, label %for.end40, label %for.body, !llvm.loop !16 for.end40: ; preds = %for.inc38 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %cnt) #7 ret void } ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @parallel(ptr nocapture noundef %a) local_unnamed_addr #4 { entry: %cnt = alloca [10 x i32], align 16 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %cnt) #7 br label %for.body for.body: ; preds = %entry, %for.inc38 %indvars.iv63 = phi i64 [ 0, %entry ], [ %indvars.iv.next64, %for.inc38 ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %cnt, i8 0, i64 40, i1 false) %arrayidx6 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 0 %0 = load i32, ptr %arrayidx6, align 4, !tbaa !9 %idxprom7 = sext i32 %0 to i64 %arrayidx8 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7 %1 = load i32, ptr %arrayidx8, align 4, !tbaa !9 %inc = add nsw i32 %1, 1 store i32 %inc, ptr %arrayidx8, align 4, !tbaa !9 %arrayidx6.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 1 %2 = load i32, ptr %arrayidx6.1, align 4, !tbaa !9 %idxprom7.1 = sext i32 %2 to i64 %arrayidx8.1 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.1 %3 = load i32, ptr %arrayidx8.1, align 4, !tbaa !9 %inc.1 = add nsw i32 %3, 1 store i32 %inc.1, ptr %arrayidx8.1, align 4, !tbaa !9 %arrayidx6.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 2 %4 = load i32, ptr %arrayidx6.2, align 4, !tbaa !9 %idxprom7.2 = sext i32 %4 to i64 %arrayidx8.2 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.2 %5 = load i32, ptr %arrayidx8.2, align 4, !tbaa !9 %inc.2 = add nsw i32 %5, 1 store i32 %inc.2, ptr %arrayidx8.2, align 4, !tbaa !9 %arrayidx6.3 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 3 %6 = load i32, ptr %arrayidx6.3, align 4, !tbaa !9 %idxprom7.3 = sext i32 %6 to i64 %arrayidx8.3 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.3 %7 = load i32, ptr %arrayidx8.3, align 4, !tbaa !9 %inc.3 = add nsw i32 %7, 1 store i32 %inc.3, ptr %arrayidx8.3, align 4, !tbaa !9 %arrayidx6.4 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 4 %8 = load i32, ptr %arrayidx6.4, align 4, !tbaa !9 %idxprom7.4 = sext i32 %8 to i64 %arrayidx8.4 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.4 %9 = load i32, ptr %arrayidx8.4, align 4, !tbaa !9 %inc.4 = add nsw i32 %9, 1 store i32 %inc.4, ptr %arrayidx8.4, align 4, !tbaa !9 %arrayidx6.5 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 5 %10 = load i32, ptr %arrayidx6.5, align 4, !tbaa !9 %idxprom7.5 = sext i32 %10 to i64 %arrayidx8.5 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.5 %11 = load i32, ptr %arrayidx8.5, align 4, !tbaa !9 %inc.5 = add nsw i32 %11, 1 store i32 %inc.5, ptr %arrayidx8.5, align 4, !tbaa !9 %arrayidx6.6 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 6 %12 = load i32, ptr %arrayidx6.6, align 4, !tbaa !9 %idxprom7.6 = sext i32 %12 to i64 %arrayidx8.6 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.6 %13 = load i32, ptr %arrayidx8.6, align 4, !tbaa !9 %inc.6 = add nsw i32 %13, 1 store i32 %inc.6, ptr %arrayidx8.6, align 4, !tbaa !9 %arrayidx6.7 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 7 %14 = load i32, ptr %arrayidx6.7, align 4, !tbaa !9 %idxprom7.7 = sext i32 %14 to i64 %arrayidx8.7 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.7 %15 = load i32, ptr %arrayidx8.7, align 4, !tbaa !9 %inc.7 = add nsw i32 %15, 1 store i32 %inc.7, ptr %arrayidx8.7, align 4, !tbaa !9 %arrayidx6.8 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv63, i64 8 %16 = load i32, ptr %arrayidx6.8, align 4, !tbaa !9 %idxprom7.8 = sext i32 %16 to i64 %arrayidx8.8 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom7.8 %17 = load i32, ptr %arrayidx8.8, align 4, !tbaa !9 %inc.8 = add nsw i32 %17, 1 store i32 %inc.8, ptr %arrayidx8.8, align 4, !tbaa !9 %18 = zext i32 %0 to i64 %arrayidx30 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 0 %19 = zext i32 %2 to i64 %arrayidx30.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 1 %20 = zext i32 %4 to i64 %arrayidx30.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 2 %21 = zext i32 %6 to i64 %arrayidx30.3 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 3 %22 = zext i32 %8 to i64 %arrayidx30.4 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 4 %23 = zext i32 %10 to i64 %arrayidx30.5 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 5 %24 = zext i32 %12 to i64 %arrayidx30.6 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 6 %25 = zext i32 %14 to i64 %arrayidx30.7 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 7 %26 = zext i32 %16 to i64 %arrayidx30.8 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv63, i64 8 br label %for.body12 for.body12: ; preds = %for.body, %for.inc35 %indvars.iv = phi i64 [ 1, %for.body ], [ %indvars.iv.next, %for.inc35 ] %arrayidx14 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %indvars.iv %27 = load i32, ptr %arrayidx14, align 4, !tbaa !9 %cmp15 = icmp sgt i32 %27, 1 br i1 %cmp15, label %for.body18.preheader, label %for.inc35 for.body18.preheader: ; preds = %for.body12 %cmp24 = icmp eq i64 %indvars.iv, %18 br i1 %cmp24, label %if.then25, label %for.inc31 if.then25: ; preds = %for.body18.preheader store i32 1, ptr %arrayidx30, align 4, !tbaa !9 br label %for.inc31 for.inc31: ; preds = %for.body18.preheader, %if.then25 %cmp24.1 = icmp eq i64 %indvars.iv, %19 br i1 %cmp24.1, label %if.then25.1, label %for.inc31.1 if.then25.1: ; preds = %for.inc31 store i32 1, ptr %arrayidx30.1, align 4, !tbaa !9 br label %for.inc31.1 for.inc31.1: ; preds = %if.then25.1, %for.inc31 %cmp24.2 = icmp eq i64 %indvars.iv, %20 br i1 %cmp24.2, label %if.then25.2, label %for.inc31.2 if.then25.2: ; preds = %for.inc31.1 store i32 1, ptr %arrayidx30.2, align 4, !tbaa !9 br label %for.inc31.2 for.inc31.2: ; preds = %if.then25.2, %for.inc31.1 %cmp24.3 = icmp eq i64 %indvars.iv, %21 br i1 %cmp24.3, label %if.then25.3, label %for.inc31.3 if.then25.3: ; preds = %for.inc31.2 store i32 1, ptr %arrayidx30.3, align 4, !tbaa !9 br label %for.inc31.3 for.inc31.3: ; preds = %if.then25.3, %for.inc31.2 %cmp24.4 = icmp eq i64 %indvars.iv, %22 br i1 %cmp24.4, label %if.then25.4, label %for.inc31.4 if.then25.4: ; preds = %for.inc31.3 store i32 1, ptr %arrayidx30.4, align 4, !tbaa !9 br label %for.inc31.4 for.inc31.4: ; preds = %if.then25.4, %for.inc31.3 %cmp24.5 = icmp eq i64 %indvars.iv, %23 br i1 %cmp24.5, label %if.then25.5, label %for.inc31.5 if.then25.5: ; preds = %for.inc31.4 store i32 1, ptr %arrayidx30.5, align 4, !tbaa !9 br label %for.inc31.5 for.inc31.5: ; preds = %if.then25.5, %for.inc31.4 %cmp24.6 = icmp eq i64 %indvars.iv, %24 br i1 %cmp24.6, label %if.then25.6, label %for.inc31.6 if.then25.6: ; preds = %for.inc31.5 store i32 1, ptr %arrayidx30.6, align 4, !tbaa !9 br label %for.inc31.6 for.inc31.6: ; preds = %if.then25.6, %for.inc31.5 %cmp24.7 = icmp eq i64 %indvars.iv, %25 br i1 %cmp24.7, label %if.then25.7, label %for.inc31.7 if.then25.7: ; preds = %for.inc31.6 store i32 1, ptr %arrayidx30.7, align 4, !tbaa !9 br label %for.inc31.7 for.inc31.7: ; preds = %if.then25.7, %for.inc31.6 %cmp24.8 = icmp eq i64 %indvars.iv, %26 br i1 %cmp24.8, label %if.then25.8, label %for.inc35 if.then25.8: ; preds = %for.inc31.7 store i32 1, ptr %arrayidx30.8, align 4, !tbaa !9 br label %for.inc35 for.inc35: ; preds = %for.inc31.7, %if.then25.8, %for.body12 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 10 br i1 %exitcond.not, label %for.inc38, label %for.body12, !llvm.loop !17 for.inc38: ; preds = %for.inc35 %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1 %exitcond66.not = icmp eq i64 %indvars.iv.next64, 9 br i1 %exitcond66.not, label %for.end40, label %for.body, !llvm.loop !18 for.end40: ; preds = %for.inc38 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %cnt) #7 ret void } ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @square(ptr nocapture noundef %a, i32 noundef %h, i32 noundef %w) local_unnamed_addr #4 { for.inc11: %cnt = alloca [10 x i32], align 16 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %cnt) #7 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %cnt, i8 0, i64 40, i1 false) %add = add nsw i32 %h, 3 %0 = sext i32 %w to i64 %1 = sext i32 %h to i64 %2 = sext i32 %add to i64 %arrayidx7 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %1, i64 %0 %3 = load i32, ptr %arrayidx7, align 4, !tbaa !9 %idxprom8 = sext i32 %3 to i64 %arrayidx9 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8 %4 = load i32, ptr %arrayidx9, align 4, !tbaa !9 %inc = add nsw i32 %4, 1 store i32 %inc, ptr %arrayidx9, align 4, !tbaa !9 %indvars.iv.next = add nsw i64 %0, 1 %arrayidx7.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %1, i64 %indvars.iv.next %5 = load i32, ptr %arrayidx7.1, align 4, !tbaa !9 %idxprom8.1 = sext i32 %5 to i64 %arrayidx9.1 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.1 %6 = load i32, ptr %arrayidx9.1, align 4, !tbaa !9 %inc.1 = add nsw i32 %6, 1 store i32 %inc.1, ptr %arrayidx9.1, align 4, !tbaa !9 %indvars.iv.next.1 = add nsw i64 %0, 2 %arrayidx7.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %1, i64 %indvars.iv.next.1 %7 = load i32, ptr %arrayidx7.2, align 4, !tbaa !9 %idxprom8.2 = sext i32 %7 to i64 %arrayidx9.2 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.2 %8 = load i32, ptr %arrayidx9.2, align 4, !tbaa !9 %inc.2 = add nsw i32 %8, 1 store i32 %inc.2, ptr %arrayidx9.2, align 4, !tbaa !9 %indvars.iv.next79 = add nsw i64 %1, 1 %cmp = icmp slt i64 %indvars.iv.next79, %2 br i1 %cmp, label %for.inc11.2, label %for.cond14.preheader, !llvm.loop !19 for.cond14.preheader: ; preds = %for.inc11.2, %for.inc11 %9 = zext i32 %3 to i64 %arrayidx39 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %1, i64 %0 %arrayidx32.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %1, i64 %indvars.iv.next %arrayidx39.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %1, i64 %indvars.iv.next %indvars.iv.next91.1 = add nsw i64 %0, 2 %arrayidx32.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %1, i64 %indvars.iv.next91.1 %arrayidx39.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %1, i64 %indvars.iv.next91.1 %arrayidx32.195 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79, i64 %0 %arrayidx39.198 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv.next79, i64 %0 %arrayidx32.1.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79, i64 %indvars.iv.next %arrayidx39.1.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv.next79, i64 %indvars.iv.next %indvars.iv.next91.1.1 = add nsw i64 %0, 2 %arrayidx32.2.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79, i64 %indvars.iv.next91.1.1 %arrayidx39.2.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv.next79, i64 %indvars.iv.next91.1.1 %indvars.iv.next93.1 = add nsw i64 %1, 2 %arrayidx32.2102 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next93.1, i64 %0 %arrayidx39.2104 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv.next93.1, i64 %0 %arrayidx32.1.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next93.1, i64 %indvars.iv.next %arrayidx39.1.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv.next93.1, i64 %indvars.iv.next %indvars.iv.next91.1.2 = add nsw i64 %0, 2 %arrayidx32.2.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next93.1, i64 %indvars.iv.next91.1.2 %arrayidx39.2.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 1, i64 %indvars.iv.next93.1, i64 %indvars.iv.next91.1.2 br label %for.body16 for.inc11.2: ; preds = %for.inc11 %arrayidx7.181 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79, i64 %0 %10 = load i32, ptr %arrayidx7.181, align 4, !tbaa !9 %idxprom8.182 = sext i32 %10 to i64 %arrayidx9.183 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.182 %11 = load i32, ptr %arrayidx9.183, align 4, !tbaa !9 %inc.184 = add nsw i32 %11, 1 store i32 %inc.184, ptr %arrayidx9.183, align 4, !tbaa !9 %arrayidx7.1.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79, i64 %indvars.iv.next %12 = load i32, ptr %arrayidx7.1.1, align 4, !tbaa !9 %idxprom8.1.1 = sext i32 %12 to i64 %arrayidx9.1.1 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.1.1 %13 = load i32, ptr %arrayidx9.1.1, align 4, !tbaa !9 %inc.1.1 = add nsw i32 %13, 1 store i32 %inc.1.1, ptr %arrayidx9.1.1, align 4, !tbaa !9 %indvars.iv.next.1.1 = add nsw i64 %0, 2 %arrayidx7.2.1 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79, i64 %indvars.iv.next.1.1 %14 = load i32, ptr %arrayidx7.2.1, align 4, !tbaa !9 %idxprom8.2.1 = sext i32 %14 to i64 %arrayidx9.2.1 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.2.1 %15 = load i32, ptr %arrayidx9.2.1, align 4, !tbaa !9 %inc.2.1 = add nsw i32 %15, 1 store i32 %inc.2.1, ptr %arrayidx9.2.1, align 4, !tbaa !9 %indvars.iv.next79.1 = add nsw i64 %1, 2 %arrayidx7.287 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79.1, i64 %0 %16 = load i32, ptr %arrayidx7.287, align 4, !tbaa !9 %idxprom8.288 = sext i32 %16 to i64 %arrayidx9.289 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.288 %17 = load i32, ptr %arrayidx9.289, align 4, !tbaa !9 %inc.290 = add nsw i32 %17, 1 store i32 %inc.290, ptr %arrayidx9.289, align 4, !tbaa !9 %arrayidx7.1.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79.1, i64 %indvars.iv.next %18 = load i32, ptr %arrayidx7.1.2, align 4, !tbaa !9 %idxprom8.1.2 = sext i32 %18 to i64 %arrayidx9.1.2 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.1.2 %19 = load i32, ptr %arrayidx9.1.2, align 4, !tbaa !9 %inc.1.2 = add nsw i32 %19, 1 store i32 %inc.1.2, ptr %arrayidx9.1.2, align 4, !tbaa !9 %indvars.iv.next.1.2 = add nsw i64 %0, 2 %arrayidx7.2.2 = getelementptr inbounds [9 x [9 x i32]], ptr %a, i64 0, i64 %indvars.iv.next79.1, i64 %indvars.iv.next.1.2 %20 = load i32, ptr %arrayidx7.2.2, align 4, !tbaa !9 %idxprom8.2.2 = sext i32 %20 to i64 %arrayidx9.2.2 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %idxprom8.2.2 %21 = load i32, ptr %arrayidx9.2.2, align 4, !tbaa !9 %inc.2.2 = add nsw i32 %21, 1 store i32 %inc.2.2, ptr %arrayidx9.2.2, align 4, !tbaa !9 br label %for.cond14.preheader for.body16: ; preds = %for.cond14.preheader, %for.inc47 %indvars.iv = phi i64 [ 1, %for.cond14.preheader ], [ %indvars.iv.next107, %for.inc47 ] %arrayidx18 = getelementptr inbounds [10 x i32], ptr %cnt, i64 0, i64 %indvars.iv %22 = load i32, ptr %arrayidx18, align 4, !tbaa !9 %cmp19 = icmp sgt i32 %22, 1 br i1 %cmp19, label %for.cond24.preheader.preheader, label %for.inc47 for.cond24.preheader.preheader: ; preds = %for.body16 %cmp33 = icmp eq i64 %indvars.iv, %9 br i1 %cmp33, label %if.then34, label %for.body27.1 if.then34: ; preds = %for.cond24.preheader.preheader store i32 1, ptr %arrayidx39, align 4, !tbaa !9 br label %for.body27.1 for.body27.1: ; preds = %if.then34, %for.cond24.preheader.preheader %23 = load i32, ptr %arrayidx32.1, align 4, !tbaa !9 %24 = zext i32 %23 to i64 %cmp33.1 = icmp eq i64 %indvars.iv, %24 br i1 %cmp33.1, label %if.then34.1, label %for.inc40.1 if.then34.1: ; preds = %for.body27.1 store i32 1, ptr %arrayidx39.1, align 4, !tbaa !9 br label %for.inc40.1 for.inc40.1: ; preds = %if.then34.1, %for.body27.1 %25 = load i32, ptr %arrayidx32.2, align 4, !tbaa !9 %26 = zext i32 %25 to i64 %cmp33.2 = icmp eq i64 %indvars.iv, %26 br i1 %cmp33.2, label %if.then34.2, label %for.inc43 if.then34.2: ; preds = %for.inc40.1 store i32 1, ptr %arrayidx39.2, align 4, !tbaa !9 br label %for.inc43 for.inc43: ; preds = %for.inc40.1, %if.then34.2 br i1 %cmp, label %for.cond24.preheader.1, label %for.inc47, !llvm.loop !20 for.cond24.preheader.1: ; preds = %for.inc43 %27 = load i32, ptr %arrayidx32.195, align 4, !tbaa !9 %28 = zext i32 %27 to i64 %cmp33.196 = icmp eq i64 %indvars.iv, %28 br i1 %cmp33.196, label %if.then34.199, label %for.body27.1.1 if.then34.199: ; preds = %for.cond24.preheader.1 store i32 1, ptr %arrayidx39.198, align 4, !tbaa !9 br label %for.body27.1.1 for.body27.1.1: ; preds = %for.cond24.preheader.1, %if.then34.199 %29 = load i32, ptr %arrayidx32.1.1, align 4, !tbaa !9 %30 = zext i32 %29 to i64 %cmp33.1.1 = icmp eq i64 %indvars.iv, %30 br i1 %cmp33.1.1, label %if.then34.1.1, label %for.inc40.1.1 if.then34.1.1: ; preds = %for.body27.1.1 store i32 1, ptr %arrayidx39.1.1, align 4, !tbaa !9 br label %for.inc40.1.1 for.inc40.1.1: ; preds = %if.then34.1.1, %for.body27.1.1 %31 = load i32, ptr %arrayidx32.2.1, align 4, !tbaa !9 %32 = zext i32 %31 to i64 %cmp33.2.1 = icmp eq i64 %indvars.iv, %32 br i1 %cmp33.2.1, label %if.then34.2.1, label %for.inc43.1 if.then34.2.1: ; preds = %for.inc40.1.1 store i32 1, ptr %arrayidx39.2.1, align 4, !tbaa !9 br label %for.inc43.1 for.inc43.1: ; preds = %for.inc40.1.1, %if.then34.2.1 %33 = load i32, ptr %arrayidx32.2102, align 4, !tbaa !9 %34 = zext i32 %33 to i64 %cmp33.2103 = icmp eq i64 %indvars.iv, %34 br i1 %cmp33.2103, label %if.then34.2105, label %for.body27.1.2 if.then34.2105: ; preds = %for.inc43.1 store i32 1, ptr %arrayidx39.2104, align 4, !tbaa !9 br label %for.body27.1.2 for.body27.1.2: ; preds = %for.inc43.1, %if.then34.2105 %35 = load i32, ptr %arrayidx32.1.2, align 4, !tbaa !9 %36 = zext i32 %35 to i64 %cmp33.1.2 = icmp eq i64 %indvars.iv, %36 br i1 %cmp33.1.2, label %if.then34.1.2, label %for.inc40.1.2 if.then34.1.2: ; preds = %for.body27.1.2 store i32 1, ptr %arrayidx39.1.2, align 4, !tbaa !9 br label %for.inc40.1.2 for.inc40.1.2: ; preds = %if.then34.1.2, %for.body27.1.2 %37 = load i32, ptr %arrayidx32.2.2, align 4, !tbaa !9 %38 = zext i32 %37 to i64 %cmp33.2.2 = icmp eq i64 %indvars.iv, %38 br i1 %cmp33.2.2, label %if.then34.2.2, label %for.inc47 if.then34.2.2: ; preds = %for.inc40.1.2 store i32 1, ptr %arrayidx39.2.2, align 4, !tbaa !9 br label %for.inc47 for.inc47: ; preds = %for.inc43, %for.inc40.1.2, %if.then34.2.2, %for.body16 %indvars.iv.next107 = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next107, 10 br i1 %exitcond.not, label %for.end49, label %for.body16, !llvm.loop !21 for.end49: ; preds = %for.inc47 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %cnt) #7 ret void } ; Function Attrs: nofree nounwind declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) 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 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { "no-trapping-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 = { 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 "no-trapping-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 } attributes #7 = { 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} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12} !18 = distinct !{!18, !12} !19 = distinct !{!19, !12} !20 = distinct !{!20, !12} !21 = distinct !{!21, !12}
#include<stdio.h> #include<string.h> int main(void){ int unused __attribute__((unused)); char name[1001]; unused = scanf("%s", name); int length = strlen(name) - 1; char l = name[length]; if(l != 's'){ name[length + 1] = 's'; name[length + 2] = '\0'; } else if(l == 's'){ name[length + 1] = 'e'; name[length + 2] = 's'; name[length + 3] = '\0'; } printf("%s", name); x: return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179420/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179420/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"%s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %name = alloca [1001 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %name) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %name) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %name) #5 %conv = shl i64 %call2, 32 %sext35 = add i64 %conv, -4294967296 %idxprom = ashr exact i64 %sext35, 32 %arrayidx = getelementptr inbounds [1001 x i8], ptr %name, i64 0, i64 %idxprom %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp.not = icmp eq i8 %0, 115 %idxprom15 = ashr exact i64 %conv, 32 %arrayidx16 = getelementptr inbounds [1001 x i8], ptr %name, i64 0, i64 %idxprom15 %sext32 = add i64 %conv, 4294967296 %idxprom18 = ashr exact i64 %sext32, 32 %arrayidx19 = getelementptr inbounds [1001 x i8], ptr %name, i64 0, i64 %idxprom18 br i1 %cmp.not, label %if.then13, label %if.then if.then: ; preds = %entry store i8 115, ptr %arrayidx16, align 1, !tbaa !5 br label %if.end23 if.then13: ; preds = %entry store i8 101, ptr %arrayidx16, align 1, !tbaa !5 store i8 115, ptr %arrayidx19, align 1, !tbaa !5 %sext33 = add i64 %conv, 8589934592 %idxprom21 = ashr exact i64 %sext33, 32 %arrayidx22 = getelementptr inbounds [1001 x i8], ptr %name, i64 0, i64 %idxprom21 br label %if.end23 if.end23: ; preds = %if.then13, %if.then %arrayidx22.sink = phi ptr [ %arrayidx22, %if.then13 ], [ %arrayidx19, %if.then ] store i8 0, ptr %arrayidx22.sink, align 1, !tbaa !5 %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %name) call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %name) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <string.h> int main(void){ char s[1005]; int l=0; scanf("%s", s); l = strlen(s); if(s[l-1]=='s'){ //s = s+'es'; printf("%s%s", s,"es"); } else{ //s = s+'s'; printf("%s%s", s,"s"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179486/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179486/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"%s\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"es\00", align 1 @.str.3 = private unnamed_addr constant [2 x i8] c"s\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [1005 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1005, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5 %sub = shl i64 %call2, 32 %sext = add i64 %sub, -4294967296 %idxprom = ashr exact i64 %sext, 32 %arrayidx = getelementptr inbounds [1005 x i8], ptr %s, i64 0, i64 %idxprom %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp = icmp eq i8 %0, 115 %.str.2..str.3 = select i1 %cmp, ptr @.str.2, ptr @.str.3 %call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %.str.2..str.3) call void @llvm.lifetime.end.p0(i64 1005, ptr nonnull %s) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void) { char S[1020]; int N; scanf("%s", S); for (int i = 0; S[i] != '\0'; i++) { N = i; } if (S[N] == 's') printf("%ses", S); else printf("%ss", S); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179529/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179529/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"%s\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ses\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%ss\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %S = alloca [1020 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1020, ptr nonnull %S) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S) br label %for.cond for.cond: ; preds = %for.cond, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ] %N.0 = phi i64 [ %indvars.iv, %for.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1020 x i8], ptr %S, i64 0, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp.not = icmp eq i8 %0, 0 %indvars.iv.next = add nuw i64 %indvars.iv, 1 br i1 %cmp.not, label %for.cond.cleanup, label %for.cond, !llvm.loop !8 for.cond.cleanup: ; preds = %for.cond %sext = shl i64 %N.0, 32 %idxprom2 = ashr exact i64 %sext, 32 %arrayidx3 = getelementptr inbounds [1020 x i8], ptr %S, i64 0, i64 %idxprom2 %1 = load i8, ptr %arrayidx3, align 1, !tbaa !5 %cmp5 = icmp eq i8 %1, 115 %.str.1..str.2 = select i1 %cmp5, ptr @.str.1, ptr @.str.2 %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, ptr noundef nonnull %S) call void @llvm.lifetime.end.p0(i64 1020, ptr nonnull %S) #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: 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <stdlib.h> int n,m,i,arr[100001],one,zero,t,p; int main() { scanf("%d %d",&n,&m); for(i=1;i<=n;i++) { scanf("%d",&arr[i]); if(arr[i]) one++; else zero++; } for(i=1;i<=m;i++) { scanf("%d %d",&t,&p); if(t==1) { if(arr[p]) { one--; zero++; arr[p]=0; } else { one++; zero--; arr[p]=1; } } else { if(p<=one) printf("1\n"); else printf("0\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17958/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17958/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 @n = dso_local global i32 0, align 4 @m = dso_local global i32 0, align 4 @i = dso_local local_unnamed_addr global i32 0, align 4 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @arr = dso_local global [100001 x i32] zeroinitializer, align 16 @one = dso_local local_unnamed_addr global i32 0, align 4 @zero = dso_local local_unnamed_addr global i32 0, align 4 @t = dso_local global i32 0, align 4 @p = dso_local global i32 0, align 4 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 @str.4 = private unnamed_addr constant [2 x i8] c"1\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 @n, ptr noundef nonnull @m) store i32 1, ptr @i, align 4, !tbaa !5 %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not38 = icmp slt i32 %0, 1 br i1 %cmp.not38, label %for.cond6.preheader, label %for.body for.cond6.preheader: ; preds = %for.body, %entry store i32 1, ptr @i, align 4, !tbaa !5 %1 = load i32, ptr @m, align 4, !tbaa !5 %cmp7.not40 = icmp slt i32 %1, 1 br i1 %cmp7.not40, label %for.end35, label %for.body8 for.body: ; preds = %entry, %for.body %storemerge39 = phi i32 [ %inc5, %for.body ], [ 1, %entry ] %idxprom = sext i32 %storemerge39 to i64 %arrayidx = getelementptr inbounds [100001 x i32], ptr @arr, i64 0, i64 %idxprom %call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %2 = load i32, ptr @i, align 4, !tbaa !5 %idxprom2 = sext i32 %2 to i64 %arrayidx3 = getelementptr inbounds [100001 x i32], ptr @arr, i64 0, i64 %idxprom2 %3 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 %zero.one = select i1 %tobool.not, ptr @zero, ptr @one %4 = load i32, ptr %zero.one, align 4, !tbaa !5 %inc = add nsw i32 %4, 1 store i32 %inc, ptr %zero.one, align 4, !tbaa !5 %inc5 = add nsw i32 %2, 1 store i32 %inc5, ptr @i, align 4, !tbaa !5 %5 = load i32, ptr @n, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %2, %5 br i1 %cmp.not.not, label %for.body, label %for.cond6.preheader, !llvm.loop !9 for.body8: ; preds = %for.cond6.preheader, %for.inc33 %call9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t, ptr noundef nonnull @p) %6 = load i32, ptr @t, align 4, !tbaa !5 %cmp10 = icmp eq i32 %6, 1 %7 = load i32, ptr @p, align 4, !tbaa !5 br i1 %cmp10, label %if.then11, label %if.else25 if.then11: ; preds = %for.body8 %idxprom12 = sext i32 %7 to i64 %arrayidx13 = getelementptr inbounds [100001 x i32], ptr @arr, i64 0, i64 %idxprom12 %8 = load i32, ptr %arrayidx13, align 4, !tbaa !5 %tobool14.not = icmp eq i32 %8, 0 %9 = load i32, ptr @one, align 4, !tbaa !5 br i1 %tobool14.not, label %if.else19, label %if.then15 if.then15: ; preds = %if.then11 %dec = add nsw i32 %9, -1 store i32 %dec, ptr @one, align 4, !tbaa !5 %10 = load i32, ptr @zero, align 4, !tbaa !5 %inc16 = add nsw i32 %10, 1 store i32 %inc16, ptr @zero, align 4, !tbaa !5 store i32 0, ptr %arrayidx13, align 4, !tbaa !5 br label %for.inc33 if.else19: ; preds = %if.then11 %inc20 = add nsw i32 %9, 1 store i32 %inc20, ptr @one, align 4, !tbaa !5 %11 = load i32, ptr @zero, align 4, !tbaa !5 %dec21 = add nsw i32 %11, -1 store i32 %dec21, ptr @zero, align 4, !tbaa !5 store i32 1, ptr %arrayidx13, align 4, !tbaa !5 br label %for.inc33 if.else25: ; preds = %for.body8 %12 = load i32, ptr @one, align 4, !tbaa !5 %cmp26.not = icmp sgt i32 %7, %12 br i1 %cmp26.not, label %if.else29, label %if.then27 if.then27: ; preds = %if.else25 %puts37 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %for.inc33 if.else29: ; preds = %if.else25 %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc33 for.inc33: ; preds = %if.else19, %if.then15, %if.else29, %if.then27 %13 = load i32, ptr @i, align 4, !tbaa !5 %inc34 = add nsw i32 %13, 1 store i32 %inc34, ptr @i, align 4, !tbaa !5 %14 = load i32, ptr @m, align 4, !tbaa !5 %cmp7.not.not = icmp slt i32 %13, %14 br i1 %cmp7.not.not, label %for.body8, label %for.end35, !llvm.loop !11 for.end35: ; preds = %for.inc33, %for.cond6.preheader 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 @puts(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 = { 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 = { 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 = !{!"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}
// AOJ 2321: Butterfly // 2017.10.7 bal4u@uu #include <stdio.h> #include <string.h> int dp[65536+2]; int main() { int n, m, l, i, j, k, s, e, ans, a; while (scanf("%d", &n) && n > 0) { memset(dp, 0, sizeof(dp)); for (i = 0; i < n; i++) { scanf("%d%d", &m, &l); for (a = 0, j = 0; j < m; j++) { scanf("%d%d", &s, &e); s -= 6; e -= 6; for (k = s; k < e; k++) a |= 1 << k; } for (ans = 0, j = 0; j < 65536; j++) { // 65536 = 1 << 16 if (!(j & a)) { int x = j | a; if (dp[x] < dp[j]+l) dp[x] = dp[j]+l; if (ans < dp[x]) ans = dp[x]; } } } printf("%d\n",ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179644/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179644/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 @dp = dso_local local_unnamed_addr global [65538 x i32] zeroinitializer, align 16 @.str.1 = private unnamed_addr constant [5 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 %l = alloca i32, align 4 %s = alloca i32, align 4 %e = 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 4, ptr nonnull %l) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #5 %call71 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %tobool72 = icmp ne i32 %call71, 0 %0 = load i32, ptr %n, align 4 %cmp73 = icmp sgt i32 %0, 0 %1 = select i1 %tobool72, i1 %cmp73, i1 false br i1 %1, label %for.body.preheader, label %while.end for.body.preheader: ; preds = %entry, %for.end41 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(262152) @dp, i8 0, i64 262152, i1 false) br label %for.body for.body: ; preds = %for.body.preheader, %for.inc39 %i.069 = phi i32 [ %inc40, %for.inc39 ], [ 0, %for.body.preheader ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m, ptr noundef nonnull %l) %2 = load i32, ptr %m, align 4, !tbaa !5 %cmp462 = icmp sgt i32 %2, 0 br i1 %cmp462, label %for.body5, label %for.cond14.preheader for.cond14.preheader: ; preds = %for.inc11, %for.body %a.0.lcssa = phi i32 [ 0, %for.body ], [ %a.1.lcssa, %for.inc11 ] %3 = load i32, ptr %l, align 4 br label %for.body16 for.body5: ; preds = %for.body, %for.inc11 %a.064 = phi i32 [ %a.1.lcssa, %for.inc11 ], [ 0, %for.body ] %j.063 = phi i32 [ %inc12, %for.inc11 ], [ 0, %for.body ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %e) %4 = load i32, ptr %s, align 4, !tbaa !5 %sub = add nsw i32 %4, -6 store i32 %sub, ptr %s, align 4, !tbaa !5 %5 = load i32, ptr %e, align 4, !tbaa !5 %sub7 = add nsw i32 %5, -6 store i32 %sub7, ptr %e, align 4, !tbaa !5 %cmp959 = icmp slt i32 %4, %5 br i1 %cmp959, label %for.body10, label %for.inc11 for.body10: ; preds = %for.body5, %for.body10 %a.161 = phi i32 [ %or, %for.body10 ], [ %a.064, %for.body5 ] %k.060 = phi i32 [ %inc, %for.body10 ], [ %sub, %for.body5 ] %shl = shl nuw i32 1, %k.060 %or = or i32 %a.161, %shl %inc = add nsw i32 %k.060, 1 %cmp9 = icmp slt i32 %inc, %sub7 br i1 %cmp9, label %for.body10, label %for.inc11, !llvm.loop !9 for.inc11: ; preds = %for.body10, %for.body5 %a.1.lcssa = phi i32 [ %a.064, %for.body5 ], [ %or, %for.body10 ] %inc12 = add nuw nsw i32 %j.063, 1 %6 = load i32, ptr %m, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc12, %6 br i1 %cmp4, label %for.body5, label %for.cond14.preheader, !llvm.loop !11 for.body16: ; preds = %for.cond14.preheader, %for.inc36 %indvars.iv = phi i64 [ 0, %for.cond14.preheader ], [ %indvars.iv.next, %for.inc36 ] %ans.267 = phi i32 [ 0, %for.cond14.preheader ], [ %ans.4, %for.inc36 ] %7 = trunc i64 %indvars.iv to i32 %and = and i32 %a.0.lcssa, %7 %tobool17.not = icmp eq i32 %and, 0 br i1 %tobool17.not, label %if.then, label %for.inc36 if.then: ; preds = %for.body16 %or18 = or i32 %a.0.lcssa, %7 %idxprom = sext i32 %or18 to i64 %arrayidx = getelementptr inbounds [65538 x i32], ptr @dp, i64 0, i64 %idxprom %8 = load i32, ptr %arrayidx, align 4, !tbaa !5 %arrayidx20 = getelementptr inbounds [65538 x i32], ptr @dp, i64 0, i64 %indvars.iv %9 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %add = add nsw i32 %3, %9 %cmp21 = icmp slt i32 %8, %add br i1 %cmp21, label %if.then22, label %if.end if.then22: ; preds = %if.then store i32 %add, ptr %arrayidx, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then22, %if.then %10 = phi i32 [ %add, %if.then22 ], [ %8, %if.then ] %spec.select = call i32 @llvm.smax.i32(i32 %ans.267, i32 %10) br label %for.inc36 for.inc36: ; preds = %for.body16, %if.end %ans.4 = phi i32 [ %ans.267, %for.body16 ], [ %spec.select, %if.end ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 65536 br i1 %exitcond.not, label %for.inc39, label %for.body16, !llvm.loop !12 for.inc39: ; preds = %for.inc36 %inc40 = add nuw nsw i32 %i.069, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %cmp1 = icmp slt i32 %inc40, %11 br i1 %cmp1, label %for.body, label %for.end41, !llvm.loop !13 for.end41: ; preds = %for.inc39 %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.4) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %tobool = icmp ne i32 %call, 0 %12 = load i32, ptr %n, align 4 %cmp = icmp sgt i32 %12, 0 %13 = select i1 %tobool, i1 %cmp, i1 false br i1 %13, label %for.body.preheader, label %while.end, !llvm.loop !14 while.end: ; preds = %for.end41, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #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: 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 = 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<string.h> #include<stdlib.h> #include<math.h> #define PI 3.141592653589793 #define MOD 1000000007 long int combination(long int n, long int r); //qsort用、昇順 int compare_int(const void *a, const void *b) { return *(int*)a-*(int*)b; } long int combination(long int n, long int r) { if(r>n-r) r = n-r; if(r == 0) return 1; else if(r == 1) return n; return (combination(n-1, r) + combination(n-1, r-1)); //大きくなるとき /* long int tmp1, tmp2, tmp3; tmp1 = combination(n-1, r); if(tmp1>=MOD) tmp1 = tmp1%MOD; tmp2 = combination(n-1, r-1); if(tmp2>=MOD) tmp2 = tmp2%MOD; tmp3 = tmp1+tmp2; if(tmp3>=MOD) tmp3 = tmp3%MOD; return (tmp3); */ } int main(){ long int n, t; scanf("%ld%ld", &n, &t); long int time[n]; long int ans=0; scanf("%ld", &time[0]); for(int i=1; i<n; i++){ scanf("%ld", &time[i]); if(time[i]-time[i-1]>t) ans += t; else ans += time[i]-time[i-1]; //printf("%ld\n", ans); } ans += t; printf("%ld\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179688/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179688/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 [7 x i8] c"%ld%ld\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%ld\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: nofree nosync nounwind memory(none) uwtable define dso_local i64 @combination(i64 noundef %n, i64 noundef %r) local_unnamed_addr #1 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end7, %entry %accumulator.tr = phi i64 [ 0, %entry ], [ %add, %if.end7 ] %n.tr = phi i64 [ %n, %entry ], [ %sub8, %if.end7 ] %r.tr = phi i64 [ %r, %entry ], [ %sub10, %if.end7 ] %sub = sub nsw i64 %n.tr, %r.tr %spec.select = tail call i64 @llvm.smin.i64(i64 %sub, i64 %r.tr) switch i64 %spec.select, label %if.end7 [ i64 0, label %return.loopexit i64 1, label %return ] if.end7: ; preds = %tailrecurse %sub8 = add nsw i64 %n.tr, -1 %call = tail call i64 @combination(i64 noundef %sub8, i64 noundef %spec.select) %sub10 = add nsw i64 %spec.select, -1 %add = add nsw i64 %call, %accumulator.tr br label %tailrecurse return.loopexit: ; preds = %tailrecurse br label %return return: ; preds = %tailrecurse, %return.loopexit %retval.0 = phi i64 [ 1, %return.loopexit ], [ %n.tr, %tailrecurse ] %accumulator.ret.tr = add nsw i64 %retval.0, %accumulator.tr ret i64 %accumulator.ret.tr } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i64, align 8 %t = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t) %0 = load i64, ptr %n, align 8, !tbaa !9 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i64, i64 %0, align 16 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla) %2 = load i64, ptr %n, align 8, !tbaa !9 %cmp30 = icmp sgt i64 %2, 1 br i1 %cmp30, label %for.body.preheader, label %entry.for.cond.cleanup_crit_edge entry.for.cond.cleanup_crit_edge: ; preds = %entry %.pre = load i64, ptr %t, align 8, !tbaa !9 br label %for.cond.cleanup for.body.preheader: ; preds = %entry %invariant.gep = getelementptr i64, ptr %vla, i64 -1 br label %for.body for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge %3 = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %6, %for.body ] %ans.0.lcssa = phi i64 [ 0, %entry.for.cond.cleanup_crit_edge ], [ %ans.1, %for.body ] %add19 = add nsw i64 %3, %ans.0.lcssa %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add19) call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #7 ret i32 0 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %ans.031 = phi i64 [ 0, %for.body.preheader ], [ %ans.1, %for.body ] %arrayidx3 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx3) %4 = load i64, ptr %arrayidx3, align 8, !tbaa !9 %gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv %5 = load i64, ptr %gep, align 8, !tbaa !9 %sub9 = sub nsw i64 %4, %5 %6 = load i64, ptr %t, align 8, !tbaa !9 %.sub9 = call i64 @llvm.smin.i64(i64 %sub9, i64 %6) %ans.1 = add nsw i64 %.sub9, %ans.031 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %7 = load i64, ptr %n, align 8, !tbaa !9 %cmp = icmp sgt i64 %7, %indvars.iv.next br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11 } ; 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 declare ptr @llvm.stacksave.p0() #5 ; 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: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #6 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 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { 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 = !{!"long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(){ char s[51]; scanf("%s",s); char aki[10]="AKIHABARA"; char akb[10]="KIHBR"; int i=0,g,c=0; for(g=0;s[g]!=0;g++); if(g>9){ puts("NO"); return 0; } for(i=0;i<g;i++){ if(s[i]=='A'){ if(s[i+1]=='A'){ puts("NO"); return 0; } continue; } if(akb[c++]!=s[i]){ puts("NO"); return 0; } if(s[i]=='K'&&(s[i+1]!='I'||s[i+2]!='H')){ puts("NO"); return 0; } } if(c!=5)puts("NO"); else puts("YES"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179745/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179745/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"%s\00", align 1 @__const.main.akb = private unnamed_addr constant [10 x i8] c"KIHBR\00\00\00\00\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %s = alloca [51 x i8], align 16 call void @llvm.lifetime.start.p0(i64 51, ptr nonnull %s) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) br label %for.cond for.cond: ; preds = %for.cond, %entry %indvars.iv94 = phi i32 [ %indvars.iv.next95, %for.cond ], [ 0, %entry ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp.not = icmp eq i8 %0, 0 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %indvars.iv.next95 = add nuw i32 %indvars.iv94, 1 br i1 %cmp.not, label %for.end, label %for.cond, !llvm.loop !8 for.end: ; preds = %for.cond %1 = trunc i64 %indvars.iv to i32 %2 = add i32 %1, -10 %or.cond = icmp ult i32 %2, -9 br i1 %or.cond, label %cleanup, label %for.body8.preheader for.body8.preheader: ; preds = %for.end %wide.trip.count = zext i32 %indvars.iv94 to i64 br label %for.body8 for.body8: ; preds = %for.body8.preheader, %for.inc56 %indvars.iv88 = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next89.pre-phi, %for.inc56 ] %c.086 = phi i32 [ 0, %for.body8.preheader ], [ %c.1, %for.inc56 ] %arrayidx10 = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %indvars.iv88 %3 = load i8, ptr %arrayidx10, align 1, !tbaa !5 %cmp12 = icmp eq i8 %3, 65 br i1 %cmp12, label %if.then14, label %if.end23 if.then14: ; preds = %for.body8 %4 = add nuw nsw i64 %indvars.iv88, 1 %arrayidx16 = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %4 %5 = load i8, ptr %arrayidx16, align 1, !tbaa !5 %cmp18 = icmp eq i8 %5, 65 br i1 %cmp18, label %cleanup, label %for.inc56 if.end23: ; preds = %for.body8 %inc24 = add nsw i32 %c.086, 1 %idxprom25 = sext i32 %c.086 to i64 %arrayidx26 = getelementptr inbounds [10 x i8], ptr @__const.main.akb, i64 0, i64 %idxprom25 %6 = load i8, ptr %arrayidx26, align 1, !tbaa !5 %cmp31.not = icmp eq i8 %6, %3 br i1 %cmp31.not, label %if.end35, label %cleanup if.end35: ; preds = %if.end23 %cmp39 = icmp eq i8 %3, 75 %7 = add nuw nsw i64 %indvars.iv88, 1 br i1 %cmp39, label %land.lhs.true, label %for.inc56 land.lhs.true: ; preds = %if.end35 %arrayidx43 = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %7 %8 = load i8, ptr %arrayidx43, align 1, !tbaa !5 %cmp45.not = icmp eq i8 %8, 73 br i1 %cmp45.not, label %lor.lhs.false, label %cleanup lor.lhs.false: ; preds = %land.lhs.true %9 = add nuw nsw i64 %indvars.iv88, 2 %arrayidx49 = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %9 %10 = load i8, ptr %arrayidx49, align 1, !tbaa !5 %cmp51.not = icmp eq i8 %10, 72 br i1 %cmp51.not, label %for.inc56, label %cleanup for.inc56: ; preds = %if.end35, %lor.lhs.false, %if.then14 %indvars.iv.next89.pre-phi = phi i64 [ %7, %lor.lhs.false ], [ %4, %if.then14 ], [ %7, %if.end35 ] %c.1 = phi i32 [ %inc24, %lor.lhs.false ], [ %c.086, %if.then14 ], [ %inc24, %if.end35 ] %exitcond.not = icmp eq i64 %indvars.iv.next89.pre-phi, %wide.trip.count br i1 %exitcond.not, label %for.end58, label %for.body8, !llvm.loop !10 for.end58: ; preds = %for.inc56 %11 = icmp eq i32 %c.1, 5 %spec.select = select i1 %11, ptr @.str.2, ptr @.str.1 br label %cleanup cleanup: ; preds = %land.lhs.true, %lor.lhs.false, %if.end23, %if.then14, %for.end58, %for.end %.str.1.sink = phi ptr [ @.str.1, %for.end ], [ %spec.select, %for.end58 ], [ @.str.1, %if.then14 ], [ @.str.1, %if.end23 ], [ @.str.1, %lor.lhs.false ], [ @.str.1, %land.lhs.true ] %call62 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink) call void @llvm.lifetime.end.p0(i64 51, ptr nonnull %s) #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: 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9}
#include <stdio.h> int ans[7] = {0, 0, 0, 0, 0, 0, 0}; int num[10][7] = { {0, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 1, 1, 0}, {1, 0, 1, 1, 0, 1, 1}, {1, 0, 0, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0}, {1, 1, 0, 1, 1, 0, 1}, {1, 1, 1, 1, 1, 0, 1}, {0, 1, 0, 0, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1} }; int main() { int I, N; int i, n; for(;;) { scanf("%d", &N); if(N == -1) break; for(i = 0; i < 7; ++ i) ans[i] = 0; for(I = 0; I < N; ++ I) { scanf("%d", &n); for(i = 0; i < 7; ++ i) { printf("%d", ans[i] ^ num[n][i]); ans[i] = num[n][i]; } printf("\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179789/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179789/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" @ans = dso_local local_unnamed_addr global [7 x i32] zeroinitializer, align 16 @num = dso_local local_unnamed_addr global [10 x [7 x i32]] [[7 x i32] [i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], [7 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0], [7 x i32] [i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1], [7 x i32] [i32 1, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1], [7 x i32] [i32 1, i32 1, i32 0, i32 0, i32 1, i32 1, i32 0], [7 x i32] [i32 1, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1], [7 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 1], [7 x i32] [i32 0, i32 1, i32 0, i32 0, i32 1, i32 1, i32 1], [7 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], [7 x i32] [i32 1, i32 1, i32 0, i32 1, i32 1, i32 1, i32 1]], align 16 @.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: %N = alloca i32, align 4 %n = 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 %n) #5 %call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp45 = icmp eq i32 %0, -1 br i1 %cmp45, label %for.end30, label %for.cond1.preheader for.cond.loopexit: ; preds = %for.body5, %for.cond1.preheader %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %1 = load i32, ptr %N, align 4, !tbaa !5 %cmp = icmp eq i32 %1, -1 br i1 %cmp, label %for.end30, label %for.cond1.preheader for.cond1.preheader: ; preds = %entry, %for.cond.loopexit %2 = phi i32 [ %1, %for.cond.loopexit ], [ %0, %entry ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(28) @ans, i8 0, i64 28, i1 false), !tbaa !5 %cmp442 = icmp sgt i32 %2, 0 br i1 %cmp442, label %for.body5, label %for.cond.loopexit for.body5: ; preds = %for.cond1.preheader, %for.body5 %I.043 = phi i32 [ %inc28, %for.body5 ], [ 0, %for.cond1.preheader ] %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %3 = load i32, ptr @ans, align 16, !tbaa !5 %4 = load i32, ptr %n, align 4, !tbaa !5 %idxprom12 = sext i32 %4 to i64 %arrayidx15 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom12, i64 0 %5 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %xor = xor i32 %5, %3 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor) %6 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17 = sext i32 %6 to i64 %arrayidx20 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17, i64 0 %7 = load i32, ptr %arrayidx20, align 4, !tbaa !5 store i32 %7, ptr @ans, align 16, !tbaa !5 %8 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 1), align 4, !tbaa !5 %arrayidx15.1 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17, i64 1 %9 = load i32, ptr %arrayidx15.1, align 4, !tbaa !5 %xor.1 = xor i32 %9, %8 %call16.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor.1) %10 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17.1 = sext i32 %10 to i64 %arrayidx20.1 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.1, i64 1 %11 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5 store i32 %11, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 1), align 4, !tbaa !5 %12 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 2), align 8, !tbaa !5 %arrayidx15.2 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.1, i64 2 %13 = load i32, ptr %arrayidx15.2, align 4, !tbaa !5 %xor.2 = xor i32 %13, %12 %call16.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor.2) %14 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17.2 = sext i32 %14 to i64 %arrayidx20.2 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.2, i64 2 %15 = load i32, ptr %arrayidx20.2, align 4, !tbaa !5 store i32 %15, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 2), align 8, !tbaa !5 %16 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 3), align 4, !tbaa !5 %arrayidx15.3 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.2, i64 3 %17 = load i32, ptr %arrayidx15.3, align 4, !tbaa !5 %xor.3 = xor i32 %17, %16 %call16.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor.3) %18 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17.3 = sext i32 %18 to i64 %arrayidx20.3 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.3, i64 3 %19 = load i32, ptr %arrayidx20.3, align 4, !tbaa !5 store i32 %19, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 3), align 4, !tbaa !5 %20 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 4), align 16, !tbaa !5 %arrayidx15.4 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.3, i64 4 %21 = load i32, ptr %arrayidx15.4, align 4, !tbaa !5 %xor.4 = xor i32 %21, %20 %call16.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor.4) %22 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17.4 = sext i32 %22 to i64 %arrayidx20.4 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.4, i64 4 %23 = load i32, ptr %arrayidx20.4, align 4, !tbaa !5 store i32 %23, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 4), align 16, !tbaa !5 %24 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 5), align 4, !tbaa !5 %arrayidx15.5 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.4, i64 5 %25 = load i32, ptr %arrayidx15.5, align 4, !tbaa !5 %xor.5 = xor i32 %25, %24 %call16.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor.5) %26 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17.5 = sext i32 %26 to i64 %arrayidx20.5 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.5, i64 5 %27 = load i32, ptr %arrayidx20.5, align 4, !tbaa !5 store i32 %27, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 5), align 4, !tbaa !5 %28 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 6), align 8, !tbaa !5 %arrayidx15.6 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.5, i64 6 %29 = load i32, ptr %arrayidx15.6, align 4, !tbaa !5 %xor.6 = xor i32 %29, %28 %call16.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %xor.6) %30 = load i32, ptr %n, align 4, !tbaa !5 %idxprom17.6 = sext i32 %30 to i64 %arrayidx20.6 = getelementptr inbounds [10 x [7 x i32]], ptr @num, i64 0, i64 %idxprom17.6, i64 6 %31 = load i32, ptr %arrayidx20.6, align 4, !tbaa !5 store i32 %31, ptr getelementptr inbounds ([7 x i32], ptr @ans, i64 0, i64 6), align 8, !tbaa !5 %putchar = call i32 @putchar(i32 10) %inc28 = add nuw nsw i32 %I.043, 1 %32 = load i32, ptr %N, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc28, %32 br i1 %cmp4, label %for.body5, label %for.cond.loopexit, !llvm.loop !9 for.end30: ; preds = %for.cond.loopexit, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { nofree nounwind } 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} !10 = !{!"llvm.loop.mustprogress"}
#include <float.h> #include <inttypes.h> #include <limits.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> #include <math.h> #ifdef __cplusplus #include <bits/stdc++.h> #endif #define getchar getchar_unlocked #define putchar putchar_unlocked int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; } int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; } uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; } int edge[99999][2]; int qmem[199998]; int u, v; int *e[100000]; int el[100000]; bool p[100000]; int f(int now, int from, int k){ if(now==v){return 1;} if(el[now]==1 && e[now][0]==from) return 0; for(int i=0; i<el[now]; i++){ int to=e[now][i]; if(to!=from){ int v=f(to, now, k+1); if(v>0){ if(v<=k){ p[now]=true; u=from; } return v+1; } } } return 0; } int g(int now, int from){ if(p[now]) return 0; p[now]=true; if(el[now]==1 && e[now][0]==from) return 1; int ans=0; for(int i=0; i<el[now]; i++){ int to=e[now][i]; if(to!=from){ int pos=g(to, now); if(pos>ans) ans=pos; } } return ans+1; } int main(void){ int n=nextint(); u=nextint()-1; v=nextint()-1; for(int i=0; i<n-1; i++){ int A=nextint()-1; int B=nextint()-1; edge[i][0]=A; edge[i][1]=B; el[A]++; el[B]++; } int ne=0; for(int i=0; i<n; i++){ e[i]=&qmem[ne]; ne+=el[i]; el[i]=0; } for(int i=0; i<n-1; i++){ int A=edge[i][0]; int B=edge[i][1]; e[A][el[A]++]=B; e[B][el[B]++]=A; } int a=f(u, -1, 0); p[v]=true; int b=g(u, -1); int ans=b+(a+1)/2-2; printf("%d\n", ans); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179839/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179839/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._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] } @v = dso_local local_unnamed_addr global i32 0, align 4 @el = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16 @e = dso_local local_unnamed_addr global [100000 x ptr] zeroinitializer, align 16 @p = dso_local local_unnamed_addr global [100000 x i8] zeroinitializer, align 16 @u = dso_local local_unnamed_addr global i32 0, align 4 @edge = dso_local local_unnamed_addr global [99999 x [2 x i32]] zeroinitializer, align 16 @qmem = dso_local global [199998 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nounwind uwtable define dso_local i32 @nextint() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %entry %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 br label %getchar_unlocked.exit cond.false.i: ; preds = %entry %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %getchar_unlocked.exit getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ] %sext72 = shl i32 %cond.i, 24 %cmp.not73 = icmp ne i32 %sext72, 754974720 %4 = add i32 %sext72, -956301313 %5 = icmp ult i32 %4, -150994945 %or.cond74 = and i1 %cmp.not73, %5 br i1 %or.cond74, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %getchar_unlocked.exit %.pre81 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit51 %6 = phi ptr [ %.pre81, %while.body.preheader ], [ %10, %getchar_unlocked.exit51 ] %_IO_read_ptr.i42 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1 %7 = load ptr, ptr %_IO_read_ptr.i42, align 8, !tbaa !9 %_IO_read_end.i43 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2 %8 = load ptr, ptr %_IO_read_end.i43, align 8, !tbaa !14 %cmp.not.i44 = icmp ult ptr %7, %8 br i1 %cmp.not.i44, label %cond.false.i48, label %cond.true.i45, !prof !15 cond.true.i45: ; preds = %while.body %call.i46 = tail call i32 @__uflow(ptr noundef nonnull %6) #5 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit51 cond.false.i48: ; preds = %while.body %incdec.ptr.i49 = getelementptr inbounds i8, ptr %7, i64 1 store ptr %incdec.ptr.i49, ptr %_IO_read_ptr.i42, align 8, !tbaa !9 %9 = load i8, ptr %7, align 1, !tbaa !16 %conv3.i50 = zext i8 %9 to i32 br label %getchar_unlocked.exit51 getchar_unlocked.exit51: ; preds = %cond.true.i45, %cond.false.i48 %10 = phi ptr [ %.pre, %cond.true.i45 ], [ %6, %cond.false.i48 ] %cond.i47 = phi i32 [ %call.i46, %cond.true.i45 ], [ %conv3.i50, %cond.false.i48 ] %sext = shl i32 %cond.i47, 24 %cmp.not = icmp ne i32 %sext, 754974720 %11 = add i32 %sext, -956301313 %12 = icmp ult i32 %11, -150994945 %or.cond = and i1 %cmp.not, %12 br i1 %or.cond, label %while.body, label %while.end, !llvm.loop !17 while.end: ; preds = %getchar_unlocked.exit51, %getchar_unlocked.exit %c.0.in.lcssa = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %cond.i47, %getchar_unlocked.exit51 ] %sext.lcssa = phi i32 [ %sext72, %getchar_unlocked.exit ], [ %sext, %getchar_unlocked.exit51 ] %cmp12 = icmp eq i32 %sext.lcssa, 754974720 br i1 %cmp12, label %if.then, label %if.end if.then: ; preds = %while.end %13 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i52 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1 %14 = load ptr, ptr %_IO_read_ptr.i52, align 8, !tbaa !9 %_IO_read_end.i53 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2 %15 = load ptr, ptr %_IO_read_end.i53, align 8, !tbaa !14 %cmp.not.i54 = icmp ult ptr %14, %15 br i1 %cmp.not.i54, label %cond.false.i58, label %cond.true.i55, !prof !15 cond.true.i55: ; preds = %if.then %call.i56 = tail call i32 @__uflow(ptr noundef nonnull %13) #5 br label %if.end cond.false.i58: ; preds = %if.then %incdec.ptr.i59 = getelementptr inbounds i8, ptr %14, i64 1 store ptr %incdec.ptr.i59, ptr %_IO_read_ptr.i52, align 8, !tbaa !9 %16 = load i8, ptr %14, align 1, !tbaa !16 %conv3.i60 = zext i8 %16 to i32 br label %if.end if.end: ; preds = %cond.false.i58, %cond.true.i55, %while.end %c.1.in = phi i32 [ %c.0.in.lcssa, %while.end ], [ %call.i56, %cond.true.i55 ], [ %conv3.i60, %cond.false.i58 ] %sext4076 = shl i32 %c.1.in, 24 %17 = add i32 %sext4076, -788529153 %18 = icmp ult i32 %17, 184549375 br i1 %18, label %while.body25.preheader, label %while.end29 while.body25.preheader: ; preds = %if.end %.pre83 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body25 while.body25: ; preds = %while.body25.preheader, %getchar_unlocked.exit71 %19 = phi ptr [ %23, %getchar_unlocked.exit71 ], [ %.pre83, %while.body25.preheader ] %x.078 = phi i32 [ %sub, %getchar_unlocked.exit71 ], [ 0, %while.body25.preheader ] %c.2.in77 = phi i32 [ %cond.i67, %getchar_unlocked.exit71 ], [ %c.1.in, %while.body25.preheader ] %conv17 = and i32 %c.2.in77, 255 %mul = mul i32 %x.078, 10 %add = add nsw i32 %conv17, -48 %sub = add i32 %add, %mul %_IO_read_ptr.i62 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 1 %20 = load ptr, ptr %_IO_read_ptr.i62, align 8, !tbaa !9 %_IO_read_end.i63 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 2 %21 = load ptr, ptr %_IO_read_end.i63, align 8, !tbaa !14 %cmp.not.i64 = icmp ult ptr %20, %21 br i1 %cmp.not.i64, label %cond.false.i68, label %cond.true.i65, !prof !15 cond.true.i65: ; preds = %while.body25 %call.i66 = tail call i32 @__uflow(ptr noundef nonnull %19) #5 %.pre82 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit71 cond.false.i68: ; preds = %while.body25 %incdec.ptr.i69 = getelementptr inbounds i8, ptr %20, i64 1 store ptr %incdec.ptr.i69, ptr %_IO_read_ptr.i62, align 8, !tbaa !9 %22 = load i8, ptr %20, align 1, !tbaa !16 %conv3.i70 = zext i8 %22 to i32 br label %getchar_unlocked.exit71 getchar_unlocked.exit71: ; preds = %cond.true.i65, %cond.false.i68 %23 = phi ptr [ %.pre82, %cond.true.i65 ], [ %19, %cond.false.i68 ] %cond.i67 = phi i32 [ %call.i66, %cond.true.i65 ], [ %conv3.i70, %cond.false.i68 ] %sext40 = shl i32 %cond.i67, 24 %24 = add i32 %sext40, -788529153 %25 = icmp ult i32 %24, 184549375 br i1 %25, label %while.body25, label %while.end29, !llvm.loop !19 while.end29: ; preds = %getchar_unlocked.exit71, %if.end %x.0.lcssa = phi i32 [ 0, %if.end ], [ %sub, %getchar_unlocked.exit71 ] %sub31 = sub i32 0, %x.0.lcssa %cond = select i1 %cmp12, i32 %sub31, i32 %x.0.lcssa ret i32 %cond } ; Function Attrs: nounwind uwtable define dso_local i64 @nextlong() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %entry %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 br label %getchar_unlocked.exit cond.false.i: ; preds = %entry %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %getchar_unlocked.exit getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i %cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ] %sext72 = shl i32 %cond.i, 24 %cmp.not73 = icmp ne i32 %sext72, 754974720 %4 = add i32 %sext72, -956301313 %5 = icmp ult i32 %4, -150994945 %or.cond74 = and i1 %cmp.not73, %5 br i1 %or.cond74, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %getchar_unlocked.exit %.pre81 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit51 %6 = phi ptr [ %.pre81, %while.body.preheader ], [ %10, %getchar_unlocked.exit51 ] %_IO_read_ptr.i42 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 1 %7 = load ptr, ptr %_IO_read_ptr.i42, align 8, !tbaa !9 %_IO_read_end.i43 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 2 %8 = load ptr, ptr %_IO_read_end.i43, align 8, !tbaa !14 %cmp.not.i44 = icmp ult ptr %7, %8 br i1 %cmp.not.i44, label %cond.false.i48, label %cond.true.i45, !prof !15 cond.true.i45: ; preds = %while.body %call.i46 = tail call i32 @__uflow(ptr noundef nonnull %6) #5 %.pre = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit51 cond.false.i48: ; preds = %while.body %incdec.ptr.i49 = getelementptr inbounds i8, ptr %7, i64 1 store ptr %incdec.ptr.i49, ptr %_IO_read_ptr.i42, align 8, !tbaa !9 %9 = load i8, ptr %7, align 1, !tbaa !16 %conv3.i50 = zext i8 %9 to i32 br label %getchar_unlocked.exit51 getchar_unlocked.exit51: ; preds = %cond.true.i45, %cond.false.i48 %10 = phi ptr [ %.pre, %cond.true.i45 ], [ %6, %cond.false.i48 ] %cond.i47 = phi i32 [ %call.i46, %cond.true.i45 ], [ %conv3.i50, %cond.false.i48 ] %sext = shl i32 %cond.i47, 24 %cmp.not = icmp ne i32 %sext, 754974720 %11 = add i32 %sext, -956301313 %12 = icmp ult i32 %11, -150994945 %or.cond = and i1 %cmp.not, %12 br i1 %or.cond, label %while.body, label %while.end, !llvm.loop !20 while.end: ; preds = %getchar_unlocked.exit51, %getchar_unlocked.exit %c.0.in.lcssa = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %cond.i47, %getchar_unlocked.exit51 ] %sext.lcssa = phi i32 [ %sext72, %getchar_unlocked.exit ], [ %sext, %getchar_unlocked.exit51 ] %cmp12.not = icmp eq i32 %sext.lcssa, 754974720 br i1 %cmp12.not, label %if.then, label %if.end if.then: ; preds = %while.end %13 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i52 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1 %14 = load ptr, ptr %_IO_read_ptr.i52, align 8, !tbaa !9 %_IO_read_end.i53 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2 %15 = load ptr, ptr %_IO_read_end.i53, align 8, !tbaa !14 %cmp.not.i54 = icmp ult ptr %14, %15 br i1 %cmp.not.i54, label %cond.false.i58, label %cond.true.i55, !prof !15 cond.true.i55: ; preds = %if.then %call.i56 = tail call i32 @__uflow(ptr noundef nonnull %13) #5 br label %if.end cond.false.i58: ; preds = %if.then %incdec.ptr.i59 = getelementptr inbounds i8, ptr %14, i64 1 store ptr %incdec.ptr.i59, ptr %_IO_read_ptr.i52, align 8, !tbaa !9 %16 = load i8, ptr %14, align 1, !tbaa !16 %conv3.i60 = zext i8 %16 to i32 br label %if.end if.end: ; preds = %cond.false.i58, %cond.true.i55, %while.end %c.1.in = phi i32 [ %c.0.in.lcssa, %while.end ], [ %call.i56, %cond.true.i55 ], [ %conv3.i60, %cond.false.i58 ] %sext3976 = shl i32 %c.1.in, 24 %17 = add i32 %sext3976, -788529153 %18 = icmp ult i32 %17, 184549375 br i1 %18, label %while.body25.preheader, label %while.end29 while.body25.preheader: ; preds = %if.end %.pre83 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %while.body25 while.body25: ; preds = %while.body25.preheader, %getchar_unlocked.exit71 %19 = phi ptr [ %23, %getchar_unlocked.exit71 ], [ %.pre83, %while.body25.preheader ] %x.078 = phi i64 [ %sub, %getchar_unlocked.exit71 ], [ 0, %while.body25.preheader ] %c.2.in77 = phi i32 [ %cond.i67, %getchar_unlocked.exit71 ], [ %c.1.in, %while.body25.preheader ] %c.2 = zext i32 %c.2.in77 to i64 %mul = mul i64 %x.078, 10 %sext40 = shl i64 %c.2, 56 %conv26 = ashr exact i64 %sext40, 56 %add = add i64 %mul, -48 %sub = add i64 %add, %conv26 %_IO_read_ptr.i62 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 1 %20 = load ptr, ptr %_IO_read_ptr.i62, align 8, !tbaa !9 %_IO_read_end.i63 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 2 %21 = load ptr, ptr %_IO_read_end.i63, align 8, !tbaa !14 %cmp.not.i64 = icmp ult ptr %20, %21 br i1 %cmp.not.i64, label %cond.false.i68, label %cond.true.i65, !prof !15 cond.true.i65: ; preds = %while.body25 %call.i66 = tail call i32 @__uflow(ptr noundef nonnull %19) #5 %.pre82 = load ptr, ptr @stdin, align 8, !tbaa !5 br label %getchar_unlocked.exit71 cond.false.i68: ; preds = %while.body25 %incdec.ptr.i69 = getelementptr inbounds i8, ptr %20, i64 1 store ptr %incdec.ptr.i69, ptr %_IO_read_ptr.i62, align 8, !tbaa !9 %22 = load i8, ptr %20, align 1, !tbaa !16 %conv3.i70 = zext i8 %22 to i32 br label %getchar_unlocked.exit71 getchar_unlocked.exit71: ; preds = %cond.true.i65, %cond.false.i68 %23 = phi ptr [ %.pre82, %cond.true.i65 ], [ %19, %cond.false.i68 ] %cond.i67 = phi i32 [ %call.i66, %cond.true.i65 ], [ %conv3.i70, %cond.false.i68 ] %sext39 = shl i32 %cond.i67, 24 %24 = add i32 %sext39, -788529153 %25 = icmp ult i32 %24, 184549375 br i1 %25, label %while.body25, label %while.end29, !llvm.loop !21 while.end29: ; preds = %getchar_unlocked.exit71, %if.end %x.0.lcssa = phi i64 [ 0, %if.end ], [ %sub, %getchar_unlocked.exit71 ] %sub30 = sub i64 0, %x.0.lcssa %cond = select i1 %cmp12.not, i64 %sub30, i64 %x.0.lcssa ret i64 %cond } ; Function Attrs: nounwind uwtable define dso_local i32 @nextstr(ptr nocapture noundef writeonly %s) local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1 %1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2 %2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14 %cmp.not.i = icmp ult ptr %1, %2 br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15 cond.true.i: ; preds = %entry %call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #5 br label %while.cond.preheader cond.false.i: ; preds = %entry %incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1 store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9 %3 = load i8, ptr %1, align 1, !tbaa !16 %conv3.i = zext i8 %3 to i32 br label %while.cond.preheader while.cond.preheader: ; preds = %cond.true.i, %cond.false.i %c.0.in.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ] br label %while.cond while.cond: ; preds = %while.cond.backedge, %while.cond.preheader %c.0.in = phi i32 [ %c.0.in.ph, %while.cond.preheader ], [ %c.0.in.be, %while.cond.backedge ] %sext = shl i32 %c.0.in, 24 switch i32 %sext, label %while.cond8 [ i32 536870912, label %while.body i32 167772160, label %while.body ] while.body: ; preds = %while.cond, %while.cond %4 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i26 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %_IO_read_ptr.i26, align 8, !tbaa !9 %_IO_read_end.i27 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2 %6 = load ptr, ptr %_IO_read_end.i27, align 8, !tbaa !14 %cmp.not.i28 = icmp ult ptr %5, %6 br i1 %cmp.not.i28, label %cond.false.i32, label %cond.true.i29, !prof !15 cond.true.i29: ; preds = %while.body %call.i30 = tail call i32 @__uflow(ptr noundef nonnull %4) #5 br label %while.cond.backedge while.cond.backedge: ; preds = %cond.true.i29, %cond.false.i32 %c.0.in.be = phi i32 [ %call.i30, %cond.true.i29 ], [ %conv3.i34, %cond.false.i32 ] br label %while.cond, !llvm.loop !22 cond.false.i32: ; preds = %while.body %incdec.ptr.i33 = getelementptr inbounds i8, ptr %5, i64 1 store ptr %incdec.ptr.i33, ptr %_IO_read_ptr.i26, align 8, !tbaa !9 %7 = load i8, ptr %5, align 1, !tbaa !16 %conv3.i34 = zext i8 %7 to i32 br label %while.cond.backedge while.cond8: ; preds = %while.cond, %while.cond8.backedge %s.addr.0 = phi ptr [ %incdec.ptr, %while.cond8.backedge ], [ %s, %while.cond ] %c.1.in = phi i32 [ %c.1.in.be, %while.cond8.backedge ], [ %c.0.in, %while.cond ] %len.0 = phi i32 [ %inc, %while.cond8.backedge ], [ 0, %while.cond ] %sext25 = shl i32 %c.1.in, 24 switch i32 %sext25, label %while.body15 [ i32 536870912, label %while.end18 i32 167772160, label %while.end18 ] while.body15: ; preds = %while.cond8 %c.1 = trunc i32 %c.1.in to i8 %incdec.ptr = getelementptr inbounds i8, ptr %s.addr.0, i64 1 store i8 %c.1, ptr %s.addr.0, align 1, !tbaa !16 %inc = add i32 %len.0, 1 %8 = load ptr, ptr @stdin, align 8, !tbaa !5 %_IO_read_ptr.i36 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1 %9 = load ptr, ptr %_IO_read_ptr.i36, align 8, !tbaa !9 %_IO_read_end.i37 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2 %10 = load ptr, ptr %_IO_read_end.i37, align 8, !tbaa !14 %cmp.not.i38 = icmp ult ptr %9, %10 br i1 %cmp.not.i38, label %cond.false.i42, label %cond.true.i39, !prof !15 cond.true.i39: ; preds = %while.body15 %call.i40 = tail call i32 @__uflow(ptr noundef nonnull %8) #5 br label %while.cond8.backedge while.cond8.backedge: ; preds = %cond.true.i39, %cond.false.i42 %c.1.in.be = phi i32 [ %call.i40, %cond.true.i39 ], [ %conv3.i44, %cond.false.i42 ] br label %while.cond8, !llvm.loop !23 cond.false.i42: ; preds = %while.body15 %incdec.ptr.i43 = getelementptr inbounds i8, ptr %9, i64 1 store ptr %incdec.ptr.i43, ptr %_IO_read_ptr.i36, align 8, !tbaa !9 %11 = load i8, ptr %9, align 1, !tbaa !16 %conv3.i44 = zext i8 %11 to i32 br label %while.cond8.backedge while.end18: ; preds = %while.cond8, %while.cond8 store i8 0, ptr %s.addr.0, align 1, !tbaa !16 ret i32 %len.0 } ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i32 @f(i32 noundef %now, i32 noundef %from, i32 noundef %k) local_unnamed_addr #1 { entry: %0 = load i32, ptr @v, align 4, !tbaa !24 %cmp = icmp eq i32 %0, %now br i1 %cmp, label %return, label %if.end if.end: ; preds = %entry %idxprom = sext i32 %now to i64 %arrayidx = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !24 %cmp1 = icmp eq i32 %1, 1 br i1 %cmp1, label %land.lhs.true, label %if.end7 land.lhs.true: ; preds = %if.end %arrayidx3 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %idxprom %2 = load ptr, ptr %arrayidx3, align 8, !tbaa !5 %3 = load i32, ptr %2, align 4, !tbaa !24 %cmp5 = icmp eq i32 %3, %from br i1 %cmp5, label %return, label %for.body.lr.ph if.end7: ; preds = %if.end %cmp10.not53 = icmp sgt i32 %1, 0 br i1 %cmp10.not53, label %for.body.lr.ph, label %return for.body.lr.ph: ; preds = %land.lhs.true, %if.end7 %arrayidx12 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %idxprom %add = add nsw i32 %k, 1 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.inc %4 = phi i32 [ %1, %for.body.lr.ph ], [ %7, %for.inc ] %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ] %5 = load ptr, ptr %arrayidx12, align 8, !tbaa !5 %arrayidx14 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv %6 = load i32, ptr %arrayidx14, align 4, !tbaa !24 %cmp15.not = icmp eq i32 %6, %from br i1 %cmp15.not, label %for.inc, label %if.then16 if.then16: ; preds = %for.body %call = tail call i32 @f(i32 noundef %6, i32 noundef %now, i32 noundef %add) %cmp17 = icmp slt i32 %call, 1 br i1 %cmp17, label %if.then16.for.inc_crit_edge, label %if.then18 if.then16.for.inc_crit_edge: ; preds = %if.then16 %.pre = load i32, ptr %arrayidx, align 4, !tbaa !24 br label %for.inc if.then18: ; preds = %if.then16 %cmp19.not = icmp sgt i32 %call, %k br i1 %cmp19.not, label %cleanup27, label %if.then20 if.then20: ; preds = %if.then18 %arrayidx22 = getelementptr inbounds [100000 x i8], ptr @p, i64 0, i64 %idxprom store i8 1, ptr %arrayidx22, align 1, !tbaa !25 store i32 %from, ptr @u, align 4, !tbaa !24 br label %cleanup27 cleanup27: ; preds = %if.then20, %if.then18 %add24 = add nuw nsw i32 %call, 1 br label %return for.inc: ; preds = %if.then16.for.inc_crit_edge, %for.body %7 = phi i32 [ %.pre, %if.then16.for.inc_crit_edge ], [ %4, %for.body ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %8 = sext i32 %7 to i64 %cmp10.not = icmp slt i64 %indvars.iv.next, %8 br i1 %cmp10.not, label %for.body, label %return, !llvm.loop !27 return: ; preds = %for.inc, %if.end7, %cleanup27, %land.lhs.true, %entry %retval.5 = phi i32 [ 1, %entry ], [ 0, %land.lhs.true ], [ %add24, %cleanup27 ], [ 0, %if.end7 ], [ 0, %for.inc ] ret i32 %retval.5 } ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i32 @g(i32 noundef %now, i32 noundef %from) local_unnamed_addr #1 { entry: %idxprom = sext i32 %now to i64 %arrayidx = getelementptr inbounds [100000 x i8], ptr @p, i64 0, i64 %idxprom %0 = load i8, ptr %arrayidx, align 1, !tbaa !25, !range !28, !noundef !29 %tobool.not = icmp eq i8 %0, 0 br i1 %tobool.not, label %if.end, label %return if.end: ; preds = %entry store i8 1, ptr %arrayidx, align 1, !tbaa !25 %arrayidx4 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx4, align 4, !tbaa !24 %cmp = icmp eq i32 %1, 1 br i1 %cmp, label %land.lhs.true, label %if.end10 land.lhs.true: ; preds = %if.end %arrayidx6 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %idxprom %2 = load ptr, ptr %arrayidx6, align 8, !tbaa !5 %3 = load i32, ptr %2, align 4, !tbaa !24 %cmp8 = icmp eq i32 %3, %from br i1 %cmp8, label %return, label %for.body.lr.ph if.end10: ; preds = %if.end %cmp1336 = icmp sgt i32 %1, 0 br i1 %cmp1336, label %for.body.lr.ph, label %return for.body.lr.ph: ; preds = %land.lhs.true, %if.end10 %arrayidx15 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %idxprom br label %for.body for.cond.cleanup.loopexit: ; preds = %if.end23 %4 = add nuw nsw i32 %ans.2, 1 br label %return for.body: ; preds = %for.body.lr.ph, %if.end23 %5 = phi i32 [ %1, %for.body.lr.ph ], [ %8, %if.end23 ] %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %if.end23 ] %ans.038 = phi i32 [ 0, %for.body.lr.ph ], [ %ans.2, %if.end23 ] %6 = load ptr, ptr %arrayidx15, align 8, !tbaa !5 %arrayidx17 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv %7 = load i32, ptr %arrayidx17, align 4, !tbaa !24 %cmp18.not = icmp eq i32 %7, %from br i1 %cmp18.not, label %if.end23, label %if.then19 if.then19: ; preds = %for.body %call = tail call i32 @g(i32 noundef %7, i32 noundef %now) %spec.select = tail call i32 @llvm.smax.i32(i32 %call, i32 %ans.038) %.pre = load i32, ptr %arrayidx4, align 4, !tbaa !24 br label %if.end23 if.end23: ; preds = %if.then19, %for.body %8 = phi i32 [ %.pre, %if.then19 ], [ %5, %for.body ] %ans.2 = phi i32 [ %spec.select, %if.then19 ], [ %ans.038, %for.body ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %9 = sext i32 %8 to i64 %cmp13 = icmp slt i64 %indvars.iv.next, %9 br i1 %cmp13, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !30 return: ; preds = %if.end10, %for.cond.cleanup.loopexit, %land.lhs.true, %entry %retval.0 = phi i32 [ 0, %entry ], [ 1, %land.lhs.true ], [ 1, %if.end10 ], [ %4, %for.cond.cleanup.loopexit ] ret i32 %retval.0 } ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %call = tail call i32 @nextint() %call1 = tail call i32 @nextint() %sub = add nsw i32 %call1, -1 store i32 %sub, ptr @u, align 4, !tbaa !24 %call2 = tail call i32 @nextint() %sub3 = add nsw i32 %call2, -1 store i32 %sub3, ptr @v, align 4, !tbaa !24 %sub4 = add i32 %call, -1 %cmp93 = icmp sgt i32 %call, 1 br i1 %cmp93, label %for.body.preheader, label %for.cond20.preheader for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %sub4 to i64 br label %for.body for.cond20.preheader: ; preds = %for.body, %entry %cmp2195 = icmp sgt i32 %call, 0 br i1 %cmp2195, label %for.body23.preheader, label %for.cond.cleanup39 for.body23.preheader: ; preds = %for.cond20.preheader %wide.trip.count104 = zext i32 %call to i64 %xtraiter = and i64 %wide.trip.count104, 1 %0 = icmp eq i32 %call, 1 br i1 %0, label %for.cond36.preheader.unr-lcssa, label %for.body23.preheader.new for.body23.preheader.new: ; preds = %for.body23.preheader %unroll_iter = and i64 %wide.trip.count104, 4294967294 br label %for.body23 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %call5 = tail call i32 @nextint() %sub6 = add nsw i32 %call5, -1 %call7 = tail call i32 @nextint() %sub8 = add nsw i32 %call7, -1 %arrayidx = getelementptr inbounds [99999 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv store i32 %sub6, ptr %arrayidx, align 8, !tbaa !24 %arrayidx12 = getelementptr inbounds [99999 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv, i64 1 store i32 %sub8, ptr %arrayidx12, align 4, !tbaa !24 %idxprom13 = sext i32 %sub6 to i64 %arrayidx14 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %idxprom13 %1 = load i32, ptr %arrayidx14, align 4, !tbaa !24 %inc = add nsw i32 %1, 1 store i32 %inc, ptr %arrayidx14, align 4, !tbaa !24 %idxprom15 = sext i32 %sub8 to i64 %arrayidx16 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %idxprom15 %2 = load i32, ptr %arrayidx16, align 4, !tbaa !24 %inc17 = add nsw i32 %2, 1 store i32 %inc17, ptr %arrayidx16, align 4, !tbaa !24 %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.cond20.preheader, label %for.body, !llvm.loop !31 for.cond36.preheader.unr-lcssa.loopexit: ; preds = %for.body23 %3 = sext i32 %add.1 to i64 br label %for.cond36.preheader.unr-lcssa for.cond36.preheader.unr-lcssa: ; preds = %for.cond36.preheader.unr-lcssa.loopexit, %for.body23.preheader %indvars.iv101.unr = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next102.1, %for.cond36.preheader.unr-lcssa.loopexit ] %ne.097.unr = phi i64 [ 0, %for.body23.preheader ], [ %3, %for.cond36.preheader.unr-lcssa.loopexit ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond36.preheader, label %for.body23.epil for.body23.epil: ; preds = %for.cond36.preheader.unr-lcssa %arrayidx25.epil = getelementptr inbounds [199998 x i32], ptr @qmem, i64 0, i64 %ne.097.unr %arrayidx27.epil = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %indvars.iv101.unr store ptr %arrayidx25.epil, ptr %arrayidx27.epil, align 8, !tbaa !5 %arrayidx29.epil = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %indvars.iv101.unr store i32 0, ptr %arrayidx29.epil, align 4, !tbaa !24 br label %for.cond36.preheader for.cond36.preheader: ; preds = %for.cond36.preheader.unr-lcssa, %for.body23.epil br i1 %cmp93, label %for.body40.preheader, label %for.cond.cleanup39 for.body40.preheader: ; preds = %for.cond36.preheader %wide.trip.count109 = zext i32 %sub4 to i64 br label %for.body40 for.body23: ; preds = %for.body23, %for.body23.preheader.new %indvars.iv101 = phi i64 [ 0, %for.body23.preheader.new ], [ %indvars.iv.next102.1, %for.body23 ] %ne.097 = phi i32 [ 0, %for.body23.preheader.new ], [ %add.1, %for.body23 ] %niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.1, %for.body23 ] %idxprom24 = sext i32 %ne.097 to i64 %arrayidx25 = getelementptr inbounds [199998 x i32], ptr @qmem, i64 0, i64 %idxprom24 %arrayidx27 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %indvars.iv101 store ptr %arrayidx25, ptr %arrayidx27, align 16, !tbaa !5 %arrayidx29 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %indvars.iv101 %4 = load i32, ptr %arrayidx29, align 8, !tbaa !24 %add = add nsw i32 %4, %ne.097 store i32 0, ptr %arrayidx29, align 8, !tbaa !24 %indvars.iv.next102 = or i64 %indvars.iv101, 1 %idxprom24.1 = sext i32 %add to i64 %arrayidx25.1 = getelementptr inbounds [199998 x i32], ptr @qmem, i64 0, i64 %idxprom24.1 %arrayidx27.1 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %indvars.iv.next102 store ptr %arrayidx25.1, ptr %arrayidx27.1, align 8, !tbaa !5 %arrayidx29.1 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %indvars.iv.next102 %5 = load i32, ptr %arrayidx29.1, align 4, !tbaa !24 %add.1 = add nsw i32 %5, %add store i32 0, ptr %arrayidx29.1, align 4, !tbaa !24 %indvars.iv.next102.1 = add nuw nsw i64 %indvars.iv101, 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.cond36.preheader.unr-lcssa.loopexit, label %for.body23, !llvm.loop !32 for.cond.cleanup39: ; preds = %for.body40, %for.cond20.preheader, %for.cond36.preheader %6 = load i32, ptr @u, align 4, !tbaa !24 %call66 = tail call i32 @f(i32 noundef %6, i32 noundef -1, i32 noundef 0) %7 = load i32, ptr @v, align 4, !tbaa !24 %idxprom67 = sext i32 %7 to i64 %arrayidx68 = getelementptr inbounds [100000 x i8], ptr @p, i64 0, i64 %idxprom67 store i8 1, ptr %arrayidx68, align 1, !tbaa !25 %8 = load i32, ptr @u, align 4, !tbaa !24 %call69 = tail call i32 @g(i32 noundef %8, i32 noundef -1) %add70 = add nsw i32 %call66, 1 %div = sdiv i32 %add70, 2 %add71 = add nsw i32 %div, -2 %sub72 = add i32 %add71, %call69 %call73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub72) ret i32 0 for.body40: ; preds = %for.body40.preheader, %for.body40 %indvars.iv106 = phi i64 [ 0, %for.body40.preheader ], [ %indvars.iv.next107, %for.body40 ] %arrayidx43 = getelementptr inbounds [99999 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv106 %9 = load i32, ptr %arrayidx43, align 8, !tbaa !24 %arrayidx48 = getelementptr inbounds [99999 x [2 x i32]], ptr @edge, i64 0, i64 %indvars.iv106, i64 1 %10 = load i32, ptr %arrayidx48, align 4, !tbaa !24 %idxprom49 = sext i32 %9 to i64 %arrayidx50 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %idxprom49 %11 = load ptr, ptr %arrayidx50, align 8, !tbaa !5 %arrayidx52 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %idxprom49 %12 = load i32, ptr %arrayidx52, align 4, !tbaa !24 %inc53 = add nsw i32 %12, 1 store i32 %inc53, ptr %arrayidx52, align 4, !tbaa !24 %idxprom54 = sext i32 %12 to i64 %arrayidx55 = getelementptr inbounds i32, ptr %11, i64 %idxprom54 store i32 %10, ptr %arrayidx55, align 4, !tbaa !24 %idxprom56 = sext i32 %10 to i64 %arrayidx57 = getelementptr inbounds [100000 x ptr], ptr @e, i64 0, i64 %idxprom56 %13 = load ptr, ptr %arrayidx57, align 8, !tbaa !5 %arrayidx59 = getelementptr inbounds [100000 x i32], ptr @el, i64 0, i64 %idxprom56 %14 = load i32, ptr %arrayidx59, align 4, !tbaa !24 %inc60 = add nsw i32 %14, 1 store i32 %inc60, ptr %arrayidx59, align 4, !tbaa !24 %idxprom61 = sext i32 %14 to i64 %arrayidx62 = getelementptr inbounds i32, ptr %13, i64 %idxprom61 store i32 %9, ptr %arrayidx62, align 4, !tbaa !24 %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1 %exitcond110.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count109 br i1 %exitcond110.not, label %for.cond.cleanup39, label %for.body40, !llvm.loop !33 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 declare i32 @__uflow(ptr noundef) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #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 = { nofree nosync nounwind memory(readwrite, argmem: read, 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { 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 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !6, i64 8} !10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196} !11 = !{!"int", !7, i64 0} !12 = !{!"long", !7, i64 0} !13 = !{!"short", !7, i64 0} !14 = !{!10, !6, i64 16} !15 = !{!"branch_weights", i32 2000, i32 1} !16 = !{!7, !7, i64 0} !17 = distinct !{!17, !18} !18 = !{!"llvm.loop.mustprogress"} !19 = distinct !{!19, !18} !20 = distinct !{!20, !18} !21 = distinct !{!21, !18} !22 = distinct !{!22, !18} !23 = distinct !{!23, !18} !24 = !{!11, !11, i64 0} !25 = !{!26, !26, i64 0} !26 = !{!"_Bool", !7, i64 0} !27 = distinct !{!27, !18} !28 = !{i8 0, i8 2} !29 = !{} !30 = distinct !{!30, !18} !31 = distinct !{!31, !18} !32 = distinct !{!32, !18} !33 = distinct !{!33, !18}
#include <stdio.h> #include <stdlib.h> #define MAPSIZE 1048576 int cmpmin(int a, int b) { return a-b; } int cmpmax(int a, int b) { return b-a; } typedef struct { int n, arr[200000]; int (*cmp)(int, int); } heap; void hpush(heap *h, int x) { int i = h->n++; h->arr[i] = x; while (i > 0) { int p = (i-1)/2; if (h->cmp(h->arr[p], h->arr[i]) > 0) { int t = h->arr[p]; h->arr[p] = h->arr[i]; h->arr[i] = t; i = p; } else break; } } int hpop(heap *h) { int ret = h->arr[0]; h->arr[0] = h->arr[--h->n]; int i = 0, c; while ((c = i*2 + 1) < h->n) { if (c+1 < h->n && h->cmp(h->arr[c], h->arr[c+1]) > 0) { c++; } if (h->cmp(h->arr[i], h->arr[c]) > 0) { int t = h->arr[c]; h->arr[c] = h->arr[i]; h->arr[i] = t; i = c; } else break; } return ret; } int hpeek(const heap *h) { return h->arr[0]; } heap left = {.n = 0, .cmp = cmpmax}, right = {.n = 0, .cmp = cmpmin}; int main(void) { int q; scanf("%d", &q); long long int y = 0, d = 0; while (q--) { int t; scanf("%d", &t); if (t == 1) { int a, b; scanf("%d%d", &a, &b); int px = hpeek(&left); y += abs(px-a); d += b; if (a < px) hpush(&left, a); else hpush(&right, a); int diff = left.n - right.n; if (diff == 2) hpush(&right, hpop(&left)); else if (diff == -1) hpush(&left, hpop(&right)); int x = hpeek(&left); if (x != px) { int lc = left.n; int rc = right.n; if (x > px) rc += 2; y += (long long int) (x - px) * (lc - rc); } } else { printf("%d %lld\n", hpeek(&left), y+d); } } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179882/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179882/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.heap = type { i32, [200000 x i32], ptr } @left = dso_local local_unnamed_addr global %struct.heap { i32 0, [200000 x i32] zeroinitializer, ptr @cmpmax }, align 8 @right = dso_local local_unnamed_addr global %struct.heap { i32 0, [200000 x i32] zeroinitializer, ptr @cmpmin }, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [9 x i8] c"%d %lld\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @cmpmin(i32 noundef %a, i32 noundef %b) #0 { entry: %sub = sub nsw i32 %a, %b ret i32 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @cmpmax(i32 noundef %a, i32 noundef %b) #0 { entry: %sub = sub nsw i32 %b, %a ret i32 %sub } ; Function Attrs: nounwind uwtable define dso_local void @hpush(ptr nocapture noundef %h, i32 noundef %x) local_unnamed_addr #1 { entry: %0 = load i32, ptr %h, align 8, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr %h, align 8, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom store i32 %x, ptr %arrayidx, align 4, !tbaa !11 %cmp41 = icmp sgt i32 %0, 0 br i1 %cmp41, label %while.body.lr.ph, label %while.end while.body.lr.ph: ; preds = %entry %cmp1 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 2 br label %while.body while.body: ; preds = %while.body.lr.ph, %cleanup %i.042 = phi i32 [ %0, %while.body.lr.ph ], [ %div37, %cleanup ] %sub = add nsw i32 %i.042, -1 %div37 = lshr i32 %sub, 1 %1 = load ptr, ptr %cmp1, align 8, !tbaa !12 %idxprom3 = zext i32 %div37 to i64 %arrayidx4 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom3 %2 = load i32, ptr %arrayidx4, align 4, !tbaa !11 %idxprom6 = zext i32 %i.042 to i64 %arrayidx7 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom6 %3 = load i32, ptr %arrayidx7, align 4, !tbaa !11 %call = tail call i32 %1(i32 noundef %2, i32 noundef %3) #6 %cmp8 = icmp sgt i32 %call, 0 br i1 %cmp8, label %cleanup, label %while.end cleanup: ; preds = %while.body %4 = load i32, ptr %arrayidx4, align 4, !tbaa !11 %5 = load i32, ptr %arrayidx7, align 4, !tbaa !11 store i32 %5, ptr %arrayidx4, align 4, !tbaa !11 store i32 %4, ptr %arrayidx7, align 4, !tbaa !11 %cmp.not = icmp ult i32 %sub, 2 br i1 %cmp.not, label %while.end, label %while.body while.end: ; preds = %cleanup, %while.body, %entry ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nounwind uwtable define dso_local i32 @hpop(ptr nocapture noundef %h) local_unnamed_addr #1 { entry: %arr = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1 %0 = load i32, ptr %arr, align 4, !tbaa !11 %1 = load i32, ptr %h, align 8, !tbaa !5 %dec = add nsw i32 %1, -1 store i32 %dec, ptr %h, align 8, !tbaa !5 %idxprom = sext i32 %dec to i64 %arrayidx2 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom %2 = load i32, ptr %arrayidx2, align 4, !tbaa !11 store i32 %2, ptr %arr, align 4, !tbaa !11 %cmp66 = icmp sgt i32 %1, 2 br i1 %cmp66, label %while.body.lr.ph, label %while.end while.body.lr.ph: ; preds = %entry %cmp9 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 2 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.then27 %3 = phi i32 [ %dec, %while.body.lr.ph ], [ %12, %if.then27 ] %add69 = phi i32 [ 1, %while.body.lr.ph ], [ %add, %if.then27 ] %mul68 = phi i32 [ 0, %while.body.lr.ph ], [ %mul, %if.then27 ] %i.067 = phi i32 [ 0, %while.body.lr.ph ], [ %c.0, %if.then27 ] %add6 = add i32 %mul68, 2 %cmp8 = icmp slt i32 %add6, %3 br i1 %cmp8, label %land.lhs.true, label %if.end land.lhs.true: ; preds = %while.body %4 = load ptr, ptr %cmp9, align 8, !tbaa !12 %idxprom11 = sext i32 %add69 to i64 %arrayidx12 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom11 %5 = load i32, ptr %arrayidx12, align 4, !tbaa !11 %idxprom15 = sext i32 %add6 to i64 %arrayidx16 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom15 %6 = load i32, ptr %arrayidx16, align 4, !tbaa !11 %call = tail call i32 %4(i32 noundef %5, i32 noundef %6) #6 %cmp17 = icmp sgt i32 %call, 0 %spec.select = select i1 %cmp17, i32 %add6, i32 %add69 br label %if.end if.end: ; preds = %land.lhs.true, %while.body %c.0 = phi i32 [ %add69, %while.body ], [ %spec.select, %land.lhs.true ] %7 = load ptr, ptr %cmp9, align 8, !tbaa !12 %idxprom20 = sext i32 %i.067 to i64 %arrayidx21 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom20 %8 = load i32, ptr %arrayidx21, align 4, !tbaa !11 %idxprom23 = sext i32 %c.0 to i64 %arrayidx24 = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1, i64 %idxprom23 %9 = load i32, ptr %arrayidx24, align 4, !tbaa !11 %call25 = tail call i32 %7(i32 noundef %8, i32 noundef %9) #6 %cmp26 = icmp sgt i32 %call25, 0 br i1 %cmp26, label %if.then27, label %while.end if.then27: ; preds = %if.end %10 = load i32, ptr %arrayidx24, align 4, !tbaa !11 %11 = load i32, ptr %arrayidx21, align 4, !tbaa !11 store i32 %11, ptr %arrayidx24, align 4, !tbaa !11 store i32 %10, ptr %arrayidx21, align 4, !tbaa !11 %mul = shl nsw i32 %c.0, 1 %add = or i32 %mul, 1 %12 = load i32, ptr %h, align 8, !tbaa !5 %cmp = icmp slt i32 %add, %12 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !13 while.end: ; preds = %if.then27, %if.end, %entry ret i32 %0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @hpeek(ptr nocapture noundef readonly %h) local_unnamed_addr #3 { entry: %arr = getelementptr inbounds %struct.heap, ptr %h, i64 0, i32 1 %0 = load i32, ptr %arr, align 4, !tbaa !11 ret i32 %0 } ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %q = alloca i32, align 4 %t = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q) %0 = load i32, ptr %q, align 4, !tbaa !11 %dec145 = add nsw i32 %0, -1 store i32 %dec145, ptr %q, align 4, !tbaa !11 %tobool.not146 = icmp eq i32 %0, 0 br i1 %tobool.not146, label %while.end, label %while.body while.body: ; preds = %entry, %if.end40 %y.0148 = phi i64 [ %y.2, %if.end40 ], [ 0, %entry ] %d.0147 = phi i64 [ %d.1, %if.end40 ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %1 = load i32, ptr %t, align 4, !tbaa !11 %cmp = icmp eq i32 %1, 1 br i1 %cmp, label %if.then, label %if.else36 if.then: ; preds = %while.body call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %2 = load i32, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 1), align 4, !tbaa !11 %3 = load i32, ptr %a, align 4, !tbaa !11 %sub = sub nsw i32 %2, %3 %4 = call i32 @llvm.abs.i32(i32 %sub, i1 true) %conv = zext i32 %4 to i64 %add = add nsw i64 %y.0148, %conv %5 = load i32, ptr %b, align 4, !tbaa !11 %conv4 = sext i32 %5 to i64 %add5 = add nsw i64 %d.0147, %conv4 %cmp6 = icmp slt i32 %3, %2 br i1 %cmp6, label %if.then8, label %if.else if.then8: ; preds = %if.then %6 = load i32, ptr @left, align 8, !tbaa !5 %inc.i = add nsw i32 %6, 1 store i32 %inc.i, ptr @left, align 8, !tbaa !5 %idxprom.i = sext i32 %6 to i64 %arrayidx.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom.i store i32 %3, ptr %arrayidx.i, align 4, !tbaa !11 %cmp41.i = icmp sgt i32 %6, 0 br i1 %cmp41.i, label %while.body.i, label %if.end while.body.i: ; preds = %if.then8, %cleanup.i %i.042.i = phi i32 [ %div37.i, %cleanup.i ], [ %6, %if.then8 ] %sub.i = add nsw i32 %i.042.i, -1 %div37.i = lshr i32 %sub.i, 1 %7 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 2), align 8, !tbaa !12 %idxprom3.i = zext i32 %div37.i to i64 %arrayidx4.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom3.i %8 = load i32, ptr %arrayidx4.i, align 4, !tbaa !11 %idxprom6.i = zext i32 %i.042.i to i64 %arrayidx7.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom6.i %9 = load i32, ptr %arrayidx7.i, align 4, !tbaa !11 %call.i = call i32 %7(i32 noundef %8, i32 noundef %9) #6 %cmp8.i = icmp sgt i32 %call.i, 0 br i1 %cmp8.i, label %cleanup.i, label %if.end cleanup.i: ; preds = %while.body.i %10 = load i32, ptr %arrayidx4.i, align 4, !tbaa !11 %11 = load i32, ptr %arrayidx7.i, align 4, !tbaa !11 store i32 %11, ptr %arrayidx4.i, align 4, !tbaa !11 store i32 %10, ptr %arrayidx7.i, align 4, !tbaa !11 %cmp.not.i = icmp ult i32 %sub.i, 2 br i1 %cmp.not.i, label %if.end, label %while.body.i if.else: ; preds = %if.then %12 = load i32, ptr @right, align 8, !tbaa !5 %inc.i52 = add nsw i32 %12, 1 store i32 %inc.i52, ptr @right, align 8, !tbaa !5 %idxprom.i53 = sext i32 %12 to i64 %arrayidx.i54 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom.i53 store i32 %3, ptr %arrayidx.i54, align 4, !tbaa !11 %cmp41.i55 = icmp sgt i32 %12, 0 br i1 %cmp41.i55, label %while.body.i57, label %if.end while.body.i57: ; preds = %if.else, %cleanup.i67 %i.042.i58 = phi i32 [ %div37.i60, %cleanup.i67 ], [ %12, %if.else ] %sub.i59 = add nsw i32 %i.042.i58, -1 %div37.i60 = lshr i32 %sub.i59, 1 %13 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @right, i64 0, i32 2), align 8, !tbaa !12 %idxprom3.i61 = zext i32 %div37.i60 to i64 %arrayidx4.i62 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom3.i61 %14 = load i32, ptr %arrayidx4.i62, align 4, !tbaa !11 %idxprom6.i63 = zext i32 %i.042.i58 to i64 %arrayidx7.i64 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom6.i63 %15 = load i32, ptr %arrayidx7.i64, align 4, !tbaa !11 %call.i65 = call i32 %13(i32 noundef %14, i32 noundef %15) #6 %cmp8.i66 = icmp sgt i32 %call.i65, 0 br i1 %cmp8.i66, label %cleanup.i67, label %if.end cleanup.i67: ; preds = %while.body.i57 %16 = load i32, ptr %arrayidx4.i62, align 4, !tbaa !11 %17 = load i32, ptr %arrayidx7.i64, align 4, !tbaa !11 store i32 %17, ptr %arrayidx4.i62, align 4, !tbaa !11 store i32 %16, ptr %arrayidx7.i64, align 4, !tbaa !11 %cmp.not.i68 = icmp ult i32 %sub.i59, 2 br i1 %cmp.not.i68, label %if.end, label %while.body.i57 if.end: ; preds = %cleanup.i67, %while.body.i57, %cleanup.i, %while.body.i, %if.else, %if.then8 %18 = load i32, ptr @left, align 8, !tbaa !5 %19 = load i32, ptr @right, align 8, !tbaa !5 %sub9 = sub nsw i32 %18, %19 switch i32 %sub9, label %if.end20 [ i32 2, label %if.then12 i32 -1, label %if.then17 ] if.then12: ; preds = %if.end %20 = load i32, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 1), align 4, !tbaa !11 %dec.i = add nsw i32 %18, -1 store i32 %dec.i, ptr @left, align 8, !tbaa !5 %idxprom.i70 = sext i32 %dec.i to i64 %arrayidx2.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom.i70 %21 = load i32, ptr %arrayidx2.i, align 4, !tbaa !11 store i32 %21, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 1), align 4, !tbaa !11 %cmp66.i = icmp sgt i32 %18, 2 br i1 %cmp66.i, label %while.body.i72, label %hpop.exit while.body.i72: ; preds = %if.then12, %if.then27.i %22 = phi i32 [ %31, %if.then27.i ], [ %dec.i, %if.then12 ] %add69.i = phi i32 [ %add.i, %if.then27.i ], [ 1, %if.then12 ] %mul68.i = phi i32 [ %mul.i, %if.then27.i ], [ 0, %if.then12 ] %i.067.i = phi i32 [ %c.0.i, %if.then27.i ], [ 0, %if.then12 ] %add6.i = add i32 %mul68.i, 2 %cmp8.i73 = icmp slt i32 %add6.i, %22 br i1 %cmp8.i73, label %land.lhs.true.i, label %if.end.i land.lhs.true.i: ; preds = %while.body.i72 %23 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 2), align 8, !tbaa !12 %idxprom11.i = sext i32 %add69.i to i64 %arrayidx12.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom11.i %24 = load i32, ptr %arrayidx12.i, align 8, !tbaa !11 %idxprom15.i = sext i32 %add6.i to i64 %arrayidx16.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom15.i %25 = load i32, ptr %arrayidx16.i, align 4, !tbaa !11 %call.i74 = call i32 %23(i32 noundef %24, i32 noundef %25) #6 %cmp17.i = icmp sgt i32 %call.i74, 0 %spec.select.i = select i1 %cmp17.i, i32 %add6.i, i32 %add69.i br label %if.end.i if.end.i: ; preds = %land.lhs.true.i, %while.body.i72 %c.0.i = phi i32 [ %add69.i, %while.body.i72 ], [ %spec.select.i, %land.lhs.true.i ] %26 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 2), align 8, !tbaa !12 %idxprom20.i = sext i32 %i.067.i to i64 %arrayidx21.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom20.i %27 = load i32, ptr %arrayidx21.i, align 4, !tbaa !11 %idxprom23.i = sext i32 %c.0.i to i64 %arrayidx24.i = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom23.i %28 = load i32, ptr %arrayidx24.i, align 4, !tbaa !11 %call25.i = call i32 %26(i32 noundef %27, i32 noundef %28) #6 %cmp26.i = icmp sgt i32 %call25.i, 0 br i1 %cmp26.i, label %if.then27.i, label %hpop.exit.loopexit if.then27.i: ; preds = %if.end.i %29 = load i32, ptr %arrayidx24.i, align 4, !tbaa !11 %30 = load i32, ptr %arrayidx21.i, align 4, !tbaa !11 store i32 %30, ptr %arrayidx24.i, align 4, !tbaa !11 store i32 %29, ptr %arrayidx21.i, align 4, !tbaa !11 %mul.i = shl nsw i32 %c.0.i, 1 %add.i = or i32 %mul.i, 1 %31 = load i32, ptr @left, align 8, !tbaa !5 %cmp.i = icmp slt i32 %add.i, %31 br i1 %cmp.i, label %while.body.i72, label %hpop.exit.loopexit, !llvm.loop !13 hpop.exit.loopexit: ; preds = %if.then27.i, %if.end.i %.pre151 = load i32, ptr @right, align 8, !tbaa !5 br label %hpop.exit hpop.exit: ; preds = %hpop.exit.loopexit, %if.then12 %32 = phi i32 [ %.pre151, %hpop.exit.loopexit ], [ %19, %if.then12 ] %inc.i75 = add nsw i32 %32, 1 store i32 %inc.i75, ptr @right, align 8, !tbaa !5 %idxprom.i76 = sext i32 %32 to i64 %arrayidx.i77 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom.i76 store i32 %20, ptr %arrayidx.i77, align 4, !tbaa !11 %cmp41.i78 = icmp sgt i32 %32, 0 br i1 %cmp41.i78, label %while.body.i80, label %if.end20 while.body.i80: ; preds = %hpop.exit, %cleanup.i90 %i.042.i81 = phi i32 [ %div37.i83, %cleanup.i90 ], [ %32, %hpop.exit ] %sub.i82 = add nsw i32 %i.042.i81, -1 %div37.i83 = lshr i32 %sub.i82, 1 %33 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @right, i64 0, i32 2), align 8, !tbaa !12 %idxprom3.i84 = zext i32 %div37.i83 to i64 %arrayidx4.i85 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom3.i84 %34 = load i32, ptr %arrayidx4.i85, align 4, !tbaa !11 %idxprom6.i86 = zext i32 %i.042.i81 to i64 %arrayidx7.i87 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom6.i86 %35 = load i32, ptr %arrayidx7.i87, align 4, !tbaa !11 %call.i88 = call i32 %33(i32 noundef %34, i32 noundef %35) #6 %cmp8.i89 = icmp sgt i32 %call.i88, 0 br i1 %cmp8.i89, label %cleanup.i90, label %if.end20 cleanup.i90: ; preds = %while.body.i80 %36 = load i32, ptr %arrayidx4.i85, align 4, !tbaa !11 %37 = load i32, ptr %arrayidx7.i87, align 4, !tbaa !11 store i32 %37, ptr %arrayidx4.i85, align 4, !tbaa !11 store i32 %36, ptr %arrayidx7.i87, align 4, !tbaa !11 %cmp.not.i91 = icmp ult i32 %sub.i82, 2 br i1 %cmp.not.i91, label %if.end20, label %while.body.i80 if.then17: ; preds = %if.end %38 = load i32, ptr getelementptr inbounds (%struct.heap, ptr @right, i64 0, i32 1), align 4, !tbaa !11 %dec.i93 = add nsw i32 %19, -1 store i32 %dec.i93, ptr @right, align 8, !tbaa !5 %idxprom.i94 = sext i32 %dec.i93 to i64 %arrayidx2.i95 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom.i94 %39 = load i32, ptr %arrayidx2.i95, align 4, !tbaa !11 store i32 %39, ptr getelementptr inbounds (%struct.heap, ptr @right, i64 0, i32 1), align 4, !tbaa !11 %cmp66.i96 = icmp sgt i32 %19, 2 br i1 %cmp66.i96, label %while.body.i98, label %hpop.exit124 while.body.i98: ; preds = %if.then17, %if.then27.i112 %40 = phi i32 [ %49, %if.then27.i112 ], [ %dec.i93, %if.then17 ] %add69.i99 = phi i32 [ %add.i114, %if.then27.i112 ], [ 1, %if.then17 ] %mul68.i100 = phi i32 [ %mul.i113, %if.then27.i112 ], [ 0, %if.then17 ] %i.067.i101 = phi i32 [ %c.0.i105, %if.then27.i112 ], [ 0, %if.then17 ] %add6.i102 = add i32 %mul68.i100, 2 %cmp8.i103 = icmp slt i32 %add6.i102, %40 br i1 %cmp8.i103, label %land.lhs.true.i116, label %if.end.i104 land.lhs.true.i116: ; preds = %while.body.i98 %41 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @right, i64 0, i32 2), align 8, !tbaa !12 %idxprom11.i117 = sext i32 %add69.i99 to i64 %arrayidx12.i118 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom11.i117 %42 = load i32, ptr %arrayidx12.i118, align 8, !tbaa !11 %idxprom15.i119 = sext i32 %add6.i102 to i64 %arrayidx16.i120 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom15.i119 %43 = load i32, ptr %arrayidx16.i120, align 4, !tbaa !11 %call.i121 = call i32 %41(i32 noundef %42, i32 noundef %43) #6 %cmp17.i122 = icmp sgt i32 %call.i121, 0 %spec.select.i123 = select i1 %cmp17.i122, i32 %add6.i102, i32 %add69.i99 br label %if.end.i104 if.end.i104: ; preds = %land.lhs.true.i116, %while.body.i98 %c.0.i105 = phi i32 [ %add69.i99, %while.body.i98 ], [ %spec.select.i123, %land.lhs.true.i116 ] %44 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @right, i64 0, i32 2), align 8, !tbaa !12 %idxprom20.i106 = sext i32 %i.067.i101 to i64 %arrayidx21.i107 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom20.i106 %45 = load i32, ptr %arrayidx21.i107, align 4, !tbaa !11 %idxprom23.i108 = sext i32 %c.0.i105 to i64 %arrayidx24.i109 = getelementptr inbounds %struct.heap, ptr @right, i64 0, i32 1, i64 %idxprom23.i108 %46 = load i32, ptr %arrayidx24.i109, align 4, !tbaa !11 %call25.i110 = call i32 %44(i32 noundef %45, i32 noundef %46) #6 %cmp26.i111 = icmp sgt i32 %call25.i110, 0 br i1 %cmp26.i111, label %if.then27.i112, label %hpop.exit124.loopexit if.then27.i112: ; preds = %if.end.i104 %47 = load i32, ptr %arrayidx24.i109, align 4, !tbaa !11 %48 = load i32, ptr %arrayidx21.i107, align 4, !tbaa !11 store i32 %48, ptr %arrayidx24.i109, align 4, !tbaa !11 store i32 %47, ptr %arrayidx21.i107, align 4, !tbaa !11 %mul.i113 = shl nsw i32 %c.0.i105, 1 %add.i114 = or i32 %mul.i113, 1 %49 = load i32, ptr @right, align 8, !tbaa !5 %cmp.i115 = icmp slt i32 %add.i114, %49 br i1 %cmp.i115, label %while.body.i98, label %hpop.exit124.loopexit, !llvm.loop !13 hpop.exit124.loopexit: ; preds = %if.then27.i112, %if.end.i104 %.pre = load i32, ptr @left, align 8, !tbaa !5 br label %hpop.exit124 hpop.exit124: ; preds = %hpop.exit124.loopexit, %if.then17 %50 = phi i32 [ %.pre, %hpop.exit124.loopexit ], [ %18, %if.then17 ] %inc.i125 = add nsw i32 %50, 1 store i32 %inc.i125, ptr @left, align 8, !tbaa !5 %idxprom.i126 = sext i32 %50 to i64 %arrayidx.i127 = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom.i126 store i32 %38, ptr %arrayidx.i127, align 4, !tbaa !11 %cmp41.i128 = icmp sgt i32 %50, 0 br i1 %cmp41.i128, label %while.body.i130, label %if.end20 while.body.i130: ; preds = %hpop.exit124, %cleanup.i140 %i.042.i131 = phi i32 [ %div37.i133, %cleanup.i140 ], [ %50, %hpop.exit124 ] %sub.i132 = add nsw i32 %i.042.i131, -1 %div37.i133 = lshr i32 %sub.i132, 1 %51 = load ptr, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 2), align 8, !tbaa !12 %idxprom3.i134 = zext i32 %div37.i133 to i64 %arrayidx4.i135 = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom3.i134 %52 = load i32, ptr %arrayidx4.i135, align 4, !tbaa !11 %idxprom6.i136 = zext i32 %i.042.i131 to i64 %arrayidx7.i137 = getelementptr inbounds %struct.heap, ptr @left, i64 0, i32 1, i64 %idxprom6.i136 %53 = load i32, ptr %arrayidx7.i137, align 4, !tbaa !11 %call.i138 = call i32 %51(i32 noundef %52, i32 noundef %53) #6 %cmp8.i139 = icmp sgt i32 %call.i138, 0 br i1 %cmp8.i139, label %cleanup.i140, label %if.end20 cleanup.i140: ; preds = %while.body.i130 %54 = load i32, ptr %arrayidx4.i135, align 4, !tbaa !11 %55 = load i32, ptr %arrayidx7.i137, align 4, !tbaa !11 store i32 %55, ptr %arrayidx4.i135, align 4, !tbaa !11 store i32 %54, ptr %arrayidx7.i137, align 4, !tbaa !11 %cmp.not.i141 = icmp ult i32 %sub.i132, 2 br i1 %cmp.not.i141, label %if.end20, label %while.body.i130 if.end20: ; preds = %cleanup.i140, %while.body.i130, %cleanup.i90, %while.body.i80, %hpop.exit124, %hpop.exit, %if.end %56 = load i32, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 1), align 4, !tbaa !11 %cmp22.not = icmp eq i32 %56, %2 br i1 %cmp22.not, label %if.end35, label %if.then24 if.then24: ; preds = %if.end20 %57 = load i32, ptr @left, align 8, !tbaa !5 %58 = load i32, ptr @right, align 8, !tbaa !5 %cmp25 = icmp sgt i32 %56, %2 %add28 = add nsw i32 %58, 2 %spec.select = select i1 %cmp25, i32 %add28, i32 %58 %sub30 = sub nsw i32 %56, %2 %conv31 = sext i32 %sub30 to i64 %sub32 = sub nsw i32 %57, %spec.select %conv33 = sext i32 %sub32 to i64 %mul = mul nsw i64 %conv33, %conv31 %add34 = add nsw i64 %mul, %add br label %if.end35 if.end35: ; preds = %if.then24, %if.end20 %y.1 = phi i64 [ %add34, %if.then24 ], [ %add, %if.end20 ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6 br label %if.end40 if.else36: ; preds = %while.body %59 = load i32, ptr getelementptr inbounds (%struct.heap, ptr @left, i64 0, i32 1), align 4, !tbaa !11 %add38 = add nsw i64 %y.0148, %d.0147 %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %59, i64 noundef %add38) br label %if.end40 if.end40: ; preds = %if.else36, %if.end35 %d.1 = phi i64 [ %add5, %if.end35 ], [ %d.0147, %if.else36 ] %y.2 = phi i64 [ %y.1, %if.end35 ], [ %y.0148, %if.else36 ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6 %60 = load i32, ptr %q, align 4, !tbaa !11 %dec = add nsw i32 %60, -1 store i32 %dec, ptr %q, align 4, !tbaa !11 %tobool.not = icmp eq i32 %60, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15 while.end: ; preds = %if.end40, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4 attributes #0 = { 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 #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #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 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, !7, i64 0} !6 = !{!"", !7, i64 0, !8, i64 4, !10, i64 800008} !7 = !{!"int", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"any pointer", !8, i64 0} !11 = !{!7, !7, i64 0} !12 = !{!6, !10, i64 800008} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = distinct !{!15, !14}
#include <stdio.h> int main() { int k; scanf("%d", &k); int odd = 0, even = 0; for(int i = 1; i <= k; i++){ if(i%2 == 0) even++; else odd++; } int cont = even*odd; printf("%d\n", cont); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179925/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179925/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: %k = alloca i32, align 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 %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %cmp.not9 = icmp slt i32 %0, 1 br i1 %cmp.not9, label %for.cond.cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader20, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %0, -8 %ind.end = or i32 %n.vec, 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ] %vec.phi14 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ] %vec.phi16 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ] %vec.phi17 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ] %1 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1> %2 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1> %3 = xor <4 x i32> %1, <i32 1, i32 1, i32 1, i32 1> %4 = xor <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1> %5 = add <4 x i32> %3, %vec.phi16 %6 = add <4 x i32> %4, %vec.phi17 %7 = add <4 x i32> %vec.phi, %1 %8 = add <4 x i32> %vec.phi14, %2 %index.next = add nuw i32 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %9 = icmp eq i32 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx18 = add <4 x i32> %6, %5 %10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx18) %bin.rdx = add <4 x i32> %8, %7 %11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %0, %n.vec br i1 %cmp.n, label %for.cond.cleanup.loopexit, label %for.body.preheader20 for.body.preheader20: ; preds = %for.body.preheader, %middle.block %odd.012.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ] %i.011.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] %even.010.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ] br label %for.body for.cond.cleanup.loopexit: ; preds = %for.body, %middle.block %even.1.lcssa = phi i32 [ %10, %middle.block ], [ %even.1, %for.body ] %odd.1.lcssa = phi i32 [ %11, %middle.block ], [ %odd.1, %for.body ] %12 = mul nsw i32 %odd.1.lcssa, %even.1.lcssa br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry %mul = phi i32 [ 0, %entry ], [ %12, %for.cond.cleanup.loopexit ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 ret i32 0 for.body: ; preds = %for.body.preheader20, %for.body %odd.012 = phi i32 [ %odd.1, %for.body ], [ %odd.012.ph, %for.body.preheader20 ] %i.011 = phi i32 [ %inc3, %for.body ], [ %i.011.ph, %for.body.preheader20 ] %even.010 = phi i32 [ %even.1, %for.body ], [ %even.010.ph, %for.body.preheader20 ] %rem = and i32 %i.011, 1 %13 = xor i32 %rem, 1 %even.1 = add i32 %13, %even.010 %odd.1 = add i32 %odd.012, %rem %inc3 = add nuw i32 %i.011, 1 %exitcond.not = icmp eq i32 %i.011, %0 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !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 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}
#include <stdio.h> #include <stdlib.h> int main(){ int k; int count_even=0; int count_odd=0; scanf("%d",&k); for(int i=1;i<=k;i++){ if(i%2==0) count_even++; else count_odd++; } printf("%d\n",count_odd*count_even); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_179969/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_179969/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: %k = alloca i32, align 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 %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %cmp.not9 = icmp slt i32 %0, 1 br i1 %cmp.not9, label %for.cond.cleanup, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader20, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %0, -8 %ind.end = or i32 %n.vec, 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ] %vec.phi15 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %vec.phi16 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ] %vec.phi17 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ] %1 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1> %2 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1> %3 = xor <4 x i32> %1, <i32 1, i32 1, i32 1, i32 1> %4 = xor <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1> %5 = add <4 x i32> %3, %vec.phi16 %6 = add <4 x i32> %4, %vec.phi17 %7 = add <4 x i32> %1, %vec.phi %8 = add <4 x i32> %2, %vec.phi15 %index.next = add nuw i32 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %9 = icmp eq i32 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx18 = add <4 x i32> %6, %5 %10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx18) %bin.rdx = add <4 x i32> %8, %7 %11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %0, %n.vec br i1 %cmp.n, label %for.cond.cleanup.loopexit, label %for.body.preheader20 for.body.preheader20: ; preds = %for.body.preheader, %middle.block %i.012.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] %count_odd.011.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ] %count_even.010.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ] br label %for.body for.cond.cleanup.loopexit: ; preds = %for.body, %middle.block %count_even.1.lcssa = phi i32 [ %10, %middle.block ], [ %count_even.1, %for.body ] %count_odd.1.lcssa = phi i32 [ %11, %middle.block ], [ %count_odd.1, %for.body ] %12 = mul nsw i32 %count_odd.1.lcssa, %count_even.1.lcssa br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry %mul = phi i32 [ 0, %entry ], [ %12, %for.cond.cleanup.loopexit ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 ret i32 0 for.body: ; preds = %for.body.preheader20, %for.body %i.012 = phi i32 [ %inc3, %for.body ], [ %i.012.ph, %for.body.preheader20 ] %count_odd.011 = phi i32 [ %count_odd.1, %for.body ], [ %count_odd.011.ph, %for.body.preheader20 ] %count_even.010 = phi i32 [ %count_even.1, %for.body ], [ %count_even.010.ph, %for.body.preheader20 ] %rem = and i32 %i.012, 1 %13 = xor i32 %rem, 1 %count_even.1 = add i32 %13, %count_even.010 %count_odd.1 = add i32 %rem, %count_odd.011 %inc3 = add nuw i32 %i.012, 1 %exitcond.not = icmp eq i32 %i.012, %0 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !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 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}
#include<stdio.h> int main() { long long t,n,r=0,i,x,y; scanf("%lld%lld",&n,&t); int a[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); if(a[i]==1)r++; } while(t--){ scanf("%lld%lld",&x,&y); if(x==1){a[y-1]=1-a[y-1]; if(a[y-1]==1)r++; else r--;} else if(y>r)printf("0\n"); else printf("1\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18001/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18001/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"%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @str = private unnamed_addr constant [2 x i8] c"1\00", align 1 @str.4 = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca i64, align 8 %n = alloca i64, align 8 %x = alloca i64, align 8 %y = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t) %0 = load i64, ptr %n, align 8, !tbaa !5 %1 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %0, align 16 %2 = load i64, ptr %n, align 8, !tbaa !5 %cmp34 = icmp sgt i64 %2, 0 br i1 %cmp34, label %for.body, label %while.cond.preheader while.cond.preheader: ; preds = %for.body, %entry %r.0.lcssa = phi i64 [ 0, %entry ], [ %spec.select, %for.body ] %invariant.gep = getelementptr i32, ptr %vla, i64 -1 %3 = load i64, ptr %t, align 8, !tbaa !5 %dec37 = add nsw i64 %3, -1 store i64 %dec37, ptr %t, align 8, !tbaa !5 %tobool.not38 = icmp eq i64 %3, 0 br i1 %tobool.not38, label %while.end, label %while.body for.body: ; preds = %entry, %for.body %r.036 = phi i64 [ %spec.select, %for.body ], [ 0, %entry ] %i.035 = phi i64 [ %inc4, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %i.035 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %4 = load i32, ptr %arrayidx, align 4, !tbaa !9 %cmp3 = icmp eq i32 %4, 1 %inc = zext i1 %cmp3 to i64 %spec.select = add nuw nsw i64 %r.036, %inc %inc4 = add nuw nsw i64 %i.035, 1 %5 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc4, %5 br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11 while.body: ; preds = %while.cond.preheader, %if.end26 %r.239 = phi i64 [ %r.3, %if.end26 ], [ %r.0.lcssa, %while.cond.preheader ] %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y) %6 = load i64, ptr %x, align 8, !tbaa !5 %cmp6 = icmp eq i64 %6, 1 %7 = load i64, ptr %y, align 8, !tbaa !5 br i1 %cmp6, label %if.then7, label %if.else19 if.then7: ; preds = %while.body %gep = getelementptr i32, ptr %invariant.gep, i64 %7 %8 = load i32, ptr %gep, align 4, !tbaa !9 %sub9 = sub nsw i32 1, %8 store i32 %sub9, ptr %gep, align 4, !tbaa !9 %cmp14 = icmp eq i32 %8, 0 br i1 %cmp14, label %if.then15, label %if.else if.then15: ; preds = %if.then7 %inc16 = add nsw i64 %r.239, 1 br label %if.end26 if.else: ; preds = %if.then7 %dec17 = add nsw i64 %r.239, -1 br label %if.end26 if.else19: ; preds = %while.body %cmp20 = icmp sgt i64 %7, %r.239 br i1 %cmp20, label %if.then21, label %if.else23 if.then21: ; preds = %if.else19 %puts33 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end26 if.else23: ; preds = %if.else19 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end26 if.end26: ; preds = %if.then21, %if.else23, %if.then15, %if.else %r.3 = phi i64 [ %inc16, %if.then15 ], [ %dec17, %if.else ], [ %r.239, %if.then21 ], [ %r.239, %if.else23 ] %9 = load i64, ptr %t, align 8, !tbaa !5 %dec = add nsw i64 %9, -1 store i64 %dec, ptr %t, align 8, !tbaa !5 %tobool.not = icmp eq i64 %9, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13 while.end: ; preds = %if.end26, %while.cond.preheader call void @llvm.stackrestore.p0(ptr %1) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #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 willreturn declare ptr @llvm.stacksave.p0() #3 ; 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: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 nosync nounwind willreturn } attributes #4 = { nofree nounwind } 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 = !{!10, !10, i64 0} !10 = !{!"int", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12}
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> int main() { int k; scanf("%d", &k); if (k%2 == 0) printf("%d\n", (k/2)*(k/2)); else printf("%d\n", (k/2)*(k/2+1)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180060/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180060/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: %k = alloca i32, align 4 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 %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %1 = and i32 %0, 1 %div = sdiv i32 %0, 2 %add.sink = add nsw i32 %div, %1 %mul5 = mul nsw i32 %add.sink, %div %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul5) call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main() { int c=0,c1=0,i,t; scanf("%d",&t); for(i=1;i<=t;i++) { if(i%2==0) c++; else c1++; } printf("%d\n",c*c1); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180103/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180103/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: %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp.not9 = icmp slt i32 %0, 1 br i1 %cmp.not9, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader20, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i32 %0, -8 %ind.end = or i32 %n.vec, 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ] %vec.phi15 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %vec.phi16 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ] %vec.phi17 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ] %1 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1> %2 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1> %3 = xor <4 x i32> %1, <i32 1, i32 1, i32 1, i32 1> %4 = xor <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1> %5 = add <4 x i32> %3, %vec.phi16 %6 = add <4 x i32> %4, %vec.phi17 %7 = add <4 x i32> %1, %vec.phi %8 = add <4 x i32> %2, %vec.phi15 %index.next = add nuw i32 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %9 = icmp eq i32 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx18 = add <4 x i32> %6, %5 %10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx18) %bin.rdx = add <4 x i32> %8, %7 %11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i32 %0, %n.vec br i1 %cmp.n, label %for.end.loopexit, label %for.body.preheader20 for.body.preheader20: ; preds = %for.body.preheader, %middle.block %i.012.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] %c1.011.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ] %c.010.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader20, %for.body %i.012 = phi i32 [ %inc3, %for.body ], [ %i.012.ph, %for.body.preheader20 ] %c1.011 = phi i32 [ %c1.1, %for.body ], [ %c1.011.ph, %for.body.preheader20 ] %c.010 = phi i32 [ %c.1, %for.body ], [ %c.010.ph, %for.body.preheader20 ] %rem = and i32 %i.012, 1 %12 = xor i32 %rem, 1 %c.1 = add i32 %12, %c.010 %c1.1 = add i32 %rem, %c1.011 %inc3 = add nuw i32 %i.012, 1 %exitcond.not = icmp eq i32 %i.012, %0 br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !13 for.end.loopexit: ; preds = %for.body, %middle.block %c.1.lcssa = phi i32 [ %10, %middle.block ], [ %c.1, %for.body ] %c1.1.lcssa = phi i32 [ %11, %middle.block ], [ %c1.1, %for.body ] %13 = mul nsw i32 %c1.1.lcssa, %c.1.lcssa br label %for.end for.end: ; preds = %for.end.loopexit, %entry %mul = phi i32 [ 0, %entry ], [ %13, %for.end.loopexit ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul) 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: 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>) #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}
#include<stdio.h> int main(){ int K; scanf("%d",&K); printf("%d\n",(K/2)*((K+1)/2)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180154/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180154/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: %K = alloca i32, align 4 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 %K) %0 = load i32, ptr %K, align 4, !tbaa !5 %div = sdiv i32 %0, 2 %add = add nsw i32 %0, 1 %div1 = sdiv i32 %add, 2 %mul = mul nsw i32 %div1, %div %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul) call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int k; scanf("%d",&k); if (k%2==0) printf("%d\n",k/2*k/2); else printf("%d\n",(k+1)/2*(k-1)/2); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180198/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180198/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: %k = alloca i32, align 4 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 %k) %0 = load i32, ptr %k, align 4, !tbaa !5 %1 = and i32 %0, 1 %cmp = icmp eq i32 %1, 0 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %div = sdiv i32 %0, 2 %mul = mul nsw i32 %div, %0 br label %if.end if.else: ; preds = %entry %add = add nsw i32 %0, 1 %div3 = sdiv i32 %add, 2 %sub = add nsw i32 %0, -1 %mul4 = mul nsw i32 %div3, %sub br label %if.end if.end: ; preds = %if.else, %if.then %mul4.sink = phi i32 [ %mul4, %if.else ], [ %mul, %if.then ] %div5 = sdiv i32 %mul4.sink, 2 %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div5) call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int gcd(int a, int b) { if (a > b) { a ^= b; b ^= a; a ^= b; } if (b % a == 0) return a; else return gcd(b % a, a); } int main() { int A, B; scanf("%d %d", &A, &B); printf("%lld\n", (long long)A * B / gcd(A, B)); fflush(stdout); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180248/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180248/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 [6 x i8] c"%lld\0A\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nosync nounwind memory(none) uwtable define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse, %entry %a.tr = phi i32 [ %a, %entry ], [ %rem, %tailrecurse ] %b.tr = phi i32 [ %b, %entry ], [ %spec.select, %tailrecurse ] %spec.select = tail call i32 @llvm.smin.i32(i32 %a.tr, i32 %b.tr) %spec.select18 = tail call i32 @llvm.smax.i32(i32 %a.tr, i32 %b.tr) %rem = srem i32 %spec.select18, %spec.select %cmp3 = icmp eq i32 %rem, 0 br i1 %cmp3, label %return, label %tailrecurse return: ; preds = %tailrecurse ret i32 %spec.select } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #1 { entry: %A = alloca i32, align 4 %B = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #5 %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 br label %tailrecurse.i tailrecurse.i: ; preds = %tailrecurse.i, %entry %a.tr.i = phi i32 [ %0, %entry ], [ %rem.i, %tailrecurse.i ] %b.tr.i = phi i32 [ %1, %entry ], [ %spec.select.i, %tailrecurse.i ] %spec.select.i = call i32 @llvm.smin.i32(i32 %a.tr.i, i32 %b.tr.i) %spec.select18.i = call i32 @llvm.smax.i32(i32 %a.tr.i, i32 %b.tr.i) %rem.i = srem i32 %spec.select18.i, %spec.select.i %cmp3.i = icmp eq i32 %rem.i, 0 br i1 %cmp3.i, label %gcd.exit, label %tailrecurse.i gcd.exit: ; preds = %tailrecurse.i %conv = sext i32 %0 to i64 %conv1 = sext i32 %1 to i64 %mul = mul nsw i64 %conv1, %conv %conv3 = sext i32 %spec.select.i to i64 %div = sdiv i64 %mul, %conv3 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div) %2 = load ptr, ptr @stdout, align 8, !tbaa !9 %call5 = call i32 @fflush(ptr noundef %2) call void @llvm.lifetime.end.p0(i64 4, 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) #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: nofree nounwind declare noundef i32 @fflush(ptr nocapture noundef) 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 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 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 = { 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 = !{!10, !10, i64 0} !10 = !{!"any pointer", !7, i64 0}
#include<stdio.h> long long gcd(long long a,long long b){ long long r = a % b; while(r > 0){ a = b; b = r; r = a % b; } return b; } long long lcm(long long a,long long b){return a*b/gcd(a,b);} int main(){ long long a, b; scanf("%lld%lld",&a,&b); printf("%lld\n",lcm(a, b)); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180291/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180291/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"%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %rem = srem i64 %a, %b %cmp7 = icmp sgt i64 %rem, 0 br i1 %cmp7, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %r.09 = phi i64 [ %rem1, %while.body ], [ %rem, %entry ] %b.addr.08 = phi i64 [ %r.09, %while.body ], [ %b, %entry ] %rem1 = srem i64 %b.addr.08, %r.09 %cmp = icmp sgt i64 %rem1, 0 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !5 while.end: ; preds = %while.body, %entry %b.addr.0.lcssa = phi i64 [ %b, %entry ], [ %r.09, %while.body ] ret i64 %b.addr.0.lcssa } ; 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 norecurse nosync nounwind memory(none) uwtable define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %rem.i = srem i64 %a, %b %cmp7.i = icmp sgt i64 %rem.i, 0 br i1 %cmp7.i, label %while.body.i, label %gcd.exit while.body.i: ; preds = %entry, %while.body.i %r.09.i = phi i64 [ %rem1.i, %while.body.i ], [ %rem.i, %entry ] %b.addr.08.i = phi i64 [ %r.09.i, %while.body.i ], [ %b, %entry ] %rem1.i = srem i64 %b.addr.08.i, %r.09.i %cmp.i = icmp sgt i64 %rem1.i, 0 br i1 %cmp.i, label %while.body.i, label %gcd.exit, !llvm.loop !5 gcd.exit: ; preds = %while.body.i, %entry %b.addr.0.lcssa.i = phi i64 [ %b, %entry ], [ %r.09.i, %while.body.i ] %mul = mul nsw i64 %b, %a %div = sdiv i64 %mul, %b.addr.0.lcssa.i ret i64 %div } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i64, ptr %a, align 8, !tbaa !7 %1 = load i64, ptr %b, align 8, !tbaa !7 %rem.i.i = srem i64 %0, %1 %cmp7.i.i = icmp sgt i64 %rem.i.i, 0 br i1 %cmp7.i.i, label %while.body.i.i, label %lcm.exit while.body.i.i: ; preds = %entry, %while.body.i.i %r.09.i.i = phi i64 [ %rem1.i.i, %while.body.i.i ], [ %rem.i.i, %entry ] %b.addr.08.i.i = phi i64 [ %r.09.i.i, %while.body.i.i ], [ %1, %entry ] %rem1.i.i = srem i64 %b.addr.08.i.i, %r.09.i.i %cmp.i.i = icmp sgt i64 %rem1.i.i, 0 br i1 %cmp.i.i, label %while.body.i.i, label %lcm.exit, !llvm.loop !5 lcm.exit: ; preds = %while.body.i.i, %entry %b.addr.0.lcssa.i.i = phi i64 [ %1, %entry ], [ %r.09.i.i, %while.body.i.i ] %mul.i = mul nsw i64 %1, %0 %div.i = sdiv i64 %mul.i, %b.addr.0.lcssa.i.i %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div.i) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #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 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 #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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"long long", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> long long int gcd(long long int a, long long int b) { long long int r; while (b!=0) { r = a % b; a = b; b = r; } return a; } int main(void) { long long int a,b,g; scanf("%lld %lld", &a, &b); g = gcd(a, b); printf("%lld\n", (a * b) / g); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180334/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180334/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 [10 x i8] c"%lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %cmp.not4 = icmp eq i64 %b, 0 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ] %b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ] %rem = srem i64 %a.addr.06, %b.addr.05 %cmp.not = icmp eq i64 %rem, 0 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %while.body, %entry %a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ] ret i64 %a.addr.0.lcssa } ; 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: %a = alloca i64, align 8 %b = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i64, ptr %a, align 8, !tbaa !7 %1 = load i64, ptr %b, align 8, !tbaa !7 %cmp.not4.i = icmp eq i64 %1, 0 br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i while.body.i: ; preds = %entry, %while.body.i %a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %0, %entry ] %b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %1, %entry ] %rem.i = srem i64 %a.addr.06.i, %b.addr.05.i %cmp.not.i = icmp eq i64 %rem.i, 0 br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5 gcd.exit: ; preds = %while.body.i, %entry %a.addr.0.lcssa.i = phi i64 [ %0, %entry ], [ %b.addr.05.i, %while.body.i ] %mul = mul nsw i64 %1, %0 %div = sdiv i64 %mul, %a.addr.0.lcssa.i %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #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 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 #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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"long long", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <stdlib.h> long long divv(long long m,long long n) { long long x; long long a, b; a = m; b = n; if (a > b) { x = a%b; } else { x = a; a = b; b = x; x = a%b; } while (x != 0) { a = b; b = x; x = a%b; } return b; } int main() { long long a1,b1,d1; scanf("%lld %lld",&a1,&b1); d1=divv(a1,b1); printf("%lld",(a1/d1)*b1); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180378/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180378/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 [10 x i8] c"%lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @divv(i64 noundef %m, i64 noundef %n) local_unnamed_addr #0 { entry: %cmp = icmp sgt i64 %m, %n br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %rem = srem i64 %m, %n br label %if.end if.else: ; preds = %entry %rem1 = srem i64 %n, %m br label %if.end if.end: ; preds = %if.else, %if.then %x.0 = phi i64 [ %rem, %if.then ], [ %rem1, %if.else ] %b.0 = phi i64 [ %n, %if.then ], [ %m, %if.else ] %cmp2.not16 = icmp eq i64 %x.0, 0 br i1 %cmp2.not16, label %while.end, label %while.body while.body: ; preds = %if.end, %while.body %b.118 = phi i64 [ %x.117, %while.body ], [ %b.0, %if.end ] %x.117 = phi i64 [ %rem3, %while.body ], [ %x.0, %if.end ] %rem3 = srem i64 %b.118, %x.117 %cmp2.not = icmp eq i64 %rem3, 0 br i1 %cmp2.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %while.body, %if.end %b.1.lcssa = phi i64 [ %b.0, %if.end ], [ %x.117, %while.body ] ret i64 %b.1.lcssa } ; 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: %a1 = alloca i64, align 8 %b1 = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a1) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b1) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %b1) %0 = load i64, ptr %a1, align 8, !tbaa !7 %1 = load i64, ptr %b1, align 8, !tbaa !7 %cmp.i = icmp sgt i64 %0, %1 br i1 %cmp.i, label %if.then.i, label %if.else.i if.then.i: ; preds = %entry %rem.i = srem i64 %0, %1 br label %if.end.i if.else.i: ; preds = %entry %rem1.i = srem i64 %1, %0 br label %if.end.i if.end.i: ; preds = %if.else.i, %if.then.i %x.0.i = phi i64 [ %rem.i, %if.then.i ], [ %rem1.i, %if.else.i ] %b.0.i = phi i64 [ %1, %if.then.i ], [ %0, %if.else.i ] %cmp2.not16.i = icmp eq i64 %x.0.i, 0 br i1 %cmp2.not16.i, label %divv.exit, label %while.body.i while.body.i: ; preds = %if.end.i, %while.body.i %b.118.i = phi i64 [ %x.117.i, %while.body.i ], [ %b.0.i, %if.end.i ] %x.117.i = phi i64 [ %rem3.i, %while.body.i ], [ %x.0.i, %if.end.i ] %rem3.i = srem i64 %b.118.i, %x.117.i %cmp2.not.i = icmp eq i64 %rem3.i, 0 br i1 %cmp2.not.i, label %divv.exit, label %while.body.i, !llvm.loop !5 divv.exit: ; preds = %while.body.i, %if.end.i %b.1.lcssa.i = phi i64 [ %b.0.i, %if.end.i ], [ %x.117.i, %while.body.i ] %div = sdiv i64 %0, %b.1.lcssa.i %mul = mul nsw i64 %div, %1 %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b1) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a1) #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 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 #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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = !{!8, !8, i64 0} !8 = !{!"long long", !9, i64 0} !9 = !{!"omnipotent char", !10, i64 0} !10 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <math.h> int main() { double a, b; double tmp, r; double ans; scanf ("%lf %lf", &a, &b); ans = a * b; if (a < b) { tmp = a; a = b; b = tmp; } r = fmod (a, b); while (r != 0) { a = b; b = r; r = fmod (a, b); } ans = ans / b; printf ("%.0lf\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180428/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180428/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 [8 x i8] c"%lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%.0lf\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca double, align 8 %b = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load double, ptr %a, align 8, !tbaa !5 %1 = load double, ptr %b, align 8, !tbaa !5 %cmp = fcmp olt double %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry store double %1, ptr %a, align 8, !tbaa !5 store double %0, ptr %b, align 8, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi double [ %0, %if.then ], [ %1, %entry ] %3 = phi double [ %1, %if.then ], [ %0, %entry ] %call1 = call double @fmod(double noundef %3, double noundef %2) #4 %cmp28 = fcmp une double %call1, 0.000000e+00 br i1 %cmp28, label %while.body, label %while.end while.body: ; preds = %if.end, %while.body %r.09 = phi double [ %call3, %while.body ], [ %call1, %if.end ] %4 = load double, ptr %b, align 8, !tbaa !5 store double %4, ptr %a, align 8, !tbaa !5 store double %r.09, ptr %b, align 8, !tbaa !5 %call3 = call double @fmod(double noundef %4, double noundef %r.09) #4 %cmp2 = fcmp une double %call3, 0.000000e+00 br i1 %cmp2, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body, %if.end %mul = fmul double %0, %1 %5 = load double, ptr %b, align 8, !tbaa !5 %div = fdiv double %mul, %5 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, 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: mustprogress nofree nounwind willreturn memory(write) declare double @fmod(double noundef, 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 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 = { 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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { long long int a, b, r, x, tmp; scanf("%lld", &a); scanf("%lld", &b); x = a * b; /* 自然数 a > b を確認・入替 */ if(a<b){ tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while(r!=0){ a = b; b = r; r = a % b; } /* 最小公倍数を出力 */ printf("%lld\n", x/b); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180471/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180471/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: %a = alloca i64, align 8 %b = 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 = 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) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry store i64 %1, ptr %a, align 8, !tbaa !5 store i64 %0, ptr %b, align 8, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry %2 = phi i64 [ %0, %if.then ], [ %1, %entry ] %3 = phi i64 [ %1, %if.then ], [ %0, %entry ] %rem = srem i64 %3, %2 %cmp2.not8 = icmp eq i64 %rem, 0 br i1 %cmp2.not8, label %while.end, label %while.body while.body: ; preds = %if.end, %while.body %r.010 = phi i64 [ %rem3, %while.body ], [ %rem, %if.end ] %r.079 = phi i64 [ %r.010, %while.body ], [ %2, %if.end ] %rem3 = srem i64 %r.079, %r.010 %cmp2.not = icmp eq i64 %rem3, 0 br i1 %cmp2.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9 while.cond.while.end_crit_edge: ; preds = %while.body store i64 %r.079, ptr %a, align 8, !tbaa !5 store i64 %r.010, ptr %b, align 8, !tbaa !5 br label %while.end while.end: ; preds = %while.cond.while.end_crit_edge, %if.end %4 = phi i64 [ %r.010, %while.cond.while.end_crit_edge ], [ %2, %if.end ] %mul = mul nsw i64 %1, %0 %div = sdiv i64 %mul, %4 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div) 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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <math.h> int main(void) { double x1, y1, x2, y2; scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); printf("%.8f\n", sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2))); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180529/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180529/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 [16 x i8] c"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%.8f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x1 = alloca double, align 8 %y1 = alloca double, align 8 %x2 = alloca double, align 8 %y2 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4 call void @llvm.lifetime.start.p0(i64 8, 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 double, ptr %x2, align 8, !tbaa !5 %1 = load double, ptr %x1, align 8, !tbaa !5 %2 = load double, ptr %y2, align 8, !tbaa !5 %3 = load double, ptr %y1, align 8, !tbaa !5 %4 = insertelement <2 x double> poison, double %0, i64 0 %5 = insertelement <2 x double> %4, double %2, i64 1 %6 = insertelement <2 x double> poison, double %1, i64 0 %7 = insertelement <2 x double> %6, double %3, i64 1 %8 = fsub <2 x double> %5, %7 %9 = fmul <2 x double> %8, %8 %shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %10 = fadd <2 x double> %9, %shift %add = extractelement <2 x double> %10, i64 0 %sqrt = call double @llvm.sqrt.f64(double %add) %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4 call void @llvm.lifetime.end.p0(i64 8, 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 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 double @llvm.sqrt.f64(double) #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 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<string.h> #include<math.h> int main(){ double x1,x2,y1,y2; scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2); printf("%f",(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180572/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180572/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 [16 x i8] c"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x1 = alloca double, align 8 %x2 = alloca double, align 8 %y1 = alloca double, align 8 %y2 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5 %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 double, ptr %x2, align 8, !tbaa !5 %1 = load double, ptr %x1, align 8, !tbaa !5 %sub = fsub double %0, %1 %2 = load double, ptr %y2, align 8, !tbaa !5 %3 = load double, ptr %y1, align 8, !tbaa !5 %sub2 = fsub double %2, %3 %mul4 = fmul double %sub2, %sub2 %4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4) %sqrt = call double @llvm.sqrt.f64(double %4) %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #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 double @llvm.sqrt.f64(double) #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 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 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <math.h> int main(){ double x1, y1, x2, y2; scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2); printf("%f\n", sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) ); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180615/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180615/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 [16 x i8] c"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x1 = alloca double, align 8 %y1 = alloca double, align 8 %x2 = alloca double, align 8 %y2 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5 %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 double, ptr %x2, align 8, !tbaa !5 %1 = load double, ptr %x1, align 8, !tbaa !5 %sub = fsub double %0, %1 %2 = load double, ptr %y2, align 8, !tbaa !5 %3 = load double, ptr %y1, align 8, !tbaa !5 %sub2 = fsub double %2, %3 %mul4 = fmul double %sub2, %sub2 %4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4) %sqrt = call double @llvm.sqrt.f64(double %4) %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #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 double @llvm.sqrt.f64(double) #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 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 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <math.h> int main(void) { double x1, y1, x2, y2, dist; scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2); dist = sqrt(pow(x2 - x1, 2.0) + pow(y2 - y1, 2.0)); printf("%f",dist); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180680/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180680/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 [16 x i8] c"%lf %lf %lf %lf\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x1 = alloca double, align 8 %y1 = alloca double, align 8 %x2 = alloca double, align 8 %y2 = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4 call void @llvm.lifetime.start.p0(i64 8, 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 double, ptr %x2, align 8, !tbaa !5 %1 = load double, ptr %x1, align 8, !tbaa !5 %2 = load double, ptr %y2, align 8, !tbaa !5 %3 = load double, ptr %y1, align 8, !tbaa !5 %4 = insertelement <2 x double> poison, double %0, i64 0 %5 = insertelement <2 x double> %4, double %2, i64 1 %6 = insertelement <2 x double> poison, double %1, i64 0 %7 = insertelement <2 x double> %6, double %3, i64 1 %8 = fsub <2 x double> %5, %7 %9 = fmul <2 x double> %8, %8 %shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison> %10 = fadd <2 x double> %9, %shift %add = extractelement <2 x double> %10, i64 0 %sqrt = call double @llvm.sqrt.f64(double %add) %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4 call void @llvm.lifetime.end.p0(i64 8, 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 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 double @llvm.sqrt.f64(double) #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 = !{!"double", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(){ int a,b,i,j; char d[110][110]={}; scanf("%d %d",&a,&b); a--; b--; printf("100 100\n"); for(i=0;i<50;i+=2){ for(j=0;j<100;j+=2){ d[i][j]=d[i+1][j]=d[i][j+1]=d[i+1][j+1]='#'; if(a){ d[i][j]='.'; a--; } } } for(i=50;i<100;i+=2){ for(j=0;j<100;j+=2){ d[i][j]=d[i+1][j]=d[i][j+1]=d[i+1][j+1]='.'; if(b){ d[i+1][j]='#'; b--; } } } for(i=0;i<100;i++)printf("%s\n",d[i]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180730/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180730/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 = private unnamed_addr constant [8 x i8] c"100 100\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 %d = alloca [110 x [110 x i8]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 12100, ptr nonnull %d) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12100) %d, i8 0, i64 12100, i1 false) %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 %dec = add nsw i32 %0, -1 store i32 %dec, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %dec1 = add nsw i32 %1, -1 store i32 %dec1, ptr %b, align 4, !tbaa !5 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) %a.promoted115 = load i32, ptr %a, align 4, !tbaa !5 br label %for.cond3.preheader for.cond3.preheader: ; preds = %entry, %for.inc29 %indvars.iv134 = phi i64 [ 0, %entry ], [ %indvars.iv.next135, %for.inc29 ] %a.promoted118119 = phi i32 [ %a.promoted115, %entry ], [ %a.promoted116, %for.inc29 ] %2 = or i64 %indvars.iv134, 1 br label %for.body5 for.cond32.preheader: ; preds = %for.inc29 %b.promoted125 = load i32, ptr %b, align 4, !tbaa !5 br label %for.cond35.preheader for.body5: ; preds = %for.cond3.preheader, %for.inc %indvars.iv = phi i64 [ 0, %for.cond3.preheader ], [ %indvars.iv.next, %for.inc ] %a.promoted117 = phi i32 [ %a.promoted118119, %for.cond3.preheader ], [ %a.promoted116, %for.inc ] %dec27112113 = phi i32 [ %a.promoted118119, %for.cond3.preheader ], [ %dec27111, %for.inc ] %3 = or i64 %indvars.iv, 1 %arrayidx8 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %2, i64 %3 store i8 35, ptr %arrayidx8, align 1, !tbaa !9 %arrayidx13 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %indvars.iv134, i64 %3 store i8 35, ptr %arrayidx13, align 1, !tbaa !9 %arrayidx18 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %2, i64 %indvars.iv store i8 35, ptr %arrayidx18, align 2, !tbaa !9 %arrayidx22 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %indvars.iv134, i64 %indvars.iv store i8 35, ptr %arrayidx22, align 2, !tbaa !9 %tobool.not = icmp eq i32 %dec27112113, 0 br i1 %tobool.not, label %for.inc, label %if.then if.then: ; preds = %for.body5 store i8 46, ptr %arrayidx22, align 2, !tbaa !9 %dec27 = add nsw i32 %dec27112113, -1 store i32 %dec27, ptr %a, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body5, %if.then %a.promoted116 = phi i32 [ %a.promoted117, %for.body5 ], [ %dec27, %if.then ] %dec27111 = phi i32 [ 0, %for.body5 ], [ %dec27, %if.then ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2 %cmp4 = icmp ult i64 %indvars.iv, 98 br i1 %cmp4, label %for.body5, label %for.inc29, !llvm.loop !10 for.inc29: ; preds = %for.inc %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 2 %cmp = icmp ult i64 %indvars.iv134, 48 br i1 %cmp, label %for.cond3.preheader, label %for.cond32.preheader, !llvm.loop !12 for.cond35.preheader: ; preds = %for.cond32.preheader, %for.inc70 %indvars.iv142 = phi i64 [ 50, %for.cond32.preheader ], [ %indvars.iv.next143, %for.inc70 ] %b.promoted128129 = phi i32 [ %b.promoted125, %for.cond32.preheader ], [ %b.promoted126, %for.inc70 ] %4 = or i64 %indvars.iv142, 1 br label %for.body37 for.body37: ; preds = %for.cond35.preheader, %for.inc67 %indvars.iv138 = phi i64 [ 0, %for.cond35.preheader ], [ %indvars.iv.next139, %for.inc67 ] %b.promoted127 = phi i32 [ %b.promoted128129, %for.cond35.preheader ], [ %b.promoted126, %for.inc67 ] %dec65122123 = phi i32 [ %b.promoted128129, %for.cond35.preheader ], [ %dec65121, %for.inc67 ] %5 = or i64 %indvars.iv138, 1 %arrayidx43 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %4, i64 %5 store i8 46, ptr %arrayidx43, align 1, !tbaa !9 %arrayidx48 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %indvars.iv142, i64 %5 store i8 46, ptr %arrayidx48, align 1, !tbaa !9 %arrayidx53 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %4, i64 %indvars.iv138 store i8 46, ptr %arrayidx53, align 2, !tbaa !9 %arrayidx57 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %indvars.iv142, i64 %indvars.iv138 store i8 46, ptr %arrayidx57, align 2, !tbaa !9 %tobool58.not = icmp eq i32 %dec65122123, 0 br i1 %tobool58.not, label %for.inc67, label %if.then59 if.then59: ; preds = %for.body37 store i8 35, ptr %arrayidx53, align 2, !tbaa !9 %dec65 = add nsw i32 %dec65122123, -1 store i32 %dec65, ptr %b, align 4, !tbaa !5 br label %for.inc67 for.inc67: ; preds = %for.body37, %if.then59 %b.promoted126 = phi i32 [ %b.promoted127, %for.body37 ], [ %dec65, %if.then59 ] %dec65121 = phi i32 [ 0, %for.body37 ], [ %dec65, %if.then59 ] %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 2 %cmp36 = icmp ult i64 %indvars.iv138, 98 br i1 %cmp36, label %for.body37, label %for.inc70, !llvm.loop !13 for.inc70: ; preds = %for.inc67 %indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 2 %cmp33 = icmp ult i64 %indvars.iv142, 98 br i1 %cmp33, label %for.cond35.preheader, label %for.body75, !llvm.loop !14 for.body75: ; preds = %for.inc70, %for.body75 %indvars.iv146 = phi i64 [ %indvars.iv.next147, %for.body75 ], [ 0, %for.inc70 ] %arrayidx77 = getelementptr inbounds [110 x [110 x i8]], ptr %d, i64 0, i64 %indvars.iv146 %puts110 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx77) %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1 %exitcond.not = icmp eq i64 %indvars.iv.next147, 100 br i1 %exitcond.not, label %for.end80, label %for.body75, !llvm.loop !15 for.end80: ; preds = %for.body75 call void @llvm.lifetime.end.p0(i64 12100, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, 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: 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: 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 #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 = { nofree nounwind } 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} !14 = distinct !{!14, !11} !15 = distinct !{!15, !11}
#include <stdio.h> int main(void){ char blood[3]; int a=0,b=0,o=0,ab=0; while(scanf("%*d,%s",blood)!=EOF){ if(blood[1]=='B')ab++; else if(blood[0]=='A')a++; else if(blood[0]=='B')b++; else if(blood[0]=='O')o++; } printf("%d\n%d\n%d\n%d\n",a,b,ab,o); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180781/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180781/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 [7 x i8] c"%*d,%s\00", align 1 @.str.1 = private unnamed_addr constant [13 x i8] c"%d\0A%d\0A%d\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %blood = alloca [3 x i8], align 1 call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %blood) #3 %call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %blood) %cmp.not32 = icmp eq i32 %call31, -1 br i1 %cmp.not32, label %while.end, label %while.body.lr.ph while.body.lr.ph: ; preds = %entry %arrayidx = getelementptr inbounds [3 x i8], ptr %blood, i64 0, i64 1 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.end25 %ab.036 = phi i32 [ 0, %while.body.lr.ph ], [ %ab.1, %if.end25 ] %o.035 = phi i32 [ 0, %while.body.lr.ph ], [ %o.1, %if.end25 ] %b.034 = phi i32 [ 0, %while.body.lr.ph ], [ %b.1, %if.end25 ] %a.033 = phi i32 [ 0, %while.body.lr.ph ], [ %a.1, %if.end25 ] %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp1 = icmp eq i8 %0, 66 br i1 %cmp1, label %if.then, label %if.else if.then: ; preds = %while.body %inc = add nsw i32 %ab.036, 1 br label %if.end25 if.else: ; preds = %while.body %1 = load i8, ptr %blood, align 1, !tbaa !5 switch i8 %1, label %if.end25 [ i8 65, label %if.then7 i8 66, label %if.then14 i8 79, label %if.then21 ] if.then7: ; preds = %if.else %inc8 = add nsw i32 %a.033, 1 br label %if.end25 if.then14: ; preds = %if.else %inc15 = add nsw i32 %b.034, 1 br label %if.end25 if.then21: ; preds = %if.else %inc22 = add nsw i32 %o.035, 1 br label %if.end25 if.end25: ; preds = %if.else, %if.then7, %if.then21, %if.then14, %if.then %a.1 = phi i32 [ %a.033, %if.then ], [ %inc8, %if.then7 ], [ %a.033, %if.then14 ], [ %a.033, %if.then21 ], [ %a.033, %if.else ] %b.1 = phi i32 [ %b.034, %if.then ], [ %b.034, %if.then7 ], [ %inc15, %if.then14 ], [ %b.034, %if.then21 ], [ %b.034, %if.else ] %o.1 = phi i32 [ %o.035, %if.then ], [ %o.035, %if.then7 ], [ %o.035, %if.then14 ], [ %inc22, %if.then21 ], [ %o.035, %if.else ] %ab.1 = phi i32 [ %inc, %if.then ], [ %ab.036, %if.then7 ], [ %ab.036, %if.then14 ], [ %ab.036, %if.then21 ], [ %ab.036, %if.else ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %blood) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !8 while.end: ; preds = %if.end25, %entry %a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1, %if.end25 ] %b.0.lcssa = phi i32 [ 0, %entry ], [ %b.1, %if.end25 ] %o.0.lcssa = phi i32 [ 0, %entry ], [ %o.1, %if.end25 ] %ab.0.lcssa = phi i32 [ 0, %entry ], [ %ab.1, %if.end25 ] %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0.lcssa, i32 noundef %b.0.lcssa, i32 noundef %ab.0.lcssa, i32 noundef %o.0.lcssa) call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %blood) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int get_type(char* s){ if(s[0] == 'A'){ if(s[1] == 'B'){ return 2; }else{ return 0; } }else if(s[0] == 'B'){ return 1; }else if(s[0] == 'O'){ return 3; } return 0; } int main(int argc, char *argv[]){ int nums[4]; nums[0] = nums[1] = nums[2] = nums[3] = 0; char b_n[3]; int number; while(scanf("%d,%s",&number,b_n) != EOF){ nums[get_type(b_n)]++; } printf("%d\n%d\n%d\n%d\n",nums[0],nums[1],nums[2],nums[3]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180824/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180824/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 [13 x i8] c"%d\0A%d\0A%d\0A%d\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @get_type(ptr nocapture noundef readonly %s) local_unnamed_addr #0 { entry: %0 = load i8, ptr %s, align 1, !tbaa !5 switch i8 %0, label %if.end20 [ i8 65, label %if.then i8 66, label %return i8 79, label %if.then18 ] if.then: ; preds = %entry %arrayidx2 = getelementptr inbounds i8, ptr %s, i64 1 %1 = load i8, ptr %arrayidx2, align 1, !tbaa !5 %cmp4 = icmp eq i8 %1, 66 %. = select i1 %cmp4, i32 2, i32 0 br label %return if.then18: ; preds = %entry br label %return if.end20: ; preds = %entry br label %return return: ; preds = %entry, %if.then, %if.end20, %if.then18 %retval.0 = phi i32 [ 3, %if.then18 ], [ 0, %if.end20 ], [ %., %if.then ], [ 1, %entry ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 { entry: %nums = alloca [4 x i32], align 16 %b_n = alloca [3 x i8], align 1 %number = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %nums) #5 %arrayidx = getelementptr inbounds [4 x i32], ptr %nums, i64 0, i64 3 %arrayidx1 = getelementptr inbounds [4 x i32], ptr %nums, i64 0, i64 2 %arrayidx2 = getelementptr inbounds [4 x i32], ptr %nums, i64 0, i64 1 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %nums, i8 0, i64 16, i1 false) call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %b_n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #5 %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number, ptr noundef nonnull %b_n) %cmp.not13 = icmp eq i32 %call12, -1 br i1 %cmp.not13, label %while.end, label %while.body.lr.ph while.body.lr.ph: ; preds = %entry %arrayidx2.i = getelementptr inbounds i8, ptr %b_n, i64 1 br label %while.body while.body: ; preds = %while.body.lr.ph, %get_type.exit %0 = load i8, ptr %b_n, align 1, !tbaa !5 switch i8 %0, label %if.end20.i [ i8 65, label %if.then.i i8 66, label %get_type.exit i8 79, label %if.then18.i ] if.then.i: ; preds = %while.body %1 = load i8, ptr %arrayidx2.i, align 1, !tbaa !5 %cmp4.i = icmp eq i8 %1, 66 %..i = select i1 %cmp4.i, i64 2, i64 0 br label %get_type.exit if.then18.i: ; preds = %while.body br label %get_type.exit if.end20.i: ; preds = %while.body br label %get_type.exit get_type.exit: ; preds = %while.body, %if.then.i, %if.then18.i, %if.end20.i %retval.0.i = phi i64 [ 3, %if.then18.i ], [ 0, %if.end20.i ], [ %..i, %if.then.i ], [ 1, %while.body ] %arrayidx6 = getelementptr inbounds [4 x i32], ptr %nums, i64 0, i64 %retval.0.i %2 = load i32, ptr %arrayidx6, align 4, !tbaa !8 %inc = add nsw i32 %2, 1 store i32 %inc, ptr %arrayidx6, align 4, !tbaa !8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number, ptr noundef nonnull %b_n) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !10 while.end.loopexit: ; preds = %get_type.exit %.pre = load i32, ptr %nums, align 16, !tbaa !8 %.pre14 = load i32, ptr %arrayidx2, align 4, !tbaa !8 %.pre15 = load i32, ptr %arrayidx1, align 8, !tbaa !8 %.pre16 = load i32, ptr %arrayidx, align 4, !tbaa !8 br label %while.end while.end: ; preds = %while.end.loopexit, %entry %3 = phi i32 [ %.pre16, %while.end.loopexit ], [ 0, %entry ] %4 = phi i32 [ %.pre15, %while.end.loopexit ], [ 0, %entry ] %5 = phi i32 [ %.pre14, %while.end.loopexit ], [ 0, %entry ] %6 = phi i32 [ %.pre, %while.end.loopexit ], [ 0, %entry ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6, i32 noundef %5, i32 noundef %4, i32 noundef %3) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %number) #5 call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %b_n) #5 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %nums) #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 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(){ char t[2]; int a,b,o,ab,s; a=b=o=ab=0; while(scanf("%d,%s",&s,t)!=EOF){ if(t[1]=='B') ab++; else if(t[0]=='A') a++; else if(t[0]=='B') b++; else if(t[0]=='O') o++; } printf("%d\n%d\n%d\n%d\n",a,b,ab,o); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180903/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180903/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 [13 x i8] c"%d\0A%d\0A%d\0A%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %t = alloca [2 x i8], align 1 %s = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %t) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3 %call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %cmp.not32 = icmp eq i32 %call31, -1 br i1 %cmp.not32, label %while.end, label %while.body.lr.ph while.body.lr.ph: ; preds = %entry %arrayidx = getelementptr inbounds [2 x i8], ptr %t, i64 0, i64 1 br label %while.body while.body: ; preds = %while.body.lr.ph, %if.end25 %ab.036 = phi i32 [ 0, %while.body.lr.ph ], [ %ab.1, %if.end25 ] %o.035 = phi i32 [ 0, %while.body.lr.ph ], [ %o.1, %if.end25 ] %b.034 = phi i32 [ 0, %while.body.lr.ph ], [ %b.1, %if.end25 ] %a.033 = phi i32 [ 0, %while.body.lr.ph ], [ %a.1, %if.end25 ] %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp1 = icmp eq i8 %0, 66 br i1 %cmp1, label %if.then, label %if.else if.then: ; preds = %while.body %inc = add nsw i32 %ab.036, 1 br label %if.end25 if.else: ; preds = %while.body %1 = load i8, ptr %t, align 1, !tbaa !5 switch i8 %1, label %if.end25 [ i8 65, label %if.then7 i8 66, label %if.then14 i8 79, label %if.then21 ] if.then7: ; preds = %if.else %inc8 = add nsw i32 %a.033, 1 br label %if.end25 if.then14: ; preds = %if.else %inc15 = add nsw i32 %b.034, 1 br label %if.end25 if.then21: ; preds = %if.else %inc22 = add nsw i32 %o.035, 1 br label %if.end25 if.end25: ; preds = %if.else, %if.then7, %if.then21, %if.then14, %if.then %a.1 = phi i32 [ %a.033, %if.then ], [ %inc8, %if.then7 ], [ %a.033, %if.then14 ], [ %a.033, %if.then21 ], [ %a.033, %if.else ] %b.1 = phi i32 [ %b.034, %if.then ], [ %b.034, %if.then7 ], [ %inc15, %if.then14 ], [ %b.034, %if.then21 ], [ %b.034, %if.else ] %o.1 = phi i32 [ %o.035, %if.then ], [ %o.035, %if.then7 ], [ %o.035, %if.then14 ], [ %inc22, %if.then21 ], [ %o.035, %if.else ] %ab.1 = phi i32 [ %inc, %if.then ], [ %ab.036, %if.then7 ], [ %ab.036, %if.then14 ], [ %ab.036, %if.then21 ], [ %ab.036, %if.else ] %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !8 while.end: ; preds = %if.end25, %entry %a.0.lcssa = phi i32 [ 0, %entry ], [ %a.1, %if.end25 ] %b.0.lcssa = phi i32 [ 0, %entry ], [ %b.1, %if.end25 ] %o.0.lcssa = phi i32 [ 0, %entry ], [ %o.1, %if.end25 ] %ab.0.lcssa = phi i32 [ 0, %entry ], [ %ab.1, %if.end25 ] %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0.lcssa, i32 noundef %b.0.lcssa, i32 noundef %ab.0.lcssa, i32 noundef %o.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %t) #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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(void) { int prime[110000], i, j, s, sum; for (i = 0; i < 110000; i++){ prime[i] = 1; } prime[0] = prime[1] = 0; for (i = 2; i * i <= 110000; i++){ if (prime[i] == 1){ for (j = i * i; j <= 110000; j += i){ prime[j] = 0; } } } while (scanf("%d", &s), s != 0){ sum = 0; i = 0; j = 0; while (i < s){ if (prime[j] == 1){ sum += j; i++; } j++; } printf("%d\n", sum); } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180947/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180947/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: %prime = alloca [110000 x i32], align 16 %s = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 440000, ptr nonnull %prime) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3 br label %vector.body vector.body: ; preds = %vector.body, %entry %index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ] %0 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5 %index.next = add nuw nsw i64 %index, 8 %2 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %index.next store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5 %index.next.1 = add nuw nsw i64 %index, 16 %4 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %index.next.1 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5 %index.next.2 = add nuw nsw i64 %index, 24 %6 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %index.next.2 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds i32, ptr %6, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5 %index.next.3 = add nuw nsw i64 %index, 32 %8 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %index.next.3 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5 %9 = getelementptr inbounds i32, ptr %8, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5 %index.next.4 = add nuw nsw i64 %index, 40 %10 = icmp eq i64 %index.next.4, 110000 br i1 %10, label %for.end, label %vector.body, !llvm.loop !9 for.end: ; preds = %vector.body %arrayidx1 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 1 store i32 0, ptr %arrayidx1, align 4, !tbaa !5 store i32 0, ptr %prime, align 16, !tbaa !5 br label %for.body5 while.cond.preheader: ; preds = %for.inc17 %call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %11 = load i32, ptr %s, align 4, !tbaa !5 %cmp20.not61 = icmp eq i32 %11, 0 br i1 %cmp20.not61, label %while.end33, label %while.cond21.preheader for.body5: ; preds = %for.end, %for.inc17 %indvars.iv63 = phi i64 [ 2, %for.end ], [ %indvars.iv.next64, %for.inc17 ] %mul55 = phi i32 [ 4, %for.end ], [ %mul, %for.inc17 ] %arrayidx7 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %indvars.iv63 %12 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp8 = icmp eq i32 %12, 1 %cmp1152 = icmp ult i32 %mul55, 110001 %or.cond = and i1 %cmp8, %cmp1152 br i1 %or.cond, label %for.body12.preheader, label %for.inc17 for.body12.preheader: ; preds = %for.body5 %13 = zext i32 %mul55 to i64 br label %for.body12 for.body12: ; preds = %for.body12.preheader, %for.body12 %indvars.iv65 = phi i64 [ %13, %for.body12.preheader ], [ %indvars.iv.next66, %for.body12 ] %arrayidx14 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %indvars.iv65 store i32 0, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, %indvars.iv63 %cmp11 = icmp ult i64 %indvars.iv.next66, 110001 br i1 %cmp11, label %for.body12, label %for.inc17, !llvm.loop !13 for.inc17: ; preds = %for.body12, %for.body5 %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1 %14 = trunc i64 %indvars.iv.next64 to i32 %mul = mul nsw i32 %14, %14 %exitcond69.not = icmp eq i64 %indvars.iv.next64, 332 br i1 %exitcond69.not, label %while.cond.preheader, label %for.body5, !llvm.loop !14 while.cond21.preheader: ; preds = %while.cond.preheader, %while.end %15 = phi i32 [ %18, %while.end ], [ %11, %while.cond.preheader ] %cmp2256 = icmp sgt i32 %15, 0 br i1 %cmp2256, label %while.body23, label %while.end while.body23: ; preds = %while.cond21.preheader, %while.body23 %indvars.iv70 = phi i64 [ %indvars.iv.next71, %while.body23 ], [ 0, %while.cond21.preheader ] %sum.059 = phi i32 [ %sum.1, %while.body23 ], [ 0, %while.cond21.preheader ] %i.257 = phi i32 [ %i.3, %while.body23 ], [ 0, %while.cond21.preheader ] %arrayidx25 = getelementptr inbounds [110000 x i32], ptr %prime, i64 0, i64 %indvars.iv70 %16 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %cmp26 = icmp eq i32 %16, 1 %inc29 = zext i1 %cmp26 to i32 %i.3 = add nuw nsw i32 %i.257, %inc29 %17 = trunc i64 %indvars.iv70 to i32 %add28 = select i1 %cmp26, i32 %17, i32 0 %sum.1 = add nuw nsw i32 %add28, %sum.059 %indvars.iv.next71 = add nuw i64 %indvars.iv70, 1 %cmp22 = icmp slt i32 %i.3, %15 br i1 %cmp22, label %while.body23, label %while.end, !llvm.loop !15 while.end: ; preds = %while.body23, %while.cond21.preheader %sum.0.lcssa = phi i32 [ 0, %while.cond21.preheader ], [ %sum.1, %while.body23 ] %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %18 = load i32, ptr %s, align 4, !tbaa !5 %cmp20.not = icmp eq i32 %18, 0 br i1 %cmp20.not, label %while.end33, label %while.cond21.preheader, !llvm.loop !16 while.end33: ; preds = %while.end, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3 call void @llvm.lifetime.end.p0(i64 440000, ptr nonnull %prime) #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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include<stdio.h> #include<math.h> int main(void){ int n, count = 0, i, s, key, so; long a; scanf("%d", &n); while ( n ) { count = so = 0; for ( a = 1; count < n; a++ ) { s = key = 2; if ( a == 1 ) ; else if ( a == 2 ) {/*printf("sosuu\n")*/;count++; so += a;} else { while ( s < sqrt(a) + 2 && key != 0) { if ( a % s == 0 ) key = 0; else key = 1; s++; } } if ( a != 1 && s > sqrt(a) + 1) {/*printf("sosuu\n")*/;count++; so += a;} } printf("%d\n", so); scanf("%d", &n); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180990/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180990/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 %tobool.not78 = icmp eq i32 %0, 0 br i1 %tobool.not78, label %while.end41, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end %1 = phi i32 [ %6, %for.end ], [ %0, %entry ] %cmp73 = icmp sgt i32 %1, 0 br i1 %cmp73, label %for.body, label %for.end for.body: ; preds = %for.cond.preheader, %for.inc %a.076 = phi i64 [ %inc38, %for.inc ], [ 1, %for.cond.preheader ] %so.075 = phi i32 [ %so.2, %for.inc ], [ 0, %for.cond.preheader ] %count.074 = phi i32 [ %count.2, %for.inc ], [ 0, %for.cond.preheader ] switch i64 %a.076, label %while.cond6.preheader [ i64 1, label %for.inc i64 2, label %if.end23.thread61 ] while.cond6.preheader: ; preds = %for.body %conv8 = sitofp i64 %a.076 to double %call969 = call double @sqrt(double noundef %conv8) #4 %add1070 = fadd double %call969, 2.000000e+00 %cmp1171 = fcmp ogt double %add1070, 2.000000e+00 br i1 %cmp1171, label %while.body15, label %land.lhs.true if.end23.thread61: ; preds = %for.body %inc = add nsw i32 %count.074, 1 %add = add i32 %so.075, 2 br label %land.lhs.true while.body15: ; preds = %while.cond6.preheader, %while.body15 %indvars.iv = phi i64 [ %indvars.iv.next, %while.body15 ], [ 2, %while.cond6.preheader ] %rem = urem i64 %a.076, %indvars.iv %cmp17 = icmp ne i64 %rem, 0 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %2 = trunc i64 %indvars.iv.next to i32 %conv7 = sitofp i32 %2 to double %call9 = call double @sqrt(double noundef %conv8) #4 %add10 = fadd double %call9, 2.000000e+00 %cmp11 = fcmp ogt double %add10, %conv7 %3 = and i1 %cmp17, %cmp11 br i1 %3, label %while.body15, label %if.end23, !llvm.loop !9 if.end23: ; preds = %while.body15 %cmp24.not = icmp eq i64 %a.076, 1 br i1 %cmp24.not, label %for.inc, label %land.lhs.true land.lhs.true: ; preds = %while.cond6.preheader, %if.end23.thread61, %if.end23 %conv27.pre-phi = phi double [ 2.000000e+00, %if.end23.thread61 ], [ %conv8, %if.end23 ], [ %conv8, %while.cond6.preheader ] %so.168 = phi i32 [ %add, %if.end23.thread61 ], [ %so.075, %if.end23 ], [ %so.075, %while.cond6.preheader ] %s.167 = phi i32 [ 2, %if.end23.thread61 ], [ %2, %if.end23 ], [ 2, %while.cond6.preheader ] %count.166 = phi i32 [ %inc, %if.end23.thread61 ], [ %count.074, %if.end23 ], [ %count.074, %while.cond6.preheader ] %conv26 = sitofp i32 %s.167 to double %call28 = call double @sqrt(double noundef %conv27.pre-phi) #4 %add29 = fadd double %call28, 1.000000e+00 %cmp30 = fcmp olt double %add29, %conv26 br i1 %cmp30, label %if.then32, label %for.inc if.then32: ; preds = %land.lhs.true %inc33 = add nsw i32 %count.166, 1 %4 = trunc i64 %a.076 to i32 %conv36 = add i32 %so.168, %4 br label %for.inc for.inc: ; preds = %for.body, %if.end23, %land.lhs.true, %if.then32 %count.2 = phi i32 [ %inc33, %if.then32 ], [ %count.166, %land.lhs.true ], [ %count.074, %if.end23 ], [ %count.074, %for.body ] %so.2 = phi i32 [ %conv36, %if.then32 ], [ %so.168, %land.lhs.true ], [ %so.075, %if.end23 ], [ %so.075, %for.body ] %inc38 = add nuw nsw i64 %a.076, 1 %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %count.2, %5 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11 for.end: ; preds = %for.inc, %for.cond.preheader %so.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %so.2, %for.inc ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %so.0.lcssa) %call40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %6 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %while.end41, label %for.cond.preheader, !llvm.loop !12 while.end41: ; preds = %for.end, %entry 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(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 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 = { 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> #include <math.h> #define MAX 1000000 #define OVER 10000 int main(void) { int sieve[MAX+1]={0},count=0,i,j,num,sum[OVER+1]={0}; sieve[1]=1; for (i=2; ; i++) { if (sieve[i]==0) { for (j=2*i; j<=MAX; j+=i) sieve[j]=1; sum[count+1]=i+sum[count]; count++; } if (count==OVER) break; } while (1) { scanf("%d",&num); if (num==0) break; printf("%d\n",sum[num]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181054/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181054/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: %sieve = alloca [1000001 x i32], align 16 %num = alloca i32, align 4 %sum = alloca [10001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4000004, ptr nonnull %sieve) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000004) %sieve, i8 0, i64 4000004, i1 false) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4 call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %sum) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) %sum, i8 0, i64 40004, i1 false) %arrayidx = getelementptr inbounds [1000001 x i32], ptr %sieve, i64 0, i64 1 store i32 1, ptr %arrayidx, align 4, !tbaa !5 br label %for.cond for.cond: ; preds = %for.inc15, %entry %indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.inc15 ], [ 2, %entry ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc15 ], [ 4, %entry ] %count.0 = phi i32 [ %count.135, %for.inc15 ], [ 0, %entry ] %arrayidx1 = getelementptr inbounds [1000001 x i32], ptr %sieve, i64 0, i64 %indvars.iv40 %0 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %cmp = icmp eq i32 %0, 0 br i1 %cmp, label %if.then, label %for.inc15 if.then: ; preds = %for.cond %cmp336 = icmp ult i64 %indvars.iv40, 500001 br i1 %cmp336, label %for.body, label %if.end for.body: ; preds = %if.then, %for.body %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body ], [ %indvars.iv, %if.then ] %arrayidx5 = getelementptr inbounds [1000001 x i32], ptr %sieve, i64 0, i64 %indvars.iv42 store i32 1, ptr %arrayidx5, align 4, !tbaa !5 %indvars.iv.next43 = add i64 %indvars.iv42, %indvars.iv40 %cmp3 = icmp ult i64 %indvars.iv.next43, 1000001 br i1 %cmp3, label %for.body, label %if.end, !llvm.loop !9 if.end: ; preds = %for.body, %if.then %idxprom6 = sext i32 %count.0 to i64 %arrayidx7 = getelementptr inbounds [10001 x i32], ptr %sum, i64 0, i64 %idxprom6 %1 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %2 = trunc i64 %indvars.iv40 to i32 %add8 = add nsw i32 %1, %2 %add9 = add nsw i32 %count.0, 1 %idxprom10 = sext i32 %add9 to i64 %arrayidx11 = getelementptr inbounds [10001 x i32], ptr %sum, i64 0, i64 %idxprom10 store i32 %add8, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp eq i32 %add9, 10000 br i1 %cmp12, label %while.cond.preheader, label %for.inc15 while.cond.preheader: ; preds = %if.end %call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %3 = load i32, ptr %num, align 4, !tbaa !5 %cmp1839 = icmp eq i32 %3, 0 br i1 %cmp1839, label %while.end, label %if.end20 for.inc15: ; preds = %for.cond, %if.end %count.135 = phi i32 [ %add9, %if.end ], [ %count.0, %for.cond ] %indvars.iv.next41 = add nuw i64 %indvars.iv40, 1 %indvars.iv.next = add i64 %indvars.iv, 2 br label %for.cond if.end20: ; preds = %while.cond.preheader, %if.end20 %4 = phi i32 [ %6, %if.end20 ], [ %3, %while.cond.preheader ] %idxprom21 = sext i32 %4 to i64 %arrayidx22 = getelementptr inbounds [10001 x i32], ptr %sum, i64 0, i64 %idxprom21 %5 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num) %6 = load i32, ptr %num, align 4, !tbaa !5 %cmp18 = icmp eq i32 %6, 0 br i1 %cmp18, label %while.end, label %if.end20 while.end: ; preds = %if.end20, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %sum) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4 call void @llvm.lifetime.end.p0(i64 4000004, ptr nonnull %sieve) #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: 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 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 = { 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"}
// AOJ 2249: Road Construction // 2017.11.15 bal4u@uu #include <stdio.h> #include <stdlib.h> #include <string.h> #define TM 0 #if TM #include <time.h> #endif #define MAX 16010 typedef struct { int t, node, c; } QUE; QUE que[MAX]; int qsize; #define PARENT(i) ((i)>>1) #define LEFT(i) ((i)<<1) #define RIGHT(i) (((i)<<1)+1) void min_heapify(int i) { int l, r, min; QUE qt; l = LEFT(i), r = RIGHT(i); if (l < qsize && (que[l].t < que[i].t || que[l].t == que[i].t && que[l].c < que[i].c)) min = l; else min = i; if (r < qsize && (que[r].t < que[min].t || que[r].t == que[min].t && que[r].c < que[min].c)) min = r; if (min != i) { qt = que[i], que[i] = que[min], que[min] = qt; min_heapify(min); } } void deq() { // if (qsize == 0) return 0; // *n = que[0].node, *t = que[0].t, *c = que[0].c; que[0] = que[--qsize]; min_heapify(0); // return 1; } void enq(int n, int t, int c) { int i, min; QUE qt; i = qsize++; que[i].node = n, que[i].t = t, que[i].c = c; while (i > 0 && (que[min = PARENT(i)].t > que[i].t || que[min].t == que[i].t && que[min].c > que[i].c)) { qt = que[i], que[i] = que[min], que[min] = qt; i = min; } } #define INF 0x55555555 typedef struct { int to, d, c; } TBL; TBL tbl[10001][50]; int len[10001]; char visited[10001]; int size; int dijkstra(int start) { int i, s, d, c, ans = 0; TBL *e; qsize = 0; memset(visited, 0, sizeof(visited)); enq(start, 0, 0); while(qsize) { s = que[0].node, d = que[0].t, c = que[0].c; deq(); if (visited[s]) continue; visited[s] = 1; ans += c; for (e = tbl[s], i = len[s]; i--; e++) { if (visited[e->to]) continue; enq(e->to, d + e->d, e->c); } } return ans; } char buf[40], *p; int getint() { int n = 0; while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf); return n; } int main() { int n, m, i, u, v, d, c; TBL *e; #if TM clock_t start, finish; start = clock(); #endif while (fgets(p=buf, 40, stdin) && *p != '0') { size = n = getint(), p++, m = getint(); memset(len, 0, sizeof(len)); for (i = 0; i < m; i++) { fgets(p=buf, 40, stdin); u = getint()-1, p++, v = getint()-1, p++, d = getint(), p++, c = getint(); e = tbl[u] + len[u]; e->to = v, e->d = d, e->c = c, len[u]++; e = tbl[v] + len[v]; e->to = u, e->d = d, e->c = c, len[v]++; } printf("%d\n", dijkstra(0)); } #if TM finish = clock(); printf("time %lf\n", (double)(finish-start)/CLOCKS_PER_SEC); #endif return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181104/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181104/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.QUE = type { i32, i32, i32 } %struct.TBL = type { i32, i32, i32 } @qsize = dso_local local_unnamed_addr global i32 0, align 4 @que = dso_local local_unnamed_addr global [16010 x %struct.QUE] zeroinitializer, align 16 @visited = dso_local local_unnamed_addr global [10001 x i8] zeroinitializer, align 16 @tbl = dso_local local_unnamed_addr global [10001 x [50 x %struct.TBL]] zeroinitializer, align 16 @len = dso_local local_unnamed_addr global [10001 x i32] zeroinitializer, align 16 @p = dso_local local_unnamed_addr global ptr null, align 8 @buf = dso_local global [40 x i8] zeroinitializer, align 16 @stdin = external local_unnamed_addr global ptr, align 8 @size = dso_local local_unnamed_addr global i32 0, align 4 @.str = 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 void @min_heapify(i32 noundef %i) local_unnamed_addr #0 { entry: %qt = alloca %struct.QUE, align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %qt) %shl = shl i32 %i, 1 %add = or i32 %shl, 1 %0 = load i32, ptr @qsize, align 4, !tbaa !5 %cmp = icmp slt i32 %shl, %0 br i1 %cmp, label %land.lhs.true, label %if.else land.lhs.true: ; preds = %entry %idxprom = sext i32 %shl to i64 %arrayidx = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 8, !tbaa !9 %idxprom2 = sext i32 %i to i64 %arrayidx3 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2 %2 = load i32, ptr %arrayidx3, align 4, !tbaa !9 %cmp5 = icmp slt i32 %1, %2 br i1 %cmp5, label %if.end, label %lor.lhs.false lor.lhs.false: ; preds = %land.lhs.true %cmp12 = icmp eq i32 %1, %2 br i1 %cmp12, label %land.lhs.true13, label %if.else land.lhs.true13: ; preds = %lor.lhs.false %c = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 2 %3 = load i32, ptr %c, align 8, !tbaa !11 %c18 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2, i32 2 %4 = load i32, ptr %c18, align 4, !tbaa !11 %cmp19 = icmp slt i32 %3, %4 br i1 %cmp19, label %if.end, label %if.else if.else: ; preds = %land.lhs.true13, %lor.lhs.false, %entry br label %if.end if.end: ; preds = %land.lhs.true, %land.lhs.true13, %if.else %min.0 = phi i32 [ %i, %if.else ], [ %shl, %land.lhs.true13 ], [ %shl, %land.lhs.true ] %cmp20 = icmp slt i32 %add, %0 br i1 %cmp20, label %land.lhs.true21, label %if.end46 land.lhs.true21: ; preds = %if.end %idxprom22 = sext i32 %add to i64 %arrayidx23 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22 %5 = load i32, ptr %arrayidx23, align 4, !tbaa !9 %idxprom25 = sext i32 %min.0 to i64 %arrayidx26 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25 %6 = load i32, ptr %arrayidx26, align 4, !tbaa !9 %cmp28 = icmp slt i32 %5, %6 br i1 %cmp28, label %if.then45, label %lor.lhs.false29 lor.lhs.false29: ; preds = %land.lhs.true21 %cmp36 = icmp eq i32 %5, %6 br i1 %cmp36, label %land.lhs.true37, label %if.end46 land.lhs.true37: ; preds = %lor.lhs.false29 %c40 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22, i32 2 %7 = load i32, ptr %c40, align 4, !tbaa !11 %c43 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25, i32 2 %8 = load i32, ptr %c43, align 4, !tbaa !11 %cmp44 = icmp slt i32 %7, %8 br i1 %cmp44, label %if.then45, label %if.end46 if.then45: ; preds = %land.lhs.true37, %land.lhs.true21 br label %if.end46 if.end46: ; preds = %if.then45, %land.lhs.true37, %lor.lhs.false29, %if.end %min.1 = phi i32 [ %add, %if.then45 ], [ %min.0, %land.lhs.true37 ], [ %min.0, %lor.lhs.false29 ], [ %min.0, %if.end ] %cmp47.not = icmp eq i32 %min.1, %i br i1 %cmp47.not, label %if.end57, label %if.then48 if.then48: ; preds = %if.end46 %idxprom49 = sext i32 %i to i64 %arrayidx50 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom49 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %qt, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50, i64 12, i1 false), !tbaa.struct !12 %idxprom53 = sext i32 %min.1 to i64 %arrayidx54 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom53 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54, i64 12, i1 false), !tbaa.struct !12 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54, ptr noundef nonnull align 4 dereferenceable(12) %qt, i64 12, i1 false), !tbaa.struct !12 tail call void @min_heapify(i32 noundef %min.1) br label %if.end57 if.end57: ; preds = %if.then48, %if.end46 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %qt) 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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local void @deq() local_unnamed_addr #3 { entry: %0 = load i32, ptr @qsize, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr @qsize, align 4, !tbaa !5 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) @que, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false), !tbaa.struct !12 tail call void @min_heapify(i32 noundef 0) ret void } ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @enq(i32 noundef %n, i32 noundef %t, i32 noundef %c) local_unnamed_addr #0 { entry: %qt = alloca %struct.QUE, align 4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %qt) %0 = load i32, ptr @qsize, align 4, !tbaa !5 %inc = add nsw i32 %0, 1 store i32 %inc, ptr @qsize, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom %node = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 1 store i32 %n, ptr %node, align 4, !tbaa !13 store i32 %t, ptr %arrayidx, align 4, !tbaa !9 %c6 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 2 store i32 %c, ptr %c6, align 4, !tbaa !11 %cmp52 = icmp sgt i32 %0, 0 br i1 %cmp52, label %land.rhs, label %while.end land.rhs: ; preds = %entry, %while.body %i.053 = phi i32 [ %shr, %while.body ], [ %0, %entry ] %shr = lshr i32 %i.053, 1 %idxprom7 = zext i32 %shr to i64 %arrayidx8 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom7 %1 = load i32, ptr %arrayidx8, align 4, !tbaa !9 %idxprom10 = zext i32 %i.053 to i64 %arrayidx11 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom10 %2 = load i32, ptr %arrayidx11, align 4, !tbaa !9 %cmp13 = icmp sgt i32 %1, %2 br i1 %cmp13, label %while.body, label %lor.rhs lor.rhs: ; preds = %land.rhs %cmp20 = icmp eq i32 %1, %2 br i1 %cmp20, label %land.rhs21, label %while.end land.rhs21: ; preds = %lor.rhs %c24 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom7, i32 2 %3 = load i32, ptr %c24, align 4, !tbaa !11 %c27 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom10, i32 2 %4 = load i32, ptr %c27, align 4, !tbaa !11 %cmp28 = icmp sgt i32 %3, %4 br i1 %cmp28, label %while.body, label %while.end while.body: ; preds = %land.rhs, %land.rhs21 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %qt, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx11, i64 12, i1 false), !tbaa.struct !12 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx11, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx8, i64 12, i1 false), !tbaa.struct !12 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx8, ptr noundef nonnull align 4 dereferenceable(12) %qt, i64 12, i1 false), !tbaa.struct !12 %cmp.not = icmp ult i32 %i.053, 2 br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !14 while.end: ; preds = %land.rhs21, %lor.rhs, %while.body, %entry call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %qt) ret void } ; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable define dso_local i32 @dijkstra(i32 noundef %start) local_unnamed_addr #3 { entry: %qt.i28 = alloca %struct.QUE, align 4 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10001) @visited, i8 0, i64 10001, i1 false) store i32 1, ptr @qsize, align 4, !tbaa !5 store i32 %start, ptr getelementptr inbounds ([16010 x %struct.QUE], ptr @que, i64 0, i64 0, i32 1), align 4, !tbaa !13 store i32 0, ptr @que, align 16, !tbaa !9 store i32 0, ptr getelementptr inbounds ([16010 x %struct.QUE], ptr @que, i64 0, i64 0, i32 2), align 8, !tbaa !11 br label %while.cond.outer while.cond.outer: ; preds = %while.cond.outer.backedge, %entry %ans.0.ph = phi i32 [ 0, %entry ], [ %add, %while.cond.outer.backedge ] br label %while.cond while.cond: ; preds = %while.cond.outer, %while.body %0 = load i32, ptr @qsize, align 4, !tbaa !5 %tobool.not = icmp eq i32 %0, 0 br i1 %tobool.not, label %while.end, label %while.body while.body: ; preds = %while.cond %1 = load i32, ptr getelementptr inbounds ([16010 x %struct.QUE], ptr @que, i64 0, i64 0, i32 1), align 4, !tbaa !13 %2 = load i32, ptr @que, align 16, !tbaa !9 %3 = load i32, ptr getelementptr inbounds ([16010 x %struct.QUE], ptr @que, i64 0, i64 0, i32 2), align 8, !tbaa !11 %dec.i = add nsw i32 %0, -1 store i32 %dec.i, ptr @qsize, align 4, !tbaa !5 %idxprom.i26 = sext i32 %dec.i to i64 %arrayidx.i27 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i26 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) @que, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i27, i64 12, i1 false), !tbaa.struct !12 tail call void @min_heapify(i32 noundef 0) %idxprom = sext i32 %1 to i64 %arrayidx = getelementptr inbounds [10001 x i8], ptr @visited, i64 0, i64 %idxprom %4 = load i8, ptr %arrayidx, align 1, !tbaa !16 %tobool1.not = icmp eq i8 %4, 0 br i1 %tobool1.not, label %if.end, label %while.cond, !llvm.loop !17 if.end: ; preds = %while.body %arrayidx.le = getelementptr inbounds [10001 x i8], ptr @visited, i64 0, i64 %idxprom store i8 1, ptr %arrayidx.le, align 1, !tbaa !16 %add = add nsw i32 %3, %ans.0.ph %arrayidx7 = getelementptr inbounds [10001 x i32], ptr @len, i64 0, i64 %idxprom %5 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %tobool8.not57 = icmp eq i32 %5, 0 br i1 %tobool8.not57, label %while.cond.outer.backedge, label %for.body.preheader while.cond.outer.backedge: ; preds = %for.inc, %if.end br label %while.cond.outer, !llvm.loop !17 for.body.preheader: ; preds = %if.end %qsize.promoted = load i32, ptr @qsize, align 4, !tbaa !5 %arrayidx5 = getelementptr inbounds [10001 x [50 x %struct.TBL]], ptr @tbl, i64 0, i64 %idxprom br label %for.body for.body: ; preds = %for.body.preheader, %for.inc %dec60.in = phi i32 [ %dec60, %for.inc ], [ %5, %for.body.preheader ] %e.059 = phi ptr [ %incdec.ptr, %for.inc ], [ %arrayidx5, %for.body.preheader ] %inc.i295558 = phi i32 [ %inc.i2954, %for.inc ], [ %qsize.promoted, %for.body.preheader ] %dec60 = add nsw i32 %dec60.in, -1 %6 = load i32, ptr %e.059, align 4, !tbaa !9 %idxprom9 = sext i32 %6 to i64 %arrayidx10 = getelementptr inbounds [10001 x i8], ptr @visited, i64 0, i64 %idxprom9 %7 = load i8, ptr %arrayidx10, align 1, !tbaa !16 %tobool11.not = icmp eq i8 %7, 0 br i1 %tobool11.not, label %if.end13, label %for.inc if.end13: ; preds = %for.body %d15 = getelementptr inbounds %struct.TBL, ptr %e.059, i64 0, i32 1 %8 = load i32, ptr %d15, align 4, !tbaa !13 %add16 = add nsw i32 %8, %2 %c17 = getelementptr inbounds %struct.TBL, ptr %e.059, i64 0, i32 2 %9 = load i32, ptr %c17, align 4, !tbaa !11 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %qt.i28) %inc.i29 = add nsw i32 %inc.i295558, 1 store i32 %inc.i29, ptr @qsize, align 4, !tbaa !5 %idxprom.i30 = sext i32 %inc.i295558 to i64 %arrayidx.i31 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i30 %node.i32 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i30, i32 1 store i32 %6, ptr %node.i32, align 4, !tbaa !13 store i32 %add16, ptr %arrayidx.i31, align 4, !tbaa !9 %c6.i33 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i30, i32 2 store i32 %9, ptr %c6.i33, align 4, !tbaa !11 %cmp52.i34 = icmp sgt i32 %inc.i295558, 0 br i1 %cmp52.i34, label %land.rhs.i35, label %enq.exit51 land.rhs.i35: ; preds = %if.end13, %while.body.i49 %i.053.i36 = phi i32 [ %shr.i37, %while.body.i49 ], [ %inc.i295558, %if.end13 ] %shr.i37 = lshr i32 %i.053.i36, 1 %idxprom7.i38 = zext i32 %shr.i37 to i64 %arrayidx8.i39 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom7.i38 %10 = load i32, ptr %arrayidx8.i39, align 4, !tbaa !9 %idxprom10.i40 = zext i32 %i.053.i36 to i64 %arrayidx11.i41 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom10.i40 %11 = load i32, ptr %arrayidx11.i41, align 4, !tbaa !9 %cmp13.i42 = icmp sgt i32 %10, %11 br i1 %cmp13.i42, label %while.body.i49, label %lor.rhs.i43 lor.rhs.i43: ; preds = %land.rhs.i35 %cmp20.i44 = icmp eq i32 %10, %11 br i1 %cmp20.i44, label %land.rhs21.i45, label %enq.exit51 land.rhs21.i45: ; preds = %lor.rhs.i43 %c24.i46 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom7.i38, i32 2 %12 = load i32, ptr %c24.i46, align 4, !tbaa !11 %c27.i47 = getelementptr inbounds [16010 x %struct.QUE], ptr @que, i64 0, i64 %idxprom10.i40, i32 2 %13 = load i32, ptr %c27.i47, align 4, !tbaa !11 %cmp28.i48 = icmp sgt i32 %12, %13 br i1 %cmp28.i48, label %while.body.i49, label %enq.exit51 while.body.i49: ; preds = %land.rhs21.i45, %land.rhs.i35 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %qt.i28, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx11.i41, i64 12, i1 false), !tbaa.struct !12 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx11.i41, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx8.i39, i64 12, i1 false), !tbaa.struct !12 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx8.i39, ptr noundef nonnull align 4 dereferenceable(12) %qt.i28, i64 12, i1 false), !tbaa.struct !12 %cmp.not.i50 = icmp ult i32 %i.053.i36, 2 br i1 %cmp.not.i50, label %enq.exit51, label %land.rhs.i35, !llvm.loop !14 enq.exit51: ; preds = %lor.rhs.i43, %land.rhs21.i45, %while.body.i49, %if.end13 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %qt.i28) br label %for.inc for.inc: ; preds = %for.body, %enq.exit51 %inc.i2954 = phi i32 [ %inc.i295558, %for.body ], [ %inc.i29, %enq.exit51 ] %incdec.ptr = getelementptr inbounds %struct.TBL, ptr %e.059, i64 1 %tobool8.not = icmp eq i32 %dec60, 0 br i1 %tobool8.not, label %while.cond.outer.backedge, label %for.body, !llvm.loop !18 while.end: ; preds = %while.cond ret i32 %ans.0.ph } ; 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: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable define dso_local i32 @getint() local_unnamed_addr #5 { entry: %p.promoted = load ptr, ptr @p, align 8, !tbaa !19 %0 = load i8, ptr %p.promoted, align 1, !tbaa !16 %cmp8 = icmp sgt i8 %0, 47 br i1 %cmp8, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %n.010 = phi i32 [ %add4, %while.body ], [ 0, %entry ] %incdec.ptr79 = phi ptr [ %incdec.ptr, %while.body ], [ %p.promoted, %entry ] %add = mul i32 %n.010, 10 %incdec.ptr = getelementptr inbounds i8, ptr %incdec.ptr79, i64 1 store ptr %incdec.ptr, ptr @p, align 8, !tbaa !19 %1 = load i8, ptr %incdec.ptr79, align 1, !tbaa !16 %2 = and i8 %1, 15 %and = zext i8 %2 to i32 %add4 = add nsw i32 %add, %and %3 = load i8, ptr %incdec.ptr, align 1, !tbaa !16 %cmp = icmp sgt i8 %3, 47 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !21 while.end: ; preds = %while.body, %entry %n.0.lcssa = phi i32 [ 0, %entry ], [ %add4, %while.body ] ret i32 %n.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #6 { entry: store ptr @buf, ptr @p, align 8, !tbaa !19 %0 = load ptr, ptr @stdin, align 8, !tbaa !19 %call113 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 40, ptr noundef %0) %tobool.not114 = icmp eq ptr %call113, null br i1 %tobool.not114, label %while.end, label %land.rhs land.rhs: ; preds = %entry, %for.end %1 = load ptr, ptr @p, align 8, !tbaa !19 %2 = load i8, ptr %1, align 1, !tbaa !16 %cmp.not = icmp eq i8 %2, 48 br i1 %cmp.not, label %while.end, label %while.body while.body: ; preds = %land.rhs %cmp8.i = icmp sgt i8 %2, 47 br i1 %cmp8.i, label %while.body.i, label %getint.exit while.body.i: ; preds = %while.body, %while.body.i %n.010.i = phi i32 [ %add4.i, %while.body.i ], [ 0, %while.body ] %incdec.ptr79.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %1, %while.body ] %add.i = mul i32 %n.010.i, 10 %incdec.ptr.i = getelementptr inbounds i8, ptr %incdec.ptr79.i, i64 1 store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !19 %3 = load i8, ptr %incdec.ptr79.i, align 1, !tbaa !16 %4 = and i8 %3, 15 %and.i = zext i8 %4 to i32 %add4.i = add nsw i32 %add.i, %and.i %5 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !16 %cmp.i = icmp sgt i8 %5, 47 br i1 %cmp.i, label %while.body.i, label %getint.exit, !llvm.loop !21 getint.exit: ; preds = %while.body.i, %while.body %6 = phi ptr [ %1, %while.body ], [ %incdec.ptr.i, %while.body.i ] %n.0.lcssa.i = phi i32 [ 0, %while.body ], [ %add4.i, %while.body.i ] store i32 %n.0.lcssa.i, ptr @size, align 4, !tbaa !5 %incdec.ptr = getelementptr inbounds i8, ptr %6, i64 1 store ptr %incdec.ptr, ptr @p, align 8, !tbaa !19 %7 = load i8, ptr %incdec.ptr, align 1, !tbaa !16 %cmp8.i52 = icmp sgt i8 %7, 47 br i1 %cmp8.i52, label %while.body.i54, label %getint.exit62.thread getint.exit62.thread: ; preds = %getint.exit tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) @len, i8 0, i64 40004, i1 false) br label %for.end while.body.i54: ; preds = %getint.exit, %while.body.i54 %n.010.i55 = phi i32 [ %add4.i60, %while.body.i54 ], [ 0, %getint.exit ] %incdec.ptr79.i56 = phi ptr [ %incdec.ptr.i58, %while.body.i54 ], [ %incdec.ptr, %getint.exit ] %add.i57 = mul i32 %n.010.i55, 10 %incdec.ptr.i58 = getelementptr inbounds i8, ptr %incdec.ptr79.i56, i64 1 store ptr %incdec.ptr.i58, ptr @p, align 8, !tbaa !19 %8 = load i8, ptr %incdec.ptr79.i56, align 1, !tbaa !16 %9 = and i8 %8, 15 %and.i59 = zext i8 %9 to i32 %add4.i60 = add nsw i32 %add.i57, %and.i59 %10 = load i8, ptr %incdec.ptr.i58, align 1, !tbaa !16 %cmp.i61 = icmp sgt i8 %10, 47 br i1 %cmp.i61, label %while.body.i54, label %getint.exit62, !llvm.loop !21 getint.exit62: ; preds = %while.body.i54 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) @len, i8 0, i64 40004, i1 false) %cmp4111 = icmp sgt i32 %add4.i60, 0 br i1 %cmp4111, label %for.body, label %for.end for.body: ; preds = %getint.exit62, %getint.exit110 %i.0112 = phi i32 [ %inc34, %getint.exit110 ], [ 0, %getint.exit62 ] store ptr @buf, ptr @p, align 8, !tbaa !19 %11 = load ptr, ptr @stdin, align 8, !tbaa !19 %call6 = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 40, ptr noundef %11) %p.promoted.i63 = load ptr, ptr @p, align 8, !tbaa !19 %12 = load i8, ptr %p.promoted.i63, align 1, !tbaa !16 %cmp8.i64 = icmp sgt i8 %12, 47 br i1 %cmp8.i64, label %while.body.i66, label %getint.exit74 while.body.i66: ; preds = %for.body, %while.body.i66 %n.010.i67 = phi i32 [ %add4.i72, %while.body.i66 ], [ 0, %for.body ] %incdec.ptr79.i68 = phi ptr [ %incdec.ptr.i70, %while.body.i66 ], [ %p.promoted.i63, %for.body ] %add.i69 = mul i32 %n.010.i67, 10 %incdec.ptr.i70 = getelementptr inbounds i8, ptr %incdec.ptr79.i68, i64 1 store ptr %incdec.ptr.i70, ptr @p, align 8, !tbaa !19 %13 = load i8, ptr %incdec.ptr79.i68, align 1, !tbaa !16 %14 = and i8 %13, 15 %and.i71 = zext i8 %14 to i32 %add4.i72 = add nsw i32 %add.i69, %and.i71 %15 = load i8, ptr %incdec.ptr.i70, align 1, !tbaa !16 %cmp.i73 = icmp sgt i8 %15, 47 br i1 %cmp.i73, label %while.body.i66, label %getint.exit74, !llvm.loop !21 getint.exit74: ; preds = %while.body.i66, %for.body %16 = phi ptr [ %p.promoted.i63, %for.body ], [ %incdec.ptr.i70, %while.body.i66 ] %n.0.lcssa.i65 = phi i32 [ 0, %for.body ], [ %add4.i72, %while.body.i66 ] %sub = add nsw i32 %n.0.lcssa.i65, -1 %incdec.ptr8 = getelementptr inbounds i8, ptr %16, i64 1 store ptr %incdec.ptr8, ptr @p, align 8, !tbaa !19 %17 = load i8, ptr %incdec.ptr8, align 1, !tbaa !16 %cmp8.i76 = icmp sgt i8 %17, 47 br i1 %cmp8.i76, label %while.body.i78, label %getint.exit86 while.body.i78: ; preds = %getint.exit74, %while.body.i78 %n.010.i79 = phi i32 [ %add4.i84, %while.body.i78 ], [ 0, %getint.exit74 ] %incdec.ptr79.i80 = phi ptr [ %incdec.ptr.i82, %while.body.i78 ], [ %incdec.ptr8, %getint.exit74 ] %add.i81 = mul i32 %n.010.i79, 10 %incdec.ptr.i82 = getelementptr inbounds i8, ptr %incdec.ptr79.i80, i64 1 store ptr %incdec.ptr.i82, ptr @p, align 8, !tbaa !19 %18 = load i8, ptr %incdec.ptr79.i80, align 1, !tbaa !16 %19 = and i8 %18, 15 %and.i83 = zext i8 %19 to i32 %add4.i84 = add nsw i32 %add.i81, %and.i83 %20 = load i8, ptr %incdec.ptr.i82, align 1, !tbaa !16 %cmp.i85 = icmp sgt i8 %20, 47 br i1 %cmp.i85, label %while.body.i78, label %getint.exit86, !llvm.loop !21 getint.exit86: ; preds = %while.body.i78, %getint.exit74 %21 = phi ptr [ %16, %getint.exit74 ], [ %incdec.ptr79.i80, %while.body.i78 ] %n.0.lcssa.i77 = phi i32 [ 0, %getint.exit74 ], [ %add4.i84, %while.body.i78 ] %sub10 = add nsw i32 %n.0.lcssa.i77, -1 %incdec.ptr11 = getelementptr inbounds i8, ptr %21, i64 2 store ptr %incdec.ptr11, ptr @p, align 8, !tbaa !19 %22 = load i8, ptr %incdec.ptr11, align 1, !tbaa !16 %cmp8.i88 = icmp sgt i8 %22, 47 br i1 %cmp8.i88, label %while.body.i90, label %getint.exit98 while.body.i90: ; preds = %getint.exit86, %while.body.i90 %n.010.i91 = phi i32 [ %add4.i96, %while.body.i90 ], [ 0, %getint.exit86 ] %incdec.ptr79.i92 = phi ptr [ %incdec.ptr.i94, %while.body.i90 ], [ %incdec.ptr11, %getint.exit86 ] %add.i93 = mul i32 %n.010.i91, 10 %incdec.ptr.i94 = getelementptr inbounds i8, ptr %incdec.ptr79.i92, i64 1 store ptr %incdec.ptr.i94, ptr @p, align 8, !tbaa !19 %23 = load i8, ptr %incdec.ptr79.i92, align 1, !tbaa !16 %24 = and i8 %23, 15 %and.i95 = zext i8 %24 to i32 %add4.i96 = add nsw i32 %add.i93, %and.i95 %25 = load i8, ptr %incdec.ptr.i94, align 1, !tbaa !16 %cmp.i97 = icmp sgt i8 %25, 47 br i1 %cmp.i97, label %while.body.i90, label %getint.exit98, !llvm.loop !21 getint.exit98: ; preds = %while.body.i90, %getint.exit86 %26 = phi ptr [ %incdec.ptr11, %getint.exit86 ], [ %incdec.ptr.i94, %while.body.i90 ] %n.0.lcssa.i89 = phi i32 [ 0, %getint.exit86 ], [ %add4.i96, %while.body.i90 ] %incdec.ptr13 = getelementptr inbounds i8, ptr %26, i64 1 store ptr %incdec.ptr13, ptr @p, align 8, !tbaa !19 %27 = load i8, ptr %incdec.ptr13, align 1, !tbaa !16 %cmp8.i100 = icmp sgt i8 %27, 47 br i1 %cmp8.i100, label %while.body.i102, label %getint.exit110 while.body.i102: ; preds = %getint.exit98, %while.body.i102 %n.010.i103 = phi i32 [ %add4.i108, %while.body.i102 ], [ 0, %getint.exit98 ] %incdec.ptr79.i104 = phi ptr [ %incdec.ptr.i106, %while.body.i102 ], [ %incdec.ptr13, %getint.exit98 ] %add.i105 = mul i32 %n.010.i103, 10 %incdec.ptr.i106 = getelementptr inbounds i8, ptr %incdec.ptr79.i104, i64 1 store ptr %incdec.ptr.i106, ptr @p, align 8, !tbaa !19 %28 = load i8, ptr %incdec.ptr79.i104, align 1, !tbaa !16 %29 = and i8 %28, 15 %and.i107 = zext i8 %29 to i32 %add4.i108 = add nsw i32 %add.i105, %and.i107 %30 = load i8, ptr %incdec.ptr.i106, align 1, !tbaa !16 %cmp.i109 = icmp sgt i8 %30, 47 br i1 %cmp.i109, label %while.body.i102, label %getint.exit110, !llvm.loop !21 getint.exit110: ; preds = %while.body.i102, %getint.exit98 %n.0.lcssa.i101 = phi i32 [ 0, %getint.exit98 ], [ %add4.i108, %while.body.i102 ] %idxprom = sext i32 %sub to i64 %arrayidx = getelementptr inbounds [10001 x [50 x %struct.TBL]], ptr @tbl, i64 0, i64 %idxprom %arrayidx16 = getelementptr inbounds [10001 x i32], ptr @len, i64 0, i64 %idxprom %31 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %idx.ext = sext i32 %31 to i64 %add.ptr = getelementptr inbounds %struct.TBL, ptr %arrayidx, i64 %idx.ext store i32 %sub10, ptr %add.ptr, align 4, !tbaa !9 %d17 = getelementptr inbounds %struct.TBL, ptr %arrayidx, i64 %idx.ext, i32 1 store i32 %n.0.lcssa.i89, ptr %d17, align 4, !tbaa !13 %c18 = getelementptr inbounds %struct.TBL, ptr %arrayidx, i64 %idx.ext, i32 2 store i32 %n.0.lcssa.i101, ptr %c18, align 4, !tbaa !11 %inc = add nsw i32 %31, 1 store i32 %inc, ptr %arrayidx16, align 4, !tbaa !5 %idxprom21 = sext i32 %sub10 to i64 %arrayidx22 = getelementptr inbounds [10001 x [50 x %struct.TBL]], ptr @tbl, i64 0, i64 %idxprom21 %arrayidx25 = getelementptr inbounds [10001 x i32], ptr @len, i64 0, i64 %idxprom21 %32 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %idx.ext26 = sext i32 %32 to i64 %add.ptr27 = getelementptr inbounds %struct.TBL, ptr %arrayidx22, i64 %idx.ext26 store i32 %sub, ptr %add.ptr27, align 4, !tbaa !9 %d29 = getelementptr inbounds %struct.TBL, ptr %arrayidx22, i64 %idx.ext26, i32 1 store i32 %n.0.lcssa.i89, ptr %d29, align 4, !tbaa !13 %c30 = getelementptr inbounds %struct.TBL, ptr %arrayidx22, i64 %idx.ext26, i32 2 store i32 %n.0.lcssa.i101, ptr %c30, align 4, !tbaa !11 %inc33 = add nsw i32 %32, 1 store i32 %inc33, ptr %arrayidx25, align 4, !tbaa !5 %inc34 = add nuw nsw i32 %i.0112, 1 %exitcond.not = icmp eq i32 %inc34, %add4.i60 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !22 for.end: ; preds = %getint.exit110, %getint.exit62.thread, %getint.exit62 %call35 = tail call i32 @dijkstra(i32 noundef 0) %call36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call35) store ptr @buf, ptr @p, align 8, !tbaa !19 %33 = load ptr, ptr @stdin, align 8, !tbaa !19 %call = tail call ptr @fgets(ptr noundef nonnull @buf, i32 noundef 40, ptr noundef %33) %tobool.not = icmp eq ptr %call, null br i1 %tobool.not, label %while.end, label %land.rhs, !llvm.loop !23 while.end: ; preds = %land.rhs, %for.end, %entry ret i32 0 } ; Function Attrs: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #7 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #5 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, 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 #6 = { 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 #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"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, !6, i64 0} !10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8} !11 = !{!10, !6, i64 8} !12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5} !13 = !{!10, !6, i64 4} !14 = distinct !{!14, !15} !15 = !{!"llvm.loop.mustprogress"} !16 = !{!7, !7, i64 0} !17 = distinct !{!17, !15} !18 = distinct !{!18, !15} !19 = !{!20, !20, i64 0} !20 = !{!"any pointer", !7, i64 0} !21 = distinct !{!21, !15} !22 = distinct !{!22, !15} !23 = distinct !{!23, !15}
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define MAX(a,b) (a>b?a:b) int main() { int n, i, j; int x[100],y[100],h[100]; int X, Y, H, max=0; scanf("%d",&n); for(i=0; i<n; i++) { scanf("%d %d %d",&x[i],&y[i],&h[i]); max = MAX(max, h[i]); } for(X=0; X<101; X++) { for(Y=0; Y<101; Y++) { for(H=max; H<max+201; H++) { int flag = 1; for(i=0; i<n; i++) { if(h[i] != MAX(0, H-abs(X-x[i])-abs(Y-y[i])) ) { flag = 0; break; } } if(flag==1) { printf("%d %d %d",X, Y, H); } } } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181155/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181155/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 [9 x i8] c"%d %d %d\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 [100 x i32], align 16 %y = alloca [100 x i32], align 16 %h = 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 400, ptr nonnull %x) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %y) #5 call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %h) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp92 = icmp sgt i32 %0, 0 br i1 %cmp92, label %for.body, label %for.cond11.preheader for.cond11.preheader: ; preds = %for.body, %entry %max.0.lcssa = phi i32 [ 0, %entry ], [ %max.0., %for.body ] %1 = add nuw nsw i32 %max.0.lcssa, 200 br label %for.cond14.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %max.094 = phi i32 [ %max.0., %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %indvars.iv %arrayidx4 = getelementptr inbounds [100 x i32], ptr %h, i64 0, i64 %indvars.iv %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx4) %2 = load i32, ptr %arrayidx4, align 4, !tbaa !5 %max.0. = call i32 @llvm.smax.i32(i32 %max.094, i32 %2) %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.cond11.preheader, !llvm.loop !9 for.cond14.preheader: ; preds = %for.cond11.preheader, %for.inc59 %X.099 = phi i32 [ 0, %for.cond11.preheader ], [ %inc60, %for.inc59 ] br label %for.cond17.preheader for.cond17.preheader: ; preds = %for.cond14.preheader, %for.inc56 %Y.098 = phi i32 [ 0, %for.cond14.preheader ], [ %inc57, %for.inc56 ] br label %for.cond20.preheader for.cond20.preheader: ; preds = %for.cond17.preheader, %if.end52 %H.097 = phi i32 [ %max.0.lcssa, %for.cond17.preheader ], [ %inc54, %if.end52 ] %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp21.not95 = icmp sgt i32 %5, 0 br i1 %cmp21.not95, label %for.body22.preheader, label %if.then50 for.body22.preheader: ; preds = %for.cond20.preheader %wide.trip.count = zext i32 %5 to i64 br label %for.body22 for.cond20: ; preds = %for.body22 %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1 %exitcond.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count br i1 %exitcond.not, label %if.then50, label %for.body22, !llvm.loop !11 for.body22: ; preds = %for.body22.preheader, %for.cond20 %indvars.iv101 = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next102, %for.cond20 ] %arrayidx24 = getelementptr inbounds [100 x i32], ptr %h, i64 0, i64 %indvars.iv101 %6 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %arrayidx26 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv101 %7 = load i32, ptr %arrayidx26, align 4, !tbaa !5 %sub = sub nsw i32 %X.099, %7 %8 = call i32 @llvm.abs.i32(i32 %sub, i1 true) %arrayidx29 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %indvars.iv101 %9 = load i32, ptr %arrayidx29, align 4, !tbaa !5 %sub30 = sub nsw i32 %Y.098, %9 %10 = call i32 @llvm.abs.i32(i32 %sub30, i1 true) %11 = add nuw i32 %8, %10 %sub31 = sub i32 %H.097, %11 %spec.select = call i32 @llvm.smax.i32(i32 %sub31, i32 0) %cmp45.not = icmp eq i32 %6, %spec.select br i1 %cmp45.not, label %for.cond20, label %if.end52 if.then50: ; preds = %for.cond20, %for.cond20.preheader %call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %X.099, i32 noundef %Y.098, i32 noundef %H.097) br label %if.end52 if.end52: ; preds = %for.body22, %if.then50 %inc54 = add nuw nsw i32 %H.097, 1 %cmp18 = icmp slt i32 %H.097, %1 br i1 %cmp18, label %for.cond20.preheader, label %for.inc56, !llvm.loop !12 for.inc56: ; preds = %if.end52 %inc57 = add nuw nsw i32 %Y.098, 1 %exitcond104.not = icmp eq i32 %inc57, 101 br i1 %exitcond104.not, label %for.inc59, label %for.cond17.preheader, !llvm.loop !13 for.inc59: ; preds = %for.inc56 %inc60 = add nuw nsw i32 %X.099, 1 %exitcond105.not = icmp eq i32 %inc60, 101 br i1 %exitcond105.not, label %for.end61, label %for.cond14.preheader, !llvm.loop !14 for.end61: ; preds = %for.inc59 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %h) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %y) #5 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #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 i32 @llvm.abs.i32(i32, i1 immarg) #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 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 = { 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} !14 = distinct !{!14, !10}
#if 0 cat <<EOF >mistaken-paste #endif // thanks for @rsk0315_h4x #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" #define _USE_MATH_DEFINES #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #include <time.h> #define BIG 2000000007 #define VERYBIG 2000000000000007LL #define MOD 1000000007 #define FOD 998244353 typedef uint64_t ull; typedef int64_t sll; #define N_MAX 1000000 #ifdef __cplusplus #include <queue> #include <stack> #include <tuple> #include <set> #include <map> #include <string> #include <algorithm> #include <functional> #include <array> using std::queue; using std::priority_queue; using std::stack; using std::tuple; using std::set; using std::map; using std::vector; using std::greater; using std::pair; using std::string; #endif typedef struct { int32_t a; int32_t b; } hw; typedef struct { sll a; sll b; } hwll; typedef struct { sll a; sll b; sll c; } hwllc; typedef struct { hwll a; hwll b; } linell; ull n, m; ull h, w; ull k; ull q; sll va, vb, vc, vd, ve, vf; ull ua, ub, uc, ud, ue, uf; long double vra, vrb, vrc; double vda, vdb, vdc; char ch, dh; ull umin (ull x, ull y) { return (x < y) ? x : y; } ull umax (ull x, ull y) { return (x > y) ? x : y; } sll smin (sll x, sll y) { return (x < y) ? x : y; } sll smax (sll x, sll y) { return (x > y) ? x : y; } ull gcd (ull x, ull y) { if (x < y) { return gcd(y, x); } else if (y == 0) { return x; } else { return gcd(y, x % y); } } ull bitpow (ull a, ull x, ull modulo) { ull result = 1; while (x) { if (x & 1) { result *= a; result %= modulo; } x /= 2; a = (a * a) % modulo; } return result; } ull divide (ull a, ull b, ull modulo) { return (a * bitpow(b, modulo - 2, modulo)) % modulo; } ull udiff (ull a, ull b) { if (a >= b) { return a - b; } else { return b - a; } } sll sdiff (sll a, sll b) { if (a >= b) { return a - b; } else { return b - a; } } int bitcount (ull n) { int result = 0; while (n) { if (n & 1) result++; n /= 2; } return result; } // double distance (sll x1, sll y1, sll x2, sll y2) { // double xdist2, ydist2, origindist, dist; // xdist2 = (x1 - x2) * (x1 - x2); // ydist2 = (y1 - y2) * (y1 - y2); // return sqrt(xdist2 + ydist2); // } int32_t pullcomp (const void *left, const void *right) { ull l = *(ull*)left; ull r = *(ull*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t psllcomp (const void *left, const void *right) { sll l = *(sll*)left; sll r = *(sll*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pcharcomp (const void *left, const void *right) { char l = *(char*)left; char r = *(char*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pdoublecomp (const void *left, const void *right) { double l = *(double*)left; double r = *(double*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pstrcomp (const void *left, const void *right) { char* l = *(char**)left; char* r = *(char**)right; return strcmp(l, r); } int32_t phwllABcomp (const void *left, const void *right) { hwll l = *(hwll*)left; hwll r = *(hwll*)right; if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } return 0; } int32_t phwllREVcomp (const void *left, const void *right) { hwll l = *(hwll*)left; hwll r = *(hwll*)right; if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } return 0; } int32_t ptriplecomp (const void *left, const void *right) { hwllc l = *(hwllc*)left; hwllc r = *(hwllc*)right; if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } if (l.c < r.c) { return -1; } if (l.c > r.c) { return +1; } return 0; } int32_t ptripleREVcomp (const void *left, const void *right) { hwllc l = *(hwllc*)left; hwllc r = *(hwllc*)right; if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } if (l.c < r.c) { return -1; } if (l.c > r.c) { return +1; } return 0; } int32_t pquadcomp (const void *left, const void *right) { linell l = *(linell*)left; linell r = *(linell*)right; sll ac = phwllABcomp(&(l.a), &(r.a)); if (ac) return ac; sll bc = phwllABcomp(&(l.b), &(r.b)); if (bc) return bc; return 0; } bool isinrange (sll left, sll x, sll right) { return (left <= x && x <= right); } bool isinrange_soft (sll left, sll x, sll right) { return (left <= x && x <= right) || (left >= x && x >= right); } sll a[N_MAX]; // ull a[N_MAX]; // sll a[3001][3001]; sll b[N_MAX]; // sll b[3001][3001]; sll c[N_MAX]; // sll d[N_MAX]; // sll e[N_MAX]; char s[N_MAX + 1]; // char s[3010][3010]; char t[N_MAX + 1]; // char t[3010][3010]; hwll xy[N_MAX]; hwllc tup[N_MAX]; // sll table[1000][1000]; ull solve () { sll i, j, ki, li; // ull result = 0; sll result = 0; double dresult = 0; // ull maybe = 0; sll maybe = 0; // ull sum = 0; sll sum = 0; sll item; ull *dpcell; for (i = 0; i <= 100; i++) { for (j = 0; j <= 100; j++) { ull ul = 0, uh = VERYBIG; for (ki = 0; ki < n; ki++) { ull mh = sdiff(i, a[ki]) + sdiff(j, b[ki]); if (!c[ki]) { uh = smin(uh, mh); } else { if (ul && ul != c[ki] + mh) break; if (!ul) ul = c[ki] + mh; } } if (ki == n && ul <= uh) { printf("%llu %llu %llu\n", i, j, ul); return 0; } } } // printf("%lld\n", result); // printf("%.15lf\n", dresult); // puts(s); return 0; success: // puts("YES"); puts("Yes"); // printf("%llu\n", result); // puts("0"); // puts("Yay!"); return 0; fail: // puts("NO"); puts("No"); // puts("0"); // puts("-1"); // puts("-1 -1 -1"); // puts("Impossible"); return 1; } int32_t main (void) { int32_t i, j; int32_t x, y; // scanf("%llu%llu", &h, &w); scanf("%llu", &n, &m); // scanf("%llu", &k, &n, &m); // scanf("%llu%llu", &h, &w); // scanf("%lld%lld", &va, &vb, &vc, &vd); // scanf("%llu%llu", &ua, &ub, &uc, &ud); // scanf("%llu", &q); // scanf("%s", s); // scanf("%s", t); for (i = 0; i < n; i++) { // scanf("%lld%lld", &xy[i].a, &xy[i].b); // scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c); scanf("%lld", &a[i]); scanf("%lld", &b[i]); scanf("%lld", &c[i]); // scanf("%lld", &d[i]); // a[i]--; // b[i]--; // c[i]--; // tup[i].a--; // tup[i].b--; } // scanf("%llu", &m, &k); // scanf("%llu", &q); // scanf("%s", s); // for (i = 0; i < m; i++) { // scanf("%lld", &b[i]); // // b[i]--; // } // for (i = 0; i < h; i++) { // for (j = 0; j < w; j++) { // scanf("%llu", &table[i][j]); // } // } // for (i = 0; i < h; i++) { // scanf("%s", &s[i]); // } solve(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181199/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181199/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.hwll = type { i64, i64 } %struct.hwllc = type { i64, i64, i64 } @n = dso_local global i64 0, align 8 @a = dso_local global [1000000 x i64] zeroinitializer, align 16 @b = dso_local global [1000000 x i64] zeroinitializer, align 16 @c = dso_local global [1000000 x i64] zeroinitializer, align 16 @.str = private unnamed_addr constant [16 x i8] c"%llu %llu %llu\0A\00", align 1 @.str.3 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1 @m = dso_local global i64 0, align 8 @.str.4 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @h = dso_local local_unnamed_addr global i64 0, align 8 @w = dso_local local_unnamed_addr global i64 0, align 8 @k = dso_local local_unnamed_addr global i64 0, align 8 @q = dso_local local_unnamed_addr global i64 0, align 8 @va = dso_local local_unnamed_addr global i64 0, align 8 @vb = dso_local local_unnamed_addr global i64 0, align 8 @vc = dso_local local_unnamed_addr global i64 0, align 8 @vd = dso_local local_unnamed_addr global i64 0, align 8 @ve = dso_local local_unnamed_addr global i64 0, align 8 @vf = dso_local local_unnamed_addr global i64 0, align 8 @ua = dso_local local_unnamed_addr global i64 0, align 8 @ub = dso_local local_unnamed_addr global i64 0, align 8 @uc = dso_local local_unnamed_addr global i64 0, align 8 @ud = dso_local local_unnamed_addr global i64 0, align 8 @ue = dso_local local_unnamed_addr global i64 0, align 8 @uf = dso_local local_unnamed_addr global i64 0, align 8 @vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @ch = dso_local local_unnamed_addr global i8 0, align 1 @dh = dso_local local_unnamed_addr global i8 0, align 1 @s = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16 @t = dso_local local_unnamed_addr global [1000001 x i8] zeroinitializer, align 16 @xy = dso_local local_unnamed_addr global [1000000 x %struct.hwll] zeroinitializer, align 16 @tup = dso_local local_unnamed_addr global [1000000 x %struct.hwllc] zeroinitializer, align 16 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 { entry: %cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse.backedge, %entry %x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ] %y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ] %cmp = icmp ult i64 %x.tr, %y.tr br i1 %cmp, label %tailrecurse.backedge, label %if.else if.else: ; preds = %tailrecurse %cmp1 = icmp eq i64 %y.tr, 0 br i1 %cmp1, label %return, label %if.else3 if.else3: ; preds = %if.else %rem = urem i64 %x.tr, %y.tr br label %tailrecurse.backedge tailrecurse.backedge: ; preds = %if.else3, %tailrecurse %y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ] br label %tailrecurse return: ; preds = %if.else ret i64 %x.tr } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 { entry: %tobool.not12 = icmp eq i64 %x, 0 br i1 %tobool.not12, label %while.end, label %while.body while.body: ; preds = %entry, %if.end %result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ] %a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ] %x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ] %and = and i64 %x.addr.013, 1 %tobool1.not = icmp eq i64 %and, 0 br i1 %tobool1.not, label %if.end, label %if.then if.then: ; preds = %while.body %mul = mul i64 %result.015, %a.addr.014 %rem = urem i64 %mul, %modulo br label %if.end if.end: ; preds = %if.then, %while.body %result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ] %div11 = lshr i64 %x.addr.013, 1 %mul2 = mul i64 %a.addr.014, %a.addr.014 %rem3 = urem i64 %mul2, %modulo %tobool.not = icmp ult i64 %x.addr.013, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5 while.end: ; preds = %if.end, %entry %result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ] ret i64 %result.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 { entry: %sub = add i64 %modulo, -2 %tobool.not12.i = icmp eq i64 %sub, 0 br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i while.body.i: ; preds = %entry, %if.end.i %result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ] %a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ] %x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ] %and.i = and i64 %x.addr.013.i, 1 %tobool1.not.i = icmp eq i64 %and.i, 0 br i1 %tobool1.not.i, label %if.end.i, label %if.then.i if.then.i: ; preds = %while.body.i %mul.i = mul i64 %a.addr.014.i, %result.015.i %rem.i = urem i64 %mul.i, %modulo br label %if.end.i if.end.i: ; preds = %if.then.i, %while.body.i %result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ] %div11.i = lshr i64 %x.addr.013.i, 1 %mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i %rem3.i = urem i64 %mul2.i, %modulo %tobool.not.i = icmp ult i64 %x.addr.013.i, 2 br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5 bitpow.exit: ; preds = %if.end.i, %entry %result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ] %mul = mul i64 %result.0.lcssa.i, %a %rem = urem i64 %mul, %modulo ret i64 %rem } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp.not = icmp ult i64 %a, %b %sub = sub i64 %a, %b %sub1 = sub i64 %b, %a %retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub ret i64 %retval.0 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 { entry: %sub = sub nsw i64 %a, %b %retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true) ret i64 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 { entry: %tobool.not6 = icmp eq i64 %n, 0 br i1 %tobool.not6, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ] %n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ] %0 = trunc i64 %n.addr.07 to i32 %1 = and i32 %0, 1 %spec.select = add i32 %1, %result.08 %div5 = lshr i64 %n.addr.07, 1 %tobool.not = icmp ult i64 %n.addr.07, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7 while.end: ; preds = %while.body, %entry %result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ] ret i32 %result.0.lcssa } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %0 = load i64, ptr %left, align 8, !tbaa !8 %1 = load i64, ptr %right, align 8, !tbaa !8 %cmp = icmp ult i64 %0, %1 %cmp1 = icmp ugt i64 %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %0 = load i64, ptr %left, align 8, !tbaa !8 %1 = load i64, ptr %right, align 8, !tbaa !8 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp sgt i64 %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %0 = load i8, ptr %left, align 1, !tbaa !12 %1 = load i8, ptr %right, align 1, !tbaa !12 %cmp = icmp slt i8 %0, %1 %cmp5 = icmp sgt i8 %0, %1 %. = zext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %0 = load double, ptr %left, align 8, !tbaa !13 %1 = load double, ptr %right, align 8, !tbaa !13 %cmp = fcmp olt double %0, %1 %cmp1 = fcmp ogt double %0, %1 %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load ptr, ptr %left, align 8, !tbaa !15 %1 = load ptr, ptr %right, align 8, !tbaa !15 %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #9 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload %. = zext i1 %cmp13 to i32 br label %cleanup cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload %. = zext i1 %cmp13 to i32 br label %cleanup cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17 %l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16 %l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17 %r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16 %r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp13, label %cleanup, label %if.end15 if.end15: ; preds = %if.end10 %cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload br i1 %cmp17, label %cleanup, label %if.end19 if.end19: ; preds = %if.end15 %cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload %. = zext i1 %cmp22 to i32 br label %cleanup cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @ptripleREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19 %l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17 %l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16 %l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19 %r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17 %r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16 %r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18 %cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp, label %cleanup, label %if.end if.end: ; preds = %entry %cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp4, label %cleanup, label %if.end6 if.end6: ; preds = %if.end %cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp8, label %cleanup, label %if.end10 if.end10: ; preds = %if.end6 %cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp13, label %cleanup, label %if.end15 if.end15: ; preds = %if.end10 %cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload br i1 %cmp17, label %cleanup, label %if.end19 if.end19: ; preds = %if.end15 %cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload %. = zext i1 %cmp22 to i32 br label %cleanup cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry %retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pquadcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 { entry: %l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !20 %l.sroa.4.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %l.sroa.4.0.copyload = load i64, ptr %l.sroa.4.0.left.sroa_idx, align 8, !tbaa.struct !19 %l.sroa.5.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 16 %l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0.left.sroa_idx, align 8, !tbaa.struct !17 %l.sroa.6.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 24 %l.sroa.6.0.copyload = load i64, ptr %l.sroa.6.0.left.sroa_idx, align 8, !tbaa.struct !18 %r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !20 %r.sroa.4.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %r.sroa.4.0.copyload = load i64, ptr %r.sroa.4.0.right.sroa_idx, align 8, !tbaa.struct !19 %r.sroa.5.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 16 %r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0.right.sroa_idx, align 8, !tbaa.struct !17 %r.sroa.6.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 24 %r.sroa.6.0.copyload = load i64, ptr %r.sroa.6.0.right.sroa_idx, align 8, !tbaa.struct !18 %cmp.i = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp.i, label %cleanup10, label %if.end.i if.end.i: ; preds = %entry %cmp4.i = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload br i1 %cmp4.i, label %cleanup10, label %if.end6.i if.end6.i: ; preds = %if.end.i %cmp8.i = icmp slt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload br i1 %cmp8.i, label %cleanup10, label %phwllABcomp.exit phwllABcomp.exit: ; preds = %if.end6.i %cmp13.i.not = icmp sgt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload br i1 %cmp13.i.not, label %cleanup10, label %if.end if.end: ; preds = %phwllABcomp.exit %cmp.i21 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp.i21, label %cleanup10, label %if.end.i22 if.end.i22: ; preds = %if.end %cmp4.i23 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload br i1 %cmp4.i23, label %cleanup10, label %if.end6.i24 if.end6.i24: ; preds = %if.end.i22 %cmp8.i25 = icmp slt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload br i1 %cmp8.i25, label %cleanup10, label %if.end10.i26 if.end10.i26: ; preds = %if.end6.i24 %cmp13.i27 = icmp sgt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload %..i28 = zext i1 %cmp13.i27 to i32 br label %cleanup10 cleanup10: ; preds = %if.end10.i26, %if.end6.i24, %if.end.i22, %if.end, %if.end6.i, %if.end.i, %entry, %phwllABcomp.exit %retval.1 = phi i32 [ 1, %phwllABcomp.exit ], [ -1, %if.end6.i ], [ 1, %if.end.i ], [ -1, %entry ], [ -1, %if.end ], [ 1, %if.end.i22 ], [ -1, %if.end6.i24 ], [ %..i28, %if.end10.i26 ] ret i32 %retval.1 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 { entry: %cmp = icmp sle i64 %left, %x %cmp1 = icmp sle i64 %x, %right %0 = and i1 %cmp, %cmp1 ret i1 %0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 { entry: %cmp.not = icmp sgt i64 %left, %x %cmp1.not = icmp sgt i64 %x, %right %or.cond = or i1 %cmp.not, %cmp1.not br i1 %or.cond, label %lor.rhs, label %lor.end lor.rhs: ; preds = %entry %cmp2 = icmp sge i64 %left, %x %cmp3 = icmp sge i64 %x, %right %0 = and i1 %cmp2, %cmp3 br label %lor.end lor.end: ; preds = %entry, %lor.rhs %1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ] ret i1 %1 } ; Function Attrs: nofree nounwind uwtable define dso_local i64 @solve() local_unnamed_addr #6 { entry: %0 = load i64, ptr @n, align 8, !tbaa !8 %cmp584.not = icmp eq i64 %0, 0 br i1 %cmp584.not, label %if.then25, label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %entry, %for.inc35.split.us.us %i.0105.us = phi i64 [ %inc36.us, %for.inc35.split.us.us ], [ 0, %entry ] br label %for.cond4.preheader.us.us for.cond4.preheader.us.us: ; preds = %for.inc32.us.us, %for.cond1.preheader.us %j.095.us.us = phi i64 [ 0, %for.cond1.preheader.us ], [ %inc33.us.us, %for.inc32.us.us ] br label %for.body6.us.us for.body6.us.us: ; preds = %for.inc.us.us, %for.cond4.preheader.us.us %uh.087.us.us = phi i64 [ 2000000000000007, %for.cond4.preheader.us.us ], [ %uh.279.us.us, %for.inc.us.us ] %ul.086.us.us = phi i64 [ 0, %for.cond4.preheader.us.us ], [ %ul.278.us.us, %for.inc.us.us ] %ki.085.us.us = phi i64 [ 0, %for.cond4.preheader.us.us ], [ %inc.us.us, %for.inc.us.us ] %arrayidx.us.us = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %ki.085.us.us %1 = load i64, ptr %arrayidx.us.us, align 8, !tbaa !8 %sub.i.us.us = sub nsw i64 %i.0105.us, %1 %retval.0.i.us.us = tail call i64 @llvm.abs.i64(i64 %sub.i.us.us, i1 true) %arrayidx7.us.us = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %ki.085.us.us %2 = load i64, ptr %arrayidx7.us.us, align 8, !tbaa !8 %sub.i72.us.us = sub nsw i64 %j.095.us.us, %2 %retval.0.i73.us.us = tail call i64 @llvm.abs.i64(i64 %sub.i72.us.us, i1 true) %add.us.us = add nuw nsw i64 %retval.0.i73.us.us, %retval.0.i.us.us %arrayidx9.us.us = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %ki.085.us.us %3 = load i64, ptr %arrayidx9.us.us, align 8, !tbaa !8 %tobool.not.us.us = icmp eq i64 %3, 0 br i1 %tobool.not.us.us, label %if.then.us.us, label %if.else.us.us if.else.us.us: ; preds = %for.body6.us.us %tobool11.not.not.us.us = icmp eq i64 %ul.086.us.us, 0 %add13.us.us = add i64 %add.us.us, %3 br i1 %tobool11.not.not.us.us, label %for.inc.us.us, label %cleanup.us.us cleanup.us.us: ; preds = %if.else.us.us %cmp14.not.not.us.us = icmp eq i64 %ul.086.us.us, %add13.us.us br i1 %cmp14.not.not.us.us, label %for.inc.us.us, label %for.end.us.us for.end.us.us: ; preds = %for.inc.us.us, %cleanup.us.us %ki.0.lcssa.us.us = phi i64 [ %ki.085.us.us, %cleanup.us.us ], [ %0, %for.inc.us.us ] %ul.0.lcssa.us.us = phi i64 [ %ul.086.us.us, %cleanup.us.us ], [ %ul.278.us.us, %for.inc.us.us ] %uh.0.lcssa.us.us = phi i64 [ %uh.087.us.us, %cleanup.us.us ], [ %uh.279.us.us, %for.inc.us.us ] %cmp22.us.us = icmp ne i64 %ki.0.lcssa.us.us, %0 %cmp24.not.us.us = icmp ugt i64 %ul.0.lcssa.us.us, %uh.0.lcssa.us.us %or.cond71.us.us = select i1 %cmp22.us.us, i1 true, i1 %cmp24.not.us.us br i1 %or.cond71.us.us, label %for.inc32.us.us, label %if.then25 for.inc32.us.us: ; preds = %for.end.us.us %inc33.us.us = add nuw nsw i64 %j.095.us.us, 1 %exitcond117.not = icmp eq i64 %inc33.us.us, 101 br i1 %exitcond117.not, label %for.inc35.split.us.us, label %for.cond4.preheader.us.us, !llvm.loop !21 if.then.us.us: ; preds = %for.body6.us.us %cond.i.us.us = tail call i64 @llvm.smin.i64(i64 %uh.087.us.us, i64 %add.us.us) br label %for.inc.us.us for.inc.us.us: ; preds = %if.then.us.us, %cleanup.us.us, %if.else.us.us %uh.279.us.us = phi i64 [ %uh.087.us.us, %cleanup.us.us ], [ %cond.i.us.us, %if.then.us.us ], [ %uh.087.us.us, %if.else.us.us ] %ul.278.us.us = phi i64 [ %ul.086.us.us, %cleanup.us.us ], [ %ul.086.us.us, %if.then.us.us ], [ %add13.us.us, %if.else.us.us ] %inc.us.us = add nuw i64 %ki.085.us.us, 1 %exitcond.not = icmp eq i64 %inc.us.us, %0 br i1 %exitcond.not, label %for.end.us.us, label %for.body6.us.us, !llvm.loop !22 for.inc35.split.us.us: ; preds = %for.inc32.us.us %inc36.us = add nuw nsw i64 %i.0105.us, 1 %exitcond118.not = icmp eq i64 %inc36.us, 101 br i1 %exitcond118.not, label %cleanup40, label %for.cond1.preheader.us, !llvm.loop !23 if.then25: ; preds = %for.end.us.us, %entry %.us-phi = phi i64 [ 0, %entry ], [ %i.0105.us, %for.end.us.us ] %.us-phi96 = phi i64 [ 0, %entry ], [ %j.095.us.us, %for.end.us.us ] %.us-phi97 = phi i64 [ 0, %entry ], [ %ul.0.lcssa.us.us, %for.end.us.us ] %call26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.us-phi, i64 noundef %.us-phi96, i64 noundef %.us-phi97) br label %cleanup40 cleanup40: ; preds = %for.inc35.split.us.us, %if.then25 ret i64 0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #6 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m) %0 = load i64, ptr @n, align 8, !tbaa !8 %cmp17.not = icmp eq i64 %0, 0 br i1 %cmp17.not, label %if.then25.i, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %indvars.iv %call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx) %arrayidx4 = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %indvars.iv %call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx4) %arrayidx7 = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %indvars.iv %call8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx7) %indvars.iv.next = add nuw i64 %indvars.iv, 1 %1 = load i64, ptr @n, align 8, !tbaa !8 %cmp = icmp ugt i64 %1, %indvars.iv.next br i1 %cmp, label %for.body, label %for.end, !llvm.loop !24 for.end: ; preds = %for.body %cmp584.not.i = icmp eq i64 %1, 0 br i1 %cmp584.not.i, label %if.then25.i, label %for.cond1.preheader.us.i for.cond1.preheader.us.i: ; preds = %for.end, %for.inc35.split.us.us.i %i.0105.us.i = phi i64 [ %inc36.us.i, %for.inc35.split.us.us.i ], [ 0, %for.end ] br label %for.cond4.preheader.us.us.i for.cond4.preheader.us.us.i: ; preds = %for.inc32.us.us.i, %for.cond1.preheader.us.i %j.095.us.us.i = phi i64 [ 0, %for.cond1.preheader.us.i ], [ %inc33.us.us.i, %for.inc32.us.us.i ] br label %for.body6.us.us.i for.body6.us.us.i: ; preds = %for.inc.us.us.i, %for.cond4.preheader.us.us.i %uh.087.us.us.i = phi i64 [ 2000000000000007, %for.cond4.preheader.us.us.i ], [ %uh.279.us.us.i, %for.inc.us.us.i ] %ul.086.us.us.i = phi i64 [ 0, %for.cond4.preheader.us.us.i ], [ %ul.278.us.us.i, %for.inc.us.us.i ] %ki.085.us.us.i = phi i64 [ 0, %for.cond4.preheader.us.us.i ], [ %inc.us.us.i, %for.inc.us.us.i ] %arrayidx.us.us.i = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %ki.085.us.us.i %2 = load i64, ptr %arrayidx.us.us.i, align 8, !tbaa !8 %sub.i.us.us.i = sub nsw i64 %i.0105.us.i, %2 %retval.0.i.us.us.i = tail call i64 @llvm.abs.i64(i64 %sub.i.us.us.i, i1 true) %arrayidx7.us.us.i = getelementptr inbounds [1000000 x i64], ptr @b, i64 0, i64 %ki.085.us.us.i %3 = load i64, ptr %arrayidx7.us.us.i, align 8, !tbaa !8 %sub.i72.us.us.i = sub nsw i64 %j.095.us.us.i, %3 %retval.0.i73.us.us.i = tail call i64 @llvm.abs.i64(i64 %sub.i72.us.us.i, i1 true) %add.us.us.i = add nuw nsw i64 %retval.0.i73.us.us.i, %retval.0.i.us.us.i %arrayidx9.us.us.i = getelementptr inbounds [1000000 x i64], ptr @c, i64 0, i64 %ki.085.us.us.i %4 = load i64, ptr %arrayidx9.us.us.i, align 8, !tbaa !8 %tobool.not.us.us.i = icmp eq i64 %4, 0 br i1 %tobool.not.us.us.i, label %if.then.us.us.i, label %if.else.us.us.i if.else.us.us.i: ; preds = %for.body6.us.us.i %tobool11.not.not.us.us.i = icmp eq i64 %ul.086.us.us.i, 0 %add13.us.us.i = add i64 %add.us.us.i, %4 br i1 %tobool11.not.not.us.us.i, label %for.inc.us.us.i, label %cleanup.us.us.i cleanup.us.us.i: ; preds = %if.else.us.us.i %cmp14.not.not.us.us.i = icmp eq i64 %ul.086.us.us.i, %add13.us.us.i br i1 %cmp14.not.not.us.us.i, label %for.inc.us.us.i, label %for.end.us.us.i for.end.us.us.i: ; preds = %for.inc.us.us.i, %cleanup.us.us.i %ki.0.lcssa.us.us.i = phi i64 [ %ki.085.us.us.i, %cleanup.us.us.i ], [ %1, %for.inc.us.us.i ] %ul.0.lcssa.us.us.i = phi i64 [ %ul.086.us.us.i, %cleanup.us.us.i ], [ %ul.278.us.us.i, %for.inc.us.us.i ] %uh.0.lcssa.us.us.i = phi i64 [ %uh.087.us.us.i, %cleanup.us.us.i ], [ %uh.279.us.us.i, %for.inc.us.us.i ] %cmp22.us.us.i = icmp ne i64 %ki.0.lcssa.us.us.i, %1 %cmp24.not.us.us.i = icmp ugt i64 %ul.0.lcssa.us.us.i, %uh.0.lcssa.us.us.i %or.cond71.us.us.i = select i1 %cmp22.us.us.i, i1 true, i1 %cmp24.not.us.us.i br i1 %or.cond71.us.us.i, label %for.inc32.us.us.i, label %if.then25.i for.inc32.us.us.i: ; preds = %for.end.us.us.i %inc33.us.us.i = add nuw nsw i64 %j.095.us.us.i, 1 %exitcond117.not.i = icmp eq i64 %inc33.us.us.i, 101 br i1 %exitcond117.not.i, label %for.inc35.split.us.us.i, label %for.cond4.preheader.us.us.i, !llvm.loop !21 if.then.us.us.i: ; preds = %for.body6.us.us.i %cond.i.us.us.i = tail call i64 @llvm.smin.i64(i64 %uh.087.us.us.i, i64 %add.us.us.i) br label %for.inc.us.us.i for.inc.us.us.i: ; preds = %if.then.us.us.i, %cleanup.us.us.i, %if.else.us.us.i %uh.279.us.us.i = phi i64 [ %uh.087.us.us.i, %cleanup.us.us.i ], [ %cond.i.us.us.i, %if.then.us.us.i ], [ %uh.087.us.us.i, %if.else.us.us.i ] %ul.278.us.us.i = phi i64 [ %ul.086.us.us.i, %cleanup.us.us.i ], [ %ul.086.us.us.i, %if.then.us.us.i ], [ %add13.us.us.i, %if.else.us.us.i ] %inc.us.us.i = add nuw i64 %ki.085.us.us.i, 1 %exitcond.not.i = icmp eq i64 %inc.us.us.i, %1 br i1 %exitcond.not.i, label %for.end.us.us.i, label %for.body6.us.us.i, !llvm.loop !22 for.inc35.split.us.us.i: ; preds = %for.inc32.us.us.i %inc36.us.i = add nuw nsw i64 %i.0105.us.i, 1 %exitcond118.not.i = icmp eq i64 %inc36.us.i, 101 br i1 %exitcond118.not.i, label %solve.exit, label %for.cond1.preheader.us.i, !llvm.loop !23 if.then25.i: ; preds = %for.end.us.us.i, %entry, %for.end %.us-phi.i = phi i64 [ 0, %for.end ], [ 0, %entry ], [ %i.0105.us.i, %for.end.us.us.i ] %.us-phi96.i = phi i64 [ 0, %for.end ], [ 0, %entry ], [ %j.095.us.us.i, %for.end.us.us.i ] %.us-phi97.i = phi i64 [ 0, %for.end ], [ 0, %entry ], [ %ul.0.lcssa.us.us.i, %for.end.us.us.i ] %call26.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.us-phi.i, i64 noundef %.us-phi96.i, i64 noundef %.us-phi97.i) br label %solve.exit solve.exit: ; preds = %for.inc35.split.us.us.i, %if.then25.i ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umin.i64(i64, i64) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umax.i64(i64, i64) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #8 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 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 #2 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(read, 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #9 = { 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 = distinct !{!5, !6} !6 = !{!"llvm.loop.mustprogress"} !7 = distinct !{!7, !6} !8 = !{!9, !9, i64 0} !9 = !{!"long", !10, i64 0} !10 = !{!"omnipotent char", !11, i64 0} !11 = !{!"Simple C/C++ TBAA"} !12 = !{!10, !10, i64 0} !13 = !{!14, !14, i64 0} !14 = !{!"double", !10, i64 0} !15 = !{!16, !16, i64 0} !16 = !{!"any pointer", !10, i64 0} !17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8} !18 = !{i64 0, i64 8, !8} !19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8} !20 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !8} !21 = distinct !{!21, !6} !22 = distinct !{!22, !6} !23 = distinct !{!23, !6} !24 = distinct !{!24, !6}
#include <stdio.h> #include<math.h> int main () { int a,b,c,d,e,f,g; scanf("%d%d%d%d",&a,&b,&c,&d); if(a>b) e=a-b; else e=b-a; if(b>c) f=b-c; else f=c-b; if(c>a) g=c-a; else g=a-c; if((e<=d&&f<=d)||g<=d) printf("Yes\n"); else printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181249/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181249/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 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"Yes\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 %d = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #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 %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 %e.0 = call i32 @llvm.abs.i32(i32 %sub, i1 true) %2 = load i32, ptr %c, align 4, !tbaa !5 %sub4 = sub nsw i32 %1, %2 %f.0 = call i32 @llvm.abs.i32(i32 %sub4, i1 true) %sub10 = sub nsw i32 %2, %0 %g.0 = call i32 @llvm.abs.i32(i32 %sub10, i1 true) %3 = load i32, ptr %d, align 4 %cmp14.not = icmp sgt i32 %e.0, %3 %cmp15.not = icmp sgt i32 %f.0, %3 %or.cond = select i1 %cmp14.not, i1 true, i1 %cmp15.not %cmp16.not = icmp sgt i32 %g.0, %3 %or.cond34 = select i1 %or.cond, i1 %cmp16.not, i1 false %str.str.3 = select i1 %or.cond34, ptr @str, ptr @str.3 %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, 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: 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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, 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 nounwind } 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"}
#include <stdio.h> #include <stdlib.h> int main() { int a[4]; int i; int sum; int flag=0; while(EOF != scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])) { sum=a[0]+a[1]+a[2]+a[3]; //printf("%d\n",sum); for(i=0; i<4; i++) { if(a[i]==sum-a[i]) { //printf("YES\n"); flag = 1; } } if(a[0]+a[1]==a[2]+a[3]||a[0]+a[2]==a[1]+a[3]||a[0]+a[3]==a[1]+a[2]) { //printf("YES\n"); flag =1; } if(flag==1) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1813/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1813/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 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [4 x i32], align 16 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #4 %arrayidx1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1 %arrayidx2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2 %arrayidx3 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3 %call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3) %cmp.not55 = icmp eq i32 %call54, -1 br i1 %cmp.not55, label %while.end, label %while.body while.body: ; preds = %entry, %if.end43 %flag.056 = phi i32 [ %flag.350, %if.end43 ], [ 0, %entry ] %0 = load i32, ptr %a, align 16, !tbaa !5 %1 = load i32, ptr %arrayidx1, align 4, !tbaa !5 %add = add nsw i32 %1, %0 %2 = load i32, ptr %arrayidx2, align 8, !tbaa !5 %3 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %add7 = add i32 %3, %2 %add9 = add i32 %add7, %add %sub = sub i32 %add9, %0 %cmp14 = icmp eq i32 %0, %sub %sub.1 = sub i32 %add9, %1 %cmp14.1 = icmp eq i32 %1, %sub.1 %4 = or i1 %cmp14.1, %cmp14 %sub.2 = sub i32 %add9, %2 %cmp14.2 = icmp eq i32 %2, %sub.2 %5 = or i1 %cmp14.2, %4 %sub.3 = sub i32 %add9, %3 %cmp14.3 = icmp eq i32 %3, %sub.3 %6 = or i1 %cmp14.3, %5 %cmp21 = icmp eq i32 %add, %add7 br i1 %cmp21, label %if.end43, label %lor.lhs.false lor.lhs.false: ; preds = %while.body %add24 = add nsw i32 %2, %0 %add27 = add nsw i32 %3, %1 %cmp28 = icmp eq i32 %add24, %add27 br i1 %cmp28, label %if.end43, label %lor.lhs.false29 lor.lhs.false29: ; preds = %lor.lhs.false %add32 = add nsw i32 %3, %0 %add35 = add nsw i32 %2, %1 %cmp36 = icmp eq i32 %add32, %add35 %cmp3959 = icmp eq i32 %flag.056, 1 %7 = or i1 %cmp36, %6 %or.cond = select i1 %7, i1 true, i1 %cmp3959 %spec.select = select i1 %or.cond, ptr @str.3, ptr @str %spec.select58 = select i1 %or.cond, i32 1, i32 %flag.056 br label %if.end43 if.end43: ; preds = %lor.lhs.false29, %while.body, %lor.lhs.false %str.sink = phi ptr [ @str.3, %lor.lhs.false ], [ @str.3, %while.body ], [ %spec.select, %lor.lhs.false29 ] %flag.350 = phi i32 [ 1, %lor.lhs.false ], [ 1, %while.body ], [ %spec.select58, %lor.lhs.false29 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end43, %entry call void @llvm.lifetime.end.p0(i64 16, 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: 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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> int main(void){ int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d); if(a>=c){ if(a-c<=d||(a-b<=d&&b-c<=d))printf("Yes\n"); else printf("No\n"); } if(c>a){ if(c-a<=d||(c-b<=d&&b-a<=d))printf("Yes\n"); else printf("No\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181342/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181342/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.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.5 = private unnamed_addr constant [4 x i8] c"Yes\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 %d = 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 %d) #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 %d) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %c, align 4, !tbaa !5 %cmp.not = icmp slt i32 %0, %1 br i1 %cmp.not, label %if.end9, label %if.then if.then: ; preds = %entry %sub = sub nsw i32 %0, %1 %2 = load i32, ptr %d, align 4, !tbaa !5 %cmp1.not = icmp sgt i32 %sub, %2 br i1 %cmp1.not, label %lor.lhs.false, label %if.end9.sink.split lor.lhs.false: ; preds = %if.then %3 = load i32, ptr %b, align 4, !tbaa !5 %sub2 = sub nsw i32 %0, %3 %cmp3.not = icmp sgt i32 %sub2, %2 %sub4 = sub nsw i32 %3, %1 %cmp5.not = icmp sgt i32 %sub4, %2 %or.cond = select i1 %cmp3.not, i1 true, i1 %cmp5.not %spec.select = select i1 %or.cond, ptr @str.4, ptr @str.5 br label %if.end9.sink.split if.end9.sink.split: ; preds = %lor.lhs.false, %if.then %str.3.sink = phi ptr [ @str.5, %if.then ], [ %spec.select, %lor.lhs.false ] %puts31 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) br label %if.end9 if.end9: ; preds = %if.end9.sink.split, %entry %4 = load i32, ptr %c, align 4, !tbaa !5 %5 = load i32, ptr %a, align 4, !tbaa !5 %cmp10 = icmp sgt i32 %4, %5 br i1 %cmp10, label %if.then11, label %if.end25 if.then11: ; preds = %if.end9 %sub12 = sub nsw i32 %4, %5 %6 = load i32, ptr %d, align 4, !tbaa !5 %cmp13.not = icmp sgt i32 %sub12, %6 br i1 %cmp13.not, label %lor.lhs.false14, label %if.end25.sink.split lor.lhs.false14: ; preds = %if.then11 %7 = load i32, ptr %b, align 4, !tbaa !5 %sub15 = sub nsw i32 %4, %7 %cmp16.not = icmp sgt i32 %sub15, %6 %sub18 = sub nsw i32 %7, %5 %cmp19.not = icmp sgt i32 %sub18, %6 %or.cond34 = select i1 %cmp16.not, i1 true, i1 %cmp19.not %spec.select35 = select i1 %or.cond34, ptr @str.4, ptr @str.5 br label %if.end25.sink.split if.end25.sink.split: ; preds = %lor.lhs.false14, %if.then11 %str.5.sink = phi ptr [ @str.5, %if.then11 ], [ %spec.select35, %lor.lhs.false14 ] %puts33 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink) br label %if.end25 if.end25: ; preds = %if.end25.sink.split, %if.end9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #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: 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"}
#include <stdio.h> #include <stdlib.h> int main(void) { int a , b, c, d ; scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); scanf("%d", &d); if(abs(a - c) <= d ) { printf("Yes"); } else if (abs(a - b) <= d ) { if (abs(b - c) <= d ) { printf("Yes"); } else { printf("No"); } } else { printf("No"); } return 0 ; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181407/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181407/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"Yes\00", align 1 @.str.2 = 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: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = 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 %d) #4 %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 %d) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %c, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 %2 = call i32 @llvm.abs.i32(i32 %sub, i1 true) %3 = load i32, ptr %d, align 4, !tbaa !5 %cmp.not = icmp sgt i32 %2, %3 br i1 %cmp.not, label %if.else, label %if.end17 if.else: ; preds = %entry %4 = load i32, ptr %b, align 4, !tbaa !5 %sub5 = sub nsw i32 %0, %4 %5 = call i32 @llvm.abs.i32(i32 %sub5, i1 true) %cmp6.not = icmp sgt i32 %5, %3 br i1 %cmp6.not, label %if.end17, label %if.then7 if.then7: ; preds = %if.else %sub8 = sub nsw i32 %4, %1 %6 = call i32 @llvm.abs.i32(i32 %sub8, i1 true) %cmp9.not = icmp sgt i32 %6, %3 %.str.2..str.1 = select i1 %cmp9.not, ptr @.str.2, ptr @.str.1 br label %if.end17 if.end17: ; preds = %if.else, %if.then7, %entry %.str.2.sink = phi ptr [ @.str.1, %entry ], [ %.str.2..str.1, %if.then7 ], [ @.str.2, %if.else ] %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #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 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 t; scanf("%d",&t); while(t--){ int a,b,c,d,k; scanf("%d %d %d %d %d ",&a,&b,&c,&d,&k); int x,y; if(a%c ==0){ x = a/c; }else{ x = a/c +1; } if(b%d ==0){ y = b/d; }else{ y = b/d +1; } int z; z = x+y; if(z>k){ printf("-1\n"); }else{ printf("%d %d\n",x,y); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18148/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18148/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 [16 x i8] c"%d %d %d %d %d \00", align 1 @.str.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @str = 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: %t = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec20 = add nsw i32 %0, -1 store i32 %dec20, ptr %t, align 4, !tbaa !5 %tobool.not21 = icmp eq i32 %0, 0 br i1 %tobool.not21, label %while.end, label %while.body while.body: ; preds = %entry, %if.end17 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 %d) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %k) %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %rem = srem i32 %1, %2 %cmp = icmp ne i32 %rem, 0 %div = sdiv i32 %1, %2 %add = zext i1 %cmp to i32 %x.0 = add nsw i32 %div, %add %3 = load i32, ptr %b, align 4, !tbaa !5 %4 = load i32, ptr %d, align 4, !tbaa !5 %rem3 = srem i32 %3, %4 %cmp4 = icmp ne i32 %rem3, 0 %div6 = sdiv i32 %3, %4 %add9 = zext i1 %cmp4 to i32 %y.0 = add nsw i32 %div6, %add9 %add11 = add nsw i32 %y.0, %x.0 %5 = load i32, ptr %k, align 4, !tbaa !5 %cmp12 = icmp sgt i32 %add11, %5 br i1 %cmp12, label %if.then13, label %if.else15 if.then13: ; preds = %while.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end17 if.else15: ; preds = %while.body %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %x.0, i32 noundef %y.0) br label %if.end17 if.end17: ; preds = %if.else15, %if.then13 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #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 %6 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end17, %entry 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: 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 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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<math.h> int main(){ int a,b,c,d,k,t,x,y; scanf("%d",&t); for(int i=0;i<t;++i){ scanf("%d%d%d%d%d",&a,&b,&c,&d,&k); x=(int)ceil((double)a/c); y=(int)ceil((double)b/d); if(x+y<=k) printf("%d %d\n",x,y); else printf("-1\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18153/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18153/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 [11 x i8] c"%d%d%d%d%d\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @str = 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: %a = alloca i32, align 4 %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 %k = alloca i32, align 4 %t = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp15 = icmp sgt i32 %0, 0 br i1 %cmp15, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.inc, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5 ret i32 0 for.body: ; preds = %entry, %for.inc %i.016 = phi i32 [ %inc, %for.inc ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %k) %1 = load i32, ptr %a, align 4, !tbaa !5 %2 = load i32, ptr %c, align 4, !tbaa !5 %3 = load i32, ptr %b, align 4, !tbaa !5 %4 = load i32, ptr %d, align 4, !tbaa !5 %5 = insertelement <2 x i32> poison, i32 %3, i64 0 %6 = insertelement <2 x i32> %5, i32 %1, i64 1 %7 = sitofp <2 x i32> %6 to <2 x double> %8 = insertelement <2 x i32> poison, i32 %4, i64 0 %9 = insertelement <2 x i32> %8, i32 %2, i64 1 %10 = sitofp <2 x i32> %9 to <2 x double> %11 = fdiv <2 x double> %7, %10 %12 = call <2 x double> @llvm.ceil.v2f64(<2 x double> %11) %13 = fptosi <2 x double> %12 to <2 x i32> %14 = extractelement <2 x i32> %13, i64 0 %15 = extractelement <2 x i32> %13, i64 1 %add = add nsw i32 %14, %15 %16 = load i32, ptr %k, align 4, !tbaa !5 %cmp8.not = icmp sgt i32 %add, %16 br i1 %cmp8.not, label %if.else, label %if.then if.then: ; preds = %for.body %call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15, i32 noundef %14) br label %for.inc if.else: ; preds = %for.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %for.inc for.inc: ; preds = %if.then, %if.else %inc = add nuw nsw i32 %i.016, 1 %17 = load i32, ptr %t, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %17 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: 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 declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <2 x double> @llvm.ceil.v2f64(<2 x double>) #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 nounwind } 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"}
/*??°???????????????(Unique number)*/ #include <stdio.h> int main(){ int i, k, l, x, N; int data[200][3]; int sum[200] = {0}; scanf("%d", &N); for (i = 0; i < N; i++) { for (k = 0; k < 3; k++) { scanf("%d", &data[i][k]); } } for (i = 0; i < N; i++) { for (k = 0; k < 3; k++) { x = 0; for (l = 0; l < N; l++) { if (data[i][k] == data[l][k] && i != l) { x++; } } if (x == 0) { sum[i] += data[i][k]; } } } for (i = 0; i < N; i++) { printf("%d\n", sum[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181573/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181573/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 %data = alloca [200 x [3 x i32]], align 16 %sum = alloca [200 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5 call void @llvm.lifetime.start.p0(i64 2400, ptr nonnull %data) #5 call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %sum) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %sum, i8 0, i64 800, 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 %cmp80 = icmp sgt i32 %0, 0 br i1 %cmp80, label %for.cond1.preheader, label %for.end56 for.cond1.preheader: ; preds = %entry, %for.cond1.preheader %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ] %arrayidx5 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv, i64 0 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5) %arrayidx5.1 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv, i64 1 %call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1) %arrayidx5.2 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv, i64 2 %call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2) %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.cond1.preheader, label %for.cond10.preheader, !llvm.loop !9 for.cond10.preheader: ; preds = %for.cond1.preheader %cmp1188 = icmp sgt i32 %1, 0 br i1 %cmp1188, label %for.cond13.preheader.us.preheader, label %for.end56 for.cond13.preheader.us.preheader: ; preds = %for.cond10.preheader %wide.trip.count105 = zext i32 %1 to i64 %min.iters.check141 = icmp ult i32 %1, 9 %n.mod.vf143 = and i64 %wide.trip.count105, 7 %3 = icmp eq i64 %n.mod.vf143, 0 %4 = select i1 %3, i64 8, i64 %n.mod.vf143 %n.vec144 = sub nsw i64 %wide.trip.count105, %4 %min.iters.check119 = icmp ult i32 %1, 9 %n.mod.vf121 = and i64 %wide.trip.count105, 7 %5 = icmp eq i64 %n.mod.vf121, 0 %6 = select i1 %5, i64 8, i64 %n.mod.vf121 %n.vec122 = sub nsw i64 %wide.trip.count105, %6 %min.iters.check = icmp ult i32 %1, 9 %n.mod.vf = and i64 %wide.trip.count105, 7 %7 = icmp eq i64 %n.mod.vf, 0 %8 = select i1 %7, i64 8, i64 %n.mod.vf %n.vec = sub nsw i64 %wide.trip.count105, %8 br label %for.cond13.preheader.us for.cond13.preheader.us: ; preds = %for.cond13.preheader.us.preheader, %for.inc42.us.us.2 %indvars.iv102 = phi i64 [ 0, %for.cond13.preheader.us.preheader ], [ %indvars.iv.next103, %for.inc42.us.us.2 ] %arrayidx40.us = getelementptr inbounds [200 x i32], ptr %sum, i64 0, i64 %indvars.iv102 %arrayidx22.us.us = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv102, i64 0 %9 = load i32, ptr %arrayidx22.us.us, align 4, !tbaa !5 br i1 %min.iters.check141, label %for.body18.us.us.preheader, label %vector.ph142 vector.ph142: ; preds = %for.cond13.preheader.us %broadcast.splatinsert154 = insertelement <4 x i32> poison, i32 %9, i64 0 %broadcast.splat155 = shufflevector <4 x i32> %broadcast.splatinsert154, <4 x i32> poison, <4 x i32> zeroinitializer %broadcast.splatinsert156 = insertelement <4 x i64> poison, i64 %indvars.iv102, i64 0 %broadcast.splat157 = shufflevector <4 x i64> %broadcast.splatinsert156, <4 x i64> poison, <4 x i32> zeroinitializer br label %vector.body146 vector.body146: ; preds = %vector.body146, %vector.ph142 %index147 = phi i64 [ 0, %vector.ph142 ], [ %index.next158, %vector.body146 ] %vec.ind148 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph142 ], [ %vec.ind.next151, %vector.body146 ] %vec.phi152 = phi <4 x i32> [ zeroinitializer, %vector.ph142 ], [ %49, %vector.body146 ] %vec.phi153 = phi <4 x i32> [ zeroinitializer, %vector.ph142 ], [ %50, %vector.body146 ] %step.add149 = add <4 x i64> %vec.ind148, <i64 4, i64 4, i64 4, i64 4> %10 = or i64 %index147, 1 %11 = or i64 %index147, 2 %12 = or i64 %index147, 3 %13 = or i64 %index147, 4 %14 = or i64 %index147, 5 %15 = or i64 %index147, 6 %16 = or i64 %index147, 7 %17 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %index147, i64 0 %18 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %10, i64 0 %19 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %11, i64 0 %20 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %12, i64 0 %21 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %13, i64 0 %22 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %14, i64 0 %23 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %15, i64 0 %24 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %16, i64 0 %25 = load i32, ptr %17, align 16, !tbaa !5 %26 = load i32, ptr %18, align 4, !tbaa !5 %27 = load i32, ptr %19, align 8, !tbaa !5 %28 = load i32, ptr %20, align 4, !tbaa !5 %29 = insertelement <4 x i32> poison, i32 %25, i64 0 %30 = insertelement <4 x i32> %29, i32 %26, i64 1 %31 = insertelement <4 x i32> %30, i32 %27, i64 2 %32 = insertelement <4 x i32> %31, i32 %28, i64 3 %33 = load i32, ptr %21, align 16, !tbaa !5 %34 = load i32, ptr %22, align 4, !tbaa !5 %35 = load i32, ptr %23, align 8, !tbaa !5 %36 = load i32, ptr %24, align 4, !tbaa !5 %37 = insertelement <4 x i32> poison, i32 %33, i64 0 %38 = insertelement <4 x i32> %37, i32 %34, i64 1 %39 = insertelement <4 x i32> %38, i32 %35, i64 2 %40 = insertelement <4 x i32> %39, i32 %36, i64 3 %41 = icmp eq <4 x i32> %broadcast.splat155, %32 %42 = icmp eq <4 x i32> %broadcast.splat155, %40 %43 = icmp ne <4 x i64> %broadcast.splat157, %vec.ind148 %44 = icmp ne <4 x i64> %broadcast.splat157, %step.add149 %45 = and <4 x i1> %43, %41 %46 = and <4 x i1> %44, %42 %47 = zext <4 x i1> %45 to <4 x i32> %48 = zext <4 x i1> %46 to <4 x i32> %49 = add <4 x i32> %vec.phi152, %47 %50 = add <4 x i32> %vec.phi153, %48 %index.next158 = add nuw i64 %index147, 8 %vec.ind.next151 = add <4 x i64> %vec.ind148, <i64 8, i64 8, i64 8, i64 8> %51 = icmp eq i64 %index.next158, %n.vec144 br i1 %51, label %middle.block139, label %vector.body146, !llvm.loop !11 middle.block139: ; preds = %vector.body146 %bin.rdx159 = add <4 x i32> %50, %49 %52 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx159) br label %for.body18.us.us.preheader for.body18.us.us.preheader: ; preds = %for.cond13.preheader.us, %middle.block139 %indvars.iv95.ph = phi i64 [ 0, %for.cond13.preheader.us ], [ %n.vec144, %middle.block139 ] %x.084.us.us.ph = phi i32 [ 0, %for.cond13.preheader.us ], [ %52, %middle.block139 ] br label %for.body18.us.us if.then34.us.us: ; preds = %for.cond16.for.end32_crit_edge.us.us %53 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us.us = add nsw i32 %53, %9 store i32 %add.us.us, ptr %arrayidx40.us, align 4, !tbaa !5 br label %for.inc42.us.us for.inc42.us.us: ; preds = %for.cond16.for.end32_crit_edge.us.us, %if.then34.us.us %arrayidx22.us.us.1 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv102, i64 1 %54 = load i32, ptr %arrayidx22.us.us.1, align 4, !tbaa !5 br i1 %min.iters.check119, label %for.body18.us.us.1.preheader, label %vector.ph120 vector.ph120: ; preds = %for.inc42.us.us %broadcast.splatinsert132 = insertelement <4 x i32> poison, i32 %54, i64 0 %broadcast.splat133 = shufflevector <4 x i32> %broadcast.splatinsert132, <4 x i32> poison, <4 x i32> zeroinitializer %broadcast.splatinsert134 = insertelement <4 x i64> poison, i64 %indvars.iv102, i64 0 %broadcast.splat135 = shufflevector <4 x i64> %broadcast.splatinsert134, <4 x i64> poison, <4 x i32> zeroinitializer br label %vector.body124 vector.body124: ; preds = %vector.body124, %vector.ph120 %index125 = phi i64 [ 0, %vector.ph120 ], [ %index.next136, %vector.body124 ] %vec.ind126 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph120 ], [ %vec.ind.next129, %vector.body124 ] %vec.phi130 = phi <4 x i32> [ zeroinitializer, %vector.ph120 ], [ %94, %vector.body124 ] %vec.phi131 = phi <4 x i32> [ zeroinitializer, %vector.ph120 ], [ %95, %vector.body124 ] %step.add127 = add <4 x i64> %vec.ind126, <i64 4, i64 4, i64 4, i64 4> %55 = or i64 %index125, 1 %56 = or i64 %index125, 2 %57 = or i64 %index125, 3 %58 = or i64 %index125, 4 %59 = or i64 %index125, 5 %60 = or i64 %index125, 6 %61 = or i64 %index125, 7 %62 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %index125, i64 1 %63 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %55, i64 1 %64 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %56, i64 1 %65 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %57, i64 1 %66 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %58, i64 1 %67 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %59, i64 1 %68 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %60, i64 1 %69 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %61, i64 1 %70 = load i32, ptr %62, align 4, !tbaa !5 %71 = load i32, ptr %63, align 16, !tbaa !5 %72 = load i32, ptr %64, align 4, !tbaa !5 %73 = load i32, ptr %65, align 8, !tbaa !5 %74 = insertelement <4 x i32> poison, i32 %70, i64 0 %75 = insertelement <4 x i32> %74, i32 %71, i64 1 %76 = insertelement <4 x i32> %75, i32 %72, i64 2 %77 = insertelement <4 x i32> %76, i32 %73, i64 3 %78 = load i32, ptr %66, align 4, !tbaa !5 %79 = load i32, ptr %67, align 16, !tbaa !5 %80 = load i32, ptr %68, align 4, !tbaa !5 %81 = load i32, ptr %69, align 8, !tbaa !5 %82 = insertelement <4 x i32> poison, i32 %78, i64 0 %83 = insertelement <4 x i32> %82, i32 %79, i64 1 %84 = insertelement <4 x i32> %83, i32 %80, i64 2 %85 = insertelement <4 x i32> %84, i32 %81, i64 3 %86 = icmp eq <4 x i32> %broadcast.splat133, %77 %87 = icmp eq <4 x i32> %broadcast.splat133, %85 %88 = icmp ne <4 x i64> %broadcast.splat135, %vec.ind126 %89 = icmp ne <4 x i64> %broadcast.splat135, %step.add127 %90 = and <4 x i1> %88, %86 %91 = and <4 x i1> %89, %87 %92 = zext <4 x i1> %90 to <4 x i32> %93 = zext <4 x i1> %91 to <4 x i32> %94 = add <4 x i32> %vec.phi130, %92 %95 = add <4 x i32> %vec.phi131, %93 %index.next136 = add nuw i64 %index125, 8 %vec.ind.next129 = add <4 x i64> %vec.ind126, <i64 8, i64 8, i64 8, i64 8> %96 = icmp eq i64 %index.next136, %n.vec122 br i1 %96, label %middle.block117, label %vector.body124, !llvm.loop !14 middle.block117: ; preds = %vector.body124 %bin.rdx137 = add <4 x i32> %95, %94 %97 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx137) br label %for.body18.us.us.1.preheader for.body18.us.us.1.preheader: ; preds = %for.inc42.us.us, %middle.block117 %indvars.iv95.1.ph = phi i64 [ 0, %for.inc42.us.us ], [ %n.vec122, %middle.block117 ] %x.084.us.us.1.ph = phi i32 [ 0, %for.inc42.us.us ], [ %97, %middle.block117 ] br label %for.body18.us.us.1 for.body18.us.us.1: ; preds = %for.body18.us.us.1.preheader, %for.body18.us.us.1 %indvars.iv95.1 = phi i64 [ %indvars.iv.next96.1, %for.body18.us.us.1 ], [ %indvars.iv95.1.ph, %for.body18.us.us.1.preheader ] %x.084.us.us.1 = phi i32 [ %x.1.us.us.1, %for.body18.us.us.1 ], [ %x.084.us.us.1.ph, %for.body18.us.us.1.preheader ] %arrayidx26.us.us.1 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv95.1, i64 1 %98 = load i32, ptr %arrayidx26.us.us.1, align 4, !tbaa !5 %cmp27.us.us.1 = icmp eq i32 %54, %98 %cmp28.not.us.us.1 = icmp ne i64 %indvars.iv102, %indvars.iv95.1 %or.cond.not.us.us.1 = and i1 %cmp28.not.us.us.1, %cmp27.us.us.1 %inc29.us.us.1 = zext i1 %or.cond.not.us.us.1 to i32 %x.1.us.us.1 = add nuw nsw i32 %x.084.us.us.1, %inc29.us.us.1 %indvars.iv.next96.1 = add nuw nsw i64 %indvars.iv95.1, 1 %exitcond.1.not = icmp eq i64 %indvars.iv.next96.1, %wide.trip.count105 br i1 %exitcond.1.not, label %for.cond16.for.end32_crit_edge.us.us.1, label %for.body18.us.us.1, !llvm.loop !15 for.cond16.for.end32_crit_edge.us.us.1: ; preds = %for.body18.us.us.1 %cmp33.us.us.1 = icmp eq i32 %x.1.us.us.1, 0 br i1 %cmp33.us.us.1, label %if.then34.us.us.1, label %for.inc42.us.us.1 if.then34.us.us.1: ; preds = %for.cond16.for.end32_crit_edge.us.us.1 %99 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us.us.1 = add nsw i32 %99, %54 store i32 %add.us.us.1, ptr %arrayidx40.us, align 4, !tbaa !5 br label %for.inc42.us.us.1 for.inc42.us.us.1: ; preds = %if.then34.us.us.1, %for.cond16.for.end32_crit_edge.us.us.1 %arrayidx22.us.us.2 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv102, i64 2 %100 = load i32, ptr %arrayidx22.us.us.2, align 4, !tbaa !5 br i1 %min.iters.check, label %for.body18.us.us.2.preheader, label %vector.ph vector.ph: ; preds = %for.inc42.us.us.1 %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %100, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer %broadcast.splatinsert115 = insertelement <4 x i64> poison, i64 %indvars.iv102, i64 0 %broadcast.splat116 = shufflevector <4 x i64> %broadcast.splatinsert115, <4 x i64> 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.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %140, %vector.body ] %vec.phi114 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %141, %vector.body ] %step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4> %101 = or i64 %index, 1 %102 = or i64 %index, 2 %103 = or i64 %index, 3 %104 = or i64 %index, 4 %105 = or i64 %index, 5 %106 = or i64 %index, 6 %107 = or i64 %index, 7 %108 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %index, i64 2 %109 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %101, i64 2 %110 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %102, i64 2 %111 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %103, i64 2 %112 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %104, i64 2 %113 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %105, i64 2 %114 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %106, i64 2 %115 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %107, i64 2 %116 = load i32, ptr %108, align 8, !tbaa !5 %117 = load i32, ptr %109, align 4, !tbaa !5 %118 = load i32, ptr %110, align 16, !tbaa !5 %119 = load i32, ptr %111, align 4, !tbaa !5 %120 = insertelement <4 x i32> poison, i32 %116, i64 0 %121 = insertelement <4 x i32> %120, i32 %117, i64 1 %122 = insertelement <4 x i32> %121, i32 %118, i64 2 %123 = insertelement <4 x i32> %122, i32 %119, i64 3 %124 = load i32, ptr %112, align 8, !tbaa !5 %125 = load i32, ptr %113, align 4, !tbaa !5 %126 = load i32, ptr %114, align 16, !tbaa !5 %127 = load i32, ptr %115, align 4, !tbaa !5 %128 = insertelement <4 x i32> poison, i32 %124, i64 0 %129 = insertelement <4 x i32> %128, i32 %125, i64 1 %130 = insertelement <4 x i32> %129, i32 %126, i64 2 %131 = insertelement <4 x i32> %130, i32 %127, i64 3 %132 = icmp eq <4 x i32> %broadcast.splat, %123 %133 = icmp eq <4 x i32> %broadcast.splat, %131 %134 = icmp ne <4 x i64> %broadcast.splat116, %vec.ind %135 = icmp ne <4 x i64> %broadcast.splat116, %step.add %136 = and <4 x i1> %134, %132 %137 = and <4 x i1> %135, %133 %138 = zext <4 x i1> %136 to <4 x i32> %139 = zext <4 x i1> %137 to <4 x i32> %140 = add <4 x i32> %vec.phi, %138 %141 = add <4 x i32> %vec.phi114, %139 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8> %142 = icmp eq i64 %index.next, %n.vec br i1 %142, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %141, %140 %143 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) br label %for.body18.us.us.2.preheader for.body18.us.us.2.preheader: ; preds = %for.inc42.us.us.1, %middle.block %indvars.iv95.2.ph = phi i64 [ 0, %for.inc42.us.us.1 ], [ %n.vec, %middle.block ] %x.084.us.us.2.ph = phi i32 [ 0, %for.inc42.us.us.1 ], [ %143, %middle.block ] br label %for.body18.us.us.2 for.body18.us.us.2: ; preds = %for.body18.us.us.2.preheader, %for.body18.us.us.2 %indvars.iv95.2 = phi i64 [ %indvars.iv.next96.2, %for.body18.us.us.2 ], [ %indvars.iv95.2.ph, %for.body18.us.us.2.preheader ] %x.084.us.us.2 = phi i32 [ %x.1.us.us.2, %for.body18.us.us.2 ], [ %x.084.us.us.2.ph, %for.body18.us.us.2.preheader ] %arrayidx26.us.us.2 = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv95.2, i64 2 %144 = load i32, ptr %arrayidx26.us.us.2, align 4, !tbaa !5 %cmp27.us.us.2 = icmp eq i32 %100, %144 %cmp28.not.us.us.2 = icmp ne i64 %indvars.iv102, %indvars.iv95.2 %or.cond.not.us.us.2 = and i1 %cmp28.not.us.us.2, %cmp27.us.us.2 %inc29.us.us.2 = zext i1 %or.cond.not.us.us.2 to i32 %x.1.us.us.2 = add nuw nsw i32 %x.084.us.us.2, %inc29.us.us.2 %indvars.iv.next96.2 = add nuw nsw i64 %indvars.iv95.2, 1 %exitcond.2.not = icmp eq i64 %indvars.iv.next96.2, %wide.trip.count105 br i1 %exitcond.2.not, label %for.cond16.for.end32_crit_edge.us.us.2, label %for.body18.us.us.2, !llvm.loop !17 for.cond16.for.end32_crit_edge.us.us.2: ; preds = %for.body18.us.us.2 %cmp33.us.us.2 = icmp eq i32 %x.1.us.us.2, 0 br i1 %cmp33.us.us.2, label %if.then34.us.us.2, label %for.inc42.us.us.2 if.then34.us.us.2: ; preds = %for.cond16.for.end32_crit_edge.us.us.2 %145 = load i32, ptr %arrayidx40.us, align 4, !tbaa !5 %add.us.us.2 = add nsw i32 %145, %100 store i32 %add.us.us.2, ptr %arrayidx40.us, align 4, !tbaa !5 br label %for.inc42.us.us.2 for.inc42.us.us.2: ; preds = %if.then34.us.us.2, %for.cond16.for.end32_crit_edge.us.us.2 %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1 %exitcond106.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count105 br i1 %exitcond106.not, label %for.cond48.preheader, label %for.cond13.preheader.us, !llvm.loop !18 for.body18.us.us: ; preds = %for.body18.us.us.preheader, %for.body18.us.us %indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body18.us.us ], [ %indvars.iv95.ph, %for.body18.us.us.preheader ] %x.084.us.us = phi i32 [ %x.1.us.us, %for.body18.us.us ], [ %x.084.us.us.ph, %for.body18.us.us.preheader ] %arrayidx26.us.us = getelementptr inbounds [200 x [3 x i32]], ptr %data, i64 0, i64 %indvars.iv95, i64 0 %146 = load i32, ptr %arrayidx26.us.us, align 4, !tbaa !5 %cmp27.us.us = icmp eq i32 %9, %146 %cmp28.not.us.us = icmp ne i64 %indvars.iv102, %indvars.iv95 %or.cond.not.us.us = and i1 %cmp28.not.us.us, %cmp27.us.us %inc29.us.us = zext i1 %or.cond.not.us.us to i32 %x.1.us.us = add nuw nsw i32 %x.084.us.us, %inc29.us.us %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1 %exitcond.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count105 br i1 %exitcond.not, label %for.cond16.for.end32_crit_edge.us.us, label %for.body18.us.us, !llvm.loop !19 for.cond16.for.end32_crit_edge.us.us: ; preds = %for.body18.us.us %cmp33.us.us = icmp eq i32 %x.1.us.us, 0 br i1 %cmp33.us.us, label %if.then34.us.us, label %for.inc42.us.us for.cond48.preheader: ; preds = %for.inc42.us.us.2 br i1 %cmp1188, label %for.body50, label %for.end56 for.body50: ; preds = %for.cond48.preheader, %for.body50 %indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.body50 ], [ 0, %for.cond48.preheader ] %arrayidx52 = getelementptr inbounds [200 x i32], ptr %sum, i64 0, i64 %indvars.iv107 %147 = load i32, ptr %arrayidx52, align 4, !tbaa !5 %call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %147) %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1 %148 = load i32, ptr %N, align 4, !tbaa !5 %149 = sext i32 %148 to i64 %cmp49 = icmp slt i64 %indvars.iv.next108, %149 br i1 %cmp49, label %for.body50, label %for.end56, !llvm.loop !20 for.end56: ; preds = %for.body50, %entry, %for.cond10.preheader, %for.cond48.preheader call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %sum) #5 call void @llvm.lifetime.end.p0(i64 2400, ptr nonnull %data) #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.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 = { 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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !12, !13} !15 = distinct !{!15, !10, !13, !12} !16 = distinct !{!16, !10, !12, !13} !17 = distinct !{!17, !10, !13, !12} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10, !13, !12} !20 = distinct !{!20, !10}
#include<stdio.h> int main(){ int n,i,j,k,z; scanf("%d",&n); int c[n][3],s[200]={}; for(i=0;i<n;i++){ scanf("%d %d %d" ,&c[i][0] ,&c[i][1] ,&c[i][2]); } for(i=0;i<3;i++){ for(j=0;j<n;j++){ z=0; for(k=0;k<n;k++){ if(j!=k && c[j][i]!=c[k][i]){ z++; } } if(z==n-1){ s[j]+=c[j][i]; } } } for(i=0;i<n;i++){ printf("%d\n",s[i]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181616/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181616/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 [9 x i8] c"%d %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 %s = alloca [200 x i32], align 16 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 %1 = zext i32 %0 to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca [3 x i32], i64 %1, align 16 call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %s) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %s, i8 0, i64 800, i1 false) %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp77 = icmp sgt i32 %3, 0 br i1 %cmp77, label %for.body, label %for.end55 for.cond9.preheader: ; preds = %for.body %cmp1383 = icmp sgt i32 %32, 0 %sub = add nsw i32 %32, -1 br i1 %cmp1383, label %for.cond12.preheader.us.preheader, label %for.end55 for.cond12.preheader.us.preheader: ; preds = %for.cond9.preheader %wide.trip.count107 = zext i32 %32 to i64 %4 = add nsw i64 %wide.trip.count107, -1 %xtraiter = and i64 %wide.trip.count107, 1 %5 = icmp eq i64 %4, 0 %unroll_iter = and i64 %wide.trip.count107, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond15.preheader.us.us for.cond15.preheader.us.us: ; preds = %for.inc41.us.us, %for.cond12.preheader.us.preheader %indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.inc41.us.us ], [ 0, %for.cond12.preheader.us.preheader ] %arrayidx22.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv104, i64 0 br i1 %5, label %for.cond15.for.end31_crit_edge.us.us.unr-lcssa, label %for.body17.us.us if.then33.us.us: ; preds = %for.cond15.for.end31_crit_edge.us.us %6 = load i32, ptr %arrayidx22.us.us, align 4, !tbaa !5 %arrayidx39.us.us = getelementptr inbounds [200 x i32], ptr %s, i64 0, i64 %indvars.iv104 %7 = load i32, ptr %arrayidx39.us.us, align 4, !tbaa !5 %add.us.us = add nsw i32 %7, %6 store i32 %add.us.us, ptr %arrayidx39.us.us, align 4, !tbaa !5 br label %for.inc41.us.us for.inc41.us.us: ; preds = %for.cond15.for.end31_crit_edge.us.us, %if.then33.us.us %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1 %exitcond108.not = icmp eq i64 %indvars.iv.next105, %wide.trip.count107 br i1 %exitcond108.not, label %for.cond15.preheader.us.us.1.preheader, label %for.cond15.preheader.us.us, !llvm.loop !9 for.cond15.preheader.us.us.1.preheader: ; preds = %for.inc41.us.us %xtraiter134 = and i64 %wide.trip.count107, 1 %8 = icmp eq i64 %4, 0 %unroll_iter137 = and i64 %wide.trip.count107, 4294967294 %lcmp.mod135.not = icmp eq i64 %xtraiter134, 0 br label %for.cond15.preheader.us.us.1 for.body17.us.us: ; preds = %for.cond15.preheader.us.us, %for.inc29.us.us.1133 %indvars.iv101 = phi i64 [ %indvars.iv.next102.1132, %for.inc29.us.us.1133 ], [ 0, %for.cond15.preheader.us.us ] %z.081.us.us = phi i32 [ %z.1.us.us.1131, %for.inc29.us.us.1133 ], [ 0, %for.cond15.preheader.us.us ] %niter = phi i64 [ %niter.next.1, %for.inc29.us.us.1133 ], [ 0, %for.cond15.preheader.us.us ] %cmp18.not.us.us = icmp eq i64 %indvars.iv104, %indvars.iv101 br i1 %cmp18.not.us.us, label %for.inc29.us.us, label %land.lhs.true.us.us land.lhs.true.us.us: ; preds = %for.body17.us.us %9 = load i32, ptr %arrayidx22.us.us, align 4, !tbaa !5 %arrayidx26.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv101, i64 0 %10 = load i32, ptr %arrayidx26.us.us, align 8, !tbaa !5 %cmp27.not.us.us = icmp ne i32 %9, %10 %inc28.us.us = zext i1 %cmp27.not.us.us to i32 %spec.select.us.us = add nsw i32 %z.081.us.us, %inc28.us.us br label %for.inc29.us.us for.inc29.us.us: ; preds = %land.lhs.true.us.us, %for.body17.us.us %z.1.us.us = phi i32 [ %z.081.us.us, %for.body17.us.us ], [ %spec.select.us.us, %land.lhs.true.us.us ] %indvars.iv.next102 = or i64 %indvars.iv101, 1 %cmp18.not.us.us.1124 = icmp eq i64 %indvars.iv104, %indvars.iv.next102 br i1 %cmp18.not.us.us.1124, label %for.inc29.us.us.1133, label %land.lhs.true.us.us.1130 land.lhs.true.us.us.1130: ; preds = %for.inc29.us.us %11 = load i32, ptr %arrayidx22.us.us, align 4, !tbaa !5 %arrayidx26.us.us.1126 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv.next102, i64 0 %12 = load i32, ptr %arrayidx26.us.us.1126, align 4, !tbaa !5 %cmp27.not.us.us.1127 = icmp ne i32 %11, %12 %inc28.us.us.1128 = zext i1 %cmp27.not.us.us.1127 to i32 %spec.select.us.us.1129 = add nsw i32 %z.1.us.us, %inc28.us.us.1128 br label %for.inc29.us.us.1133 for.inc29.us.us.1133: ; preds = %land.lhs.true.us.us.1130, %for.inc29.us.us %z.1.us.us.1131 = phi i32 [ %z.1.us.us, %for.inc29.us.us ], [ %spec.select.us.us.1129, %land.lhs.true.us.us.1130 ] %indvars.iv.next102.1132 = add nuw nsw i64 %indvars.iv101, 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.cond15.for.end31_crit_edge.us.us.unr-lcssa, label %for.body17.us.us, !llvm.loop !11 for.cond15.for.end31_crit_edge.us.us.unr-lcssa: ; preds = %for.inc29.us.us.1133, %for.cond15.preheader.us.us %z.1.us.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.us ], [ %z.1.us.us.1131, %for.inc29.us.us.1133 ] %indvars.iv101.unr = phi i64 [ 0, %for.cond15.preheader.us.us ], [ %indvars.iv.next102.1132, %for.inc29.us.us.1133 ] %z.081.us.us.unr = phi i32 [ 0, %for.cond15.preheader.us.us ], [ %z.1.us.us.1131, %for.inc29.us.us.1133 ] br i1 %lcmp.mod.not, label %for.cond15.for.end31_crit_edge.us.us, label %for.body17.us.us.epil for.body17.us.us.epil: ; preds = %for.cond15.for.end31_crit_edge.us.us.unr-lcssa %cmp18.not.us.us.epil = icmp eq i64 %indvars.iv104, %indvars.iv101.unr br i1 %cmp18.not.us.us.epil, label %for.cond15.for.end31_crit_edge.us.us, label %land.lhs.true.us.us.epil land.lhs.true.us.us.epil: ; preds = %for.body17.us.us.epil %13 = load i32, ptr %arrayidx22.us.us, align 4, !tbaa !5 %arrayidx26.us.us.epil = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv101.unr, i64 0 %14 = load i32, ptr %arrayidx26.us.us.epil, align 4, !tbaa !5 %cmp27.not.us.us.epil = icmp ne i32 %13, %14 %inc28.us.us.epil = zext i1 %cmp27.not.us.us.epil to i32 %spec.select.us.us.epil = add nsw i32 %z.081.us.us.unr, %inc28.us.us.epil br label %for.cond15.for.end31_crit_edge.us.us for.cond15.for.end31_crit_edge.us.us: ; preds = %for.body17.us.us.epil, %land.lhs.true.us.us.epil, %for.cond15.for.end31_crit_edge.us.us.unr-lcssa %z.1.us.us.lcssa = phi i32 [ %z.1.us.us.lcssa.ph, %for.cond15.for.end31_crit_edge.us.us.unr-lcssa ], [ %z.081.us.us.unr, %for.body17.us.us.epil ], [ %spec.select.us.us.epil, %land.lhs.true.us.us.epil ] %cmp32.us.us = icmp eq i32 %z.1.us.us.lcssa, %sub br i1 %cmp32.us.us, label %if.then33.us.us, label %for.inc41.us.us for.cond15.preheader.us.us.1: ; preds = %for.cond15.preheader.us.us.1.preheader, %for.inc41.us.us.1 %indvars.iv104.1 = phi i64 [ %indvars.iv.next105.1, %for.inc41.us.us.1 ], [ 0, %for.cond15.preheader.us.us.1.preheader ] %arrayidx22.us.us.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv104.1, i64 1 br i1 %8, label %for.cond15.for.end31_crit_edge.us.us.1.unr-lcssa, label %for.body17.us.us.1 for.body17.us.us.1: ; preds = %for.cond15.preheader.us.us.1, %for.inc29.us.us.1.1 %indvars.iv101.1 = phi i64 [ %indvars.iv.next102.1.1, %for.inc29.us.us.1.1 ], [ 0, %for.cond15.preheader.us.us.1 ] %z.081.us.us.1 = phi i32 [ %z.1.us.us.1.1, %for.inc29.us.us.1.1 ], [ 0, %for.cond15.preheader.us.us.1 ] %niter138 = phi i64 [ %niter138.next.1, %for.inc29.us.us.1.1 ], [ 0, %for.cond15.preheader.us.us.1 ] %cmp18.not.us.us.1 = icmp eq i64 %indvars.iv104.1, %indvars.iv101.1 br i1 %cmp18.not.us.us.1, label %for.inc29.us.us.1, label %land.lhs.true.us.us.1 land.lhs.true.us.us.1: ; preds = %for.body17.us.us.1 %15 = load i32, ptr %arrayidx22.us.us.1, align 4, !tbaa !5 %arrayidx26.us.us.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv101.1, i64 1 %16 = load i32, ptr %arrayidx26.us.us.1, align 4, !tbaa !5 %cmp27.not.us.us.1 = icmp ne i32 %15, %16 %inc28.us.us.1 = zext i1 %cmp27.not.us.us.1 to i32 %spec.select.us.us.1 = add nsw i32 %z.081.us.us.1, %inc28.us.us.1 br label %for.inc29.us.us.1 for.inc29.us.us.1: ; preds = %land.lhs.true.us.us.1, %for.body17.us.us.1 %z.1.us.us.1 = phi i32 [ %z.081.us.us.1, %for.body17.us.us.1 ], [ %spec.select.us.us.1, %land.lhs.true.us.us.1 ] %indvars.iv.next102.1 = or i64 %indvars.iv101.1, 1 %cmp18.not.us.us.1.1 = icmp eq i64 %indvars.iv104.1, %indvars.iv.next102.1 br i1 %cmp18.not.us.us.1.1, label %for.inc29.us.us.1.1, label %land.lhs.true.us.us.1.1 land.lhs.true.us.us.1.1: ; preds = %for.inc29.us.us.1 %17 = load i32, ptr %arrayidx22.us.us.1, align 4, !tbaa !5 %arrayidx26.us.us.1.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv.next102.1, i64 1 %18 = load i32, ptr %arrayidx26.us.us.1.1, align 8, !tbaa !5 %cmp27.not.us.us.1.1 = icmp ne i32 %17, %18 %inc28.us.us.1.1 = zext i1 %cmp27.not.us.us.1.1 to i32 %spec.select.us.us.1.1 = add nsw i32 %z.1.us.us.1, %inc28.us.us.1.1 br label %for.inc29.us.us.1.1 for.inc29.us.us.1.1: ; preds = %land.lhs.true.us.us.1.1, %for.inc29.us.us.1 %z.1.us.us.1.1 = phi i32 [ %z.1.us.us.1, %for.inc29.us.us.1 ], [ %spec.select.us.us.1.1, %land.lhs.true.us.us.1.1 ] %indvars.iv.next102.1.1 = add nuw nsw i64 %indvars.iv101.1, 2 %niter138.next.1 = add i64 %niter138, 2 %niter138.ncmp.1 = icmp eq i64 %niter138.next.1, %unroll_iter137 br i1 %niter138.ncmp.1, label %for.cond15.for.end31_crit_edge.us.us.1.unr-lcssa, label %for.body17.us.us.1, !llvm.loop !11 for.cond15.for.end31_crit_edge.us.us.1.unr-lcssa: ; preds = %for.inc29.us.us.1.1, %for.cond15.preheader.us.us.1 %z.1.us.us.1.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.us.1 ], [ %z.1.us.us.1.1, %for.inc29.us.us.1.1 ] %indvars.iv101.1.unr = phi i64 [ 0, %for.cond15.preheader.us.us.1 ], [ %indvars.iv.next102.1.1, %for.inc29.us.us.1.1 ] %z.081.us.us.1.unr = phi i32 [ 0, %for.cond15.preheader.us.us.1 ], [ %z.1.us.us.1.1, %for.inc29.us.us.1.1 ] br i1 %lcmp.mod135.not, label %for.cond15.for.end31_crit_edge.us.us.1, label %for.body17.us.us.1.epil for.body17.us.us.1.epil: ; preds = %for.cond15.for.end31_crit_edge.us.us.1.unr-lcssa %cmp18.not.us.us.1.epil = icmp eq i64 %indvars.iv104.1, %indvars.iv101.1.unr br i1 %cmp18.not.us.us.1.epil, label %for.cond15.for.end31_crit_edge.us.us.1, label %land.lhs.true.us.us.1.epil land.lhs.true.us.us.1.epil: ; preds = %for.body17.us.us.1.epil %19 = load i32, ptr %arrayidx22.us.us.1, align 4, !tbaa !5 %arrayidx26.us.us.1.epil = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv101.1.unr, i64 1 %20 = load i32, ptr %arrayidx26.us.us.1.epil, align 4, !tbaa !5 %cmp27.not.us.us.1.epil = icmp ne i32 %19, %20 %inc28.us.us.1.epil = zext i1 %cmp27.not.us.us.1.epil to i32 %spec.select.us.us.1.epil = add nsw i32 %z.081.us.us.1.unr, %inc28.us.us.1.epil br label %for.cond15.for.end31_crit_edge.us.us.1 for.cond15.for.end31_crit_edge.us.us.1: ; preds = %for.body17.us.us.1.epil, %land.lhs.true.us.us.1.epil, %for.cond15.for.end31_crit_edge.us.us.1.unr-lcssa %z.1.us.us.1.lcssa = phi i32 [ %z.1.us.us.1.lcssa.ph, %for.cond15.for.end31_crit_edge.us.us.1.unr-lcssa ], [ %z.081.us.us.1.unr, %for.body17.us.us.1.epil ], [ %spec.select.us.us.1.epil, %land.lhs.true.us.us.1.epil ] %cmp32.us.us.1 = icmp eq i32 %z.1.us.us.1.lcssa, %sub br i1 %cmp32.us.us.1, label %if.then33.us.us.1, label %for.inc41.us.us.1 if.then33.us.us.1: ; preds = %for.cond15.for.end31_crit_edge.us.us.1 %21 = load i32, ptr %arrayidx22.us.us.1, align 4, !tbaa !5 %arrayidx39.us.us.1 = getelementptr inbounds [200 x i32], ptr %s, i64 0, i64 %indvars.iv104.1 %22 = load i32, ptr %arrayidx39.us.us.1, align 4, !tbaa !5 %add.us.us.1 = add nsw i32 %22, %21 store i32 %add.us.us.1, ptr %arrayidx39.us.us.1, align 4, !tbaa !5 br label %for.inc41.us.us.1 for.inc41.us.us.1: ; preds = %if.then33.us.us.1, %for.cond15.for.end31_crit_edge.us.us.1 %indvars.iv.next105.1 = add nuw nsw i64 %indvars.iv104.1, 1 %exitcond108.1.not = icmp eq i64 %indvars.iv.next105.1, %wide.trip.count107 br i1 %exitcond108.1.not, label %for.cond15.preheader.us.us.2.preheader, label %for.cond15.preheader.us.us.1, !llvm.loop !9 for.cond15.preheader.us.us.2.preheader: ; preds = %for.inc41.us.us.1 %xtraiter139 = and i64 %wide.trip.count107, 1 %23 = icmp eq i64 %4, 0 %unroll_iter142 = and i64 %wide.trip.count107, 4294967294 %lcmp.mod140.not = icmp eq i64 %xtraiter139, 0 br label %for.cond15.preheader.us.us.2 for.cond15.preheader.us.us.2: ; preds = %for.cond15.preheader.us.us.2.preheader, %for.inc41.us.us.2 %indvars.iv104.2 = phi i64 [ %indvars.iv.next105.2, %for.inc41.us.us.2 ], [ 0, %for.cond15.preheader.us.us.2.preheader ] %arrayidx22.us.us.2 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv104.2, i64 2 br i1 %23, label %for.cond15.for.end31_crit_edge.us.us.2.unr-lcssa, label %for.body17.us.us.2 for.body17.us.us.2: ; preds = %for.cond15.preheader.us.us.2, %for.inc29.us.us.2.1 %indvars.iv101.2 = phi i64 [ %indvars.iv.next102.2.1, %for.inc29.us.us.2.1 ], [ 0, %for.cond15.preheader.us.us.2 ] %z.081.us.us.2 = phi i32 [ %z.1.us.us.2.1, %for.inc29.us.us.2.1 ], [ 0, %for.cond15.preheader.us.us.2 ] %niter143 = phi i64 [ %niter143.next.1, %for.inc29.us.us.2.1 ], [ 0, %for.cond15.preheader.us.us.2 ] %cmp18.not.us.us.2 = icmp eq i64 %indvars.iv104.2, %indvars.iv101.2 br i1 %cmp18.not.us.us.2, label %for.inc29.us.us.2, label %land.lhs.true.us.us.2 land.lhs.true.us.us.2: ; preds = %for.body17.us.us.2 %24 = load i32, ptr %arrayidx22.us.us.2, align 4, !tbaa !5 %arrayidx26.us.us.2 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv101.2, i64 2 %25 = load i32, ptr %arrayidx26.us.us.2, align 8, !tbaa !5 %cmp27.not.us.us.2 = icmp ne i32 %24, %25 %inc28.us.us.2 = zext i1 %cmp27.not.us.us.2 to i32 %spec.select.us.us.2 = add nsw i32 %z.081.us.us.2, %inc28.us.us.2 br label %for.inc29.us.us.2 for.inc29.us.us.2: ; preds = %land.lhs.true.us.us.2, %for.body17.us.us.2 %z.1.us.us.2 = phi i32 [ %z.081.us.us.2, %for.body17.us.us.2 ], [ %spec.select.us.us.2, %land.lhs.true.us.us.2 ] %indvars.iv.next102.2 = or i64 %indvars.iv101.2, 1 %cmp18.not.us.us.2.1 = icmp eq i64 %indvars.iv104.2, %indvars.iv.next102.2 br i1 %cmp18.not.us.us.2.1, label %for.inc29.us.us.2.1, label %land.lhs.true.us.us.2.1 land.lhs.true.us.us.2.1: ; preds = %for.inc29.us.us.2 %26 = load i32, ptr %arrayidx22.us.us.2, align 4, !tbaa !5 %arrayidx26.us.us.2.1 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv.next102.2, i64 2 %27 = load i32, ptr %arrayidx26.us.us.2.1, align 4, !tbaa !5 %cmp27.not.us.us.2.1 = icmp ne i32 %26, %27 %inc28.us.us.2.1 = zext i1 %cmp27.not.us.us.2.1 to i32 %spec.select.us.us.2.1 = add nsw i32 %z.1.us.us.2, %inc28.us.us.2.1 br label %for.inc29.us.us.2.1 for.inc29.us.us.2.1: ; preds = %land.lhs.true.us.us.2.1, %for.inc29.us.us.2 %z.1.us.us.2.1 = phi i32 [ %z.1.us.us.2, %for.inc29.us.us.2 ], [ %spec.select.us.us.2.1, %land.lhs.true.us.us.2.1 ] %indvars.iv.next102.2.1 = add nuw nsw i64 %indvars.iv101.2, 2 %niter143.next.1 = add i64 %niter143, 2 %niter143.ncmp.1 = icmp eq i64 %niter143.next.1, %unroll_iter142 br i1 %niter143.ncmp.1, label %for.cond15.for.end31_crit_edge.us.us.2.unr-lcssa, label %for.body17.us.us.2, !llvm.loop !11 for.cond15.for.end31_crit_edge.us.us.2.unr-lcssa: ; preds = %for.inc29.us.us.2.1, %for.cond15.preheader.us.us.2 %z.1.us.us.2.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.us.2 ], [ %z.1.us.us.2.1, %for.inc29.us.us.2.1 ] %indvars.iv101.2.unr = phi i64 [ 0, %for.cond15.preheader.us.us.2 ], [ %indvars.iv.next102.2.1, %for.inc29.us.us.2.1 ] %z.081.us.us.2.unr = phi i32 [ 0, %for.cond15.preheader.us.us.2 ], [ %z.1.us.us.2.1, %for.inc29.us.us.2.1 ] br i1 %lcmp.mod140.not, label %for.cond15.for.end31_crit_edge.us.us.2, label %for.body17.us.us.2.epil for.body17.us.us.2.epil: ; preds = %for.cond15.for.end31_crit_edge.us.us.2.unr-lcssa %cmp18.not.us.us.2.epil = icmp eq i64 %indvars.iv104.2, %indvars.iv101.2.unr br i1 %cmp18.not.us.us.2.epil, label %for.cond15.for.end31_crit_edge.us.us.2, label %land.lhs.true.us.us.2.epil land.lhs.true.us.us.2.epil: ; preds = %for.body17.us.us.2.epil %28 = load i32, ptr %arrayidx22.us.us.2, align 4, !tbaa !5 %arrayidx26.us.us.2.epil = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv101.2.unr, i64 2 %29 = load i32, ptr %arrayidx26.us.us.2.epil, align 4, !tbaa !5 %cmp27.not.us.us.2.epil = icmp ne i32 %28, %29 %inc28.us.us.2.epil = zext i1 %cmp27.not.us.us.2.epil to i32 %spec.select.us.us.2.epil = add nsw i32 %z.081.us.us.2.unr, %inc28.us.us.2.epil br label %for.cond15.for.end31_crit_edge.us.us.2 for.cond15.for.end31_crit_edge.us.us.2: ; preds = %for.body17.us.us.2.epil, %land.lhs.true.us.us.2.epil, %for.cond15.for.end31_crit_edge.us.us.2.unr-lcssa %z.1.us.us.2.lcssa = phi i32 [ %z.1.us.us.2.lcssa.ph, %for.cond15.for.end31_crit_edge.us.us.2.unr-lcssa ], [ %z.081.us.us.2.unr, %for.body17.us.us.2.epil ], [ %spec.select.us.us.2.epil, %land.lhs.true.us.us.2.epil ] %cmp32.us.us.2 = icmp eq i32 %z.1.us.us.2.lcssa, %sub br i1 %cmp32.us.us.2, label %if.then33.us.us.2, label %for.inc41.us.us.2 if.then33.us.us.2: ; preds = %for.cond15.for.end31_crit_edge.us.us.2 %30 = load i32, ptr %arrayidx22.us.us.2, align 4, !tbaa !5 %arrayidx39.us.us.2 = getelementptr inbounds [200 x i32], ptr %s, i64 0, i64 %indvars.iv104.2 %31 = load i32, ptr %arrayidx39.us.us.2, align 4, !tbaa !5 %add.us.us.2 = add nsw i32 %31, %30 store i32 %add.us.us.2, ptr %arrayidx39.us.us.2, align 4, !tbaa !5 br label %for.inc41.us.us.2 for.inc41.us.us.2: ; preds = %if.then33.us.us.2, %for.cond15.for.end31_crit_edge.us.us.2 %indvars.iv.next105.2 = add nuw nsw i64 %indvars.iv104.2, 1 %exitcond108.2.not = icmp eq i64 %indvars.iv.next105.2, %wide.trip.count107 br i1 %exitcond108.2.not, label %for.cond47.preheader, label %for.cond15.preheader.us.us.2, !llvm.loop !9 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv %arrayidx4 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 1 %arrayidx7 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 2 %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx7) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %32 = load i32, ptr %n, align 4, !tbaa !5 %33 = sext i32 %32 to i64 %cmp = icmp slt i64 %indvars.iv.next, %33 br i1 %cmp, label %for.body, label %for.cond9.preheader, !llvm.loop !12 for.cond47.preheader: ; preds = %for.inc41.us.us.2 br i1 %cmp1383, label %for.body49, label %for.end55 for.body49: ; preds = %for.cond47.preheader, %for.body49 %indvars.iv113 = phi i64 [ %indvars.iv.next114, %for.body49 ], [ 0, %for.cond47.preheader ] %arrayidx51 = getelementptr inbounds [200 x i32], ptr %s, i64 0, i64 %indvars.iv113 %34 = load i32, ptr %arrayidx51, align 4, !tbaa !5 %call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %34) %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1 %35 = load i32, ptr %n, align 4, !tbaa !5 %36 = sext i32 %35 to i64 %cmp48 = icmp slt i64 %indvars.iv.next114, %36 br i1 %cmp48, label %for.body49, label %for.end55, !llvm.loop !13 for.end55: ; preds = %for.body49, %entry, %for.cond9.preheader, %for.cond47.preheader call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %s) #5 call void @llvm.stackrestore.p0(ptr %2) 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 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: 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 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 = { 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 <string.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <limits.h> #include <math.h> int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */ int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */ int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */ int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */ #define min(a,b) (a < b ? a: b) #define max(a,b) (a > b ? a: b) #define rep(i, l, r) for (int i = l; i < r; i++) #define MAX 100001 #define MOD 1000000007 typedef long long int lli; int main(void) { int N, K; scanf("%d %d", &N, &K); int A[MAX]; rep(i, 0, N) scanf("%d", &A[i]); int ans = (N - 2) / (K - 1) + 1; printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181674/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181674/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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @acs(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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @des(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i32, ptr %b, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @cmp_char(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i8, ptr %a, align 1, !tbaa !9 %conv = sext i8 %0 to i32 %1 = load i8, ptr %b, align 1, !tbaa !9 %conv1 = sext i8 %1 to i32 %sub = sub nsw i32 %conv, %conv1 ret i32 %sub } ; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable define dso_local i32 @cmp_str(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 { entry: %0 = load ptr, ptr %a, align 8, !tbaa !10 %1 = load ptr, ptr %b, align 8, !tbaa !10 %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #6 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %N = alloca i32, align 4 %K = alloca i32, align 4 %A = alloca [100001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K) call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %A) #7 %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp6 = icmp sgt i32 %0, 0 br i1 %cmp6, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ] %sub = add nsw i32 %.lcssa, -2 %1 = load i32, ptr %K, align 4, !tbaa !5 %sub2 = add nsw i32 %1, -1 %div = sdiv i32 %sub, %sub2 %add = add nsw i32 %div, 1 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add) call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %A) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7 ret i32 0 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100001 x i32], ptr %A, 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 %2 = load i32, ptr %N, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 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) #4 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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) #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 nounwind willreturn memory(read, 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 #2 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #5 = { 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 #6 = { nounwind willreturn memory(read) } attributes #7 = { 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 = !{!11, !11, i64 0} !11 = !{!"any pointer", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main(){ int a,n,k,x,an = 1; scanf("%d %d",&n,&k); for( x = 0 ; x < n ; x++ ) scanf("%d",&a); n -= k; k--; while( n > 0) { n -= k; an++; } printf("%d\n",an); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181724/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181724/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: %a = alloca i32, align 4 %n = 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 %n) #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 %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %0, 0 br i1 %cmp9, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %x.010 = phi i32 [ %inc, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a) %inc = add nuw nsw i32 %x.010, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %1 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ] %2 = load i32, ptr %k, align 4, !tbaa !5 %sub = sub nsw i32 %.lcssa, %2 store i32 %sub, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %k, align 4, !tbaa !5 %cmp211 = icmp sgt i32 %sub, 0 br i1 %cmp211, label %while.body, label %while.end while.body: ; preds = %for.end, %while.body %an.012 = phi i32 [ %inc4, %while.body ], [ 1, %for.end ] %3 = phi i32 [ %sub3, %while.body ], [ %sub, %for.end ] %sub3 = sub nsw i32 %3, %dec %inc4 = add nuw nsw i32 %an.012, 1 %cmp2 = icmp sgt i32 %sub3, 0 br i1 %cmp2, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !11 while.cond.while.end_crit_edge: ; preds = %while.body store i32 %sub3, ptr %n, align 4, !tbaa !5 br label %while.end while.end: ; preds = %while.cond.while.end_crit_edge, %for.end %an.0.lcssa = phi i32 [ %inc4, %while.cond.while.end_crit_edge ], [ 1, %for.end ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %an.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main (void) { int n , k , a[100000],i , ans; scanf("%d%d" , &n , &k); for(i=0;i<n;i++) scanf("%d" , &a[i]); for(i=1;k<n;i++) n = n-(k-1); printf("%d\n" , i); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181768/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181768/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: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 %a = alloca [100000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3 call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #3 %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 !5 %cmp15 = icmp sgt i32 %0, 0 br i1 %cmp15, label %for.body, label %for.cond2.preheader for.cond2.preheader: ; preds = %for.body, %entry %n.promoted = phi i32 [ %0, %entry ], [ %2, %for.body ] %1 = load i32, ptr %k, align 4, !tbaa !5 %cmp318 = icmp slt i32 %1, %n.promoted br i1 %cmp318, label %for.body4, label %for.end8 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x i32], ptr %a, 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 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.body4: ; preds = %for.cond2.preheader, %for.body4 %i.120 = phi i32 [ %inc7, %for.body4 ], [ 1, %for.cond2.preheader ] %sub51719 = phi i32 [ %sub5, %for.body4 ], [ %n.promoted, %for.cond2.preheader ] %reass.sub = sub i32 %sub51719, %1 %sub5 = add i32 %reass.sub, 1 %inc7 = add nuw nsw i32 %i.120, 1 %cmp3 = icmp slt i32 %1, %sub5 br i1 %cmp3, label %for.body4, label %for.cond2.for.end8_crit_edge, !llvm.loop !11 for.cond2.for.end8_crit_edge: ; preds = %for.body4 store i32 %sub5, ptr %n, align 4, !tbaa !5 br label %for.end8 for.end8: ; preds = %for.cond2.for.end8_crit_edge, %for.cond2.preheader %i.1.lcssa = phi i32 [ %inc7, %for.cond2.for.end8_crit_edge ], [ 1, %for.cond2.preheader ] %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.1.lcssa) call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #3 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int N, K; scanf("%d %d", &N, &K); if (N == K) printf("%d\n", 1); else { printf("%d\n", (int)ceil((double)(N-1) / (K-1))); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181810/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181810/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: %N = alloca i32, align 4 %K = 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 %K) #4 %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 !5 %1 = load i32, ptr %K, align 4, !tbaa !5 %cmp = icmp eq i32 %0, %1 br i1 %cmp, label %if.end, label %if.else if.else: ; preds = %entry %sub = add nsw i32 %0, -1 %conv = sitofp i32 %sub to double %sub2 = add nsw i32 %1, -1 %conv3 = sitofp i32 %sub2 to double %div = fdiv double %conv, %conv3 %2 = call double @llvm.ceil.f64(double %div) %conv4 = fptosi double %2 to i32 br label %if.end if.end: ; preds = %entry, %if.else %conv4.sink = phi i32 [ %conv4, %if.else ], [ 1, %entry ] %call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv4.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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 speculatable willreturn memory(none) declare double @llvm.ceil.f64(double) #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> #define MAX_N 51 #define MAX_M 51 #define MAX_COUNT 101 int count[MAX_COUNT]; void init(void) { int i; for (i = 0; i < MAX_COUNT; i++) count[i] = 0; } int main(void) { int n, q, m, t, i, j, max, maxp; while (1) { init(); scanf("%d %d", &n, &q); if (n == 0 && q == 0) return 0; for (i = 0; i < n; i++) { scanf("%d", &m); for (j = 0; j < m; j++) { scanf("%d", &t); count[t]++; } } max = 0; maxp = 0; for (i = 1; i < MAX_COUNT; i++) { if (count[i] >= q && count[i] > max) { max = count[i]; maxp = i; } } printf("%d\n", maxp); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181854/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181854/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" @count = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16 @.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: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable define dso_local void @init() local_unnamed_addr #0 { entry: tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @count, i8 0, i64 404, i1 false), !tbaa !5 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 nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %q = alloca i32, align 4 %m = alloca i32, align 4 %t = 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 %q) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @count, i8 0, i64 404, i1 false), !tbaa !5 %call46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp47 = icmp eq i32 %0, 0 %1 = load i32, ptr %q, align 4 %cmp148 = icmp eq i32 %1, 0 %or.cond49 = select i1 %cmp47, i1 %cmp148, i1 false br i1 %or.cond49, label %if.then, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end28 %2 = phi i32 [ %15, %for.end28 ], [ %1, %entry ] %3 = phi i32 [ %14, %for.end28 ], [ %0, %entry ] %cmp241 = icmp sgt i32 %3, 0 br i1 %cmp241, label %for.body, label %for.cond12.preheader if.then: ; preds = %for.end28, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 for.cond12.preheader.loopexit: ; preds = %for.inc9 %.pre = load i32, ptr %q, align 4, !tbaa !5 br label %for.cond12.preheader for.cond12.preheader: ; preds = %for.cond12.preheader.loopexit, %for.cond.preheader %4 = phi i32 [ %.pre, %for.cond12.preheader.loopexit ], [ %2, %for.cond.preheader ] br label %for.body14 for.body: ; preds = %for.cond.preheader, %for.inc9 %i.042 = phi i32 [ %inc10, %for.inc9 ], [ 0, %for.cond.preheader ] %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %m) %5 = load i32, ptr %m, align 4, !tbaa !5 %cmp539 = icmp sgt i32 %5, 0 br i1 %cmp539, label %for.body6, label %for.inc9 for.body6: ; preds = %for.body, %for.body6 %j.040 = phi i32 [ %inc8, %for.body6 ], [ 0, %for.body ] %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t) %6 = load i32, ptr %t, align 4, !tbaa !5 %idxprom = sext i32 %6 to i64 %arrayidx = getelementptr inbounds [101 x i32], ptr @count, i64 0, i64 %idxprom %7 = load i32, ptr %arrayidx, align 4, !tbaa !5 %inc = add nsw i32 %7, 1 store i32 %inc, ptr %arrayidx, align 4, !tbaa !5 %inc8 = add nuw nsw i32 %j.040, 1 %8 = load i32, ptr %m, align 4, !tbaa !5 %cmp5 = icmp slt i32 %inc8, %8 br i1 %cmp5, label %for.body6, label %for.inc9, !llvm.loop !9 for.inc9: ; preds = %for.body6, %for.body %inc10 = add nuw nsw i32 %i.042, 1 %9 = load i32, ptr %n, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc10, %9 br i1 %cmp2, label %for.body, label %for.cond12.preheader.loopexit, !llvm.loop !11 for.body14: ; preds = %for.body14, %for.cond12.preheader %indvars.iv = phi i64 [ 1, %for.cond12.preheader ], [ %indvars.iv.next.1, %for.body14 ] %maxp.045 = phi i32 [ 0, %for.cond12.preheader ], [ %maxp.1.1, %for.body14 ] %max.044 = phi i32 [ 0, %for.cond12.preheader ], [ %max.1.1, %for.body14 ] %arrayidx16 = getelementptr inbounds [101 x i32], ptr @count, i64 0, i64 %indvars.iv %10 = load i32, ptr %arrayidx16, align 4, !tbaa !5 %cmp17.not = icmp sge i32 %10, %4 %cmp21 = icmp sgt i32 %10, %max.044 %or.cond38 = select i1 %cmp17.not, i1 %cmp21, i1 false %max.1 = select i1 %or.cond38, i32 %10, i32 %max.044 %11 = trunc i64 %indvars.iv to i32 %maxp.1 = select i1 %or.cond38, i32 %11, i32 %maxp.045 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx16.1 = getelementptr inbounds [101 x i32], ptr @count, i64 0, i64 %indvars.iv.next %12 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5 %cmp17.not.1 = icmp sge i32 %12, %4 %cmp21.1 = icmp sgt i32 %12, %max.1 %or.cond38.1 = select i1 %cmp17.not.1, i1 %cmp21.1, i1 false %max.1.1 = select i1 %or.cond38.1, i32 %12, i32 %max.1 %13 = trunc i64 %indvars.iv.next to i32 %maxp.1.1 = select i1 %or.cond38.1, i32 %13, i32 %maxp.1 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 101 br i1 %exitcond.not.1, label %for.end28, label %for.body14, !llvm.loop !12 for.end28: ; preds = %for.body14 %call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %maxp.1.1) call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @count, i8 0, i64 404, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q) %14 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %14, 0 %15 = load i32, ptr %q, align 4 %cmp1 = icmp eq i32 %15, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %if.then, label %for.cond.preheader } ; 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: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(write, 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 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 = { 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} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> #include <math.h> int box[1000000]; int main(void) { double a; int b, c, d; int z, zz; while (scanf("%lf", &a) != EOF){ for (b = 0; b <= a; b++) { box[b] = 0; } for (b = 1; b <= a; b++) { box[b] = b; } c = 0; d = 2; while (sqrt(a) >= d) { for (b = d; b <= a; b += d) { box[b] = -1; } c++; for (b = 2; b <= a; b++) { zz = 0; if (box[b] != -1) { for (z = b; z >= 1; z--) { if (b % z == 0) { zz++; } } } if (zz == 2) { d = b; b = a + 1; } } } for (b = d; b <= a; b++) { if (box[b] != -1) { c++; } } printf("%d\n", c); } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181898/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181898/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"%lf\00", align 1 @box = dso_local local_unnamed_addr global [1000000 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: %a = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 %call131 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %cmp.not132 = icmp eq i32 %call131, -1 br i1 %cmp.not132, label %while.end74, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end72 %0 = load double, ptr %a, align 8, !tbaa !5 %cmp1103 = fcmp ult double %0, 0.000000e+00 br i1 %cmp1103, label %for.cond3.preheader, label %for.body for.cond3.preheader: ; preds = %for.body, %for.cond.preheader %cmp5105 = fcmp ult double %0, 1.000000e+00 br i1 %cmp5105, label %while.cond13.preheader, label %for.body7 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @box, i64 0, i64 %indvars.iv store i32 0, ptr %arrayidx, align 4, !tbaa !9 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %1 = trunc i64 %indvars.iv.next to i32 %conv = sitofp i32 %1 to double %cmp1 = fcmp ult double %0, %conv br i1 %cmp1, label %for.cond3.preheader, label %for.body, !llvm.loop !11 while.cond13.preheader: ; preds = %for.body7, %for.cond3.preheader %call14120 = call double @sqrt(double noundef %0) #4 %cmp16121 = fcmp ult double %call14120, 2.000000e+00 br i1 %cmp16121, label %for.cond58.preheader, label %for.cond19.preheader for.body7: ; preds = %for.cond3.preheader, %for.body7 %indvars.iv134 = phi i64 [ %indvars.iv.next135, %for.body7 ], [ 1, %for.cond3.preheader ] %arrayidx9 = getelementptr inbounds [1000000 x i32], ptr @box, i64 0, i64 %indvars.iv134 %2 = trunc i64 %indvars.iv134 to i32 store i32 %2, ptr %arrayidx9, align 4, !tbaa !9 %indvars.iv.next135 = add nuw i64 %indvars.iv134, 1 %3 = trunc i64 %indvars.iv.next135 to i32 %conv4 = sitofp i32 %3 to double %cmp5 = fcmp ult double %0, %conv4 br i1 %cmp5, label %while.cond13.preheader, label %for.body7, !llvm.loop !13 while.cond13.loopexit.loopexit: ; preds = %if.end48 %.pre = sitofp i32 %d.2 to double br label %while.cond13.loopexit while.cond13.loopexit: ; preds = %while.cond13.loopexit.loopexit, %for.end27 %conv15.pre-phi = phi double [ %.pre, %while.cond13.loopexit.loopexit ], [ %conv20107, %for.end27 ] %d.1.lcssa = phi i32 [ %d.2, %while.cond13.loopexit.loopexit ], [ %d.0123, %for.end27 ] %call14 = call double @sqrt(double noundef %6) #4 %cmp16 = fcmp ult double %call14, %conv15.pre-phi br i1 %cmp16, label %for.cond58.preheader, label %for.cond19.preheader, !llvm.loop !14 for.cond58.preheader: ; preds = %while.cond13.loopexit, %while.cond13.preheader %c.0.lcssa = phi i32 [ 0, %while.cond13.preheader ], [ %inc28, %while.cond13.loopexit ] %d.0.lcssa = phi i32 [ 2, %while.cond13.preheader ], [ %d.1.lcssa, %while.cond13.loopexit ] %4 = load double, ptr %a, align 8, !tbaa !5 %conv59126 = sitofp i32 %d.0.lcssa to double %cmp60127 = fcmp ult double %4, %conv59126 br i1 %cmp60127, label %for.end72, label %for.body62.preheader for.body62.preheader: ; preds = %for.cond58.preheader %5 = sext i32 %d.0.lcssa to i64 br label %for.body62 for.cond19.preheader: ; preds = %while.cond13.preheader, %while.cond13.loopexit %d.0123 = phi i32 [ %d.1.lcssa, %while.cond13.loopexit ], [ 2, %while.cond13.preheader ] %c.0122 = phi i32 [ %inc28, %while.cond13.loopexit ], [ 0, %while.cond13.preheader ] %6 = load double, ptr %a, align 8 %conv20107 = sitofp i32 %d.0123 to double %cmp21108 = fcmp ult double %6, %conv20107 br i1 %cmp21108, label %for.end27, label %for.body23.preheader for.body23.preheader: ; preds = %for.cond19.preheader %7 = sext i32 %d.0123 to i64 br label %for.body23 for.body23: ; preds = %for.body23.preheader, %for.body23 %indvars.iv137 = phi i64 [ %7, %for.body23.preheader ], [ %indvars.iv.next138, %for.body23 ] %arrayidx25 = getelementptr inbounds [1000000 x i32], ptr @box, i64 0, i64 %indvars.iv137 store i32 -1, ptr %arrayidx25, align 4, !tbaa !9 %indvars.iv.next138 = add i64 %indvars.iv137, %7 %8 = trunc i64 %indvars.iv.next138 to i32 %conv20 = sitofp i32 %8 to double %cmp21 = fcmp ult double %6, %conv20 br i1 %cmp21, label %for.end27, label %for.body23, !llvm.loop !15 for.end27: ; preds = %for.body23, %for.cond19.preheader %inc28 = add nuw nsw i32 %c.0122, 1 %cmp31115 = fcmp ult double %6, 2.000000e+00 br i1 %cmp31115, label %while.cond13.loopexit, label %for.body33.lr.ph for.body33.lr.ph: ; preds = %for.end27 %add52 = fadd double %6, 1.000000e+00 %conv53 = fptosi double %add52 to i32 br label %for.body33 for.body33: ; preds = %for.body33.lr.ph, %if.end48 %d.1118 = phi i32 [ %d.0123, %for.body33.lr.ph ], [ %d.2, %if.end48 ] %b.3116 = phi i32 [ 2, %for.body33.lr.ph ], [ %inc56, %if.end48 ] %idxprom34 = sext i32 %b.3116 to i64 %arrayidx35 = getelementptr inbounds [1000000 x i32], ptr @box, i64 0, i64 %idxprom34 %9 = load i32, ptr %arrayidx35, align 4, !tbaa !9 %cmp36.not = icmp ne i32 %9, -1 %cmp39111 = icmp sgt i32 %b.3116, 0 %or.cond = and i1 %cmp36.not, %cmp39111 br i1 %or.cond, label %for.body41.preheader, label %if.end48 for.body41.preheader: ; preds = %for.body33 %xtraiter = and i32 %b.3116, 1 %10 = icmp eq i32 %b.3116, 1 br i1 %10, label %if.end48.loopexit.unr-lcssa, label %for.body41.preheader.new for.body41.preheader.new: ; preds = %for.body41.preheader %unroll_iter = and i32 %b.3116, -2 br label %for.body41 for.body41: ; preds = %for.body41, %for.body41.preheader.new %zz.0113 = phi i32 [ 0, %for.body41.preheader.new ], [ %spec.select.1, %for.body41 ] %z.0112 = phi i32 [ %b.3116, %for.body41.preheader.new ], [ %dec.1, %for.body41 ] %niter = phi i32 [ 0, %for.body41.preheader.new ], [ %niter.next.1, %for.body41 ] %rem = srem i32 %b.3116, %z.0112 %cmp42 = icmp eq i32 %rem, 0 %inc45 = zext i1 %cmp42 to i32 %spec.select = add nuw nsw i32 %zz.0113, %inc45 %dec = add nsw i32 %z.0112, -1 %rem.1 = srem i32 %b.3116, %dec %cmp42.1 = icmp eq i32 %rem.1, 0 %inc45.1 = zext i1 %cmp42.1 to i32 %spec.select.1 = add nuw nsw i32 %spec.select, %inc45.1 %dec.1 = add nsw i32 %z.0112, -2 %niter.next.1 = add i32 %niter, 2 %niter.ncmp.1.not = icmp eq i32 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1.not, label %if.end48.loopexit.unr-lcssa, label %for.body41, !llvm.loop !16 if.end48.loopexit.unr-lcssa: ; preds = %for.body41, %for.body41.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body41.preheader ], [ %spec.select.1, %for.body41 ] %zz.0113.unr = phi i32 [ 0, %for.body41.preheader ], [ %spec.select.1, %for.body41 ] %z.0112.unr = phi i32 [ %b.3116, %for.body41.preheader ], [ %dec.1, %for.body41 ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %if.end48, label %for.body41.epil for.body41.epil: ; preds = %if.end48.loopexit.unr-lcssa %rem.epil = srem i32 %b.3116, %z.0112.unr %cmp42.epil = icmp eq i32 %rem.epil, 0 %inc45.epil = zext i1 %cmp42.epil to i32 %spec.select.epil = add nuw nsw i32 %zz.0113.unr, %inc45.epil br label %if.end48 if.end48: ; preds = %for.body41.epil, %if.end48.loopexit.unr-lcssa, %for.body33 %zz.2 = phi i32 [ 0, %for.body33 ], [ %spec.select.lcssa.ph, %if.end48.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body41.epil ] %cmp49 = icmp eq i32 %zz.2, 2 %b.4 = select i1 %cmp49, i32 %conv53, i32 %b.3116 %d.2 = select i1 %cmp49, i32 %b.3116, i32 %d.1118 %inc56 = add nsw i32 %b.4, 1 %conv30 = sitofp i32 %inc56 to double %cmp31 = fcmp ult double %6, %conv30 br i1 %cmp31, label %while.cond13.loopexit.loopexit, label %for.body33, !llvm.loop !17 for.body62: ; preds = %for.body62.preheader, %for.body62 %indvars.iv140 = phi i64 [ %5, %for.body62.preheader ], [ %indvars.iv.next141, %for.body62 ] %c.1129 = phi i32 [ %c.0.lcssa, %for.body62.preheader ], [ %spec.select101, %for.body62 ] %arrayidx64 = getelementptr inbounds [1000000 x i32], ptr @box, i64 0, i64 %indvars.iv140 %11 = load i32, ptr %arrayidx64, align 4, !tbaa !9 %cmp65.not = icmp ne i32 %11, -1 %inc68 = zext i1 %cmp65.not to i32 %spec.select101 = add nuw nsw i32 %c.1129, %inc68 %indvars.iv.next141 = add i64 %indvars.iv140, 1 %12 = trunc i64 %indvars.iv.next141 to i32 %conv59 = sitofp i32 %12 to double %cmp60 = fcmp ult double %4, %conv59 br i1 %cmp60, label %for.end72, label %for.body62, !llvm.loop !18 for.end72: ; preds = %for.body62, %for.cond58.preheader %c.1.lcssa = phi i32 [ %c.0.lcssa, %for.cond58.preheader ], [ %spec.select101, %for.body62 ] %call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.1.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end74, label %for.cond.preheader, !llvm.loop !19 while.end74: ; preds = %for.end72, %entry call void @llvm.lifetime.end.p0(i64 8, 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: 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 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 = { 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"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12} !15 = distinct !{!15, !12} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12} !18 = distinct !{!18, !12} !19 = distinct !{!19, !12}
#include<stdio.h> char is_prime[1000000]; int sum_prime[1000000]; int main() { int x, y; for (x = 0; x < 1000000; x ++) is_prime[x] = 1; is_prime[0] = 0; is_prime[1] = 0; for (x = 2; x < 1000; x ++) { if (is_prime[x] != 0) { for (y = x * x; y < 1000000; y += x) { is_prime[y] = 0; } } } for (x = 1; x < 1000000; x ++) { sum_prime[x] = sum_prime[x - 1] + is_prime[x]; } while (scanf("%d", &x) != EOF) { printf("%d\n", sum_prime[x]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181940/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181940/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" @is_prime = dso_local local_unnamed_addr global [1000000 x i8] zeroinitializer, align 16 @sum_prime = dso_local local_unnamed_addr global [1000000 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: %x = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000) @is_prime, i8 1, i64 1000000, i1 false), !tbaa !5 store i8 0, ptr @is_prime, align 16, !tbaa !5 store i8 0, ptr getelementptr inbounds ([1000000 x i8], ptr @is_prime, i64 0, i64 1), align 1, !tbaa !5 br label %for.body3 for.cond19.preheader: ; preds = %for.inc16 %.pre = load i32, ptr @sum_prime, align 16, !tbaa !8 br label %for.body22 for.body3: ; preds = %entry, %for.inc16 %indvars.iv61 = phi i64 [ 5, %entry ], [ %indvars.iv.next62, %for.inc16 ] %indvars.iv56 = phi i64 [ 2, %entry ], [ %indvars.iv.next57, %for.inc16 ] %indvars.iv54 = phi i32 [ 4, %entry ], [ %indvars.iv.next55, %for.inc16 ] %indvars65 = trunc i64 %indvars.iv56 to i32 %arrayidx5 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv56 %0 = load i8, ptr %arrayidx5, align 1, !tbaa !5 %cmp6.not = icmp ne i8 %0, 0 %mul = mul nsw i32 %indvars65, %indvars65 %cmp946 = icmp ult i32 %mul, 1000000 %or.cond = select i1 %cmp6.not, i1 %cmp946, i1 false br i1 %or.cond, label %for.body11.preheader, label %for.inc16 for.body11.preheader: ; preds = %for.body3 %1 = zext i32 %indvars.iv54 to i64 br label %for.body11 for.body11: ; preds = %for.body11.preheader, %for.body11 %indvars.iv58 = phi i64 [ %1, %for.body11.preheader ], [ %indvars.iv.next59, %for.body11 ] %arrayidx13 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv58 store i8 0, ptr %arrayidx13, align 1, !tbaa !5 %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, %indvars.iv56 %cmp9 = icmp ult i64 %indvars.iv.next59, 1000000 br i1 %cmp9, label %for.body11, label %for.inc16, !llvm.loop !10 for.inc16: ; preds = %for.body11, %for.body3 %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1 %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 2 %2 = trunc i64 %indvars.iv61 to i32 %indvars.iv.next55 = add i32 %indvars.iv54, %2 %exitcond.not = icmp eq i64 %indvars.iv.next57, 1000 br i1 %exitcond.not, label %for.cond19.preheader, label %for.body3, !llvm.loop !12 while.cond.preheader: ; preds = %for.body22 store i32 1000000, ptr %x, align 4, !tbaa !8 %call51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %cmp34.not52 = icmp eq i32 %call51, -1 br i1 %cmp34.not52, label %while.end, label %while.body for.body22: ; preds = %for.body22, %for.cond19.preheader %3 = phi i32 [ %.pre, %for.cond19.preheader ], [ %add28.2, %for.body22 ] %indvars.iv = phi i64 [ 1, %for.cond19.preheader ], [ %indvars.iv.next.2, %for.body22 ] %arrayidx26 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv %4 = load i8, ptr %arrayidx26, align 1, !tbaa !5 %conv27 = sext i8 %4 to i32 %add28 = add nsw i32 %3, %conv27 %arrayidx30 = getelementptr inbounds [1000000 x i32], ptr @sum_prime, i64 0, i64 %indvars.iv store i32 %add28, ptr %arrayidx30, align 4, !tbaa !8 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx26.1 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.next %5 = load i8, ptr %arrayidx26.1, align 1, !tbaa !5 %conv27.1 = sext i8 %5 to i32 %add28.1 = add nsw i32 %add28, %conv27.1 %arrayidx30.1 = getelementptr inbounds [1000000 x i32], ptr @sum_prime, i64 0, i64 %indvars.iv.next store i32 %add28.1, ptr %arrayidx30.1, align 4, !tbaa !8 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx26.2 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.next.1 %6 = load i8, ptr %arrayidx26.2, align 1, !tbaa !5 %conv27.2 = sext i8 %6 to i32 %add28.2 = add nsw i32 %add28.1, %conv27.2 %arrayidx30.2 = getelementptr inbounds [1000000 x i32], ptr @sum_prime, i64 0, i64 %indvars.iv.next.1 store i32 %add28.2, ptr %arrayidx30.2, align 4, !tbaa !8 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %exitcond68.not.2 = icmp eq i64 %indvars.iv.next.2, 1000000 br i1 %exitcond68.not.2, label %while.cond.preheader, label %for.body22, !llvm.loop !13 while.body: ; preds = %while.cond.preheader, %while.body %7 = load i32, ptr %x, align 4, !tbaa !8 %idxprom36 = sext i32 %7 to i64 %arrayidx37 = getelementptr inbounds [1000000 x i32], ptr @sum_prime, i64 0, i64 %idxprom36 %8 = load i32, ptr %arrayidx37, align 4, !tbaa !8 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x) %cmp34.not = icmp eq i32 %call, -1 br i1 %cmp34.not, label %while.end, label %while.body, !llvm.loop !14 while.end: ; preds = %while.body, %while.cond.preheader 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: 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) #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 nounwind willreturn memory(argmem: write) } 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, 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 M 1000000 int main(){ int n,c,i,j; char p[M]={1,1}; for(i=2;i*i<M;i++){ if(p[i])continue; for(j=i*i;j<M;j+=i)p[j]=1; } while(scanf("%d",&n)!=EOF){ for(c=n;n;n--)c-=p[n]; printf("%d\n",c); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181984/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181984/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 %p = alloca [1000000 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %p) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000) %p, i8 0, i64 1000000, i1 false) store i8 1, ptr %p, align 16 %0 = getelementptr inbounds <{ i8, i8, [999998 x i8] }>, ptr %p, i64 0, i32 1 store i8 1, ptr %0, align 1 br label %for.body while.cond.preheader: ; preds = %for.inc7 %call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp9.not35 = icmp eq i32 %call34, -1 br i1 %cmp9.not35, label %while.end, label %while.body for.body: ; preds = %entry, %for.inc7 %indvars.iv = phi i64 [ 2, %entry ], [ %indvars.iv.next, %for.inc7 ] %mul31 = phi i32 [ 4, %entry ], [ %mul, %for.inc7 ] %arrayidx = getelementptr inbounds [1000000 x i8], ptr %p, i64 0, i64 %indvars.iv %1 = load i8, ptr %arrayidx, align 1, !tbaa !5 %tobool.not = icmp eq i8 %1, 0 %cmp327 = icmp ult i32 %mul31, 1000000 %or.cond = and i1 %tobool.not, %cmp327 br i1 %or.cond, label %for.body4.preheader, label %for.inc7 for.body4.preheader: ; preds = %for.body %2 = zext i32 %mul31 to i64 br label %for.body4 for.body4: ; preds = %for.body4.preheader, %for.body4 %indvars.iv36 = phi i64 [ %2, %for.body4.preheader ], [ %indvars.iv.next37, %for.body4 ] %arrayidx6 = getelementptr inbounds [1000000 x i8], ptr %p, i64 0, i64 %indvars.iv36 store i8 1, ptr %arrayidx6, align 1, !tbaa !5 %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, %indvars.iv %cmp3 = icmp ult i64 %indvars.iv.next37, 1000000 br i1 %cmp3, label %for.body4, label %for.inc7, !llvm.loop !8 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, 1000 br i1 %exitcond.not, label %while.cond.preheader, label %for.body, !llvm.loop !10 while.body: ; preds = %while.cond.preheader, %for.end16 %4 = load i32, ptr %n, align 4, !tbaa !11 %tobool11.not32 = icmp eq i32 %4, 0 br i1 %tobool11.not32, label %for.end16, label %for.body12.preheader for.body12.preheader: ; preds = %while.body %5 = sext i32 %4 to i64 %6 = zext i32 %4 to i64 %min.iters.check = icmp ult i32 %4, 8 br i1 %min.iters.check, label %for.body12.preheader46, label %vector.ph vector.ph: ; preds = %for.body12.preheader %n.vec = and i64 %6, 4294967288 %ind.end = sub nsw i64 %5, %n.vec %7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %4, i64 0 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> [ %7, %vector.ph ], [ %13, %vector.body ] %vec.phi43 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ] %offset.idx = sub i64 %5, %index %8 = getelementptr inbounds [1000000 x i8], ptr %p, i64 0, i64 %offset.idx %9 = getelementptr inbounds i8, ptr %8, i64 -3 %wide.load = load <4 x i8>, ptr %9, align 1, !tbaa !5 %reverse = shufflevector <4 x i8> %wide.load, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %10 = getelementptr inbounds i8, ptr %8, i64 -7 %wide.load44 = load <4 x i8>, ptr %10, align 1, !tbaa !5 %reverse45 = shufflevector <4 x i8> %wide.load44, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %11 = sext <4 x i8> %reverse to <4 x i32> %12 = sext <4 x i8> %reverse45 to <4 x i32> %13 = sub <4 x i32> %vec.phi, %11 %14 = sub <4 x i32> %vec.phi43, %12 %index.next = add nuw i64 %index, 8 %15 = icmp eq i64 %index.next, %n.vec br i1 %15, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %14, %13 %16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %6 br i1 %cmp.n, label %for.cond10.for.end16_crit_edge, label %for.body12.preheader46 for.body12.preheader46: ; preds = %for.body12.preheader, %middle.block %indvars.iv40.ph = phi i64 [ %5, %for.body12.preheader ], [ %ind.end, %middle.block ] %c.033.ph = phi i32 [ %4, %for.body12.preheader ], [ %16, %middle.block ] br label %for.body12 for.body12: ; preds = %for.body12.preheader46, %for.body12 %indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.body12 ], [ %indvars.iv40.ph, %for.body12.preheader46 ] %c.033 = phi i32 [ %sub, %for.body12 ], [ %c.033.ph, %for.body12.preheader46 ] %arrayidx14 = getelementptr inbounds [1000000 x i8], ptr %p, i64 0, i64 %indvars.iv40 %17 = load i8, ptr %arrayidx14, align 1, !tbaa !5 %conv = sext i8 %17 to i32 %sub = sub nsw i32 %c.033, %conv %indvars.iv.next41 = add nsw i64 %indvars.iv40, -1 %18 = and i64 %indvars.iv.next41, 4294967295 %tobool11.not = icmp eq i64 %18, 0 br i1 %tobool11.not, label %for.cond10.for.end16_crit_edge, label %for.body12, !llvm.loop !16 for.cond10.for.end16_crit_edge: ; preds = %for.body12, %middle.block %sub.lcssa = phi i32 [ %16, %middle.block ], [ %sub, %for.body12 ] store i32 0, ptr %n, align 4, !tbaa !11 br label %for.end16 for.end16: ; preds = %for.cond10.for.end16_crit_edge, %while.body %c.0.lcssa = phi i32 [ %sub.lcssa, %for.cond10.for.end16_crit_edge ], [ 0, %while.body ] %call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp9.not = icmp eq i32 %call, -1 br i1 %cmp9.not, label %while.end, label %while.body, !llvm.loop !17 while.end: ; preds = %for.end16, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %p) #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.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 = { 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9} !11 = !{!12, !12, i64 0} !12 = !{!"int", !6, i64 0} !13 = distinct !{!13, !9, !14, !15} !14 = !{!"llvm.loop.isvectorized", i32 1} !15 = !{!"llvm.loop.unroll.runtime.disable"} !16 = distinct !{!16, !9, !15, !14} !17 = distinct !{!17, !9}
#include "stdio.h" #define MAX_N 999999 int is_prime[MAX_N+1]; int sieve(int n) { int p=0,i,j; for(i=0;i<=n;i++) is_prime[i]=1; is_prime[0]=is_prime[1]=0; for(i=2;i<=n;i++) { if(is_prime[i]) { p++; for(j=2*i;j<=n;j+=i) is_prime[j]=0; } } return p; } int main() { int n; while(scanf("%d",&n)!=EOF) { printf("%d\n",sieve(n)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182026/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182026/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" @is_prime = dso_local local_unnamed_addr global [1000000 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 norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @sieve(i32 noundef %n) local_unnamed_addr #0 { entry: %cmp.not29 = icmp slt i32 %n, 0 br i1 %cmp.not29, label %for.end.thread, label %for.body.preheader for.end.thread: ; preds = %entry store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @is_prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @is_prime, align 16, !tbaa !5 br label %for.end16 for.body.preheader: ; preds = %entry %0 = add nuw i32 %n, 1 %wide.trip.count = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %n, 7 br i1 %min.iters.check, label %for.body.preheader50, label %vector.ph vector.ph: ; preds = %for.body.preheader %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 ] %1 = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, label %for.body.preheader50 for.body.preheader50: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader50, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader50 ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %indvars.iv store i32 1, ptr %arrayidx, align 4, !tbaa !5 %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.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @is_prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @is_prime, align 16, !tbaa !5 %cmp2.not33 = icmp slt i32 %n, 2 br i1 %cmp2.not33, label %for.end16, label %for.body3.preheader for.body3.preheader: ; preds = %for.end %4 = add nuw i32 %n, 1 %wide.trip.count47 = zext i32 %4 to i64 br label %for.body3 for.body3: ; preds = %for.body3.preheader, %for.inc14 %indvars.iv40 = phi i64 [ 2, %for.body3.preheader ], [ %indvars.iv.next41, %for.inc14 ] %indvars.iv38 = phi i64 [ 4, %for.body3.preheader ], [ %indvars.iv.next39, %for.inc14 ] %p.034 = phi i32 [ 0, %for.body3.preheader ], [ %p.1, %for.inc14 ] %arrayidx5 = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %indvars.iv40 %5 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %tobool.not = icmp eq i32 %5, 0 br i1 %tobool.not, label %for.inc14, label %if.then if.then: ; preds = %for.body3 %inc6 = add nsw i32 %p.034, 1 %indvars.iv40.tr = trunc i64 %indvars.iv40 to i32 %6 = shl i32 %indvars.iv40.tr, 1 %cmp8.not31 = icmp sgt i32 %6, %n br i1 %cmp8.not31, label %for.inc14, label %for.body9 for.body9: ; preds = %if.then, %for.body9 %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body9 ], [ %indvars.iv38, %if.then ] %arrayidx11 = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %indvars.iv42 store i32 0, ptr %arrayidx11, align 4, !tbaa !5 %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, %indvars.iv40 %7 = trunc i64 %indvars.iv.next43 to i32 %cmp8.not = icmp sgt i32 %7, %n br i1 %cmp8.not, label %for.inc14, label %for.body9, !llvm.loop !14 for.inc14: ; preds = %for.body9, %if.then, %for.body3 %p.1 = phi i32 [ %p.034, %for.body3 ], [ %inc6, %if.then ], [ %inc6, %for.body9 ] %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1 %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 2 %exitcond48.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count47 br i1 %exitcond48.not, label %for.end16, label %for.body3, !llvm.loop !15 for.end16: ; preds = %for.inc14, %for.end.thread, %for.end %p.0.lcssa = phi i32 [ 0, %for.end ], [ 0, %for.end.thread ], [ %p.1, %for.inc14 ] ret i32 %p.0.lcssa } ; 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) #4 %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not4 = icmp eq i32 %call3, -1 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %sieve.exit %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not29.i = icmp slt i32 %0, 0 br i1 %cmp.not29.i, label %for.end.thread.i, label %for.body.preheader.i for.end.thread.i: ; preds = %while.body store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @is_prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @is_prime, align 16, !tbaa !5 br label %sieve.exit for.body.preheader.i: ; preds = %while.body %1 = add nuw i32 %0, 1 %wide.trip.count.i = zext i32 %1 to i64 %min.iters.check = icmp ult i32 %0, 7 br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph vector.ph: ; preds = %for.body.preheader.i %n.vec = and i64 %wide.trip.count.i, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %2 = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %4 = icmp eq i64 %index.next, %n.vec br i1 %4, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i br i1 %cmp.n, label %for.end.i, label %for.body.i.preheader for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block %indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ] br label %for.body.i for.body.i: ; preds = %for.body.i.preheader, %for.body.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ] %arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %indvars.iv.i store i32 1, ptr %arrayidx.i, align 4, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i br i1 %exitcond.not.i, label %for.end.i, label %for.body.i, !llvm.loop !17 for.end.i: ; preds = %for.body.i, %middle.block store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @is_prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @is_prime, align 16, !tbaa !5 %cmp2.not33.i = icmp slt i32 %0, 2 br i1 %cmp2.not33.i, label %sieve.exit, label %for.body3.i for.body3.i: ; preds = %for.end.i, %for.inc14.i %indvars.iv40.i = phi i64 [ %indvars.iv.next41.i, %for.inc14.i ], [ 2, %for.end.i ] %indvars.iv38.i = phi i64 [ %indvars.iv.next39.i, %for.inc14.i ], [ 4, %for.end.i ] %p.034.i = phi i32 [ %p.1.i, %for.inc14.i ], [ 0, %for.end.i ] %arrayidx5.i = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %indvars.iv40.i %5 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5 %tobool.not.i = icmp eq i32 %5, 0 br i1 %tobool.not.i, label %for.inc14.i, label %if.then.i if.then.i: ; preds = %for.body3.i %inc6.i = add nsw i32 %p.034.i, 1 %indvars.iv40.tr.i = trunc i64 %indvars.iv40.i to i32 %6 = shl i32 %indvars.iv40.tr.i, 1 %cmp8.not31.i = icmp sgt i32 %6, %0 br i1 %cmp8.not31.i, label %for.inc14.i, label %for.body9.i for.body9.i: ; preds = %if.then.i, %for.body9.i %indvars.iv42.i = phi i64 [ %indvars.iv.next43.i, %for.body9.i ], [ %indvars.iv38.i, %if.then.i ] %arrayidx11.i = getelementptr inbounds [1000000 x i32], ptr @is_prime, i64 0, i64 %indvars.iv42.i store i32 0, ptr %arrayidx11.i, align 4, !tbaa !5 %indvars.iv.next43.i = add nuw nsw i64 %indvars.iv42.i, %indvars.iv40.i %7 = trunc i64 %indvars.iv.next43.i to i32 %cmp8.not.i = icmp slt i32 %0, %7 br i1 %cmp8.not.i, label %for.inc14.i, label %for.body9.i, !llvm.loop !14 for.inc14.i: ; preds = %for.body9.i, %if.then.i, %for.body3.i %p.1.i = phi i32 [ %p.034.i, %for.body3.i ], [ %inc6.i, %if.then.i ], [ %inc6.i, %for.body9.i ] %indvars.iv.next41.i = add nuw nsw i64 %indvars.iv40.i, 1 %indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 2 %exitcond48.not.i = icmp eq i64 %indvars.iv.next41.i, %wide.trip.count.i br i1 %exitcond48.not.i, label %sieve.exit, label %for.body3.i, !llvm.loop !15 sieve.exit: ; preds = %for.inc14.i, %for.end.thread.i, %for.end.i %p.0.lcssa.i = phi i32 [ 0, %for.end.i ], [ 0, %for.end.thread.i ], [ %p.1.i, %for.inc14.i ] %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %p.0.lcssa.i) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18 while.end: ; preds = %sieve.exit, %entry 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 norecurse 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 = { 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, !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, !11, !12} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10}
#include <stdio.h> #include <math.h> int is_prime1(int); int is_prime2(int); int prime[168]; int main() { int input_count; int prime_count; int input; int cnt; int output[30]; int prime_cnt; /*Make prime table*/ prime[0] = 2; prime_cnt = 1; for(cnt = 3; cnt < 1000; cnt += 2) { if(is_prime1(cnt)) { prime[prime_cnt] = cnt; prime_cnt++; } } /*Get, calculate input then save in output[]*/ input_count = 0; while(scanf("%d", &input) != EOF) { prime_count = 0; if(input >= 2) { prime_count++; } for(cnt = 3; cnt <= input; cnt += 2) { if(is_prime2(cnt)) { prime_count++; } } output[input_count] = prime_count; input_count++; } /*print output[]*/ for(cnt = 0; cnt < input_count; cnt++) { printf("%d\n", output[cnt]); } return 0; } int is_prime1(int prime1_input) { int prime1_cnt; if(prime1_input == 1) { return 0; } else if(prime1_input == 2 || prime1_input == 3 || prime1_input == 5 || prime1_input == 7) { return 1; } for(prime1_cnt = 3 ; prime1_cnt <= (sqrt(prime1_input)); prime1_cnt += 2) { if(prime1_input % prime1_cnt == 0) { return 0; } } return 1; } int is_prime2(int prime2_input) { int prime2_cnt = 0; for( ;prime2_cnt <168; prime2_cnt++) { if(prime[prime2_cnt] > sqrt(prime2_input)) { break; } if(prime2_input % prime[prime2_cnt] == 0) { return 0; } } return 1; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182077/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182077/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" @prime = dso_local local_unnamed_addr global [168 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 @switch.table.is_prime1 = private unnamed_addr constant [7 x i32] [i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1], align 4 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %input = alloca i32, align 4 %output = alloca [30 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #6 call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %output) #6 store i32 2, ptr @prime, align 16, !tbaa !5 br label %for.body while.cond.preheader: ; preds = %for.inc %call162 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input) %cmp2.not63 = icmp eq i32 %call162, -1 br i1 %cmp2.not63, label %for.end29, label %while.body for.body: ; preds = %entry, %for.inc %prime_cnt.057 = phi i32 [ 1, %entry ], [ %prime_cnt.1, %for.inc ] %cnt.056 = phi i32 [ 3, %entry ], [ %add, %for.inc ] switch i32 %cnt.056, label %for.cond.preheader.i [ i32 2, label %if.then i32 7, label %if.then i32 5, label %if.then i32 3, label %if.then ] for.cond.preheader.i: ; preds = %for.body %conv9.i = sitofp i32 %cnt.056 to double %call26.i = tail call double @sqrt(double noundef %conv9.i) #6 %cmp1027.i = fcmp ult double %call26.i, 3.000000e+00 br i1 %cmp1027.i, label %if.then, label %for.body.i for.cond.i: ; preds = %for.body.i %add.i = add nuw nsw i32 %prime1_cnt.028.i, 2 %conv.i = sitofp i32 %add.i to double %call.i = tail call double @sqrt(double noundef %conv9.i) #6 %cmp10.i = fcmp ult double %call.i, %conv.i br i1 %cmp10.i, label %if.then, label %for.body.i, !llvm.loop !9 for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i %prime1_cnt.028.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ] %rem.i = urem i32 %cnt.056, %prime1_cnt.028.i %cmp12.i = icmp eq i32 %rem.i, 0 br i1 %cmp12.i, label %for.inc, label %for.cond.i if.then: ; preds = %for.cond.i, %for.body, %for.body, %for.body, %for.body, %for.cond.preheader.i %idxprom = sext i32 %prime_cnt.057 to i64 %arrayidx = getelementptr inbounds [168 x i32], ptr @prime, i64 0, i64 %idxprom store i32 %cnt.056, ptr %arrayidx, align 4, !tbaa !5 %inc = add nsw i32 %prime_cnt.057, 1 br label %for.inc for.inc: ; preds = %for.body.i, %if.then %prime_cnt.1 = phi i32 [ %inc, %if.then ], [ %prime_cnt.057, %for.body.i ] %add = add nuw nsw i32 %cnt.056, 2 %cmp = icmp ult i32 %cnt.056, 998 br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11 for.cond21.preheader: ; preds = %for.end17 %0 = and i64 %indvars.iv.next, 4294967295 %cmp2266.not = icmp eq i64 %0, 0 br i1 %cmp2266.not, label %for.end29, label %for.body23.preheader for.body23.preheader: ; preds = %for.cond21.preheader %wide.trip.count = and i64 %indvars.iv.next, 4294967295 br label %for.body23 while.body: ; preds = %while.cond.preheader, %for.end17 %indvars.iv = phi i64 [ %indvars.iv.next, %for.end17 ], [ 0, %while.cond.preheader ] %1 = load i32, ptr %input, align 4, !tbaa !5 %cmp3 = icmp sgt i32 %1, 1 %spec.select = zext i1 %cmp3 to i32 %cmp8.not58 = icmp slt i32 %1, 3 br i1 %cmp8.not58, label %for.end17, label %for.body9 for.body9: ; preds = %while.body, %for.cond7 %cnt.160 = phi i32 [ %add16, %for.cond7 ], [ 3, %while.body ] %prime_count.159 = phi i32 [ %4, %for.cond7 ], [ %spec.select, %while.body ] %conv1.i = sitofp i32 %cnt.160 to double br label %for.body.i45 for.cond.i49: ; preds = %if.end.i %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %exitcond.not.i = icmp eq i64 %indvars.iv.next.i, 168 br i1 %exitcond.not.i, label %is_prime2.exit.thread, label %for.body.i45, !llvm.loop !12 for.body.i45: ; preds = %for.cond.i49, %for.body9 %indvars.iv.i = phi i64 [ 0, %for.body9 ], [ %indvars.iv.next.i, %for.cond.i49 ] %arrayidx.i = getelementptr inbounds [168 x i32], ptr @prime, i64 0, i64 %indvars.iv.i %2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %conv.i46 = sitofp i32 %2 to double %call.i47 = call double @sqrt(double noundef %conv1.i) #6 %cmp2.i = fcmp olt double %call.i47, %conv.i46 br i1 %cmp2.i, label %is_prime2.exit.thread, label %if.end.i if.end.i: ; preds = %for.body.i45 %3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5 %rem.i48 = srem i32 %cnt.160, %3 %cmp6.i = icmp eq i32 %rem.i48, 0 br i1 %cmp6.i, label %for.cond7, label %for.cond.i49 is_prime2.exit.thread: ; preds = %for.body.i45, %for.cond.i49 %inc1355 = add nsw i32 %prime_count.159, 1 br label %for.cond7 for.cond7: ; preds = %if.end.i, %is_prime2.exit.thread %4 = phi i32 [ %inc1355, %is_prime2.exit.thread ], [ %prime_count.159, %if.end.i ] %add16 = add nuw nsw i32 %cnt.160, 2 %5 = load i32, ptr %input, align 4, !tbaa !5 %cmp8.not = icmp sgt i32 %add16, %5 br i1 %cmp8.not, label %for.end17, label %for.body9, !llvm.loop !13 for.end17: ; preds = %for.cond7, %while.body %prime_count.1.lcssa = phi i32 [ %spec.select, %while.body ], [ %4, %for.cond7 ] %arrayidx19 = getelementptr inbounds [30 x i32], ptr %output, i64 0, i64 %indvars.iv store i32 %prime_count.1.lcssa, ptr %arrayidx19, align 4, !tbaa !5 %indvars.iv.next = add nuw i64 %indvars.iv, 1 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input) %cmp2.not = icmp eq i32 %call1, -1 br i1 %cmp2.not, label %for.cond21.preheader, label %while.body, !llvm.loop !14 for.body23: ; preds = %for.body23.preheader, %for.body23 %indvars.iv69 = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next70, %for.body23 ] %arrayidx25 = getelementptr inbounds [30 x i32], ptr %output, i64 0, i64 %indvars.iv69 %6 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6) %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1 %exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count br i1 %exitcond.not, label %for.end29, label %for.body23, !llvm.loop !15 for.end29: ; preds = %for.body23, %while.cond.preheader, %for.cond21.preheader call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %output) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input) #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 memory(write) uwtable define dso_local i32 @is_prime1(i32 noundef %prime1_input) local_unnamed_addr #2 { entry: %switch.tableidx = add i32 %prime1_input, -1 %0 = icmp ult i32 %switch.tableidx, 7 br i1 %0, label %switch.hole_check, label %for.cond.preheader for.cond.preheader: ; preds = %switch.hole_check, %entry %conv9 = sitofp i32 %prime1_input to double %call26 = tail call double @sqrt(double noundef %conv9) #6 %cmp1027 = fcmp ult double %call26, 3.000000e+00 br i1 %cmp1027, label %cleanup, label %for.body for.cond: ; preds = %for.body %add = add nuw nsw i32 %prime1_cnt.028, 2 %conv = sitofp i32 %add to double %call = tail call double @sqrt(double noundef %conv9) #6 %cmp10 = fcmp ult double %call, %conv br i1 %cmp10, label %cleanup, label %for.body, !llvm.loop !9 for.body: ; preds = %for.cond.preheader, %for.cond %prime1_cnt.028 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ] %rem = srem i32 %prime1_input, %prime1_cnt.028 %cmp12 = icmp eq i32 %rem, 0 br i1 %cmp12, label %cleanup, label %for.cond switch.hole_check: ; preds = %entry %switch.maskindex = trunc i32 %switch.tableidx to i8 %switch.shifted = lshr i8 87, %switch.maskindex %1 = and i8 %switch.shifted, 1 %switch.lobit.not = icmp eq i8 %1, 0 br i1 %switch.lobit.not, label %for.cond.preheader, label %switch.lookup switch.lookup: ; preds = %switch.hole_check %2 = sext i32 %switch.tableidx to i64 %switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.is_prime1, i64 0, i64 %2 %switch.load = load i32, ptr %switch.gep, align 4 br label %cleanup cleanup: ; preds = %for.body, %for.cond, %switch.lookup, %for.cond.preheader %retval.0 = phi i32 [ 1, %for.cond.preheader ], [ %switch.load, %switch.lookup ], [ 0, %for.body ], [ 1, %for.cond ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable define dso_local i32 @is_prime2(i32 noundef %prime2_input) local_unnamed_addr #4 { entry: %conv1 = sitofp i32 %prime2_input to double br label %for.body for.cond: ; preds = %if.end %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 168 br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !12 for.body: ; preds = %entry, %for.cond %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.cond ] %arrayidx = getelementptr inbounds [168 x i32], ptr @prime, i64 0, i64 %indvars.iv %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %conv = sitofp i32 %0 to double %call = tail call double @sqrt(double noundef %conv1) #6 %cmp2 = fcmp olt double %call, %conv br i1 %cmp2, label %cleanup, label %if.end if.end: ; preds = %for.body %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %rem = srem i32 %prime2_input, %1 %cmp6 = icmp eq i32 %rem, 0 br i1 %cmp6, label %cleanup, label %for.cond cleanup: ; preds = %for.cond, %for.body, %if.end %retval.0 = phi i32 [ 0, %if.end ], [ 1, %for.body ], [ 1, %for.cond ] ret i32 %retval.0 } ; 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: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double 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 memory(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 #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 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 #5 = { 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 #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} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10}
#include <stdio.h> #include <math.h> int main(){ int t,x,y,move; float d; scanf("%d",&t); while(t--){ scanf("%d %d",&x,&y); d=sqrt(x*x+y*y); if(d==0){ move=0; } else if((int)d==d){ move=1; } else{ move=2; } printf("%d\n",move); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18212/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18212/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"%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: %t = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec16 = add nsw i32 %0, -1 store i32 %dec16, ptr %t, align 4, !tbaa !5 %tobool.not17 = icmp eq i32 %0, 0 br i1 %tobool.not17, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %1 = load i32, ptr %x, align 4, !tbaa !5 %mul = mul nsw i32 %1, %1 %2 = load i32, ptr %y, align 4, !tbaa !5 %mul2 = mul nsw i32 %2, %2 %add = add nuw nsw i32 %mul2, %mul %conv = sitofp i32 %add to double %call3 = call double @sqrt(double noundef %conv) #4 %conv4 = fptrunc double %call3 to float %cmp = fcmp oeq float %conv4, 0.000000e+00 %conv6 = fptosi float %conv4 to i32 %conv7 = sitofp i32 %conv6 to float %cmp8 = fcmp oeq float %conv7, %conv4 %. = select i1 %cmp8, i32 1, i32 2 %move.0 = select i1 %cmp, i32 0, i32 %. %call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %move.0) %3 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #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(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 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 = { 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<math.h> #define MAX 1000000 int main(){ int n; int i,j,k,l; int count; int S[MAX]; int T[MAX]; for(i=0;i<MAX;i++){S[i]=1;} S[0]=0; S[1]=0; for(i=2;i*i<MAX;i++){ if(S[i]==1){ for(j=i*2;j<MAX;j+=i){S[j]=0;} } } T[0]=0; T[1]=0; for(i=2;i<MAX;i++){ T[i]=T[i-1]+S[i];} while(scanf("%d",&n)!=EOF){ printf("%d\n",T[n]); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182163/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182163/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 %S = alloca [1000000 x i32], align 16 %T = alloca [1000000 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %S) #3 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %T) #3 br label %vector.body vector.body: ; preds = %vector.body, %entry %index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ] %0 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5 %index.next = add nuw nsw i64 %index, 8 %2 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %index.next store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5 %index.next.1 = add nuw nsw i64 %index, 16 %4 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %index.next.1 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5 %index.next.2 = add nuw nsw i64 %index, 24 %6 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %index.next.2 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds i32, ptr %6, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5 %index.next.3 = add nuw nsw i64 %index, 32 %8 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %index.next.3 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5 %9 = getelementptr inbounds i32, ptr %8, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5 %index.next.4 = add nuw nsw i64 %index, 40 %10 = icmp eq i64 %index.next.4, 1000000 br i1 %10, label %for.end, label %vector.body, !llvm.loop !9 for.end: ; preds = %vector.body %arrayidx2 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 1 store i32 0, ptr %arrayidx2, align 4, !tbaa !5 br label %for.body5 for.body5: ; preds = %for.inc17.1, %for.end %indvars.iv64 = phi i64 [ 2, %for.end ], [ %indvars.iv.next65.1, %for.inc17.1 ] %indvars.iv62 = phi i64 [ 4, %for.end ], [ %indvars.iv.next63.1, %for.inc17.1 ] %arrayidx7 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv64 %11 = load i32, ptr %arrayidx7, align 8, !tbaa !5 %cmp8 = icmp eq i32 %11, 1 br i1 %cmp8, label %for.body12, label %for.inc17 for.body12: ; preds = %for.body5, %for.body12 %indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body12 ], [ %indvars.iv62, %for.body5 ] %arrayidx14 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv66 store i32 0, ptr %arrayidx14, align 8, !tbaa !5 %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, %indvars.iv64 %cmp11 = icmp ult i64 %indvars.iv.next67, 1000000 br i1 %cmp11, label %for.body12, label %for.inc17, !llvm.loop !13 for.inc17: ; preds = %for.body12, %for.body5 %indvars.iv.next65 = or i64 %indvars.iv64, 1 %arrayidx7.1 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv.next65 %12 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5 %cmp8.1 = icmp eq i32 %12, 1 br i1 %cmp8.1, label %for.body12.preheader.1, label %for.inc17.1 for.body12.preheader.1: ; preds = %for.inc17 %indvars.iv.next63 = or i64 %indvars.iv62, 2 br label %for.body12.1 for.body12.1: ; preds = %for.body12.1, %for.body12.preheader.1 %indvars.iv66.1 = phi i64 [ %indvars.iv.next67.1, %for.body12.1 ], [ %indvars.iv.next63, %for.body12.preheader.1 ] %arrayidx14.1 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv66.1 store i32 0, ptr %arrayidx14.1, align 4, !tbaa !5 %indvars.iv.next67.1 = add nuw nsw i64 %indvars.iv66.1, %indvars.iv.next65 %cmp11.1 = icmp ult i64 %indvars.iv.next67.1, 1000000 br i1 %cmp11.1, label %for.body12.1, label %for.inc17.1, !llvm.loop !13 for.inc17.1: ; preds = %for.body12.1, %for.inc17 %indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 2 %indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 4 %exitcond70.not.1 = icmp eq i64 %indvars.iv.next65.1, 1000 br i1 %exitcond70.not.1, label %for.end19, label %for.body5, !llvm.loop !14 for.end19: ; preds = %for.inc17.1 store i32 0, ptr %T, align 16, !tbaa !5 %arrayidx21 = getelementptr inbounds [1000000 x i32], ptr %T, i64 0, i64 1 store i32 0, ptr %arrayidx21, align 4, !tbaa !5 br label %for.body24 while.cond.preheader: ; preds = %for.body24 %call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp35.not60 = icmp eq i32 %call59, -1 br i1 %cmp35.not60, label %while.end, label %while.body for.body24: ; preds = %for.body24, %for.end19 %13 = phi i32 [ 0, %for.end19 ], [ %add29.1, %for.body24 ] %indvars.iv71 = phi i64 [ 2, %for.end19 ], [ %indvars.iv.next72.1, %for.body24 ] %arrayidx28 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv71 %14 = load i32, ptr %arrayidx28, align 8, !tbaa !5 %add29 = add nsw i32 %14, %13 %arrayidx31 = getelementptr inbounds [1000000 x i32], ptr %T, i64 0, i64 %indvars.iv71 store i32 %add29, ptr %arrayidx31, align 8, !tbaa !5 %indvars.iv.next72 = or i64 %indvars.iv71, 1 %arrayidx28.1 = getelementptr inbounds [1000000 x i32], ptr %S, i64 0, i64 %indvars.iv.next72 %15 = load i32, ptr %arrayidx28.1, align 4, !tbaa !5 %add29.1 = add nsw i32 %15, %add29 %arrayidx31.1 = getelementptr inbounds [1000000 x i32], ptr %T, i64 0, i64 %indvars.iv.next72 store i32 %add29.1, ptr %arrayidx31.1, align 4, !tbaa !5 %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71, 2 %exitcond75.not.1 = icmp eq i64 %indvars.iv.next72.1, 1000000 br i1 %exitcond75.not.1, label %while.cond.preheader, label %for.body24, !llvm.loop !15 while.body: ; preds = %while.cond.preheader, %while.body %16 = load i32, ptr %n, align 4, !tbaa !5 %idxprom36 = sext i32 %16 to i64 %arrayidx37 = getelementptr inbounds [1000000 x i32], ptr %T, i64 0, i64 %idxprom36 %17 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp35.not = icmp eq i32 %call, -1 br i1 %cmp35.not, label %while.end, label %while.body, !llvm.loop !16 while.end: ; preds = %while.body, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %T) #3 call void @llvm.lifetime.end.p0(i64 4000000, 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 = 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} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10}
#include <stdio.h> #include <string.h> #define MAX (1000000) int main(void) { char flag[MAX + 1]; int count; int i, j; int input; memset(flag, 1, MAX); flag[0] = flag[1] = 0; for (i = 2; i <= 1001; i++) if (flag[i]) for (j = i * 2; j <= MAX; j += i) flag[j] = 0; while (scanf("%d", &input) != EOF){ count = 0; for (i = 0; i <= input; i++) if (flag[i]) count++; printf("%d\n", count); } return (0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182235/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182235/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: %flag = alloca [1000001 x i8], align 16 %input = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 1000001, ptr nonnull %flag) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000000) %flag, i8 1, i64 1000000, i1 false) %arrayidx = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 1 store i8 0, ptr %arrayidx, align 1, !tbaa !5 store i8 0, ptr %flag, align 16, !tbaa !5 br label %for.body while.cond.preheader: ; preds = %for.inc8.1 %call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input) %cmp10.not42 = icmp eq i32 %call41, -1 br i1 %cmp10.not42, label %while.end, label %for.cond11.preheader for.body: ; preds = %for.inc8.1, %entry %indvars.iv43 = phi i64 [ 2, %entry ], [ %indvars.iv.next44.1, %for.inc8.1 ] %indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next.1, %for.inc8.1 ] %arrayidx2 = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 %indvars.iv43 %0 = load i8, ptr %arrayidx2, align 2, !tbaa !5 %tobool.not.not = icmp eq i8 %0, 0 br i1 %tobool.not.not, label %for.inc8, label %for.body5 for.body5: ; preds = %for.body, %for.body5 %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body5 ], [ %indvars.iv, %for.body ] %arrayidx7 = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 %indvars.iv45 store i8 0, ptr %arrayidx7, align 2, !tbaa !5 %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, %indvars.iv43 %cmp4 = icmp ult i64 %indvars.iv.next46, 1000001 br i1 %cmp4, label %for.body5, label %for.inc8, !llvm.loop !8 for.inc8: ; preds = %for.body5, %for.body %indvars.iv.next44 = or i64 %indvars.iv43, 1 %arrayidx2.1 = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 %indvars.iv.next44 %1 = load i8, ptr %arrayidx2.1, align 1, !tbaa !5 %tobool.not.not.1 = icmp eq i8 %1, 0 br i1 %tobool.not.not.1, label %for.inc8.1, label %for.body5.preheader.1 for.body5.preheader.1: ; preds = %for.inc8 %indvars.iv.next = or i64 %indvars.iv, 2 br label %for.body5.1 for.body5.1: ; preds = %for.body5.1, %for.body5.preheader.1 %indvars.iv45.1 = phi i64 [ %indvars.iv.next46.1, %for.body5.1 ], [ %indvars.iv.next, %for.body5.preheader.1 ] %arrayidx7.1 = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 %indvars.iv45.1 store i8 0, ptr %arrayidx7.1, align 1, !tbaa !5 %indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45.1, %indvars.iv.next44 %cmp4.1 = icmp ult i64 %indvars.iv.next46.1, 1000001 br i1 %cmp4.1, label %for.body5.1, label %for.inc8.1, !llvm.loop !8 for.inc8.1: ; preds = %for.body5.1, %for.inc8 %indvars.iv.next44.1 = add nuw nsw i64 %indvars.iv43, 2 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 4 %exitcond.not.1 = icmp eq i64 %indvars.iv.next44.1, 1002 br i1 %exitcond.not.1, label %while.cond.preheader, label %for.body, !llvm.loop !10 for.cond11.preheader: ; preds = %while.cond.preheader, %for.end22 %2 = load i32, ptr %input, align 4, !tbaa !11 %cmp12.not38 = icmp slt i32 %2, 0 br i1 %cmp12.not38, label %for.end22, label %for.body13.preheader for.body13.preheader: ; preds = %for.cond11.preheader %3 = add nuw i32 %2, 1 %wide.trip.count = zext i32 %3 to i64 %min.iters.check = icmp ult i32 %2, 7 br i1 %min.iters.check, label %for.body13.preheader55, label %vector.ph vector.ph: ; preds = %for.body13.preheader %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 ], [ %10, %vector.body ] %vec.phi53 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %4 = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 %index %wide.load = load <4 x i8>, ptr %4, align 8, !tbaa !5 %5 = getelementptr inbounds i8, ptr %4, i64 4 %wide.load54 = load <4 x i8>, ptr %5, align 4, !tbaa !5 %6 = icmp ne <4 x i8> %wide.load, zeroinitializer %7 = icmp ne <4 x i8> %wide.load54, zeroinitializer %8 = zext <4 x i1> %6 to <4 x i32> %9 = zext <4 x i1> %7 to <4 x i32> %10 = add <4 x i32> %vec.phi, %8 %11 = add <4 x i32> %vec.phi53, %9 %index.next = add nuw i64 %index, 8 %12 = icmp eq i64 %index.next, %n.vec br i1 %12, label %middle.block, label %vector.body, !llvm.loop !13 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %11, %10 %13 = 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.end22, label %for.body13.preheader55 for.body13.preheader55: ; preds = %for.body13.preheader, %middle.block %indvars.iv49.ph = phi i64 [ 0, %for.body13.preheader ], [ %n.vec, %middle.block ] %count.039.ph = phi i32 [ 0, %for.body13.preheader ], [ %13, %middle.block ] br label %for.body13 for.body13: ; preds = %for.body13.preheader55, %for.body13 %indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.body13 ], [ %indvars.iv49.ph, %for.body13.preheader55 ] %count.039 = phi i32 [ %spec.select, %for.body13 ], [ %count.039.ph, %for.body13.preheader55 ] %arrayidx15 = getelementptr inbounds [1000001 x i8], ptr %flag, i64 0, i64 %indvars.iv49 %14 = load i8, ptr %arrayidx15, align 1, !tbaa !5 %tobool16.not = icmp ne i8 %14, 0 %inc18 = zext i1 %tobool16.not to i32 %spec.select = add nuw nsw i32 %count.039, %inc18 %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1 %exitcond52.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count br i1 %exitcond52.not, label %for.end22, label %for.body13, !llvm.loop !16 for.end22: ; preds = %for.body13, %middle.block, %for.cond11.preheader %count.0.lcssa = phi i32 [ 0, %for.cond11.preheader ], [ %13, %middle.block ], [ %spec.select, %for.body13 ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input) %cmp10.not = icmp eq i32 %call, -1 br i1 %cmp10.not, label %while.end, label %for.cond11.preheader, !llvm.loop !17 while.end: ; preds = %for.end22, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input) #5 call void @llvm.lifetime.end.p0(i64 1000001, ptr nonnull %flag) #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.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 = { 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 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = distinct !{!10, !9} !11 = !{!12, !12, i64 0} !12 = !{!"int", !6, i64 0} !13 = distinct !{!13, !9, !14, !15} !14 = !{!"llvm.loop.isvectorized", i32 1} !15 = !{!"llvm.loop.unroll.runtime.disable"} !16 = distinct !{!16, !9, !15, !14} !17 = distinct !{!17, !9}
#include<stdio.h> #define M 1000000 int main(void){ int i,j; int n; int array[M][2]; int count; for(i=0;i<M;i++){ array[i][0]=i+1; array[i][1]=1; } array[0][1]=0; for(i=1;i<M;i++) if(array[i][1]){ for(j=i;j<M;j+=(i+1)) array[j][1]=0; array[i][1]=1; } for(;scanf("%d",&n)==1;){ count=0; for(i=0;i<n;i++) if(array[i][1]) count++; printf("%d\n",count); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182307/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182307/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 %array = alloca [1000000 x [2 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 %array) #4 br label %vector.body vector.body: ; preds = %vector.body, %entry %index = phi i64 [ 0, %entry ], [ %index.next.1, %vector.body ] %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %entry ], [ %vec.ind.next.1, %vector.body ] %0 = or i64 %index, 2 %1 = trunc <2 x i64> %vec.ind to <2 x i32> %2 = add <2 x i32> %1, <i32 1, i32 1> %3 = trunc <2 x i64> %vec.ind to <2 x i32> %4 = add <2 x i32> %3, <i32 3, i32 3> %5 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %index %6 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %0 %interleaved.vec = shufflevector <2 x i32> %2, <2 x i32> <i32 1, i32 1>, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec, ptr %5, align 16, !tbaa !5 %interleaved.vec88 = shufflevector <2 x i32> %4, <2 x i32> <i32 1, i32 1>, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec88, ptr %6, align 16, !tbaa !5 %index.next = or i64 %index, 4 %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4> %7 = or i64 %index, 6 %8 = trunc <2 x i64> %vec.ind.next to <2 x i32> %9 = add <2 x i32> %8, <i32 1, i32 1> %10 = trunc <2 x i64> %vec.ind.next to <2 x i32> %11 = add <2 x i32> %10, <i32 3, i32 3> %12 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %index.next %13 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %7 %interleaved.vec.1 = shufflevector <2 x i32> %9, <2 x i32> <i32 1, i32 1>, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec.1, ptr %12, align 16, !tbaa !5 %interleaved.vec88.1 = shufflevector <2 x i32> %11, <2 x i32> <i32 1, i32 1>, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec88.1, ptr %13, align 16, !tbaa !5 %index.next.1 = add nuw nsw i64 %index, 8 %vec.ind.next.1 = add <2 x i64> %vec.ind, <i64 8, i64 8> %14 = icmp eq i64 %index.next.1, 1000000 br i1 %14, label %for.end, label %vector.body, !llvm.loop !9 for.end: ; preds = %vector.body %arrayidx6 = getelementptr inbounds [2 x i32], ptr %array, i64 0, i64 1 store i32 0, ptr %arrayidx6, align 4, !tbaa !5 br label %for.body9 for.cond29.preheader: ; preds = %for.inc26 %call71 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp3072 = icmp eq i32 %call71, 1 br i1 %cmp3072, label %for.cond32.preheader, label %for.end46 for.body9: ; preds = %for.end, %for.inc26 %indvars.iv76 = phi i64 [ 2, %for.end ], [ %indvars.iv.next77, %for.inc26 ] %indvars.iv74 = phi i64 [ 1, %for.end ], [ %indvars.iv.next75, %for.inc26 ] %arrayidx12 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %indvars.iv74, i64 1 %15 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %tobool.not = icmp eq i32 %15, 0 br i1 %tobool.not, label %for.inc26, label %for.body15 for.body15: ; preds = %for.body9, %for.body15 %indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body15 ], [ %indvars.iv74, %for.body9 ] %arrayidx18 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %indvars.iv78, i64 1 store i32 0, ptr %arrayidx18, align 4, !tbaa !5 %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, %indvars.iv76 %cmp14 = icmp ult i64 %indvars.iv.next79, 1000000 br i1 %cmp14, label %for.body15, label %for.end22, !llvm.loop !13 for.end22: ; preds = %for.body15 store i32 1, ptr %arrayidx12, align 4, !tbaa !5 br label %for.inc26 for.inc26: ; preds = %for.body9, %for.end22 %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1 %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1 %exitcond82.not = icmp eq i64 %indvars.iv.next77, 1000001 br i1 %exitcond82.not, label %for.cond29.preheader, label %for.body9, !llvm.loop !14 for.cond32.preheader: ; preds = %for.cond29.preheader, %for.end44 %16 = load i32, ptr %n, align 4, !tbaa !5 %cmp3368 = icmp sgt i32 %16, 0 br i1 %cmp3368, label %for.body34.preheader, label %for.end44 for.body34.preheader: ; preds = %for.cond32.preheader %wide.trip.count = zext i32 %16 to i64 %min.iters.check = icmp ult i32 %16, 9 br i1 %min.iters.check, label %for.body34.preheader99, label %vector.ph91 vector.ph91: ; preds = %for.body34.preheader %n.mod.vf = and i64 %wide.trip.count, 7 %17 = icmp eq i64 %n.mod.vf, 0 %18 = select i1 %17, i64 8, i64 %n.mod.vf %n.vec = sub nsw i64 %wide.trip.count, %18 br label %vector.body93 vector.body93: ; preds = %vector.body93, %vector.ph91 %index94 = phi i64 [ 0, %vector.ph91 ], [ %index.next98, %vector.body93 ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph91 ], [ %26, %vector.body93 ] %vec.phi95 = phi <4 x i32> [ zeroinitializer, %vector.ph91 ], [ %27, %vector.body93 ] %19 = or i64 %index94, 4 %20 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %index94, i64 1 %21 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %19, i64 1 %wide.vec = load <8 x i32>, ptr %20, align 4, !tbaa !5 %wide.vec96 = load <8 x i32>, ptr %21, align 4, !tbaa !5 %strided.vec = shufflevector <8 x i32> %wide.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6> %strided.vec97 = shufflevector <8 x i32> %wide.vec96, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6> %22 = icmp ne <4 x i32> %strided.vec, zeroinitializer %23 = icmp ne <4 x i32> %strided.vec97, zeroinitializer %24 = zext <4 x i1> %22 to <4 x i32> %25 = zext <4 x i1> %23 to <4 x i32> %26 = add <4 x i32> %vec.phi, %24 %27 = add <4 x i32> %vec.phi95, %25 %index.next98 = add nuw i64 %index94, 8 %28 = icmp eq i64 %index.next98, %n.vec br i1 %28, label %middle.block89, label %vector.body93, !llvm.loop !15 middle.block89: ; preds = %vector.body93 %bin.rdx = add <4 x i32> %27, %26 %29 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) br label %for.body34.preheader99 for.body34.preheader99: ; preds = %for.body34.preheader, %middle.block89 %indvars.iv83.ph = phi i64 [ 0, %for.body34.preheader ], [ %n.vec, %middle.block89 ] %count.070.ph = phi i32 [ 0, %for.body34.preheader ], [ %29, %middle.block89 ] br label %for.body34 for.body34: ; preds = %for.body34.preheader99, %for.body34 %indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body34 ], [ %indvars.iv83.ph, %for.body34.preheader99 ] %count.070 = phi i32 [ %spec.select, %for.body34 ], [ %count.070.ph, %for.body34.preheader99 ] %arrayidx37 = getelementptr inbounds [1000000 x [2 x i32]], ptr %array, i64 0, i64 %indvars.iv83, i64 1 %30 = load i32, ptr %arrayidx37, align 4, !tbaa !5 %tobool38.not = icmp ne i32 %30, 0 %inc40 = zext i1 %tobool38.not to i32 %spec.select = add nuw nsw i32 %count.070, %inc40 %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1 %exitcond86.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count br i1 %exitcond86.not, label %for.end44, label %for.body34, !llvm.loop !16 for.end44: ; preds = %for.body34, %for.cond32.preheader %count.0.lcssa = phi i32 [ 0, %for.cond32.preheader ], [ %spec.select, %for.body34 ] %call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp30 = icmp eq i32 %call, 1 br i1 %cmp30, label %for.cond32.preheader, label %for.end46, !llvm.loop !17 for.end46: ; preds = %for.end44, %for.cond29.preheader call void @llvm.lifetime.end.p0(i64 8000000, ptr nonnull %array) #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.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} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10, !11, !12} !16 = distinct !{!16, !10, !12, !11} !17 = distinct !{!17, !10}
#include <stdio.h> #define MAX 1000000 int prime[MAX]; void gen_prime(int n) { int i, j; for (i = 0; i < n; ++i) { prime[i] = 1; } prime[0] = prime[1] = 0; for (i = 0; i * i <= n; ++i) { if (prime[i]) { for (j = 2 * i; j <= n; j += i) { prime[j] = 0; } } } } int main(void) { int nprime[MAX] = {0}; int i, n; gen_prime(MAX - 1); for (i = 1, n = 0; i < MAX; ++i) { if (prime[i]) { nprime[i] = ++n; } } while (scanf("%d", &n) != EOF) { if (n == 1) { printf("0\n"); } else { while (nprime[n] == 0) { --n; } printf("%d\n", nprime[n]); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182372/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182372/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" @prime = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16 @.str = 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 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @gen_prime(i32 noundef %n) local_unnamed_addr #0 { entry: %cmp29 = icmp sgt i32 %n, 0 br i1 %cmp29, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %min.iters.check = icmp ult i32 %n, 8 br i1 %min.iters.check, label %for.body.preheader45, label %vector.ph vector.ph: ; preds = %for.body.preheader %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 ] %0 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %2 = icmp eq i64 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, label %for.body.preheader45 for.body.preheader45: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader45, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader45 ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv store i32 1, ptr %arrayidx, align 4, !tbaa !5 %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.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block, %entry store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @prime, align 16, !tbaa !5 %cmp2.not33 = icmp slt i32 %n, 0 br i1 %cmp2.not33, label %for.end16, label %for.body3 for.body3: ; preds = %for.end, %for.inc14 %indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.inc14 ], [ 0, %for.end ] %indvars.iv36 = phi i64 [ %indvars.iv.next37, %for.inc14 ], [ 0, %for.end ] %arrayidx5 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv38 %3 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 %indvars.iv38.tr = trunc i64 %indvars.iv38 to i32 %4 = shl i32 %indvars.iv38.tr, 1 %cmp8.not31 = icmp sgt i32 %4, %n %or.cond = or i1 %tobool.not, %cmp8.not31 br i1 %or.cond, label %for.inc14, label %for.body9 for.body9: ; preds = %for.body3, %for.body9 %indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.body9 ], [ %indvars.iv36, %for.body3 ] %arrayidx11 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv40 store i32 0, ptr %arrayidx11, align 4, !tbaa !5 %indvars.iv.next41 = add i64 %indvars.iv40, %indvars.iv38 %5 = trunc i64 %indvars.iv.next41 to i32 %cmp8.not = icmp sgt i32 %5, %n br i1 %cmp8.not, label %for.inc14, label %for.body9, !llvm.loop !14 for.inc14: ; preds = %for.body9, %for.body3 %indvars.iv.next39 = add nuw i64 %indvars.iv38, 1 %6 = trunc i64 %indvars.iv.next39 to i32 %mul = mul nsw i32 %6, %6 %cmp2.not = icmp sgt i32 %mul, %n %indvars.iv.next37 = add i64 %indvars.iv36, 2 br i1 %cmp2.not, label %for.end16, label %for.body3, !llvm.loop !15 for.end16: ; preds = %for.inc14, %for.end 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 nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %nprime = alloca [1000000 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %nprime) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000000) %nprime, i8 0, i64 4000000, i1 false) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 br label %vector.body vector.body: ; preds = %vector.body.3, %entry %index = phi i64 [ 0, %entry ], [ %index.next.3, %vector.body.3 ] %0 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5 %index.next = or i64 %index, 8 %2 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %index.next store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5 %index.next.1 = or i64 %index, 16 %4 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %index.next.1 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5 %index.next.2 = or i64 %index, 24 %6 = icmp eq i64 %index.next.2, 999992 br i1 %6, label %for.body.i, label %vector.body.3, !llvm.loop !16 vector.body.3: ; preds = %vector.body %7 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %index.next.2 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5 %8 = getelementptr inbounds i32, ptr %7, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5 %index.next.3 = add nuw nsw i64 %index, 32 br label %vector.body for.body.i: ; preds = %vector.body store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999992), align 16, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999993), align 4, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999994), align 8, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999995), align 4, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999996), align 16, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999997), align 4, !tbaa !5 store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 999998), align 8, !tbaa !5 store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !5 store i32 0, ptr @prime, align 16, !tbaa !5 br label %for.body3.i for.body3.i: ; preds = %for.inc14.i, %for.body.i %indvars.iv38.i = phi i64 [ %indvars.iv.next39.i, %for.inc14.i ], [ 0, %for.body.i ] %indvars.iv36.i = phi i64 [ %indvars.iv.next37.i, %for.inc14.i ], [ 0, %for.body.i ] %arrayidx5.i = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv38.i %9 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5 %tobool.not.i = icmp eq i32 %9, 0 %indvars.iv38.tr.i = trunc i64 %indvars.iv38.i to i32 %10 = shl i32 %indvars.iv38.tr.i, 1 %cmp8.not31.i = icmp sgt i32 %10, 999999 %or.cond.i = or i1 %tobool.not.i, %cmp8.not31.i br i1 %or.cond.i, label %for.inc14.i, label %for.body9.i for.body9.i: ; preds = %for.body3.i, %for.body9.i %indvars.iv40.i = phi i64 [ %indvars.iv.next41.i, %for.body9.i ], [ %indvars.iv36.i, %for.body3.i ] %arrayidx11.i = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv40.i store i32 0, ptr %arrayidx11.i, align 4, !tbaa !5 %indvars.iv.next41.i = add i64 %indvars.iv40.i, %indvars.iv38.i %11 = trunc i64 %indvars.iv.next41.i to i32 %cmp8.not.i = icmp sgt i32 %11, 999999 br i1 %cmp8.not.i, label %for.inc14.i, label %for.body9.i, !llvm.loop !14 for.inc14.i: ; preds = %for.body9.i, %for.body3.i %indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1 %indvars.iv.next37.i = add nuw nsw i64 %indvars.iv36.i, 2 %exitcond = icmp eq i64 %indvars.iv.next39.i, 1000 br i1 %exitcond, label %for.body, label %for.body3.i, !llvm.loop !15 while.cond.preheader: ; preds = %for.inc store i32 %inc21, ptr %n, align 4, !tbaa !5 %call31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp4.not32 = icmp eq i32 %call31, -1 br i1 %cmp4.not32, label %while.end17, label %while.body for.body: ; preds = %for.inc14.i, %for.inc.1 %indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.1 ], [ 1, %for.inc14.i ] %inc2223 = phi i32 [ %inc21.1, %for.inc.1 ], [ 0, %for.inc14.i ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv %12 = load i32, ptr %arrayidx, align 4, !tbaa !5 %tobool.not = icmp eq i32 %12, 0 br i1 %tobool.not, label %for.inc, label %if.then if.then: ; preds = %for.body %inc = add nsw i32 %inc2223, 1 %arrayidx2 = getelementptr inbounds [1000000 x i32], ptr %nprime, i64 0, i64 %indvars.iv store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %for.body, %if.then %inc21 = phi i32 [ %inc2223, %for.body ], [ %inc, %if.then ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond35.not = icmp eq i64 %indvars.iv.next, 1000000 br i1 %exitcond35.not, label %while.cond.preheader, label %for.body.1, !llvm.loop !17 for.body.1: ; preds = %for.inc %arrayidx.1 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv.next %13 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %tobool.not.1 = icmp eq i32 %13, 0 br i1 %tobool.not.1, label %for.inc.1, label %if.then.1 if.then.1: ; preds = %for.body.1 %inc.1 = add nsw i32 %inc21, 1 %arrayidx2.1 = getelementptr inbounds [1000000 x i32], ptr %nprime, i64 0, i64 %indvars.iv.next store i32 %inc.1, ptr %arrayidx2.1, align 4, !tbaa !5 br label %for.inc.1 for.inc.1: ; preds = %if.then.1, %for.body.1 %inc21.1 = phi i32 [ %inc21, %for.body.1 ], [ %inc.1, %if.then.1 ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 br label %for.body while.body: ; preds = %while.cond.preheader, %if.end16 %14 = load i32, ptr %n, align 4, !tbaa !5 %cmp5 = icmp eq i32 %14, 1 br i1 %cmp5, label %if.then6, label %while.cond8.preheader while.cond8.preheader: ; preds = %while.body %idxprom927 = sext i32 %14 to i64 %arrayidx1028 = getelementptr inbounds [1000000 x i32], ptr %nprime, i64 0, i64 %idxprom927 %15 = load i32, ptr %arrayidx1028, align 4, !tbaa !5 %cmp1129 = icmp eq i32 %15, 0 br i1 %cmp1129, label %while.body12, label %while.end if.then6: ; preds = %while.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end16 while.body12: ; preds = %while.cond8.preheader, %while.body12 %indvars.iv36 = phi i64 [ %indvars.iv.next37, %while.body12 ], [ %idxprom927, %while.cond8.preheader ] %indvars.iv.next37 = add i64 %indvars.iv36, -1 %arrayidx10 = getelementptr inbounds [1000000 x i32], ptr %nprime, i64 0, i64 %indvars.iv.next37 %16 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp11 = icmp eq i32 %16, 0 br i1 %cmp11, label %while.body12, label %while.cond8.while.end_crit_edge, !llvm.loop !18 while.cond8.while.end_crit_edge: ; preds = %while.body12 %17 = trunc i64 %indvars.iv.next37 to i32 store i32 %17, ptr %n, align 4, !tbaa !5 br label %while.end while.end: ; preds = %while.cond8.while.end_crit_edge, %while.cond8.preheader %.lcssa = phi i32 [ %16, %while.cond8.while.end_crit_edge ], [ %15, %while.cond8.preheader ] %call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.lcssa) br label %if.end16 if.end16: ; preds = %while.end, %if.then6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp4.not = icmp eq i32 %call, -1 br i1 %cmp4.not, label %while.end17, label %while.body, !llvm.loop !19 while.end17: ; preds = %if.end16, %while.cond.preheader call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %nprime) #6 ret i32 0 } ; 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: 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 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 attributes #0 = { nofree norecurse 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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } 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 = !{!"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, !11, !12} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10}
#include <stdio.h> int main(){ int n, i, j; while( scanf("%d", &n) != EOF){ int number[n], sum = 0; number[0] = 0; for( i = 1; i < n; i++){ number[i] = 1; } for( i = 1; i < n; i++){ if( number[i-1] == 1){ for( j = 2; j < i; j += i){ if( i % j == 0){ number[i-1] = 0; break; } } for( j = i*2; j <= n; j += i){ number[j-1] = 0; } } if( number[i] ){ sum++; } } printf("%d\n", sum); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182415/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182415/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 %call66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not67 = icmp eq i32 %call66, -1 br i1 %cmp.not67, label %while.end, label %while.body while.body: ; preds = %entry, %for.end36 %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 store i32 0, ptr %vla, align 16, !tbaa !5 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp156 = icmp sgt i32 %3, 1 br i1 %cmp156, label %for.body.preheader, label %for.end36 for.body.preheader: ; preds = %while.body %wide.trip.count = zext i32 %3 to i64 %4 = add nsw i64 %wide.trip.count, -1 %min.iters.check = icmp ult i32 %3, 9 br i1 %min.iters.check, label %for.body.preheader85, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %4, -8 %ind.end = or i64 %n.vec, 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %offset.idx = or i64 %index, 1 %5 = getelementptr inbounds i32, ptr %vla, i64 %offset.idx store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 4, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 4, !tbaa !5 %index.next = add nuw i64 %index, 8 %7 = icmp eq i64 %index.next, %n.vec br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.cond3.preheader, label %for.body.preheader85 for.body.preheader85: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] br label %for.body for.cond3.preheader: ; preds = %for.body, %middle.block br i1 %cmp156, label %for.body5.preheader, label %for.end36 for.body5.preheader: ; preds = %for.cond3.preheader %8 = zext i32 %3 to i64 %wide.trip.count80 = zext i32 %3 to i64 %invariant.gep83 = getelementptr i32, ptr %vla, i64 -1 %invariant.gep = getelementptr i32, ptr %vla, i64 -1 br label %for.body5 for.body: ; preds = %for.body.preheader85, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader85 ] %arrayidx2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 1, ptr %arrayidx2, align 4, !tbaa !5 %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.cond3.preheader, label %for.body, !llvm.loop !13 for.body5: ; preds = %for.body5.preheader, %if.end28 %9 = phi i32 [ 0, %for.body5.preheader ], [ %12, %if.end28 ] %indvars.iv71 = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next72, %if.end28 ] %indvars.iv69 = phi i32 [ 2, %for.body5.preheader ], [ %indvars.iv.next70, %if.end28 ] %sum.064 = phi i32 [ 0, %for.body5.preheader ], [ %spec.select, %if.end28 ] %10 = sext i32 %indvars.iv69 to i64 %gep84 = getelementptr i32, ptr %invariant.gep83, i64 %indvars.iv71 %cmp8 = icmp eq i32 %9, 1 br i1 %cmp8, label %for.cond9.preheader, label %if.end28 for.cond9.preheader: ; preds = %for.body5 %cmp1058 = icmp ugt i64 %indvars.iv71, 2 %rem82 = and i64 %indvars.iv71, 1 %cmp12 = icmp eq i64 %rem82, 0 %or.cond = and i1 %cmp1058, %cmp12 br i1 %or.cond, label %if.then13, label %for.end18 if.then13: ; preds = %for.cond9.preheader store i32 0, ptr %gep84, align 4, !tbaa !5 br label %for.end18 for.end18: ; preds = %for.cond9.preheader, %if.then13 %indvars.iv71.tr = trunc i64 %indvars.iv71 to i32 %11 = shl i32 %indvars.iv71.tr, 1 %cmp20.not60 = icmp sgt i32 %11, %3 br i1 %cmp20.not60, label %if.end28, label %for.body21 for.body21: ; preds = %for.end18, %for.body21 %indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body21 ], [ %10, %for.end18 ] %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv73 store i32 0, ptr %gep, align 4, !tbaa !5 %indvars.iv.next74 = add nsw i64 %indvars.iv73, %indvars.iv71 %cmp20.not = icmp sgt i64 %indvars.iv.next74, %8 br i1 %cmp20.not, label %if.end28, label %for.body21, !llvm.loop !14 if.end28: ; preds = %for.body21, %for.end18, %for.body5 %arrayidx30 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv71 %12 = load i32, ptr %arrayidx30, align 4, !tbaa !5 %tobool.not = icmp ne i32 %12, 0 %inc32 = zext i1 %tobool.not to i32 %spec.select = add nuw nsw i32 %sum.064, %inc32 %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1 %indvars.iv.next70 = add nuw i32 %indvars.iv69, 2 %exitcond81.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count80 br i1 %exitcond81.not, label %for.end36, label %for.body5, !llvm.loop !15 for.end36: ; preds = %if.end28, %while.body, %for.cond3.preheader %sum.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %while.body ], [ %spec.select, %if.end28 ] %call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16 while.end: ; preds = %for.end36, %entry 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 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 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 = { 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}
#include<stdio.h> int m[1000000]; int main(void){ int n,i,j,cnt; while(scanf("%d",&n)!=EOF){ cnt=0; for(i=0;i<=n;i++){ m[i]=i; } m[1] = 0; for(i=2;i<=n;i++){ for(j=2;i*j<=n;j++){ m[i*j]=0; } } i=0; while(i <= n){ if(m[i]!=0) cnt++; i++; } printf("%d\n",cnt); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182466/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182466/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 @m = dso_local local_unnamed_addr global [1000000 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) #4 %call52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not53 = icmp eq i32 %call52, -1 br i1 %cmp.not53, label %while.end26, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %while.end %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp1.not40 = icmp slt i32 %0, 0 br i1 %cmp1.not40, label %while.cond17.preheader.thread, label %for.body.preheader while.cond17.preheader.thread: ; preds = %for.cond.preheader store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @m, i64 0, i64 1), align 4, !tbaa !5 br label %while.end for.body.preheader: ; preds = %for.cond.preheader %1 = add nuw i32 %0, 1 %wide.trip.count = zext i32 %1 to i64 %min.iters.check70 = icmp ult i32 %0, 7 br i1 %min.iters.check70, label %for.body.preheader81, label %vector.ph71 vector.ph71: ; preds = %for.body.preheader %n.vec73 = and i64 %wide.trip.count, 4294967288 br label %vector.body76 vector.body76: ; preds = %vector.body76, %vector.ph71 %index77 = phi i64 [ 0, %vector.ph71 ], [ %index.next79, %vector.body76 ] %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph71 ], [ %vec.ind.next, %vector.body76 ] %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4> %2 = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %index77 store <4 x i32> %vec.ind, ptr %2, align 16, !tbaa !5 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> %step.add, ptr %3, align 16, !tbaa !5 %index.next79 = add nuw i64 %index77, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %4 = icmp eq i64 %index.next79, %n.vec73 br i1 %4, label %middle.block68, label %vector.body76, !llvm.loop !9 middle.block68: ; preds = %vector.body76 %cmp.n75 = icmp eq i64 %n.vec73, %wide.trip.count br i1 %cmp.n75, label %for.end, label %for.body.preheader81 for.body.preheader81: ; preds = %for.body.preheader, %middle.block68 %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec73, %middle.block68 ] br label %for.body for.body: ; preds = %for.body.preheader81, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader81 ] %arrayidx = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %indvars.iv %5 = trunc i64 %indvars.iv to i32 store i32 %5, ptr %arrayidx, align 4, !tbaa !5 %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.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block68 store i32 0, ptr getelementptr inbounds ([1000000 x i32], ptr @m, i64 0, i64 1), align 4, !tbaa !5 %cmp3.not46 = icmp slt i32 %0, 2 br i1 %cmp3.not46, label %while.cond17.preheader, label %for.cond5.preheader.preheader for.cond5.preheader.preheader: ; preds = %for.end %6 = add i32 %0, -1 %xtraiter = and i32 %6, 1 %7 = icmp eq i32 %0, 2 br i1 %7, label %while.cond17.preheader.loopexit.unr-lcssa, label %for.cond5.preheader.preheader.new for.cond5.preheader.preheader.new: ; preds = %for.cond5.preheader.preheader %unroll_iter = and i32 %6, -2 br label %for.cond5.preheader while.cond17.preheader.loopexit.unr-lcssa: ; preds = %for.inc14.1, %for.cond5.preheader.preheader %i.147.unr = phi i32 [ 2, %for.cond5.preheader.preheader ], [ %inc15.1, %for.inc14.1 ] %lcmp.mod.not = icmp eq i32 %xtraiter, 0 %mul42.epil = shl nuw nsw i32 %i.147.unr, 1 %cmp6.not43.epil = icmp sgt i32 %mul42.epil, %0 %or.cond = select i1 %lcmp.mod.not, i1 true, i1 %cmp6.not43.epil br i1 %or.cond, label %while.cond17.preheader, label %for.body7.epil for.body7.epil: ; preds = %while.cond17.preheader.loopexit.unr-lcssa, %for.body7.epil %indvars.iv55.epil = phi i64 [ %indvars.iv.next56.epil, %for.body7.epil ], [ 2, %while.cond17.preheader.loopexit.unr-lcssa ] %mul45.epil = phi i32 [ %mul.epil, %for.body7.epil ], [ %mul42.epil, %while.cond17.preheader.loopexit.unr-lcssa ] %idxprom9.epil = zext i32 %mul45.epil to i64 %arrayidx10.epil = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %idxprom9.epil store i32 0, ptr %arrayidx10.epil, align 4, !tbaa !5 %indvars.iv.next56.epil = add nuw nsw i64 %indvars.iv55.epil, 1 %indvars.epil = trunc i64 %indvars.iv.next56.epil to i32 %mul.epil = mul nsw i32 %i.147.unr, %indvars.epil %cmp6.not.epil = icmp sgt i32 %mul.epil, %0 br i1 %cmp6.not.epil, label %while.cond17.preheader, label %for.body7.epil, !llvm.loop !14 while.cond17.preheader: ; preds = %while.cond17.preheader.loopexit.unr-lcssa, %for.body7.epil, %for.end br i1 %cmp1.not40, label %while.end, label %while.body19.preheader while.body19.preheader: ; preds = %while.cond17.preheader %8 = add nuw nsw i32 %0, 1 %wide.trip.count63 = zext i32 %8 to i64 %min.iters.check = icmp ult i32 %0, 7 br i1 %min.iters.check, label %while.body19.preheader80, label %vector.ph vector.ph: ; preds = %while.body19.preheader %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 ], [ %15, %vector.body ] %vec.phi66 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ] %9 = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %9, align 16, !tbaa !5 %10 = getelementptr inbounds i32, ptr %9, i64 4 %wide.load67 = load <4 x i32>, ptr %10, align 16, !tbaa !5 %11 = icmp ne <4 x i32> %wide.load, zeroinitializer %12 = icmp ne <4 x i32> %wide.load67, zeroinitializer %13 = zext <4 x i1> %11 to <4 x i32> %14 = zext <4 x i1> %12 to <4 x i32> %15 = add <4 x i32> %vec.phi, %13 %16 = add <4 x i32> %vec.phi66, %14 %index.next = add nuw i64 %index, 8 %17 = icmp eq i64 %index.next, %n.vec br i1 %17, label %middle.block, label %vector.body, !llvm.loop !15 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %16, %15 %18 = 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 %while.end, label %while.body19.preheader80 while.body19.preheader80: ; preds = %while.body19.preheader, %middle.block %indvars.iv59.ph = phi i64 [ 0, %while.body19.preheader ], [ %n.vec, %middle.block ] %cnt.050.ph = phi i32 [ 0, %while.body19.preheader ], [ %18, %middle.block ] br label %while.body19 for.cond5.preheader: ; preds = %for.inc14.1, %for.cond5.preheader.preheader.new %i.147 = phi i32 [ 2, %for.cond5.preheader.preheader.new ], [ %inc15.1, %for.inc14.1 ] %niter = phi i32 [ 0, %for.cond5.preheader.preheader.new ], [ %niter.next.1, %for.inc14.1 ] %mul42 = shl nuw nsw i32 %i.147, 1 %cmp6.not43 = icmp sgt i32 %mul42, %0 br i1 %cmp6.not43, label %for.inc14, label %for.body7 for.body7: ; preds = %for.cond5.preheader, %for.body7 %indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.body7 ], [ 2, %for.cond5.preheader ] %mul45 = phi i32 [ %mul, %for.body7 ], [ %mul42, %for.cond5.preheader ] %idxprom9 = zext i32 %mul45 to i64 %arrayidx10 = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %idxprom9 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1 %indvars = trunc i64 %indvars.iv.next56 to i32 %mul = mul nsw i32 %i.147, %indvars %cmp6.not = icmp sgt i32 %mul, %0 br i1 %cmp6.not, label %for.inc14, label %for.body7, !llvm.loop !14 for.inc14: ; preds = %for.body7, %for.cond5.preheader %inc15 = or i32 %i.147, 1 %mul42.1 = shl nuw nsw i32 %inc15, 1 %cmp6.not43.1 = icmp sgt i32 %mul42.1, %0 br i1 %cmp6.not43.1, label %for.inc14.1, label %for.body7.1 for.body7.1: ; preds = %for.inc14, %for.body7.1 %indvars.iv55.1 = phi i64 [ %indvars.iv.next56.1, %for.body7.1 ], [ 2, %for.inc14 ] %mul45.1 = phi i32 [ %mul.1, %for.body7.1 ], [ %mul42.1, %for.inc14 ] %idxprom9.1 = zext i32 %mul45.1 to i64 %arrayidx10.1 = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %idxprom9.1 store i32 0, ptr %arrayidx10.1, align 4, !tbaa !5 %indvars.iv.next56.1 = add nuw nsw i64 %indvars.iv55.1, 1 %indvars.1 = trunc i64 %indvars.iv.next56.1 to i32 %mul.1 = mul nsw i32 %inc15, %indvars.1 %cmp6.not.1 = icmp sgt i32 %mul.1, %0 br i1 %cmp6.not.1, label %for.inc14.1, label %for.body7.1, !llvm.loop !14 for.inc14.1: ; preds = %for.body7.1, %for.inc14 %inc15.1 = add nuw i32 %i.147, 2 %niter.next.1 = add i32 %niter, 2 %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %while.cond17.preheader.loopexit.unr-lcssa, label %for.cond5.preheader, !llvm.loop !16 while.body19: ; preds = %while.body19.preheader80, %while.body19 %indvars.iv59 = phi i64 [ %indvars.iv.next60, %while.body19 ], [ %indvars.iv59.ph, %while.body19.preheader80 ] %cnt.050 = phi i32 [ %spec.select, %while.body19 ], [ %cnt.050.ph, %while.body19.preheader80 ] %arrayidx21 = getelementptr inbounds [1000000 x i32], ptr @m, i64 0, i64 %indvars.iv59 %19 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %cmp22.not = icmp ne i32 %19, 0 %inc23 = zext i1 %cmp22.not to i32 %spec.select = add nuw nsw i32 %cnt.050, %inc23 %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1 %exitcond64.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count63 br i1 %exitcond64.not, label %while.end, label %while.body19, !llvm.loop !17 while.end: ; preds = %while.body19, %middle.block, %while.cond17.preheader.thread, %while.cond17.preheader %cnt.0.lcssa = phi i32 [ 0, %while.cond17.preheader ], [ 0, %while.cond17.preheader.thread ], [ %18, %middle.block ], [ %spec.select, %while.body19 ] %call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end26, label %for.cond.preheader, !llvm.loop !18 while.end26: ; preds = %while.end, %entry 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.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 = distinct !{!15, !10, !11, !12} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10}
#include <stdio.h> int sosu(int n){ int num[n+1],i,j,count=0; for(i=0;i<=n;i++) num[i]=1; num[0]=num[1]=0; for(i=2;i<=n;i++){ if(num[i]==1){ for(j=2;i*j<=n;j++) num[i*j]=0; } } for(i=0;i<=n;i++){ if(num[i]==1) count++; } return count; } int main(void){ int n; while(scanf("%d",&n)!=EOF){ printf("%d\n",sosu(n)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182509/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182509/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(none) uwtable define dso_local i32 @sosu(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 %cmp.not50 = icmp slt i32 %n, 0 br i1 %cmp.not50, label %for.end32, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i32 %add, 8 br i1 %min.iters.check, label %for.body.preheader96, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %0, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %1 = getelementptr inbounds i32, ptr %vla, i64 %index store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %3 = icmp eq i64 %index.next, %n.vec br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %0 br i1 %cmp.n, label %for.end, label %for.body.preheader96 for.body.preheader96: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.body: ; preds = %for.body.preheader96, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader96 ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 1, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %0 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13 for.end: ; preds = %for.body, %middle.block %arrayidx1 = getelementptr inbounds i32, ptr %vla, i64 1 store i32 0, ptr %arrayidx1, align 4, !tbaa !5 store i32 0, ptr %vla, align 16, !tbaa !5 %cmp4.not56 = icmp slt i32 %n, 2 br i1 %cmp4.not56, label %for.cond21.preheader, label %for.body5 for.cond21.preheader: ; preds = %for.inc18, %for.end br i1 %cmp.not50, label %for.end32, label %for.body23.preheader for.body23.preheader: ; preds = %for.cond21.preheader %min.iters.check83 = icmp ult i32 %add, 8 br i1 %min.iters.check83, label %for.body23.preheader94, label %vector.ph84 vector.ph84: ; preds = %for.body23.preheader %n.vec86 = and i64 %0, 4294967288 br label %vector.body89 vector.body89: ; preds = %vector.body89, %vector.ph84 %index90 = phi i64 [ 0, %vector.ph84 ], [ %index.next93, %vector.body89 ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph84 ], [ %10, %vector.body89 ] %vec.phi91 = phi <4 x i32> [ zeroinitializer, %vector.ph84 ], [ %11, %vector.body89 ] %4 = getelementptr inbounds i32, ptr %vla, i64 %index90 %wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5 %5 = getelementptr inbounds i32, ptr %4, i64 4 %wide.load92 = load <4 x i32>, ptr %5, align 16, !tbaa !5 %6 = icmp eq <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1> %7 = icmp eq <4 x i32> %wide.load92, <i32 1, i32 1, i32 1, i32 1> %8 = zext <4 x i1> %6 to <4 x i32> %9 = zext <4 x i1> %7 to <4 x i32> %10 = add <4 x i32> %vec.phi, %8 %11 = add <4 x i32> %vec.phi91, %9 %index.next93 = add nuw i64 %index90, 8 %12 = icmp eq i64 %index.next93, %n.vec86 br i1 %12, label %middle.block81, label %vector.body89, !llvm.loop !14 middle.block81: ; preds = %vector.body89 %bin.rdx = add <4 x i32> %11, %10 %13 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n88 = icmp eq i64 %n.vec86, %0 br i1 %cmp.n88, label %for.end32, label %for.body23.preheader94 for.body23.preheader94: ; preds = %for.body23.preheader, %middle.block81 %indvars.iv73.ph = phi i64 [ 0, %for.body23.preheader ], [ %n.vec86, %middle.block81 ] %count.061.ph = phi i32 [ 0, %for.body23.preheader ], [ %13, %middle.block81 ] br label %for.body23 for.body5: ; preds = %for.end, %for.inc18 %indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.inc18 ], [ 2, %for.end ] %arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv66 %14 = load i32, ptr %arrayidx7, align 4, !tbaa !5 %cmp8 = icmp ne i32 %14, 1 %indvars.iv66.tr = trunc i64 %indvars.iv66 to i32 %15 = shl i32 %indvars.iv66.tr, 1 %cmp10.not53 = icmp sgt i32 %15, %n %or.cond = or i1 %cmp8, %cmp10.not53 br i1 %or.cond, label %for.inc18, label %for.body11.preheader for.body11.preheader: ; preds = %for.body5 %16 = trunc i64 %indvars.iv66 to i32 br label %for.body11 for.body11: ; preds = %for.body11.preheader, %for.body11 %indvars.iv63 = phi i64 [ 2, %for.body11.preheader ], [ %indvars.iv.next64, %for.body11 ] %mul55 = phi i32 [ %15, %for.body11.preheader ], [ %mul, %for.body11 ] %idxprom13 = zext i32 %mul55 to i64 %arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %idxprom13 store i32 0, ptr %arrayidx14, align 4, !tbaa !5 %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1 %indvars = trunc i64 %indvars.iv.next64 to i32 %mul = mul nsw i32 %indvars, %16 %cmp10.not = icmp sgt i32 %mul, %n br i1 %cmp10.not, label %for.inc18, label %for.body11, !llvm.loop !15 for.inc18: ; preds = %for.body11, %for.body5 %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1 %exitcond72.not = icmp eq i64 %indvars.iv.next67, %0 br i1 %exitcond72.not, label %for.cond21.preheader, label %for.body5, !llvm.loop !16 for.body23: ; preds = %for.body23.preheader94, %for.body23 %indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body23 ], [ %indvars.iv73.ph, %for.body23.preheader94 ] %count.061 = phi i32 [ %spec.select, %for.body23 ], [ %count.061.ph, %for.body23.preheader94 ] %arrayidx25 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv73 %17 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %cmp26 = icmp eq i32 %17, 1 %inc28 = zext i1 %cmp26 to i32 %spec.select = add nuw nsw i32 %count.061, %inc28 %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %exitcond78.not = icmp eq i64 %indvars.iv.next74, %0 br i1 %exitcond78.not, label %for.end32, label %for.body23, !llvm.loop !17 for.end32: ; preds = %for.body23, %middle.block81, %entry, %for.cond21.preheader %count.0.lcssa = phi i32 [ 0, %for.cond21.preheader ], [ 0, %entry ], [ %13, %middle.block81 ], [ %spec.select, %for.body23 ] ret i32 %count.0.lcssa } ; 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 %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not4 = icmp eq i32 %call3, -1 br i1 %cmp.not4, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %0 = load i32, ptr %n, align 4, !tbaa !5 %call1 = call i32 @sosu(i32 noundef %0) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call1) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18 while.end: ; preds = %while.body, %entry 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: 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.vector.reduce.add.v4i32(<4 x i32>) #4 attributes #0 = { 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 #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 = { 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, !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, !11, !12} !15 = distinct !{!15, !10} !16 = distinct !{!16, !10} !17 = distinct !{!17, !10, !12, !11} !18 = distinct !{!18, !10}
#include<stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n; scanf("%d",&n); n++; long int B,x,y; scanf("%ld%ld%ld",&B,&x,&y); long long int a[n], sum = 0; a[0] = 0; for(int i=1;i<n;i++){ if(a[i-1] + x <= B) a[i] = a[i-1] + x; else a[i] = a[i-1] - y; sum += a[i]; } printf("%lld\n",sum); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18256/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18256/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 [10 x i8] c"%ld%ld%ld\00", align 1 @.str.2 = 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: %t = alloca i32, align 4 %n = alloca i32, align 4 %B = alloca i64, align 8 %x = alloca i64, align 8 %y = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec33 = add nsw i32 %0, -1 store i32 %dec33, ptr %t, align 4, !tbaa !5 %tobool.not34 = icmp eq i32 %0, 0 br i1 %tobool.not34, label %while.end, label %while.body while.body: ; preds = %entry, %for.cond.cleanup call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %inc = add nsw i32 %1, 1 store i32 %inc, ptr %n, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #4 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %B, ptr noundef nonnull %x, ptr noundef nonnull %y) %2 = call ptr @llvm.stacksave.p0() %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp30 = icmp sgt i32 %3, 1 br i1 %cmp30, label %for.body.lr.ph, label %for.cond.cleanup for.body.lr.ph: ; preds = %while.body %4 = load i64, ptr %x, align 8, !tbaa !9 %5 = load i64, ptr %B, align 8, !tbaa !9 %6 = load i64, ptr %y, align 8 %wide.trip.count = zext i32 %3 to i64 %7 = add nsw i64 %wide.trip.count, -1 %8 = add nsw i64 %wide.trip.count, -2 %xtraiter = and i64 %7, 3 %9 = icmp ult i64 %8, 3 br i1 %9, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %7, -4 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %add19.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %add19.3, %for.body ] %.unr = phi i64 [ 0, %for.body.lr.ph ], [ %spec.select.3, %for.body ] %sum.031.unr = phi i64 [ 0, %for.body.lr.ph ], [ %add19.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 %10 = phi i64 [ %spec.select.epil, %for.body.epil ], [ %.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %sum.031.epil = phi i64 [ %add19.epil, %for.body.epil ], [ %sum.031.unr, %for.cond.cleanup.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.loopexit.unr-lcssa ] %add.epil = add nsw i64 %4, %10 %cmp4.not.epil = icmp sgt i64 %add.epil, %5 %sub14.epil = sub nsw i64 %10, %6 %spec.select.epil = select i1 %cmp4.not.epil, i64 %sub14.epil, i64 %add.epil %add19.epil = add nsw i64 %spec.select.epil, %sum.031.epil %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 !11 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit.unr-lcssa, %for.body.epil, %while.body %sum.0.lcssa = phi i64 [ 0, %while.body ], [ %add19.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %add19.epil, %for.body.epil ] %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 %11 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %11, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %11, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13 for.body: ; preds = %for.body, %for.body.lr.ph.new %12 = phi i64 [ 0, %for.body.lr.ph.new ], [ %spec.select.3, %for.body ] %sum.031 = phi i64 [ 0, %for.body.lr.ph.new ], [ %add19.3, %for.body ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.3, %for.body ] %add = add nsw i64 %4, %12 %cmp4.not = icmp sgt i64 %add, %5 %sub14 = sub nsw i64 %12, %6 %spec.select = select i1 %cmp4.not, i64 %sub14, i64 %add %add19 = add nsw i64 %spec.select, %sum.031 %add.1 = add nsw i64 %4, %spec.select %cmp4.not.1 = icmp sgt i64 %add.1, %5 %sub14.1 = sub nsw i64 %spec.select, %6 %spec.select.1 = select i1 %cmp4.not.1, i64 %sub14.1, i64 %add.1 %add19.1 = add nsw i64 %spec.select.1, %add19 %add.2 = add nsw i64 %4, %spec.select.1 %cmp4.not.2 = icmp sgt i64 %add.2, %5 %sub14.2 = sub nsw i64 %spec.select.1, %6 %spec.select.2 = select i1 %cmp4.not.2, i64 %sub14.2, i64 %add.2 %add19.2 = add nsw i64 %spec.select.2, %add19.1 %add.3 = add nsw i64 %4, %spec.select.2 %cmp4.not.3 = icmp sgt i64 %add.3, %5 %sub14.3 = sub nsw i64 %spec.select.2, %6 %spec.select.3 = select i1 %cmp4.not.3, i64 %sub14.3, i64 %add.3 %add19.3 = add nsw i64 %spec.select.3, %add19.2 %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 !15 while.end: ; preds = %for.cond.cleanup, %entry 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 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 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 = { 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 = !{!"long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.unroll.disable"} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = distinct !{!15, !14}
#include <stdio.h> int z[9999],r[9999]; int f(int a,int b){ printf("? %d %d\n",a,b); fflush(stdout); char c[2]; scanf("%s",c); return *c=='Y'; } int main(){ int a,b,c=0,h,i=0; scanf("%d%d",&a,&b); if(a<=b){puts("Impossible");return 0;} for(a+=b;i<a;i++)if(!c||f(z[c-1],i))z[c++]=i;else c--; h=z[c-1]; for(i=0;i<a;i++)r[i]=h==i||f(h,i); printf("! "); for(i=0;i<a;i++)printf("%d",r[i]); puts(""); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182639/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182639/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\0A\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.3 = private unnamed_addr constant [11 x i8] c"Impossible\00", align 1 @z = dso_local local_unnamed_addr global [9999 x i32] zeroinitializer, align 16 @r = dso_local local_unnamed_addr global [9999 x i32] zeroinitializer, align 16 @.str.4 = private unnamed_addr constant [3 x i8] c"! \00", align 1 @.str.5 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @f(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %c = alloca [2 x i8], align 1 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %a, i32 noundef %b) %0 = load ptr, ptr @stdout, align 8, !tbaa !5 %call1 = tail call i32 @fflush(ptr noundef %0) call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %c) #4 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c) %1 = load i8, ptr %c, align 1, !tbaa !9 %cmp = icmp eq i8 %1, 89 %conv4 = zext i1 %cmp to i32 call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %c) #4 ret i32 %conv4 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nounwind declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1 ; 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 #1 ; 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 uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %c.i57 = alloca [2 x i8], align 1 %c.i = alloca [2 x i8], align 1 %a = alloca i32, align 4 %b = 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i32, ptr %a, align 4, !tbaa !10 %1 = load i32, ptr %b, align 4, !tbaa !10 %cmp.not = icmp sgt i32 %0, %1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %entry %call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3) br label %cleanup if.end: ; preds = %entry %add = add nsw i32 %1, %0 store i32 %add, ptr %a, align 4, !tbaa !10 %cmp263 = icmp sgt i32 %add, 0 br i1 %cmp263, label %for.body, label %for.end23 for.body: ; preds = %if.end, %for.inc %i.065 = phi i32 [ %inc9, %for.inc ], [ 0, %if.end ] %c.064 = phi i32 [ %c.1, %for.inc ], [ 0, %if.end ] %tobool.not = icmp eq i32 %c.064, 0 br i1 %tobool.not, label %if.then5, label %lor.lhs.false lor.lhs.false: ; preds = %for.body %sub = add nsw i32 %c.064, -1 %idxprom = sext i32 %sub to i64 %arrayidx = getelementptr inbounds [9999 x i32], ptr @z, i64 0, i64 %idxprom %2 = load i32, ptr %arrayidx, align 4, !tbaa !10 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %2, i32 noundef %i.065) %3 = load ptr, ptr @stdout, align 8, !tbaa !5 %call1.i = call i32 @fflush(ptr noundef %3) call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %c.i) #4 %call2.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c.i) %4 = load i8, ptr %c.i, align 1, !tbaa !9 %cmp.i.not = icmp eq i8 %4, 89 call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %c.i) #4 br i1 %cmp.i.not, label %if.then5, label %for.inc if.then5: ; preds = %lor.lhs.false, %for.body %inc = add nsw i32 %c.064, 1 %idxprom6 = sext i32 %c.064 to i64 %arrayidx7 = getelementptr inbounds [9999 x i32], ptr @z, i64 0, i64 %idxprom6 store i32 %i.065, ptr %arrayidx7, align 4, !tbaa !10 br label %for.inc for.inc: ; preds = %lor.lhs.false, %if.then5 %c.1 = phi i32 [ %inc, %if.then5 ], [ %sub, %lor.lhs.false ] %inc9 = add nuw nsw i32 %i.065, 1 %5 = load i32, ptr %a, align 4, !tbaa !10 %cmp2 = icmp slt i32 %inc9, %5 br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !12 for.end: ; preds = %for.inc %6 = add nsw i32 %c.1, -1 %7 = sext i32 %6 to i64 %arrayidx12 = getelementptr inbounds [9999 x i32], ptr @z, i64 0, i64 %7 %8 = load i32, ptr %arrayidx12, align 4, !tbaa !10 %cmp1466 = icmp sgt i32 %5, 0 br i1 %cmp1466, label %for.body15.preheader, label %for.end23 for.body15.preheader: ; preds = %for.end %9 = zext i32 %8 to i64 br label %for.body15 for.body15: ; preds = %for.body15.preheader, %lor.end %10 = phi i32 [ %5, %for.body15.preheader ], [ %14, %lor.end ] %indvars.iv = phi i64 [ 0, %for.body15.preheader ], [ %indvars.iv.next, %lor.end ] %cmp16 = icmp eq i64 %indvars.iv, %9 br i1 %cmp16, label %lor.end, label %lor.rhs lor.rhs: ; preds = %for.body15 %11 = trunc i64 %indvars.iv to i32 %call.i58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8, i32 noundef %11) %12 = load ptr, ptr @stdout, align 8, !tbaa !5 %call1.i59 = call i32 @fflush(ptr noundef %12) call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %c.i57) #4 %call2.i60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c.i57) %13 = load i8, ptr %c.i57, align 1, !tbaa !9 %cmp.i61 = icmp eq i8 %13, 89 call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %c.i57) #4 %.pre = load i32, ptr %a, align 4, !tbaa !10 br label %lor.end lor.end: ; preds = %lor.rhs, %for.body15 %14 = phi i32 [ %10, %for.body15 ], [ %.pre, %lor.rhs ] %15 = phi i1 [ true, %for.body15 ], [ %cmp.i61, %lor.rhs ] %lor.ext = zext i1 %15 to i32 %arrayidx20 = getelementptr inbounds [9999 x i32], ptr @r, i64 0, i64 %indvars.iv store i32 %lor.ext, ptr %arrayidx20, align 4, !tbaa !10 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %16 = sext i32 %14 to i64 %cmp14 = icmp slt i64 %indvars.iv.next, %16 br i1 %cmp14, label %for.body15, label %for.end23, !llvm.loop !14 for.end23: ; preds = %lor.end, %if.end, %for.end %call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4) %17 = load i32, ptr %a, align 4, !tbaa !10 %cmp2668 = icmp sgt i32 %17, 0 br i1 %cmp2668, label %for.body27, label %for.end33 for.body27: ; preds = %for.end23, %for.body27 %indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body27 ], [ 0, %for.end23 ] %arrayidx29 = getelementptr inbounds [9999 x i32], ptr @r, i64 0, i64 %indvars.iv71 %18 = load i32, ptr %arrayidx29, align 4, !tbaa !10 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %18) %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1 %19 = load i32, ptr %a, align 4, !tbaa !10 %20 = sext i32 %19 to i64 %cmp26 = icmp slt i64 %indvars.iv.next72, %20 br i1 %cmp26, label %for.body27, label %for.end33, !llvm.loop !15 for.end33: ; preds = %for.body27, %for.end23 %putchar = call i32 @putchar(i32 10) br label %cleanup cleanup: ; preds = %for.end33, %if.then 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: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) 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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } 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 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = !{!11, !11, i64 0} !11 = !{!"int", !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13} !15 = distinct !{!15, !13}
#include<stdio.h> int main() { int n, a, b; scanf("%d%d%d", &n, &a, &b); if (a > b || n == 1 && a != b) { printf("0"); } else if (n == 1 && a == b) printf("1"); else { printf("%lld",(long long) (b - a)*(n - 2) + 1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182682/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182682/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 [7 x i8] c"%d%d%d\00", align 1 @.str.3 = 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: %n = alloca i32, align 4 %a = alloca i32, align 4 %b = 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 %a) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, 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 br i1 %cmp, label %if.then, label %lor.lhs.false lor.lhs.false: ; preds = %entry %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp1 = icmp ne i32 %2, 1 %cmp2.not = icmp eq i32 %0, %1 %or.cond = or i1 %cmp2.not, %cmp1 br i1 %or.cond, label %if.else, label %if.then if.then: ; preds = %lor.lhs.false, %entry %putchar15 = call i32 @putchar(i32 48) br label %if.end13 if.else: ; preds = %lor.lhs.false %cmp4 = icmp eq i32 %2, 1 %brmerge.not = and i1 %cmp2.not, %cmp4 br i1 %brmerge.not, label %if.then7, label %if.else9 if.then7: ; preds = %if.else %putchar = call i32 @putchar(i32 49) br label %if.end13 if.else9: ; preds = %if.else %sub = sub nsw i32 %1, %0 %conv = sext i32 %sub to i64 %sub10 = add nsw i32 %2, -2 %conv11 = sext i32 %sub10 to i64 %mul = mul nsw i64 %conv11, %conv %add = add nsw i64 %mul, 1 %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %add) br label %if.end13 if.end13: ; preds = %if.then7, %if.else9, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, 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: nofree nounwind declare noundef i32 @putchar(i32 noundef) 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"}
#include <stdio.h> int main(void){ long long n,a,b; scanf("%lld",&n); scanf("%lld",&a); scanf("%lld",&b); if(((n == 1)&&(a != b)) || b < a){ printf("0\n"); }else{ printf("%lld\n",(n-2)*(b-a)+1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182725/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182725/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.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %a = alloca i64, align 8 %b = 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 %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #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 %a) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b) %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp eq i64 %0, 1 %.pre = load i64, ptr %b, align 8, !tbaa !5 %.pre9 = load i64, ptr %a, align 8, !tbaa !5 %cmp3.not = icmp ne i64 %.pre9, %.pre %or.cond.not11 = select i1 %cmp, i1 %cmp3.not, i1 false %cmp4 = icmp slt i64 %.pre, %.pre9 %or.cond10 = select i1 %or.cond.not11, i1 true, i1 %cmp4 br i1 %or.cond10, label %if.then, label %if.else if.then: ; preds = %entry %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end if.else: ; preds = %entry %sub = add nsw i64 %0, -2 %sub6 = sub nsw i64 %.pre, %.pre9 %mul = mul nsw i64 %sub6, %sub %add = add nsw i64 %mul, 1 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add) br label %if.end if.end: ; preds = %if.else, %if.then call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #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: 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 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<stdlib.h> #define F 1 //const int mod[F]={1000000009,1000000021,1000000033,1000000087}; const int mod[F]={5077}; typedef struct hashNode{ int hash[F]; } node; node add(node a,node b){ node x; for(int i=0;i<F;i++){ x.hash[i]=(a.hash[i]+b.hash[i])%mod[i]; } return x; } node minus(node a,node b){ node c; for(int i=0;i<F;i++){ c.hash[i]=(a.hash[i]-b.hash[i]+mod[i])%mod[i]; } return c; } int isZero(node a){ for(int i=0;i<F;i++) if(a.hash[i]>0) return 0; return 1; } void run(void){ int n,k; scanf("%d%d",&n,&k); int *a=(int *)calloc(n,sizeof(int)); int i,j; for(i=0;i<n;i++) scanf("%d",a+i); node *dp=(node *)calloc(k,sizeof(node)); for(i=0;i<F;i++) dp[0].hash[i]=1; for(i=0;i<n;i++){ for(j=k-1;j-a[i]>=0;j--){ dp[j]=add(dp[j],dp[j-a[i]]); } } node *dp2=(node *)calloc(k,sizeof(node)); int ans=0; for(i=0;i<n;i++){ if(a[i]>=k) continue; for(j=0;j<a[i];j++) dp2[j]=dp[j]; for(j=a[i];j<k;j++){ dp2[j]=minus(dp[j],dp2[j-a[i]]); } for(j=k-1;j>=k-a[i];j--) if(!isZero(dp2[j])) break; if(j<k-a[i]) ans++; } printf("%d\n",ans); } int main(void){ run(); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182776/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182776/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.hashNode = type { [1 x i32] } @mod = dso_local local_unnamed_addr constant [1 x i32] [i32 5077], align 4 @.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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @add(i32 %a.coerce, i32 %b.coerce) local_unnamed_addr #0 { entry: %add = add nsw i32 %b.coerce, %a.coerce %rem = srem i32 %add, 5077 ret i32 %rem } ; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @minus(i32 %a.coerce, i32 %b.coerce) local_unnamed_addr #0 { entry: %sub = add i32 %a.coerce, 5077 %add = sub i32 %sub, %b.coerce %rem = srem i32 %add, 5077 ret i32 %rem } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @isZero(i32 %a.coerce) local_unnamed_addr #0 { entry: %cmp1 = icmp slt i32 %a.coerce, 1 %spec.select = zext i1 %cmp1 to i32 ret i32 %spec.select } ; Function Attrs: nofree nounwind uwtable define dso_local void @run() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, 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 !5 %conv = sext i32 %0 to i64 %call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #8 %cmp171 = icmp sgt i32 %0, 0 br i1 %cmp171, label %for.body, label %for.end 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.1, 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, %entry %.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ] %3 = load i32, ptr %k, align 4, !tbaa !5 %conv4 = sext i32 %3 to i64 %call5 = call noalias ptr @calloc(i64 noundef %conv4, i64 noundef 4) #8 store i32 1, ptr %call5, align 4, !tbaa !5 %cmp15178 = icmp sgt i32 %.lcssa, 0 br i1 %cmp15178, label %for.cond18.preheader.lr.ph, label %for.end115 for.cond18.preheader.lr.ph: ; preds = %for.end %j.0173 = add nsw i32 %3, -1 %4 = sext i32 %j.0173 to i64 %wide.trip.count = zext i32 %.lcssa to i64 %5 = shl nsw i64 %4, 2 %scevgep = getelementptr i8, ptr %call5, i64 %5 %scevgep224 = getelementptr i8, ptr %call5, i64 4 %6 = shl nsw i64 %4, 2 %7 = getelementptr i8, ptr %call5, i64 %6 %scevgep227 = getelementptr i8, ptr %7, i64 4 %8 = sub nsw i64 4, %6 %scevgep228 = getelementptr i8, ptr %call5, i64 %8 %scevgep230 = getelementptr i8, ptr %call5, i64 4 br label %for.cond18.preheader for.cond18.preheader: ; preds = %for.cond18.preheader.lr.ph, %for.inc39 %indvars.iv194 = phi i64 [ 0, %for.cond18.preheader.lr.ph ], [ %indvars.iv.next195, %for.inc39 ] %arrayidx20 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv194 %9 = load i32, ptr %arrayidx20, align 4, !tbaa !5 %sub21174 = sub nsw i32 %j.0173, %9 %cmp22175 = icmp sgt i32 %sub21174, -1 br i1 %cmp22175, label %for.body24.preheader, label %for.inc39 for.body24.preheader: ; preds = %for.cond18.preheader %10 = sext i32 %9 to i64 %11 = xor i64 %10, -1 %12 = add nsw i64 %11, %4 %smin232 = call i64 @llvm.smin.i64(i64 %12, i64 -1) %13 = add i64 %smin232, %10 %14 = sub i64 %4, %13 %min.iters.check = icmp ult i64 %14, 36 br i1 %min.iters.check, label %for.body24.preheader265, label %vector.scevcheck vector.scevcheck: ; preds = %for.body24.preheader %15 = xor i64 %10, -1 %16 = add nsw i64 %15, %4 %smin = call i64 @llvm.smin.i64(i64 %16, i64 -1) %17 = xor i64 %smin, -1 %18 = add i64 %17, %4 %19 = sub i64 %18, %10 %20 = trunc i64 %19 to i32 %21 = icmp ult i32 %sub21174, %20 %22 = icmp ugt i64 %19, 4294967295 %23 = or i1 %21, %22 %mul.result218.neg = mul i64 %19, -4 %24 = getelementptr i8, ptr %scevgep, i64 %mul.result218.neg %25 = icmp ugt ptr %24, %scevgep %26 = zext i32 %sub21174 to i64 %27 = shl nuw nsw i64 %26, 2 %scevgep220 = getelementptr i8, ptr %call5, i64 %27 %mul.result222.neg = mul i64 %19, -4 %28 = getelementptr i8, ptr %scevgep220, i64 %mul.result222.neg %29 = icmp ugt ptr %28, %scevgep220 %30 = or i1 %25, %23 %31 = or i1 %29, %30 br i1 %31, label %for.body24.preheader265, label %vector.memcheck vector.memcheck: ; preds = %vector.scevcheck %32 = xor i64 %10, -1 %33 = add nsw i64 %32, %4 %smin225 = call i64 @llvm.smin.i64(i64 %33, i64 -1) %34 = add i64 %smin225, %10 %35 = shl nsw i64 %34, 2 %scevgep226 = getelementptr i8, ptr %scevgep224, i64 %35 %36 = zext i32 %sub21174 to i64 %37 = add i64 %34, %36 %38 = shl nsw i64 %37, 2 %scevgep229 = getelementptr i8, ptr %scevgep228, i64 %38 %39 = shl nuw nsw i64 %36, 2 %scevgep231 = getelementptr i8, ptr %scevgep230, i64 %39 %bound0 = icmp ult ptr %scevgep226, %scevgep231 %bound1 = icmp ult ptr %scevgep229, %scevgep227 %found.conflict = and i1 %bound0, %bound1 br i1 %found.conflict, label %for.body24.preheader265, label %vector.ph vector.ph: ; preds = %vector.memcheck %n.vec = and i64 %14, -8 %ind.end = sub i64 %4, %n.vec %.cast = trunc i64 %n.vec to i32 %ind.end233 = sub i32 %sub21174, %.cast br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %.cast235 = trunc i64 %index to i32 %offset.idx = sub i32 %sub21174, %.cast235 %offset.idx236 = sub i64 %4, %index %40 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %offset.idx236 %41 = zext i32 %offset.idx to i64 %42 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %41 %43 = getelementptr inbounds i32, ptr %40, i64 -3 %wide.load = load <4 x i32>, ptr %43, align 4, !alias.scope !11, !noalias !14 %44 = getelementptr inbounds i32, ptr %40, i64 -7 %wide.load237 = load <4 x i32>, ptr %44, align 4, !alias.scope !11, !noalias !14 %45 = getelementptr inbounds i32, ptr %42, i64 -3 %wide.load239 = load <4 x i32>, ptr %45, align 4, !alias.scope !14 %46 = getelementptr inbounds i32, ptr %42, i64 -7 %wide.load241 = load <4 x i32>, ptr %46, align 4, !alias.scope !14 %47 = add nsw <4 x i32> %wide.load239, %wide.load %48 = add nsw <4 x i32> %wide.load241, %wide.load237 %49 = srem <4 x i32> %47, <i32 5077, i32 5077, i32 5077, i32 5077> %50 = srem <4 x i32> %48, <i32 5077, i32 5077, i32 5077, i32 5077> store <4 x i32> %49, ptr %43, align 4, !alias.scope !11, !noalias !14 store <4 x i32> %50, ptr %44, align 4, !alias.scope !11, !noalias !14 %index.next = add nuw i64 %index, 8 %51 = icmp eq i64 %index.next, %n.vec br i1 %51, label %middle.block, label %vector.body, !llvm.loop !16 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %14, %n.vec br i1 %cmp.n, label %for.inc39, label %for.body24.preheader265 for.body24.preheader265: ; preds = %vector.memcheck, %vector.scevcheck, %for.body24.preheader, %middle.block %indvars.iv190.ph = phi i64 [ %4, %vector.memcheck ], [ %4, %vector.scevcheck ], [ %4, %for.body24.preheader ], [ %ind.end, %middle.block ] %sub21177.ph = phi i32 [ %sub21174, %vector.memcheck ], [ %sub21174, %vector.scevcheck ], [ %sub21174, %for.body24.preheader ], [ %ind.end233, %middle.block ] br label %for.body24 for.body24: ; preds = %for.body24.preheader265, %for.body24 %indvars.iv190 = phi i64 [ %indvars.iv.next191, %for.body24 ], [ %indvars.iv190.ph, %for.body24.preheader265 ] %sub21177 = phi i32 [ %55, %for.body24 ], [ %sub21177.ph, %for.body24.preheader265 ] %arrayidx26 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %indvars.iv190 %idxprom32 = zext i32 %sub21177 to i64 %arrayidx33 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %idxprom32 %52 = load i32, ptr %arrayidx26, align 4 %53 = load i32, ptr %arrayidx33, align 4 %add.i = add nsw i32 %53, %52 %rem.i = srem i32 %add.i, 5077 store i32 %rem.i, ptr %arrayidx26, align 4, !tbaa.struct !19 %indvars.iv.next191 = add nsw i64 %indvars.iv190, -1 %54 = sub nsw i64 %indvars.iv.next191, %10 %cmp22 = icmp sgt i64 %54, -1 %55 = trunc i64 %54 to i32 br i1 %cmp22, label %for.body24, label %for.inc39, !llvm.loop !21 for.inc39: ; preds = %for.body24, %middle.block, %for.cond18.preheader %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1 %exitcond.not = icmp eq i64 %indvars.iv.next195, %wide.trip.count br i1 %exitcond.not, label %for.end41, label %for.cond18.preheader, !llvm.loop !22 for.end41: ; preds = %for.inc39 %call43 = call noalias ptr @calloc(i64 noundef %conv4, i64 noundef 4) #8 br i1 %cmp15178, label %for.body47.preheader, label %for.end115 for.body47.preheader: ; preds = %for.end41 %wide.trip.count212 = zext i32 %.lcssa to i64 %56 = sub nsw i64 0, %conv4 br label %for.body47 for.body47: ; preds = %for.body47.preheader, %for.inc113 %indvars.iv209 = phi i64 [ 0, %for.body47.preheader ], [ %indvars.iv.next210, %for.inc113 ] %ans.0185 = phi i32 [ 0, %for.body47.preheader ], [ %ans.1, %for.inc113 ] %arrayidx49 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv209 %57 = load i32, ptr %arrayidx49, align 4, !tbaa !5 %cmp50.not = icmp slt i32 %57, %3 br i1 %cmp50.not, label %for.cond52.preheader, label %for.inc113 for.cond52.preheader: ; preds = %for.body47 %cmp55180 = icmp sgt i32 %57, 0 br i1 %cmp55180, label %for.body57.preheader, label %for.body70.preheader for.body57.preheader: ; preds = %for.cond52.preheader %58 = zext i32 %57 to i64 %59 = shl nuw nsw i64 %58, 2 call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call43, ptr nonnull align 4 %call5, i64 %59, i1 false), !tbaa !20 br label %for.body70.preheader for.body70.preheader: ; preds = %for.cond52.preheader, %for.body57.preheader %60 = sext i32 %57 to i64 %61 = sub nsw i64 %conv4, %60 %min.iters.check249 = icmp ult i64 %61, 8 %62 = and i64 %60, 4611686018427387896 %diff.check = icmp eq i64 %62, 0 %or.cond = or i1 %min.iters.check249, %diff.check br i1 %or.cond, label %for.body70.preheader264, label %vector.ph250 vector.ph250: ; preds = %for.body70.preheader %n.vec252 = and i64 %61, -8 %ind.end253 = add nsw i64 %n.vec252, %60 br label %vector.body256 vector.body256: ; preds = %vector.body256, %vector.ph250 %index257 = phi i64 [ 0, %vector.ph250 ], [ %index.next263, %vector.body256 ] %offset.idx258 = add i64 %index257, %60 %63 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %offset.idx258 %64 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %offset.idx258 %65 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %index257 %wide.load259 = load <4 x i32>, ptr %64, align 4 %66 = getelementptr inbounds i32, ptr %64, i64 4 %wide.load260 = load <4 x i32>, ptr %66, align 4 %wide.load261 = load <4 x i32>, ptr %65, align 4 %67 = getelementptr inbounds i32, ptr %65, i64 4 %wide.load262 = load <4 x i32>, ptr %67, align 4 %68 = add <4 x i32> %wide.load259, <i32 5077, i32 5077, i32 5077, i32 5077> %69 = add <4 x i32> %wide.load260, <i32 5077, i32 5077, i32 5077, i32 5077> %70 = sub <4 x i32> %68, %wide.load261 %71 = sub <4 x i32> %69, %wide.load262 %72 = srem <4 x i32> %70, <i32 5077, i32 5077, i32 5077, i32 5077> %73 = srem <4 x i32> %71, <i32 5077, i32 5077, i32 5077, i32 5077> store <4 x i32> %72, ptr %63, align 4 %74 = getelementptr inbounds i32, ptr %63, i64 4 store <4 x i32> %73, ptr %74, align 4 %index.next263 = add nuw i64 %index257, 8 %75 = icmp eq i64 %index.next263, %n.vec252 br i1 %75, label %middle.block247, label %vector.body256, !llvm.loop !23 middle.block247: ; preds = %vector.body256 %cmp.n255 = icmp eq i64 %61, %n.vec252 br i1 %cmp.n255, label %for.cond89.preheader, label %for.body70.preheader264 for.body70.preheader264: ; preds = %for.body70.preheader, %middle.block247 %indvars.iv200.ph = phi i64 [ %60, %for.body70.preheader ], [ %ind.end253, %middle.block247 ] %76 = sub nsw i64 %conv4, %indvars.iv200.ph %xtraiter = and i64 %76, 1 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body70.prol.loopexit, label %for.body70.prol for.body70.prol: ; preds = %for.body70.preheader264 %arrayidx72.prol = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %indvars.iv200.ph %arrayidx75.prol = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %indvars.iv200.ph %77 = sub nsw i64 %indvars.iv200.ph, %60 %arrayidx80.prol = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %77 %78 = load i32, ptr %arrayidx75.prol, align 4 %79 = load i32, ptr %arrayidx80.prol, align 4 %sub.i.prol = add i32 %78, 5077 %add.i169.prol = sub i32 %sub.i.prol, %79 %rem.i170.prol = srem i32 %add.i169.prol, 5077 store i32 %rem.i170.prol, ptr %arrayidx72.prol, align 4, !tbaa.struct !19 %indvars.iv.next201.prol = add nsw i64 %indvars.iv200.ph, 1 br label %for.body70.prol.loopexit for.body70.prol.loopexit: ; preds = %for.body70.prol, %for.body70.preheader264 %indvars.iv200.unr = phi i64 [ %indvars.iv200.ph, %for.body70.preheader264 ], [ %indvars.iv.next201.prol, %for.body70.prol ] %80 = xor i64 %indvars.iv200.ph, %56 %81 = icmp eq i64 %80, -1 br i1 %81, label %for.cond89.preheader, label %for.body70 for.cond89.preheader: ; preds = %for.body70.prol.loopexit, %for.body70, %middle.block247 %sub92 = sub nsw i32 %3, %57 %82 = sext i32 %sub92 to i64 br label %for.cond89 for.body70: ; preds = %for.body70.prol.loopexit, %for.body70 %indvars.iv200 = phi i64 [ %indvars.iv.next201.1, %for.body70 ], [ %indvars.iv200.unr, %for.body70.prol.loopexit ] %arrayidx72 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %indvars.iv200 %arrayidx75 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %indvars.iv200 %83 = sub nsw i64 %indvars.iv200, %60 %arrayidx80 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %83 %84 = load i32, ptr %arrayidx75, align 4 %85 = load i32, ptr %arrayidx80, align 4 %sub.i = add i32 %84, 5077 %add.i169 = sub i32 %sub.i, %85 %rem.i170 = srem i32 %add.i169, 5077 store i32 %rem.i170, ptr %arrayidx72, align 4, !tbaa.struct !19 %indvars.iv.next201 = add nsw i64 %indvars.iv200, 1 %arrayidx72.1 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %indvars.iv.next201 %arrayidx75.1 = getelementptr inbounds %struct.hashNode, ptr %call5, i64 %indvars.iv.next201 %86 = sub nsw i64 %indvars.iv.next201, %60 %arrayidx80.1 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %86 %87 = load i32, ptr %arrayidx75.1, align 4 %88 = load i32, ptr %arrayidx80.1, align 4 %sub.i.1 = add i32 %87, 5077 %add.i169.1 = sub i32 %sub.i.1, %88 %rem.i170.1 = srem i32 %add.i169.1, 5077 store i32 %rem.i170.1, ptr %arrayidx72.1, align 4, !tbaa.struct !19 %indvars.iv.next201.1 = add nsw i64 %indvars.iv200, 2 %exitcond205.not.1 = icmp eq i64 %indvars.iv.next201.1, %conv4 br i1 %exitcond205.not.1, label %for.cond89.preheader, label %for.body70, !llvm.loop !24 for.cond89: ; preds = %for.cond89.preheader, %for.body95 %indvars.iv206 = phi i64 [ %conv4, %for.cond89.preheader ], [ %indvars.iv.next207, %for.body95 ] %cmp93.not.not.not = icmp sle i64 %indvars.iv206, %82 br i1 %cmp93.not.not.not, label %for.end104, label %for.body95 for.body95: ; preds = %for.cond89 %indvars.iv.next207 = add nsw i64 %indvars.iv206, -1 %arrayidx97 = getelementptr inbounds %struct.hashNode, ptr %call43, i64 %indvars.iv.next207 %89 = load i32, ptr %arrayidx97, align 4 %cmp1.i = icmp sgt i32 %89, 0 br i1 %cmp1.i, label %for.end104, label %for.cond89, !llvm.loop !25 for.end104: ; preds = %for.body95, %for.cond89 %inc111 = zext i1 %cmp93.not.not.not to i32 %spec.select = add nsw i32 %ans.0185, %inc111 br label %for.inc113 for.inc113: ; preds = %for.end104, %for.body47 %ans.1 = phi i32 [ %ans.0185, %for.body47 ], [ %spec.select, %for.end104 ] %indvars.iv.next210 = add nuw nsw i64 %indvars.iv209, 1 %exitcond213.not = icmp eq i64 %indvars.iv.next210, %wide.trip.count212 br i1 %exitcond213.not, label %for.end115, label %for.body47, !llvm.loop !26 for.end115: ; preds = %for.inc113, %for.end, %for.end41 %ans.0.lcssa = phi i32 [ 0, %for.end41 ], [ 0, %for.end ], [ %ans.1, %for.inc113 ] %call116 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret void } ; 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,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4 ; 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) #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: tail call void @run() ret i32 0 } ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #6 attributes #0 = { 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 #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,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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 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, !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 = !{!12} !12 = distinct !{!12, !13} !13 = distinct !{!13, !"LVerDomain"} !14 = !{!15} !15 = distinct !{!15, !13} !16 = distinct !{!16, !10, !17, !18} !17 = !{!"llvm.loop.isvectorized", i32 1} !18 = !{!"llvm.loop.unroll.runtime.disable"} !19 = !{i64 0, i64 4, !20} !20 = !{!7, !7, i64 0} !21 = distinct !{!21, !10, !17} !22 = distinct !{!22, !10} !23 = distinct !{!23, !10, !17, !18} !24 = distinct !{!24, !10, !17} !25 = distinct !{!25, !10} !26 = distinct !{!26, !10}
#include <stdio.h> int ball_invest(int balls[11],int ball_num,int B[11],int C[11],int bn,int cn){ int is_possible = 0; int i; if(B[bn] < balls[ball_num]){ if(ball_num == 10)return 1; B[bn+1] = balls[ball_num]; is_possible += ball_invest(balls,ball_num + 1,B,C,bn+1,cn); B[bn+1] = 0; } if(C[cn] < balls[ball_num]){ if(ball_num == 10)return 1; C[cn+1] = balls[ball_num]; is_possible += ball_invest(balls,ball_num + 1,B,C,bn,cn+1); C[cn+1] = 0; } return is_possible; } int main(void){ int B[11]; int C[11]; int balls[11]; int i; int n; int is_possible = 0; scanf("%d",&n); for(;n > 0;n--){ B[0] = 0; C[0] = 0; for(i = 1;i <= 10;i++){ scanf("%d",&balls[i]); B[i] = 0; C[i] = 0; } is_possible = ball_invest(balls,1,B,C,0,0); if(is_possible >= 1)printf("YES\n"); else printf("NO\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182826/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182826/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 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local i32 @ball_invest(ptr noundef %balls, i32 noundef %ball_num, ptr noundef %B, ptr noundef %C, i32 noundef %bn, i32 noundef %cn) local_unnamed_addr #0 { entry: %idxprom = sext i32 %bn to i64 %arrayidx = getelementptr inbounds i32, ptr %B, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %idxprom1 = sext i32 %ball_num to i64 %arrayidx2 = getelementptr inbounds i32, ptr %balls, i64 %idxprom1 %1 = load i32, ptr %arrayidx2, align 4, !tbaa !5 %cmp = icmp slt i32 %0, %1 br i1 %cmp, label %if.then, label %if.end15 if.then: ; preds = %entry %cmp3 = icmp eq i32 %ball_num, 10 br i1 %cmp3, label %common.ret70, label %if.end if.end: ; preds = %if.then %add = add nsw i32 %bn, 1 %idxprom7 = sext i32 %add to i64 %arrayidx8 = getelementptr inbounds i32, ptr %B, i64 %idxprom7 store i32 %1, ptr %arrayidx8, align 4, !tbaa !5 %add9 = add nsw i32 %ball_num, 1 %call = tail call i32 @ball_invest(ptr noundef nonnull %balls, i32 noundef %add9, ptr noundef nonnull %B, ptr noundef %C, i32 noundef %add, i32 noundef %cn) store i32 0, ptr %arrayidx8, align 4, !tbaa !5 %.pre = load i32, ptr %arrayidx2, align 4, !tbaa !5 br label %if.end15 if.end15: ; preds = %if.end, %entry %2 = phi i32 [ %.pre, %if.end ], [ %1, %entry ] %is_possible.0 = phi i32 [ %call, %if.end ], [ 0, %entry ] %idxprom16 = sext i32 %cn to i64 %arrayidx17 = getelementptr inbounds i32, ptr %C, i64 %idxprom16 %3 = load i32, ptr %arrayidx17, align 4, !tbaa !5 %cmp20 = icmp slt i32 %3, %2 br i1 %cmp20, label %if.then21, label %common.ret70 if.then21: ; preds = %if.end15 %cmp22 = icmp eq i32 %ball_num, 10 br i1 %cmp22, label %common.ret70, label %if.end24 common.ret70: ; preds = %if.end15, %if.then21, %if.then, %if.end24 %common.ret70.op = phi i32 [ %add33, %if.end24 ], [ 1, %if.then ], [ 1, %if.then21 ], [ %is_possible.0, %if.end15 ] ret i32 %common.ret70.op if.end24: ; preds = %if.then21 %add27 = add nsw i32 %cn, 1 %idxprom28 = sext i32 %add27 to i64 %arrayidx29 = getelementptr inbounds i32, ptr %C, i64 %idxprom28 store i32 %2, ptr %arrayidx29, align 4, !tbaa !5 %add30 = add nsw i32 %ball_num, 1 %call32 = tail call i32 @ball_invest(ptr noundef nonnull %balls, i32 noundef %add30, ptr noundef nonnull %B, ptr noundef nonnull %C, i32 noundef %bn, i32 noundef %add27) %add33 = add nsw i32 %call32, %is_possible.0 store i32 0, ptr %arrayidx29, align 4, !tbaa !5 br label %common.ret70 } ; 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: %B = alloca [11 x i32], align 16 %C = alloca [11 x i32], align 16 %balls = alloca [11 x i32], align 16 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %B) #5 call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %C) #5 call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %balls) #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) %.pr = load i32, ptr %n, align 4, !tbaa !5 %cmp25 = icmp sgt i32 %.pr, 0 br i1 %cmp25, label %for.body.preheader, label %for.end18 for.body.preheader: ; preds = %entry %arrayidx5 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 1 %arrayidx8 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 1 %arrayidx10 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 1 %arrayidx5.1 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 2 %arrayidx8.1 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 2 %arrayidx10.1 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 2 %arrayidx5.2 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 3 %arrayidx8.2 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 3 %arrayidx10.2 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 3 %arrayidx5.3 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 4 %arrayidx8.3 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 4 %arrayidx10.3 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 4 %arrayidx5.4 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 5 %arrayidx8.4 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 5 %arrayidx10.4 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 5 %arrayidx5.5 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 6 %arrayidx8.5 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 6 %arrayidx10.5 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 6 %arrayidx5.6 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 7 %arrayidx8.6 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 7 %arrayidx10.6 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 7 %arrayidx5.7 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 8 %arrayidx8.7 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 8 %arrayidx10.7 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 8 %arrayidx5.8 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 9 %arrayidx8.8 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 9 %arrayidx10.8 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 9 %arrayidx5.9 = getelementptr inbounds [11 x i32], ptr %balls, i64 0, i64 10 %arrayidx8.9 = getelementptr inbounds [11 x i32], ptr %B, i64 0, i64 10 %arrayidx10.9 = getelementptr inbounds [11 x i32], ptr %C, i64 0, i64 10 br label %for.body for.body: ; preds = %for.body.preheader, %for.body store i32 0, ptr %B, align 16, !tbaa !5 store i32 0, ptr %C, align 16, !tbaa !5 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5) store i32 0, ptr %arrayidx8, align 4, !tbaa !5 store i32 0, ptr %arrayidx10, align 4, !tbaa !5 %call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1) store i32 0, ptr %arrayidx8.1, align 8, !tbaa !5 store i32 0, ptr %arrayidx10.1, align 8, !tbaa !5 %call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2) store i32 0, ptr %arrayidx8.2, align 4, !tbaa !5 store i32 0, ptr %arrayidx10.2, align 4, !tbaa !5 %call6.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.3) store i32 0, ptr %arrayidx8.3, align 16, !tbaa !5 store i32 0, ptr %arrayidx10.3, align 16, !tbaa !5 %call6.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.4) store i32 0, ptr %arrayidx8.4, align 4, !tbaa !5 store i32 0, ptr %arrayidx10.4, align 4, !tbaa !5 %call6.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.5) store i32 0, ptr %arrayidx8.5, align 8, !tbaa !5 store i32 0, ptr %arrayidx10.5, align 8, !tbaa !5 %call6.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.6) store i32 0, ptr %arrayidx8.6, align 4, !tbaa !5 store i32 0, ptr %arrayidx10.6, align 4, !tbaa !5 %call6.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.7) store i32 0, ptr %arrayidx8.7, align 16, !tbaa !5 store i32 0, ptr %arrayidx10.7, align 16, !tbaa !5 %call6.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.8) store i32 0, ptr %arrayidx8.8, align 4, !tbaa !5 store i32 0, ptr %arrayidx10.8, align 4, !tbaa !5 %call6.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.9) store i32 0, ptr %arrayidx8.9, align 8, !tbaa !5 store i32 0, ptr %arrayidx10.9, align 8, !tbaa !5 %call13 = call i32 @ball_invest(ptr noundef nonnull %balls, i32 noundef 1, ptr noundef nonnull %B, ptr noundef nonnull %C, i32 noundef 0, i32 noundef 0) %cmp14 = icmp sgt i32 %call13, 0 %str.3.str = select i1 %cmp14, ptr @str.3, ptr @str %puts23 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str) %0 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %0, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %cmp = icmp sgt i32 %0, 1 br i1 %cmp, label %for.body, label %for.end18, !llvm.loop !9 for.end18: ; preds = %for.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %balls) #5 call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %C) #5 call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %B) #5 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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { 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 #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 = { nofree nounwind } 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"}
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <inttypes.h> #include <stdlib.h> #include <string.h> #include <math.h> typedef uint64_t uint64; typedef uint32_t uint32; typedef int64_t int64; typedef int32_t int32; #define finc(i,a,b) for(int32 i=(a);i<=(b);i++) #define fdec(i,a,b) for(int32 i=(b)+1;i-->(a);) #define in(i,bits) scanf("%"PRId##bits"",&i) #define uin(i,bits) scanf("%"PRIu##bits"",&i) #define out(i,bits,c) printf("%"PRId##bits"%c",i,c) #define uout(i,bits,c) printf("%"PRIu##bits"%c",i,c) #define end '\n' int main(void) { int32 test; in(test, 32); while (test--) { int32 n; in(n, 32); for (int32 i = 2 * n + 2; i <= 4 * n; i += 2) out(i, 32, ' '); putchar(end); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18287/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18287/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 [5 x i8] c"%d%c\00", align 1 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %test = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %test) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %test) %0 = load i32, ptr %test, align 4, !tbaa !5 %dec12 = add nsw i32 %0, -1 store i32 %dec12, ptr %test, align 4, !tbaa !5 %tobool.not13 = icmp eq i32 %0, 0 br i1 %tobool.not13, label %while.end, label %while.body while.body: ; preds = %entry, %for.cond.cleanup call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %mul = shl nsw i32 %1, 1 %i.08 = add nsw i32 %mul, 2 %mul29 = shl nsw i32 %1, 2 %cmp.not10 = icmp sgt i32 %i.08, %mul29 br i1 %cmp.not10, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.body, %while.body %2 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i = call i32 @putc(i32 noundef 10, ptr noundef %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 %3 = load i32, ptr %test, align 4, !tbaa !5 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %test, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11 for.body: ; preds = %while.body, %for.body %i.011 = phi i32 [ %i.0, %for.body ], [ %i.08, %while.body ] %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.011, i32 noundef 32) %i.0 = add nsw i32 %i.011, 2 %4 = load i32, ptr %n, align 4, !tbaa !5 %mul2 = shl nsw i32 %4, 2 %cmp.not = icmp sgt i32 %i.0, %mul2 br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13 while.end: ; preds = %for.cond.cleanup, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %test) #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 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) 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 = !{!10, !10, i64 0} !10 = !{!"any pointer", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12}
#include<stdio.h> int list[10]; int c=0; int solve(int n,int a,int b){ if(n==10){ return 1; } else{ if(a<list[n]){ if(solve(n+1,list[n],b)){ return 1; } } if(b<list[n]){ if(solve(n+1,a,list[n])){ return 1; } } return 0; } } int main(){ int i,j; int n; int a,b; scanf("%d",&n); a=0,b=0; for(i=0;i<n;i++){ for(j=0;j<10;j++){ scanf("%d",&list[j]); } printf(solve(0,0,0)?"YES\n":"NO\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182941/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182941/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 i32 0, align 4 @list = dso_local global [10 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"YES\0A\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"NO\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @solve(i32 noundef %n, i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cmp = icmp eq i32 %n, 10 br i1 %cmp, label %return, label %if.else if.else: ; preds = %entry %idxprom = sext i32 %n to i64 %arrayidx = getelementptr inbounds [10 x i32], ptr @list, i64 0, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %0, %a br i1 %cmp1, label %if.then2, label %if.end6 if.then2: ; preds = %if.else %add = add nsw i32 %n, 1 %call = tail call i32 @solve(i32 noundef %add, i32 noundef %0, i32 noundef %b), !range !9 %tobool.not = icmp eq i32 %call, 0 br i1 %tobool.not, label %if.end6, label %return if.end6: ; preds = %if.then2, %if.else %cmp9 = icmp sgt i32 %0, %b br i1 %cmp9, label %if.then10, label %if.end18 if.then10: ; preds = %if.end6 %add11 = add nsw i32 %n, 1 %call14 = tail call i32 @solve(i32 noundef %add11, i32 noundef %a, i32 noundef %0), !range !9 %tobool15.not = icmp eq i32 %call14, 0 br i1 %tobool15.not, label %if.end18, label %return if.end18: ; preds = %if.then10, %if.end6 br label %return return: ; preds = %if.then10, %if.then2, %entry, %if.end18 %retval.0 = phi i32 [ 0, %if.end18 ], [ 1, %entry ], [ 1, %if.then2 ], [ 1, %if.then10 ] ret i32 %retval.0 } ; 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 %cmp14 = icmp sgt i32 %0, 0 br i1 %cmp14, label %for.cond1.preheader, label %for.end9 for.cond1.preheader: ; preds = %entry, %for.cond1.preheader %i.015 = phi i32 [ %inc8, %for.cond1.preheader ], [ 0, %entry ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @list) %call4.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 1)) %call4.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 2)) %call4.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 3)) %call4.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 4)) %call4.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 5)) %call4.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 6)) %call4.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 7)) %call4.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 8)) %call4.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([10 x i32], ptr @list, i64 0, i64 9)) %call5 = call i32 @solve(i32 noundef 0, i32 noundef 0, i32 noundef 0), !range !9 %tobool.not = icmp eq i32 %call5, 0 %cond = select i1 %tobool.not, ptr @.str.2, ptr @.str.1 %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond) %inc8 = add nuw nsw i32 %i.015, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc8, %1 br i1 %cmp, label %for.cond1.preheader, label %for.end9, !llvm.loop !10 for.end9: ; preds = %for.cond1.preheader, %entry 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(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 = { 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"} !9 = !{i32 0, i32 2} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> typedef long long ll; ll battis_read_int() { ll ret = 0; char c = getchar(); int sgn; while (1) { if (c == EOF) { return EOF; } if (c >= '0' && c <= '9') { sgn = 1; break; } if (c == '-') { c = getchar(); if (c < '0' || c > '9') { continue; } sgn = -1; break; } c = getchar(); } while (1) { ret = ret*10 + c - '0'; c = getchar(); if (c < '0' || c > '9') { return sgn*ret; } } } #define get_int() battis_read_int() #define get_double() battis_read_double() int max(int a, int b) { if (a > b) { return a; } return b; } int min(int a, int b) { if (a < b) { return a; } return b; } int main() { ll i; ll n = get_int(); ll b[n/2]; ll a[n]; for (i = 0; i < n/2; i++) { b[i] = get_int(); } ll t = b[n/2 - 1]; a[n/2 - 1] = t/2; a[n/2] = t - a[n/2 - 1]; ll mx = a[n/2]; ll mn = a[n/2 - 1]; for (i = 1; i < n/2; i++) { if (b[n/2 - 1 - i] - mx <= a[n/2 - i]) { a[n/2 + i] = mx; a[n/2 - 1 - i] = b[n/2 - 1 - i] - mx; mn = a[n/2 - 1 - i]; mx = a[n/2 + i]; } else { a[n/2 - 1 - i] = mn; a[n/2 + i] = b[n/2 - 1 - i] - mn; mn = a[n/2 - 1 - i]; mx = a[n/2 + i]; } } for (i = 0; i < n - 1; i++) { printf("%lld ", a[i]); } printf("%lld\n", a[i]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183/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"%lld \00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i64 @battis_read_int() local_unnamed_addr #0 { entry: %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i = tail call i32 @getc(ptr noundef %0) %conv = trunc i32 %call.i to i8 %cmp61 = icmp eq i8 %conv, -1 br i1 %cmp61, label %cleanup, label %if.end if.end: ; preds = %entry, %while.cond.backedge %c.062 = phi i8 [ %conv16, %while.cond.backedge ], [ %conv, %entry ] %1 = add i8 %c.062, -48 %or.cond = icmp ult i8 %1, 10 br i1 %or.cond, label %while.end, label %if.end10 if.end10: ; preds = %if.end %cmp12 = icmp eq i8 %c.062, 45 %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i58 = tail call i32 @getc(ptr noundef %2) %conv16 = trunc i32 %call.i58 to i8 br i1 %cmp12, label %if.then14, label %while.cond.backedge if.then14: ; preds = %if.end10 %sext = shl i32 %call.i58, 24 %3 = add i32 %sext, -956301313 %or.cond46 = icmp ult i32 %3, -150994945 br i1 %or.cond46, label %while.cond.backedge, label %while.end while.cond.backedge: ; preds = %if.end10, %if.then14 %cmp = icmp eq i8 %conv16, -1 br i1 %cmp, label %cleanup, label %if.end while.end: ; preds = %if.then14, %if.end %c.1 = phi i8 [ %c.062, %if.end ], [ %conv16, %if.then14 ] %sgn.0 = phi i64 [ 1, %if.end ], [ -1, %if.then14 ] br label %while.cond28 while.cond28: ; preds = %while.cond28, %while.end %ret.0 = phi i64 [ 0, %while.end ], [ %sub, %while.cond28 ] %c.2 = phi i8 [ %c.1, %while.end ], [ %conv32, %while.cond28 ] %mul = mul nsw i64 %ret.0, 10 %conv30 = sext i8 %c.2 to i64 %add = add i64 %mul, -48 %sub = add i64 %add, %conv30 %4 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i60 = tail call i32 @getc(ptr noundef %4) %conv32 = trunc i32 %call.i60 to i8 %sext57 = shl i32 %call.i60, 24 %5 = add i32 %sext57, -956301313 %or.cond47 = icmp ult i32 %5, -150994945 br i1 %or.cond47, label %if.then40, label %while.cond28 if.then40: ; preds = %while.cond28 %mul42 = mul nsw i64 %sub, %sgn.0 br label %cleanup cleanup: ; preds = %while.cond.backedge, %entry, %if.then40 %retval.0 = phi i64 [ %mul42, %if.then40 ], [ -1, %entry ], [ -1, %while.cond.backedge ] ret i64 %retval.0 } ; 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: %a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %a.b } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %vla176184 = alloca [0 x i64], align 16 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i.i = tail call i32 @getc(ptr noundef %0) %conv.i = trunc i32 %call.i.i to i8 %cmp61.i = icmp eq i8 %conv.i, -1 br i1 %cmp61.i, label %battis_read_int.exit.thread, label %if.end.i if.end.i: ; preds = %entry, %while.cond.backedge.i %c.062.i = phi i8 [ %conv16.i, %while.cond.backedge.i ], [ %conv.i, %entry ] %1 = add i8 %c.062.i, -48 %or.cond.i = icmp ult i8 %1, 10 br i1 %or.cond.i, label %while.end.i, label %if.end10.i if.end10.i: ; preds = %if.end.i %cmp12.i = icmp eq i8 %c.062.i, 45 %2 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i58.i = tail call i32 @getc(ptr noundef %2) %conv16.i = trunc i32 %call.i58.i to i8 br i1 %cmp12.i, label %if.then14.i, label %while.cond.backedge.i if.then14.i: ; preds = %if.end10.i %sext.i = shl i32 %call.i58.i, 24 %3 = add i32 %sext.i, -956301313 %or.cond46.i = icmp ult i32 %3, -150994945 br i1 %or.cond46.i, label %while.cond.backedge.i, label %while.end.i while.cond.backedge.i: ; preds = %if.then14.i, %if.end10.i %cmp.i = icmp eq i8 %conv16.i, -1 br i1 %cmp.i, label %battis_read_int.exit.thread, label %if.end.i while.end.i: ; preds = %if.then14.i, %if.end.i %c.1.i = phi i8 [ %c.062.i, %if.end.i ], [ %conv16.i, %if.then14.i ] %sgn.0.i = phi i64 [ 1, %if.end.i ], [ -1, %if.then14.i ] br label %while.cond28.i while.cond28.i: ; preds = %while.cond28.i, %while.end.i %ret.0.i = phi i64 [ 0, %while.end.i ], [ %sub.i, %while.cond28.i ] %c.2.i = phi i8 [ %c.1.i, %while.end.i ], [ %conv32.i, %while.cond28.i ] %mul.i = mul nsw i64 %ret.0.i, 10 %conv30.i = sext i8 %c.2.i to i64 %add.i = add i64 %mul.i, -48 %sub.i = add i64 %add.i, %conv30.i %4 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i60.i = tail call i32 @getc(ptr noundef %4) %conv32.i = trunc i32 %call.i60.i to i8 %sext57.i = shl i32 %call.i60.i, 24 %5 = add i32 %sext57.i, -956301313 %or.cond47.i = icmp ult i32 %5, -150994945 br i1 %or.cond47.i, label %battis_read_int.exit, label %while.cond28.i battis_read_int.exit.thread: ; preds = %while.cond.backedge.i, %entry %vla1177185 = alloca [18446744073709551615 x i64], align 16 br label %for.end battis_read_int.exit: ; preds = %while.cond28.i %mul42.i = mul nsw i64 %sub.i, %sgn.0.i %div = sdiv i64 %mul42.i, 2 %vla = alloca i64, i64 %div, align 16 %vla1 = alloca i64, i64 %mul42.i, align 16 %cmp164 = icmp sgt i64 %mul42.i, 1 br i1 %cmp164, label %for.body, label %for.end for.body: ; preds = %battis_read_int.exit, %battis_read_int.exit163 %i.0165 = phi i64 [ %inc, %battis_read_int.exit163 ], [ 0, %battis_read_int.exit ] %6 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i.i131 = tail call i32 @getc(ptr noundef %6) %conv.i132 = trunc i32 %call.i.i131 to i8 %cmp61.i133 = icmp eq i8 %conv.i132, -1 br i1 %cmp61.i133, label %battis_read_int.exit163, label %if.end.i134 if.end.i134: ; preds = %for.body, %while.cond.backedge.i141 %c.062.i135 = phi i8 [ %conv16.i140, %while.cond.backedge.i141 ], [ %conv.i132, %for.body ] %7 = add i8 %c.062.i135, -48 %or.cond.i136 = icmp ult i8 %7, 10 br i1 %or.cond.i136, label %while.end.i147, label %if.end10.i137 if.end10.i137: ; preds = %if.end.i134 %cmp12.i138 = icmp eq i8 %c.062.i135, 45 %8 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i58.i139 = tail call i32 @getc(ptr noundef %8) %conv16.i140 = trunc i32 %call.i58.i139 to i8 br i1 %cmp12.i138, label %if.then14.i144, label %while.cond.backedge.i141 if.then14.i144: ; preds = %if.end10.i137 %sext.i145 = shl i32 %call.i58.i139, 24 %9 = add i32 %sext.i145, -956301313 %or.cond46.i146 = icmp ult i32 %9, -150994945 br i1 %or.cond46.i146, label %while.cond.backedge.i141, label %while.end.i147 while.cond.backedge.i141: ; preds = %if.then14.i144, %if.end10.i137 %cmp.i142 = icmp eq i8 %conv16.i140, -1 br i1 %cmp.i142, label %battis_read_int.exit163, label %if.end.i134 while.end.i147: ; preds = %if.then14.i144, %if.end.i134 %c.1.i148 = phi i8 [ %c.062.i135, %if.end.i134 ], [ %conv16.i140, %if.then14.i144 ] %sgn.0.i149 = phi i64 [ 1, %if.end.i134 ], [ -1, %if.then14.i144 ] br label %while.cond28.i150 while.cond28.i150: ; preds = %while.cond28.i150, %while.end.i147 %ret.0.i151 = phi i64 [ 0, %while.end.i147 ], [ %sub.i156, %while.cond28.i150 ] %c.2.i152 = phi i8 [ %c.1.i148, %while.end.i147 ], [ %conv32.i158, %while.cond28.i150 ] %mul.i153 = mul nsw i64 %ret.0.i151, 10 %conv30.i154 = sext i8 %c.2.i152 to i64 %add.i155 = add i64 %mul.i153, -48 %sub.i156 = add i64 %add.i155, %conv30.i154 %10 = load ptr, ptr @stdin, align 8, !tbaa !5 %call.i60.i157 = tail call i32 @getc(ptr noundef %10) %conv32.i158 = trunc i32 %call.i60.i157 to i8 %sext57.i159 = shl i32 %call.i60.i157, 24 %11 = add i32 %sext57.i159, -956301313 %or.cond47.i160 = icmp ult i32 %11, -150994945 br i1 %or.cond47.i160, label %if.then40.i161, label %while.cond28.i150 if.then40.i161: ; preds = %while.cond28.i150 %mul42.i162 = mul nsw i64 %sub.i156, %sgn.0.i149 br label %battis_read_int.exit163 battis_read_int.exit163: ; preds = %while.cond.backedge.i141, %for.body, %if.then40.i161 %retval.0.i143 = phi i64 [ %mul42.i162, %if.then40.i161 ], [ -1, %for.body ], [ -1, %while.cond.backedge.i141 ] %arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.0165 store i64 %retval.0.i143, ptr %arrayidx, align 8, !tbaa !9 %inc = add nuw nsw i64 %i.0165, 1 %exitcond.not = icmp eq i64 %inc, %div br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11 for.end: ; preds = %battis_read_int.exit163, %battis_read_int.exit.thread, %battis_read_int.exit %cmp164183 = phi i1 [ false, %battis_read_int.exit.thread ], [ false, %battis_read_int.exit ], [ %cmp164, %battis_read_int.exit163 ] %vla1182 = phi ptr [ %vla1177185, %battis_read_int.exit.thread ], [ %vla1, %battis_read_int.exit ], [ %vla1, %battis_read_int.exit163 ] %vla181 = phi ptr [ %vla176184, %battis_read_int.exit.thread ], [ %vla, %battis_read_int.exit ], [ %vla, %battis_read_int.exit163 ] %div180 = phi i64 [ 0, %battis_read_int.exit.thread ], [ %div, %battis_read_int.exit ], [ %div, %battis_read_int.exit163 ] %retval.0.i179 = phi i64 [ -1, %battis_read_int.exit.thread ], [ %mul42.i, %battis_read_int.exit ], [ %mul42.i, %battis_read_int.exit163 ] %sub = add nsw i64 %div180, -1 %arrayidx5 = getelementptr inbounds i64, ptr %vla181, i64 %sub %12 = load i64, ptr %arrayidx5, align 8, !tbaa !9 %div6 = sdiv i64 %12, 2 %arrayidx9 = getelementptr inbounds i64, ptr %vla1182, i64 %sub store i64 %div6, ptr %arrayidx9, align 8, !tbaa !9 %sub13 = sub nsw i64 %12, %div6 %arrayidx15 = getelementptr inbounds i64, ptr %vla1182, i64 %div180 store i64 %sub13, ptr %arrayidx15, align 8, !tbaa !9 %cmp23166 = icmp sgt i64 %retval.0.i179, 3 br i1 %cmp23166, label %for.body24.preheader, label %for.cond74.preheader for.body24.preheader: ; preds = %for.end %smax = tail call i64 @llvm.smax.i64(i64 %div180, i64 2) br label %for.body24 for.cond74.preheader: ; preds = %for.inc71, %for.end %sub75 = add i64 %retval.0.i179, -1 br i1 %cmp164183, label %for.body77, label %for.end82 for.body24: ; preds = %for.body24.preheader, %for.inc71 %mn.0169 = phi i64 [ %mn.1, %for.inc71 ], [ %div6, %for.body24.preheader ] %mx.0168 = phi i64 [ %mx.1, %for.inc71 ], [ %sub13, %for.body24.preheader ] %i.1167 = phi i64 [ %inc72, %for.inc71 ], [ 1, %for.body24.preheader ] %sub27 = sub nsw i64 %sub, %i.1167 %arrayidx28 = getelementptr inbounds i64, ptr %vla181, i64 %sub27 %13 = load i64, ptr %arrayidx28, align 8, !tbaa !9 %sub29 = sub nsw i64 %13, %mx.0168 %sub31 = sub nsw i64 %div180, %i.1167 %arrayidx32 = getelementptr inbounds i64, ptr %vla1182, i64 %sub31 %14 = load i64, ptr %arrayidx32, align 8, !tbaa !9 %cmp33.not = icmp sgt i64 %sub29, %14 br i1 %cmp33.not, label %if.else, label %if.then if.then: ; preds = %for.body24 %arrayidx35 = getelementptr i64, ptr %arrayidx15, i64 %i.1167 store i64 %mx.0168, ptr %arrayidx35, align 8, !tbaa !9 %arrayidx44 = getelementptr inbounds i64, ptr %vla1182, i64 %sub27 store i64 %sub29, ptr %arrayidx44, align 8, !tbaa !9 %15 = load i64, ptr %arrayidx35, align 8, !tbaa !9 br label %for.inc71 if.else: ; preds = %for.body24 %arrayidx55 = getelementptr inbounds i64, ptr %vla1182, i64 %sub27 store i64 %mn.0169, ptr %arrayidx55, align 8, !tbaa !9 %sub60 = sub nsw i64 %13, %mn.0169 %arrayidx63 = getelementptr i64, ptr %arrayidx15, i64 %i.1167 store i64 %sub60, ptr %arrayidx63, align 8, !tbaa !9 %16 = load i64, ptr %arrayidx55, align 8, !tbaa !9 br label %for.inc71 for.inc71: ; preds = %if.then, %if.else %mx.1 = phi i64 [ %15, %if.then ], [ %sub60, %if.else ] %mn.1 = phi i64 [ %sub29, %if.then ], [ %16, %if.else ] %inc72 = add nuw nsw i64 %i.1167, 1 %exitcond172.not = icmp eq i64 %inc72, %smax br i1 %exitcond172.not, label %for.cond74.preheader, label %for.body24, !llvm.loop !13 for.body77: ; preds = %for.cond74.preheader, %for.body77 %i.2171 = phi i64 [ %inc81, %for.body77 ], [ 0, %for.cond74.preheader ] %arrayidx78 = getelementptr inbounds i64, ptr %vla1182, i64 %i.2171 %17 = load i64, ptr %arrayidx78, align 8, !tbaa !9 %call79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %17) %inc81 = add nuw nsw i64 %i.2171, 1 %exitcond173.not = icmp eq i64 %inc81, %sub75 br i1 %exitcond173.not, label %for.end82, label %for.body77, !llvm.loop !14 for.end82: ; preds = %for.body77, %for.cond74.preheader %i.2.lcssa = phi i64 [ 0, %for.cond74.preheader ], [ %sub75, %for.body77 ] %arrayidx83 = getelementptr inbounds i64, ptr %vla1182, i64 %i.2.lcssa %18 = load i64, ptr %arrayidx83, align 8, !tbaa !9 %call84 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %18) ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @getc(ptr nocapture noundef) 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 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 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 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 "no-trapping-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) } !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 = !{!"long long", !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) { float m5, m10; while (scanf("%f %f", &m5, &m10) != EOF){ if (35.5 > m5 && 71 > m10){ printf("AAA\n"); } else if (37.5 > m5 && 77 > m10){ printf("AA\n"); } else if (40 > m5 && 83 > m10){ printf("A\n"); } else if (43 > m5 && 89 > m10){ printf("B\n"); } else if (50 > m5 && 105 > m10){ printf("C\n"); } else if (55 > m5 && 116 > m10){ printf("D\n"); } else if (70 > m5 && 148 > m10){ printf("E\n"); } else { printf("NA\n"); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183049/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183049/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"%f %f\00", align 1 @str = private unnamed_addr constant [3 x i8] c"NA\00", align 1 @str.9 = private unnamed_addr constant [2 x i8] c"E\00", align 1 @str.10 = private unnamed_addr constant [2 x i8] c"D\00", align 1 @str.11 = private unnamed_addr constant [2 x i8] c"C\00", align 1 @str.12 = private unnamed_addr constant [2 x i8] c"B\00", align 1 @str.13 = private unnamed_addr constant [2 x i8] c"A\00", align 1 @str.14 = private unnamed_addr constant [3 x i8] c"AA\00", align 1 @str.15 = private unnamed_addr constant [4 x i8] c"AAA\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %m5 = alloca float, align 4 %m10 = alloca float, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m5) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m10) #4 %call75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m5, ptr noundef nonnull %m10) %cmp.not76 = icmp eq i32 %call75, -1 br i1 %cmp.not76, label %while.end, label %while.body while.body: ; preds = %entry, %if.end61 %0 = load float, ptr %m5, align 4, !tbaa !5 %cmp1 = fcmp olt float %0, 3.550000e+01 %1 = load float, ptr %m10, align 4 %cmp3 = fcmp olt float %1, 7.100000e+01 %or.cond = select i1 %cmp1, i1 %cmp3, i1 false br i1 %or.cond, label %if.end61, label %if.else if.else: ; preds = %while.body %cmp7 = fcmp olt float %0, 3.750000e+01 %cmp10 = fcmp olt float %1, 7.700000e+01 %or.cond62 = select i1 %cmp7, i1 %cmp10, i1 false br i1 %or.cond62, label %if.end61, label %if.else14 if.else14: ; preds = %if.else %cmp15 = fcmp olt float %0, 4.000000e+01 %cmp18 = fcmp olt float %1, 8.300000e+01 %or.cond63 = select i1 %cmp15, i1 %cmp18, i1 false br i1 %or.cond63, label %if.end61, label %if.else22 if.else22: ; preds = %if.else14 %cmp23 = fcmp olt float %0, 4.300000e+01 %cmp26 = fcmp olt float %1, 8.900000e+01 %or.cond64 = select i1 %cmp23, i1 %cmp26, i1 false br i1 %or.cond64, label %if.end61, label %if.else30 if.else30: ; preds = %if.else22 %cmp31 = fcmp olt float %0, 5.000000e+01 %cmp34 = fcmp olt float %1, 1.050000e+02 %or.cond65 = select i1 %cmp31, i1 %cmp34, i1 false br i1 %or.cond65, label %if.end61, label %if.else38 if.else38: ; preds = %if.else30 %cmp39 = fcmp olt float %0, 5.500000e+01 %cmp42 = fcmp olt float %1, 1.160000e+02 %or.cond66 = select i1 %cmp39, i1 %cmp42, i1 false br i1 %or.cond66, label %if.end61, label %if.else46 if.else46: ; preds = %if.else38 %cmp47 = fcmp olt float %0, 7.000000e+01 %cmp50 = fcmp olt float %1, 1.480000e+02 %or.cond67 = select i1 %cmp47, i1 %cmp50, i1 false %str.9.str = select i1 %or.cond67, ptr @str.9, ptr @str br label %if.end61 if.end61: ; preds = %if.else46, %if.else38, %if.else30, %if.else22, %if.else14, %if.else, %while.body %str.14.sink = phi ptr [ @str.15, %while.body ], [ @str.14, %if.else ], [ @str.13, %if.else14 ], [ @str.12, %if.else22 ], [ @str.11, %if.else30 ], [ @str.10, %if.else38 ], [ %str.9.str, %if.else46 ] %puts73 = call i32 @puts(ptr nonnull dereferenceable(1) %str.14.sink) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m5, ptr noundef nonnull %m10) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end61, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m10) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m5) #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 = !{!"float", !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; char canvas[105]; scanf("%d", &n); scanf("%s", canvas); char left = '?', right = '?'; int emptyLen = 0; int flag = 0; for (int i = 0; i < n; i++) { //printf("curr %d: %c\n", i, canvas[i]); if (canvas[i] == '?') { emptyLen++; //printf("?x%d at %d\n", emptyLen, i); if (emptyLen == 1) { right = (i < n-1)? canvas[i+1]: '?'; if (left == '?' || right == '?' || left == right) { //printf("ok ? at %d\n", i); flag = 1; } } if (emptyLen >= 2) { //printf("2+ ? at %d\n", i); flag = 1; } } else { if (i > 0 && canvas[i] == canvas[i-1]) { printf("No"); return 0; } left = canvas[i]; emptyLen = 0; } } printf((flag > 0)? "Yes": "No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1831/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1831/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"No\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %canvas = alloca [105 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3 call void @llvm.lifetime.start.p0(i64 105, ptr nonnull %canvas) #3 %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 %canvas) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not74 = icmp sgt i32 %0, 0 br i1 %cmp.not74, label %for.body.lr.ph, label %cleanup52 for.body.lr.ph: ; preds = %entry %sub = add nsw i32 %0, -1 %1 = zext i32 %sub to i64 %wide.trip.count = zext i32 %0 to i64 %2 = load i8, ptr %canvas, align 16, !tbaa !9 %cmp2.peel = icmp eq i8 %2, 63 %exitcond.peel.not = icmp eq i32 %0, 1 br i1 %exitcond.peel.not, label %for.end.loopexit, label %for.body.preheader for.body.preheader: ; preds = %for.body.lr.ph %spec.select85 = zext i1 %cmp2.peel to i32 br label %for.body for.body: ; preds = %for.body.preheader, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.body.preheader ] %flag.077 = phi i32 [ %flag.2, %for.inc ], [ %spec.select85, %for.body.preheader ] %emptyLen.076 = phi i32 [ %emptyLen.1, %for.inc ], [ %spec.select85, %for.body.preheader ] %left.075 = phi i8 [ %left.1, %for.inc ], [ %2, %for.body.preheader ] %arrayidx = getelementptr inbounds [105 x i8], ptr %canvas, i64 0, i64 %indvars.iv %3 = load i8, ptr %arrayidx, align 1, !tbaa !9 %cmp2 = icmp eq i8 %3, 63 br i1 %cmp2, label %if.then, label %land.lhs.true if.then: ; preds = %for.body %inc = add nsw i32 %emptyLen.076, 1 %cmp4 = icmp eq i32 %emptyLen.076, 0 br i1 %cmp4, label %if.then6, label %if.end25 if.then6: ; preds = %if.then %cmp7 = icmp ult i64 %indvars.iv, %1 br i1 %cmp7, label %cond.true, label %cond.end cond.true: ; preds = %if.then6 %4 = add nuw nsw i64 %indvars.iv, 1 %arrayidx10 = getelementptr inbounds [105 x i8], ptr %canvas, i64 0, i64 %4 %5 = load i8, ptr %arrayidx10, align 1, !tbaa !9 br label %cond.end cond.end: ; preds = %if.then6, %cond.true %cond = phi i8 [ %5, %cond.true ], [ 63, %if.then6 ] %cmp14 = icmp eq i8 %left.075, 63 %cmp17 = icmp eq i8 %cond, 63 %or.cond = select i1 %cmp14, i1 true, i1 %cmp17 %cmp22 = icmp eq i8 %left.075, %cond %or.cond71 = select i1 %or.cond, i1 true, i1 %cmp22 %spec.select72 = select i1 %or.cond71, i32 1, i32 %flag.077 br label %if.end25 if.end25: ; preds = %cond.end, %if.then %flag.1 = phi i32 [ %flag.077, %if.then ], [ %spec.select72, %cond.end ] %cmp26.inv = icmp slt i32 %emptyLen.076, 1 %spec.select = select i1 %cmp26.inv, i32 %flag.1, i32 1 br label %for.inc land.lhs.true: ; preds = %for.body %6 = add nuw i64 %indvars.iv, 4294967295 %idxprom36 = and i64 %6, 4294967295 %arrayidx37 = getelementptr inbounds [105 x i8], ptr %canvas, i64 0, i64 %idxprom36 %7 = load i8, ptr %arrayidx37, align 1, !tbaa !9 %cmp39 = icmp eq i8 %3, %7 br i1 %cmp39, label %cleanup52, label %for.inc for.inc: ; preds = %land.lhs.true, %if.end25 %left.1 = phi i8 [ %left.075, %if.end25 ], [ %3, %land.lhs.true ] %emptyLen.1 = phi i32 [ %inc, %if.end25 ], [ 0, %land.lhs.true ] %flag.2 = phi i32 [ %spec.select, %if.end25 ], [ %flag.077, %land.lhs.true ] %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.end.loopexit.loopexit, label %for.body, !llvm.loop !10 for.end.loopexit.loopexit: ; preds = %for.inc %8 = icmp sgt i32 %flag.2, 0 br label %for.end.loopexit for.end.loopexit: ; preds = %for.end.loopexit.loopexit, %for.body.lr.ph %flag.2.lcssa = phi i1 [ %cmp2.peel, %for.body.lr.ph ], [ %8, %for.end.loopexit.loopexit ] %9 = select i1 %flag.2.lcssa, ptr @.str.3, ptr @.str.2 br label %cleanup52 cleanup52: ; preds = %land.lhs.true, %entry, %for.end.loopexit %.str.2.sink = phi ptr [ @.str.2, %entry ], [ %9, %for.end.loopexit ], [ @.str.2, %land.lhs.true ] %call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 105, ptr nonnull %canvas) #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, !12} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.peeled.count", i32 1}
#include<stdio.h> int main() { int t,n,i; scanf("%d",&t); while(t--) { scanf("%d",&n); i=4*n; while(n--) { printf("%d ",i); i=i-2; } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18315/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18315/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 ; 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 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %dec13 = add nsw i32 %0, -1 store i32 %dec13, ptr %t, align 4, !tbaa !5 %tobool.not14 = icmp eq i32 %0, 0 br i1 %tobool.not14, label %while.end8, label %while.body while.body: ; preds = %entry, %while.end %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !5 %dec310 = add nsw i32 %1, -1 store i32 %dec310, ptr %n, align 4, !tbaa !5 %tobool4.not11 = icmp eq i32 %1, 0 br i1 %tobool4.not11, label %while.end, label %while.body5.preheader while.body5.preheader: ; preds = %while.body %mul = shl nsw i32 %1, 2 br label %while.body5 while.body5: ; preds = %while.body5.preheader, %while.body5 %i.012 = phi i32 [ %sub, %while.body5 ], [ %mul, %while.body5.preheader ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.012) %sub = add nsw i32 %i.012, -2 %.pr = load i32, ptr %n, align 4, !tbaa !5 %dec3 = add nsw i32 %.pr, -1 store i32 %dec3, ptr %n, align 4, !tbaa !5 %tobool4.not = icmp eq i32 %.pr, 0 br i1 %tobool4.not, label %while.end, label %while.body5, !llvm.loop !9 while.end: ; preds = %while.body5, %while.body %putchar = call i32 @putchar(i32 10) %2 = load i32, ptr %t, align 4, !tbaa !5 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %t, align 4, !tbaa !5 %tobool.not = icmp eq i32 %2, 0 br i1 %tobool.not, label %while.end8, label %while.body, !llvm.loop !11 while.end8: ; preds = %while.end, %entry 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: 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 declare noundef i32 @putchar(i32 noundef) 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 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> double v; double plays(double c, double m, double p) { double total = p; if (c < 1e-9) c = 0; if (m < 1e-9) m = 0; if (c > 0 && c <= v && m > 0) total += c * (1 + plays(0, m + c / 2, p + c / 2)); if (c > 0 && c <= v && m == 0) total += c * 2; if (c > 0 && c > v && m > 0) total += c * (1 + plays(c - v, m + v / 2, p + v / 2)); if (c > 0 && c > v && m == 0) total += c * (1 + plays(c - v, 0, p + v)); if (m > 0 && m <= v && c > 0) total += m * (1 + plays(c + m / 2, 0, p + m / 2)); if (m > 0 && m <= v && c == 0) total += m * 2; if (m > 0 && m > v && c > 0) total += m * (1 + plays(c + v / 2, m - v, p + v / 2)); if (m > 0 && m > v && c == 0) total += m * (1 + plays(0, m - v, p + v)); //printf("%f %f %f => %f\n", c, m, p, total); return total + 0; } int main(void) { int tc; scanf("%d", &tc); while (tc-- > 0) { double c, m, p; scanf("%lf %lf %lf %lf", &c, &m, &p, &v); printf("%0.12f\n", plays(c, m, p)); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18320/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18320/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" @v = dso_local global double 0.000000e+00, align 8 @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1 @.str.2 = private unnamed_addr constant [8 x i8] c"%0.12f\0A\00", align 1 ; Function Attrs: nofree nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local double @plays(double noundef %c, double noundef %m, double noundef %p) local_unnamed_addr #0 { entry: %cmp = fcmp olt double %c, 1.000000e-09 %c.addr.0 = select i1 %cmp, double 0.000000e+00, double %c %cmp1 = fcmp olt double %m, 1.000000e-09 %m.addr.0 = select i1 %cmp1, double 0.000000e+00, double %m %cmp4 = fcmp ogt double %c.addr.0, 0.000000e+00 br i1 %cmp4, label %land.lhs.true, label %if.end43 land.lhs.true: ; preds = %entry %0 = load double, ptr @v, align 8, !tbaa !5 %cmp5 = fcmp ole double %c.addr.0, %0 %cmp7 = fcmp ogt double %m.addr.0, 0.000000e+00 %or.cond = and i1 %cmp7, %cmp5 br i1 %or.cond, label %if.then8, label %land.lhs.true14 if.then8: ; preds = %land.lhs.true %div = fmul double %c.addr.0, 5.000000e-01 %add = fadd double %m.addr.0, %div %add10 = fadd double %div, %p %call = tail call double @plays(double noundef 0.000000e+00, double noundef %add, double noundef %add10) %add11 = fadd double %call, 1.000000e+00 %1 = tail call double @llvm.fmuladd.f64(double %c.addr.0, double %add11, double %p) br label %land.lhs.true14 land.lhs.true14: ; preds = %if.then8, %land.lhs.true %total.0.ph = phi double [ %p, %land.lhs.true ], [ %1, %if.then8 ] %cmp17 = fcmp oeq double %m.addr.0, 0.000000e+00 %or.cond90 = and i1 %cmp17, %cmp5 %2 = tail call double @llvm.fmuladd.f64(double %c.addr.0, double 2.000000e+00, double %total.0.ph) %total.1.ph = select i1 %or.cond90, double %2, double %total.0.ph %cmp22 = fcmp ogt double %c.addr.0, %0 %or.cond91 = and i1 %cmp7, %cmp22 br i1 %or.cond91, label %if.then25, label %land.lhs.true34 if.then25: ; preds = %land.lhs.true14 %sub = fsub double %c.addr.0, %0 %div26 = fmul double %0, 5.000000e-01 %add27 = fadd double %m.addr.0, %div26 %add29 = fadd double %div26, %p %call30 = tail call double @plays(double noundef %sub, double noundef %add27, double noundef %add29) %add31 = fadd double %call30, 1.000000e+00 %3 = tail call double @llvm.fmuladd.f64(double %c.addr.0, double %add31, double %total.1.ph) br label %land.lhs.true34 land.lhs.true34: ; preds = %if.then25, %land.lhs.true14 %total.2.ph = phi double [ %total.1.ph, %land.lhs.true14 ], [ %3, %if.then25 ] %or.cond92 = and i1 %cmp17, %cmp22 br i1 %or.cond92, label %if.then38, label %if.end43 if.then38: ; preds = %land.lhs.true34 %sub39 = fsub double %c.addr.0, %0 %add40 = fadd double %0, %p %call41 = tail call double @plays(double noundef %sub39, double noundef 0.000000e+00, double noundef %add40) %add42 = fadd double %call41, 1.000000e+00 %4 = tail call double @llvm.fmuladd.f64(double %c.addr.0, double %add42, double %total.2.ph) br label %if.end43 if.end43: ; preds = %entry, %if.then38, %land.lhs.true34 %total.3 = phi double [ %4, %if.then38 ], [ %total.2.ph, %land.lhs.true34 ], [ %p, %entry ] %cmp44 = fcmp ogt double %m.addr.0, 0.000000e+00 br i1 %cmp44, label %land.lhs.true45, label %if.end88 land.lhs.true45: ; preds = %if.end43 %5 = load double, ptr @v, align 8, !tbaa !5 %cmp46 = fcmp ole double %m.addr.0, %5 %or.cond93 = and i1 %cmp4, %cmp46 br i1 %or.cond93, label %if.then49, label %land.lhs.true58 if.then49: ; preds = %land.lhs.true45 %div50 = fmul double %m.addr.0, 5.000000e-01 %add51 = fadd double %c.addr.0, %div50 %add53 = fadd double %div50, %p %call54 = tail call double @plays(double noundef %add51, double noundef 0.000000e+00, double noundef %add53) %add55 = fadd double %call54, 1.000000e+00 %6 = tail call double @llvm.fmuladd.f64(double %m.addr.0, double %add55, double %total.3) br label %land.lhs.true58 land.lhs.true58: ; preds = %if.then49, %land.lhs.true45 %total.4.ph = phi double [ %total.3, %land.lhs.true45 ], [ %6, %if.then49 ] %cmp61 = fcmp oeq double %c.addr.0, 0.000000e+00 %or.cond94 = and i1 %cmp61, %cmp46 %7 = tail call double @llvm.fmuladd.f64(double %m.addr.0, double 2.000000e+00, double %total.4.ph) %total.5.ph = select i1 %or.cond94, double %7, double %total.4.ph %cmp66 = fcmp ogt double %m.addr.0, %5 %or.cond95 = and i1 %cmp4, %cmp66 br i1 %or.cond95, label %if.then69, label %land.lhs.true79 if.then69: ; preds = %land.lhs.true58 %div70 = fmul double %5, 5.000000e-01 %add71 = fadd double %c.addr.0, %div70 %sub72 = fsub double %m.addr.0, %5 %add74 = fadd double %div70, %p %call75 = tail call double @plays(double noundef %add71, double noundef %sub72, double noundef %add74) %add76 = fadd double %call75, 1.000000e+00 %8 = tail call double @llvm.fmuladd.f64(double %m.addr.0, double %add76, double %total.5.ph) br label %land.lhs.true79 land.lhs.true79: ; preds = %if.then69, %land.lhs.true58 %total.6.ph = phi double [ %total.5.ph, %land.lhs.true58 ], [ %8, %if.then69 ] %or.cond96 = and i1 %cmp61, %cmp66 br i1 %or.cond96, label %if.then83, label %if.end88 if.then83: ; preds = %land.lhs.true79 %sub84 = fsub double %m.addr.0, %5 %add85 = fadd double %5, %p %call86 = tail call double @plays(double noundef 0.000000e+00, double noundef %sub84, double noundef %add85) %add87 = fadd double %call86, 1.000000e+00 %9 = tail call double @llvm.fmuladd.f64(double %m.addr.0, double %add87, double %total.6.ph) br label %if.end88 if.end88: ; preds = %if.end43, %if.then83, %land.lhs.true79 %total.7 = phi double [ %9, %if.then83 ], [ %total.6.ph, %land.lhs.true79 ], [ %total.3, %if.end43 ] %add89 = fadd double %total.7, 0.000000e+00 ret double %add89 } ; 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 speculatable willreturn memory(none) declare double @llvm.fmuladd.f64(double, double, double) #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: %tc = alloca i32, align 4 %c = alloca double, align 8 %m = alloca double, align 8 %p = alloca double, align 8 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tc) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tc) %0 = load i32, ptr %tc, align 4, !tbaa !9 %dec4 = add nsw i32 %0, -1 store i32 %dec4, ptr %tc, align 4, !tbaa !9 %cmp5 = icmp sgt i32 %0, 0 br i1 %cmp5, label %while.body, label %while.end while.body: ; preds = %entry, %while.body call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #5 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p) #5 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c, ptr noundef nonnull %m, ptr noundef nonnull %p, ptr noundef nonnull @v) %1 = load double, ptr %c, align 8, !tbaa !5 %2 = load double, ptr %m, align 8, !tbaa !5 %3 = load double, ptr %p, align 8, !tbaa !5 %call2 = call double @plays(double noundef %1, double noundef %2, double noundef %3) %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call2) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5 %4 = load i32, ptr %tc, align 4, !tbaa !9 %dec = add nsw i32 %4, -1 store i32 %dec, ptr %tc, align 4, !tbaa !9 %cmp = icmp sgt i32 %4, 0 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tc) #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(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 willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!"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() { int n; scanf("%d", &n); printf(n / 10 == 9 || n % 10 == 9 ? "Yes\n" : "No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183243/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183243/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 [5 x i8] c"Yes\0A\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"No\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 %.off = add i32 %0, -90 %cmp = icmp ult i32 %.off, 10 br i1 %cmp, label %lor.end, label %lor.rhs lor.rhs: ; preds = %entry %rem = srem i32 %0, 10 %cmp1 = icmp eq i32 %rem, 9 %1 = select i1 %cmp1, ptr @.str.1, ptr @.str.2 br label %lor.end lor.end: ; preds = %lor.rhs, %entry %cond = phi ptr [ @.str.1, %entry ], [ %1, %lor.rhs ] %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond) 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"}
#include <stdio.h> int main(void){ int n; scanf("%d",&n); printf("%s\n",(n%10==9 || n/10==9)?"Yes":"No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183287/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183287/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.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.3 = 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: %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 %rem = srem i32 %0, 10 %cmp = icmp eq i32 %rem, 9 %.off = add i32 %0, -90 %cmp1 = icmp ult i32 %.off, 10 %1 = or i1 %cmp, %cmp1 %cond = select i1 %1, ptr @.str.2, ptr @.str.3 %puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond) 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 @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"}
#include<stdio.h> int main() { int N; scanf("%d",&N); if((N/10) %9==0) printf("Yes\n"); else if((N-9)%10==0) printf("Yes\n"); else printf("No\n"); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183337/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183337/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 = 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: 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 %div = sdiv i32 %0, 10 %rem = srem i32 %div, 9 %cmp = icmp eq i32 %rem, 0 br i1 %cmp, label %if.end8, label %if.else if.else: ; preds = %entry %sub = add nsw i32 %0, -9 %rem2 = srem i32 %sub, 10 %cmp3 = icmp eq i32 %rem2, 0 %str.3.str = select i1 %cmp3, ptr @str.4, ptr @str br label %if.end8 if.end8: ; preds = %if.else, %entry %str.3.sink = phi ptr [ @str.4, %entry ], [ %str.3.str, %if.else ] %puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) 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 @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"}
#include<stdio.h> #define ERROR -1 int main(){ int i; scanf("%d",&i); if(i<10||i>99)return ERROR; if(i/10==9||(i+1)%10==0){ printf("Yes\n"); }else{ printf("No\n"); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183380/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183380/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 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %i = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %0 = load i32, ptr %i, align 4 %1 = add i32 %0, -100 %or.cond = icmp ult i32 %1, -90 br i1 %or.cond, label %cleanup, label %if.end if.end: ; preds = %entry %.off = add nsw i32 %0, -90 %cmp2 = icmp ult i32 %.off, 10 br i1 %cmp2, label %cleanup.sink.split, label %lor.lhs.false3 lor.lhs.false3: ; preds = %if.end %2 = trunc i32 %0 to i8 %rem.lhs.trunc = add nuw nsw i8 %2, 1 %rem10 = urem i8 %rem.lhs.trunc, 10 %cmp4 = icmp eq i8 %rem10, 0 %spec.select = select i1 %cmp4, ptr @str.3, ptr @str br label %cleanup.sink.split cleanup.sink.split: ; preds = %lor.lhs.false3, %if.end %str.3.sink = phi ptr [ @str.3, %if.end ], [ %spec.select, %lor.lhs.false3 ] %puts9 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink) br label %cleanup cleanup: ; preds = %cleanup.sink.split, %entry %retval.0 = phi i32 [ -1, %entry ], [ 0, %cleanup.sink.split ] call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #4 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: 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)"}
#include<stdio.h> int main() { int a,b,c; scanf("%d",&a); b = a/10; c = a - b*10; if(b==9){ printf("Yes\n"); return 0; }else if(c==9){ printf("Yes\n"); return 0; } printf("No\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183423/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183423/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 = 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: 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) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %0 = load i32, ptr %a, align 4, !tbaa !5 %.fr = freeze i32 %0 %.off = add i32 %.fr, -90 %cmp = icmp ult i32 %.off, 10 br i1 %cmp, label %cleanup, label %if.else if.else: ; preds = %entry %1 = srem i32 %.fr, 10 %cmp2 = icmp eq i32 %1, 9 %str.3.str = select i1 %cmp2, ptr @str.4, ptr @str br label %cleanup cleanup: ; preds = %if.else, %entry %str.sink = phi ptr [ @str.4, %entry ], [ %str.3.str, %if.else ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) 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: 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"}